fixed type errors when pylance type checking mode is strict.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from argparse import Namespace, _SubParsersAction
|
||||
from argparse import Namespace
|
||||
from typing import Any
|
||||
|
||||
from mdrsclient.api import LaboratoryApi
|
||||
from mdrsclient.commands.base import BaseCommand
|
||||
@ -6,15 +7,20 @@ from mdrsclient.commands.base import BaseCommand
|
||||
|
||||
class LabsCommand(BaseCommand):
|
||||
@classmethod
|
||||
def register(cls, parsers: _SubParsersAction) -> None:
|
||||
command = cls()
|
||||
def register(cls, parsers: Any) -> None:
|
||||
labs_parser = parsers.add_parser("labs", help="list all laboratories")
|
||||
labs_parser.add_argument("remote", help="label of remote host")
|
||||
labs_parser.set_defaults(func=command.labs)
|
||||
labs_parser.set_defaults(func=cls.func)
|
||||
|
||||
def labs(self, args: Namespace) -> None:
|
||||
remote = self._parse_remote_host(args.remote)
|
||||
connection = self._create_connection(remote)
|
||||
@classmethod
|
||||
def func(cls, args: Namespace) -> None:
|
||||
remote = str(args.remote)
|
||||
cls.labs(remote)
|
||||
|
||||
@classmethod
|
||||
def labs(cls, remote: str) -> None:
|
||||
remote = cls._parse_remote_host(remote)
|
||||
connection = cls._create_connection(remote)
|
||||
laboratory_api = LaboratoryApi(connection)
|
||||
laboratories = laboratory_api.list()
|
||||
connection.laboratories = laboratories
|
||||
|
Reference in New Issue
Block a user