Skip to content

Commit a3b1b6d

Browse files
committed
Changed isort to force wrapping of imports to reduce merge conflicts from minor import changes.
1 parent c185904 commit a3b1b6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+668
-182
lines changed

cmd2/ansi.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,25 @@
55
"""
66
import functools
77
import re
8-
from enum import Enum
9-
from typing import IO, Any, List, Union
8+
from enum import (
9+
Enum,
10+
)
11+
from typing import (
12+
IO,
13+
Any,
14+
List,
15+
Union,
16+
)
1017

1118
import colorama
12-
from colorama import Back, Fore, Style
13-
from wcwidth import wcswidth
19+
from colorama import (
20+
Back,
21+
Fore,
22+
Style,
23+
)
24+
from wcwidth import (
25+
wcswidth,
26+
)
1427

1528
# On Windows, filter ANSI escape codes out of text sent to stdout/stderr, and replace them with equivalent Win32 calls
1629
colorama.init(strip=False)

cmd2/argparse_completer.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@
1010
import inspect
1111
import numbers
1212
import shutil
13-
from collections import deque
14-
from typing import Dict, List, Optional, Union
13+
from collections import (
14+
deque,
15+
)
16+
from typing import (
17+
Dict,
18+
List,
19+
Optional,
20+
Union,
21+
)
1522

16-
from . import ansi, cmd2, constants
23+
from . import (
24+
ansi,
25+
cmd2,
26+
constants,
27+
)
1728
from .argparse_custom import (
1829
ATTR_CHOICES_CALLABLE,
1930
ATTR_DESCRIPTIVE_COMPLETION_HEADER,
@@ -23,9 +34,17 @@
2334
CompletionItem,
2435
generate_range_error,
2536
)
26-
from .command_definition import CommandSet
27-
from .table_creator import Column, SimpleTable
28-
from .utils import CompletionError, basic_complete
37+
from .command_definition import (
38+
CommandSet,
39+
)
40+
from .table_creator import (
41+
Column,
42+
SimpleTable,
43+
)
44+
from .utils import (
45+
CompletionError,
46+
basic_complete,
47+
)
2948

3049
# If no descriptive header is supplied, then this will be used instead
3150
DEFAULT_DESCRIPTIVE_HEADER = 'Description'

cmd2/argparse_custom.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,25 @@ def my_completer_method(self, text, line, begidx, endidx, arg_tokens)
220220
import re
221221
import sys
222222
# noinspection PyUnresolvedReferences,PyProtectedMember
223-
from argparse import ONE_OR_MORE, ZERO_OR_MORE, ArgumentError, _
224-
from typing import Any, Callable, Optional, Tuple, Type, Union
225-
226-
from . import ansi, constants
223+
from argparse import (
224+
ONE_OR_MORE,
225+
ZERO_OR_MORE,
226+
ArgumentError,
227+
_,
228+
)
229+
from typing import (
230+
Any,
231+
Callable,
232+
Optional,
233+
Tuple,
234+
Type,
235+
Union,
236+
)
237+
238+
from . import (
239+
ansi,
240+
constants,
241+
)
227242

228243
############################################################################################################
229244
# The following are names of custom argparse argument attributes added by cmd2

cmd2/clipboard.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"""
55
import pyperclip
66
# noinspection PyProtectedMember
7-
from pyperclip import PyperclipException
7+
from pyperclip import (
8+
PyperclipException,
9+
)
810

911
# Can we access the clipboard? Should always be true on Windows and Mac, but only sometimes on Linux
1012
try:

cmd2/cmd2.py

