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 Protocol, runtime_checkable | |
from pydantic import BaseModel, BeforeValidator | |
import inspect | |
from functools import wraps | |
from typing import Annotated, Optional, get_type_hints, Protocol, runtime_checkable | |
def enforce_protocol(func): | |
sig = inspect.signature(func) | |
hints = get_type_hints(func) | |
@wraps(func) |