|
1 | | -# |
2 | | -# -*- coding: utf-8 -*- |
3 | | -# flake8: noqa F401 |
4 | 1 | """This simply imports certain things for backwards compatibility.""" |
5 | 2 |
|
6 | | -import sys |
7 | | - |
8 | 3 | import importlib.metadata as importlib_metadata |
| 4 | +import sys |
9 | 5 |
|
10 | 6 | try: |
11 | 7 | __version__ = importlib_metadata.version(__name__) |
12 | 8 | except importlib_metadata.PackageNotFoundError: # pragma: no cover |
13 | 9 | # package is not installed |
14 | 10 | pass |
15 | 11 |
|
| 12 | +# Check if user has defined a module that sets a custom value for argparse_custom.DEFAULT_ARGUMENT_PARSER. |
| 13 | +# Do this before loading cmd2.Cmd class so its commands use the custom parser. |
| 14 | +import argparse |
16 | 15 | from typing import List |
17 | 16 |
|
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, |
|
34 | 33 | set_default_argument_parser_type, |
35 | 34 | ) |
36 | 35 |
|
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 | 36 | cmd2_parser_module = getattr(argparse, 'cmd2_parser_module', None) |
42 | 37 | if cmd2_parser_module is not None: |
43 | 38 | import importlib |
44 | 39 |
|
45 | 40 | importlib.import_module(cmd2_parser_module) |
46 | 41 |
|
| 42 | +from . import plugin |
47 | 43 | from .argparse_completer import set_default_ap_completer_type |
48 | | - |
49 | 44 | from .cmd2 import Cmd |
50 | 45 | from .command_definition import CommandSet, with_default_category |
51 | 46 | from .constants import COMMAND_NAME, DEFAULT_SHORTCUTS |
52 | | -from .decorators import with_argument_list, with_argparser, with_category, as_subcommand_to |
| 47 | +from .decorators import as_subcommand_to, with_argparser, with_argument_list, with_category |
53 | 48 | from .exceptions import ( |
54 | 49 | Cmd2ArgparseError, |
55 | 50 | CommandSetRegistrationError, |
56 | 51 | CompletionError, |
57 | 52 | PassThroughException, |
58 | 53 | SkipPostcommandHooks, |
59 | 54 | ) |
60 | | -from . import plugin |
61 | 55 | from .parsing import Statement |
62 | 56 | from .py_bridge import CommandResult |
63 | | -from .utils import categorize, CompletionMode, CustomCompletionSettings, Settable |
64 | | - |
| 57 | +from .utils import CompletionMode, CustomCompletionSettings, Settable, categorize |
65 | 58 |
|
66 | 59 | __all__: List[str] = [ |
67 | 60 | 'COMMAND_NAME', |
|
0 commit comments