Config: Annotate __load() signature and paths_buf

The __load() method has no type annotations for any of its three
parameters, making it inconsistent with __init__ and harder for type
checkers to verify correctness. Add type annotations to all __load()
parameters and the paths_buf local variable.

The paths_buf variable needs an explicit list[str] annotation because
mypy cannot infer the type of an empty list literal when passed as
a mutable buffer argument to serdes.read().

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-14 14:51:54 +02:00 • committed by janware DevOps
commit 9ed8c1cb18
Signed by: DevOps
SSH key fingerprint: SHA256:cZiw7ExG5q3KAVm7Jse3rGITowu0VjgUgNMPbifmY8g

View file

@ -16,7 +16,12 @@ _REFUSE_MODE_MASK: int = 0o0027
class Config(): # export
def __load(self, search_dirs, glob_paths, refuse_mode_mask):
def __load(
self,
search_dirs: list[str] | None,
glob_paths: list[str] | None,
refuse_mode_mask: int | None
) -> StringTree:
ret = StringTree("", "")
exe = Path(os.path.basename(sys.argv[0])).stem
@ -41,7 +46,7 @@ class Config(): # export
slog(DEBUG, 'Looking for config "{}"'.format(g))
for f in glob.glob(g):
slog(DEBUG, 'Reading config "{}"'.format(f))
paths_buf = []
paths_buf: list[str] = []
tree = serdes.read(f, paths_buf = paths_buf)
assert len(paths_buf) > 0, \
f'Expected at least one path in paths_buf, got {len(paths_buf)}'