Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.2k
Relax protected namespace config default#10441
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
1 files reviewed, 1 outstanding issue(s) found.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cloudflare-workers-and-pagesbot commentedSep 18, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Deploying pydantic-docs with |
Latest commit: | 36a7816 |
Status: | ✅ Deploy successful! |
Preview URL: | https://5749a93c.pydantic-docs.pages.dev |
Branch Preview URL: | https://protected-ns.pydantic-docs.pages.dev |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
codspeed-hqbot commentedSep 18, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
CodSpeed Performance ReportMerging#10441 willnot alter performanceComparing Summary
|
231eb93
toe9d3e43
Comparechanging tests, adding updatesremove added spaceUpdate docs/concepts/serialization.mdCo-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>Update docs/concepts/serialization.mdCo-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>removing warning related code
removing unneeded warning check
1859a35
to0a9bfa9
Comparegithub-actionsbot commentedSep 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
one real question, otherwise LGTM.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
1 files reviewed, 2 total issue(s) found.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
sydney-runkle commentedOct 2, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think this should be ready for review. Given#10493, I actually don't think it's necessary that we add frompydanticimportBaseModelfromtypingimportAnyclassUser(BaseModel):model_fields:list[str]model_computed_fields:list[str]model_extra:dict[str,Any]model_fields_set:set[str]user=User(model_fields=['id','name'],model_computed_fields=[],model_extra={},model_fields_set={'id','name'})"""/Users/programming/pydantic_work/pydantic/pydantic/_internal/_fields.py:190: UserWarning: Field name "model_fields" in "User" shadows an attribute in parent "BaseModel" warnings.warn(/Users/programming/pydantic_work/pydantic/pydantic/_internal/_fields.py:190: UserWarning: Field name "model_computed_fields" in "User" shadows an attribute in parent "BaseModel" warnings.warn(/Users/programming/pydantic_work/pydantic/pydantic/_internal/_fields.py:190: UserWarning: Field name "model_extra" in "User" shadows an attribute in parent "BaseModel" warnings.warn(/Users/programming/pydantic_work/pydantic/pydantic/_internal/_fields.py:190: UserWarning: Field name "model_fields_set" in "User" shadows an attribute in parent "BaseModel" warnings.warn(""" I've also enabled support for compiled patterns, though I don't think that's necessary, as all other overrides are methods - which are standard practice to override, and you'll get type checking warnings if signature isn't compatible or b) warnings if something conflicts with the protected namespaces. |
@@ -273,7 +273,7 @@ def push(self, config_wrapper: ConfigWrapper | ConfigDict | None): | |||
ser_json_inf_nan='null', | |||
validate_default=False, | |||
validate_return=False, | |||
protected_namespaces=('model_',), | |||
protected_namespaces=('model_validate', 'model_dump'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Do we also want to addmodel_construct
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good question, cc@samuelcolvin@dmontagu
sydney-runkleOct 2, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Following up here - we decided we didn't need to addmodel_construct
- that's not a namespace we anticipate expanding in the same way we do formodel_dump_
etc, you can imaginepython
,json
,some_other_format
.
eb9b838
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Closes#10315
Decided not to warn on method overrides, as that's an incredibly common practice in Python, and type checking does enough warning here in cases of incompatibility.