Skip to content

Commit

Permalink
import key submodule into __init__
Browse files Browse the repository at this point in the history
fixes #87
  • Loading branch information
Cube707 committed Jul 28, 2022
1 parent 01b4b0a commit 77c1ac5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions readchar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
or platform.startswith("freebsd")
):
from ._posix_read import readchar, readkey
from . import _posix_key as key
elif platform in ("win32", "cygwin"):
from ._win_read import readchar, readkey
from . import _win_key as key
else:
raise NotImplementedError(f"The platform {platform} is not supported yet")
2 changes: 2 additions & 0 deletions readchar/key.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# flake8: noqa E401,E403
# this file exists only for backwards compatability
# it allow the use of `import readchar.key`

from . import platform

Expand Down
1 change: 0 additions & 1 deletion tests/posix/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ def test_readkeyImport():

def test_keyImport():
a = {k: v for k, v in vars(readchar.key).items() if not k.startswith("__")}
del a["platform"]
b = {k: v for k, v in vars(readchar._posix_key).items() if not k.startswith("__")}
assert a == b
1 change: 0 additions & 1 deletion tests/windows/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ def test_readkeyImport():

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

0 comments on commit 77c1ac5

Please sign in to comment.