jw-pkg/src/python/jw/pkg/cmds/projects/CmdCommands.py
Jan Lindemann 5fa008be5a
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>
2026-08-07 18:02:26 +02:00

30 lines
892 B
Python

from __future__ import annotations
from .Cmd import Cmd, Parent
from typing import TYPE_CHECKING, override
if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
class CmdCommands(Cmd): # export
def __init__(self, parent: Parent) -> None:
super().__init__(parent, 'commands', help = 'List available commands')
@override
def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser)
@override
async def _run(self, args: Namespace) -> None:
import glob
import os
import re
this_dir = os.path.dirname(__file__)
ret = []
for file_name in glob.glob('Cmd*.py', root_dir = this_dir):
cc_name = re.sub(r'^Cmd|\.py', '', file_name)
name = re.sub(r'(?<!^)(?=[A-Z])', '-', cc_name).lower()
ret.append(name)
print(' '.join(ret))