Big diff: Use new "|" union syntax#5872
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
JelleZijlstra
left a comment
There was a problem hiding this comment.
Thanks, I checked a couple of file and this looks great.
Will leave this open for a while longer in case someone has an objection.
srittau
left a comment
There was a problem hiding this comment.
Thanks, I think it's a good idea to have the stubs as modern as can be, as they are likely to be used as examples for other stub creators.
|
I think I'll merge this once CI passes. Waiting longer causes conflicts that I have to fix manually, and that's error-prone and hard to review as a part of a huge PR. |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
|
@Akuli Will this also work on Python 3.9 because as far as I know this new syntax is being introduced in Python 3.10 ? |
|
The syntax works in |
|
@Akuli Ah, thanks! |
Done with quick and dirty scripts:
main script
Import cleaner (can mess up comments, needs manual checking)
Files left untouched (e.g. because scripts did something weird):
@python2stubs (stdlib and third party)stubs/protobuf/google/stdlib/_ast.pyistdlib/_thread.pyistdlib/ast.pyistdlib/asyncio/tasks.pyistdlib/configparser.pyistdlib/ctypes/__init__.pyistdlib/email/_header_value_parser.pyistdlib/os/__init__.pyistdlib/pickle.pyistdlib/types.pyistdlib/zoneinfo/__init__.pyistubs/Jinja2/jinja2/nodes.pyistubs/click/click/core.pyistubs/requests/requests/sessions.pyistubs/six/six/__init__.pyistubs/typed-ast/typed_ast/ast27.pyistubs/typed-ast/typed_ast/ast3.pyi