Skip to content

Commit

Permalink
MAINT: resolve pyflake F403 'from module import *' used
Browse files Browse the repository at this point in the history
* For external modules, resolve imported members
* Most internal relative modules were ignored or marked noqa: F403
* Convert a few internal absolute imports to relative imports
  • Loading branch information
mwtoews committed Jan 22, 2020
1 parent 4787918 commit f9c5bd5
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions numpy/core/multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from . import overrides
from . import _multiarray_umath
import numpy as np
from numpy.core._multiarray_umath import *
from numpy.core._multiarray_umath import (
from ._multiarray_umath import * # noqa: F403
from ._multiarray_umath import (
_fastCopyAndTranspose, _flagdict, _insert, _reconstruct, _vec_string,
_ARRAY_API, _monotonicity, _get_ndarray_c_version
)
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
uses_accelerate_framework, get_sgemv_fix
)
from numpy.compat import npy_load_module
from setup_common import *
from setup_common import * # noqa: F403

# Set to True to enable relaxed strides checking. This (mostly) means
# that `strides[dim]` is ignored if `shape[dim] == 1` when setting flags.
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/tests/test_umath_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from os import path
import sys
import pytest
from ctypes import *
from ctypes import c_float, c_int, cast, pointer, POINTER
from numpy.testing import assert_array_max_ulp

runtest = sys.platform.startswith('linux') and (platform.machine() == 'x86_64')
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"""

from . import _multiarray_umath
from numpy.core._multiarray_umath import *
from numpy.core._multiarray_umath import (
from ._multiarray_umath import * # noqa: F403
from ._multiarray_umath import (
_UFUNC_API, _add_newdoc_ufunc, _ones_like
)

Expand Down
11 changes: 8 additions & 3 deletions numpy/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
import subprocess
from copy import copy
from distutils import ccompiler
from distutils.ccompiler import *
from distutils.errors import DistutilsExecError, DistutilsModuleError, \
DistutilsPlatformError, CompileError
from distutils.ccompiler import (
compiler_class, gen_lib_options, get_default_compiler, new_compiler,
CCompiler
)
from distutils.errors import (
DistutilsExecError, DistutilsModuleError, DistutilsPlatformError,
CompileError, UnknownFileError
)
from distutils.sysconfig import customize_compiler
from distutils.version import LooseVersion

Expand Down
2 changes: 1 addition & 1 deletion numpy/distutils/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from distutils.core import *
from distutils.core import Distribution, setup

if 'setuptools' in sys.modules:
have_setuptools = True
Expand Down
2 changes: 1 addition & 1 deletion numpy/distutils/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Colored log, requires Python 2.3 or up.
import sys
from distutils.log import *
from distutils.log import * # noqa: F403
from distutils.log import Log as old_Log
from distutils.log import _global_log

Expand Down
4 changes: 2 additions & 2 deletions numpy/distutils/unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"""
import os

from distutils.errors import DistutilsExecError, CompileError
from distutils.unixccompiler import *
from distutils.errors import CompileError, DistutilsExecError, LibError
from distutils.unixccompiler import UnixCCompiler
from numpy.distutils.ccompiler import replace_method
from numpy.distutils.misc_util import _commandline_dep_string
from numpy.distutils import log
Expand Down
2 changes: 1 addition & 1 deletion numpy/matlib.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from numpy.matrixlib.defmatrix import matrix, asmatrix
# need * as we're copying the numpy namespace (FIXME: this makes little sense)
from numpy import *
from numpy import * # noqa: F403

__version__ = np.__version__

Expand Down
2 changes: 1 addition & 1 deletion tools/swig/test/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env python
# System imports
from distutils.core import *
from distutils.core import Extension, setup
from distutils import sysconfig

# Third-party modules - we depend on numpy for everything
Expand Down

0 comments on commit f9c5bd5

Please sign in to comment.