diff --git a/Makefile b/Makefile index 1bd1cbd..c5c07a7 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ test: mypy check mypy: - mypy async_timeout tests + mypy --config-file setup.cfg async_timeout tests check: diff --git a/async_timeout/__init__.py b/async_timeout/__init__.py index 08bdd47..e6e6124 100644 --- a/async_timeout/__init__.py +++ b/async_timeout/__init__.py @@ -2,7 +2,7 @@ import sys from types import TracebackType -from typing import Optional, Type +from typing import Optional, Type, Any __version__ = '3.0.0' @@ -25,12 +25,12 @@ class timeout: loop - asyncio compatible event loop """ def __init__(self, timeout: Optional[float], - *, loop: asyncio.AbstractEventLoop=None) -> None: + *, loop: Optional[asyncio.AbstractEventLoop] = None) -> None: self._timeout = timeout if loop is None: loop = asyncio.get_event_loop() self._loop = loop - self._task = None # type: Optional[asyncio.Task] + self._task = None # type: Optional[asyncio.Task[Any]] self._cancelled = False self._cancel_handler = None # type: Optional[asyncio.Handle] self._cancel_at = None # type: Optional[float] @@ -102,7 +102,7 @@ def _cancel_task(self) -> None: self._cancelled = True -def current_task(loop: asyncio.AbstractEventLoop) -> asyncio.Task: +def current_task(loop: asyncio.AbstractEventLoop) -> 'asyncio.Task[Any]': if PY_37: task = asyncio.current_task(loop=loop) # type: ignore else: diff --git a/setup.cfg b/setup.cfg index 919fd65..c4fd4f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,3 +6,16 @@ license_file = LICENSE [mypy-pytest] ignore_missing_imports = true + +[mypy] +python_version = 3.6 +warn_unused_ignores = True +warn_redundant_casts = True +warn_no_return = True +strict_optional = True +show_traceback = True +show_column_numbers = True +no_implicit_optional = True +disallow_incomplete_defs = True +disallow_any_generics = True +ignore_missing_imports = True