App, lib: Add type annotations to untyped functions

Add missing type annotations to functions that are called from typed
contexts, satisfying the new disallow_untyped_calls mypy rule.

Fixes:
- Local.py: __log() with typed parameters
- lib/App.py: _add_arguments(), add_cmd_to_parser(), add_cmds_to_parser()
- pm/rpm.py, dpkg.py: meta_map() return type
- Exec.py: __init_askpass() return type
- App.py: strip_module_from_spec(), __get_project_refs_cached(),
  ResultCache.__init__ and run(), _add_arguments()
- Added Collection type for truthy-iterable compliance

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-22 22:48:42 +02:00
commit 410fd7ab5c
6 changed files with 26 additions and 15 deletions

View file

@ -14,14 +14,14 @@ from .Types import LoadTypes
from .util import pretty_cmd
if TYPE_CHECKING:
from collections.abc import Awaitable
from collections.abc import Awaitable, Collection
from typing import TypeVar
T = TypeVar('T')
class App: # export
def _add_arguments(self, parser):
def _add_arguments(self, parser: ArgumentParser) -> None:
self.__parser.add_argument(
'--log-flags', help = 'Log flags', default = self.__default_log_flags
)
@ -51,7 +51,7 @@ class App: # export
eloop: None = None,
) -> None:
def add_cmd_to_parser(cmd, parsers):
def add_cmd_to_parser(cmd: AbstractCmd, parsers: Any) -> ArgumentParser:
parser = parsers.add_parser(
cmd.name,
help = cmd.help,
@ -67,7 +67,7 @@ class App: # export
def add_cmds_to_parser(
parent: AbstractCmd | App,
parser: ArgumentParser,
cmds,
cmds: Collection[AbstractCmd],
all = False
) -> None:
if not cmds: