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'm trying to write a simple wrapper around dataclass.field
To Reproduce
Here is a simple snippet that work perfectly under mypy
from dataclasses import field, dataclass
@dataclass
class C:
some_int: int
some_str: str = field(metadata={"doc": "foo"})
another_int: int
c = C(42, "bla", 43)
Now in order to make doc creation easy, I want to write an helper like this
Fixing this will require some changes to the plugin that's used to deal with dataclass semantics. I'm not sure it is easy -- there would have to be a way to mark specific functions (like your doc()) as having similar semantics as field(). But you're free to look over the source code (start at mypy/plugins/dataclasses.py).
Hi,
Bug Report
I'm trying to write a simple wrapper around
dataclass.field
To Reproduce
Here is a simple snippet that work perfectly under mypy
Now in order to make doc creation easy, I want to write an helper like this
So, my snippet can be written:
Expected Behavior
mypy return no error like in the first snippet
Actual Behavior
Your Environment
mypy.ini
(and other config files): NoneRelated Info
I believe those bugs are kind of related.
#8853
#5383
There is a few users that need to alias freely assign / alias dataclass method and class.
The text was updated successfully, but these errors were encountered: