o
    7ήcE                     @   s  d dl mZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZ ddlmZ er.ddlmZ dZded	 d
ddd	fddZG dd	 d	ZG dd deeZG dd deeZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG d d! d!eZG d"d# d#eZG d$d% d%eZG d&d' d'eZ G d(d) d)eZ!G d*d+ d+eZ"G d,d- d-e"Z#G d.d/ d/e"Z$G d0d1 d1e"Z%G d2d3 d3e"Z&G d4d5 d5e"Z'G d6d7 d7e"Z(G d8d9 d9e"Z)G d:d; d;eZ*G d<d= d=eZ+G d>d? d?eZ,G d@dA dAeZ-G dBdC dCeZ.G dDdE dEe.Z/G dFdG dGe.Z0G dHdI dIe.Z1G dJdK dKeZ2G dLdM dMeZ3G dNdO dOeZ4G dPdQ dQeZ5G dRdS dSeZ6G dTdU dUeZ7G dVdW dWeZ8G dXdY dYeZ9G dZd[ d[eZ:G d\d] d]eZ;G d^d_ d_eZ<G d`da daeZ=G dbdc dceZ>G ddde deeZ?G dfdg dgeZ@G dhdi dieZAG djdk dkeZBG dldm dmeZCG dndo doeZDG dpdq dqeZEG drds dseZFG dtdu dueFZGG dvdw dweFZHG dxdy dyeFZIG dzd{ d{eFZJG d|d} d}eZKG d~d deZLG dd deZMG dd deZNG dd deZOG dd deZPG dd deZQG dd deZRG dd deZSG dd deZTG dd deZUG dd deZVG dd deZWG dd deZXG dd deZYG dd deZZG dd deZ[G dd deZ\G dd deZ]G dd deZ^G dd deZ_G dd deZ`G dd deZaG dd deZbG dd deZcG dd deZdG dd deZeG dd deZfG dd deZgG dd deZhG dd deZiG dd deZjG dd deZkG dd deZlG dd deZmG ddÄ deZnG ddń deZoG ddǄ deZpG ddɄ deZqG dd˄ deZrG dd̈́ deZsG ddτ deZtG ddф deZuG ddӄ deZvdS )    )Decimal)Path)TYPE_CHECKINGAnyCallableSequenceSetTupleTypeUnion   )display_as_type)
DictStrAny)]PydanticTypeErrorPydanticValueErrorConfigErrorMissingError
ExtraErrorNoneIsNotAllowedErrorNoneIsAllowedErrorWrongConstantErrorNotNoneError	BoolError
BytesError	DictError
EmailErrorUrlErrorUrlSchemeErrorUrlSchemePermittedErrorUrlUserInfoErrorUrlHostErrorUrlHostTldErrorUrlPortErrorUrlExtraError	EnumErrorIntEnumErrorEnumMemberErrorIntegerError
FloatError	PathErrorPathNotExistsErrorPathNotAFileErrorPathNotADirectoryErrorPyObjectErrorSequenceError	ListErrorSetErrorFrozenSetError
TupleErrorTupleLengthErrorListMinLengthErrorListMaxLengthErrorListUniqueItemsErrorSetMinLengthErrorSetMaxLengthErrorFrozenSetMinLengthErrorFrozenSetMaxLengthErrorAnyStrMinLengthErrorAnyStrMaxLengthErrorStrErrorStrRegexErrorNumberNotGtErrorNumberNotGeErrorNumberNotLtErrorNumberNotLeErrorNumberNotMultipleErrorDecimalErrorDecimalIsNotFiniteErrorDecimalMaxDigitsErrorDecimalMaxPlacesErrorDecimalWholeDigitsErrorDateTimeError	DateErrorDateNotInThePastErrorDateNotInTheFutureError	TimeErrorDurationErrorHashableError	UUIDErrorUUIDVersionErrorArbitraryTypeError
ClassErrorSubclassError	JsonErrorJsonTypeErrorPatternErrorDataclassTypeErrorCallableErrorIPvAnyAddressErrorIPvAnyInterfaceErrorIPvAnyNetworkErrorIPv4AddressErrorIPv6AddressErrorIPv4NetworkErrorIPv6NetworkErrorIPv4InterfaceErrorIPv6InterfaceError
ColorErrorStrictBoolErrorNotDigitErrorLuhnValidationErrorInvalidLengthForBrandInvalidByteSizeInvalidByteSizeUnitMissingDiscriminatorInvalidDiscriminatorclsPydanticErrorMixinctxr   returnc                 C   s   | di |S )a  
    For built-in exceptions like ValueError or TypeError, we need to implement
    __reduce__ to override the default behaviour (instead of __getstate__/__setstate__)
    By default pickle protocol 2 calls `cls.__new__(cls, *args)`.
    Since we only use kwargs, we need a little constructor to change that.
    Note: the callable can't be a lambda as pickle looks in the namespace to find it
    N rp   )rl   rn   rp   rp   6/tmp/pip-target-vg8gfxp4/lib/python/pydantic/errors.py
