8000 Modified according to @tacaswell comments · matplotlib/matplotlib@41bf6b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41bf6b5

Browse files
committed
Modified according to @tacaswell comments
1 parent 088542e commit 41bf6b5

File tree

7 files changed

+19
-20
lines changed

7 files changed

+19
-20
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,8 @@ def set_clip_path(self, path):
971971
"""
972972
if path is not None and not isinstance(path,
973973
transforms.TransformedPath):
974-
msg = "Path should be a matplotlib.transforms.TransformedPath \
975-
instance."
974+
msg = ("Path should be a matplotlib.transforms.TransformedPath"
975+
"instance.")
976976
raise ValueError(msg)
977977
self._clippath = path
978978

lib/matplotlib/blocking_input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def post_event(self):
149149
"""
150150
This will be called to process events
151151
"""
152-
if len(self.events) <= 0:
152+
if len(self.events) == 0:
153153
warnings.warn("No events yet")
154154
elif self.events[-1].name == 'key_press_event':
155155
self.key_event()
@@ -362,7 +362,7 @@ def post_event(self):
362362
"""
363363
Determines if it is a key event
364364
"""
365-
if len(self.events) <= 0:
365+
if len(self.events) == 0:
366366
warnings.warn("No events yet")
367367
else:
368368
self.keyormouse = self.events[-1].name == 'key_press_event'

lib/matplotlib/contour.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,11 @@ def __init__(self, ax, *args, **kwargs):
858858
self.logscale = False
859859

860860
if self.origin not in [None, 'lower', 'upper', 'image']:
861-
raise ValueError("If given, *origin* must be one of ['lower', \
862-
'upper', 'image']")
861+
raise ValueError("If given, *origin* must be one of ['lower',"
862+
" 'upper', 'image']")
863863
if self.extent is not None and len(self.extent) != 4:
864-
raise ValueError("If give, *extent* must be '[ *None* | \
865-
(x0,x1,y0,y1) ]'")
864+
raise ValueError("If given, *extent* must be '[ *None* |"
865+
" (x0,x1,y0,y1) ]'")
866866
if self.colors is not None and cmap is not None:
867867
raise ValueError('Either colors or cmap must be None')
868868
if self.origin == 'image':

lib/matplotlib/finance.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -860,18 +860,16 @@ def _missing(sequence, miss=-1):
860860
"""
861861
return np.where(np.array(sequence) == miss)[0]
862862

863-
same_length = (len(opens) == len(highs)) and (len(opens) == len(lows)) and\
864-
(len(opens) == len(closes))
863+
same_length = len(opens) == len(highs) == len(lows) == len(closes)
865864
_missopens = _missing(opens)
866-
same_missing = (_missopens == _missing(highs)).all() and (_missopens ==
867-
_missing(lows)).all() and (_missopens == _missing(closes)).all()
865+
same_missing = ((_missopens == _missing(highs)).all() and
866+
(_missopens == _missing(lows)).all() and
867+
(_missopens == _missing(closes)).all())
868868

869869
if not (same_length and same_missing):
870-
msg = """
871-
*opens*, *highs*, *lows* and *closes* must have the same length.
872-
NOTE: this code assumes if any value open, high, low, close is
873-
missing (*-1*) they all must be missing
874-
"""
870+
msg = ("*opens*, *highs*, *lows* and *closes* must have the same"
871+
" length. NOTE: this code assumes if any value open, high,"
872+
"low, close is missing (*-1*) they all must be missing.")
875873
raise ValueError(msg)
876874

877875

lib/matplotlib/patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,8 +3094,8 @@ def ensure_quadratic_bezier(path):
30943094
its control points if true.
30953095
"""
30963096
segments = list(path.iter_segments())
3097-
if (len(segments) != 2) or (segments[0][1] != Path.MOVETO) or\
3098-
(segments[1][1] != Path.CURVE3):
3097+
if ((len(segments) != 2) or (segments[0][1] != Path.MOVETO) or
3098+
(segments[1][1] != Path.CURVE3)):
30993099
msg = "'path' it's not a valid quadratic bezier curve"
31003100
raise ValueError(msg)
31013101

lib/matplotlib/transforms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,6 +2465,7 @@ def __init__(self, boxin, boxout, **kwargs):
24652465
"""
24662466
if not boxin.is_bbox or not boxout.is_bbox:
24672467
msg = "'boxin' and 'boxout' must be bbox"
2468+
raise ValueError(msg)
24682469

24692470
Affine2DBase.__init__(self, **kwargs)
24702471
self._boxin = boxin

lib/matplotlib/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
13071307
rectprops = dict(facecolor='red', alpha=0.5)
13081308

13091309
if direction not in ['horizontal', 'vertical']:
1310-
raise ValueError('Must choose horizontal or vertical for direction')
1310+
raise ValueError("direction must be in ['horizontal', 'vertical']")
13111311
self.direction = direction
13121312

13131313
self.rect = None

0 commit comments

Comments
 (0)
0