You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that functions like attr.has, attr.fields, attr.fields_dict doesn't work as i expected when i pass in class with generic type defined:
from attr import frozen, evolve, mutable, has, fields, fields_dict, Attribute
T = TypeVar("T")
@frozen
class A(Generic[T]):
a: int
b: T
has(A) => True
has(A[str]) => False (should be True)
fields(A) => Sequence[Attribute]
fields(A[str]) => TypeError: Passed object must be a class (should be Sequence[Attribute])
fields_dict(A) => Mapping[str, Attribute]
fields(A[str]) => TypeError: Passed object must be a class (should be Mapping[str, Attribute])```
The text was updated successfully, but these errors were encountered:
LukasKrocek
changed the title
Attr class helper methods - Support for generic classes
Attr class helper functions - Support for generic classes
Nov 3, 2022
LukasKrocek
changed the title
Attr class helper functions - Support for generic classes
Class helper functions - Support for generic classes
Nov 3, 2022
I noticed that functions like
attr.has, attr.fields, attr.fields_dict
doesn't work as i expected when i pass in class with generic type defined:The text was updated successfully, but these errors were encountered: