8000 Clean up location check · matplotlib/matplotlib@2e4b17e · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e4b17e

Browse files
committed
Clean up location check
1 parent 508c78c commit 2e4b17e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/offsetbox.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,12 +1043,12 @@ def __init__(self, loc,
10431043
self.set_child(child)
10441044

10451045
if is_string_like(loc):
1046-
if loc not in self.codes:
1046+
try:
1047+
loc = self.codes[loc]
1048+
except KeyError:
10471049
raise RuntimeError('Unrecognized location "%s". Valid '
10481050
'locations are\n\t%s\n'
10491051
% (loc, '\n\t'.join(self.codes)))
1050-
else:
1051-
loc = self.codes[loc]
10521052

10531053
self.loc = loc
10541054
self.borderpad = borderpad

0 commit comments

Comments
 (0)
0