-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
add asyncio.__all__
#13038
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 asyncio.__all__
#13038
Conversation
Neither pyright nor pytype like this very much. |
This comment has been minimized.
This comment has been minimized.
It seems that pyright and pytype gained support for += on |
The pytype error is slightly different. mypy complained about changing the length of the tuple type, which I worked around with the annotation of it as I'm not certain what, if any, annotation would satisfy both needs. |
This comment has been minimized.
This comment has been minimized.
Well, as Eric pointed out, this isn't in the typing spec. Technically this doesn't go beyond the typing spec: __all__ = ('a', 'b')
__all__ += submodule.__all__ where submodule is also a tuple |
I updated the MR to just be one giant platform x version matrix. It's not pretty and updating it won't be very ergonomic, but I don't see what other choice we have. |
This comment has been minimized.
This comment has been minimized.
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.
I'm honestly not a fan of duplicating all items in each branch instead of using __all__ += ...
inside the branches.
Me neither, but If we want to diverge from runtime and use a list for |
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.
I'm unsure what the better option is, but your logic makes sense.
Can't we just use lists if they work better with type checkers? In basically every use case of |
If we do that, we should probably get stubtest updated to ignore the type discrepancy on |
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.
typo: aysyncio
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
This is ugly, but other solutions also have problems, and if we miss a change in the future, stubtest will tell us, so the maintenance risk isn't that high. |
This passes the stubtest checks for
__all__
in the master branch of mypy.Runtime just sums over the
__all__
imported from each of the submodules. I tried that, but mypy didn't pick it up properly, so here's the explicit version, in all its messy glory.