diff options
author | Mike Taves <mwtoews@gmail.com> | 2020-01-28 13:46:25 +1300 |
---|---|---|
committer | Mike Taves <mwtoews@gmail.com> | 2020-01-28 13:46:25 +1300 |
commit | d2f1d7704c5f55fc39cd040acf4a07ddce88319b (patch) | |
tree | 455248691e966ba665ac53bddf2fa4f2a689e538 | |
parent | f398a0df8a2105b2fdeaeab54505451169b0a869 (diff) | |
download | numpy-d2f1d7704c5f55fc39cd040acf4a07ddce88319b.tar.gz |
STY,MAINT: avoid 'multiple imports on one line' (flake8 E401)
* PEP 8: "Imports should usually be on separate lines"
* Where modified, sort imported modules alphabetically
* Clean-up unused imports from these expanded lines
-rw-r--r-- | doc/source/conf.py | 4 | ||||
-rwxr-xr-x | doc/summarize.py | 12 | ||||
-rw-r--r-- | numpy/core/code_generators/genapi.py | 5 | ||||
-rw-r--r-- | numpy/core/tests/test_scalarprint.py | 3 | ||||
-rw-r--r-- | numpy/distutils/command/config.py | 7 | ||||
-rw-r--r-- | numpy/distutils/cpuinfo.py | 8 | ||||
-rw-r--r-- | numpy/distutils/line_endings.py | 5 | ||||
-rw-r--r-- | numpy/doc/constants.py | 3 | ||||
-rw-r--r-- | numpy/linalg/lapack_lite/clapack_scrub.py | 3 | ||||
-rw-r--r-- | numpy/random/tests/test_extending.py | 5 | ||||
-rw-r--r-- | numpy/testing/_private/utils.py | 4 |
11 files changed, 41 insertions, 18 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py index 957cb17e6..11be7ec1c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- -import sys, os, re +import os +import re +import sys # Minimum version, enforced by sphinx needs_sphinx = '2.2.0' diff --git a/doc/summarize.py b/doc/summarize.py index ea2397538..5a3088267 100755 --- a/doc/summarize.py +++ b/doc/summarize.py @@ -5,8 +5,12 @@ summarize.py Show a summary about which NumPy functions are documented and which are not. """ -import os, glob, re, sys, inspect, optparse import collections.abc +import glob +import inspect +import optparse +import os +import sys sys.path.append(os.path.join(os.path.dirname(__file__), 'sphinxext')) from sphinxext.phantom_import import import_phantom_module @@ -98,7 +102,11 @@ def check_numpy(): documented = get_documented(glob.glob(SOURCE_DIR + '/*.rst')) undocumented = {} - import numpy, numpy.fft, numpy.linalg, numpy.random + import numpy + import numpy.fft + import numpy.linalg + import numpy.random + for mod in [numpy, numpy.fft, numpy.linalg, numpy.random, numpy.ctypeslib, numpy.emath, numpy.ma]: undocumented.update(get_undocumented(documented, mod, skip=SKIP_LIST)) diff --git a/numpy/core/code_generators/genapi.py b/numpy/core/code_generators/genapi.py index 4fa68a1f0..88dc2d90a 100644 --- a/numpy/core/code_generators/genapi.py +++ b/numpy/core/code_generators/genapi.py @@ -8,10 +8,11 @@ specified. """ from numpy.distutils.conv_template import process_file as process_c_file -import sys, os, re import hashlib import io - +import os +import re +import sys import textwrap from os.path import join diff --git a/numpy/core/tests/test_scalarprint.py b/numpy/core/tests/test_scalarprint.py index 126191856..6502ec4c1 100644 --- a/numpy/core/tests/test_scalarprint.py +++ b/numpy/core/tests/test_scalarprint.py @@ -2,9 +2,10 @@ """ Test printing of scalar types. """ -import code, sys +import code import platform import pytest +import sys from tempfile import TemporaryFile import numpy as np diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index 2c833aad7..e54a54449 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -2,11 +2,12 @@ # try_compile call. try_run works but is untested for most of Fortran # compilers (they must define linker_exe first). # Pearu Peterson -import os, signal -import warnings -import sys +import os +import signal import subprocess +import sys import textwrap +import warnings from distutils.command.config import config as old_config from distutils.command.config import LANG_EXT diff --git a/numpy/distutils/cpuinfo.py b/numpy/distutils/cpuinfo.py index e066f9888..7bcda256b 100644 --- a/numpy/distutils/cpuinfo.py +++ b/numpy/distutils/cpuinfo.py @@ -14,13 +14,15 @@ Pearu Peterson """ __all__ = ['cpu'] -import sys, re, types import os +import platform +import re +import sys +import types +import warnings from subprocess import getstatusoutput -import warnings -import platform def getoutput(cmd, successful_status=(0,), stacklevel=1): try: diff --git a/numpy/distutils/line_endings.py b/numpy/distutils/line_endings.py index 92a84e56a..686e5ebd9 100644 --- a/numpy/distutils/line_endings.py +++ b/numpy/distutils/line_endings.py @@ -1,7 +1,10 @@ """ Functions for converting from DOS to UNIX line endings """ -import sys, re, os +import os +import re +import sys + def dos2unix(file): "Replace CRLF with LF in argument files. Print names of changed files." diff --git a/numpy/doc/constants.py b/numpy/doc/constants.py index 96813b66c..2c629ad33 100644 --- a/numpy/doc/constants.py +++ b/numpy/doc/constants.py @@ -13,7 +13,8 @@ NumPy includes several constants: # # Note: the docstring is autogenerated. # -import textwrap, re +import re +import textwrap # Maintain same format as in numpy.add_newdocs constants = [] diff --git a/numpy/linalg/lapack_lite/clapack_scrub.py b/numpy/linalg/lapack_lite/clapack_scrub.py index 531d861cf..c5a3279be 100644 --- a/numpy/linalg/lapack_lite/clapack_scrub.py +++ b/numpy/linalg/lapack_lite/clapack_scrub.py @@ -1,6 +1,7 @@ #!/usr/bin/env python -import sys, os +import os import re +import sys from io import StringIO from plex import Scanner, Str, Lexicon, Opt, Bol, State, AnyChar, TEXT, IGNORE diff --git a/numpy/random/tests/test_extending.py b/numpy/random/tests/test_extending.py index 23a874fb1..b0d4c60fe 100644 --- a/numpy/random/tests/test_extending.py +++ b/numpy/random/tests/test_extending.py @@ -1,8 +1,9 @@ -import os, sys +import os import pytest -import warnings import shutil import subprocess +import sys +import warnings try: import cffi diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 8b098f1d1..67b7d317c 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -1444,7 +1444,9 @@ def _assert_valid_refcount(op): """ if not HAS_REFCOUNT: return True - import numpy as np, gc + + import gc + import numpy as np b = np.arange(100*100).reshape(100, 100) c = b |