cls_kwargsl   s   rr   c                   @   sd   e Zd ZU eed< eed< deddfddZdefdd	Zdee	d
 ee
d  df f fddZdS )rm   codemsg_templatern   ro   Nc                 K   s
   || _ d S N)__dict__)selfrn   rp   rp   rq   __init__{   s   
zPydanticErrorMixin.__init__c                 C   s   | j jdi | jS )Nrp   )rt   formatrv   rw   rp   rp   rq   __str__~      zPydanticErrorMixin.__str__).rm   r   c                 C   s   t | j| jffS ru   )rr   	__class__rv   rz   rp   rp   rq   
__reduce__   s   zPydanticErrorMixin.__reduce__)__name__
__module____qualname__str__annotations__r   rx   r{   r	   r   r
   r~   rp   rp   rp   rq   rm   w   s   
 *c                   @      e Zd ZdS )r   Nr   r   r   rp   rp   rp   rq   r          r   c                   @   r   )r   Nr   rp   rp   rp   rq   r      r   r   c                   @   r   )r   Nr   rp   rp   rp   rq   r      r   r   c                   @      e Zd ZdZdS )r   zfield requiredNr   r   r   rt   rp   rp   rp   rq   r          r   c                   @   r   )r   zextra fields not permittedNr   rp   rp   rp   rq   r      r   r   c                   @      e Zd ZdZdZdS )r   znone.not_allowedznone is not an allowed valueNr   r   r   rs   rt   rp   rp   rp   rq   r          r   c                   @   r   )r   znone.allowedzvalue is not noneNr   rp   rp   rp   rq   r      r   r   c                   @      e Zd ZdZdefddZdS )r   constro   c                 C       d dd | jD }d| S )N, c                 s   s    | ]}t |V  qd S ru   )repr.0vrp   rp   rq   	<genexpr>   s    z-WrongConstantError.__str__.<locals>.<genexpr>zunexpected value; permitted: )join	permittedrw   r   rp   rp   rq   r{         
zWrongConstantError.__str__Nr   r   r   rs   r   r{   rp   rp   rp   rq   r          r   c                   @   r   )r   not_nonezvalue is not NoneNr   rp   rp   rp   rq   r      r   r   c                   @   r   )r   z&value could not be parsed to a booleanNr   rp   rp   rp   rq   r      r   r   c                   @   r   )r   zbyte type expectedNr   rp   rp   rp   rq   r      r   r   c                   @   r   )r   zvalue is not a valid dictNr   rp   rp   rp   rq   r      r   r   c                   @   r   )r   z"value is not a valid email addressNr   rp   rp   rp   rq   r      r   r   c                   @   r   )r   urlN)r   r   r   rs   rp   rp   rp   rq   r      r   r   c                   @   r   )r   
url.schemezinvalid or missing URL schemeNr   rp   rp   rp   rq   r      r   r   c                       s.   e Zd ZdZdZdee f fddZ  ZS )r   r   zURL scheme not permittedallowed_schemesc                       t  j|d d S )N)r   superrx   )rw   r   r}   rp   rq   rx         z UrlSchemePermittedError.__init__)	r   r   r   rs   rt   r   r   rx   __classcell__rp   rp   r   rq   r          r   c                   @   r   )r   zurl.userinfoz$userinfo required in URL but missingNr   rp   rp   rp   rq   r      r   r   c                   @   r   )r    url.hostzURL host invalidNr   rp   rp   rp   rq   r       r   r    c                   @   r   )r!   r   z+URL host invalid, top level domain requiredNr   rp   rp   rp   rq   r!      r   r!   c                   @   r   )r"   zurl.portz*URL port invalid, port cannot exceed 65535Nr   rp   rp   rp   rq   r"      r   r"   c                   @   r   )r#   z	url.extraz>URL invalid, extra characters found after valid URL: {extra!r}Nr   rp   rp   rp   rq   r#      r   r#   c                   @   r   )r&   enumro   c                 C   r   )Nr   c                 s   s    | ]}t |jV  qd S ru   )r   valuer   rp   rp   rq   r      s    z*EnumMemberError.__str__.<locals>.<genexpr>z4value is not a valid enumeration member; permitted: )r   enum_valuesr   rp   rp   rq   r{      r   zEnumMemberError.__str__Nr   rp   rp   rp   rq   r&      r   r&   c                   @   r   )r'   zvalue is not a valid integerNr   rp   rp   rp   rq   r'      r   r'   c                   @   r   )r(   zvalue is not a valid floatNr   rp   rp   rp   rq   r(      r   r(   c                   @   r   )r)   zvalue is not a valid pathNr   rp   rp   rp   rq   r)      r   r)   c                       s&   e Zd Zdeddf fddZ  ZS )_PathValueErrorpathro   Nc                      t  jt|d d S )N)r   )r   rx   r   )rw   r   r   rp   rq   rx         z_PathValueError.__init__)r   r   r   r   rx   r   rp   rp   r   rq   r      s    r   c                   @   r   )r*   zpath.not_existsz1file or directory at path "{path}" does not existNr   rp   rp   rp   rq   r*     r   r*   c                   @   r   )r+   zpath.not_a_filez&path "{path}" does not point to a fileNr   rp   rp   rp   rq   r+     r   r+   c                   @   r   )r,   zpath.not_a_directoryz+path "{path}" does not point to a directoryNr   rp   rp   rp   rq   r,     r   r,   c                   @   r   )r-   zOensure this value contains valid import path or valid callable: {error_message}Nr   rp   rp   rp   rq   r-     r   r-   c                   @   r   )r.   zvalue is not a valid sequenceNr   rp   rp   rp   rq   r.     r   r.   c                   @   r   )IterableErrorzvalue is not a valid iterableNr   rp   rp   rp   rq   r     r   r   c                   @   r   )r/   zvalue is not a valid listNr   rp   rp   rp   rq   r/     r   r/   c                   @   r   )r0   zvalue is not a valid setNr   rp   rp   rp   rq   r0   "  r   r0   c                   @   r   )r1   zvalue is not a valid frozensetNr   rp   rp   rp   rq   r1   &  r   r1   c                   @   r   )
DequeErrorzvalue is not a valid dequeNr   rp   rp   rp   rq   r   *  r   r   c                   @   r   )r2   zvalue is not a valid tupleNr   rp   rp   rp   rq   r2   .  r   r2   c                       s2   e Zd ZdZdZdededdf fddZ  ZS )	r3   ztuple.lengthz>wrong tuple length {actual_length}, expected {expected_length}actual_lengthexpected_lengthro   Nc                   s   t  j||d d S )N)r   r   r   )rw   r   r   r   rp   rq   rx   6  r|   zTupleLengthError.__init__r   r   r   rs   rt   intrx   r   rp   rp   r   rq   r3   2      "r3   c                       .   e Zd ZdZdZdeddf fddZ  ZS )r4   zlist.min_items2ensure this value has at least {limit_value} itemslimit_valuero   Nc                   r   N)r   r   rw   r   r   rp   rq   rx   >  r   zListMinLengthError.__init__r   rp   rp   r   rq   r4   :  r   r4   c                       r   )r5   zlist.max_items1ensure this value has at most {limit_value} itemsr   ro   Nc                   r   r   r   r   r   rp   rq   rx   F  r   zListMaxLengthError.__init__r   rp   rp   r   rq   r5   B  r   r5   c                   @   r   )r6   zlist.unique_itemszthe list has duplicated itemsNr   rp   rp   rp   rq   r6   J  r   r6   c                       r   )r7   zset.min_itemsr   r   ro   Nc                   r   r   r   r   r   rp   rq   rx   S  r   zSetMinLengthError.__init__r   rp   rp   r   rq   r7   O  r   r7   c                       r   )r8   zset.max_itemsr   r   ro   Nc                   r   r   r   r   r   rp   rq   rx   [  r   zSetMaxLengthError.__init__r   rp   rp   r   rq   r8   W  r   r8   c                       r   )r9   zfrozenset.min_itemsr   r   ro   Nc                   r   r   r   r   r   rp   rq   rx   c  r   z FrozenSetMinLengthError.__init__r   rp   rp   r   rq   r9   _  r   r9   c                       r   )r:   zfrozenset.max_itemsr   r   ro   Nc                   r   r   r   r   r   rp   rq   rx   k  r   z FrozenSetMaxLengthError.__init__r   rp   rp   r   rq   r:   g  r   r:   c                       r   )r;   zany_str.min_lengthz7ensure this value has at least {limit_value} charactersr   ro   Nc                   r   r   r   r   r   rp   rq   rx   s  r   zAnyStrMinLengthError.__init__r   rp   rp   r   rq   r;   o  r   r;   c                       r   )r<   zany_str.max_lengthz6ensure this value has at most {limit_value} charactersr   ro   Nc                   r   r   r   r   r   rp   rq   rx   {  r   zAnyStrMaxLengthError.__init__r   rp   rp   r   rq   r<   w  r   r<   c                   @   r   )r=   zstr type expectedNr   rp   rp   rp   rq   r=     r   r=   c                       r   )r>   z	str.regexz'string does not match regex "{pattern}"patternro   Nc                   r   )N)r   r   )rw   r   r   rp   rq   rx     r   zStrRegexError.__init__)r   r   r   rs   rt   r   rx   r   rp   rp   r   rq   r>     r   r>   c                       s0   e Zd Zdeeeef ddf fddZ  ZS )_NumberBoundErrorr   ro   Nc                   r   r   r   r   r   rp   rq   rx     r   z_NumberBoundError.__init__)	r   r   r   r   r   floatr   rx   r   rp   rp   r   rq   r     s    (r   c                   @   r   )r?   znumber.not_gtz/ensure this value is greater than {limit_value}Nr   rp   rp   rp   rq   r?     r   r?   c                   @   r   )r@   znumber.not_gez;ensure this value is greater than or equal to {limit_value}Nr   rp   rp   rp   rq   r@     r   r@   c                   @   r   )rA   znumber.not_ltz,ensure this value is less than {limit_value}Nr   rp   rp   rp   rq   rA     r   rA   c                   @   r   )rB   znumber.not_lez8ensure this value is less than or equal to {limit_value}Nr   rp   rp   rp   rq   rB     r   rB   c                   @   r   )NumberNotFiniteErrorznumber.not_finite_numberz$ensure this value is a finite numberNr   rp   rp   rp   rq   r     r   r   c                       s8   e Zd ZdZdZdeeeef ddf fddZ	  Z
S )rC   znumber.not_multiplez0ensure this value is a multiple of {multiple_of}multiple_ofro   Nc                   r   )N)r   r   )rw   r   r   rp   rq   rx     r   zNumberNotMultipleError.__init__)r   r   r   rs   rt   r   r   r   r   rx   r   rp   rp   r   rq   rC     s    (rC   c                   @   r   )rD   value is not a valid decimalNr   rp   rp   rp   rq   rD     r   rD   c                   @   r   )rE   zdecimal.not_finiter   Nr   rp   rp   rp   rq   rE     r   rE   c                       r   )rF   zdecimal.max_digitsz?ensure that there are no more than {max_digits} digits in total
max_digitsro   Nc                   r   )N)r   r   )rw   r   r   rp   rq   rx     r   zDecimalMaxDigitsError.__init__r   rp   rp   r   rq   rF     r   rF   c                       r   )rG   zdecimal.max_placeszBensure that there are no more than {decimal_places} decimal placesdecimal_placesro   Nc                   r   )N)r   r   )rw   r   r   rp   rq   rx     r   zDecimalMaxPlacesError.__init__r   rp   rp   r   rq   rG     r   rG   c                       r   )rH   zdecimal.whole_digitszQensure that there are no more than {whole_digits} digits before the decimal pointwhole_digitsro   Nc                   r   )N)r   r   )rw   r   r   rp   rq   rx     r   z DecimalWholeDigitsError.__init__r   rp   rp   r   rq   rH     r   rH   c                   @   r   )rI   zinvalid datetime formatNr   rp   rp   rp   rq   rI     r   rI   c                   @   r   )rJ   zinvalid date formatNr   rp   rp   rp   rq   rJ     r   rJ   c                   @   r   )rK   zdate.not_in_the_pastzdate is not in the pastNr   rp   rp   rp   rq   rK     r   rK   c                   @   r   )rL   zdate.not_in_the_futurezdate is not in the futureNr   rp   rp   rp   rq   rL     r   rL   c                   @   r   )rM   zinvalid time formatNr   rp   rp   rp   rq   rM     r   rM   c                   @   r   )rN   zinvalid duration formatNr   rp   rp   rp   rq   rN     r   rN   c                   @   r   )rO   zvalue is not a valid hashableNr   rp   rp   rp   rq   rO     r   rO   c                   @   r   )rP   zvalue is not a valid uuidNr   rp   rp   rp   rq   rP     r   rP   c                       r   )rQ   zuuid.versionz(uuid version {required_version} expectedrequired_versionro   Nc                   r   )N)r   r   )rw   r   r   rp   rq   rx     r   zUUIDVersionError.__init__r   rp   rp   r   rq   rQ     r   rQ   c                       2   e Zd ZdZdZdee ddf fddZ  ZS )rR   arbitrary_typez.instance of {expected_arbitrary_type} expectedexpected_arbitrary_typero   Nc                   r   )N)r   r   rx   r   )rw   r   r   rp   rq   rx      r   zArbitraryTypeError.__init__	r   r   r   rs   rt   r
   r   rx   r   rp   rp   r   rq   rR     r   rR   c                   @   r   )rS   classza class is expectedNr   rp   rp   rp   rq   rS     r   rS   c                       r   )rT   subclassz%subclass of {expected_class} expectedexpected_classro   Nc                   r   )N)r   r   )rw   r   r   rp   rq   rx     r   zSubclassError.__init__r   rp   rp   r   rq   rT   	  r   rT   c                   @   r   )rU   zInvalid JSONNr   rp   rp   rp   rq   rU     r   rU   c                   @   r   )rV   jsonz+JSON object must be str, bytes or bytearrayNr   rp   rp   rp   rq   rV     r   rV   c                   @   r   )rW   regex_patternzInvalid regular expressionNr   rp   rp   rp   rq   rW     r   rW   c                   @   r   )rX   	dataclassz0instance of {class_name}, tuple or dict expectedNr   rp   rp   rp   rq   rX     r   rX   c                   @   r   )rY   z{value} is not callableNr   rp   rp   rp   rq   rY   $  r   rY   c                   @   r   )r$   enum_instancez${value} is not a valid Enum instanceNr   rp   rp   rp   rq   r$   (  r   r$   c                   @   r   )r%   int_enum_instancez'{value} is not a valid IntEnum instanceNr   rp   rp   rp   rq   r%   -  r   r%   c                   @   r   )rZ   z)value is not a valid IPv4 or IPv6 addressNr   rp   rp   rp   rq   rZ   2  r   rZ   c                   @   r   )r[   z+value is not a valid IPv4 or IPv6 interfaceNr   rp   rp   rp   rq   r[   6  r   r[   c                   @   r   )r\   z)value is not a valid IPv4 or IPv6 networkNr   rp   rp   rp   rq   r\   :  r   r\   c                   @   r   )r]   z!value is not a valid IPv4 addressNr   rp   rp   rp   rq   r]   >  r   r]   c                   @   r   )r^   z!value is not a valid IPv6 addressNr   rp   rp   rp   rq   r^   B  r   r^   c                   @   r   )r_   z!value is not a valid IPv4 networkNr   rp   rp   rp   rq   r_   F  r   r_   c                   @   r   )r`   z!value is not a valid IPv6 networkNr   rp   rp   rp   rq   r`   J  r   r`   c                   @   r   )ra   z#value is not a valid IPv4 interfaceNr   rp   rp   rp   rq   ra   N  r   ra   c                   @   r   )rb   z#value is not a valid IPv6 interfaceNr   rp   rp   rp   rq   rb   R  r   rb   c                   @   r   )rc   z$value is not a valid color: {reason}Nr   rp   rp   rp   rq   rc   V  r   rc   c                   @   r   )rd   zvalue is not a valid booleanNr   rp   rp   rp   rq   rd   Z  r   rd   c                   @   r   )re   zpayment_card_number.digitszcard number is not all digitsNr   rp   rp   rp   rq   re   ^  r   re   c                   @   r   )rf   zpayment_card_number.luhn_checkzcard number is not luhn validNr   rp   rp   rp   rq   rf   c  r   rf   c                   @   r   )rg   z,payment_card_number.invalid_length_for_brandz3Length for a {brand} card must be {required_length}Nr   rp   rp   rp   rq   rg   h  r   rg   c                   @   r   )rh   z/could not parse value and unit from byte stringNr   rp   rp   rp   rq   rh   m  r   rh   c                   @   r   )ri   z%could not interpret byte unit: {unit}Nr   rp   rp   rp   rq   ri   q  r   ri   c                   @   r   )rj   z)discriminated_union.missing_discriminatorz7Discriminator {discriminator_key!r} is missing in valueNr   rp   rp   rp   rq   rj   u  r   rj   c                       s:   e Zd ZdZdZdededee ddf fdd	Z  Z	S )
rk   z)discriminated_union.invalid_discriminatorzuNo match for discriminator {discriminator_key!r} and value {discriminator_value!r} (allowed values: {allowed_values})discriminator_keydiscriminator_valueallowed_valuesro   Nc                   s"   t  j||dtt|d d S )Nr   )r   r   r   )r   rx   r   mapr   )rw   r   r   r   r   rp   rq   rx     s
   
zInvalidDiscriminator.__init__)
r   r   r   rs   rt   r   r   r   rx   r   rp   rp   r   rq   rk   z  s
    *rk   N)wdecimalr   pathlibr   typingr   r   r   r   r   r	   r
   r   r   r   __all__rr   rm   	TypeErrorr   
ValueErrorr   RuntimeErrorr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r&   r'   r(   r)   r   r*   r+   r,   r-   r.   r   r/   r0   r1   r   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r   r?   r@   rA   rB   r   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   r$   r%   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rp   rp   rp   rq   <module>   s    (a