This file contains hidden or 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 Any, TypedDict, Union | |
from typeguard import CollectionCheckStrategy, check_type | |
class TypedObject: | |
def __init__(self, object_type: Any) -> None: | |
self.object_type = object_type | |
def validate(self, value: Any) -> Any: | |
check_type( |
This file contains hidden or 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
import json | |
from typing import Any, TypedDict, Union, Callable, Optional | |
from typeguard import CollectionCheckStrategy, check_type | |
Serializer = Optional[Callable] | |
def typed_object_factory(object_type: Any, serializer: Serializer=None): | |
class TypedObject: |
OlderNewer