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

asyncio.BaseEventLoop missing #452

Closed
toejough opened this issue Aug 6, 2016 · 6 comments
Closed

asyncio.BaseEventLoop missing #452

toejough opened this issue Aug 6, 2016 · 6 comments

Comments

@toejough
Copy link
Contributor

toejough commented Aug 6, 2016

The current docs say that asyncio.BaseEventLoop is the base class for all asyncio event loops, but this definition is missing from the typeshed stubs for asyncio.

This results in mypy reporting error: Name 'asyncio.BaseEventLoop' is not defined when you check code like def get_or_create_event_loop() -> asyncio.BaseEventLoop.

Verified this class does exist and is callable as asyncio.BaseEventLoop with python 3.5.2:

> python
Python 3.5.2 (default, Jul 28 2016, 21:28:00)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> asyncio.BaseEventLoop
<class 'asyncio.base_events.BaseEventLoop'>
>>>

This is with the latest mypy from github, and the latest typeshed as a submodule:

> mypy --version
mypy 0.4.4-dev-72317c32c65cf318883a4c2ebec6ed9e065c2bfd
>
@gvanrossum
Copy link
Member

IIRC the PEP (3156) only has AbstractEventLoop. As a wotkaround you can use
that. Does that work?

On Saturday, August 6, 2016, toejough notifications@github.com wrote:

The current docs
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEventLoop
say that asyncio.BaseEventLoop is the base class for all asyncio event
loops, but this definition is missing from the typeshed stubs for asyncio
https://github.com/python/typeshed/blob/master/stdlib/3.4/asyncio/__init__.pyi
.

This results in mypy reporting error: Name 'asyncio.BaseEventLoop' is not
defined when you check code like def get_or_create_event_loop() ->
asyncio.BaseEventLoop.

Verified this class does exist and is callable as asyncio.BaseEventLoop
with python 3.5.2:

python
Python 3.5.2 (default, Jul 28 2016, 21:28:00)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.>>> import asyncio>>> asyncio.BaseEventLoop<class 'asyncio.base_events.BaseEventLoop'>>>>

This is with the latest mypy from github, and the latest typeshed as a
submodule:

mypy --version
mypy 0.4.4-dev-72317c32c65cf318883a4c2ebec6ed9e065c2bfd>


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#452, or mute the thread
https://github.com/notifications/unsubscribe-auth/ACwrMiLZAn3TOenh_ml9jNtNe6fy3Z2Sks5qdHrSgaJpZM4JeRLG
.

--Guido (mobile)

@toejough
Copy link
Contributor Author

toejough commented Aug 6, 2016

Yes, I am using that and things are working well - thank you!

@gvanrossum
Copy link
Member

Ah, so I think the problem here is the CPython docs for asyncio. While PEP 3156 only mentions AbstractEventLoop, the CPython docs only mention BaseEventLoop. I filed http://bugs.python.org/issue27700 to correct the CPython docs. But in the meantime maybe we should export BaseEventLoop as well? Do you have the time and energy to submit a PR for this purpose? (Unfortunately it will have to be pretty much a copy of AbstractEventLoop with all the @abstractmethod decorators taken out).

@toejough
Copy link
Contributor Author

toejough commented Aug 6, 2016

Sure - I'll make some time to submit a PR this week.

@gvanrossum
Copy link
Member

The CPython docs have been fixed to use AbstractEventLoop now. Should we still keep this open?

@toejough
Copy link
Contributor Author

nope, this can definitely be closed. Sorry I never got around to it myself 👎

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

No branches or pull requests

2 participants