App, lib, cmds: Fix mypy.explicit-override fallout

This commit adds @override decorators to approximately 300 methods
across 76 files that inherit from base classes such as AbstractCmd,
FileContext, ExecContext, Distro, SSHClient, and others.

The decorator ensures the type checker can verify that overridden
methods have compatible signatures and prevents accidental shadowing
of inherited methods without intent.

Files modified include command classes, library modules, distro
implementations, and SSH client implementations.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-22 15:51:14 +02:00
commit 5fa008be5a
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -7,7 +7,7 @@ import pwd
import sys
from functools import cache
from typing import TYPE_CHECKING
from typing import override, TYPE_CHECKING
from ..base import Result, StatResult
from ..ExecContext import ExecContext as Base
@ -25,6 +25,7 @@ class Local(Base):
def _username(self) -> str:
return pwd.getpwuid(os.getuid()).pw_name
@override
async def _run(
self,
cmd: list[str],
@ -155,9 +156,11 @@ class Local(Base):
if cwd is not None:
os.chdir(cwd)
@override
async def _unlink(self, path: str) -> None:
os.unlink(path)
@override
async def _erase(self, path: str) -> None:
if os.path.isdir(path):
import shutil
@ -165,26 +168,33 @@ class Local(Base):
return
os.unlink(path)
@override
async def _rename(self, src: str, dst: str) -> None:
os.rename(src, dst)
@override
async def _mkdir(self, path: str, mode: int) -> None:
os.mkdir(path, mode)
@override
async def _stat(self, path: str, follow_symlinks: bool) -> StatResult:
return StatResult.from_os(os.stat(path, follow_symlinks = follow_symlinks))
@override
async def _file_exists(self, path: str) -> bool:
return os.path.exists(path)
@override
async def _chown(self, path: str, owner: str | None, group: str | None) -> None:
uid = pwd.getpwnam(owner).pw_uid if owner else -1
gid = grp.getgrnam(group).gr_gid if group else -1
os.chown(path, uid, gid)
@override
async def _chmod(self, path: str, mode: int) -> None:
os.chmod(path, mode)
@override
async def _is_dir(self, path: str, follow_symlinks: bool) -> bool:
if (not follow_symlinks) and os.path.islink(path):
return False