summaryrefslogtreecommitdiff
path: root/numpy/core/_methods.py
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2020-12-05 13:22:39 +0100
committerBas van Beek <b.f.van.beek@vu.nl>2020-12-05 13:22:39 +0100
commitb2778a8a6d99dfbfee8f09daf6c069d1acf1aa8d (patch)
tree2691fb225b407e81b9012cfdc1fbfa59a089b019 /numpy/core/_methods.py
parent45840adcf20eabc665d2fc17f28bf93e75bdf20a (diff)
downloadnumpy-b2778a8a6d99dfbfee8f09daf6c069d1acf1aa8d.tar.gz
MAINT: Replace `contextlib_nullcontext` with `contextlib.nullcontext`
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r--numpy/core/_methods.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py
index c730e2035..1867ba68c 100644
--- a/numpy/core/_methods.py
+++ b/numpy/core/_methods.py
@@ -4,6 +4,7 @@ and the Python code for the NumPy-namespace function
"""
import warnings
+from contextlib import nullcontext
from numpy.core import multiarray as mu
from numpy.core import umath as um
@@ -11,7 +12,7 @@ from numpy.core._asarray import asanyarray
from numpy.core import numerictypes as nt
from numpy.core import _exceptions
from numpy._globals import _NoValue
-from numpy.compat import pickle, os_fspath, contextlib_nullcontext
+from numpy.compat import pickle, os_fspath
# save those O(100) nanoseconds!
umr_maximum = um.maximum.reduce
@@ -279,7 +280,7 @@ def _ptp(a, axis=None, out=None, keepdims=False):
def _dump(self, file, protocol=2):
if hasattr(file, 'write'):
- ctx = contextlib_nullcontext(file)
+ ctx = nullcontext(file)
else:
ctx = open(os_fspath(file), "wb")
with ctx as f: