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
78 changed files with 263 additions and 81 deletions

View file

@ -1,3 +1,4 @@
from typing import override
import asyncio
import os
import shlex
@ -42,10 +43,12 @@ class AsyncSSH(Base):
self.__connect_timeout = connect_timeout
self.__conn: asyncssh.SSHClientConnection | None = None
@override
async def _open(self) -> None:
await super()._open()
await self._conn
@override
async def _close(self) -> None:
if self.__conn is not None:
try:
@ -355,6 +358,7 @@ class AsyncSSH(Base):
stdout = b''.join(stdout_parts) if stdout_parts else None
return Result(stdout, None, exit_code, cmd = cmd)
@override
async def _run_ssh(
self,
cmd: list[str],

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import os
from typing import TYPE_CHECKING
from typing import override, TYPE_CHECKING
from ...base import InputMode
from ...util import run_cmd
@ -48,6 +48,7 @@ class Exec(Base):
self.__askpass_orig[key] = os.getenv(key)
os.environ[key] = val
@override
async def _run_ssh(
self,
cmd: list[str],

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import override, TYPE_CHECKING
# Tolerate missing paramiko imports. jw-pkg is designed to work with what it
# finds.
@ -52,15 +52,18 @@ class Paramiko(Base):
def __scp(self) -> Any:
return paramiko.SCPClient(self.__client.get_transport())
@override
async def _open(self) -> None:
await super()._open()
self.__client
@override
async def _close(self) -> None:
if self.___client is not None:
self.___client.close()
self.___client = None
@override
async def _run_ssh(
self,
cmd: list[str],