mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-04 19:03:39 +00:00
feat: add py.typed for typing extensions
Extensions which use the tutor API need to know that the tutor package is typed. For that we add the py.typed file. Also, we fix the signature of get_typed. See: https://mypy.readthedocs.io/en/stable/installed_packages.html#installed-packages
This commit is contained in:
parent
7eeccfb5f5
commit
1161f925a4
@ -1,3 +1,4 @@
|
||||
include requirements/base.in
|
||||
include requirements/plugins.txt
|
||||
recursive-include tutor/templates *
|
||||
include tutor/py.typed
|
||||
|
0
tutor/py.typed
Normal file
0
tutor/py.typed
Normal file
@ -35,7 +35,10 @@ T = t.TypeVar("T")
|
||||
|
||||
|
||||
def get_typed(
|
||||
config: Config, key: str, expected_type: t.Type[T], default: t.Optional[T] = None
|
||||
config: t.Dict[str, t.Any],
|
||||
key: str,
|
||||
expected_type: t.Type[T],
|
||||
default: t.Optional[T] = None,
|
||||
) -> T:
|
||||
value = config.get(key, default)
|
||||
if not isinstance(value, expected_type):
|
||||
|
Loading…
Reference in New Issue
Block a user