10000 MAINT: removed unused imports listed in LGTM by ajayd-san · Pull Request #19090 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: removed unused imports listed in LGTM #19090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
MAINT: removed unused imports listed in LGTM
  • Loading branch information
ajayd-san committed May 24, 2021
commit ca53c09c9a3b0c3eed59d4b0a0313fd5f76793fd
3 changes: 0 additions & 3 deletions numpy/compat/py3k.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
from pathlib import Path
import io

import abc
from abc import ABC as abc_ABC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact these are imported here is considered public API for this module


try:
import pickle5 as pickle
except ImportError:
Expand Down
1 change: 0 additions & 1 deletion numpy/core/defchararray.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

"""
import functools
import sys
from .numerictypes import (
string_, unicode_, integer, int_, object_, bool_, character)
from .numeric import ndarray, compare_chararrays
Expand Down
1 change: 0 additions & 1 deletion numpy/core/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
array([2., 2.])

"""
import os
import warnings
from collections import Counter
from contextlib import nullcontext
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# These imports are needed for backward compatibility,
# do not change them. issue gh-11862
# _ones_like is semi-public, on purpose not added to __all__
from ._multiarray_umath import _UFUNC_API, _add_newdoc_ufunc, _ones_like
from ._multiarray_umath import _UFUNC_API, _add_newdoc_ufunc

__all__ = [
'_UFUNC_API', 'ERR_CALL', 'ERR_DEFAULT', 'ERR_IGNORE', 'ERR_LOG',
Expand Down
2 changes: 0 additions & 2 deletions numpy/distutils/fcompiler/nv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

from numpy.distutils.fcompiler import FCompiler

compilers = ['NVHPCFCompiler']
Expand Down
1 change: 0 additions & 1 deletion numpy/distutils/mingw32ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import textwrap

# Overwrite certain distutils.ccompiler functions:
import numpy.distutils.ccompiler # noqa: F401
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible this import is needed to do some monkey-patching. I don't know for sure.

from numpy.distutils import log
# NT stuff
# 1. Make sure libpython<version>.a exists for gcc. If not, build it.
Expand Down
1 change: 0 additions & 1 deletion numpy/f2py/crackfortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
The above may be solved by creating appropriate preprocessor program, for example.

"""
import io
import sys
import string
import fileinput
Expand Down
1 change: 0 additions & 1 deletion numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import builtins

# needed in this module for compatibility
from numpy.lib.histograms import histogram, histogramdd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem., See the comment on the line above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be added to __all__ then?

Copy link
Member
@BvB93 BvB93 May 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worthwhile to figure out why exactly they're here in the first place.
Based on the answer deprecating (or removing) them might be desirable over adding them to __all__.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, found it: four years ago they were moved from function_base to histograms in a namespace clean up (#10186).
Honestly, this period is long enough that I'd advocate for their deprecation.



array_function_dispatch = functools.partial(
Expand Down
1 change: 0 additions & 1 deletion numpy/lib/npyio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import os
import re
import functools
Expand Down
1 change: 0 additions & 1 deletion numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from numpy import expand_dims
from numpy.core.numeric import normalize_axis_tuple
from numpy.core._internal import recursive
from numpy.compat import pickle


__all__ = [
Expand Down
1 change: 0 additions & 1 deletion numpy/ma/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import numpy as np
from numpy import ndarray, array as nxarray
import numpy.core.umath as umath
from numpy.core.multiarray import normalize_axis_index
from numpy.core.numeric import normalize_axis_tuple
from numpy.lib.function_base import _ureduce
Expand Down
3 changes: 1 addition & 2 deletions numpy/typing/_array_like.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import sys
from typing import Any, overload, Sequence, TYPE_CHECKING, Union, TypeVar
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar

from numpy import (
ndarray,
Expand All @@ -20,7 +20,6 @@
str_,
bytes_,
)
from ._dtype_like import DTypeLike

if sys.version_info >= (3, 8):
from typing import Protocol
Expand Down
2 changes: 0 additions & 2 deletions numpy/typing/_callable.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@
_BoolLike_co,
_IntLike_co,
_FloatLike_co,
_ComplexLike_co,
_NumberLike_co,
)
from . import NBitBase
from ._array_like import ArrayLike
from ._generic_alias import NDArray

if sys.version_info >= (3, 8):
Expand Down
0