Skip to content

Commit f1aa08c

Browse files
authored
MyPy cleanup and absolute imports in pandas.core.dtypes.common (#21008)
1 parent eb40557 commit f1aa08c

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

pandas/core/arrays/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ def __setitem__(self, key, value):
195195
)
196196

197197
def __len__(self):
198+
# type: () -> int
198199
"""Length of this array
199200
200201
Returns
201202
-------
202203
length : int
203204
"""
204-
# type: () -> int
205205
raise AbstractMethodError(self)
206206

207207
def __iter__(self):

pandas/core/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -788,14 +788,14 @@ def base(self):
788788

789789
@property
790790
def _ndarray_values(self):
791+
# type: () -> np.ndarray
791792
"""The data as an ndarray, possibly losing information.
792793
793794
The expectation is that this is cheap to compute, and is primarily
794795
used for interacting with our indexers.
795796
796797
- categorical -> codes
797798
"""
798-
# type: () -> np.ndarray
799799
if is_extension_array_dtype(self):
800800
return self.values._ndarray_values
801801
return self.values

pandas/core/dtypes/common.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@
55
PY3, PY36)
66
from pandas._libs import algos, lib
77
from pandas._libs.tslibs import conversion
8-
from .dtypes import (CategoricalDtype, CategoricalDtypeType,
9-
DatetimeTZDtype, DatetimeTZDtypeType,
10-
PeriodDtype, PeriodDtypeType,
11-
IntervalDtype, IntervalDtypeType,
12-
ExtensionDtype, PandasExtensionDtype)
13-
from .generic import (ABCCategorical, ABCPeriodIndex,
14-
ABCDatetimeIndex, ABCSeries,
15-
ABCSparseArray, ABCSparseSeries, ABCCategoricalIndex,
16-
ABCIndexClass, ABCDateOffset)
17-
from .inference import is_string_like, is_list_like
18-
from .inference import * # noqa
8+
from pandas.core.dtypes.dtypes import (
9+
CategoricalDtype, CategoricalDtypeType, DatetimeTZDtype,
10+
DatetimeTZDtypeType, PeriodDtype, PeriodDtypeType, IntervalDtype,
11+
IntervalDtypeType, ExtensionDtype, PandasExtensionDtype)
12+
from pandas.core.dtypes.generic import (
13+
ABCCategorical, ABCPeriodIndex, ABCDatetimeIndex, ABCSeries,
14+
ABCSparseArray, ABCSparseSeries, ABCCategoricalIndex, ABCIndexClass,
15+
ABCDateOffset)
16+
from pandas.core.dtypes.inference import ( # noqa:F401
17+
is_bool, is_integer, is_hashable, is_iterator, is_float,
18+
is_dict_like, is_scalar, is_string_like, is_list_like, is_number,
19+
is_file_like, is_re, is_re_compilable, is_sequence, is_nested_list_like,
20+
is_named_tuple, is_array_like, is_decimal, is_complex, is_interval)
1921

2022

2123
_POSSIBLY_CAST_DTYPES = set([np.dtype(t).name

0 commit comments

Comments
 (0)