Skip to content

Commit 01d7d33

Browse files
JelleZijlstraasvetlov
authored andcommitted
more aggressive typing (#48)
1 parent 647437b commit 01d7d33

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ test: mypy check
33

44

55
mypy:
6-
mypy async_timeout tests
6+
mypy --config-file setup.cfg async_timeout tests
77

88

99
check:

async_timeout/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33

44
from types import TracebackType
5-
from typing import Optional, Type
5+
from typing import Optional, Type, Any
66

77

88
__version__ = '3.0.0'
@@ -25,12 +25,12 @@ class timeout:
2525
loop - asyncio compatible event loop
2626
"""
2727
def __init__(self, timeout: Optional[float],
28-
*, loop: asyncio.AbstractEventLoop=None) -> None:
28+
*, loop: Optional[asyncio.AbstractEventLoop] = None) -> None:
2929
self._timeout = timeout
3030
if loop is None:
3131
loop = asyncio.get_event_loop()
3232
self._loop = loop
33-
self._task = None # type: Optional[asyncio.Task]
33+
self._task = None # type: Optional[asyncio.Task[Any]]
3434
self._cancelled = False
3535
self._cancel_handler = None # type: Optional[asyncio.Handle]
3636
self._cancel_at = None # type: Optional[float]
@@ -102,7 +102,7 @@ def _cancel_task(self) -> None:
102102
self._cancelled = True
103103

104104

105-
def current_task(loop: asyncio.AbstractEventLoop) -> asyncio.Task:
105+
def current_task(loop: asyncio.AbstractEventLoop) -> 'asyncio.Task[Any]':
106106
if PY_37:
107107
task = asyncio.current_task(loop=loop) # type: ignore
108108
else:

setup.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,16 @@ license_file = LICENSE
66

77
[mypy-pytest]
88
ignore_missing_imports = true
9+
10+
[mypy]
11+
python_version = 3.6
12+
warn_unused_ignores = True
13+
warn_redundant_casts = True
14+
warn_no_return = True
15+
strict_optional = True
16+
show_traceback = True
17+
show_column_numbers = True
18+
no_implicit_optional = True
19+
disallow_incomplete_defs = True
20+
disallow_any_generics = True
21+
ignore_missing_imports = True

0 commit comments

Comments
 (0)