cmd2 2.5.5__py3-none-any.whl → 2.5.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cmd2/command_definition.py +6 -3
- {cmd2-2.5.5.dist-info → cmd2-2.5.6.dist-info}/METADATA +1 -1
- {cmd2-2.5.5.dist-info → cmd2-2.5.6.dist-info}/RECORD +6 -6
- {cmd2-2.5.5.dist-info → cmd2-2.5.6.dist-info}/LICENSE +0 -0
- {cmd2-2.5.5.dist-info → cmd2-2.5.6.dist-info}/WHEEL +0 -0
- {cmd2-2.5.5.dist-info → cmd2-2.5.6.dist-info}/top_level.txt +0 -0
cmd2/command_definition.py
CHANGED
@@ -10,6 +10,7 @@ from typing import (
|
|
10
10
|
Mapping,
|
11
11
|
Optional,
|
12
12
|
Type,
|
13
|
+
TypeVar,
|
13
14
|
)
|
14
15
|
|
15
16
|
from .constants import (
|
@@ -30,8 +31,10 @@ if TYPE_CHECKING: # pragma: no cover
|
|
30
31
|
#: Further refinements are needed to define the input parameters
|
31
32
|
CommandFunc = Callable[..., Optional[bool]]
|
32
33
|
|
34
|
+
CommandSetType = TypeVar('CommandSetType', bound=Type['CommandSet'])
|
33
35
|
|
34
|
-
|
36
|
+
|
37
|
+
def with_default_category(category: str, *, heritable: bool = True) -> Callable[[CommandSetType], CommandSetType]:
|
35
38
|
"""
|
36
39
|
Decorator that applies a category to all ``do_*`` command methods in a class that do not already
|
37
40
|
have a category specified.
|
@@ -42,7 +45,7 @@ def with_default_category(category: str, *, heritable: bool = True) -> Callable[
|
|
42
45
|
override the default category.
|
43
46
|
|
44
47
|
If `heritable` is set to False, then only the commands declared locally to this CommandSet will be placed in the
|
45
|
-
specified category. Dynamically created commands
|
48
|
+
specified category. Dynamically created commands and commands declared in sub-classes will not receive this
|
46
49
|
category.
|
47
50
|
|
48
51
|
:param category: category to put all uncategorized commands in
|
@@ -50,7 +53,7 @@ def with_default_category(category: str, *, heritable: bool = True) -> Callable[
|
|
50
53
|
:return: decorator function
|
51
54
|
"""
|
52
55
|
|
53
|
-
def decorate_class(cls:
|
56
|
+
def decorate_class(cls: CommandSetType) -> CommandSetType:
|
54
57
|
if heritable:
|
55
58
|
setattr(cls, CLASS_ATTR_DEFAULT_HELP_CATEGORY, category)
|
56
59
|
|
@@ -4,7 +4,7 @@ cmd2/argparse_completer.py,sha256=6z0zmODqM7vhQhI0c6JUvCmR2V4qfdWQEyTZeNIea8c,36
|
|
4
4
|
cmd2/argparse_custom.py,sha256=bbAYRr79ZSJWGchd7trmRQDHWAsSJaW0dTQMp65Mrv4,57806
|
5
5
|
cmd2/clipboard.py,sha256=7EISono76d7djj17hbvR9cCTB7jVGSBkUjgVQiMyUjE,549
|
6
6
|
cmd2/cmd2.py,sha256=_u8AqoPQ_3kydZOT_PJOb46qRqtHGKoUwN_g9mSwFfU,261510
|
7
|
-
cmd2/command_definition.py,sha256=
|
7
|
+
cmd2/command_definition.py,sha256=OscFEk-O2N20fb8_fhkczqclaCxOwYyxNTnXWXOlngg,7655
|
8
8
|
cmd2/constants.py,sha256=DioxETv-_HzcMUnjuPyz7Cqw4YEt_MTrzOMotiHj-Jo,1981
|
9
9
|
cmd2/decorators.py,sha256=tNVvNyOR6uZW_bkU1ti13bBDNKbN5V-AJtbTns_aSOQ,19743
|
10
10
|
cmd2/exceptions.py,sha256=DwX7rQmon4eRyX1ZK4yne4lObdPO1j5Agg3Bav6pXwU,3600
|
@@ -17,8 +17,8 @@ cmd2/rl_utils.py,sha256=HVPdNjuYyU67-XerPUJArmzhohzI1ABrZhU9cLc-EIs,11538
|
|
17
17
|
cmd2/table_creator.py,sha256=qoxt9s3MxQkfSkp4cIPFMlVzC7kRjUU55p0ow7pFQus,47544
|
18
18
|
cmd2/transcript.py,sha256=I0sD38RbG79Qz9GXIlfh1pHSNmWBTY2SLZAKEdSLWI4,9182
|
19
19
|
cmd2/utils.py,sha256=4eBvbG6yqe3wg9wwi2jdng2iy5gghueNQjuF2afSyuI,49385
|
20
|
-
cmd2-2.5.
|
21
|
-
cmd2-2.5.
|
22
|
-
cmd2-2.5.
|
23
|
-
cmd2-2.5.
|
24
|
-
cmd2-2.5.
|
20
|
+
cmd2-2.5.6.dist-info/LICENSE,sha256=QXrW0Z0merk9mncyUkn-sgRxhT8_o1dL5HEaBNH47Q4,1099
|
21
|
+
cmd2-2.5.6.dist-info/METADATA,sha256=8_-ALhxdH1tG6ZonYNcVZJ5wdpMCZ5sTj4Ka2axdLDM,13308
|
22
|
+
cmd2-2.5.6.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
23
|
+
cmd2-2.5.6.dist-info/top_level.txt,sha256=gJbOJmyrARwLhm5diXAtzlNQdxbDZ8iRJ8HJi65_5hg,5
|
24
|
+
cmd2-2.5.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|