diff options
author | Eric Lin <anselor@gmail.com> | 2020-07-24 12:21:43 -0400 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2020-08-04 13:38:08 -0400 |
commit | 06cee9126839c465a356f8b44a5f008853eb8cad (patch) | |
tree | 88de1a9f07f20fb6a7e1a8f77b1c48fb41382d19 /cmd2 | |
parent | 787a31931ed4c4a18ae66a570d396b12b2b7b525 (diff) | |
download | cmd2-git-06cee9126839c465a356f8b44a5f008853eb8cad.tar.gz |
updated imports
Added additional documentation
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/cmd2.py | 5 | ||||
-rw-r--r-- | cmd2/command_definition.py | 2 | ||||
-rw-r--r-- | cmd2/decorators.py | 5 |
3 files changed, 7 insertions, 5 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index affd395f..ca60a461 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -37,7 +37,6 @@ import pickle import re import sys import threading -import types from code import InteractiveConsole from collections import namedtuple from contextlib import redirect_stdout @@ -425,8 +424,8 @@ class Cmd(cmd.Cmd): cmdset.on_register(self) methods = inspect.getmembers( cmdset, - predicate=lambda meth: (inspect.ismethod(meth) or isinstance(meth, Callable)) and - meth.__name__.startswith(COMMAND_FUNC_PREFIX)) + predicate=lambda meth: (inspect.ismethod(meth) or isinstance(meth, Callable)) + and meth.__name__.startswith(COMMAND_FUNC_PREFIX)) installed_attributes = [] try: diff --git a/cmd2/command_definition.py b/cmd2/command_definition.py index 0645de2a..1858c80b 100644 --- a/cmd2/command_definition.py +++ b/cmd2/command_definition.py @@ -3,7 +3,7 @@ Supports the definition of commands in separate classes to be composed into cmd2.Cmd """ import functools -from typing import Callable, Dict, Iterable, Optional, Type +from typing import Callable, Iterable, Optional, Type from .constants import COMMAND_FUNC_PREFIX diff --git a/cmd2/decorators.py b/cmd2/decorators.py index aad44ac4..8c3739f1 100644 --- a/cmd2/decorators.py +++ b/cmd2/decorators.py @@ -1,12 +1,15 @@ # coding=utf-8 """Decorators for ``cmd2`` commands""" import argparse -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union from . import constants from .exceptions import Cmd2ArgparseError from .parsing import Statement +if TYPE_CHECKING: + import cmd2 + def with_category(category: str) -> Callable: """A decorator to apply a category to a ``do_*`` command method. |