Skip to content

Commit 9616d98

Browse files
authored
CLN: Fixing mypy errors in pandas/conftest.py (#29046)
1 parent b6ae034 commit 9616d98

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pandas/_typing.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
List,
1212
Mapping,
1313
Optional,
14+
Type,
1415
TypeVar,
1516
Union,
1617
)
@@ -44,7 +45,9 @@
4445

4546
# other
4647

47-
Dtype = Union[str, np.dtype, "ExtensionDtype"]
48+
Dtype = Union[
49+
"ExtensionDtype", str, np.dtype, Type[Union[str, float, int, complex, bool]]
50+
]
4851
DtypeObj = Union[np.dtype, "ExtensionDtype"]
4952
FilePathOrBuffer = Union[str, Path, IO[AnyStr]]
5053

pandas/conftest.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from decimal import Decimal
2424
import operator
2525
import os
26+
from typing import List
2627

2728
from dateutil.tz import tzlocal, tzutc
2829
import hypothesis
@@ -31,6 +32,7 @@
3132
import pytest
3233
from pytz import FixedOffset, utc
3334

35+
from pandas._typing import Dtype
3436
import pandas.util._test_decorators as td
3537

3638
import pandas as pd
@@ -798,14 +800,14 @@ def utc_fixture(request):
798800

799801
UNSIGNED_INT_DTYPES = ["uint8", "uint16", "uint32", "uint64"]
800802
UNSIGNED_EA_INT_DTYPES = ["UInt8", "UInt16", "UInt32", "UInt64"]
801-
SIGNED_INT_DTYPES = [int, "int8", "int16", "int32", "int64"]
803+
SIGNED_INT_DTYPES: List[Dtype] = [int, "int8", "int16", "int32", "int64"]
802804
SIGNED_EA_INT_DTYPES = ["Int8", "Int16", "Int32", "Int64"]
803805
ALL_INT_DTYPES = UNSIGNED_INT_DTYPES + SIGNED_INT_DTYPES
804806
ALL_EA_INT_DTYPES = UNSIGNED_EA_INT_DTYPES + SIGNED_EA_INT_DTYPES
805807

806-
FLOAT_DTYPES = [float, "float32", "float64"]
807-
COMPLEX_DTYPES = [complex, "complex64", "complex128"]
808-
STRING_DTYPES = [str, "str", "U"]
808+
FLOAT_DTYPES: List[Dtype] = [float, "float32", "float64"]
809+
COMPLEX_DTYPES: List[Dtype] = [complex, "complex64", "complex128"]
810+
STRING_DTYPES: List[Dtype] = [str, "str", "U"]
809811

810812
DATETIME64_DTYPES = ["datetime64[ns]", "M8[ns]"]
811813
TIMEDELTA64_DTYPES = ["timedelta64[ns]", "m8[ns]"]

0 commit comments

Comments
 (0)