Validate Call
Decorator for validating function calls.
validate_call ¶
validate_call(*, config: ConfigDict | None = None, validate_return: bool = False) -> Callable[[AnyCallableT], AnyCallableT]
validate_call(func: AnyCallableT) -> AnyCallableT
validate_call(func: AnyCallableT | None = None, /, *, config: ConfigDict | None = None, validate_return: bool = False) -> AnyCallableT | Callable[[AnyCallableT], AnyCallableT]
Usage Documentation
Returns a decorated wrapper around the function that validates the arguments and, optionally, the return value.
Usage may be either as a plain decorator @validate_call or with arguments @validate_call(...).
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
func
|
AnyCallableT | None
|
The function to be decorated. |
None
|
config
|
ConfigDict | None
|
The configuration dictionary. |
None
|
validate_return
|
bool
|
Whether to validate the return value. |
False
|
返回:
| 类型 | 描述 |
|---|---|
AnyCallableT | Callable[[AnyCallableT], AnyCallableT]
|
The decorated function. |
源代码位于: .venv/lib/python3.13/site-packages/pydantic/validate_call_decorator.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |