|
38 | 38 | import re |
39 | 39 | import sys |
40 | 40 | import threading |
41 | | -from code import InteractiveConsole |
42 | | -from collections import namedtuple |
43 | | -from contextlib import redirect_stdout |
| 41 | +from code import ( |
| 42 | + InteractiveConsole, |
| 43 | +) |
| 44 | +from collections import ( |
| 45 | + namedtuple, |
| 46 | +) |
| 47 | +from contextlib import ( |
| 48 | + redirect_stdout, |
| 49 | +) |
44 | 50 | from typing import ( |
45 | 51 | Any, |
46 | 52 | Callable, |
|
69 | 75 | get_paste_buffer, |
70 | 76 | write_to_paste_buffer, |
71 | 77 | ) |
72 | | -from .command_definition import CommandSet |
| 78 | +from .command_definition import ( |
| 79 | + CommandSet, |
| 80 | +) |
73 | 81 | from .constants import ( |
74 | 82 | CLASS_ATTR_DEFAULT_HELP_CATEGORY, |
75 | 83 | COMMAND_FUNC_PREFIX, |
|
118 | 126 | if rl_type == RlType.NONE: # pragma: no cover |
119 | 127 | sys.stderr.write(ansi.style_warning(rl_warning)) |
120 | 128 | else: |
121 | | - from .rl_utils import rl_force_redisplay, readline |
| 129 | + from .rl_utils import ( |
| 130 | + readline, |
| 131 | + rl_force_redisplay, |
| 132 | + ) |
122 | 133 |
|
123 | 134 | # Used by rlcompleter in Python console loaded by py command |
124 | 135 | orig_rl_delims = readline.get_completer_delims() |
|
133 | 144 |
|
134 | 145 | # Get the readline lib so we can make changes to it |
135 | 146 | import ctypes |
136 | | - from .rl_utils import readline_lib |
| 147 | + |
| 148 | + from .rl_utils import ( |
| 149 | + readline_lib, |
| 150 | + ) |
137 | 151 |
|
138 | 152 | rl_basic_quote_characters = ctypes.c_char_p.in_dll(readline_lib, "rl_basic_quote_characters") |
139 | 153 | orig_rl_basic_quotes = ctypes.cast(rl_basic_quote_characters, ctypes.c_void_p).value |
|
142 | 156 | ipython_available = True |
143 | 157 | try: |
144 | 158 | # noinspection PyUnresolvedReferences,PyPackageRequirements |
145 | | - from IPython import embed |
| 159 | + from IPython import ( |
| 160 | + embed, |
| 161 | + ) |
146 | 162 | except ImportError: # pragma: no cover |
147 | 163 | ipython_available = False |
148 | 164 |
|
@@ -1976,7 +1992,9 @@ def _complete_argparse_command( |
1976 | 1992 | cmd_set: Optional[CommandSet] = None |
1977 | 1993 | ) -> List[str]: |
1978 | 1994 | """Completion function for argparse commands""" |
1979 | | - from .argparse_completer import ArgparseCompleter |
| 1995 | + from .argparse_completer import ( |
| 1996 | + ArgparseCompleter, |
| 1997 | + ) |
1980 | 1998 |
|
1981 | 1999 | completer = ArgparseCompleter(argparser, self) |
1982 | 2000 | tokens, raw_tokens = self.tokens_for_completion(line, begidx, endidx) |
@@ -3283,7 +3301,9 @@ def complete_help_subcommands( |
3283 | 3301 | # Combine the command and its subcommand tokens for the ArgparseCompleter |
3284 | 3302 | tokens = [command] + arg_tokens['subcommands'] |
3285 | 3303 |
|
3286 | | - from .argparse_completer import ArgparseCompleter |
| 3304 | + from .argparse_completer import ( |
| 3305 | + ArgparseCompleter, |
| 3306 | + ) |
3287 | 3307 |
|
3288 | 3308 | completer = ArgparseCompleter(argparser, self) |
3289 | 3309 | return completer.complete_subcommand_help(tokens, text, line, begidx, endidx) |
@@ -3322,7 +3342,9 @@ def do_help(self, args: argparse.Namespace) -> None: |
3322 | 3342 |
|
3323 | 3343 | # If the command function uses argparse, then use argparse's help |
3324 | 3344 | if func is not None and argparser is not None: |
3325 | | - from .argparse_completer import ArgparseCompleter |
| 3345 | + from .argparse_completer import ( |
| 3346 | + ArgparseCompleter, |
| 3347 | + ) |
3326 | 3348 |
|
3327 | 3349 | completer = ArgparseCompleter(argparser, self) |
3328 | 3350 | tokens = [args.command] + args.subcommands |
@@ -3573,7 +3595,9 @@ def complete_set_value( |
3573 | 3595 | completer_method=settable.completer_method, |
3574 | 3596 | ) |
3575 | 3597 |
|
3576 | | - from .argparse_completer import ArgparseCompleter |
| 3598 | + from .argparse_completer import ( |
| 3599 | + ArgparseCompleter, |
| 3600 | + ) |
3577 | 3601 |
|
3578 | 3602 | completer = ArgparseCompleter(settable_parser, self) |
3579 | 3603 |
|
@@ -3861,7 +3885,9 @@ def py_quit(): |
3861 | 3885 | """Function callable from the interactive Python console to exit that environment""" |
3862 | 3886 | raise EmbeddedConsoleExit |
3863 | 3887 |
|
3864 | | - from .py_bridge import PyBridge |
| 3888 | + from .py_bridge import ( |
| 3889 | + PyBridge, |
| 3890 | + ) |
3865 | 3891 |
|
3866 | 3892 | py_bridge = PyBridge(self) |
3867 | 3893 | saved_sys_path = None |
@@ -4016,7 +4042,9 @@ def do_ipy(self, _: argparse.Namespace) -> Optional[bool]: |
4016 | 4042 |
|
4017 | 4043 | :return: True if running of commands should stop |
4018 | 4044 | """ |
4019 | | - from .py_bridge import PyBridge |
| 4045 | + from .py_bridge import ( |
| 4046 | + PyBridge, |
| 4047 | + ) |
4020 | 4048 |
|
4021 | 4049 | # noinspection PyUnusedLocal |
4022 | 4050 | def load_ipy(cmd2_app: Cmd, py_bridge: PyBridge): |
@@ -4559,8 +4587,12 @@ def _run_transcript_tests(self, transcript_paths: List[str]) -> None: |
4559 | 4587 | """ |
4560 | 4588 | import time |
4561 | 4589 | import unittest |
| 4590 | + |
4562 | 4591 | import cmd2 |
4563 | | - from .transcript import Cmd2TestCase |
| 4592 | + |
| 4593 | + from .transcript import ( |
| 4594 | + Cmd2TestCase, |
| 4595 | + ) |
4564 | 4596 |
|
4565 | 4597 | class TestMyAppCase(Cmd2TestCase): |
4566 | 4598 | cmdapp = self |
|
0 commit comments