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:
Jan Lindemann 2026-07-24 19:25:57 +02:00 • committed by janware DevOps
commit f171443d49
Signed by: DevOps
SSH key fingerprint: SHA256:cZiw7ExG5q3KAVm7Jse3rGITowu0VjgUgNMPbifmY8g

View file

@ -6,7 +6,7 @@ import re
from collections import OrderedDict
from collections.abc import MutableMapping
from enum import Enum, auto
from typing import TYPE_CHECKING, override
from typing import TYPE_CHECKING, Any, override
from typing import overload
@ -14,7 +14,7 @@ from typing import cast
if TYPE_CHECKING:
from collections.abc import Callable
from typing import Any, Iterator
from typing import Iterator
from ..log import DEBUG, INFO, get_caller_pos, slog
@ -53,7 +53,7 @@ def cleanup_string(s: str | StringTree) -> str | StringTree:
return s[1:-1].replace('\\' + s[0], s[0])
return s
class StringTree(MutableMapping): # export
class StringTree(MutableMapping[str, Any]): # export
class Error(Exception):
pass