File tree 2 files changed +7
-10
lines changed
2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ from . import validators as validators
27
27
from ._cmp import cmp_using as cmp_using
28
28
from ._version_info import VersionInfo
29
29
30
+
31
+ if sys .version_info >= (3 , 10 ):
32
+ from typing import TypeGuard
33
+ else :
34
+ from typing_extensions import TypeGuard
35
+
30
36
__version__ : str
31
37
__version_info__ : VersionInfo
32
38
__title__ : str
@@ -470,15 +476,7 @@ def astuple(
470
476
tuple_factory : Type [Sequence [Any ]] = ...,
471
477
retain_collection_types : bool = ...,
472
478
) -> Tuple [Any , ...]: ...
473
-
474
- if sys .version_info >= (3 , 10 ):
475
- from typing import TypeGuard
476
-
477
- def has (cls : type ) -> TypeGuard [Type [AttrsInstance ]]: ...
478
-
479
- else :
480
- def has (cls : type ) -> bool : ...
481
-
479
+ def has (cls : type ) -> TypeGuard [Type [AttrsInstance ]]: ...
482
480
def assoc (inst : _T , ** changes : Any ) -> _T : ...
483
481
def evolve (inst : _T , ** changes : Any ) -> _T : ...
484
482
Original file line number Diff line number Diff line change 1373
1373
fields(A) # E: Argument 1 to "fields" has incompatible type "Type[A]"; expected "Type[AttrsInstance]"
1374
1374
1375
1375
- case : testHasTypeGuard
1376
- skip : sys.version_info < (3, 10)
1377
1376
main : |
1378
1377
from attrs import define, has
1379
1378
You can’t perform that action at this time.
0 commit comments