Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.2k
Support compiled patterns inprotected_namespaces
#10522
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
cloudflare-workers-and-pagesbot commentedSep 30, 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: | 35804ff |
Status: | ✅ Deploy successful! |
Preview URL: | https://d4c38ffd.pydantic-docs.pages.dev |
Branch Preview URL: | https://support-re-for-protected-ns.pydantic-docs.pages.dev |
codspeed-hqbot commentedSep 30, 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#10522 willnot alter performanceComparing Summary
|
github-actionsbot commentedOct 1, 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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
if ann_name.startswith(protected_namespace): | ||
ns_violation: bool = False | ||
if isinstance(protected_namespace, Pattern): | ||
ns_violation = protected_namespace.match(ann_name) is not None |
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.
Ismatch
better thanfullmatch
here? I thinkmatch
might be equally capable and more practical (don't need to include.*
on the end to serve as a prefix match I guess), just want to make sure you've thought about it and decided to go withmatch
.
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 - I thinkmatch
is more practical, as you can use special characters (ex:^<pattern>$
) to basically ensurefullmatch
behavior, whereasfullmatch
does that by default and thus offers less customizability 👍
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>
Merge branch 'support-re-for-protected-ns' ofhttps://github.com/pydantic/pydantic into support-re-for-protected-ns
296f2ca
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ConfigDict.protected_namespaces
now supports matching on compiled patterns.Whereas we used to only support prefix check for
str
type protected namespaces, this now expands the customizability of a protected namespace significantly.