Source code for result_py.contracts

from collections.abc import Iterable, Mapping
from typing import Protocol, TypeVar, runtime_checkable

type Identity[X] = X

T_co = TypeVar("T_co", covariant=True)

T_add = TypeVar("T_add")


[docs] @runtime_checkable class HasItems[K, V](Protocol):
[docs] def items(self) -> Iterable[tuple[K, V]]: ...
[docs] @runtime_checkable class HasRootMapping(Protocol[T_co]): @property def root(self) -> Mapping[str, T_co]: ...
[docs] @runtime_checkable class HasAdd(Protocol[T_add]): def __add__(self: T_add, value: T_add, /) -> T_add: ...