-
Notifications
You must be signed in to change notification settings - Fork 156
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
PyLint - 'from_dict' member (no-member) #198
Comments
The same is true for other methods (e.g.
|
You can also get around it by inheriting from |
@RunOrVeith Thanks for the hint. Is it possible to also achieve that with the decorator i.e. is this fixable or is inheriting from With the inheritance I still get the following warnings:
But I can't explain why that is since dataclasses_json does seem to have proper type annotations. Maybe this is a pyright issue and I need to raise it on their side? I do also get the warning that the package does not have a stub file:
Since dataclasses_json does provide type annotations, I'm not sure how that correlates with the type stub file. Maybe one needs to an empty or basic stub file for static type checkers to be happy? I don't know what the best practice with respect to package development is. |
Hi, Regarding the errors around The decorator registers a given user class as a "virtual subclass" of |
You don't want to use stub files, it is a nightmare to keep them in sync with the code. They are better suited as an addon to existing packages that you can't modify. |
This should be resolved in 0.5.8 |
@george-zubrienko It seems that Mypy is still struggling to find
You can see the code triggering this error here ( Is this error related to this issue or should I open a new one? |
Currently the only way to avoid this is to subclass DataClassJsonMixin - you can use annotation as well, but subclassing is mandatory to prevent pylint/mypy fuming black smoke |
Also re-opening this one, as not solved yet - #442 is the way forward. |
dataclasses-json does not seem to pass PyLint tests if using created methods.
In this example the method used is from_dict.
To get around it, brain tips must be added.
Example Implementation for dataclasses: https://github.com/PyCQA/astroid/blob/master/astroid/brain/brain_dataclasses.py
Note at the moment I did not look exactly the full logic of this, but if dataclasses-json can be added to the astroid git project, it would play nicely like dataclasses does.
For now we got around it by having a .pylintrc with:
[TYPECHECK]
generated-members=from_dict
The text was updated successfully, but these errors were encountered: