comparison env/lib/python3.9/site-packages/attr/validators.pyi @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 from typing import (
2 Container,
3 List,
4 Union,
5 TypeVar,
6 Type,
7 Any,
8 Optional,
9 Tuple,
10 Iterable,
11 Mapping,
12 Callable,
13 Match,
14 AnyStr,
15 overload,
16 )
17 from . import _ValidatorType
18
19 _T = TypeVar("_T")
20 _T1 = TypeVar("_T1")
21 _T2 = TypeVar("_T2")
22 _T3 = TypeVar("_T3")
23 _I = TypeVar("_I", bound=Iterable)
24 _K = TypeVar("_K")
25 _V = TypeVar("_V")
26 _M = TypeVar("_M", bound=Mapping)
27
28 # To be more precise on instance_of use some overloads.
29 # If there are more than 3 items in the tuple then we fall back to Any
30 @overload
31 def instance_of(type: Type[_T]) -> _ValidatorType[_T]: ...
32 @overload
33 def instance_of(type: Tuple[Type[_T]]) -> _ValidatorType[_T]: ...
34 @overload
35 def instance_of(
36 type: Tuple[Type[_T1], Type[_T2]]
37 ) -> _ValidatorType[Union[_T1, _T2]]: ...
38 @overload
39 def instance_of(
40 type: Tuple[Type[_T1], Type[_T2], Type[_T3]]
41 ) -> _ValidatorType[Union[_T1, _T2, _T3]]: ...
42 @overload
43 def instance_of(type: Tuple[type, ...]) -> _ValidatorType[Any]: ...
44 def provides(interface: Any) -> _ValidatorType[Any]: ...
45 def optional(
46 validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]]
47 ) -> _ValidatorType[Optional[_T]]: ...
48 def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
49 def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
50 def matches_re(
51 regex: AnyStr,
52 flags: int = ...,
53 func: Optional[
54 Callable[[AnyStr, AnyStr, int], Optional[Match[AnyStr]]]
55 ] = ...,
56 ) -> _ValidatorType[AnyStr]: ...
57 def deep_iterable(
58 member_validator: _ValidatorType[_T],
59 iterable_validator: Optional[_ValidatorType[_I]] = ...,
60 ) -> _ValidatorType[_I]: ...
61 def deep_mapping(
62 key_validator: _ValidatorType[_K],
63 value_validator: _ValidatorType[_V],
64 mapping_validator: Optional[_ValidatorType[_M]] = ...,
65 ) -> _ValidatorType[_M]: ...
66 def is_callable() -> _ValidatorType[_T]: ...