Created
August 29, 2023 12:22
-
-
Save NilashishC/e435d19f377e8f07d62b2136d73bedb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import TypedDict, Unpack, assert_type | |
class CustomType(TypedDict): | |
"""test.""" | |
collection: dict[str, str] | |
name: str | |
plugin_type: str | |
docstring: str | |
data: CustomType = { | |
"collection": {"namespace": "testns", "name": "testname"}, | |
"name": "plugin_name", | |
"plugin_type": "module", | |
"docstring": "/path/to/ds", | |
} | |
def foo(**data: Unpack[CustomType]) -> None: | |
assert_type(data, CustomType) | |
foo(**data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment