lib: Change Iterable to Collection for truthy checks

Change parameter types from Iterable[str] to Collection[str] wherever
the parameter is tested for emptiness (if not names). This satisfies
the new truthy-iterable mypy rule, since bare Iterable values are
always truthy even when empty.

Affected files:
- Distro.py: install, delete, select, _select, _select_by_name
- rpm.py: query_packages
- suse/Distro.py: _select_by_name
- Cmd.py (secrets): _match_files, _list_template_files, etc.
- DistroContext.py: list_template_files, list_secret_paths, etc.

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:29:27 +02:00
commit dcbd4b1c84
5 changed files with 25 additions and 23 deletions

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Iterable
from typing import TYPE_CHECKING, Collection, Iterable
from ..base import InputMode
from ..Package import Package
@ -41,7 +41,7 @@ async def run_rpm( # export
return result.stdout_str
async def query_packages( # export
names: Iterable[str] = [],
names: Collection[str] = [],
ec: ExecContext | None = None,
) -> Iterable[Package]:
fmt_str = (