lib, cmds: Add exhaustive match cases

Add 'case _: pass' to match statements that are intentionally
non-exhaustive, satisfying the new exhaustive-match mypy rule.

Also replaced 'case '_':' (a string literal) with 'case _: pass' in
pkg_relations.py since it was an unreachable case (syntax is a
VersionSyntax enum, not a str).

Added 'case VersionSyntax.names_only:' to the match in pkg_relations.py
to handle the missing enum value.

Files modified:
- util.py: Two match statements for askpass env vars
- Distro.py: Three match statements for backend/os detection
- pkg_relations.py: Match on VersionSyntax enum
- CmdListRepos.py: Match on URL scheme

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:35:22 +02:00
commit 55b63ded69
4 changed files with 16 additions and 5 deletions

View file

@ -143,6 +143,8 @@ class CmdListRepos(Cmd): # export
f'instance at {args.base_url}, tried {", ".join(tried)}'
)
return
case _:
pass
if os.path.isdir(args.base_url):
for subdir in ['.', args.from_owner]:
out = []

View file

@ -150,6 +150,8 @@ def pkg_relations(
match syntax:
case VersionSyntax.semver:
pass
case VersionSyntax.names_only:
pass
case VersionSyntax.debian:
if len(expanded_dep) == 3:
match expanded_dep[1]:
@ -157,11 +159,10 @@ def pkg_relations(
expanded_dep[1] = '<<'
case '>':
expanded_dep[1] = '>>'
case '_':
raise NotImplementedError(
f'Unknown dependency syntax "{syntax}" for '
f'dependency "{dep[0]} {dep[1]} {dep[3]}"'
)
case _:
pass
case _:
pass
dep_str = ' '.join(expanded_dep)
if quote:
dep_str = '"' + dep_str + '"'