diff options
author | kotfu <kotfu@kotfu.net> | 2018-06-19 10:06:20 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-06-19 10:06:20 -0600 |
commit | 101395a437ef66846e207c039a12ee946128fab9 (patch) | |
tree | 4e024a7899396f4e111bda10f2cd8c053db12a5b /cmd2/pyscript_bridge.py | |
parent | b0a0251c77e73a3f3c0a755f3fabb9fdf136ccfa (diff) | |
parent | b5def934f4d368a7e1a1fe67a98b3cdcc14cd2d9 (diff) | |
download | cmd2-git-101395a437ef66846e207c039a12ee946128fab9.tar.gz |
Merge branch 'master' into plugin_functions
Diffstat (limited to 'cmd2/pyscript_bridge.py')
-rw-r--r-- | cmd2/pyscript_bridge.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py index 196be82b..9353e611 100644 --- a/cmd2/pyscript_bridge.py +++ b/cmd2/pyscript_bridge.py @@ -10,7 +10,7 @@ Released under MIT license, see LICENSE file import argparse import functools import sys -from typing import List, Tuple, Callable +from typing import List, Callable # Python 3.4 require contextlib2 for temporarily redirecting stderr and stdout if sys.version_info < (3, 5): @@ -40,7 +40,7 @@ class CommandResult(namedtuple_with_defaults('CmdResult', ['stdout', 'stderr', ' class CopyStream(object): """Copies all data written to a stream""" - def __init__(self, inner_stream, echo: bool = False): + def __init__(self, inner_stream, echo: bool = False) -> None: self.buffer = '' self.inner_stream = inner_stream self.echo = echo @@ -212,7 +212,7 @@ class ArgparseFunctor: def process_flag(action, value): if isinstance(action, argparse._CountAction): if isinstance(value, int): - for c in range(value): + for _ in range(value): cmd_str[0] += '{} '.format(action.option_strings[0]) return else: @@ -298,4 +298,5 @@ class PyscriptBridge(object): return commands def __call__(self, args: str): - return _exec_cmd(self._cmd2_app, functools.partial(self._cmd2_app.onecmd_plus_hooks, args + '\n'), self.cmd_echo) + return _exec_cmd(self._cmd2_app, functools.partial(self._cmd2_app.onecmd_plus_hooks, args + '\n'), + self.cmd_echo) |