a cE@sddlmZddlmZddlmZmZmZmZm Z m Z m Z m Z ddlm Z er\ddlmZdZe dd dd d d ZGd ddZGdddeeZGdddeeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGd d!d!eZGd"d#d#eZGd$d%d%eZ Gd&d'd'eZ!Gd(d)d)eZ"Gd*d+d+e"Z#Gd,d-d-e"Z$Gd.d/d/e"Z%Gd0d1d1e"Z&Gd2d3d3e"Z'Gd4d5d5e"Z(Gd6d7d7e"Z)Gd8d9d9eZ*Gd:d;d;eZ+Gdd?d?eZ-Gd@dAdAeZ.GdBdCdCe.Z/GdDdEdEe.Z0GdFdGdGe.Z1GdHdIdIeZ2GdJdKdKeZ3GdLdMdMeZ4GdNdOdOeZ5GdPdQdQeZ6GdRdSdSeZ7GdTdUdUeZ8GdVdWdWeZ9GdXdYdYeZ:GdZd[d[eZ;Gd\d]d]eZGdbdcdceZ?GdddedeeZ@GdfdgdgeZAGdhdidieZBGdjdkdkeZCGdldmdmeZDGdndodoeZEGdpdqdqeZFGdrdsdseFZGGdtdudueFZHGdvdwdweFZIGdxdydyeFZJGdzd{d{eZKGd|d}d}eZLGd~ddeZMGdddeZNGdddeZOGdddeZPGdddeZQGdddeZRGdddeZSGdddeZTGdddeZUGdddeZVGdddeZWGdddeZXGdddeZYGdddeZZGdddeZ[GdddeZ\GdddeZ]GdddeZ^GdddeZ_GdddeZ`GdddeZaGdddeZbGdddeZcGdddeZdGdddeZeGdddeZfGdddeZgGdddeZhGdddeZiGdddeZjGdddeZkGdddeZlGdddeZmGdddeZnGddÄdeZoGddńdeZpGddDŽdeZqGddɄdeZrGdd˄deZsGdd̈́deZtGddτdeZuGddфdeZvdS))Decimal)Path) TYPE_CHECKINGAnyCallableSequenceSetTupleTypeUnion)display_as_type) DictStrAny)]PydanticTypeErrorPydanticValueError ConfigError MissingError ExtraErrorNoneIsNotAllowedErrorNoneIsAllowedErrorWrongConstantError NotNoneError BoolError BytesError DictError EmailErrorUrlErrorUrlSchemeErrorUrlSchemePermittedErrorUrlUserInfoError UrlHostErrorUrlHostTldError UrlPortError UrlExtraError EnumError IntEnumErrorEnumMemberError IntegerError FloatError PathErrorPathNotExistsErrorPathNotAFileErrorPathNotADirectoryError PyObjectError SequenceError ListErrorSetErrorFrozenSetError TupleErrorTupleLengthErrorListMinLengthErrorListMaxLengthErrorListUniqueItemsErrorSetMinLengthErrorSetMaxLengthErrorFrozenSetMinLengthErrorFrozenSetMaxLengthErrorAnyStrMinLengthErrorAnyStrMaxLengthErrorStrError StrRegexErrorNumberNotGtErrorNumberNotGeErrorNumberNotLtErrorNumberNotLeErrorNumberNotMultipleError DecimalErrorDecimalIsNotFiniteErrorDecimalMaxDigitsErrorDecimalMaxPlacesErrorDecimalWholeDigitsError DateTimeError DateErrorDateNotInThePastErrorDateNotInTheFutureError TimeError DurationError HashableError UUIDErrorUUIDVersionErrorArbitraryTypeError ClassError SubclassError JsonError JsonTypeError PatternErrorDataclassTypeError CallableErrorIPvAnyAddressErrorIPvAnyInterfaceErrorIPvAnyNetworkErrorIPv4AddressErrorIPv6AddressErrorIPv4NetworkErrorIPv6NetworkErrorIPv4InterfaceErrorIPv6InterfaceError ColorErrorStrictBoolError NotDigitErrorLuhnValidationErrorInvalidLengthForBrandInvalidByteSizeInvalidByteSizeUnitMissingDiscriminatorInvalidDiscriminatorPydanticErrorMixinr)clsctxreturncCs|fi|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 )rmrnrprp\/workspaces/shunt/resources/test-fastapi/venv/lib/python3.9/site-packages/pydantic/errors.py cls_kwargslsrrc@sbeZdZUeed<eed<eddddZeddd Zee d ee dd ffdd d Z dS)rlcode msg_templateN)rnrocKs ||_dSN)__dict__)selfrnrprprq__init__{szPydanticErrorMixin.__init__rocCs|jjfi|jSru)rtformatrvrwrprprq__str__~szPydanticErrorMixin.__str__).rlrcCst|j|jffSru)rr __class__rvr{rprprq __reduce__szPydanticErrorMixin.__reduce__) __name__ __module__ __qualname__str__annotations__rrxr|r rr r~rprprprqrlws c@s eZdZdS)rNrrrrprprprqrsrc@s eZdZdS)rNrrprprprqrsrc@s eZdZdS)rNrrprprprqrsrc@seZdZdZdS)rzfield requiredNrrrrtrprprprqrsrc@seZdZdZdS)rzextra fields not permittedNrrprprprqrsrc@seZdZdZdZdS)rznone.not_allowedznone is not an allowed valueNrrrrsrtrprprprqrsrc@seZdZdZdZdS)rz none.allowedzvalue is not noneNrrprprprqrsrc@seZdZdZedddZdS)rconstrycCs ddd|jD}d|S)N, css|]}t|VqdSru)repr.0vrprprq z-WrongConstantError.__str__..zunexpected value; permitted: )join permittedrwrrprprqr|szWrongConstantError.__str__Nrrrrsrr|rprprprqrsrc@seZdZdZdZdS)rZnot_nonezvalue is not NoneNrrprprprqrsrc@seZdZdZdS)rz&value could not be parsed to a booleanNrrprprprqrsrc@seZdZdZdS)rzbyte type expectedNrrprprprqrsrc@seZdZdZdS)rzvalue is not a valid dictNrrprprprqrsrc@seZdZdZdS)rz"value is not a valid email addressNrrprprprqrsrc@seZdZdZdS)rurlN)rrrrsrprprprqrsrc@seZdZdZdZdS)r url.schemezinvalid or missing URL schemeNrrprprprqrsrcs.eZdZdZdZeedfdd ZZS)rrzURL scheme not permittedallowed_schemescstj|ddS)Nrsuperrx)rwrr}rprqrxsz UrlSchemePermittedError.__init__) rrrrsrtrrrx __classcell__rprprrqrsrc@seZdZdZdZdS)rz url.userinfoz$userinfo required in URL but missingNrrprprprqrsrc@seZdZdZdZdS)r url.hostzURL host invalidNrrprprprqr sr c@seZdZdZdZdS)r!rz+URL host invalid, top level domain requiredNrrprprprqr!sr!c@seZdZdZdZdS)r"zurl.portz*URL port invalid, port cannot exceed 65535Nrrprprprqr"sr"c@seZdZdZdZdS)r#z url.extraz>URL invalid, extra characters found after valid URL: {extra!r}Nrrprprprqr#sr#c@seZdZdZedddZdS)r&enumrycCs ddd|jD}d|S)Nrcss|]}t|jVqdSru)rvaluerrprprqrrz*EnumMemberError.__str__..z4value is not a valid enumeration member; permitted: )rZ enum_valuesrrprprqr|szEnumMemberError.__str__Nrrprprprqr&sr&c@seZdZdZdS)r'zvalue is not a valid integerNrrprprprqr'sr'c@seZdZdZdS)r(zvalue is not a valid floatNrrprprprqr(sr(c@seZdZdZdS)r)zvalue is not a valid pathNrrprprprqr)sr)cs$eZdZeddfdd ZZS)_PathValueErrorN)pathrocstjt|ddS)N)r)rrxr)rwrrrprqrxsz_PathValueError.__init__)rrrrrxrrprprrqrsrc@seZdZdZdZdS)r*zpath.not_existsz1file or directory at path "{path}" does not existNrrprprprqr*sr*c@seZdZdZdZdS)r+zpath.not_a_filez&path "{path}" does not point to a fileNrrprprprqr+sr+c@seZdZdZdZdS)r,zpath.not_a_directoryz+path "{path}" does not point to a directoryNrrprprprqr, sr,c@seZdZdZdS)r-zOensure this value contains valid import path or valid callable: {error_message}Nrrprprprqr-sr-c@seZdZdZdS)r.zvalue is not a valid sequenceNrrprprprqr.sr.c@seZdZdZdS) IterableErrorzvalue is not a valid iterableNrrprprprqrsrc@seZdZdZdS)r/zvalue is not a valid listNrrprprprqr/sr/c@seZdZdZdS)r0zvalue is not a valid setNrrprprprqr0"sr0c@seZdZdZdS)r1zvalue is not a valid frozensetNrrprprprqr1&sr1c@seZdZdZdS) DequeErrorzvalue is not a valid dequeNrrprprprqr*src@seZdZdZdS)r2zvalue is not a valid tupleNrrprprprqr2.sr2cs.eZdZdZdZeeddfdd ZZS)r3z tuple.lengthz>wrong tuple length {actual_length}, expected {expected_length}N) actual_lengthexpected_lengthrocstj||ddS)N)rrr)rwrrrrprqrx6szTupleLengthError.__init__rrrrsrtintrxrrprprrqr32sr3cs,eZdZdZdZeddfdd ZZS)r4zlist.min_items2ensure this value has at least {limit_value} itemsN limit_valuerocstj|ddSN)rrrwrrrprqrx>szListMinLengthError.__init__rrprprrqr4:sr4cs,eZdZdZdZeddfdd ZZS)r5zlist.max_items1ensure this value has at most {limit_value} itemsNrcstj|ddSrrrrrprqrxFszListMaxLengthError.__init__rrprprrqr5Bsr5c@seZdZdZdZdS)r6zlist.unique_itemszthe list has duplicated itemsNrrprprprqr6Jsr6cs,eZdZdZdZeddfdd ZZS)r7z set.min_itemsrNrcstj|ddSrrrrrprqrxSszSetMinLengthError.__init__rrprprrqr7Osr7cs,eZdZdZdZeddfdd ZZS)r8z set.max_itemsrNrcstj|ddSrrrrrprqrx[szSetMaxLengthError.__init__rrprprrqr8Wsr8cs,eZdZdZdZeddfdd ZZS)r9zfrozenset.min_itemsrNrcstj|ddSrrrrrprqrxcsz FrozenSetMinLengthError.__init__rrprprrqr9_sr9cs,eZdZdZdZeddfdd ZZS)r:zfrozenset.max_itemsrNrcstj|ddSrrrrrprqrxksz FrozenSetMaxLengthError.__init__rrprprrqr:gsr:cs,eZdZdZdZeddfdd ZZS)r;zany_str.min_lengthz7ensure this value has at least {limit_value} charactersNrcstj|ddSrrrrrprqrxsszAnyStrMinLengthError.__init__rrprprrqr;osr;cs,eZdZdZdZeddfdd ZZS)r<zany_str.max_lengthz6ensure this value has at most {limit_value} charactersNrcstj|ddSrrrrrprqrx{szAnyStrMaxLengthError.__init__rrprprrqr<wsr<c@seZdZdZdS)r=zstr type expectedNrrprprprqr=sr=cs,eZdZdZdZeddfdd ZZS)r>z str.regexz'string does not match regex "{pattern}"N)patternrocstj|ddS)N)rr)rwrrrprqrxszStrRegexError.__init__)rrrrsrtrrxrrprprrqr>sr>cs.eZdZeeeefddfdd ZZS)_NumberBoundErrorNrcstj|ddSrrrrrprqrxsz_NumberBoundError.__init__) rrrr rfloatrrxrrprprrqrsrc@seZdZdZdZdS)r?z number.not_gtz/ensure this value is greater than {limit_value}Nrrprprprqr?sr?c@seZdZdZdZdS)r@z number.not_gez;ensure this value is greater than or equal to {limit_value}Nrrprprprqr@sr@c@seZdZdZdZdS)rAz number.not_ltz,ensure this value is less than {limit_value}NrrprprprqrAsrAc@seZdZdZdZdS)rBz number.not_lez8ensure this value is less than or equal to {limit_value}NrrprprprqrBsrBc@seZdZdZdZdS)NumberNotFiniteErrorznumber.not_finite_numberz$ensure this value is a finite numberNrrprprprqrsrcs6eZdZdZdZeeeefddfdd Z Z S)rCznumber.not_multiplez0ensure this value is a multiple of {multiple_of}N) multiple_ofrocstj|ddS)N)rr)rwrrrprqrxszNumberNotMultipleError.__init__) rrrrsrtr rrrrxrrprprrqrCsrCc@seZdZdZdS)rDvalue is not a valid decimalNrrprprprqrDsrDc@seZdZdZdZdS)rEzdecimal.not_finiterNrrprprprqrEsrEcs,eZdZdZdZeddfdd ZZS)rFzdecimal.max_digitsz?ensure that there are no more than {max_digits} digits in totalN) max_digitsrocstj|ddS)N)rr)rwrrrprqrxszDecimalMaxDigitsError.__init__rrprprrqrFsrFcs,eZdZdZdZeddfdd ZZS)rGzdecimal.max_placeszBensure that there are no more than {decimal_places} decimal placesN)decimal_placesrocstj|ddS)N)rr)rwrrrprqrxszDecimalMaxPlacesError.__init__rrprprrqrGsrGcs,eZdZdZdZeddfdd ZZS)rHzdecimal.whole_digitszQensure that there are no more than {whole_digits} digits before the decimal pointN) whole_digitsrocstj|ddS)N)rr)rwrrrprqrxsz DecimalWholeDigitsError.__init__rrprprrqrHsrHc@seZdZdZdS)rIzinvalid datetime formatNrrprprprqrIsrIc@seZdZdZdS)rJzinvalid date formatNrrprprprqrJsrJc@seZdZdZdZdS)rKzdate.not_in_the_pastzdate is not in the pastNrrprprprqrKsrKc@seZdZdZdZdS)rLzdate.not_in_the_futurezdate is not in the futureNrrprprprqrLsrLc@seZdZdZdS)rMzinvalid time formatNrrprprprqrMsrMc@seZdZdZdS)rNzinvalid duration formatNrrprprprqrNsrNc@seZdZdZdS)rOzvalue is not a valid hashableNrrprprprqrOsrOc@seZdZdZdS)rPzvalue is not a valid uuidNrrprprprqrPsrPcs,eZdZdZdZeddfdd ZZS)rQz uuid.versionz(uuid version {required_version} expectedN)required_versionrocstj|ddS)N)rr)rwrrrprqrxszUUIDVersionError.__init__rrprprrqrQsrQcs0eZdZdZdZeeddfdd ZZS)rRZarbitrary_typez.instance of {expected_arbitrary_type} expectedN)expected_arbitrary_typerocstjt|ddS)N)rrrxr )rwrrrprqrxszArbitraryTypeError.__init__ rrrrsrtr rrxrrprprrqrRsrRc@seZdZdZdZdS)rSclassza class is expectedNrrprprprqrSsrScs0eZdZdZdZeeddfdd ZZS)rTsubclassz%subclass of {expected_class} expectedN)expected_classrocstjt|ddS)N)rr)rwrrrprqrx szSubclassError.__init__rrprprrqrT srTc@seZdZdZdS)rUz Invalid JSONNrrprprprqrUsrUc@seZdZdZdZdS)rVjsonz+JSON object must be str, bytes or bytearrayNrrprprprqrVsrVc@seZdZdZdZdS)rWZ regex_patternzInvalid regular expressionNrrprprprqrWsrWc@seZdZdZdZdS)rXZ dataclassz0instance of {class_name}, tuple or dict expectedNrrprprprqrXsrXc@seZdZdZdS)rYz{value} is not callableNrrprprprqrY$srYc@seZdZdZdZdS)r$Z enum_instancez${value} is not a valid Enum instanceNrrprprprqr$(sr$c@seZdZdZdZdS)r%Zint_enum_instancez'{value} is not a valid IntEnum instanceNrrprprprqr%-sr%c@seZdZdZdS)rZz)value is not a valid IPv4 or IPv6 addressNrrprprprqrZ2srZc@seZdZdZdS)r[z+value is not a valid IPv4 or IPv6 interfaceNrrprprprqr[6sr[c@seZdZdZdS)r\z)value is not a valid IPv4 or IPv6 networkNrrprprprqr\:sr\c@seZdZdZdS)r]z!value is not a valid IPv4 addressNrrprprprqr]>sr]c@seZdZdZdS)r^z!value is not a valid IPv6 addressNrrprprprqr^Bsr^c@seZdZdZdS)r_z!value is not a valid IPv4 networkNrrprprprqr_Fsr_c@seZdZdZdS)r`z!value is not a valid IPv6 networkNrrprprprqr`Jsr`c@seZdZdZdS)raz#value is not a valid IPv4 interfaceNrrprprprqraNsrac@seZdZdZdS)rbz#value is not a valid IPv6 interfaceNrrprprprqrbRsrbc@seZdZdZdS)rcz$value is not a valid color: {reason}NrrprprprqrcVsrcc@seZdZdZdS)rdzvalue is not a valid booleanNrrprprprqrdZsrdc@seZdZdZdZdS)rezpayment_card_number.digitszcard number is not all digitsNrrprprprqre^srec@seZdZdZdZdS)rfzpayment_card_number.luhn_checkzcard number is not luhn validNrrprprprqrfcsrfc@seZdZdZdZdS)rgz,payment_card_number.invalid_length_for_brandz3Length for a {brand} card must be {required_length}Nrrprprprqrghsrgc@seZdZdZdS)rhz/could not parse value and unit from byte stringNrrprprprqrhmsrhc@seZdZdZdS)riz%could not interpret byte unit: {unit}Nrrprprprqriqsric@seZdZdZdZdS)rjz)discriminated_union.missing_discriminatorz7Discriminator {discriminator_key!r} is missing in valueNrrprprprqrjusrjcs4eZdZdZdZeeeeddfdd ZZ S)rkz)discriminated_union.invalid_discriminatorzuNo match for discriminator {discriminator_key!r} and value {discriminator_value!r} (allowed values: {allowed_values})N)discriminator_keydiscriminator_valueallowed_valuesrocs"tj||dtt|ddS)Nr)rrr)rrxrmapr)rwrrrrrprqrxs zInvalidDiscriminator.__init__) rrrrsrtrrrrxrrprprrqrkzsrkN)wdecimalrpathlibrtypingrrrrrr r r r r__all__rrrl TypeErrorr ValueErrorr RuntimeErrorrrrrrrrrrrrrrrrr r!r"r#r&r'r(r)rr*r+r,r-r.rr/r0r1rr2r3r4r5r6r7r8r9r:r;r<r=r>rr?r@rArBrrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYr$r%rZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrprprprqs  (  a