Skip to content

Commit 07bf33f

Browse files
committed
MAINT: cleanup unused imports; avoid redefinition of imports
* Cleanup unused imports (F401) of mostly standard Python modules, or some internal but unlikely referenced modules * Where internal imports are potentially used, mark with noqa * Avoid redefinition of imports (F811)
1 parent a9bc5db commit 07bf33f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+27
-82
lines changed

benchmarks/benchmarks/bench_random.py

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

33
import numpy as np
44

5-
from numpy.random import RandomState
6-
75
try:
86
from numpy.random import Generator
97
except ImportError:

benchmarks/benchmarks/bench_records.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import os
2-
31
from .common import Benchmark
42

53
import numpy as np

doc/neps/tools/build_index.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55

66
import os
7-
import sys
87
import jinja2
98
import glob
109
import re

doc/postprocess.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
MODE is either 'html' or 'tex'.
77
88
"""
9-
import re
109
import optparse
1110
import io
1211

doc/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ def setup(app):
257257
# Autosummary
258258
# -----------------------------------------------------------------------------
259259

260-
import glob
261260
autosummary_generate = True
262261

263262
# -----------------------------------------------------------------------------
@@ -381,7 +380,6 @@ def linkcode_resolve(domain, info):
381380
numpy.__version__, fn, linespec)
382381

383382
from pygments.lexers import CLexer
384-
from pygments import token
385383
import copy
386384

387385
class NumPyLexer(CLexer):

doc/source/user/plots/matplotlib3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22
import matplotlib.pyplot as plt
3-
from matplotlib import cm
43
from mpl_toolkits.mplot3d import Axes3D
54

65
fig = plt.figure()

numpy/core/_type_aliases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
2424
"""
2525
import warnings
26-
import sys
2726

2827
from numpy.compat import unicode
2928
from numpy._globals import VisibleDeprecationWarning

numpy/core/code_generators/generate_ufunc_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
import numpy_api
55

6-
from genapi import \
7-
TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
6+
from genapi import TypeApi, FunctionApi
87

98
h_template = r"""
109
#ifdef _UMATHMODULE

numpy/core/function_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import types
55

66
from . import numeric as _nx
7-
from .numeric import (result_type, NaN, shares_memory, MAY_SHARE_BOUNDS,
8-
TooHardError, asanyarray, ndim)
7+
from .numeric import result_type, NaN, asanyarray, ndim
98
from numpy.core.multiarray import add_docstring
109
from numpy.core import overrides
1110

numpy/core/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def visibility_define(config):
392392

393393
def configuration(parent_package='',top_path=None):
394394
from numpy.distutils.misc_util import Configuration, dot_join
395-
from numpy.distutils.system_info import get_info, dict_append
395+
from numpy.distutils.system_info import get_info
396396

397397
config = Configuration('core', parent_package, top_path)
398398
local_dir = config.local_path

0 commit comments

Comments
 (0)