mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Bump cherrypy from 18.8.0 to 18.9.0 (#2266)
* Bump cherrypy from 18.8.0 to 18.9.0 Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.8.0 to 18.9.0. - [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cherrypy/compare/v18.8.0...v18.9.0) --- updated-dependencies: - dependency-name: cherrypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cherrypy==18.9.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
cfefa928be
commit
faef9a94c4
673 changed files with 159850 additions and 11583 deletions
67
lib/pydantic/validate_call_decorator.py
Normal file
67
lib/pydantic/validate_call_decorator.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
"""Decorator for validating function calls."""
|
||||
from __future__ import annotations as _annotations
|
||||
|
||||
import functools
|
||||
from typing import TYPE_CHECKING, Any, Callable, TypeVar, overload
|
||||
|
||||
from ._internal import _validate_call
|
||||
|
||||
__all__ = ('validate_call',)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .config import ConfigDict
|
||||
|
||||
AnyCallableT = TypeVar('AnyCallableT', bound=Callable[..., Any])
|
||||
|
||||
|
||||
@overload
|
||||
def validate_call(
|
||||
*, config: ConfigDict | None = None, validate_return: bool = False
|
||||
) -> Callable[[AnyCallableT], AnyCallableT]:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def validate_call(__func: AnyCallableT) -> AnyCallableT:
|
||||
...
|
||||
|
||||
|
||||
def validate_call(
|
||||
__func: AnyCallableT | None = None,
|
||||
*,
|
||||
config: ConfigDict | None = None,
|
||||
validate_return: bool = False,
|
||||
) -> AnyCallableT | Callable[[AnyCallableT], AnyCallableT]:
|
||||
"""Usage docs: https://docs.pydantic.dev/2.6/concepts/validation_decorator/
|
||||
|
||||
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(...)`.
|
||||
|
||||
Args:
|
||||
__func: The function to be decorated.
|
||||
config: The configuration dictionary.
|
||||
validate_return: Whether to validate the return value.
|
||||
|
||||
Returns:
|
||||
The decorated function.
|
||||
"""
|
||||
|
||||
def validate(function: AnyCallableT) -> AnyCallableT:
|
||||
if isinstance(function, (classmethod, staticmethod)):
|
||||
name = type(function).__name__
|
||||
raise TypeError(f'The `@{name}` decorator should be applied after `@validate_call` (put `@{name}` on top)')
|
||||
validate_call_wrapper = _validate_call.ValidateCallWrapper(function, config, validate_return)
|
||||
|
||||
@functools.wraps(function)
|
||||
def wrapper_function(*args, **kwargs):
|
||||
return validate_call_wrapper(*args, **kwargs)
|
||||
|
||||
wrapper_function.raw_function = function # type: ignore
|
||||
|
||||
return wrapper_function # type: ignore
|
||||
|
||||
if __func:
|
||||
return validate(__func)
|
||||
else:
|
||||
return validate
|
Loading…
Add table
Add a link
Reference in a new issue