Lines changed: 77 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,89 @@
3838
import re
3939
import sys
4040
import threading
41-
from code import InteractiveConsole
42-
from collections import namedtuple
43-
from contextlib import redirect_stdout
44-
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union
45-
46-
from . import ansi, constants, plugin, utils
47-
from .argparse_custom import DEFAULT_ARGUMENT_PARSER, CompletionItem
48-
from .clipboard import can_clip, get_paste_buffer, write_to_paste_buffer
49-
from .command_definition import CommandSet
50-
from .constants import CLASS_ATTR_DEFAULT_HELP_CATEGORY, COMMAND_FUNC_PREFIX, COMPLETER_FUNC_PREFIX, HELP_FUNC_PREFIX
51-
from .decorators import with_argparser, as_subcommand_to
41+
from code import (
42+
InteractiveConsole,
43+
)
44+
from collections import (
45+
namedtuple,
46+
)
47+
from contextlib import (
48+
redirect_stdout,
49+
)
50+
from typing import (
51+
Any,
52+
Callable,
53+
Dict,
54+
Iterable,
55+
List,
56+
Mapping,
57+
Optional,
58+
Tuple,
59+
Type,
60+
Union,
61+
)
62+
63+
from . import (
64+
ansi,
65+
constants,
66+
plugin,
67+
utils,
68+
)
69+
from .argparse_custom import (
70+
DEFAULT_ARGUMENT_PARSER,
71+
CompletionItem,
72+
)
73+
from .clipboard import (
74+
can_clip,
75+
get_paste_buffer,
76+
write_to_paste_buffer,
77+
)
78+
from .command_definition import (
79+
CommandSet,
80+
)
81+
from .constants import (
82+
CLASS_ATTR_DEFAULT_HELP_CATEGORY,
83+
COMMAND_FUNC_PREFIX,
84+
COMPLETER_FUNC_PREFIX,
85+
HELP_FUNC_PREFIX,
86+
)
87+
from .decorators import (
88+
as_subcommand_to,
89+
with_argparser,
90+
)
5291
from .exceptions import (
53-
CommandSetRegistrationError,
5492
Cmd2ShlexError,
93+
CommandSetRegistrationError,
5594
EmbeddedConsoleExit,
5695
EmptyStatement,
5796
RedirectionError,
58-
SkipPostcommandHooks
97+
SkipPostcommandHooks,
98+
)
99+
from .history import (
100+
History,
101+
HistoryItem,
102+
)
103+
from .parsing import (
104+
Macro,
105+
MacroArg,
106+
Statement,
107+
StatementParser,
108+
shlex_split,
109+
)
110+
from .rl_utils import (
111+
RlType,
112+
rl_get_point,
113+
rl_make_safe_prompt,
114+
rl_set_prompt,
115+
rl_type,
116+
rl_warning,
117+
vt100_support,
118+
)
119+
from .utils import (
120+
CompletionError,
121+
Settable,
122+
get_defining_class,
59123
)
60-
from .history import History, HistoryItem
61-
from .parsing import Macro, MacroArg, Statement, StatementParser, shlex_split
62-
from .rl_utils import RlType, rl_get_point, rl_make_safe_prompt, rl_set_prompt, rl_type, rl_warning, vt100_support
63-
from .utils import CompletionError, get_defining_class, Settable
64124

65125
# Set up readline
66126
if rl_type == RlType.NONE: # pragma: no cover

cmd2/command_definition.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22
"""
33
Supports the definition of commands in separate classes to be composed into cmd2.Cmd
44
"""
5-
from typing import Optional, Type
6-
7-
from .constants import CLASS_ATTR_DEFAULT_HELP_CATEGORY, COMMAND_FUNC_PREFIX
8-
from .exceptions import CommandSetRegistrationError
5+
from typing import (
6+
Optional,
7+
Type,
8+
)
9+
10+
from .constants import (
11+
CLASS_ATTR_DEFAULT_HELP_CATEGORY,
12+
COMMAND_FUNC_PREFIX,
13+
)
14+
from .exceptions import (
15+
CommandSetRegistrationError,
16+
)
917

1018
# Allows IDEs to resolve types without impacting imports at runtime, breaking circular dependency issues
1119
try: # pragma: no cover

cmd2/decorators.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
# coding=utf-8
22
"""Decorators for ``cmd2`` commands"""
33
import argparse
4-
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
5-
6-
from . import constants
7-
from .argparse_custom import Cmd2AttributeWrapper
8-
from .exceptions import Cmd2ArgparseError
9-
from .parsing import Statement
4+
from typing import (
5+
TYPE_CHECKING,
6+
Any,
7+
Callable,
8+
Dict,
9+
Iterable,
10+
List,
11+
Optional,
12+
Tuple,
13+
Union,
14+
)
15+
16+
from . import (
17+
constants,
18+
)
19+
from .argparse_custom import (
20+
Cmd2AttributeWrapper,
21+
)
22+
from .exceptions import (
23+
Cmd2ArgparseError,
24+
)
25+
from .parsing import (
26+
Statement,
27+
)
1028

1129
if TYPE_CHECKING: # pragma: no cover
1230
import cmd2

cmd2/history.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
"""
55

66
import re
7-
from typing import List, Union
7+
from typing import (
8+
List,
9+
Union,
10+
)
811

912
import attr
1013

11-
from . import utils
12-
from .parsing import Statement
14+
from . import (
15+
utils,
16+
)
17+
from .parsing import (
18+
Statement,
19+
)
1320

1421

1522
@attr.s(frozen=True)

cmd2/parsing.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,24 @@
44

55
import re
66
import shlex
7-
from typing import Dict, Iterable, List, Optional, Tuple, Union
7+
from typing import (
8+
Dict,
9+
Iterable,
10+
List,
11+
Optional,
12+
Tuple,
13+
Union,
14+
)
815

916
import attr
1017

11-
from . import constants, utils
12-
from .exceptions import Cmd2ShlexError
18+
from . import (
19+
constants,
20+
utils,
21+
)
22+
from .exceptions import (
23+
Cmd2ShlexError,
24+
)
1325

1426

1527
def shlex_split(str_to_split: str) -> List[str]:

cmd2/py_bridge.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
"""
66

77
import sys
8-
from contextlib import redirect_stderr, redirect_stdout
9-
from typing import Optional
10-
11-
from .utils import StdSim, namedtuple_with_defaults
8+
from contextlib import (
9+
redirect_stderr,
10+
redirect_stdout,
11+
)
12+
from typing import (
13+
Optional,
14+
)
15+
16+
from .utils import (
17+
StdSim,
18+
namedtuple_with_defaults,
19+
)
1220

1321

1422
class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr', 'stop', 'data'])):

0 commit comments

Comments
 (0)