L i׃UddlmZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z m Z mZddlmZmZddlmZmZmZmZmZmZmZmZmZmZmZmZddlZddlm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*dd l+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9dd l:m;Z;mm?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFdd lGmHZHer dd lImJZJmKZKmLZLmMZMd dgZNe dZOe dd ZPedZQeGddeZRGdd ejZSd;dZTddZW d?dZXd@dZYdddAdZZeGddeZ[ejZ]d e^d!<Gd"d#Z_dBd$Z`dCd%ZadDd&ZbdEd'ZcdFd(ZdereSZ=n Gd)de>eSZ=e;s.dd*lmeZfmgZged+e0d,efZherdd-lmeZenehZedDd.Zin"es Gd/d0e=e eOZjdDd1ZidGd2ZkdHd3ZedIdJd4ZgGd5d6ed78ZleGd9d:ejZmy)K) annotationsN) TYPE_CHECKINGAnyTypeUnionGenericTypeVarCallableOptionalcast)datedatetime) ListUnpackLiteralClassVarProtocolRequired ParamSpec TypedDict TypeGuardfinaloverrideruntime_checkable) FieldInfo) BodyIncExQueryModelTHeadersTimeoutNotGiven AnyMappingHttpxRequestFiles) PropertyInfois_listis_given json_safe lru_cache is_mapping parse_datecoerce_booleanparse_datetimestrip_not_givenextract_type_argis_annotated_typeis_type_alias_typestrip_annotated_type) PYDANTIC_V1 ConfigDict GenericModelget_argsis_union parse_obj get_originis_literal_typeget_model_configget_model_fieldsfield_get_default)RAW_RESPONSE_HEADER) ModelField ModelSchema LiteralSchemaModelFieldsSchema BaseModelr6_T _BaseModelT)boundPceZdZUded<y)_ConfigProtocolboolallow_population_by_field_nameN__name__ __module__ __qualname____annotations__W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/anthropic/_models.pyrJrJOs$((rSrJcfeZdZUer$eeddZGddejZ n/e de e jjddZded <erd Zd ed < d dddddd ddZddddddd ddZeddZee d d dZeseZerqed d d d d ddddddd dd d!fdZed dd d d d ddddddd dd d"fdZxZSxZS)#rDc|jSN)__fields_set__selfs rTmodel_fields_setzBaseModel.model_fields_setWs&& &rScDeZdZUejj Zded<y)BaseModel.ConfigrextraN)rNrOrPpydanticExtraallowr^rQrRrSrTConfigr]]s!--E3 -rSrbraDEFER_PYDANTIC_BUILDtrue)r^ defer_buildClassVar[ConfigDict] model_configNz Optional[str] _request_idpythonTF)mode use_api_names exclude_unsetexclude_defaults exclude_nonewarningsc0|j||||||S)aDRecursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude. By default, fields that were not set by the API will not be included, and keys will match the API response, *not* the property names from the model. For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). Args: mode: If mode is 'json', the dictionary will only contain JSON serializable types. e.g. `datetime` will be turned into a string, `"2024-3-22T18:11:19.117000Z"`. If mode is 'python', the dictionary may contain any Python objects. e.g. `datetime(2024, 3, 22)` use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value from the output. exclude_none: Whether to exclude fields that have a value of `None` from the output. warnings: Whether to log warnings when invalid fields are encountered. This is only supported in Pydantic v2. )rjby_aliasrlrmrnro) model_dump)rZrjrkrlrmrnros rTto_dictzBaseModel.to_dictts,:"'-%   rS)indentrkrlrmrnroc0|j||||||S)alGenerates a JSON string representing this model as it would be received from or sent to the API (but with indentation). By default, fields that were not set by the API will not be included, and keys will match the API response, *not* the property names from the model. For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). Args: indent: Indentation to use in the JSON output. If `None` is passed, the output will be compact. Defaults to `2` use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that have the default value. exclude_none: Whether to exclude fields that have a value of `None`. warnings: Whether to show any warnings that occurred during serialization. This is only supported in Pydantic v2. )rurqrlrmrnro)model_dump_json)rZrurkrlrmrnros rTto_jsonzBaseModel.to_jsons.4##"'-% $  rScL|jd|jddS)N(z, )) __repr_name__ __repr_str__rYs rT__str__zBaseModel.__str__s-$$&'q):):4)@(ACCrSc f|j|}i}t|}t|tr |jn|j d}| t }t|}|jD]S\}} | j} | | |vr|r|} | |vr&t|| | | ||<|j|Ft| ||<Ut|} i} |jD]=\} } | |vs | t| | n| }tr|j| ||| <9|| | <?t j#|d|tr)|j%t j#|d||St j#|ddt j#|d| t j#|d||S) Npopulate_by_name)valuefieldkeyrtype___dict__rX__pydantic_private____pydantic_extra____pydantic_fields_set__)__new__r< isinstancerJrLgetsetr=itemsalias_construct_fieldaddr>_get_extra_fields_typeconstruct_typer4object __setattr___init_private_attributes)_BaseModel__cls _fields_setvaluesm fields_valuesconfigr model_fieldsnamerrextra_field_type_extrarparseds rT constructzBaseModel.constructs MM% +- !%(&/2  1 1./   %K'. '--/ ?KD%++C{s&05Ef}&6VC[PU[^&_ d#%&7&> d# ?2%8 ,,. )JC,&P`Ple;KLrwOOC()/M#&"(F3K ) 1j-8  & & (   q"2K @   q"8$ ?   q"6 ?   q";[ IrS) rjincludeexcludecontextrqrlrmrnexclude_computed_fields round_triprofallbackserialize_as_anyc @|dvr td| dk7r td| dk7r td| td| dk7r td| td | dk7r td t| ||||nd||| }|d k(rtd t |S|S)aUsage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. Args: mode: The mode in which `to_python` should run. If mode is 'json', the output will only contain JSON serializable types. If mode is 'python', the output may contain non-JSON-serializable Python objects. include: A set of fields to include in the output. exclude: A set of fields to exclude from the output. context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of `None`. exclude_computed_fields: Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicated `round_trip` parameter instead. round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. fallback: A function to call when an unknown value is encountered. If not provided, a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. Returns: A dictionary representation of the model. >jsonriz&mode must be either 'json' or 'python'F+round_trip is only supported in Pydantic v2T)warnings is only supported in Pydantic v2(context is only supported in Pydantic v21serialize_as_any is only supported in Pydantic v2)fallback is only supported in Pydantic v28exclude_computed_fields is only supported in Pydantic v2)rrrqrlrmrnrdict[str, Any]) ValueErrorsuperdictr r))rZrjrrrrqrlrmrnrrrorrdumped __class__s rTrrzBaseModel.model_dump s\-- !IJJU" !NOO4 !LMM" !KLL5( !TUU# !LMM&%/ ![\\W\%-%9u+!1) "FAE4()F*;< ZTZ ZrS)ru ensure_asciirrrrqrlrmrnrrrorrc  | dk7r td| dk7r td| td|dk7r td| td|dk7r td| dk7r td t| |||||nd||| S) aUsage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json Generates a JSON representation of the model using Pydantic's `to_json` method. Args: indent: Indentation to use in the JSON output. If None is passed, the output will be compact. include: Field(s) to include in the JSON output. Can take either a string or set of strings. exclude: Field(s) to exclude from the JSON output. Can take either a string or set of strings. by_alias: Whether to serialize using field aliases. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that have the default value. exclude_none: Whether to exclude fields that have a value of `None`. round_trip: Whether to use serialization/deserialization between JSON and class instance. warnings: Whether to show any warnings that occurred during serialization. Returns: A JSON string representation of the model. FrTrrrrz-ensure_ascii is only supported in Pydantic v2r)rurrrqrlrmrn)rrr)rZrurrrrrqrlrmrnrrrorrrs rTrwzBaseModel.model_dump_jsonTsJU" !NOO4 !LMM" !KLL5( !TUU# !LMMu$ !PQQ&%/ ![\\7<%-%9u+!1)  rS)returnzset[str])rjzLiteral['json', 'python']rkrKrlrKrmrKrnrKrorKrzdict[str, object])ru int | NonerkrKrlrKrmrKrnrKrorKrstr)rrrW)rz Type[ModelT]rset[str] | Nonerrrr )rjzLiteral['json', 'python'] | strr IncEx | Nonerrr Any | Nonerq bool | NonerlrKrmrKrnrKrrKrrKro'bool | Literal['none', 'warn', 'error']rCallable[[Any], Any] | NonerrKrr)rurrrKrrrrrrrqrrlrKrmrKrnrKrrKrrKrorrrrrKrr)rNrOrPr4propertyrr[r_ BaseConfigrbr5r-osenvironrrgrQrrhrsrxr~ classmethodrmodel_constructrrrw __classcell__rs@rTrDrDTsf   '   ' .X(( ..8~bjjnnE[]c6d'e. * %) ]) "+3""!&"$ ($  $  $  $ $ $  $ R""!&"! !  !  !  ! ! !  ! FDD  (,99$99  99v $ 5=$($("&$("'%*!&,1$@D48%*D [2D [" D [ " D [  D ["D [ D [#D [D [&*D [D [>D [2D [#D [ !D [ D [L "&!&$($("&$("'%*!&,1$@D48%*!: :  :  " :  " :  : ":  : #: : &*: : >: 2:  #!: "#:  : ]rSc | t|Strtt|j}n |j }|t d|t||t|ddS)Nz"Unexpected field type is None for metadata)rrr) r>r4r type outer_type_ annotation RuntimeErrorrgetattr)rrrrs rTrrsc } ''T5,,-   }?uEFF UWUJX\=] ^^rSctry|j}|ddk(r)|d}|ddk(r|jd}|r d|vr|dSy)Nrmodelschema model-fields extras_schemacls)r4__pydantic_core_schema__r)rrfieldsextrass rTrrsY  ) )F f~ ! &>^ +ZZ0F%6/e}$ rScjt|rt|D]}t|syyt|S)zWReturns whether or not the given type is either a `BaseModel` or a union of `BaseModel`TF)r8r7 is_basemodelis_basemodel_type)rvariants rTrrs7 GG$  U ##rSct|xs|}tj|syt|txst|t S)NF)r:inspectisclass issubclassrDr6)rorigins rTrrs9   '%F ??6 " fi ( LJv|,LLrScR|r tdttt||S)a?Construct a BaseModel class without validation. This is useful for cases where you need to instantiate a `BaseModel` from an API response as this provides type-safe params which isn't supported by helpers like `construct_type()`. ```py build(MyModel, my_field_a="foo", my_field_b=123) ``` z]Received positional arguments which are not supported; Keyword arguments must be used insteadrr) TypeErrorr rFr)base_model_clsargskwargss rTbuildrs-  k    ^.O PPrSc8ttt||S)zLoose coercion to the expected type with construction of nested values. Note: the returned value from this function is not guaranteed to match the given type. r)r rErrs rTconstruct_type_uncheckedrs Ne< ==rS)rc d}td|}t|r|}|j}|t|dkDr t |}n0t |rt |dd}t|d}n t }t|xs|}t |}t|r ttd|xs||S|t,k(rJt|s|St |\} } |j/D cic]\} }| t)|| c}} St1|st3j4|rt7|t8st7|t:rt=|r;|Dcgc]/}t|r tt>|j@d i|n|1c}St|rBt7|t8r|j@d i|Stt>|j@d i|S|tBk(r-t=|s|S|d}|Dcgc]}t)||c}S|tDk(r&t#|tFrtE|}||k7r|S|S|S|tHk(r tK|S|tLk(r tO|S|S#t$rYnwxYwt||}|rpt|re|j|jxs |j }|r:t#|t$r*|j&j|} | r t)| |S|D] } t)|| cS#t$rYwxYwt+d|cc}} wcc}wcc}w#t$r|cYSwxYw#t$r|cYSwxYw) zLoose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned as-is. Nz type[object]rrr)unionmeta_annotationsrz0Could not convert data into a valid instance of rR)(r r2 __value__lentupler1r7r0r:r8 validate_type Exception_build_discriminated_union_metar+rfield_alias_from field_namerrmappingrrrrr;rrrrDr6r'rrlistfloatintrr.r r,)rrr original_typemetarr discriminator variant_value variant_typer_ items_typeritementry inner_typecoerceds rTrrsPM  'E%  H  1 %h 5 !qr" *w  '%F E?D  tNMejk\a:e;L.De$..77RWWk k e %+&u///-4U#--66 6 ~u~L!W KPQ%U*=QQ  eS !ElG% N   !%( ( } e$ $ Lg   "8eVZ[ Z.!IIm&D&D&` H`H`aMM3!?,4488G ) EJJ G %EAA    MeWUVVblR L   L sZI,,L-4L3:L8 L= M, I87I8 L LL= M  M  MMceZdZUded<y)CachedDiscriminatorTypeDiscriminatorDetails__discriminator__NrMrRrSrTrr]s++rSrz5weakref.WeakKeyDictionary[type, DiscriminatorDetails]DISCRIMINATOR_CACHEcJeZdZUded< ded< ded< d dZy) r rr str | Nonerdict[str, type]rc.||_||_||_yrW)rrr)rZrdiscriminator_fielddiscriminator_aliass rT__init__zDiscriminatorDetails.__init__s - 3rSN)rrrrrr rNone)rNrOrPrQrrRrSrTr r esSO!  4! 4! 4 ( 4  4rSr ctj|}||Sd}|D]-}t|ts|j!|j}n|syi}d}t |D]}t |}t|strwtd|jj|}|sH|j}t|ddx}sdt|spt |D]} t| ts||| <t||} | s| jd}| d} | ddk(std| dD]} t| ts||| <|syt!||| } tj#|| | S) Nzdict[str, FieldInfo]rserialization_aliasrrliteralrBexpected)rrr)r rrr&rr7r3rr4r __fields__rrr;r_extract_field_schema_pv2r  setdefault) rrcacheddiscriminator_field_namerrrr field_inforr field_schemadetailss rTrrs $ $U +F  +/& j, /J4L4L4X'1'?'? $  $!G&*E?5&w/ W %!"8':L:LMQQRjk !'1&6&6#")*lD"IIJI_iOj!)*!55%eS1-4GEN52';ST',ii0E&F#$X '94!%o|!DZ!P5%eS1-4GEN555< "4/G ""5'2 NrSc|j}|ddk(r|d}|ddk7rytd|}|d}|ddk7rytd|}|dj|}|sytd |S) Nr definitionsrrrArrCrr@)rr r)rrr fields_schemars rTrrs  + +F f~&! f~  - (F8$MV.,m3GR0n-0nYm0nDcN -  V1>@T0UDcN - Vs < AAc eZdZy)r6N)rNrOrPrRrSrTr6r6s rS) TypeAdaptercomputed_fieldzTypeAdapter[object])maxsize)r2c6t|j|SrW)r2validate_pythonrs rTr$r$s5!11%88rSceZdZUdZded<y) RootModelzUsed as a placeholder to easily convert runtime types to a Pydantic format to provide validation. For example: ```py validated = RootModel[int](__root__="5").__root__ # validated: 5 ``` rE__root__N)rNrOrP__doc__rQrRrSrTr8r8s  rSr8cjt|j|}tt|jSrW)_create_pydantic_modelvalidater rEr9)rrrs rTr$r$$s(&u-66u=B''rSct|SrW)r8)rs rTr<r<(s rSctd)Nz+attempted to use TypeAdapter in pydantic v1r)_args_kwargss rTr2r2+sHIIrSc 0dddfd }|||S|S)Nctd)Nz.attempted to use computed_field in pydantic v1r@)r__s rT _exc_funcz!computed_field.._exc_func/sOP PrScSrWrR)rrErFs rT_deczcomputed_field.._dec2s  rS)rrrErrrrR)funcrErHrFs @rTr3r3.s% Q   : KrSc|eZdZUded<ded<ded<ded<ded <d ed <d ed <ded<ded<ded<ded<y)FinalRequestOptionsInputz Required[str]methodurlrparamsr!headersr max_retrieszfloat | Timeout | NonetimeoutzHttpxRequestFiles | Nonefilesridempotency_keyr json_datar$ extra_jsonrKfollow_redirectsNrMrRrSrTrKrK;sB   M  ## ##OrSrKF)totalcneZdZUded<ded<iZded<eZded<eZded <eZd ed <d Z d ed<d Z ded<eZ ded<d Z ded<d Z ded<d Zded<erGddej"ZnedZded<d"dZd#d Ze d$ d%fd! ZeseZxZSxZS)&FinalRequestOptionsrrLrMrrNzUnion[Headers, NotGiven]rOzUnion[int, NotGiven]rPz%Union[float, Timeout, None, NotGiven]rQNzUnion[HttpxRequestFiles, None]rRzUnion[str, None]rSz%Union[Callable[[Any], Any], NotGiven] post_parserzUnion[bool, None]rVzUnion[Body, None]rTzUnion[AnyMapping, None]rUceZdZUdZded<y)FinalRequestOptions.ConfigTrKarbitrary_types_allowedN)rNrOrPr]rQrRrSrTrbr\]s ,0 #T 0rSrbT)r]rfrgcRt|jtr|S|jSrW)rrPr#)rZrPs rTget_max_retriesz#FinalRequestOptions.get_max_retriesbs$ d&& 1 rSct|jsy|jjtr3i|j|_|jj tyyrW)r(rOrr?poprYs rT_strip_raw_response_headerz.FinalRequestOptions._strip_raw_response_headergsL %  <<  / 0+dll+DL LL  0 1 1rSc |jDcic]\}}|t|}}}trttt ||fi|St ||fi|Scc}}wrW)rr/r4r rYrrr)rrrrrrrs rTrzFinalRequestOptions.constructust%lln " U ' '" " +UW->{-Uf-UV Vw&{=f==" sA")rPrrr)rrrW)rrrz Unpack[FinalRequestOptionsInput]rrY)rNrOrPrQrNr#rOrPrQrRrSrZrVrTrUr4r_rrbr5rgr_rbrrrrrrs@rTrYrYIs K HFE(0 G %2(0 K%25=ZG 2?,0E )0(,O%,9AK6C*.'.$(I '*.J'. 1X(( 1.8PT-U *U 2(, >$ >3 >  > > # rSrY)rrrrrrrr)rztype[pydantic.BaseModel]rz type | None)rrrrK)rrrz/TypeGuard[type[BaseModel] | type[GenericModel]])rzCallable[P, _BaseModelT]rzP.argsrzP.kwargsrrF)rrrtype[_T]rrE)rrrrrzOptional[List[Any]]rr)rrrztuple[Any, ...]rzDiscriminatorDetails | None)rztype[BaseModel]rrrzModelField | None)rrdrrrrE)r(rrzpydantic.ConfigDictrr)r-rDr.r rr)rrErzType[RootModel[_T]])rArrBrrrrW)rIrrErrr)n __future__rrrweakreftypingrrrrrr r r r rr typing_extensionsrrrrrrrrrrrrr_pydantic.fieldsr_typesrrrr r!r"r#r$r%_utilsr&r'r(r)r*r+r,r-r.r/r0r1r2r3_compatr4r5r6BaseGenericModelr7r8r9r:r;r<r=r> _constantsr?pydantic_core.core_schemar@rArBrC__all__rErFrHrJrDrrrrrrrrWeakKeyDictionaryr rQr rrrr)r0r2 _TypeAdapterr3_CachedTypeAdapterr$r8r<rKrYrRrSrTrts1" ^^^#    %       ,cc  ' T]m;7  cN)h)){""{| _" $MQ,Q QQ Q.>UYup,h,,NgWMfMfMhJh&4&4R9x%*H0 o"L ' V35LYt5L\5Z[(( 9  L'"+ ( J  y =$(,,=$=$rS