U nf>E@sddlmZddlmZddlmZmZmZmZm Z m Z m Z m Z ddl mZer\ddl mZdZe dddd d d ZGd ddZGd ddeeZGdddeeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZ Gd#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&Gd/d0d0e#Z'Gd1d2d2e#Z(Gd3d4d4e#Z)Gd5d6d6e#Z*Gd7d8d8eZ+Gd9d:d:eZ,Gd;d<dd>eZ.Gd?d@d@eZ/GdAdBdBe/Z0GdCdDdDe/Z1GdEdFdFe/Z2GdGdHdHeZ3GdIdJdJeZ4GdKdLdLeZ5GdMdNdNeZ6GdOdPdPeZ7GdQdRdReZ8GdSdTdTeZ9GdUdVdVeZ:GdWdXdXeZ;GdYdZdZeZGd_d`d`eZ?GdadbdbeZ@GdcddddeZAGdedfdfeZBGdgdhdheZCGdidjdjeZDGdkdldleZEGdmdndneZFGdodpdpeZGGdqdrdreGZHGdsdtdteGZIGdudvdveGZJGdwdxdxeGZKGdydzdzeZLGd{d|d|eZMGd}d~d~eZNGdddeZOGdddeZPGdddeZQGdddeZRGdddeZSGdddeZTGdddeZUGdddeZVGdddeZWGdddeZXGdddeZYGdddeZZGdddeZ[GdddeZ\GdddeZ]GdddeZ^GdddeZ_GdddeZ`GdddeZaGdddeZbGdddeZcGdddeZdGdddeZeGdddeZfGdddeZgGdddeZhGdddeZiGdddeZjGdddeZkGdddeZlGdddeZmGdddeZnGdddeZoGdd„deZpGddĄdeZqGddƄdeZrGddȄdeZsGddʄdeZtGdd̄deZuGdd΄deZvGddЄdeZwdS))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 |f|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 )rlrmroro@/opt/hc_python/lib/python3.8/site-packages/pydantic/v1/errors.py cls_kwargslsrqc@sbeZdZUeed<eed<eddddZeddd Zee d ee dd ffdd d Z dS)rkcode msg_templateN)rmrncKs ||_dSN)__dict__)selfrmrororp__init__{szPydanticErrorMixin.__init__rncCs|jjf|jSrt)rsformatrurvrororp__str__~szPydanticErrorMixin.__str__).rkr cCst|j|jffSrt)rq __class__rurzrororp __reduce__szPydanticErrorMixin.__reduce__) __name__ __module__ __qualname__str__annotations__rrwr{r rr r}rorororprkws c@s eZdZdS)rNr~rrrorororprsrc@s eZdZdS)rNrrorororprsrc@s eZdZdS)rNrrorororprsrc@seZdZdZdS)rzfield requiredNr~rrrsrorororprsrc@seZdZdZdS)rzextra fields not permittedNrrorororprsrc@seZdZdZdZdS)rznone.not_allowedznone is not an allowed valueNr~rrrrrsrorororprsrc@seZdZdZdZdS)rz none.allowedzvalue is not noneNrrorororprsrc@seZdZdZedddZdS)rconstrxcCs ddd|jD}d|S)N, css|]}t|VqdSrt)repr.0vrororp sz-WrongConstantError.__str__..zunexpected value; permitted: )join permittedrvrrororpr{szWrongConstantError.__str__Nr~rrrrrr{rorororprsrc@seZdZdZdZdS)rZnot_nonezvalue is not NoneNrrorororprsrc@seZdZdZdS)rz&value could not be parsed to a booleanNrrorororprsrc@seZdZdZdS)rzbyte type expectedNrrorororprsrc@seZdZdZdS)rzvalue is not a valid dictNrrorororprsrc@seZdZdZdS)rz"value is not a valid email addressNrrorororprsrc@seZdZdZdS)rurlN)r~rrrrrorororprsrc@seZdZdZdZdS)r url.schemezinvalid or missing URL schemeNrrorororprsrcs.eZdZdZdZeedfdd ZZS)rrzURL scheme not permittedallowed_schemescstj|ddS)Nrsuperrw)rvrr|rorprwsz UrlSchemePermittedError.__init__) r~rrrrrsrrrw __classcell__rororrprsrc@seZdZdZdZdS)rz url.userinfoz$userinfo required in URL but missingNrrorororprsrc@seZdZdZdZdS)rurl.hostzURL host invalidNrrorororprsrc@seZdZdZdZdS)r rz+URL host invalid, top level domain requiredNrrorororpr sr c@seZdZdZdZdS)r!zurl.portz*URL port invalid, port cannot exceed 65535Nrrorororpr!sr!c@seZdZdZdZdS)r"z url.extraz>URL invalid, extra characters found after valid URL: {extra!r}Nrrorororpr"sr"c@seZdZdZedddZdS)r%enumrxcCs ddd|jD}d|S)Nrcss|]}t|jVqdSrt)rvaluerrororprsz*EnumMemberError.__str__..z4value is not a valid enumeration member; permitted: )rZ enum_valuesrrororpr{szEnumMemberError.__str__Nrrorororpr%sr%c@seZdZdZdS)r&zvalue is not a valid integerNrrorororpr&sr&c@seZdZdZdS)r'zvalue is not a valid floatNrrorororpr'sr'c@seZdZdZdS)r(zvalue is not a valid pathNrrorororpr(sr(cs$eZdZeddfdd ZZS)_PathValueErrorN)pathrncstjt|ddS)N)r)rrwr)rvrrrorprwsz_PathValueError.__init__)r~rrrrwrrororrprsrc@seZdZdZdZdS)r)zpath.not_existsz1file or directory at path "{path}" does not existNrrorororpr)sr)c@seZdZdZdZdS)r*zpath.not_a_filez&path "{path}" does not point to a fileNrrorororpr*sr*c@seZdZdZdZdS)r+zpath.not_a_directoryz+path "{path}" does not point to a directoryNrrorororpr+ sr+c@seZdZdZdS)r,zOensure this value contains valid import path or valid callable: {error_message}Nrrorororpr,sr,c@seZdZdZdS)r-zvalue is not a valid sequenceNrrorororpr-sr-c@seZdZdZdS) IterableErrorzvalue is not a valid iterableNrrorororprsrc@seZdZdZdS)r.zvalue is not a valid listNrrorororpr.sr.c@seZdZdZdS)r/zvalue is not a valid setNrrorororpr/"sr/c@seZdZdZdS)r0zvalue is not a valid frozensetNrrorororpr0&sr0c@seZdZdZdS) DequeErrorzvalue is not a valid dequeNrrorororpr*src@seZdZdZdS)r1zvalue is not a valid tupleNrrorororpr1.sr1cs.eZdZdZdZeeddfdd ZZS)r2z tuple.lengthz>wrong tuple length {actual_length}, expected {expected_length}N) actual_lengthexpected_lengthrncstj||ddS)N)rrr)rvrrrrorprw6szTupleLengthError.__init__r~rrrrrsintrwrrororrpr22sr2cs,eZdZdZdZeddfdd ZZS)r3zlist.min_items2ensure this value has at least {limit_value} itemsN limit_valuerncstj|ddSN)rrrvrrrorprw>szListMinLengthError.__init__rrororrpr3:sr3cs,eZdZdZdZeddfdd ZZS)r4zlist.max_items1ensure this value has at most {limit_value} itemsNrcstj|ddSrrrrrorprwFszListMaxLengthError.__init__rrororrpr4Bsr4c@seZdZdZdZdS)r5zlist.unique_itemszthe list has duplicated itemsNrrorororpr5Jsr5cs,eZdZdZdZeddfdd ZZS)r6z set.min_itemsrNrcstj|ddSrrrrrorprwSszSetMinLengthError.__init__rrororrpr6Osr6cs,eZdZdZdZeddfdd ZZS)r7z set.max_itemsrNrcstj|ddSrrrrrorprw[szSetMaxLengthError.__init__rrororrpr7Wsr7cs,eZdZdZdZeddfdd ZZS)r8zfrozenset.min_itemsrNrcstj|ddSrrrrrorprwcsz FrozenSetMinLengthError.__init__rrororrpr8_sr8cs,eZdZdZdZeddfdd ZZS)r9zfrozenset.max_itemsrNrcstj|ddSrrrrrorprwksz FrozenSetMaxLengthError.__init__rrororrpr9gsr9cs,eZdZdZdZeddfdd ZZS)r:zany_str.min_lengthz7ensure this value has at least {limit_value} charactersNrcstj|ddSrrrrrorprwsszAnyStrMinLengthError.__init__rrororrpr:osr:cs,eZdZdZdZeddfdd ZZS)r;zany_str.max_lengthz6ensure this value has at most {limit_value} charactersNrcstj|ddSrrrrrorprw{szAnyStrMaxLengthError.__init__rrororrpr;wsr;c@seZdZdZdS)r<zstr type expectedNrrorororpr<sr<cs,eZdZdZdZeddfdd ZZS)r=z str.regexz'string does not match regex "{pattern}"N)patternrncstj|ddS)N)rr)rvrrrorprwszStrRegexError.__init__)r~rrrrrsrrwrrororrpr=sr=cs.eZdZeeeefddfdd ZZS)_NumberBoundErrorNrcstj|ddSrrrrrorprwsz_NumberBoundError.__init__) r~rrr rfloatrrwrrororrprsrc@seZdZdZdZdS)r>z number.not_gtz/ensure this value is greater than {limit_value}Nrrorororpr>sr>c@seZdZdZdZdS)r?z number.not_gez;ensure this value is greater than or equal to {limit_value}Nrrorororpr?sr?c@seZdZdZdZdS)r@z number.not_ltz,ensure this value is less than {limit_value}Nrrorororpr@sr@c@seZdZdZdZdS)rAz number.not_lez8ensure this value is less than or equal to {limit_value}NrrorororprAsrAc@seZdZdZdZdS)NumberNotFiniteErrorznumber.not_finite_numberz$ensure this value is a finite numberNrrorororprsrcs6eZdZdZdZeeeefddfdd Z Z S)rBznumber.not_multiplez0ensure this value is a multiple of {multiple_of}N) multiple_ofrncstj|ddS)N)rr)rvrrrorprwszNumberNotMultipleError.__init__) r~rrrrrsr rrrrwrrororrprBsrBc@seZdZdZdS)rCvalue is not a valid decimalNrrorororprCsrCc@seZdZdZdZdS)rDzdecimal.not_finiterNrrorororprDsrDcs,eZdZdZdZeddfdd ZZS)rEzdecimal.max_digitsz?ensure that there are no more than {max_digits} digits in totalN) max_digitsrncstj|ddS)N)rr)rvrrrorprwszDecimalMaxDigitsError.__init__rrororrprEsrEcs,eZdZdZdZeddfdd ZZS)rFzdecimal.max_placeszBensure that there are no more than {decimal_places} decimal placesN)decimal_placesrncstj|ddS)N)rr)rvrrrorprwszDecimalMaxPlacesError.__init__rrororrprFsrFcs,eZdZdZdZeddfdd ZZS)rGzdecimal.whole_digitszQensure that there are no more than {whole_digits} digits before the decimal pointN) whole_digitsrncstj|ddS)N)rr)rvrrrorprwsz DecimalWholeDigitsError.__init__rrororrprGsrGc@seZdZdZdS)rHzinvalid datetime formatNrrorororprHsrHc@seZdZdZdS)rIzinvalid date formatNrrorororprIsrIc@seZdZdZdZdS)rJzdate.not_in_the_pastzdate is not in the pastNrrorororprJsrJc@seZdZdZdZdS)rKzdate.not_in_the_futurezdate is not in the futureNrrorororprKsrKc@seZdZdZdS)rLzinvalid time formatNrrorororprLsrLc@seZdZdZdS)rMzinvalid duration formatNrrorororprMsrMc@seZdZdZdS)rNzvalue is not a valid hashableNrrorororprNsrNc@seZdZdZdS)rOzvalue is not a valid uuidNrrorororprOsrOcs,eZdZdZdZeddfdd ZZS)rPz uuid.versionz(uuid version {required_version} expectedN)required_versionrncstj|ddS)N)rr)rvrrrorprwszUUIDVersionError.__init__rrororrprPsrPcs0eZdZdZdZeeddfdd ZZS)rQZarbitrary_typez.instance of {expected_arbitrary_type} expectedN)expected_arbitrary_typerncstjt|ddS)N)rrrwr )rvrrrorprwszArbitraryTypeError.__init__ r~rrrrrsr rrwrrororrprQsrQc@seZdZdZdZdS)rRclassza class is expectedNrrorororprRsrRcs0eZdZdZdZeeddfdd ZZS)rSsubclassz%subclass of {expected_class} expectedN)expected_classrncstjt|ddS)N)rr)rvrrrorprw szSubclassError.__init__rrororrprS srSc@seZdZdZdS)rTz Invalid JSONNrrorororprTsrTc@seZdZdZdZdS)rUjsonz+JSON object must be str, bytes or bytearrayNrrorororprUsrUc@seZdZdZdZdS)rVZ regex_patternzInvalid regular expressionNrrorororprVsrVc@seZdZdZdZdS)rW dataclassz0instance of {class_name}, tuple or dict expectedNrrorororprWsrWc@seZdZdZdS)rXz{value} is not callableNrrorororprX$srXc@seZdZdZdZdS)r#Z enum_instancez${value} is not a valid Enum instanceNrrorororpr#(sr#c@seZdZdZdZdS)r$Zint_enum_instancez'{value} is not a valid IntEnum instanceNrrorororpr$-sr$c@seZdZdZdS)rYz)value is not a valid IPv4 or IPv6 addressNrrorororprY2srYc@seZdZdZdS)rZz+value is not a valid IPv4 or IPv6 interfaceNrrorororprZ6srZc@seZdZdZdS)r[z)value is not a valid IPv4 or IPv6 networkNrrorororpr[:sr[c@seZdZdZdS)r\z!value is not a valid IPv4 addressNrrorororpr\>sr\c@seZdZdZdS)r]z!value is not a valid IPv6 addressNrrorororpr]Bsr]c@seZdZdZdS)r^z!value is not a valid IPv4 networkNrrorororpr^Fsr^c@seZdZdZdS)r_z!value is not a valid IPv6 networkNrrorororpr_Jsr_c@seZdZdZdS)r`z#value is not a valid IPv4 interfaceNrrorororpr`Nsr`c@seZdZdZdS)raz#value is not a valid IPv6 interfaceNrrorororpraRsrac@seZdZdZdS)rbz$value is not a valid color: {reason}NrrorororprbVsrbc@seZdZdZdS)rczvalue is not a valid booleanNrrorororprcZsrcc@seZdZdZdZdS)rdzpayment_card_number.digitszcard number is not all digitsNrrorororprd^srdc@seZdZdZdZdS)rezpayment_card_number.luhn_checkzcard number is not luhn validNrrorororprecsrec@seZdZdZdZdS)rfz,payment_card_number.invalid_length_for_brandz3Length for a {brand} card must be {required_length}Nrrorororprfhsrfc@seZdZdZdS)rgz/could not parse value and unit from byte stringNrrorororprgmsrgc@seZdZdZdS)rhz%could not interpret byte unit: {unit}Nrrorororprhqsrhc@seZdZdZdZdS)riz)discriminated_union.missing_discriminatorz7Discriminator {discriminator_key!r} is missing in valueNrrorororpriusrics4eZdZdZdZeeeeddfdd ZZ S)rjz)discriminated_union.invalid_discriminatorzuNo match for discriminator {discriminator_key!r} and value {discriminator_value!r} (allowed values: {allowed_values})N)discriminator_keydiscriminator_valueallowed_valuesrncs"tj||dtt|ddS)Nr)rrr)rrwrmapr)rvrrrrrorprws zInvalidDiscriminator.__init__) r~rrrrrsrrrrwrrororrprjzsrjN)xdecimalrpathlibrtypingrrrrrr r r Zpydantic.v1.typingr r __all__rqrk TypeErrorr ValueErrorr RuntimeErrorrrrrrrrrrrrrrrrrr r!r"r%r&r'r(rr)r*r+r,r-rr.r/r0rr1r2r3r4r5r6r7r8r9r:r;r<r=rr>r?r@rArrBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXr#r$rYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrorororps  (  a