Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed69d98

Browse files
authored
Merge pull request #14351 from anntzer/redundant-check-in-list
Remove some redundant check_in_list calls.
2 parents d888c07 + a1c0d69 commit ed69d98

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

lib/matplotlib/scale.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ class LogitTransform(Transform):
617617

618618
def __init__(self, nonpos='mask'):
619619
Transform.__init__(self)
620+
cbook._check_in_list(['mask', 'clip'], nonpos=nonpos)
620621
self._nonpos = nonpos
621622
self._clip = {"clip": True, "mask": False}[nonpos]
622623

@@ -633,8 +634,7 @@ def inverted(self):
633634
return LogisticTransform(self._nonpos)
634635

635636
def __str__(self):
636-
return "{}({!r})".format(type(self).__name__,
637-
"clip" if self._clip else "mask")
637+
return "{}({!r})".format(type(self).__name__, self._nonpos)
638638

639639

640640
class LogisticTransform(Transform):
@@ -673,7 +673,6 @@ def __init__(self, axis, nonpos='mask'):
673673
values beyond ]0, 1[ can be masked as invalid, or clipped to a number
674674
very close to 0 or 1
675675
"""
676-
cbook._check_in_list(['mask', 'clip'], nonpos=nonpos)
677676
self._transform = LogitTransform(nonpos)
678677

679678
def get_transform(self):

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ def set_axis_direction(self, d):
471471
Adjust the text angle and text alignment of axis label
472472
according to the matplotlib convention.
473473
474-
475474
===================== ========== ========= ========== ==========
476475
property left bottom right top
477476
===================== ========== ========= ========== ==========
@@ -483,9 +482,7 @@ def set_axis_direction(self, d):
483482
Note that the text angles are actually relative to (90 + angle
484483
of the direction to the ticklabel), which gives 0 for bottom
485484
axis.
486-
487485
"""
488-
cbook._check_in_list(["left", "right", "top", "bottom"], d=d)
489486
self.set_default_alignment(d)
490487
self.set_default_angle(d)
491488

@@ -555,11 +552,9 @@ def set_axis_direction(self, label_direction):
555552
of the direction to the ticklabel), which gives 0 for bottom
556553
axis.
557554
"""
558-
cbook._check_in_list(["left", "right", "top", "bottom"],
559-
label_direction=label_direction)
560-
self._axis_direction = label_direction
561555
self.set_default_alignment(label_direction)
562556
self.set_default_angle(label_direction)
557+
self._axis_direction = label_direction
563558

564559
def invert_axis_direction(self):
565560
label_direction = self._get_opposite_direction(self._axis_direction)
@@ -836,17 +831,15 @@ def set_axis_direction(self, axis_direction):
836831
relative to (90 + angle of the direction to the ticklabel),
837832
which gives 0 for bottom axis.
838833
"""
839-
cbook._check_in_list(["left", "right", "top", "bottom"],
840-
axis_direction=axis_direction)
834+
self.major_ticklabels.set_axis_direction(axis_direction)
835+
self.label.set_axis_direction(axis_direction)
841836
self._axis_direction = axis_direction
842837
if axis_direction in ["left", "top"]:
843838
self.set_ticklabel_direction("-")
844839
self.set_axislabel_direction("-")
845840
else:
846841
self.set_ticklabel_direction("+")
847842
self.set_axislabel_direction("+")
848-
self.major_ticklabels.set_axis_direction(axis_direction)
849-
self.label.set_axis_direction(axis_direction)
850843

851844
def set_ticklabel_direction(self, tick_direction):
852845
r"""

0 commit comments

Comments
 (0)