From c9cd6b0fbb736c06d2c2cd7a71bdb2b3cc83006b Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Thu, 1 Apr 2021 20:34:01 +0200 Subject: [PATCH] Clean lazytox script (#48583) --- script/lazytox.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/script/lazytox.py b/script/lazytox.py index 5a8837b8154..1f2f4cf02b0 100755 --- a/script/lazytox.py +++ b/script/lazytox.py @@ -32,13 +32,14 @@ def printc(the_color, *args): return try: print(escape_codes[the_color] + msg + escape_codes["reset"]) - except KeyError: + except KeyError as err: print(msg) - raise ValueError(f"Invalid color {the_color}") + raise ValueError(f"Invalid color {the_color}") from err def validate_requirements_ok(): """Validate requirements, returns True of ok.""" + # pylint: disable=import-error,import-outside-toplevel from gen_requirements_all import main as req_main return req_main(True) == 0 @@ -67,7 +68,6 @@ async def async_exec(*args, display=False): printc("cyan", *argsp) try: kwargs = { - "loop": LOOP, "stdout": asyncio.subprocess.PIPE, "stderr": asyncio.subprocess.STDOUT, } @@ -232,15 +232,7 @@ async def main(): if __name__ == "__main__": - LOOP = ( - asyncio.ProactorEventLoop() - if sys.platform == "win32" - else asyncio.get_event_loop() - ) - try: - LOOP.run_until_complete(main()) + asyncio.run(main()) except (FileNotFoundError, KeyboardInterrupt): pass - finally: - LOOP.close()