tokencrawler/.venv/lib/python3.9/site-packages/apischema/skip.py
2022-03-17 22:16:30 +01:00

19 lines
428 B
Python

__all__ = ["NotNull", "Skip"]
from typing import TypeVar, Union
from apischema.visitor import Unsupported
Skip = Unsupported
T = TypeVar("T")
try:
from apischema.typing import Annotated
NotNull = Union[T, Annotated[None, Skip]]
except ImportError:
class _NotNull:
def __getitem__(self, item):
raise TypeError("NotNull requires Annotated (PEP 593)")
NotNull = _NotNull() # type: ignore