mypy: Fix disallow_untyped_calls check fallout

Add return type annotations and parameter type hints to previously
untyped functions, preparing for disallow_untyped_calls enforcement:

- ArgsContainer.py: keys() -> Iterable[str]
- Object.py: Object.__init__() -> None
- ShuntingYard.py: tokenize(), infix_to_postfix(), __init__(),
  add_operator(), Stack methods, debug(), Calculator/Matcher.__init__()
- ShellCmd.py: __exec(), __cleanup(), init(), cleanup(), __init__()
- Auth.py: __bind() -> Connection, import Connection
- TableIoHandler.py: _check_non_nullable() -> None, buf annotation
- Queries.py: _add() -> None
- rows.py: __equal(), rows_duplicates(), rows_check_not_null(),
  rows_dump(), rows_dumps() with proper type signatures
- CompositeForeignKey.py: __table() -> Table
- EventRouter.py: iter_peers() -> Iterator[tuple[str, Any]]
- MapAttr2Shape.py: __value(), __add_key_nodegraphics()
- ldap.py: __search() -> str, collect() -> set[str]
- multi_key_dict.py: has_key(), get_other_keys(), iterkeys(),
  get_values_from_str(), test_multi_key_dict(), __init__(),
  items_dict annotation

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 22:02:28 +02:00 • committed by janware DevOps
commit e014a9251f
Signed by: DevOps
SSH key fingerprint: SHA256:cZiw7ExG5q3KAVm7Jse3rGITowu0VjgUgNMPbifmY8g
4 changed files with 76 additions and 66 deletions

View file

@ -33,8 +33,8 @@ class TableIoHandler(ABC): # export
def _primary_keys(self):
return self._table_meta.primary_keys
def _check_non_nullable(self, rows):
buf = []
def _check_non_nullable(self, rows: list[dict[str, Any]]) -> None:
buf: list[dict[str, Any]] = []
non_nullable = self._table_meta.not_null_insertible_columns
try:
rows_check_not_null(rows, non_nullable, buf = buf)
@ -77,6 +77,9 @@ class TableIoHandler(ABC): # export
) -> TType:
slog(INFO, f'Reading table "{self._table_name}" from "{uri}"')
ret = self._load(uri, reference)
if check_duplicates:
slog(INFO, f'Checking duplicates in {self._table_name}')
d = rows_duplicates(ret)
if check_duplicates:
slog(INFO, f'Checking duplicates in {self._table_name}')
d = rows_duplicates(ret)

View file

@ -81,5 +81,5 @@ class Queries(abc.ABC): # export
self._add(ret)
# To be overriden in case the derived class wants to keep track
def _add(self, query):
def _add(self, query) -> None:
pass

View file

@ -5,6 +5,8 @@ import os
import re
import textwrap
from typing import Any
from tabulate import TableFormat, tabulate # type: ignore[import-untyped]
from ..log import (ERR, INFO, WARNING, get_caller_pos, prio_gets_logged, slog, slog_m)
@ -17,9 +19,9 @@ def rows_pretty(rows): # export
out.append(json.dumps(row, sort_keys = True, indent = 4, default = str))
return '\n'.join(out)
def rows_duplicates(rows, log_prio = INFO, caller = None): # export
def rows_duplicates(rows, log_prio = INFO, caller = None) -> list[int]: # export
def __equal(r1, r2):
def __equal(r1: dict[str, Any], r2: dict[str, Any]) -> bool:
for col in set(r1.keys()) | set(r2.keys()):
if col in r1:
if col not in r2:
@ -112,20 +114,20 @@ def rows_rewrite_regex(rows, rules): # export
raise
def rows_check_not_null( # export
rows,
rows: list[dict[str, Any]],
keys,
log_prio = WARNING,
buf = None,
buf: list[dict[str, Any]] | None = None,
stat_key = None,
throw = True,
throw: bool = True,
caller = None
):
) -> list[dict[str, Any]]:
if isinstance(keys, str):
keys = [keys]
if caller is None:
caller = get_caller_pos()
count = 0
stats = dict()
stats: dict[str, int] = dict()
if buf is None:
buf = []
else:
@ -165,7 +167,7 @@ def rows_dumps( # export
heading = None,
lead = None,
tablefmt = None
):
) -> str:
headers = 'keys'
dump_rows = rows
@ -244,9 +246,12 @@ def rows_dumps( # export
lead = ''
assert isinstance(tablefmt, str) or isinstance(tablefmt, TableFormat), 'tablefmt'
return header + heading + lead + tabulate(
dump_rows, headers = headers, tablefmt = tablefmt
) + footer
return cast(
str,
header + heading + lead + tabulate(
dump_rows, headers = headers, tablefmt = tablefmt
) + footer
)
def rows_dump( # export
rows,
@ -259,7 +264,7 @@ def rows_dump( # export
heading = None,
lead = None,
tablefmt = None
):
) -> None:
if not prio_gets_logged(log_prio):
return

View file

@ -1,12 +1,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, override
from typing import TYPE_CHECKING, Any, Optional, cast, override
from ...log import WARNING, slog
from .SingleForeignKey import SingleForeignKey
if TYPE_CHECKING:
from .ColumnSet import ColumnSet
from .Table import Table
class CompositeForeignKey: # export
@ -14,11 +15,11 @@ class CompositeForeignKey: # export
self, child_col_set: ColumnSet, parent_col_set: ColumnSet
): # TODO: Implement alternative ways to construct
def __table(s):
ret = None
def __table(s) -> Table:
ret: Table | None = None
for c in s:
if ret is None:
ret = c.table
ret = cast(Table, c.table)
else:
assert (ret == c.table)
assert (ret is not None)