typing: Set Command.app type
The osc_lib.shell.Shell class provides far more functionality than cliff.app.App does and is what is actually used in practice. We also remove some old, commented out code. Change-Id: I972580747c627c2448c4a931bf8ae1ef1cd9558c Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
@@ -24,6 +24,9 @@ from cliff import show
|
||||
from osc_lib import exceptions
|
||||
from osc_lib.i18n import _
|
||||
|
||||
if ty.TYPE_CHECKING:
|
||||
from osc_lib import shell
|
||||
|
||||
|
||||
class CommandMeta(abc.ABCMeta):
|
||||
def __new__(
|
||||
@@ -41,6 +44,7 @@ class CommandMeta(abc.ABCMeta):
|
||||
|
||||
class Command(command.Command, metaclass=CommandMeta):
|
||||
log: logging.Logger
|
||||
app: 'shell.OpenStackShell'
|
||||
|
||||
def run(self, parsed_args: argparse.Namespace) -> int:
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
|
||||
@@ -18,15 +18,10 @@ import typing as ty
|
||||
|
||||
from osc_lib.command import command
|
||||
|
||||
if ty.TYPE_CHECKING:
|
||||
from osc_lib import shell
|
||||
|
||||
|
||||
class Timing(command.Lister):
|
||||
"""Show timing data"""
|
||||
|
||||
app: 'shell.OpenStackShell'
|
||||
|
||||
def take_action(
|
||||
self, parsed_args: argparse.Namespace
|
||||
) -> tuple[tuple[str, ...], list[ty.Any]]:
|
||||
|
||||
@@ -470,9 +470,6 @@ class OpenStackShell(app.App):
|
||||
"cloud cfg: %s", strutils.mask_password(self.cloud.config)
|
||||
)
|
||||
|
||||
# Callout for stuff between o-c-c and ClientManager
|
||||
# self._initialize_app_2(self.options)
|
||||
|
||||
self._load_plugins()
|
||||
|
||||
self._load_commands()
|
||||
|
||||
Reference in New Issue
Block a user