U nf( @s<UdZddlmZddlmZmZddlmZddl m Z m Z m Z m Z mZmZddlmZddlmZmZmZmZdd lmZmZdd lmZdd lmZd Ze r~Gd ddeZGdddeZGdddeZ GdddeZ!GdddeZ"GdddeZ#eeee e!e"ej$ej%ej&ej'f Z(ee#ej)fZ*ee+e e e fe,e e fee fZ-de.d<e de(e-Z/e dej)e#e-Z0neZ1edddd d d dd d!d"d"d#d#d#d$d#d%d&d'd(Z2ed)d*d+d#d,d-d.d/Z3ed)d*d+d#d,d0d1d/Z3ed)d*d2d+d#d,d3d4d/Z3ed5ddd d d d6d#d#d#d7d3d8d/Z3dS)9zCOld `@validator` and `@root_validator` function validators from V1.) annotations)partial partialmethod) FunctionType) TYPE_CHECKINGAnyCallableTypeVarUnionoverload)warn)LiteralProtocol TypeAlias deprecated) _decorators_decorators_v1)PydanticUserError)PydanticDeprecatedSince20zQ`allow_reuse` is deprecated and will be ignored; it should no longer be necessaryc@seZdZddddddZdS)_OnlyValueValidatorClsMethodr)!_OnlyValueValidatorClsMethod__cls#_OnlyValueValidatorClsMethod__valuereturncCsdSN)selfrrrrR/opt/hc_python/lib/python3.8/site-packages/pydantic/deprecated/class_validators.py__call__z%_OnlyValueValidatorClsMethod.__call__N__name__ __module__ __qualname__rrrrrrsrc@s eZdZdddddddZdS)_V1ValidatorWithValuesClsMethodrdict[str, Any])$_V1ValidatorWithValuesClsMethod__cls&_V1ValidatorWithValuesClsMethod__valuevaluesrcCsdSrr)rr&r'r(rrrrrz(_V1ValidatorWithValuesClsMethod.__call__Nr rrrrr$sr$c@s eZdZdddddddZdS)%_V1ValidatorWithValuesKwOnlyClsMethodrr%)*_V1ValidatorWithValuesKwOnlyClsMethod__cls,_V1ValidatorWithValuesKwOnlyClsMethod__valuer(rcCsdSrr)rr*r+r(rrrrrz._V1ValidatorWithValuesKwOnlyClsMethod.__call__Nr rrrrr)sr)c@seZdZddddddZdS)_V1ValidatorWithKwargsClsMethodr)$_V1ValidatorWithKwargsClsMethod__clskwargsrcKsdSrr)rr-r.rrrrrz(_V1ValidatorWithKwargsClsMethod.__call__Nr rrrrr,sr,c@s eZdZdddddddZdS)(_V1ValidatorWithValuesAndKwargsClsMethodrr%)-_V1ValidatorWithValuesAndKwargsClsMethod__clsr(r.rcKsdSrr)rr0r(r.rrrr"rz1_V1ValidatorWithValuesAndKwargsClsMethod.__call__Nr rrrrr/!sr/c@seZdZddddddZdS)_V1RootValidatorClsMethodrz"_decorators_v1.RootValidatorValues)_V1RootValidatorClsMethod__cls!_V1RootValidatorClsMethod__valuesrcCsdSrr)rr2r3rrrr%sz"_V1RootValidatorClsMethod.__call__Nr rrrrr1$sr1r_PartialClsOrStaticMethod_V1ValidatorType_V1RootValidatorFunctionTypePydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more detailsN)categoryF)pre each_itemalways check_fields allow_reusestrboolz bool | Nonez.Callable[[_V1ValidatorType], _V1ValidatorType])__fieldfieldsr9r:r;r<r=rcstdtdd|dkr tttt|ftdtrJtdddntd d Dshtd d d|dkrtd nddddfdd }|S)aDecorate methods on the class indicating that they should be used to validate fields. Args: __field (str): The first field the validator should be called on; this is separate from `fields` to ensure an error is raised if you don't pass at least one. *fields (str): Additional field(s) the validator should be called on. pre (bool, optional): Whether this validator should be called before the standard validators (else after). Defaults to False. each_item (bool, optional): For complex objects (sets, lists etc.) whether to validate individual elements rather than the whole object. Defaults to False. always (bool, optional): Whether this method and other validators should be called even if the value is missing. Defaults to False. check_fields (bool | None, optional): Whether to check that the fields actually exist on the model. Defaults to None. allow_reuse (bool, optional): Whether to track and raise an error if another validator refers to the decorated function. Defaults to False. Returns: Callable: A decorator that can be used to decorate a function to be used as a validator. r7r stacklevelTrz`@validator` should be used with fields and keyword arguments, not bare. E.g. usage should be `@validator('', ...)`zvalidator-no-fieldscodecss|]}t|tVqdSr) isinstancer>).0fieldrrr szvalidator..z`@validator` fields should be passed as separate string args. E.g. usage should be `@validator('', '', ...)`zvalidator-invalid-fieldsbeforeafterrz(_decorators.PydanticDescriptorProxy[Any]frcsJt|rtdddt|}tj}tjd}tj|||dS)Nz2`@validator` cannot be applied to instance methodszvalidator-instance-methodrD)rAmoder:r;r<Zshim)ris_instance_method_from_sigr%ensure_classmethod_based_on_signaturerZmake_generic_v1_field_validatorZValidatorDecoratorInfoPydanticDescriptorProxy)rMwrapZvalidator_wrapper_infor;r<r:rArNrrdecs  zvalidator..dec)r DeprecationWarning_ALLOW_REUSE_WARNING_MESSAGEtuplerFrrall)r@r9r:r;r<r=rArUrrTr validatorLs*$ rZ.)r=z Literal[True]zFCallable[[_V1RootValidatorFunctionType], _V1RootValidatorFunctionType])skip_on_failurer=rcCsdSrr)r[r=rrrroot_validators r\)r9r=rcCsdSrr)r9r=rrrr\s zLiteral[False])r9r[r=rcCsdSrrr9r[r=rrrr\s Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more detailsr]rcstdtdd|rt|S|dkr.ttt|dkr:dnd|dkrZ|dk rZtdd d ttj|d d d dfdd }|S)aDecorate methods on a model indicating that they should be used to validate (and perhaps modify) data either before or after standard model parsing/validation is performed. Args: pre (bool, optional): Whether this validator should be called before the standard validators (else after). Defaults to False. skip_on_failure (bool, optional): Whether to stop validation and return as soon as a failure is encountered. Defaults to False. allow_reuse (bool, optional): Whether to track and raise an error if another validator refers to the decorated function. Defaults to False. Returns: Any: A decorator that can be used to decorate a function to be used as a root_validator. r^rrBTrJrKFzIf you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.zroot-validator-pre-skiprD)r9zHCallable[..., Any] | classmethod[Any, Any, Any] | staticmethod[Any, Any]rrLcs8t|rtdt|}tjd}tj||dS)Nz7`@root_validator` cannot be applied to instance methods)rNrO)rrP TypeErrorrQZRootValidatorDecoratorInforR)rMresZdec_inforNrSrrrUs    zroot_validator..dec)r rVr\rWrrrZmake_v1_generic_root_validator)r9r[r=Z__argsrUrrarr\s$  )4__doc__ __future__rZ _annotations functoolsrrtypesrtypingrrrr r r warningsr typing_extensionsr rrr _internalrrerrorsrrrWrr$r)r,r/r1ZV1ValidatorWithValuesZV1ValidatorWithValuesKwOnlyZV1ValidatorWithKwargsZV1ValidatorWithValuesAndKwargsZ V1ValidatorZV1RootValidatorFunctionZV1RootValidator classmethod staticmethodr4__annotations__r5r6rVrZr\rrrrs       ,   "L