Add new ruff rules and fix their fallout:
future-annotations = true
select = [ "TC", # type-checking import placement rules "FA", # future annotations rules ]This comprises:
- Streamline imports and exports in cmds.xxx.Cmd
- Import base class as "Base"- Export types Cmd and Parent via __all__- Move all types imported only for annotation below TYPE_CHECKING
- Use "from __future__ import annotations" all over the place
Signed-off-by: Jan Lindemann <jan@janware.com>
19 lines
483 B
Python
19 lines
483 B
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from ...CmdBase import CmdBase as Base
|
|
from ..CmdPosix import CmdPosix as Parent
|
|
|
|
if TYPE_CHECKING:
|
|
from argparse import ArgumentParser
|
|
|
|
class Cmd(Base): # export
|
|
|
|
def __init__(self, parent: Parent, name: str, help: str) -> None:
|
|
super().__init__(parent, name, help)
|
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
super().add_arguments(parser)
|
|
|
|
__all__ = ['Parent', 'Cmd']
|