8000 Change elif to else · matplotlib/matplotlib@9bb0c9e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9bb0c9e

Browse files
committed
Change elif to else
1 parent 2e5a310 commit 9bb0c9e

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ def new_locator(self, nx, ny, nx1=None, ny1=None):
250250
ny1 if ny1 is not None else ny + 1)
251251

252252
def append_size(self, position, size):
253+
_api.check_in_list(["left", "right", "bottom", "top"],
254+
position=position)
253255
if position == "left":
254256
self._horizontal.insert(0, size)
255257
self._xrefindex += 1
@@ -258,11 +260,8 @@ def append_size(self, position, size):
258260
elif position == "bottom":
259261
self._vertical.insert(0, size)
260262
self._yrefindex += 1
261-
elif position == "top":
263+
else: # 'top'
262264
self._vertical.append(size)
263-
else:
264-
_api.check_in_list(["left", "right", "bottom", "top"],
265-
position=position)
266265

267266
def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
268267
"""
@@ -512,6 +511,8 @@ def append_axes(self, position, size, pad=None, add_to_figure=True, *,
512511
**kwargs
513512
All extra keywords arguments are passed to the created axes.
514513
"""
514+
_api.check_in_list(["left", "right", "bottom", "top"],
515+
position=position)
515516
if position == "left":
516517
ax = self.new_horizontal(
517518
size, pad, pack_start=True, axes_class=axes_class, **kwargs)
@@ -521,12 +522,9 @@ def append_axes(self, position, size, pad=None, add_to_figure=True, *,
521522
elif position == "bottom":
522523
ax = self.new_vertical(
523524
size, pad, pack_start=True, axes_class=axes_class, **kwargs)
524-
elif position == "top":
525+
else: # "top"
525526
ax = self.new_vertical(
526527
size, pad, pack_start=False, axes_class=axes_class, **kwargs)
527-
else:
528-
_api.check_in_list(["left", "right", "bottom", "top"],
529-
position=position)
530528
if add_to_figure:
531529
self._fig.add_axes(ax)
532530
return ax

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ def set_proj_type(self, proj_type, focal_length=None):
813813
raise ValueError(f"focal_length = {focal_length} must be "
814814
"greater than 0")
815815
self._focal_length = focal_length
816-
elif proj_type == 'ortho':
816+
else: # 'ortho':
817817
if focal_length not in (None, np.inf):
818818
raise ValueError(f"focal_length = {focal_length} must be "
819819
f"None for proj_type = {proj_type}")

0 commit comments

Comments
 (0)
0