Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

validators.pyi 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. from typing import (
  2. Any,
  3. AnyStr,
  4. Callable,
  5. Container,
  6. ContextManager,
  7. Iterable,
  8. List,
  9. Mapping,
  10. Match,
  11. Optional,
  12. Pattern,
  13. Tuple,
  14. Type,
  15. TypeVar,
  16. Union,
  17. overload,
  18. )
  19. from . import _ValidatorType
  20. from . import _ValidatorArgType
  21. _T = TypeVar("_T")
  22. _T1 = TypeVar("_T1")
  23. _T2 = TypeVar("_T2")
  24. _T3 = TypeVar("_T3")
  25. _I = TypeVar("_I", bound=Iterable)
  26. _K = TypeVar("_K")
  27. _V = TypeVar("_V")
  28. _M = TypeVar("_M", bound=Mapping)
  29. def set_disabled(run: bool) -> None: ...
  30. def get_disabled() -> bool: ...
  31. def disabled() -> ContextManager[None]: ...
  32. # To be more precise on instance_of use some overloads.
  33. # If there are more than 3 items in the tuple then we fall back to Any
  34. @overload
  35. def instance_of(type: Type[_T]) -> _ValidatorType[_T]: ...
  36. @overload
  37. def instance_of(type: Tuple[Type[_T]]) -> _ValidatorType[_T]: ...
  38. @overload
  39. def instance_of(
  40. type: Tuple[Type[_T1], Type[_T2]]
  41. ) -> _ValidatorType[Union[_T1, _T2]]: ...
  42. @overload
  43. def instance_of(
  44. type: Tuple[Type[_T1], Type[_T2], Type[_T3]]
  45. ) -> _ValidatorType[Union[_T1, _T2, _T3]]: ...
  46. @overload
  47. def instance_of(type: Tuple[type, ...]) -> _ValidatorType[Any]: ...
  48. def provides(interface: Any) -> _ValidatorType[Any]: ...
  49. def optional(
  50. validator: Union[
  51. _ValidatorType[_T], List[_ValidatorType[_T]], Tuple[_ValidatorType[_T]]
  52. ]
  53. ) -> _ValidatorType[Optional[_T]]: ...
  54. def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
  55. def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
  56. def matches_re(
  57. regex: Union[Pattern[AnyStr], AnyStr],
  58. flags: int = ...,
  59. func: Optional[
  60. Callable[[AnyStr, AnyStr, int], Optional[Match[AnyStr]]]
  61. ] = ...,
  62. ) -> _ValidatorType[AnyStr]: ...
  63. def deep_iterable(
  64. member_validator: _ValidatorArgType[_T],
  65. iterable_validator: Optional[_ValidatorType[_I]] = ...,
  66. ) -> _ValidatorType[_I]: ...
  67. def deep_mapping(
  68. key_validator: _ValidatorType[_K],
  69. value_validator: _ValidatorType[_V],
  70. mapping_validator: Optional[_ValidatorType[_M]] = ...,
  71. ) -> _ValidatorType[_M]: ...
  72. def is_callable() -> _ValidatorType[_T]: ...
  73. def lt(val: _T) -> _ValidatorType[_T]: ...
  74. def le(val: _T) -> _ValidatorType[_T]: ...
  75. def ge(val: _T) -> _ValidatorType[_T]: ...
  76. def gt(val: _T) -> _ValidatorType[_T]: ...
  77. def max_len(length: int) -> _ValidatorType[_T]: ...
  78. def min_len(length: int) -> _ValidatorType[_T]: ...
  79. def not_(
  80. validator: _ValidatorType[_T],
  81. *,
  82. msg: Optional[str] = None,
  83. exc_types: Union[Type[Exception], Iterable[Type[Exception]]] = ...,
  84. ) -> _ValidatorType[_T]: ...