-
Notifications
You must be signed in to change notification settings - Fork 193
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
Replace deprecated typing.Hashable with collections.abc.Hashable. #1068
Replace deprecated typing.Hashable with collections.abc.Hashable. #1068
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.
Thanks! I didn't know about PEP 585.
In fact all Callable, Mapping, NamedTuple, etc... should also be imported from collections.abc too, if I understand well the docs https://docs.python.org/3/library/stdtypes.html#types-genericalias.
We can start with Hashable here, and you may add an issue for the other types to be treated later. If that's what you prefer, tell me by answering this comment and I'll approve this PR.
If you are up to make a whole pass on these deprecations in this PR, let me know, I'll let you do it and add the approval once the pass is done.
Thank you again @carlosgmartin !
@vroulet I see a deprecation notice for but not for collections.abc doesn't seem to have the latter two. Is that right? If so, I can edit the first two. |
We keep Union as long as we support python 3.9 (we'll drop Union and Optional if we drop 3.9).
|
…ng with equivalents from collections.abc.
f9b816e
to
1cde704
Compare
@vroulet Updated. |
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 doing this!
According to the Python documentation, typing.Hashable is deprecated and should be replaced with collections.abc.Hashable. This PR fixes optax accordingly.