summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2022-05-18 23:16:50 +0300
committerGitHub <noreply@github.com>2022-05-18 23:16:50 +0300
commit6932eff2c2f634e9b88e940b9f5c02a24b6e71f6 (patch)
tree1658a687c7c5fe15aa72e967e2845a38f51868e8 /numpy/lib
parent59aad3cf436691d447e43038e3402500f13cd817 (diff)
parentae1648437863aa322785dac60f33db86fa028e99 (diff)
downloadnumpy-6932eff2c2f634e9b88e940b9f5c02a24b6e71f6.tar.gz
Merge pull request #16830 from bsipocz/python2_cleanup
MAINT: more python <3.6 cleanup
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/format.py3
-rw-r--r--numpy/lib/npyio.py20
2 files changed, 1 insertions, 22 deletions
diff --git a/numpy/lib/format.py b/numpy/lib/format.py
index 264fff8d6..625768b62 100644
--- a/numpy/lib/format.py
+++ b/numpy/lib/format.py
@@ -370,8 +370,7 @@ def _wrap_header(header, version):
import struct
assert version is not None
fmt, encoding = _header_size_info[version]
- if not isinstance(header, bytes): # always true on python 3
- header = header.encode(encoding)
+ header = header.encode(encoding)
hlen = len(header) + 1
padlen = ARRAY_ALIGN - ((MAGIC_LEN + struct.calcsize(fmt) + hlen) % ARRAY_ALIGN)
try:
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 33b49127c..210c0ea94 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -250,26 +250,6 @@ class NpzFile(Mapping):
else:
raise KeyError("%s is not a file in the archive" % key)
- # deprecate the python 2 dict apis that we supported by accident in
- # python 3. We forgot to implement itervalues() at all in earlier
- # versions of numpy, so no need to deprecated it here.
-
- def iteritems(self):
- # Numpy 1.15, 2018-02-20
- warnings.warn(
- "NpzFile.iteritems is deprecated in python 3, to match the "
- "removal of dict.itertems. Use .items() instead.",
- DeprecationWarning, stacklevel=2)
- return self.items()
-
- def iterkeys(self):
- # Numpy 1.15, 2018-02-20
- warnings.warn(
- "NpzFile.iterkeys is deprecated in python 3, to match the "
- "removal of dict.iterkeys. Use .keys() instead.",
- DeprecationWarning, stacklevel=2)
- return self.keys()
-
@set_module('numpy')
def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True,