From b2778a8a6d99dfbfee8f09daf6c069d1acf1aa8d Mon Sep 17 00:00:00 2001 From: Bas van Beek Date: Sat, 5 Dec 2020 13:22:39 +0100 Subject: MAINT: Replace `contextlib_nullcontext` with `contextlib.nullcontext` --- numpy/core/_methods.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'numpy/core/_methods.py') 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: -- cgit v1.2.1