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:
parent
1f3e38e685
commit
9ed8c1cb18
1 changed files with 7 additions and 2 deletions
|
|
@ -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)}'
|
||||
|
|
|
|||
Loading…
Reference in a new issue