diff --git a/tools/python/jwutils/Cmd.py b/tools/python/jwutils/Cmd.py index 394bbae..8ca5be4 100644 --- a/tools/python/jwutils/Cmd.py +++ b/tools/python/jwutils/Cmd.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import annotations -from typing import Optional, List, Type, Union, TypeVar import inspect, sys, re, abc, argparse from argparse import ArgumentParser, _SubParsersAction @@ -21,9 +20,9 @@ class Cmd(abc.ABC): # export self.name = name self.help = help self.parent = None - self.children: List[Cmd] = [] - self.child_classes: List[Type[Cmd]] = [] - self.app: Optional[Cmds] = None + self.children: list[Cmd] = [] + self.child_classes: list[type[Cmd]] = [] + self.app: Cmds|None = None async def _run(self, args): pass @@ -34,7 +33,7 @@ class Cmd(abc.ABC): # export r.set_defaults(func=self.run) return r - def add_subcommands(self, cmd: Union[str, Type[Cmd], List[Type[Cmd]]]) -> None: + def add_subcommands(self, cmd: str|type[Cmd]|list[type[Cmd]]) -> None: if isinstance(cmd, str): sc = [] for name, obj in inspect.getmembers(sys.modules[self.__class__.__module__]): diff --git a/tools/python/jwutils/Cmds.py b/tools/python/jwutils/Cmds.py index dd4402f..a784776 100644 --- a/tools/python/jwutils/Cmds.py +++ b/tools/python/jwutils/Cmds.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from typing import Optional import os, sys, argcomplete, argparse, importlib, inspect, re, pickle, asyncio, cProfile from argparse import ArgumentParser from pathlib import Path, PurePath