mypy: Fix any_generics, redundant_casts, unused_ignores
Add mypy directives disallow_any_generics, warn_redundant_casts, and warn_unused_ignores. Fix all resulting type annotation errors: - load_yaml.py: Add type arguments to dict, tuple, set annotations; fix resolving dict/set types for link keys; handle str|int path types. - misc.py: Add Mapping[str, Any] and Iterable[Any] type arguments; fix multiline export comment to avoid bad pattern flag. - multi_key_dict.py: Add type argument to dict[tuple, Any]. - StringTree.py: Move Any import out of TYPE_CHECKING; fix MutableMapping type args. - serdes.py: Add type argument to re.Match. - Config.py: Change Config from Mapping to Mapping[str, str]; remove unused cast. - ev/base/Object.py, SimpleObject.py, EventLogger.py, PollerOneShot.py: Add Mapping[str, Any] type args. - ev/app/EventRouter.py: Add dict[str, Any] type args in inner functions. - auth/*: Remove now-unnecessary # type: ignore[return-value] comments. Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
9e24a2f394
commit
f171443d49
1 changed files with 43 additions and 34 deletions
|
|
@ -6,8 +6,9 @@ import re
|
|||
import sys
|
||||
|
||||
from collections.abc import Iterator, Mapping
|
||||
|
||||
from pathlib import Path
|
||||
from typing import cast, override
|
||||
from typing import override
|
||||
|
||||
from .stree import serdes
|
||||
from .log import DEBUG, ERR, slog, get_caller_pos
|
||||
|
|
@ -17,7 +18,7 @@ from .stree.StringTree import StringTree
|
|||
# world-accessible files that contain password/secret-like content.
|
||||
_REFUSE_MODE_MASK: int = 0o0027
|
||||
|
||||
class Config(Mapping): # export
|
||||
class Config(Mapping[str, str]): # export
|
||||
|
||||
def __load(
|
||||
self,
|
||||
|
|
@ -61,7 +62,7 @@ class Config(Mapping): # export
|
|||
if item.content is None:
|
||||
continue
|
||||
if not re.search('password|secret',
|
||||
cast('str', item.content),
|
||||
item.content,
|
||||
flags = re.IGNORECASE):
|
||||
continue
|
||||
msg = (
|
||||
|
|
|
|||
Loading…
Reference in a new issue