lint: tidy up code in cli module

This commit is contained in:
Iain Learmonth 2022-06-17 13:21:35 +01:00
parent 5f7733d064
commit 98895e47de
6 changed files with 61 additions and 58 deletions

View file

@ -0,0 +1,22 @@
import argparse
from abc import abstractmethod
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
_SubparserType = argparse._SubParsersAction[argparse.ArgumentParser] # pylint: disable=protected-access
else:
_SubparserType = Any
class BaseCliHandler:
def __init__(self, args: argparse.Namespace) -> None:
self.args = args
@classmethod
@abstractmethod
def add_subparser_to(cls, subparsers: _SubparserType) -> None:
raise NotImplementedError
@abstractmethod
def run(self) -> None:
raise NotImplementedError