Skip to content

Commit 5511ea4

Browse files
simonjayhawkinsTomAugspurger
authored andcommitted
pandas\core\arrays\categorical.py:514: error: Implicit generic "Any". Use "typing.List" and specify generic parameters
1 parent c0b2a7f commit 5511ea4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pandas/_typing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from pandas.core.indexes.base import Index # noqa: F401
2424
from pandas.core.series import Series # noqa: F401
2525
from pandas.core.generic import NDFrame # noqa: F401
26+
from pandas import Interval # noqa: F401
2627

2728

2829
AnyArrayLike = TypeVar("AnyArrayLike", "ExtensionArray", "Index", "Series", np.ndarray)
@@ -32,10 +33,12 @@
3233
FilePathOrBuffer = Union[str, Path, IO[AnyStr]]
3334

3435
FrameOrSeries = TypeVar("FrameOrSeries", bound="NDFrame")
35-
Scalar = Union[str, int, float, bool]
36+
PythonScalar = Union[str, int, float, bool]
37+
PandasScalar = Union[DatetimeLikeScalar, "Interval"]
38+
Scalar = Union[PythonScalar, PandasScalar]
3639
Axis = Union[str, int]
3740
Ordered = Optional[bool]
38-
JSONSerializable = Union[Scalar, List, Dict]
41+
JSONSerializable = Union[PythonScalar, List, Dict]
3942

4043
Axes = Collection
4144

pandas/core/arrays/categorical.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import operator
22
from shutil import get_terminal_size
3-
from typing import Type, Union, cast
3+
from typing import List, Type, Union, cast
44
from warnings import warn
55

66
import numpy as np
77

88
from pandas._config import get_option
99

1010
from pandas._libs import algos as libalgos, hashtable as htable
11-
from pandas._typing import ArrayLike, Dtype, Ordered
11+
from pandas._typing import ArrayLike, Dtype, Ordered, Scalar
1212
from pandas.compat.numpy import function as nv
1313
from pandas.util._decorators import (
1414
Appender,
@@ -511,7 +511,7 @@ def itemsize(self) -> int:
511511
"""
512512
return self.categories.itemsize
513513

514-
def tolist(self) -> list:
514+
def tolist(self) -> List[Scalar]:
515515
"""
516516
Return a list of the values.
517517

0 commit comments

Comments
 (0)