cmds / lib: Fix more static checker findings

Fix more errors and warnings produced by "make check" as reported by
CI and a pyright upgrade.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-06-01 07:45:22 +02:00
commit 24928c6f5d
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
16 changed files with 123 additions and 122 deletions

View file

@ -84,16 +84,14 @@ class Result:
if err is None:
return False
import re
return re.search(pattern, err) is not None
def __summarize(self, cmd: list[str] | None, wd: str | None = None) -> str:
from .util import pretty_cmd
if cmd is None:
cmd = self.__cmd
call = ''
if cmd is not None:
from .util import pretty_cmd
if wd is None:
wd = self.__wd
call = f'"{pretty_cmd(cmd, wd)}" '
@ -164,7 +162,6 @@ class StatResult(NamedTuple):
def from_os(cls, rhs: os.stat_result) -> StatResult:
import grp
import pwd
return StatResult(
rhs.st_mode,
pwd.getpwuid(rhs.st_uid).pw_name,