50
50
_use_attr = False
51
51
attr = None
52
52
ATTR_NOTHING = None
53
- Attribute = TypeVar ("Attribute" , bound = object ) # type: ignore
53
+ Attribute = TypeVar ("Attribute" , bound = object ) # type: ignore[misc, assignment]
54
54
55
55
# define empty placeholders for getting attr fields as a tuple or dict. They will never be
56
56
# called because the import failed; but they're here to ensure that the function is defined in
57
57
# sections of code that don't know if the import was successful or not.
58
58
59
- def get_attr_fields (cls : type ) -> Tuple [dataclasses .Field , ...]: # type: ignore
59
+ def get_attr_fields (cls : type ) -> Tuple [dataclasses .Field , ...]: # type: ignore[misc]
60
60
"""Get tuple of fields for attr class. attrs isn't imported so return empty tuple."""
61
61
return ()
62
62
63
- def get_attr_fields_dict (cls : type ) -> Dict [str , dataclasses .Field ]: # type: ignore
63
+ def get_attr_fields_dict (cls : type ) -> Dict [str , dataclasses .Field ]: # type: ignore[misc]
64
64
"""Get dict of name->field for attr class. attrs isn't imported so return empty dict."""
65
65
return {}
66
66
@@ -79,11 +79,11 @@ class DataclassesProtocol(Protocol):
79
79
from attr import AttrsInstance
80
80
else :
81
81
82
- class AttrsInstance (Protocol ): # type: ignore
82
+ class AttrsInstance (Protocol ): # type: ignore[no-redef]
83
83
__attrs_attrs__ : Dict [str , Any ]
84
84
85
85
86
- def is_attr_class (cls : type ) -> bool : # type: ignore
86
+ def is_attr_class (cls : type ) -> bool : # type: ignore[arg-type]
87
87
"""Return True if the class is an attr class, and False otherwise"""
88
88
return hasattr (cls , "__attrs_attrs__" )
89
89
@@ -367,7 +367,7 @@ def attr_from(
367
367
parsers: a dictionary of parser functions to apply to specific types
368
368
"""
369
369
return_values : Dict [str , Any ] = {}
370
- for attribute in get_fields (cls ): # type: ignore
370
+ for attribute in get_fields (cls ): # type: ignore[arg-type]
371
371
return_value : Any
372
372
if attribute .name in kwargs :
373
373
str_value : str = kwargs [attribute .name ]
0 commit comments