From 9d388887f40930dc71a0f075e99adec3d7f074e2 Mon Sep 17 00:00:00 2001 From: Jan Wille Date: Fri, 15 Mar 2024 15:43:59 +0100 Subject: [PATCH] make `key.py` reflect `key` from `__init__` Fixes #107 --- readchar/key.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/readchar/key.py b/readchar/key.py index 359f3f0..55a3623 100644 --- a/readchar/key.py +++ b/readchar/key.py @@ -1,13 +1,11 @@ # flake8: noqa E401,E403 # this file exists only for backwards compatibility # it allows the use of `import readchar.key` +import sys -from . import platform +from . import key as __key -if platform.startswith(("linux", "darwin", "freebsd")): - from ._posix_key import * -elif platform in ("win32", "cygwin"): - from ._win_key import * -else: - raise NotImplementedError(f"The platform {platform} is not supported yet") +for __k, __v in vars(__key).items(): + if not __k.startswith("__"): + setattr(sys.modules[__name__], __k, __v)