4444 from attr import fields as get_attr_fields
4545 from attr import fields_dict as get_attr_fields_dict
4646
47- Attribute : TypeAlias = attr .Attribute # type: ignore[name-defined, no-redef ]
47+ Attribute : TypeAlias = attr .Attribute # type: ignore[name-defined]
4848 # dataclasses and attr have internal tokens for missing values, join into a set so that we can
4949 # check if a value is missing without knowing the type of backing class
5050 MISSING = frozenset ({DATACLASSES_MISSING , attr .NOTHING })
5151except ImportError : # pragma: no cover
5252 _use_attr = False
5353 attr = None
54- Attribute : TypeAlias = TypeVar ("Attribute" , bound = object ) # type: ignore[misc, assignment, no-redef] # noqa: E501
54+ Attribute : TypeAlias = TypeVar ("Attribute" , bound = object ) # type: ignore[misc, no-redef] # noqa: E501
5555
5656 # define empty placeholders for getting attr fields as a tuple or dict. They will never be
5757 # called because the import failed; but they're here to ensure that the function is defined in
@@ -85,7 +85,7 @@ class AttrsInstance(Protocol): # type: ignore[no-redef]
8585 __attrs_attrs__ : ClassVar [Any ]
8686
8787
88- def is_attr_class (cls : type ) -> bool : # type: ignore[arg-type]
88+ def is_attr_class (cls : type ) -> bool :
8989 """Return True if the class is an attr class, and False otherwise"""
9090 return hasattr (cls , "__attrs_attrs__" )
9191
@@ -396,7 +396,7 @@ def get_fields_dict(
396396) -> Mapping [str , FieldType ]:
397397 """Get the fields dict from either a dataclasses or attr dataclass (or instance)"""
398398 if is_dataclasses_class (cls ):
399- return _get_dataclasses_fields_dict (cls ) # type: ignore[arg-type]
399+ return _get_dataclasses_fields_dict (cls )
400400 elif is_attr_class (cls ): # type: ignore[arg-type]
401401 return get_attr_fields_dict (cls ) # type: ignore[arg-type]
402402 else :
@@ -408,9 +408,9 @@ def get_fields(
408408) -> Tuple [FieldType , ...]:
409409 """Get the fields tuple from either a dataclasses or attr dataclass (or instance)"""
410410 if is_dataclasses_class (cls ):
411- return get_dataclasses_fields (cls ) # type: ignore[arg-type]
411+ return get_dataclasses_fields (cls )
412412 elif is_attr_class (cls ): # type: ignore[arg-type]
413- return get_attr_fields (cls ) # type: ignore[arg-type]
413+ return get_attr_fields (cls ) # type: ignore[arg-type, no-any-return ]
414414 else :
415415 raise TypeError ("cls must a dataclasses or attr class" )
416416
0 commit comments