lint: tidy up code in cli module
This commit is contained in:
parent
5f7733d064
commit
98895e47de
6 changed files with 61 additions and 58 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue