Skip to content

Commit 77c1ac5

Browse files
committed
import key submodule into __init__
fixes #87
1 parent 01b4b0a commit 77c1ac5

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

readchar/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
or platform.startswith("freebsd")
1313
):
1414
from ._posix_read import readchar, readkey
15+
from . import _posix_key as key
1516
elif platform in ("win32", "cygwin"):
1617
from ._win_read import readchar, readkey
18+
from . import _win_key as key
1719
else:
1820
raise NotImplementedError(f"The platform {platform} is not supported yet")

readchar/key.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# flake8: noqa E401,E403
2+
# this file exists only for backwards compatability
3+
# it allow the use of `import readchar.key`
24

35
from . import platform
46

tests/posix/test_import.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ def test_readkeyImport():
1111

1212
def test_keyImport():
1313
a = {k: v for k, v in vars(readchar.key).items() if not k.startswith("__")}
14-
del a["platform"]
1514
b = {k: v for k, v in vars(readchar._posix_key).items() if not k.startswith("__")}
1615
assert a == b

tests/windows/test_import.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ def test_readkeyImport():
1111

1212
def test_keyImport():
1313
a = {k: v for k, v in vars(readchar.key).items() if not k.startswith("__")}
14-
del a["platform"]
1514
b = {k: v for k, v in vars(readchar._win_key).items() if not k.startswith("__")}
1615
assert a == b

0 commit comments

Comments
 (0)