view mercurial/thirdparty/attr/setters.pyi @ 51402:2e10ddbb9faa

phases: check secret presence the right way during discovery There is an official function for this, lets use it. This will prevent the code to break in the future while we refactor the phase code.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 20 Feb 2024 17:17:54 +0100
parents e1c586b9a43c
children
line wrap: on
line source

from typing import Any, NewType, NoReturn, TypeVar, cast

from . import Attribute, _OnSetAttrType

_T = TypeVar("_T")

def frozen(
    instance: Any, attribute: Attribute[Any], new_value: Any
) -> 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