|
3 | 3 | # flake8: noqa F401
|
4 | 4 | """This simply imports certain things for backwards compatibility."""
|
5 | 5 |
|
6 |
| -import sys |
7 |
| - |
8 | 6 | import importlib.metadata as importlib_metadata
|
9 | 7 |
|
10 | 8 | try:
|
|
15 | 13 |
|
16 | 14 | from typing import List
|
17 | 15 |
|
| 16 | +from . import plugin |
18 | 17 | from .ansi import (
|
19 |
| - Cursor, |
20 | 18 | Bg,
|
21 |
| - Fg, |
| 19 | + Cursor, |
22 | 20 | EightBitBg,
|
23 | 21 | EightBitFg,
|
| 22 | + Fg, |
24 | 23 | RgbBg,
|
25 | 24 | RgbFg,
|
26 | 25 | TextStyle,
|
27 | 26 | style,
|
28 | 27 | )
|
| 28 | +from .argparse_completer import set_default_ap_completer_type |
29 | 29 | from .argparse_custom import (
|
30 | 30 | Cmd2ArgumentParser,
|
31 | 31 | Cmd2AttributeWrapper,
|
32 | 32 | CompletionItem,
|
33 | 33 | register_argparse_argument_parameter,
|
34 | 34 | set_default_argument_parser_type,
|
35 | 35 | )
|
36 |
| - |
37 |
| -# Check if user has defined a module that sets a custom value for argparse_custom.DEFAULT_ARGUMENT_PARSER. |
38 |
| -# Do this before loading cmd2.Cmd class so its commands use the custom parser. |
39 |
| -import argparse |
40 |
| - |
41 |
| -cmd2_parser_module = getattr(argparse, 'cmd2_parser_module', None) |
42 |
| -if cmd2_parser_module is not None: |
43 |
| - import importlib |
44 |
| - |
45 |
| - importlib.import_module(cmd2_parser_module) |
46 |
| - |
47 |
| -from .argparse_completer import set_default_ap_completer_type |
48 |
| - |
49 | 36 | from .cmd2 import Cmd
|
50 |
| -from .command_definition import CommandSet, with_default_category |
51 |
| -from .constants import COMMAND_NAME, DEFAULT_SHORTCUTS |
52 |
| -from .decorators import with_argument_list, with_argparser, with_category, as_subcommand_to |
| 37 | +from .command_definition import ( |
| 38 | + CommandSet, |
| 39 | + with_default_category, |
| 40 | +) |
| 41 | +from .constants import ( |
| 42 | + COMMAND_NAME, |
| 43 | + DEFAULT_SHORTCUTS, |
| 44 | +) |
| 45 | +from .decorators import ( |
| 46 | + as_subcommand_to, |
| 47 | + with_argparser, |
| 48 | + with_argument_list, |
| 49 | + with_category, |
| 50 | +) |
53 | 51 | from .exceptions import (
|
54 | 52 | Cmd2ArgparseError,
|
55 | 53 | CommandSetRegistrationError,
|
56 | 54 | CompletionError,
|
57 | 55 | PassThroughException,
|
58 | 56 | SkipPostcommandHooks,
|
59 | 57 | )
|
60 |
| -from . import plugin |
61 | 58 | from .parsing import Statement
|
62 | 59 | from .py_bridge import CommandResult
|
63 |
| -from .utils import categorize, CompletionMode, CustomCompletionSettings, Settable |
64 |
| - |
| 60 | +from .utils import ( |
| 61 | + CompletionMode, |
| 62 | + CustomCompletionSettings, |
| 63 | + Settable, |
| 64 | + categorize, |
| 65 | +) |
65 | 66 |
|
66 | 67 | __all__: List[str] = [
|
67 | 68 | 'COMMAND_NAME',
|
|
81 | 82 | 'Cmd2AttributeWrapper',
|
82 | 83 | 'CompletionItem',
|
83 | 84 | 'register_argparse_argument_parameter',
|
84 |
| - 'set_default_argument_parser_type', |
85 | 85 | 'set_default_ap_completer_type',
|
| 86 | + 'set_default_argument_parser_type', |
86 | 87 | # Cmd2
|
87 | 88 | 'Cmd',
|
88 | 89 | 'CommandResult',
|
|
98 | 99 | 'Cmd2ArgparseError',
|
99 | 100 | 'CommandSetRegistrationError',
|
100 | 101 | 'CompletionError',
|
| 102 | + 'PassThroughException', |
101 | 103 | 'SkipPostcommandHooks',
|
102 | 104 | # modules
|
103 | 105 | 'plugin',
|
|
0 commit comments