|
14 | 14 | )
|
15 | 15 |
|
16 | 16 | import numpy as np
|
| 17 | +import numpy.typing as npt |
17 | 18 | import pandas as pd
|
| 19 | + |
| 20 | +# Next set of imports is to keep the private imports needed for testing |
| 21 | +# in one place |
| 22 | +from pandas._testing import ensure_clean as ensure_clean |
18 | 23 | from pandas.core.groupby.groupby import BaseGroupBy
|
19 | 24 | from pandas.util.version import Version
|
20 | 25 | import pytest
|
21 | 26 |
|
22 |
| -from pandas._typing import T |
| 27 | +if TYPE_CHECKING: |
| 28 | + from pandas._typing import ( |
| 29 | + BooleanDtypeArg as BooleanDtypeArg, |
| 30 | + BytesDtypeArg as BytesDtypeArg, |
| 31 | + CategoryDtypeArg as CategoryDtypeArg, |
| 32 | + ComplexDtypeArg as ComplexDtypeArg, |
| 33 | + Dtype as Dtype, |
| 34 | + FloatDtypeArg as FloatDtypeArg, |
| 35 | + IntDtypeArg as IntDtypeArg, |
| 36 | + ObjectDtypeArg as ObjectDtypeArg, |
| 37 | + StrDtypeArg as StrDtypeArg, |
| 38 | + T as T, |
| 39 | + TimedeltaDtypeArg as TimedeltaDtypeArg, |
| 40 | + TimestampDtypeArg as TimestampDtypeArg, |
| 41 | + UIntDtypeArg as UIntDtypeArg, |
| 42 | + VoidDtypeArg as VoidDtypeArg, |
| 43 | + np_ndarray_bool as np_ndarray_bool, |
| 44 | + np_ndarray_int as np_ndarray_int, |
| 45 | + ) |
| 46 | +else: |
| 47 | + # Separately define here so pytest works |
| 48 | + np_ndarray_bool = npt.NDArray[np.bool_] |
| 49 | + np_ndarray_int = npt.NDArray[np.signedinteger] |
23 | 50 |
|
24 | 51 | TYPE_CHECKING_INVALID_USAGE: Final = TYPE_CHECKING
|
25 | 52 | WINDOWS = os.name == "nt" or "cygwin" in platform.system().lower()
|
|
0 commit comments