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
update AnyClassMethod
for change in python/typeshed#9771
#5505
update AnyClassMethod
for change in python/typeshed#9771
#5505
Conversation
ca7ab12
to
aefc695
Compare
please review For some reason, checks arn't starting for this MR to ensure that the new version of mypy passes. |
Please rebase this onto our current |
2d83499
to
a49c07a
Compare
@adriangb - I rebased but it was only 1 commit behind the intended branch. This is a patch for the currently released, non-prepreelase version (1.10) so rebasing onto |
pydantic/typing.py
Outdated
@@ -271,7 +271,8 @@ def is_union(tp: Optional[Type[Any]]) -> bool: | |||
MappingIntStrAny = Mapping[IntStr, Any] | |||
CallableGenerator = Generator[AnyCallable, None, None] | |||
ReprArgs = Sequence[Tuple[Optional[str], Any]] | |||
AnyClassMethod = classmethod[Any] | |||
# classmethod[TargetType, CallableParamSpecType, CallableReturnType] | |||
AnyClassMethod = classmethod[Any, Any, Any] |
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.
AnyClassMethod = classmethod[Any, Any, Any] | |
MYPY = False | |
if not MYPY: | |
AnyClassMethod = classmethod[Any, Any, Any] | |
else: | |
AnyClassMethod = classmethod[Any] |
I would suggest reverting the change to the mypy version (i.e., change it back to 0.971 in requirements-linting.txt
) and making this change instead, which I think should result in the update to the definition used by pyright but not mypy.
I think this should keep everything else behaving the same (so we don't need to worry about breaking existing mypy functionality), but please confirm that this change would work for you with pyright.
As far as I'm currently aware it's not our intention to support mypy v1.2.0 with pydantic v1, given the various breaking changes (it will be supported in pydantic v2 though), so I wouldn't worry about updating the requirements-linting.txt.
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.
It didn't work on the pright side as provided but it did work with the condition swapped. It also worked locally with mypy==0.971
.
as per @dmontagu comments above, please update. |
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
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
thanks so much. |
Any ETA on when we can expect to see this released? |
@ITProKyle this has just been released in v1.10.8, which should be available through PyPI shortly. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [pydantic](https://togithub.com/pydantic/pydantic) | `==1.10.7` -> `==1.10.8` | [![age](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/compatibility-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/confidence-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pydantic/pydantic</summary> ### [`v1.10.8`](https://togithub.com/pydantic/pydantic/releases/tag/v1.10.8): 2023-05-23 [Compare Source](https://togithub.com/pydantic/pydantic/compare/v1.10.7...v1.10.8) #### What's Changed - Fix a bug in `Literal` usage with `typing-extension==4.6.0`, [#​5826](https://togithub.com/pydantic/pydantic/issues/5826) by [@​hramezani](https://togithub.com/hramezani) - This solves the (closed) issue [#​3849](https://togithub.com/pydantic/pydantic/issues/3849) where aliased fields that use discriminated union fail to validate when the data contains the non-aliased field name, [#​5736](https://togithub.com/pydantic/pydantic/issues/5736) by [@​benwah](https://togithub.com/benwah) - Update email-validator dependency to >=2.0.0post2, [#​5627](https://togithub.com/pydantic/pydantic/issues/5627) by [@​adriangb](https://togithub.com/adriangb) - update `AnyClassMethod` for changes in [python/typeshed#​9771](https://togithub.com/python/typeshed/issues/9771), [#​5505](https://togithub.com/pydantic/pydantic/issues/5505) by [@​ITProKyle](https://togithub.com/ITProKyle) #### New Contributors - [@​DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos) made their first contribution in [pydantic/pydantic#5375 - [@​ITProKyle](https://togithub.com/ITProKyle) made their first contribution in [pydantic/pydantic#5505 - [@​benwah](https://togithub.com/benwah) made their first contribution in [pydantic/pydantic#5736 **Full Changelog**: pydantic/pydantic@v1.10.7...v1.10.8 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/allenporter/flux-local). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS45OC40IiwidXBkYXRlZEluVmVyIjoiMzUuOTguNCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [pydantic](https://togithub.com/pydantic/pydantic) | `==1.10.7` -> `==1.10.8` | [![age](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/compatibility-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/confidence-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pydantic/pydantic</summary> ### [`v1.10.8`](https://togithub.com/pydantic/pydantic/releases/tag/v1.10.8): 2023-05-23 [Compare Source](https://togithub.com/pydantic/pydantic/compare/v1.10.7...v1.10.8) ##### What's Changed - Fix a bug in `Literal` usage with `typing-extension==4.6.0`, [#​5826](https://togithub.com/pydantic/pydantic/issues/5826) by [@​hramezani](https://togithub.com/hramezani) - This solves the (closed) issue [#​3849](https://togithub.com/pydantic/pydantic/issues/3849) where aliased fields that use discriminated union fail to validate when the data contains the non-aliased field name, [#​5736](https://togithub.com/pydantic/pydantic/issues/5736) by [@​benwah](https://togithub.com/benwah) - Update email-validator dependency to >=2.0.0post2, [#​5627](https://togithub.com/pydantic/pydantic/issues/5627) by [@​adriangb](https://togithub.com/adriangb) - update `AnyClassMethod` for changes in [python/typeshed#​9771](https://togithub.com/python/typeshed/issues/9771), [#​5505](https://togithub.com/pydantic/pydantic/issues/5505) by [@​ITProKyle](https://togithub.com/ITProKyle) ##### New Contributors - [@​DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos) made their first contribution in [pydantic/pydantic#5375 - [@​ITProKyle](https://togithub.com/ITProKyle) made their first contribution in [pydantic/pydantic#5505 - [@​benwah](https://togithub.com/benwah) made their first contribution in [pydantic/pydantic#5736 **Full Changelog**: pydantic/pydantic@v1.10.7...v1.10.8 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/allenporter/pyrainbird). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS45OC40IiwidXBkYXRlZEluVmVyIjoiMzUuOTguNCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Change Summary
Updates the
AnyClassMethod
type variable to match recent changes to typeshed (python/typeshed#9771).Related issue number
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)
Selected Reviewer: @PrettyWood