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
In my project, I am working on a decorator that automates converting a dict into an AttrsInstance.
To perform reflection checks on input definitions, I found myself needing to subclass AttrsInstance without modifying it—just to add the runtime_checkable decorator.
It would be incredibly helpful if the attrs library's definition already included runtime_checkable.
The text was updated successfully, but these errors were encountered:
As @Tinchecommented on your PR, this is not trivial, because runtime_checkable checks whether an instance fulfills the Protocol you defined and since AttrsInstance is empty, every class will conform.
Maybe it's possible if we switch to an abc with a dedicated __instancecheck__?
Is it possible to add the
runtime_checkable
decorator toAttrsInstance
protocol?attrs/src/attr/__init__.py
Lines 37 to 38 in 598494a
In my project, I am working on a decorator that automates converting a dict into an
AttrsInstance
.To perform reflection checks on input definitions, I found myself needing to subclass
AttrsInstance
without modifying it—just to add theruntime_checkable
decorator.It would be incredibly helpful if the attrs library's definition already included
runtime_checkable
.The text was updated successfully, but these errors were encountered: