8000 `a and b or c` -> `b if a else c` · matplotlib/matplotlib@143f700 · GitHub
[go: up one dir, main page]

Skip to content

Commit 143f700

Browse files
committed
a and b or c -> b if a else c
1 parent c94d0ed commit 143f700

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

examples/tests/backend_driver_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def drive(backend, directories, python=['python'], switches=[]):
418418

419419

420420
def parse_options():
421-
doc = (__doc__ and __doc__.split('\n\n')) or " "
421+
doc = __doc__.split("\n\n") if __doc__ else " "
422422
op = OptionParser(description=doc[0].strip(),
423423
usage='%prog [options] [--] [backends and switches]',
424424
#epilog='\n'.join(doc[1:]) # epilog not supported on my python2.4 machine: JDH

lib/matplotlib/axes/_axes.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,17 +2996,17 @@ def get_next_color():
29962996
if labeldistance is not None:
29972997
xt = x + labeldistance * radius * math.cos(thetam)
29982998
yt = y + labeldistance * radius * math.sin(thetam)
2999-
label_alignment_h = xt > 0 and 'left' or 'right'
2999+
label_alignment_h = 'left' if xt > 0 else 'right'
30003000
label_alignment_v = 'center'
30013001
label_rotation = 'horizontal'
30023002
if rotatelabels:
3003-
label_alignment_v = yt > 0 and 'bottom' or 'top'
3004-
label_rotation = np.rad2deg(thetam) + (0 if xt > 0
3005-
else 180)
3003+
label_alignment_v = 'bottom' if yt > 0 else 'top'
3004+
label_rotation CC11 = (np.rad2deg(thetam)
3005+
+ (0 if xt > 0 else 180))
30063006
props = dict(horizontalalignment=label_alignment_h,
3007-
verticalalignment=label_alignment_v,
3008-
rotation=label_rotation,
3009-
size=rcParams['xtick.labelsize'])
3007+
verticalalignment=label_alignment_v,
3008+
rotation=label_rotation,
3009+
size=rcParams['xtick.labelsize'])
30103010
props.update(textprops)
30113011

30123012
t = self.text(xt, yt, label, **props)

lib/matplotlib/hatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __init__(self, hatch, density):
9898
(self.num_rows // 2) * (self.num_rows))
9999
self.num_vertices = (self.num_shapes *
100100
len(self.shape_vertices) *
101-
(self.filled and 1 or 2))
101+
(1 if self.filled else 2))
102102

103103
def set_vertices_and_codes(self, vertices, codes):
104104
offset = 1.0 / self.num_rows

0 commit comments

Comments
 (0)
0