-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add a frozenset type annotation to allowed_schemes on stricturl #2198
Add a frozenset type annotation to allowed_schemes on stricturl #2198
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2198 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 4199 4199
Branches 854 854
=========================================
Hits 4199 4199
Continue to review full report at Codecov.
|
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.
LGTM!
For the local error on make lint
, it's because you must be using python 3.7- version.
The check is done on the line with the decorator (l367) whereas with python 3.8+ it's the decorated one that is (l368)
https://github.com/samuelcolvin/pydantic/blob/1a2791d4223ff1d18400432ef5d020ce6910aa4a/pydantic/main.py#L367-L368
We could probably just add a second # noqa: C901
on l367 like it's done above
https://github.com/samuelcolvin/pydantic/blob/1a2791d4223ff1d18400432ef5d020ce6910aa4a/pydantic/main.py#L211-L212
You are correct. I had messed up something with my virtualenvs. Tests all pass in a fresh new 3.8 environment. |
LGTM, please add a change description. |
df3945c
to
6123b55
Compare
Sorry, I already had this locally but failed to push it. It's in now. |
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.
LGTM!
thanks a lot. |
Change Summary
I was recently using the
stricturl
field type and declared some constants for the allowed schemes. Semantically, it makes the most sense to me to usefrozenset
s for those constants. Thus I propose to extend the type annotation to includeFrozenSet[str]
.Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)
Locally, the test suite fails for me with
but that's unrelated to my change.