From 8a9f784f41c9e6ced084c7699d7718ee999f30e9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 28 Oct 2019 08:36:15 +0100 Subject: [PATCH] flake8 fixes for pyrepl/readline.py --- pyrepl/readline.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pyrepl/readline.py b/pyrepl/readline.py index 8ac466d..9da95ab 100644 --- a/pyrepl/readline.py +++ b/pyrepl/readline.py @@ -108,7 +108,7 @@ def get_completions(self, stem): while True: try: next = function(stem, state) - except: + except StopIteration: break if not isinstance(next, str): break @@ -424,13 +424,13 @@ def stub(*args, **kwds): stub.func_name = _name globals()[_name] = stub -for _name, _ret in [ - ('read_init_file', None), - ('redisplay', None), - ('set_pre_input_hook', None), -]: - assert _name not in globals(), _name - _make_stub(_name, _ret) + +assert 'read_init_file' not in globals() +read_init_file = _make_stub('read_init_file', None) +assert 'redisplay' not in globals() +redisplay = _make_stub('redisplay', None) +assert 'set_pre_input_hook' not in globals() +set_pre_input_hook = _make_stub('set_pre_input_hook', None) def _setup(): @@ -463,7 +463,7 @@ def _old_raw_input(prompt=''): del sys.__raw_input__ except AttributeError: pass - return raw_input(prompt) + return raw_input(prompt) # noqa: F821 sys.__raw_input__ = _wrapper.raw_input else: @@ -477,5 +477,6 @@ def _old_raw_input(prompt=''): _old_raw_input = builtins.input builtins.input = _wrapper.raw_input + _old_raw_input = None _setup()