X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=input_utils.py;h=77094daaa7a70cd83ebf0e2b5ba0adac311d2b01;hb=532df2c5b57c7517dfb3dddd8c1358fbadf8baf3;hp=e0b457d5a0e73ffc43d3d83ff09228328e6a641e;hpb=b29be4f1750fd20bd2eada88e751dfae85817882;p=python_utils.git diff --git a/input_utils.py b/input_utils.py index e0b457d..77094da 100644 --- a/input_utils.py +++ b/input_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities related to user input.""" import logging @@ -11,7 +13,6 @@ import readchar # type: ignore import exceptions - logger = logging.getLogger(__file__) @@ -38,7 +39,7 @@ def single_keystroke_response( try: while True: response = readchar.readchar() - logger.debug(f'Keystroke: {ord(response)}') + logger.debug('Keystroke: 0x%x', ord(response)) if response in valid_responses: break if ord(response) in os_special_keystrokes: @@ -52,9 +53,7 @@ def single_keystroke_response( print(prompt, end="") sys.stdout.flush() try: - response = _single_keystroke_response_internal( - valid_responses, timeout_seconds - ) + response = _single_keystroke_response_internal(valid_responses, timeout_seconds) if ord(response) == 3: raise KeyboardInterrupt('User pressed ^C in input_utils.')