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:
parent
cbd6bac84c
commit
dcbd4b1c84
5 changed files with 25 additions and 23 deletions
|
|
@ -6,6 +6,7 @@ from ...Distro import Distro as Base
|
|||
from ...pm.rpm import list_files, query_packages, run_rpm
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Collection
|
||||
from typing import Iterable
|
||||
|
||||
from ...base import Result
|
||||
|
|
@ -68,7 +69,7 @@ class Distro(Base):
|
|||
return False
|
||||
|
||||
@override
|
||||
async def _select_by_name(self, names: Iterable[str]) -> Iterable[Package]:
|
||||
async def _select_by_name(self, names: Collection[str]) -> Iterable[Package]:
|
||||
return await query_packages(names, ec = self.ctx)
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Reference in a new issue