Source code for ewokscore.model
from typing import Any
try:
from typing import Annotated, get_args
except ImportError:
# python <3.9
from typing_extensions import Annotated, get_args
from pydantic import BaseModel, WrapValidator
from pydantic.annotated_handlers import GetCoreSchemaHandler
from .variable import Variable
from .hashing import HasUhash
from .hashing import UniversalHash
from .persistence.proxy import DataUri
from .persistence.proxy import DataProxy
class _IgnoresVariableWrapperTypes:
pass
_VARIABLE_WRAPPER_TYPES = Variable, UniversalHash, HasUhash, DataProxy, DataUri
def _ignore_variable_wrapper_types(value: Any, handler: GetCoreSchemaHandler) -> Any:
if isinstance(value, _VARIABLE_WRAPPER_TYPES):
return value
return handler(value)