[issue35987] Mypy and Asyncio import cannot be skipped

Samuel GIFFARD report at bugs.python.org
Wed Feb 13 08:43:38 EST 2019


New submission from Samuel GIFFARD <mulugruntz at gmail.com>:

Some modules cannot be found with mypy. And cannot be silenced/skipped by mypy.

Have the following 3 files:

##############################
# example1.py
from asyncio import BaseEventLoop  # Module 'asyncio' has no attribute 'BaseEventLoop'
from asyncio import Semaphore  # OK
import aiostream  # gets skipped correctly
import asyncio  # OK
asyncio.windows_events.WindowsProactorEventLoopPolicy()  # Module has no attribute 'windows_events'
asyncio.WindowsProactorEventLoopPolicy()  # Module has no attribute 'WindowsProactorEventLoopPolicy'

##############################
# mypy.ini
[mypy]
python_version = 3.7

[mypy-asyncio,aiostream]
follow_imports = skip
ignore_missing_imports = True

##############################
# Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]

[packages]
mypy = "==0.670"
aiostream = "==0.3.1"

[requires]
python_version = "3.7"

##############################
$> pipenv install
#...
$> pipenv run python -m mypy --config-file mypy.ini example1.py
example1.py:1: error: Module 'asyncio' has no attribute 'BaseEventLoop'
example1.py:5: error: Module has no attribute "windows_events"
example1.py:6: error: Module has no attribute "WindowsProactorEventLoopPolicy"


Why Semaphore (and others) works and BaseEventLoop (among others) doesn't work... no idea.
But it completely breaks mypy that it somehow cannot be skipped nor silenced.

----------
components: asyncio
messages: 335439
nosy: Samuel GIFFARD, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Mypy and Asyncio import cannot be skipped
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35987>
_______________________________________


More information about the Python-bugs-list mailing list