[+] improve typing
This commit is contained in:
parent
6a2b14d8b9
commit
9f4b426229
@ -11,7 +11,7 @@ import os
|
||||
import logging
|
||||
|
||||
|
||||
from typing import (Optional, Any, cast,)
|
||||
from typing import (Optional, Any, cast, Type, TypeVar,)
|
||||
from typing_extensions import (
|
||||
Self, BinaryIO,
|
||||
)
|
||||
@ -55,7 +55,26 @@ class PyProject:
|
||||
)
|
||||
|
||||
tool: dict[str, Any] = dataclasses.field(
|
||||
default_factory=dict,
|
||||
default_factory=lambda : dict(),
|
||||
)
|
||||
|
||||
Key = TypeVar('Key')
|
||||
Value = TypeVar('Value')
|
||||
|
||||
def check_dict(
|
||||
value: Any,
|
||||
KT: Type[Key],
|
||||
VT: Type[Value],
|
||||
) -> dict[Key, Value]:
|
||||
assert isinstance(value, dict)
|
||||
value2 = cast(dict[Any, Any], value)
|
||||
assert all([
|
||||
isinstance(k, KT) and isinstance(v, VT)
|
||||
for k, v in value2.items()
|
||||
])
|
||||
return cast(
|
||||
dict[Key, Value],
|
||||
value,
|
||||
)
|
||||
|
||||
def pyproject_load(
|
||||
|
@ -114,10 +114,13 @@ include = [
|
||||
#'../../../../../follow_the_leader/views2/payments.py',
|
||||
#'../../../../../follow_the_leader/logic/payments.py',
|
||||
#'../../../../../follow_the_leader/logic/paypal.py',
|
||||
'python',
|
||||
'online/fxreader/pr34/commands_typed/**/*.py',
|
||||
]
|
||||
# stubPath = '../mypy-stubs'
|
||||
extraPaths = [
|
||||
'python',
|
||||
'.',
|
||||
'../mypy-stubs',
|
||||
'../mypy-stubs/types-debugpy',
|
||||
# '../../../../../',
|
||||
]
|
||||
#strict = ["src"]
|
||||
|
Loading…
Reference in New Issue
Block a user