Skip to content

Commit d785aa3

Browse files
authored
MAINT: Remove unused imports and unreachable code (numpy#18762)
* Remove unnecessary imports and minor fixes
1 parent 3d83143 commit d785aa3

File tree

7 files changed

+1
-13
lines changed

7 files changed

+1
-13
lines changed

numpy/compat/py3k.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
import os
2121
from pathlib import Path
2222
import io
23-
24-
import abc
25-
from abc import ABC as abc_ABC
26-
2723
try:
2824
import pickle5 as pickle
2925
except ImportError:

numpy/core/multiarray.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
"""
88

99
import functools
10-
import warnings
11-
1210
from . import overrides
1311
from . import _multiarray_umath
1412
from ._multiarray_umath import * # noqa: F403

numpy/lib/format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def _read_array_header(fp, version):
606606
if EXPECTED_KEYS != d.keys():
607607
keys = sorted(d.keys())
608608
msg = "Header does not contain the correct keys: {!r}"
609-
raise ValueError(msg.format(d.keys()))
609+
raise ValueError(msg.format(keys))
610610

611611
# Sanity-check the values.
612612
if (not isinstance(d['shape'], tuple) or

numpy/lib/index_tricks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ def __getitem__(self, key):
201201
length = int(step)
202202
if step != 1:
203203
step = (key.stop-start)/float(step-1)
204-
stop = key.stop + step
205204
return _nx.arange(0, length, 1, float)*step + start
206205
else:
207206
return _nx.arange(start, stop, step)

numpy/ma/extras.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,6 @@ def _median(a, axis=None, out=None, overwrite_input=False):
743743
return np.ma.mean(asorted[indexer], axis=axis, out=out)
744744

745745
if asorted.ndim == 1:
746-
counts = count(asorted)
747746
idx, odd = divmod(count(asorted), 2)
748747
mid = asorted[idx + odd - 1:idx + 1]
749748
if np.issubdtype(asorted.dtype, np.inexact) and asorted.size > 0:

numpy/ma/mrecords.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def __new__(cls, shape, dtype=None, buf=None, offset=0, strides=None,
129129
msg = "Mask and data not compatible: data size is %i, " + \
130130
"mask size is %i."
131131
raise MAError(msg % (nd, nm))
132-
copy = True
133132
if not keep_mask:
134133
self.__setmask__(mask)
135134
self._sharedmask = True

numpy/typing/_array_like.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import sys
44
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
5-
65
from numpy import (
76
ndarray,
87
dtype,
@@ -20,9 +19,7 @@
2019
str_,
2120
bytes_,
2221
)
23-
2422
from . import _HAS_TYPING_EXTENSIONS
25-
from ._dtype_like import DTypeLike
2623

2724
if sys.version_info >= (3, 8):
2825
from typing import Protocol

0 commit comments

Comments
 (0)