2023-01-13 02:28:26 +00:00
|
|
|
from typing import Any, NewType, NoReturn, TypeVar
|
|
|
|
|
2024-06-07 14:38:19 +00:00
|
|
|
from . import Attribute
|
|
|
|
from attrs import _OnSetAttrType
|
2023-01-12 01:04:47 +00:00
|
|
|
|
|
|
|
_T = TypeVar("_T")
|
|
|
|
|
|
|
|
def frozen(
|
2023-01-13 02:28:26 +00:00
|
|
|
instance: Any, attribute: Attribute[Any], new_value: Any
|
2023-01-12 01:04:47 +00:00
|
|
|
) -> NoReturn: ...
|
|
|
|
def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
|
|
|
|
def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
|
|
|
|
|
|
|
|
# convert is allowed to return Any, because they can be chained using pipe.
|
|
|
|
def convert(
|
|
|
|
instance: Any, attribute: Attribute[Any], new_value: Any
|
|
|
|
) -> Any: ...
|
|
|
|
|
|
|
|
_NoOpType = NewType("_NoOpType", object)
|
|
|
|
NO_OP: _NoOpType
|