Skip to content

Commit 43d6867

Browse files
committed
Removed unnecessary stuff from top of cmd2/__init__.py
1 parent 7f0a47f commit 43d6867

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

cmd2/__init__.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
#
2-
# -*- coding: utf-8 -*-
3-
# flake8: noqa F401
41
"""This simply imports certain things for backwards compatibility."""
52

6-
import sys
7-
83
import importlib.metadata as importlib_metadata
4+
import sys
95

106
try:
117
__version__ = importlib_metadata.version(__name__)
128
except importlib_metadata.PackageNotFoundError: # pragma: no cover
139
# package is not installed
1410
pass
1511

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
1615
from typing import List
1716

1817
from .ansi import (
19-
Cursor,
2018
Bg,
21-
Fg,
19+
Cursor,
2220
EightBitBg,
2321
EightBitFg,
22+
Fg,
2423
RgbBg,
2524
RgbFg,
2625
TextStyle,
@@ -34,34 +33,28 @@
3433
set_default_argument_parser_type,
3534
)
3635

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-
4136
cmd2_parser_module = getattr(argparse, 'cmd2_parser_module', None)
4237
if cmd2_parser_module is not None:
4338
import importlib
4439

4540
importlib.import_module(cmd2_parser_module)
4641

42+
from . import plugin
4743
from .argparse_completer import set_default_ap_completer_type
48-
4944
from .cmd2 import Cmd
5045
from .command_definition import CommandSet, with_default_category
5146
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
5348
from .exceptions import (
5449
Cmd2ArgparseError,
5550
CommandSetRegistrationError,
5651
CompletionError,
5752
PassThroughException,
5853
SkipPostcommandHooks,
5954
)
60-
from . import plugin
6155
from .parsing import Statement
6256
from .py_bridge import CommandResult
63-
from .utils import categorize, CompletionMode, CustomCompletionSettings, Settable
64-
57+
from .utils import CompletionMode, CustomCompletionSettings, Settable, categorize
6558

6659
__all__: List[str] = [
6760
'COMMAND_NAME',

0 commit comments

Comments
 (0)