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

Skip to content

Commit 73c22bc

Browse files
committed
MAINT Use attribute access so errors are caught
1 parent d0e3a94 commit 73c22bc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/matplotlib/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def _sanitize_extrema(ex):
107107
if ex is None:
108108
return ex
109109
try:
110-
ret = np.ndarray.item(ex)
110+
ret = ex.item()
111111
except AttributeError:
112112
ret = float(ex)
113113
return ret

lib/matplotlib/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
412412
A_scaled -= a_min
413413
# a_min and a_max might be ndarray subclasses so use
414414
# item to avoid errors
415-
a_min = np.ndarray.item(a_min.astype(scaled_dtype))
416-
a_max = np.ndarray.item(a_max.astype(scaled_dtype))
415+
a_min = a_min.astype(scaled_dtype).item()
416+
a_max = a_max.astype(scaled_dtype).item()
417417

418418
if a_min != a_max:
419419
A_scaled /= ((a_max - a_min) / 0.8)

0 commit comments

Comments
 (0)