Skip to content

Instantly share code, notes, and snippets.

@NilashishC
Created August 29, 2023 12:22
Show Gist options
  • Save NilashishC/e435d19f377e8f07d62b2136d73bedb6 to your computer and use it in GitHub Desktop.
Save NilashishC/e435d19f377e8f07d62b2136d73bedb6 to your computer and use it in GitHub Desktop.
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