chore: stricter mypy config

This commit is contained in:
monosans
2024-12-21 17:49:42 +03:00
parent dc5ac84332
commit 62f3791c19
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -47,4 +47,4 @@ repos:
- types-aiofiles
- typing-extensions<5
- uvloop<0.22; implementation_name=='cpython' and (sys_platform=='darwin' or sys_platform=='linux')
- winloop<0.1.7; implementation_name=='cpython' and (sys_platform=='cygwin' or sys_platform=='win32')
- winloop<0.1.8; implementation_name=='cpython' and (sys_platform=='cygwin' or sys_platform=='win32')
-1
View File
@@ -1,5 +1,4 @@
[mypy]
follow_untyped_imports = True
python_version = 3.9
disallow_subclassing_any = False
disallow_untyped_calls = False
+4 -4
View File
@@ -53,23 +53,23 @@ _logger = logging.getLogger(__name__)
def get_async_run() -> Callable[[Coroutine[Any, Any, T]], T]:
if sys.implementation.name == "cpython":
try:
import uvloop # type: ignore[import-not-found, unused-ignore] # noqa: PLC0415
import uvloop # noqa: PLC0415
except ImportError:
pass
else:
try:
return uvloop.run # type: ignore[no-any-return, unused-ignore]
return uvloop.run # type: ignore[no-any-return]
except AttributeError:
uvloop.install()
return asyncio.run
try:
import winloop # type: ignore[import-not-found, unused-ignore] # noqa: PLC0415
import winloop # noqa: PLC0415
except ImportError:
pass
else:
try:
return winloop.run # type: ignore[no-any-return, unused-ignore]
return winloop.run # type: ignore[no-any-return]
except AttributeError:
winloop.install()
return asyncio.run