annotate mercurial/thirdparty/attr/setters.pyi @ 52123:d12dc9139135 default tip

test: stabilize `test-audit-path.t` in rust (hopefully) We have been seeing flakiness on the file reported for a bit.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 26 Oct 2024 12:56:02 +0200
parents e1c586b9a43c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49643
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
1 from typing import Any, NewType, NoReturn, TypeVar, cast
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
2
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
3 from . import Attribute, _OnSetAttrType
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
4
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
5 _T = TypeVar("_T")
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
6
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
7 def frozen(
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
8 instance: Any, attribute: Attribute[Any], new_value: Any
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
9 ) -> NoReturn: ...
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
10 def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
11 def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
12
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
13 # convert is allowed to return Any, because they can be chained using pipe.
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
14 def convert(
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
15 instance: Any, attribute: Attribute[Any], new_value: Any
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
16 ) -> Any: ...
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
17
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
18 _NoOpType = NewType("_NoOpType", object)
e1c586b9a43c attr: vendor 22.1.0
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff changeset
19 NO_OP: _NoOpType