summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorWarren Weckesser <warren.weckesser@gmail.com>2020-01-23 13:48:38 -0500
committerWarren Weckesser <warren.weckesser@gmail.com>2020-01-23 14:05:15 -0500
commit021163b5e2293286b26d22bdae51305da634e74d (patch)
treedea44e19f7bbbeda64a219506fdcf8088e449ea6 /numpy
parent04ac2a13b302a7af6fe2a5ca67e09a0e09a0f8e7 (diff)
downloadnumpy-021163b5e2293286b26d22bdae51305da634e74d.tar.gz
MAINT: Clean up, mostly unused imports.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/_add_newdocs.py1
-rw-r--r--numpy/core/_exceptions.py1
-rw-r--r--numpy/core/arrayprint.py4
-rw-r--r--numpy/core/fromnumeric.py1
-rw-r--r--numpy/core/multiarray.py3
-rw-r--r--numpy/core/numeric.py3
-rw-r--r--numpy/core/records.py1
-rw-r--r--numpy/core/setup_common.py1
-rw-r--r--numpy/core/tests/test_arrayprint.py1
-rw-r--r--numpy/core/tests/test_defchararray.py3
-rw-r--r--numpy/core/tests/test_deprecations.py2
-rw-r--r--numpy/core/tests/test_function_base.py1
-rw-r--r--numpy/core/tests/test_indexing.py1
-rw-r--r--numpy/core/tests/test_mem_overlap.py1
-rw-r--r--numpy/core/tests/test_scalar_ctors.py6
-rw-r--r--numpy/core/tests/test_scalar_methods.py8
-rw-r--r--numpy/core/tests/test_scalarbuffer.py1
-rw-r--r--numpy/core/tests/test_scalarprint.py2
-rw-r--r--numpy/core/tests/test_shape_base.py1
-rw-r--r--numpy/core/tests/test_unicode.py2
-rw-r--r--numpy/distutils/ccompiler.py1
-rw-r--r--numpy/lib/_datasource.py1
-rw-r--r--numpy/lib/format.py2
-rw-r--r--numpy/lib/tests/test__datasource.py5
-rw-r--r--numpy/lib/tests/test_mixins.py1
-rw-r--r--numpy/lib/tests/test_regression.py1
-rw-r--r--numpy/polynomial/chebyshev.py2
-rw-r--r--numpy/polynomial/hermite.py1
-rw-r--r--numpy/polynomial/hermite_e.py1
-rw-r--r--numpy/polynomial/laguerre.py1
-rw-r--r--numpy/polynomial/legendre.py1
-rw-r--r--numpy/polynomial/polynomial.py1
32 files changed, 10 insertions, 52 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py
index cb68b8360..87ae96fa0 100644
--- a/numpy/core/_add_newdocs.py
+++ b/numpy/core/_add_newdocs.py
@@ -8,7 +8,6 @@ NOTE: Many of the methods of ndarray have corresponding functions.
core/fromnumeric.py, core/defmatrix.py up-to-date.
"""
-import sys
from numpy.core import numerictypes as _numerictypes
from numpy.core import dtype
diff --git a/numpy/core/_exceptions.py b/numpy/core/_exceptions.py
index 88a45561f..99172e23d 100644
--- a/numpy/core/_exceptions.py
+++ b/numpy/core/_exceptions.py
@@ -157,7 +157,6 @@ class _ArrayMemoryError(MemoryError):
@staticmethod
def _size_to_string(num_bytes):
""" Convert a number of bytes into a binary size string """
- import math
# https://en.wikipedia.org/wiki/Binary_prefix
LOG2_STEP = 10
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index ec7e4261f..456ef76f0 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -31,12 +31,12 @@ except ImportError:
import numpy as np
from . import numerictypes as _nt
-from .umath import absolute, not_equal, isnan, isinf, isfinite, isnat
+from .umath import absolute, isinf, isfinite, isnat
from . import multiarray
from .multiarray import (array, dragon4_positional, dragon4_scientific,
datetime_as_string, datetime_data, ndarray,
set_legacy_print_mode)
-from .fromnumeric import ravel, any
+from .fromnumeric import any
from .numeric import concatenate, asarray, errstate
from .numerictypes import (longlong, intc, int_, float_, complex_, bool_,
flexible)
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 213a4438f..46dd961d8 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -6,7 +6,6 @@ import types
import warnings
import numpy as np
-from .. import VisibleDeprecationWarning
from . import multiarray as mu
from . import overrides
from . import umath as um
diff --git a/numpy/core/multiarray.py b/numpy/core/multiarray.py
index d8adc640e..d50c53e30 100644
--- a/numpy/core/multiarray.py
+++ b/numpy/core/multiarray.py
@@ -7,13 +7,10 @@ by importing from the extension module.
"""
import functools
-import sys
import warnings
-import sys
from . import overrides
from . import _multiarray_umath
-import numpy as np
from ._multiarray_umath import * # noqa: F403
from ._multiarray_umath import (
_fastCopyAndTranspose, _flagdict, _insert, _reconstruct, _vec_string,
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 72c6089b8..f1d7d48f1 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -4,10 +4,9 @@ import operator
import sys
import warnings
import numbers
-import contextlib
import numpy as np
-from numpy.compat import pickle, basestring
+from numpy.compat import basestring
from . import multiarray
from .multiarray import (
_fastCopyAndTranspose as fastCopyAndTranspose, ALLOW_THREADS,
diff --git a/numpy/core/records.py b/numpy/core/records.py
index d4aa2feb9..fbef40f72 100644
--- a/numpy/core/records.py
+++ b/numpy/core/records.py
@@ -33,7 +33,6 @@ Record arrays allow us to access fields as properties::
array([2., 2.])
"""
-import sys
import os
import warnings
from collections import Counter, OrderedDict
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
index 08337a81e..7cac66e61 100644
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -2,7 +2,6 @@
import sys
import warnings
import copy
-import binascii
import textwrap
from numpy.distutils.misc_util import mingw32
diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py
index 96240be0f..cd3e501a5 100644
--- a/numpy/core/tests/test_arrayprint.py
+++ b/numpy/core/tests/test_arrayprint.py
@@ -837,7 +837,6 @@ class TestPrintOptions:
assert_raises(TypeError, np.set_printoptions, threshold=b'1')
def test_unicode_object_array():
- import sys
expected = "array(['é'], dtype=object)"
x = np.array([u'\xe9'], dtype=object)
assert_equal(repr(x), expected)
diff --git a/numpy/core/tests/test_defchararray.py b/numpy/core/tests/test_defchararray.py
index 4c9016c3e..39600553d 100644
--- a/numpy/core/tests/test_defchararray.py
+++ b/numpy/core/tests/test_defchararray.py
@@ -1,10 +1,9 @@
-import sys
import numpy as np
from numpy.core.multiarray import _vec_string
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_raises,
- assert_raises_regex, suppress_warnings,
+ assert_raises_regex
)
kw_unicode_true = {'unicode': True} # make 2to3 work properly
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py
index 252133d7b..01b35ec90 100644
--- a/numpy/core/tests/test_deprecations.py
+++ b/numpy/core/tests/test_deprecations.py
@@ -4,11 +4,9 @@ to document how deprecations should eventually be turned into errors.
"""
import datetime
-import sys
import operator
import warnings
import pytest
-import shutil
import tempfile
import numpy as np
diff --git a/numpy/core/tests/test_function_base.py b/numpy/core/tests/test_function_base.py
index 7e5ea1cc6..2197ef0cd 100644
--- a/numpy/core/tests/test_function_base.py
+++ b/numpy/core/tests/test_function_base.py
@@ -4,7 +4,6 @@ from numpy import (
)
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_array_equal, assert_allclose,
- suppress_warnings
)
diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py
index 237e381a7..4bb5cb11a 100644
--- a/numpy/core/tests/test_indexing.py
+++ b/numpy/core/tests/test_indexing.py
@@ -2,7 +2,6 @@ import sys
import warnings
import functools
import operator
-import pytest
import numpy as np
from numpy.core._multiarray_tests import array_indexing
diff --git a/numpy/core/tests/test_mem_overlap.py b/numpy/core/tests/test_mem_overlap.py
index d3b58d8e8..3e9875f5b 100644
--- a/numpy/core/tests/test_mem_overlap.py
+++ b/numpy/core/tests/test_mem_overlap.py
@@ -1,4 +1,3 @@
-import sys
import itertools
import pytest
diff --git a/numpy/core/tests/test_scalar_ctors.py b/numpy/core/tests/test_scalar_ctors.py
index d3592a5fc..2de5084b6 100644
--- a/numpy/core/tests/test_scalar_ctors.py
+++ b/numpy/core/tests/test_scalar_ctors.py
@@ -1,13 +1,9 @@
"""
Test the scalar constructors, which also do type-coercion
"""
-import sys
-import platform
-import pytest
-
import numpy as np
from numpy.testing import (
- assert_equal, assert_almost_equal, assert_raises, assert_warns,
+ assert_equal, assert_almost_equal, assert_warns,
)
class TestFromString:
diff --git a/numpy/core/tests/test_scalar_methods.py b/numpy/core/tests/test_scalar_methods.py
index c9de3e402..4f5fd2988 100644
--- a/numpy/core/tests/test_scalar_methods.py
+++ b/numpy/core/tests/test_scalar_methods.py
@@ -1,18 +1,14 @@
"""
Test the scalar constructors, which also do type-coercion
"""
-import os
import fractions
import platform
import pytest
import numpy as np
-from numpy.testing import (
- run_module_suite,
- assert_equal, assert_almost_equal, assert_raises, assert_warns,
- dec
-)
+from numpy.testing import assert_equal, assert_raises
+
class TestAsIntegerRatio:
# derived in part from the cpython test "test_floatasratio"
diff --git a/numpy/core/tests/test_scalarbuffer.py b/numpy/core/tests/test_scalarbuffer.py
index bda1c5333..b8c6dd4aa 100644
--- a/numpy/core/tests/test_scalarbuffer.py
+++ b/numpy/core/tests/test_scalarbuffer.py
@@ -1,7 +1,6 @@
"""
Test scalar buffer interface adheres to PEP 3118
"""
-import sys
import numpy as np
import pytest
diff --git a/numpy/core/tests/test_scalarprint.py b/numpy/core/tests/test_scalarprint.py
index 3293d0426..d042eef8b 100644
--- a/numpy/core/tests/test_scalarprint.py
+++ b/numpy/core/tests/test_scalarprint.py
@@ -8,7 +8,7 @@ import pytest
from tempfile import TemporaryFile
import numpy as np
-from numpy.testing import assert_, assert_equal, suppress_warnings
+from numpy.testing import assert_, assert_equal
class TestRealScalars:
def test_str(self):
diff --git a/numpy/core/tests/test_shape_base.py b/numpy/core/tests/test_shape_base.py
index 7c23c7128..738260327 100644
--- a/numpy/core/tests/test_shape_base.py
+++ b/numpy/core/tests/test_shape_base.py
@@ -1,5 +1,4 @@
import pytest
-import sys
import numpy as np
from numpy.core import (
array, arange, atleast_1d, atleast_2d, atleast_3d, block, vstack, hstack,
diff --git a/numpy/core/tests/test_unicode.py b/numpy/core/tests/test_unicode.py
index f16789148..ac065d5d6 100644
--- a/numpy/core/tests/test_unicode.py
+++ b/numpy/core/tests/test_unicode.py
@@ -1,5 +1,3 @@
-import sys
-
import numpy as np
from numpy.compat import unicode
from numpy.testing import assert_, assert_equal, assert_array_equal
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index dc7ae6d46..9ea083774 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -1,7 +1,6 @@
import os
import re
import sys
-import types
import shlex
import time
import subprocess
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py
index 139b8c0ca..cb337ce83 100644
--- a/numpy/lib/_datasource.py
+++ b/numpy/lib/_datasource.py
@@ -36,7 +36,6 @@ Example::
"""
import os
import sys
-import warnings
import shutil
import io
from contextlib import closing
diff --git a/numpy/lib/format.py b/numpy/lib/format.py
index 114bae287..b31340314 100644
--- a/numpy/lib/format.py
+++ b/numpy/lib/format.py
@@ -599,7 +599,7 @@ def _read_array_header(fp, version):
raise ValueError(msg.format(d['fortran_order']))
try:
dtype = descr_to_dtype(d['descr'])
- except TypeError as e:
+ except TypeError:
msg = "descr is not a valid dtype descriptor: {!r}"
raise ValueError(msg.format(d['descr']))
diff --git a/numpy/lib/tests/test__datasource.py b/numpy/lib/tests/test__datasource.py
index d3bd88d7f..1ed7815d9 100644
--- a/numpy/lib/tests/test__datasource.py
+++ b/numpy/lib/tests/test__datasource.py
@@ -1,13 +1,10 @@
import os
-import sys
import pytest
from tempfile import mkdtemp, mkstemp, NamedTemporaryFile
from shutil import rmtree
import numpy.lib._datasource as datasource
-from numpy.testing import (
- assert_, assert_equal, assert_raises, assert_warns
- )
+from numpy.testing import assert_, assert_equal, assert_raises
import urllib.request as urllib_request
from urllib.parse import urlparse
diff --git a/numpy/lib/tests/test_mixins.py b/numpy/lib/tests/test_mixins.py
index e184ffe19..a9a0c9081 100644
--- a/numpy/lib/tests/test_mixins.py
+++ b/numpy/lib/tests/test_mixins.py
@@ -1,6 +1,5 @@
import numbers
import operator
-import sys
import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises
diff --git a/numpy/lib/tests/test_regression.py b/numpy/lib/tests/test_regression.py
index 37cc158ba..a2598990b 100644
--- a/numpy/lib/tests/test_regression.py
+++ b/numpy/lib/tests/test_regression.py
@@ -1,5 +1,4 @@
import os
-import sys
import numpy as np
from numpy.testing import (
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py
index 0bb297807..e547d151c 100644
--- a/numpy/polynomial/chebyshev.py
+++ b/numpy/polynomial/chebyshev.py
@@ -87,7 +87,6 @@ References
(preprint: https://www.math.hmc.edu/~benjamin/papers/CombTrig.pdf, pg. 4)
"""
-import warnings
import numpy as np
import numpy.linalg as la
from numpy.core.multiarray import normalize_axis_index
@@ -1058,7 +1057,6 @@ def chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
if n > 1:
tmp[2] = c[1]/4
for j in range(2, n):
- t = c[j]/(2*j + 1) # FIXME: t never used
tmp[j + 1] = c[j]/(2*(j + 1))
tmp[j - 1] -= c[j]/(2*(j - 1))
tmp[0] += k[i] - chebval(lbnd, tmp)
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py
index cb98b7e1f..4db344720 100644
--- a/numpy/polynomial/hermite.py
+++ b/numpy/polynomial/hermite.py
@@ -58,7 +58,6 @@ See also
`numpy.polynomial`
"""
-import warnings
import numpy as np
import numpy.linalg as la
from numpy.core.multiarray import normalize_axis_index
diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py
index 1f4a93c24..a7ff67f9c 100644
--- a/numpy/polynomial/hermite_e.py
+++ b/numpy/polynomial/hermite_e.py
@@ -58,7 +58,6 @@ See also
`numpy.polynomial`
"""
-import warnings
import numpy as np
import numpy.linalg as la
from numpy.core.multiarray import normalize_axis_index
diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py
index bf8e11623..0ab17f2f1 100644
--- a/numpy/polynomial/laguerre.py
+++ b/numpy/polynomial/laguerre.py
@@ -58,7 +58,6 @@ See also
`numpy.polynomial`
"""
-import warnings
import numpy as np
import numpy.linalg as la
from numpy.core.multiarray import normalize_axis_index
diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py
index d74b87d5a..ec2f9e828 100644
--- a/numpy/polynomial/legendre.py
+++ b/numpy/polynomial/legendre.py
@@ -81,7 +81,6 @@ numpy.polynomial.hermite
numpy.polynomial.hermite_e
"""
-import warnings
import numpy as np
import numpy.linalg as la
from numpy.core.multiarray import normalize_axis_index
diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py
index 92fdc06fa..94c722628 100644
--- a/numpy/polynomial/polynomial.py
+++ b/numpy/polynomial/polynomial.py
@@ -62,7 +62,6 @@ __all__ = [
'polyfit', 'polytrim', 'polyroots', 'Polynomial', 'polyval2d', 'polyval3d',
'polygrid2d', 'polygrid3d', 'polyvander2d', 'polyvander3d']
-import warnings
import numpy as np
import numpy.linalg as la
from numpy.core.multiarray import normalize_axis_index