1
1
# TODO(npdtypes): Many types specified here can be made more specific/accurate;
2
2
# the more specific versions are specified in comments
3
-
3
+ from decimal import Decimal
4
4
from typing import (
5
5
Any ,
6
6
Callable ,
@@ -13,9 +13,12 @@ from typing import (
13
13
14
14
import numpy as np
15
15
16
+ from pandas ._libs .interval import Interval
17
+ from pandas ._libs .tslibs import Period
16
18
from pandas ._typing import (
17
19
ArrayLike ,
18
20
DtypeObj ,
21
+ TypeGuard ,
19
22
npt ,
20
23
)
21
24
@@ -38,13 +41,13 @@ def infer_dtype(value: object, skipna: bool = ...) -> str: ...
38
41
def is_iterator (obj : object ) -> bool : ...
39
42
def is_scalar (val : object ) -> bool : ...
40
43
def is_list_like (obj : object , allow_sets : bool = ...) -> bool : ...
41
- def is_period (val : object ) -> bool : ...
42
- def is_interval (val : object ) -> bool : ...
43
- def is_decimal (val : object ) -> bool : ...
44
- def is_complex (val : object ) -> bool : ...
45
- def is_bool (val : object ) -> bool : ...
46
- def is_integer (val : object ) -> bool : ...
47
- def is_float (val : object ) -> bool : ...
44
+ def is_period (val : object ) -> TypeGuard [ Period ] : ...
45
+ def is_interval (val : object ) -> TypeGuard [ Interval ] : ...
46
+ def is_decimal (val : object ) -> TypeGuard [ Decimal ] : ...
47
+ def is_complex (val : object ) -> TypeGuard [ complex ] : ...
48
+ def is_bool (val : object ) -> TypeGuard [ bool | np . bool_ ] : ...
49
+ def is_integer (val : object ) -> TypeGuard [ int | np . integer ] : ...
50
+ def is_float (val : object ) -> TypeGuard [ float ] : ...
48
51
def is_interval_array (values : np .ndarray ) -> bool : ...
49
52
def is_datetime64_array (values : np .ndarray ) -> bool : ...
50
53
def is_timedelta_or_timedelta64_array (values : np .ndarray ) -> bool : ...
0 commit comments