setters.pyi 573 B

12345678910111213141516171819
  1. from typing import Any, NewType, NoReturn, TypeVar, cast
  2. from . import Attribute, _OnSetAttrType
  3. _T = TypeVar("_T")
  4. def frozen(
  5. instance: Any, attribute: Attribute[Any], new_value: Any
  6. ) -> NoReturn: ...
  7. def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
  8. def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
  9. # convert is allowed to return Any, because they can be chained using pipe.
  10. def convert(
  11. instance: Any, attribute: Attribute[Any], new_value: Any
  12. ) -> Any: ...
  13. _NoOpType = NewType("_NoOpType", object)
  14. NO_OP: _NoOpType