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:
parent
30a00df5c7
commit
5fa008be5a
78 changed files with 263 additions and 81 deletions
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import os
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import override, TYPE_CHECKING
|
||||
|
||||
from ...Distro import Distro as Base
|
||||
from ...log import NOTICE, log
|
||||
|
|
@ -38,9 +38,11 @@ class Distro(Base):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@override
|
||||
async def _ref(self) -> None:
|
||||
await self.apt_get(['update'])
|
||||
|
||||
@override
|
||||
async def _dup(self, download_only: bool) -> None:
|
||||
args: list[str] = []
|
||||
if download_only:
|
||||
|
|
@ -48,6 +50,7 @@ class Distro(Base):
|
|||
args.append('upgrade')
|
||||
await self.apt_get(args)
|
||||
|
||||
@override
|
||||
async def _reboot_required(self, verbose: bool) -> bool:
|
||||
reboot_required = '/run/reboot_required'
|
||||
if os.path.exists(reboot_required):
|
||||
|
|
@ -64,9 +67,11 @@ class Distro(Base):
|
|||
log(NOTICE, f"No. {reboot_required} doesn't exist.")
|
||||
return False
|
||||
|
||||
@override
|
||||
async def _select_by_name(self, names: Iterable[str]) -> Iterable[Package]:
|
||||
return await query_packages(names, ec = self.ctx)
|
||||
|
||||
@override
|
||||
async def _install(self, names: Iterable[str], only_update: bool) -> None:
|
||||
args = ['install']
|
||||
if only_update:
|
||||
|
|
@ -75,8 +80,10 @@ class Distro(Base):
|
|||
args.extend(names)
|
||||
await self.apt_get(args)
|
||||
|
||||
@override
|
||||
async def _delete(self, names: Iterable[str]) -> None:
|
||||
await self.dpkg(['-P', *names], sudo = True)
|
||||
|
||||
@override
|
||||
async def _pkg_files(self, name: str) -> Iterable[str]:
|
||||
return await list_files(name, ec = self.ctx)
|
||||
|
|
|
|||
Loading…
Reference in a new issue