Skip to content

Commit 43f2f7c

Browse files
committed
alltrue and sometrue are known as all and any.
1 parent 338f6da commit 43f2f7c

File tree

4 files changed

+7
-22
lines changed

4 files changed

+7
-22
lines changed

lib/matplotlib/backends/backend_ps.py

+1-15
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,7 @@ def quote_ps_string(s):
170170
return s.decode('ascii')
171171

172172

173-
def seq_allequal(seq1, seq2):
174-
"""
175-
seq1 and seq2 are either None or sequences or arrays
176-
Return True if both are None or both are seqs with identical
177-
elements
178-
"""
179-
if seq1 is None:
180-
return seq2 is None
181-
182-
if seq2 is None:
183-
return False
184-
#ok, neither are None:, assuming iterable
185-
186-
if len(seq1) != len(seq2): return False
187-
return np.alltrue(np.equal(seq1, seq2))
173+
seq_allequal = np.array_equal
188174

189175

190176
class RendererPS(RendererBase):

lib/matplotlib/colors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ def _init(self):
561561
def is_gray(self):
562562
if not self._isinit:
563563
self._init()
564-
return (np.alltrue(self._lut[:, 0] == self._lut[:, 1]) and
565-
np.alltrue(self._lut[:, 0] == self._lut[:, 2]))
564+
return (np.all(self._lut[:, 0] == self._lut[:, 1]) and
565+
np.all(self._lut[:, 0] == self._lut[:, 2]))
566566

567567
def _resample(self, lutsize):
568568
"""

lib/matplotlib/figure.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
457457
*ha*
458458
The horizontal alignment of the xticklabels
459459
"""
460-
allsubplots = np.alltrue([hasattr(ax, 'is_last_row') for ax
461-
in self.axes])
460+
allsubplots = all(hasattr(ax, 'is_last_row') for ax in self.axes)
462461
if len(self.axes) == 1:
463462
for label in self.axes[0].get_xticklabels():
464463
label.set_ha(ha)

lib/mpl_toolkits/mplot3d/proj3d.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ def proj_transform_vec_clip(vec, M):
136136
w = vecw[3]
137137
# clip here..
138138
txs, tys, tzs = vecw[0]/w, vecw[1]/w, vecw[2]/w
139-
tis = (vecw[0] >= 0) * (vecw[0] <= 1) * (vecw[1] >= 0) * (vecw[1] <= 1)
140-
if np.sometrue(tis):
141-
tis = vecw[1] < 1
139+
tis = (vecw[0] >= 0) & (vecw[0] <= 1) & (vecw[1] >= 0) & (vecw[1] <= 1)
140+
if np.any(tis):
141+
tis = vecw[1] < 1
142142
return txs, tys, tzs, tis
143143

144144
def inv_transform(xs, ys, zs, M):

0 commit comments

Comments
 (0)