-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stubgen generates __mypy-replace
method for @dataclass_transform
#18081
Comments
Another problem is that stubgen swallows the |
@hamdanal This is unrelated to this bug but do you think it's possible to make stubgen preserve arbitrary decorators? E.g. home assistant uses
Here Mypy passes if I remove decorators in In original home assistant code base mypy accepts methods decorated with |
The decision to ignore unknown decorators predates my contributions to stubgen. I suggest you open a new issue asking for this to be supported. |
Thanks for raising this issue. I'm hit with the same bug on my project and was bumping my head. |
Please leave discussion of unrelated problems out of this issue. Feel free to open a new issue (or look for an existing one) if you have feedback that isn't related to this |
Addresses part of #18081 stubgen still does not handle dataclass transforms correctly but with this change we make sure to never include private mypy generated symbols in the stubs.
Bug Report
Stubgen generates
mypy-replace
method which makes.pyi
file invalid.To Reproduce
Minimum example, truncated from Home Assistant codebase:
$ stubgen --include-private test.py
Without
--include-private
this method is not generated.Expected Behavior
Stubgen produces
.pyi
file with valid syntax, withoutmypy-replace
. Probably with__replace__
method:Actual Behavior
Stubgen on master generates:
Stubgen 1.13.0 generates
__replace__
method as well:Your Environment
1.13.0
.--include-private
The text was updated successfully, but these errors were encountered: