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:
parent
a3e46121da
commit
55b63ded69
4 changed files with 16 additions and 5 deletions
|
|
@ -98,6 +98,8 @@ class Distro(abc.ABC):
|
|||
match ret:
|
||||
case 'opensuse-tumbleweed':
|
||||
return 'suse'
|
||||
case _:
|
||||
pass
|
||||
return ret
|
||||
|
||||
@classmethod
|
||||
|
|
@ -119,6 +121,8 @@ class Distro(abc.ABC):
|
|||
backend_id = 'redhat'
|
||||
case 'opensuse' | 'suse':
|
||||
backend_id = 'suse'
|
||||
case _:
|
||||
pass
|
||||
module_path = 'jw.pkg.lib.distros.' + backend_id + '.Distro'
|
||||
try:
|
||||
module = importlib.import_module(module_path)
|
||||
|
|
@ -173,6 +177,8 @@ class Distro(abc.ABC):
|
|||
__append('linux')
|
||||
__append('pkg-pm')
|
||||
__append('pm-pacman')
|
||||
case _:
|
||||
pass
|
||||
|
||||
os = self.os
|
||||
name = re.sub(r'-.*', '', os)
|
||||
|
|
|
|||
Loading…
Reference in a new issue