-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
Forbid kwarg unpacking in class definition #1754
Comments
Hello, @sobolevn Can you assign me this issue? I'd like to contribute. Thanks. |
Thanks a lot! |
Thank you, @sobolevn ! Can you please elaborate the issue? It'd be really helpful. |
@StutiV what help do you need? I would love to answer speicific questions 🙂 |
@sobolevn Which file should I be making these changes in? |
@StutiV it is probably Probably |
@sobolevn can you assign this issue for me? |
@StakanAgan done! Thanks! |
@sobolevn do you have an example full example where a class receives parameters, please? Does the class need to have a metaclass or something like? |
For example, this is fine: from pydantic import BaseModel, Extra
class Model(BaseModel, extra=Extra.forbid):
a: str This is not (but will work the same way): from pydantic import BaseModel, Extra
kw = {'extra': Extra.forbid}
class Model(BaseModel, **kw):
a: str Source: https://pydantic-docs.helpmanual.io/usage/model_config/ |
Rule request
Thesis
We need to forbid code like this:
But, this code is valid:
Reasoning
Dynamic class generation with unknown values is really bad!
The text was updated successfully, but these errors were encountered: