-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
jsonschema: {relative,absolute}_path can hold ints #7980
jsonschema: {relative,absolute}_path can hold ints #7980
Conversation
Not used to the `x|y` syntax
15ea157
to
83a515b
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
@sirosen, does this change make sense to you? :) |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Yes, this change is definitely an improvement -- the OP's comment/example on the earlier PR is accurate, and I'm sorry I didn't catch this earlier. I'm looking now to see if there are other |
I'll merge for now; further fixes can be made in further PRs if necessary. |
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.
Thanks for the fix, and thanks @sirosen for confirming!
Fixes #12901 by incoprating python/typeshed#7980 (The olddeps will automatically be fixed now, but let's pull in the more complete stubs for day-to-day use while we're at it.)
In matrix-org/synapse#12901 I noticed an problem with the changes to the jsonschema stubs in #7950.
This change remedies that by teaching mypy that paths, relative paths and absolute paths on Error objects can hold strings, ints, or a mixture of the two. For evidence that this is the case, see e.g. https://github.com/python-jsonschema/jsonschema/blob/2e2832463e8de7977217d377ca0553c10f6fb48c/jsonschema/tests/test_exceptions.py#L246-L247 or the test case I provided in #7950 (comment).