Commit 7aabf2e 1 parent 4eeadd5 commit 7aabf2e Copy full SHA for 7aabf2e
File tree 5 files changed +31
-4
lines changed
5 files changed +31
-4
lines changed Original file line number Diff line number Diff line change
1
+ [mypy]
2
+ # Error codes can be used to write more specific `type: ignore` comments.
3
+ show_error_codes = True
4
+
5
+ [mypy-curio.*]
6
+ # Curio doesn't provide type hints.
7
+ ignore_missing_imports = True
8
+
9
+ [mypy-pytest.*]
10
+ # The version of pytest used doesn't provide type hints.
11
+ ignore_missing_imports = True
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
+ MYPY_VERSION=0.782
5
6
YAPF_VERSION=0.22.0
6
7
7
8
if [ " $TRAVIS_OS_NAME " = " osx" ]; then
@@ -75,6 +76,19 @@ in your local checkout.
75
76
EOF
76
77
exit 1
77
78
fi
79
+ pip install mypy==${MYPY_VERSION}
80
+ if ! mypy --pretty sniffio; then
81
+ cat << EOF
82
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
83
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
84
+
85
+ Type checking problems were found (listed above).
86
+
87
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
88
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
89
+ EOF
90
+ exit 1
91
+ fi
78
92
exit 0
79
93
fi
80
94
Original file line number Diff line number Diff line change 14
14
15
15
license = "MIT -or- Apache License 2.0" ,
16
16
packages = find_packages (),
17
+ package_data = {"sniffio" : ["py.typed" ]},
17
18
install_requires = [],
18
19
keywords = [
19
20
"async" ,
Original file line number Diff line number Diff line change 1
1
from contextvars import ContextVar
2
+ from typing import Optional
2
3
import sys
3
4
4
5
current_async_library_cvar = ContextVar (
5
6
"current_async_library_cvar" , default = None
6
- )
7
+ ) # type: ContextVar[Optional[str]]
7
8
8
9
9
10
class AsyncLibraryNotFoundError (RuntimeError ):
10
11
pass
11
12
12
13
13
- def current_async_library ():
14
+ def current_async_library () -> str :
14
15
"""Detect which async library is currently running.
15
16
16
17
The following libraries are currently supported:
@@ -65,9 +66,9 @@ async def generic_sleep(seconds):
65
66
if "asyncio" in sys .modules :
66
67
import asyncio
67
68
try :
68
- current_task = asyncio .current_task
69
+ current_task = asyncio .current_task # type: ignore[attr-defined]
69
70
except AttributeError :
70
- current_task = asyncio .Task .current_task
71
+ current_task = asyncio .Task .current_task # type: ignore[attr-defined]
71
72
try :
72
73
if current_task () is not None :
73
74
if (3 , 7 ) <= sys .version_info :
You can’t perform that action at this time.
0 commit comments