Skip to content
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 __all__ for asyncio.unix_events & asyncio.taskgroups, and simplify asyncio.__init__ #7343

Merged
merged 4 commits into from
Feb 28, 2022

Conversation

AlexWaygood
Copy link
Member

Now that all asyncio submodules have accurate __all__s, we can drastically simplify the imports in asyncio.__init__.pyi and do something much more similar to what's done at runtime.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood changed the title Simplify asyncio.__init__ Add __all__ for aysncio.unix_events & asyncio.taskgroups, & simplify asyncio.__init__ Feb 21, 2022
@AlexWaygood AlexWaygood changed the title Add __all__ for aysncio.unix_events & asyncio.taskgroups, & simplify asyncio.__init__ Add __all__ for aysncio.unix_events & asyncio.taskgroups, and simplify asyncio.__init__ Feb 21, 2022
@AlexWaygood
Copy link
Member Author

@rchen152, any idea what the pytype error is trying to tell me? 🙂

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood changed the title Add __all__ for aysncio.unix_events & asyncio.taskgroups, and simplify asyncio.__init__ Add __all__ for asyncio.unix_events & asyncio.taskgroups, and simplify asyncio.__init__ Feb 21, 2022
@rchen152
Copy link
Collaborator

Looks like pytype is either not allowing __all__ to be imported multiple times or complaining about it being defined multiple times in the same file (despite the version guards). Either way, looks like a pytype bug to me =/ Investigating.

@AlexWaygood
Copy link
Member Author

Investigating.

Thank you!!

rchen152 added a commit to google/pytype that referenced this pull request Feb 23, 2022
* __all__ should always be skipped.
* Underscore-prefixed TypeVar definitions are obviously not meant to be
  exported.

See python/typeshed#7343.

PiperOrigin-RevId: 430327362
@rchen152
Copy link
Collaborator

I've submitted a fix for this; as long as I don't run into any unexpected problems, I should be able to cut a pytype release containing the fix tomorrow or Thursday.

@rchen152
Copy link
Collaborator

Alright, pytype-2022.2.23 is out. Let me know if you run into any problems.

AlexWaygood added a commit to AlexWaygood/typeshed that referenced this pull request Feb 24, 2022
JelleZijlstra pushed a commit that referenced this pull request Feb 24, 2022
@JelleZijlstra JelleZijlstra reopened this Feb 24, 2022
@AlexWaygood
Copy link
Member Author

Alright, pytype-2022.2.23 is out. Let me know if you run into any problems.

Looks like it's working great — thanks for the quick fix!

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

core (https://github.com/home-assistant/core)
+ homeassistant/runner.py:51: error: Unused "type: ignore[misc, valid-type]" comment
+ homeassistant/runner.py:62: error: "HassEventLoopPolicy" has no attribute "_loop_factory"  [attr-defined]

@AlexWaygood
Copy link
Member Author

Ping on this -- the CI is green now that the pytype version used in CI has been updated :)

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I'm a tad worried about the second line in the primer output, this can be sorted out later if necessary.

@srittau srittau merged commit bf167d4 into python:master Feb 28, 2022
@AlexWaygood AlexWaygood deleted the asyncio branch February 28, 2022 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants