Skip to content
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

TYP: enable reportUnusedImport #46937

Merged
merged 5 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from __future__ import annotations

__docformat__ = "restructuredtext"
Expand All @@ -20,7 +19,7 @@
del _hard_dependencies, _dependency, _missing_dependencies

# numpy compat
from pandas.compat import is_numpy_dev as _is_numpy_dev
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401

try:
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
Expand All @@ -44,7 +43,7 @@
)

# let init-time option registration happen
import pandas.core.config_init
import pandas.core.config_init # pyright: ignore # noqa:F401

from pandas.core.api import (
# dtype
Expand Down Expand Up @@ -134,7 +133,8 @@
qcut,
)

from pandas import api, arrays, errors, io, plotting, testing, tseries
from pandas import api, arrays, errors, io, plotting, tseries
from pandas import testing # noqa:PDF015
from pandas.util._print_versions import show_versions

from pandas.io.api import (
Expand Down
2 changes: 1 addition & 1 deletion pandas/_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"options",
]
from pandas._config import config
from pandas._config import dates # noqa:F401
from pandas._config import dates # pyright: ignore # noqa:F401
from pandas._config.config import (
describe_option,
get_option,
Expand Down
139 changes: 132 additions & 7 deletions pandas/_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import numpy as np

from pandas._config.localization import ( # noqa:F401
from pandas._config.localization import (
can_set_locale,
get_locales,
set_locale,
Expand Down Expand Up @@ -49,24 +49,24 @@
Series,
bdate_range,
)
from pandas._testing._io import ( # noqa:F401
from pandas._testing._io import (
close,
network,
round_trip_localpath,
round_trip_pathlib,
round_trip_pickle,
write_to_compressed,
)
from pandas._testing._random import ( # noqa:F401
from pandas._testing._random import (
randbool,
rands,
rands_array,
)
from pandas._testing._warnings import ( # noqa:F401
from pandas._testing._warnings import (
assert_produces_warning,
maybe_produces_warning,
)
from pandas._testing.asserters import ( # noqa:F401
from pandas._testing.asserters import (
assert_almost_equal,
assert_attr_equal,
assert_categorical_equal,
Expand All @@ -91,11 +91,11 @@
assert_timedelta_array_equal,
raise_assert_detail,
)
from pandas._testing.compat import ( # noqa:F401
from pandas._testing.compat import (
get_dtype,
get_obj,
)
from pandas._testing.contexts import ( # noqa:F401
from pandas._testing.contexts import (
RNGContext,
decompress_file,
ensure_clean,
Expand Down Expand Up @@ -1033,3 +1033,128 @@ def shares_memory(left, right) -> bool:
return shares_memory(arr, right)

raise NotImplementedError(type(left), type(right))


__all__ = [
"ALL_INT_EA_DTYPES",
"ALL_INT_NUMPY_DTYPES",
"ALL_NUMPY_DTYPES",
"ALL_REAL_NUMPY_DTYPES",
"all_timeseries_index_generator",
"assert_almost_equal",
"assert_attr_equal",
"assert_categorical_equal",
"assert_class_equal",
"assert_contains_all",
"assert_copy",
"assert_datetime_array_equal",
"assert_dict_equal",
"assert_equal",
"assert_extension_array_equal",
"assert_frame_equal",
"assert_index_equal",
"assert_indexing_slices_equivalent",
"assert_interval_array_equal",
"assert_is_sorted",
"assert_is_valid_plot_return_object",
"assert_metadata_equivalent",
"assert_numpy_array_equal",
"assert_period_array_equal",
"assert_produces_warning",
"assert_series_equal",
"assert_sp_array_equal",
"assert_timedelta_array_equal",
"at",
"BOOL_DTYPES",
"box_expected",
"BYTES_DTYPES",
"can_set_locale",
"close",
"COMPLEX_DTYPES",
"convert_rows_list_to_csv_str",
"DATETIME64_DTYPES",
"decompress_file",
"EMPTY_STRING_PATTERN",
"ENDIAN",
"ensure_clean",
"ensure_clean_dir",
"ensure_safe_environment_variables",
"equalContents",
"external_error_raised",
"FLOAT_EA_DTYPES",
"FLOAT_NUMPY_DTYPES",
"getCols",
"get_cython_table_params",
"get_dtype",
"getitem",
"get_locales",
"getMixedTypeDict",
"get_obj",
"get_op_from_name",
"getPeriodData",
"getSeriesData",
"getTimeSeriesData",
"iat",
"iloc",
"index_subclass_makers_generator",
"loc",
"makeBoolIndex",
"makeCategoricalIndex",
"makeCustomDataframe",
"makeCustomIndex",
"makeDataFrame",
"makeDateIndex",
"makeFloatIndex",
"makeFloatSeries",
"makeIntervalIndex",
"makeIntIndex",
"makeMissingDataframe",
"makeMixedDataFrame",
"makeMultiIndex",
"makeNumericIndex",
"makeObjectSeries",
"makePeriodFrame",
"makePeriodIndex",
"makePeriodSeries",
"make_rand_series",
"makeRangeIndex",
"makeStringIndex",
"makeStringSeries",
"makeTimeDataFrame",
"makeTimedeltaIndex",
"makeTimeSeries",
"makeUIntIndex",
"maybe_produces_warning",
"NARROW_NP_DTYPES",
"network",
"NP_NAT_OBJECTS",
"NULL_OBJECTS",
"OBJECT_DTYPES",
"raise_assert_detail",
"randbool",
"rands",
"reset_display_options",
"reset_testing_mode",
"RNGContext",
"round_trip_localpath",
"round_trip_pathlib",
"round_trip_pickle",
"setitem",
"set_locale",
"set_testing_mode",
"set_timezone",
"shares_memory",
"SIGNED_INT_EA_DTYPES",
"SIGNED_INT_NUMPY_DTYPES",
"STRING_DTYPES",
"SubclassedCategorical",
"SubclassedDataFrame",
"SubclassedSeries",
"TIMEDELTA64_DTYPES",
"to_array",
"UNSIGNED_INT_EA_DTYPES",
"UNSIGNED_INT_NUMPY_DTYPES",
"use_numexpr",
"with_csv_dialect",
"write_to_compressed",
]
9 changes: 8 additions & 1 deletion pandas/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
""" public toolkit API """
from pandas.api import ( # noqa:F401
from pandas.api import (
exchange,
extensions,
indexers,
types,
)

__all__ = [
"exchange",
"extensions",
"indexers",
"types",
]
2 changes: 1 addition & 1 deletion pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ def spmatrix(request):
params=[
getattr(pd.offsets, o)
for o in pd.offsets.__all__
if issubclass(getattr(pd.offsets, o), pd.offsets.Tick)
if issubclass(getattr(pd.offsets, o), pd.offsets.Tick) and o != "Tick"
]
)
def tick_classes(request):
Expand Down
64 changes: 62 additions & 2 deletions pandas/core/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa:F401

from pandas._libs import (
NaT,
Period,
Expand Down Expand Up @@ -84,3 +82,65 @@

# DataFrame needs to be imported after NamedAgg to avoid a circular import
from pandas.core.frame import DataFrame # isort:skip

__all__ = [
"array",
"bdate_range",
"BooleanDtype",
"Categorical",
"CategoricalDtype",
"CategoricalIndex",
"DataFrame",
"DateOffset",
"date_range",
"DatetimeIndex",
"DatetimeTZDtype",
"factorize",
"Flags",
"Float32Dtype",
"Float64Dtype",
"Float64Index",
"Grouper",
"Index",
"IndexSlice",
"Int16Dtype",
"Int32Dtype",
"Int64Dtype",
"Int64Index",
"Int8Dtype",
"Interval",
"IntervalDtype",
"IntervalIndex",
"interval_range",
"isna",
"isnull",
"MultiIndex",
"NA",
"NamedAgg",
"NaT",
"notna",
"notnull",
"NumericIndex",
"Period",
"PeriodDtype",
"PeriodIndex",
"period_range",
"RangeIndex",
"Series",
"set_eng_float_format",
"StringDtype",
"Timedelta",
"TimedeltaIndex",
"timedelta_range",
"Timestamp",
"to_datetime",
"to_numeric",
"to_timedelta",
"UInt16Dtype",
"UInt32Dtype",
"UInt64Dtype",
"UInt64Index",
"UInt8Dtype",
"unique",
"value_counts",
]
4 changes: 2 additions & 2 deletions pandas/core/arrays/arrow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# flake8: noqa: F401

from pandas.core.arrays.arrow.array import ArrowExtensionArray

__all__ = ["ArrowExtensionArray"]
12 changes: 10 additions & 2 deletions pandas/core/arrays/sparse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa: F401

from pandas.core.arrays.sparse.accessor import (
SparseAccessor,
SparseFrameAccessor,
Expand All @@ -11,3 +9,13 @@
make_sparse_index,
)
from pandas.core.arrays.sparse.dtype import SparseDtype

__all__ = [
"BlockIndex",
"IntIndex",
"make_sparse_index",
"SparseAccessor",
"SparseArray",
"SparseDtype",
"SparseFrameAccessor",
]
46 changes: 44 additions & 2 deletions pandas/core/dtypes/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa:F401

from pandas.core.dtypes.common import (
is_array_like,
is_bool,
Expand Down Expand Up @@ -43,3 +41,47 @@
is_unsigned_integer_dtype,
pandas_dtype,
)

__all__ = [
"is_array_like",
"is_bool",
"is_bool_dtype",
"is_categorical",
"is_categorical_dtype",
"is_complex",
"is_complex_dtype",
"is_datetime64_any_dtype",
"is_datetime64_dtype",
"is_datetime64_ns_dtype",
"is_datetime64tz_dtype",
"is_dict_like",
"is_dtype_equal",
"is_extension_array_dtype",
"is_extension_type",
"is_file_like",
"is_float",
"is_float_dtype",
"is_hashable",
"is_int64_dtype",
"is_integer",
"is_integer_dtype",
"is_interval",
"is_interval_dtype",
"is_iterator",
"is_list_like",
"is_named_tuple",
"is_number",
"is_numeric_dtype",
"is_object_dtype",
"is_period_dtype",
"is_re",
"is_re_compilable",
"is_scalar",
"is_signed_integer_dtype",
"is_sparse",
"is_string_dtype",
"is_timedelta64_dtype",
"is_timedelta64_ns_dtype",
"is_unsigned_integer_dtype",
"pandas_dtype",
]
Loading