L i͖ddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZmZddlmZddlmZmZmZddlmZmZmZddlmZmZmZmZmZmZdd l m!Z!m"Z"m#Z#m$Z$e%jLZ'd Z(d Z)d Z*e jViZ,e%Z-ej\ej^ej`Z1Gd dejdZ3e3jhZ4 Gdde5Z6e4ddddddddddddddfdZ7 dT dUdZ8 dV dWdZ9dXdZ:GddeZ;dZdZ? dZdZ@dZAdZBdZCd ZDGd!d"ZEd#ZFd$ZG d[d%ZH d\d'ZIeIZJ d(ZKd]d)ZL d^d*ZMd_d+ZNd,ZOd`d-ZPd.ZQdVd/ZRdad0ZSdbd1ZTd2ZUd3ZVd4Z0d5ZW dcd6ZXddd7ZY ded9ZZdfd:Z[ ded;Z\ dgd<Z] dhd=Z^did>Z_Gd?d@Z`e`jDcgc]}e`|e4ddddd&|dAk7dd&e_|B  c}ZbeNeReTe`ebCebDcgc]}|jdDk7s|c}CebDcgc]!}|js|jdDk7s |#c}CZ`GdEdFZeeReTeeZeGdGdHZfefjDcgc]}e`|e4ddddd&ddd&e_|B c}ZgeReTefegCegCZfGdIdJZhehjDcgc]}e`|e4ddddd&ddd&K c}ZieNeReTeheiCeiCeiCZhGdLd8ZjdMDcgc]}e`|e4ddddd&ddd&K c}ZieNeReTejeiCeiCeiCZje%fdfdNZkeIddOGdPdQZldRZmdSZ.ycc}wcc}wcc}wcc}wcc}wcc}w)j) annotationsN)CallableMapping)cached_property)Any NamedTupleTypeVar)_compat_configsetters) PY_3_10_PLUS PY_3_11_PLUS PY_3_13_PLUS_AnnotationExtractor_get_annotationsget_generic_base)DefaultAlreadySetErrorFrozenInstanceErrorNotAnAttrsClassErrorUnannotatedAttributeErrorz__attr_factory_%s)ztyping.ClassVarz t.ClassVarClassVarztyping_extensions.ClassVar_attrs_cached_hashc>eZdZdZej ZdZdZy)_NothingaF Sentinel to indicate the lack of a value when `None` is ambiguous. If extending attrs, you can use ``typing.Literal[NOTHING]`` to show that a value may be ``NOTHING``. .. versionchanged:: 21.1.0 ``bool(NOTHING)`` is now False. .. versionchanged:: 22.2.0 ``NOTHING`` is now an ``enum.Enum`` variant. cy)NNOTHINGselfs P/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/attr/_make.py__repr__z_Nothing.__repr__Kscy)NFrrs r!__bool__z_Nothing.__bool__Nsr#N) __name__ __module__ __qualname____doc__enumautorr"r%rr#r!rr>s diikGr#rc(eZdZdZeddfdZy)_CacheHashWrappera An integer subclass that pickles / copies as None This is used for non-slots classes with ``cache_hash=True``, to avoid serializing a potentially (even likely) invalid hash value. Since `None` is the default value for uncalculated hashes, whenever this is copied, the copy's value for the hash should automatically reset. See GH #613 for more details. Nrc ||fSNr)r _none_constructor_argss r! __reduce__z_CacheHashWrapper.__reduce__fs  %''r#)r&r'r(r)typer2rr#r!r-r-Zs ,0:R(r#r-Tct|| | d\} }} }||dur|dur d}t|| 8|tur d}t|t | s d}t|t | }|i}t | ttfrtj| } |rt |ttfrt|}|rt |ttfrt|}tdid|d|d |d dd |d |d |d|d|d| d| d|d| d|d| d|S)a; Create a new field / attribute on a class. Identical to `attrs.field`, except it's not keyword-only. Consider using `attrs.field` in new code (``attr.ib`` will *never* go away, though). .. warning:: Does **nothing** unless the class is also decorated with `attr.s` (or similar)! .. versionadded:: 15.2.0 *convert* .. versionadded:: 16.3.0 *metadata* .. versionchanged:: 17.1.0 *validator* can be a ``list`` now. .. versionchanged:: 17.1.0 *hash* is `None` and therefore mirrors *eq* by default. .. versionadded:: 17.3.0 *type* .. deprecated:: 17.4.0 *convert* .. versionadded:: 17.4.0 *converter* as a replacement for the deprecated *convert* to achieve consistency with other noun-based arguments. .. versionadded:: 18.1.0 ``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``. .. versionadded:: 18.2.0 *kw_only* .. versionchanged:: 19.2.0 *convert* keyword argument removed. .. versionchanged:: 19.2.0 *repr* also accepts a custom callable. .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01. .. versionadded:: 19.2.0 *eq* and *order* .. versionadded:: 20.1.0 *on_setattr* .. versionchanged:: 20.3.0 *kw_only* backported to Python 2 .. versionchanged:: 21.1.0 *eq*, *order*, and *cmp* also accept a custom callable .. versionchanged:: 21.1.0 *cmp* undeprecated .. versionadded:: 22.2.0 *alias* .. versionchanged:: 25.4.0 *kw_only* can now be None, and its default is also changed from False to None. TNF6Invalid value for hash. Must be True, False, or None.z=The `default` and `factory` arguments are mutually exclusive.z*The `factory` argument must be a callable.default validatorreprcmphashinit convertermetadatar3kw_onlyeqeq_keyorder order_key on_setattraliasr) _determine_attrib_eq_order TypeErrorr ValueErrorcallableFactory isinstancelisttupler pipeand_ _CountingAttr)r6r7r8r9r:r;r=r3r<factoryr>r?rArCrDr@rBmsgs r!attribrRjst$> R$ By D,U1BFn ' !O S/ ! >CS/ !'"*tUm,\\:. Z D%=9)$ Z D%=9)$                         ! r#c8t||d}t|||y)z[ Evaluate the script with the given global (globs) and local (locs) variables. execN)compileeval)scriptglobslocsfilenamebytecodes r!_compile_and_evalr\svx0H5$r#c|in|}d}|} t|d|jd|f}tjj ||}||k(rn|ddd|d}|dz }Ut |||||S)zP Cache the script with _linecache_, compile it and return the _locals_. Nr T->)len splitlines linecachecache setdefaultr\) rWrZrXlocalsrYcount base_filenamelinecache_tupleold_vals r!_linecache_and_compilerks2VD EM  K    d #    //,,XG o % #CR()5'3   feT84 Kr#c|d}i}t|D]\}}|fd}t|||<t|tf|S)z Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0)) Attributesc ||Sr/r)r is r!getterz&_make_attr_tuple_class..getters 7Nr#) enumeratepropertyr3rL)cls_name attr_namesattr_class_namebodyro attr_namerps r!_make_attr_tuple_classrx sX" *-O D!*-+ 9 #6*Y + %4 00r#c,eZdZUded<ded<ded<y) _Attributesr3attrslist[Attribute] base_attrsdict[str, type]base_attrs_mapN)r&r'r(__annotations__rr#r!rzrz s K##r#rzct|}|jdr|jdr|dd}|jtS)z Check whether *annot* is a typing.ClassVar. The string comparison hack is used to avoid evaluating all string annotations which would put attrs-based classes at a performance disadvantage compared to plain old classes. )'"r r^)str startswithendswith_CLASSVAR_PREFIXES)annots r! _is_class_varr&sE JE  #z(Ba    . //r#c||jvS)zR Check whether *cls* defines *attrib_name* (and doesn't just inherit it). )__dict__)cls attrib_names r!_has_own_attributer7s #,, &&r#cg}i}t|jddD]a}t|dgD]O}|js|j|vr|j d}|j ||||j<Qcg}t}t|D]>}|j|vr|jd||j|j@||fS)zQ Collect attr.ibs from base classes of *cls*, except *taken_attr_names*. r r^__attrs_attrs__T inheritedr) reversed__mro__getattrrnameevolveappendsetinsertadd)rtaken_attr_namesr} base_attr_mapbase_clsafilteredseens r!_collect_base_attrsr>s JMS[[2./-#4b9 -A{{aff(884(A   a $,M!&& !  --H 5D j ! 66T> 1   ] ""r#cg}i}|jddD]p}t|dgD]^}|j|vr|jd}|j |j|j ||||j<`r||fS)a- Collect attr.ibs from base classes of *cls*, except *taken_attr_names*. N.B. *taken_attr_names* will be mutated. Adhere to the old incorrect behavior. Notably it collects from the front and considers inherited attributes which leads to the buggy behavior reported in #428. r r^rTr)rrrrrr)rrr}rrrs r!_collect_base_attrs_brokenr_sJMKK"%-#4b9 -Avv))4(A   (   a $,M!&& ! -- } $$r#c |jt|}|t|j}n|durjD chc]\}} | jt ur|} }} g}t } |jD]h\} } t| r| j| j| t}|jt ur t|}|j| |fj| | z }|rQtddjt|fdzdztdjDd}t j"}t$j&j(}|D cgc]!\} }|| |||u|j| #}} }|r(t+||Dchc]}|j,c}\}}n't/||Dchc]}|j,c}\}}|t$j&j0ur>|Dcgc]}|j3d }}|Dcgc]}|j3d }}||z}|t5|||}d }d |DD]B}|dur"|j6turd |}t9||d us.|j6tusAd}D|D]=}|j:rt=j?|d tA|j,?|Dcgc]}|j,}}tC|jD|}tG||||Scc} }wcc}} wcc}wcc}wcc}wcc}wcc}w)a3 Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. If *collect_by_mro* is True, collect them in the correct MRO order, otherwise use the old -- incorrect -- order. See #428. Return an `_Attributes`. Tz1The following `attr.ib`s lack a type annotation: , c:j|jSr/)getcounter)ncds r!z"_transform_attrs..sbffQi6G6Gr#)key.c3NK|]\}}|jtur||fywr/) __class__rO).0rattrs r! z#_transform_attrs..s, D$>>]2t  s#%c |djSNr )r)es r!rz"_transform_attrs..s!A$,,r#)r>Fc3\K|]$}|jdus|jdus!|&yw)FN)r;r>rrs r!rz#_transform_attrs..s& MA!&&"5!))u:La Ms ,,,zlNo mandatory attributes allowed after an attribute with a default value or factory. Attribute in question: rD)$rrrKitemsrrOrrrrrrRrrjoinsorted Attributefrom_counting_attr ClassProps KeywordOnlyNOrrrFORCErrLr6rGrD _OBJ_SETATTR__get___default_init_alias_forrxr&rz)rthese auto_attribsr>collect_by_mrofield_transformerannsca_listrrca_names annot_namesrwr3r unannotatedfcanoca own_attrsr}rr{ had_defaultrQrt AttrsClassrs @r!_transform_attrsr{sp$ B C D u{{}%  !hhj d~~.   e #zz| +OItT" OOI &y'*A{{-/1I NNIq> * +, +C));,GH   "$((*  '    & &C    " "B% Ir   2  HHY   I$7 ),Q!&&,% ! M%? ),Q!&&,% ! M*((...5>?QXXdX+? ?6@Aahhth,A A  "E$'U34K M M $ 199#7ABCAFGCS/ ! % AIIW$<K Nww   #G-DQVV-L MN#((Q!&&(J(' jAJ z%(*m DD{ L--@A>)s* L=<&M1M M M5M?Mcgd}||jdn|jgd|jddgt|d}|tj|d}t dj |||d |i d S) N) zdef wrapper(_cls):z __class__ = _clsz def __getattr__(self, item, cached_properties=cached_properties, original_getattr=original_getattr, _cached_setattr_get=_cached_setattr_get):z+ func = cached_properties.get(item)z if func is not None:z! result = func(self)z1 _setter = _cached_setattr_get(self)z# _setter(item, result)z return resultz, return original_getattr(self, item))z try:z2 return super().__getattribute__(item)z except AttributeError:z4 if not hasattr(super(), '__getattr__'):z raisez- return super().__getattr__(item)zY original_error = f"'{self.__class__.__name__}' object has no attribute '{item}'"z- raise AttributeError(original_error)z return __getattr__z__getattr__ = wrapper(_cls)r)cached_properties_cached_setattr_getoriginal_getattr _cls)rf __getattr__)rextend_generate_unique_filenamerrrkr)rrrlinesunique_filenameglobs r!_make_cached_property_getattrrs E# :      LL $ ) 0Y?O/+33, D " %/4   r#cft|tr|dvrtj|||yt)z4 Attached to frozen classes as __setattr__. ) __cause__ __context__ __traceback____suppress_context__ __notes__N)rJ BaseException __setattr__rr rvalues r!_frozen_setattrsr's7$ &44, !!$e4 r#cdt|tr|dvrtj||yt)z4 Attached to frozen classes as __delattr__. )rN)rJr __delattr__r)r rs r!_frozen_delattrsr8s.$ &4>+A!!$- r#c |\}|j}t |}|D];}|j s|j }|j}||vs-t||||<=|di|S#t$rdt|d}t|dwxYw)a Create a new instance, based on the first positional argument with *changes* applied. .. tip:: On Python 3.13 and later, you can also use `copy.replace` instead. Args: inst: Instance of a class with *attrs* attributes. *inst* must be passed as a positional argument. changes: Keyword changes in the new copy. Returns: A copy of inst with *changes* incorporated. Raises: TypeError: If *attr_name* couldn't be found in the class ``__init__``. attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs* class. .. versionadded:: 17.1.0 .. deprecated:: 23.1.0 It is now deprecated to pass the instance using the keyword argument *inst*. It will raise a warning until at least April 2024, after which it will become an error. Always pass the instance as a positional argument. .. versionchanged:: 24.1.0 *inst* can't be passed as a keyword argument anymore. z*evolve() takes 1 positional argument, but z were givenNr) rGrarFrfieldsr;rrDr) argschangesinstrQrr{rrw init_names r!rrCsJ' ..C 3KE :vv FF GG G #!(y!9GI  : >>! '8T ; O n$& 's A%%%B ceZdZdZdZ ddZdZddZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZddZddZy) _ClassBuilderz( Iteratively build *one* class. )_add_method_dunders _attr_names_attrs_base_attr_map _base_names _cache_hashr _cls_dict_delete_attribs_frozen_has_custom_setattr_has_post_init _has_pre_init_is_exc _on_setattr_pre_init_has_args _repr_added_script_snippets_slots _weakref_slot_wrote_own_setattrc t||||j|j|j\}}}||_|j rt |jni|_||_ |D chc]} | jc} |_ ||_ td|D|_|j |_|j |_|j$|_|j(t*j,j.u|_t3t5|dd|_d|_|j6r>|j:} t=j>| } tA| jBdkD|_t3t5|dd|_"t3| |_#|jH|_%|jL|_'||_(d|_)|j|jd<||jd<|j r.tT|jd<tV|jd <d |_)n|jNtXtZj\tZj^fvrdx} } |D]%} | j`d } | jbd } | s"| s%n|jNtXk(r| s| r>|jNtZj\k(r| r|jNtZj^k(r | sd|_'|jdr-|jg\|jd <|jd <g|_4d|_5tm|jd rtm|jds|jn|_8y|jr|_8ycc} w)Nc34K|]}|jywr/rrs r!rz)_ClassBuilder.__init__..s 7A 7s__attrs_pre_init__Fr __attrs_post_init__r__attrs_props__rrT __getstate__ __setstate__r'r():rr>collected_fields_by_mrorr is_slotteddictrrrrrrrLrr  is_frozenrhas_weakref_slotr  hashabilityr HashabilityHASHABLE_CACHEDrboolrrrrinspect signaturera parametersrr is_exceptionron_setattr_hookrrr rr_DEFAULT_ON_SETATTRr validateconvertr7r<added_pickling_make_getstate_setstaterrhasattr_add_method_dunders_safer_add_method_dunders_unsafe)r rrrpropshas_custom_setattrr{r}base_mapr pre_init_funcpre_init_signature has_validator has_converters r!__init__z_ClassBuilder.__init__s'7    MM  ) )  # # ' #z8 /4/?/?cll+R ,67qAFF7& 7 77&&  "33   !7!7!G!G G "'#/CU"KL"'    22M!(!2!2=!A &)*<*G*G&H1&LD #"730Eu#MN#';))  00#5 "',0KK(),1() ??,)rr&rs r!r"z_ClassBuilder.__repr__s$TYY%7%7$8;;r#cHdj|jDcgc]}|d c}}i}|jD]\}}}|j|t|t |j d|}|jD]\}}}||j |ycc}w)z= Evaluate any registered snippets in one go. rrmethodsN)rrupdaterkrrr)r snippetrWrX_ snippet_globsrYhooks r!_eval_snippetsz_ClassBuilder._eval_snippetssd6K6KL7GAJLM#'#8#8 ( A}a LL ' (&  %dii ;   // 'JAq$  & 'Ms BcX|j|jdur5|j}tj||j _n+|j}trtj|}t|ddrd|jvr|j|S)z Finalize class based on the accumulated configuration. Builder cannot be used after calling this method. T__attrs_init_subclass__N)r:r _create_slots_classweakrefrefr__attrs_base_of_slotted___patch_original_classrabcupdate_abstractmethodsrrr<)r rs r! build_classz_ClassBuilder.build_classs  ;;$ **,C29++c2BDII /,,.C005 C2D 9)=  ' ' ) r#c|j}|j}|jr\|jD]M}||vst ||t t us t jt5t||dddO|jjD]\}}t||||js+t |ddrd|_|js t |_|S#1swYxYw)zA Apply accumulated methods and return the class. N__attrs_own_setattr__F)rrrrr _SENTINEL contextlibsuppressAttributeErrordelattrrrsetattrr rFrrr)r r base_namesrrs r!rAz#_ClassBuilder._patch_original_class-sii%%    (( + *T95YF $,,^<+T*++ + >>//1 &KD% Cu % & &&7 (%, ).C %++". #++s * C))C2 c  |jjDcic]&\}}|gt|jddvr||(}}}t t drt j |j|jsSd|d<|jsB|jjD])}|jjdds t|d<ni}d}|jjddD]U}|jjdd d }|jt!|d gDcic]}|t!||c}Wt#|j$}|j} |j&r$dt!|jd d vr d| vr|s| d z } |jD cic]"\}} t)| t*r || j,$} }} g} | rt/|j} | jD]`\}}| |fz } ||=| j1|t3j4|j6}|t2j8j:us\|| |<b|jd}|| j1|t=| ||j|d<| Dcgc] }||vs| }}|jDcic] \}}||vr||}}}|Dcgc] }||vs| }}|j||j>r|j1t@t||d <|jjB|d<tE|j|jjF|jj|}tIjJ|jjM| D]}t)|tNtPfrt!|jRdd }n5t)|tTrt!|jVdd }n t!|dd }|si|D]%} |jX|ju}|s||_,'|Scc}}wcc}wcc} }wcc}wcc}}wcc}w#tZ$rYXwxYw)zL Build and return a new class with a `__slots__` attribute. r __weakref___clear_type_descriptorsFrFrr r^NT __slots__r)rOrr( __closure__).rrrLrr'sysrPrr r __bases__rrrrr5rrrr rJrfuncrrrrreturn_annotation Parameteremptyrr_HASH_CACHE_FIELDr(r3r& itertoolschainvalues classmethod staticmethod__func__rrfget cell_contentsrG)r kvrrexisting_slotsweakref_inheritedrrMnames cached_propr&additional_closure_functions_to_updateclass_annotationsrU annotationr slot_namesslotslot_descriptor reused_slotsritem closure_cellscellmatchs r!r=z!_ClassBuilder._create_slots_classQs ,,. 1M% 0 01M:M}MM qD   31 2  ' ' 2&&*/B& '++ $ 3 3H((,,-DeL,8=)! ))!B/ H  $$]D9E$(!  ! !!(+r B'(D11  ))*      WTYY R%HHU*% % %E&(XXZ !k+7 +"" "  24.  0 ; /557 9 d$ tH6==dC$..t4FF W%6%6%<%<<.8%d+ 9 "vvm4 +6==>NO =!#3TYY!B}  (-GtJ0FdG G*8)=)=)? %oz! / !  (2NtT5MdN N ,      / 0 +;!YY33>d499odii00$))2E2ErJOO LL   !#I  1D$l ;<!( }d K D(+!( =$ G 'mT B  % 11 ..$));E -0* 1! 12 S F" >H  OJ"sA+Q2Q 3'Q$+ Q*5Q*Q/& Q50Q51Q:: RRctj|\}}fd}jj|||fd_S)Nc4j|d|d<y)Nr"rcls_dictrXr s r! _attach_reprz,_ClassBuilder.add_repr.._attach_reprs#'#;#;E*.__str__s==? "r#r)rrGrr)r rQrs r!add_strz_ClassBuilder.add_strs?GCS/ ! #%)$<$.s! R=-@B! s cDDcic]}|t||c}Scc}w)9 Automatically created by attrs. r)r rstate_attr_namess r!slots_getstatez=_ClassBuilder._make_getstate_setstate..slots_getstates&;KK$D'$--K KKsctj|}t|trt |D]\}}|||nD]}||vs||||r|t dyy)rN)rrrJrLziprY)r state_ClassBuilder__bound_setattrrrhash_caching_enabledrs r!slots_setstatez=_ClassBuilder._make_getstate_setstate..slots_setstates+2248O%'$''7#?1KD%#D%01-;Du}'eDk:;$ 148$r#)rLrr)r rrrrs @@r!r&z%_ClassBuilder._make_getstate_setstatesI !! ))!   L $// 9,~--r#c$d|jd<|SN__hash__)rrs r!make_unhashablez_ClassBuilder.make_unhashables%)z" r#ctjjjj\}}dfd }j j |||fS)Nfrozen cache_hashc4j|d|d<yrru)rwrYr s r! attach_hashz+_ClassBuilder.add_hash..attach_hash*s#'#;#;D._attach_initAs*$D#.D #'#;#;D#AHZ r#_make_init_scriptrrrrrrr rrrrrr)r rWrXrrs` @r!add_initz_ClassBuilder.add_init1s%6 II KK     # #    LL KK       LL    & "{ B $$fe\%BC r#cD|jd|jd<|S)Nct|fi|Sr/)r)r rs r!rz+_ClassBuilder.add_replace..LsF4$;7$;r# __replace__)rrrs r! add_replacez_ClassBuilder.add_replaceJs%(,(@(@ ;) }% r#cVtd|jD|jd<y)Nc3dK|](}|jr|js|j*ywr/)r;r>r)rfields r!rz/_ClassBuilder.add_match_args..Qs)1 zz%-- JJ1 s.0__match_args__)rLrrrs r!add_match_argsz_ClassBuilder.add_match_argsPs'+01 1 , '(r#cdtjjjjj j jjjjjd \}}fd}jj|||fS)NTrcF|d}|_j||d<y)N__attrs_init__rrs r!_attach_attrs_initz8_ClassBuilder.add_attrs_init.._attach_attrs_initgs,)*D#.D )-)A)A$)GH% &r#r)r rWrXrrs` @r!add_attrs_initz_ClassBuilder.add_attrs_initWs%6 II KK     # #    LL KK       LL    & "{ H $$fe5G%HI r#cj}tj\}}fd}jj |||ft |d<S)Nc4j|d|d<y)N__eq__rurvs r! _attach_eqz(_ClassBuilder.add_eq.._attach_equs!%!9!9%/!JHX r#__ne__)r_make_eq_scriptrrrr)r rrWrXrs` r!add_eqz_ClassBuilder.add_eqpsO ^^' 4  K $$feZ%@A8  r#cj}fdtjjD\|d<|d<|d<|d<S)Nc3@K|]}j|ywr/ru)rmethr s r!rz*_ClassBuilder.add_order..s&B   $ $T *B s__lt____le____gt____ge__)r _make_orderrr)r rs` r! add_orderz_ClassBuilder.add_order~sL ^^B #DIIt{{;B >8 blBxL"X,  r#c\i|jD]C}|jxs |j}|s |tjus3||f|j <Es|S|j r d}t|fd}d|jd<|j||jd<d|_ |S)Nz7Can't combine custom __setattr__ with on_setattr hooks.ch |\}}||||}t|||y#t$r|}YwxYwr/)KeyErrorr)r rvalrr9nvalsa_attrss r!rz._ClassBuilder.add_setattr..__setattr__sG *"4.4D!S) tT *   s # 11TrFr) rrCrr NO_OPrrrGrrr )r rrCrQrrs @r! add_setattrz_ClassBuilder.add_setattrs 1A9)9)9Jj =#$j=  1 K  # #KCS/ ! +37./(,(@(@(M}%"& r#c|jj|_|jjd|j|_d|jjd|_|S)z@ Add __module__ and __qualname__ to a *method*. r$Method generated by attrs for class )rr'r(r&r)r methods r!r)z(_ClassBuilder._add_method_dunders_unsafes`!II00!%!7!7 8&//9JK34993I3I2J! L  r#ctjt5|jj|_dddtjt5|jj d|j |_dddtjt5d|jj d|_ddd|S#1swYxYw#1swYXxYw#1swY|SxYw)zL Add __module__ and __qualname__ to a *method* if possible. Nrr)rHrIrJrr'r(r&r)rs r!r(z&_ClassBuilder._add_method_dunders_safes  0 5 $ 4 4F  5  0 P%)YY%;%;$_determine_attrib_eq_order..decide_callable_or_booleans1 E?u3EczCczr#FTrr) r9r?rArrQrcmp_keyr@rBs r!rErEs  3$T0ABC6o 1#6 WGS')) zF/3 F }vy5e<y U{u}=o vui ''r#cT|dus|dur|S||dur|S|D]}t||sy|S)ap Check whether we should implement a set of methods for *cls*. *flag* is the argument passed into @attr.s like 'init', *auto_detect* the same as passed into @attr.s and *dunders* is a tuple of attribute names whose presence signal that the user has implemented it themselves. Return *default* if no reason for either for or against is found. TF)r)rflag auto_detectdundersr6dunders r!_determine_whether_to_implementr sL t|tu}  | u, c6 * Nr#Fc8  ddl}|jtddt|||d\||t t t frtj     fd}||S||S)a A class decorator that adds :term:`dunder methods` according to the specified attributes using `attr.ib` or the *these* argument. Consider using `attrs.define` / `attrs.frozen` in new code (``attr.s`` will *never* go away, though). Args: repr_ns (str): When using nested classes, there was no way in Python 2 to automatically detect that. This argument allows to set a custom name for a more meaningful ``repr`` output. This argument is pointless in Python 3 and is therefore deprecated. .. caution:: Refer to `attrs.define` for the rest of the parameters, but note that they can have different defaults. Notably, leaving *on_setattr* as `None` will **not** add any hooks. .. versionadded:: 16.0.0 *slots* .. versionadded:: 16.1.0 *frozen* .. versionadded:: 16.3.0 *str* .. versionadded:: 16.3.0 Support for ``__attrs_post_init__``. .. versionchanged:: 17.1.0 *hash* supports `None` as value which is also the default now. .. versionadded:: 17.3.0 *auto_attribs* .. versionchanged:: 18.1.0 If *these* is passed, no attributes are deleted from the class body. .. versionchanged:: 18.1.0 If *these* is ordered, the order is retained. .. versionadded:: 18.2.0 *weakref_slot* .. deprecated:: 18.2.0 ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now raise a `DeprecationWarning` if the classes compared are subclasses of each other. ``__eq`` and ``__ne__`` never tried to compared subclasses to each other. .. versionchanged:: 19.2.0 ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now do not consider subclasses comparable anymore. .. versionadded:: 18.2.0 *kw_only* .. versionadded:: 18.2.0 *cache_hash* .. versionadded:: 19.1.0 *auto_exc* .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01. .. versionadded:: 19.2.0 *eq* and *order* .. versionadded:: 20.1.0 *auto_detect* .. versionadded:: 20.1.0 *collect_by_mro* .. versionadded:: 20.1.0 *getstate_setstate* .. versionadded:: 20.1.0 *on_setattr* .. versionadded:: 20.3.0 *field_transformer* .. versionchanged:: 21.1.0 ``init=False`` injects ``__attrs_init__`` .. versionchanged:: 21.1.0 Support for ``__attrs_pre_init__`` .. versionchanged:: 21.1.0 *cmp* undeprecated .. versionadded:: 21.3.0 *match_args* .. versionadded:: 22.2.0 *unsafe_hash* as an alias for *hash* (for :pep:`681` compliance). .. deprecated:: 24.1.0 *repr_ns* .. versionchanged:: 24.1.0 Instances are not compared as tuples of attributes anymore, but using a big ``and`` condition. This is faster and has more correct behavior for uncomparable values like `math.nan`. .. versionadded:: 24.1.0 If a class has an *inherited* classmethod called ``__attrs_init_subclass__``, it is executed after the class is created. .. deprecated:: 24.1.0 *hash* is deprecated in favor of *unsafe_hash*. .. versionchanged:: 25.4.0 *kw_only* now only applies to attributes defined in the current class, and respects attribute-level ``kw_only=False`` settings. .. versionadded:: 25.4.0 *force_kw_only* NrzQThe `repr_ns` argument is deprecated and will be removed in or after August 2025.) stacklevelc xs t|}duxrt|t} xr t|d}|r|r d}t || xrt | d}t j}|r |j}ndurr |jn |j}n~dur |j}nm^ durt|dr |j}nN|dur|durr |jn |j}n+|dur |j}n|j}n d}t|t j}rr |jn |j} n |j } t d"id|d |d d d t | d dt | dd|d| xrt | dd|dd| d!ddt | ddd} | j"sr d}t|t%| | |} | j&r| j)| j*r| j-| j.r| j1| j2r| j5s| j7| j"r| j9n(| j:|jur| j=| j>r| jAn| jCr d}t|tDrt|d s| jGtHrrt|d!s| jK| jMS)#NTrz/Can't freeze a class with a custom __setattr__.)rrFrr5r rrr added_initr1 added_reprr~added_eqadded_ordering)rrrrradded_match_argsr>r added_strr%)rr)r6r!rzlInvalid value for cache_hash. To use hash caching, hashing must be either explicitly or implicitly enabled.)rr*r+zFInvalid value for cache_hash. To use hash caching, init must be True.rrr)'_has_frozen_base_class issubclassrrrGrrr LEAVE_ALONErHASHABLE UNHASHABLErFrrYESr is_hashablerrr{rrrrrrrrrrrrrrrrrrD)"rris_exchas_own_setattrrQr?rrrkwor*builderrrauto_excrreq_r force_kw_onlyrgetstate_setstater:r;r> match_argsrCorder_r8repr_nsslotsrr weakref_slots" r!wrapzattrs..wraps94S9 T!Djm&D% *< +  yCCS/ !Z ; k#7 !,, %11K T\++ ))  U]%11K \d"'9#z'J)55 t T 1" //$-- u)55 )44 JCC.  ,, '4+##+//C..C! ! ! ! %3 ! 7T;  ! 7T; ! !  &:/8 ! &$'! (()! *+! ,*-! ./! 0;!0 1! >'?! @0A! F  ZACC.   %.        W % ?? OO  >> NN            !          +"8"8 8  # # %         " " $^n$  23 F    ! &s,<=  " " $""$$r#) warningswarnDeprecationWarningrrJrKrLr rM) maybe_clsrrr8r9r:r;rrrrrr>rrr?rArrrrCrr unsafe_hashrrrrrs ``` `````````` `````` ` @@r!r{r{'sB c   ,CUDAKC*tUm,\\:. G%G%G%G%V  ?r#c&|jtuS)zV Check whether *cls* has a frozen ancestor by looking at its __setattr__. )rr)rs r!rr3s ??. ..r#c Xd|d|jdt|d|jdS)zF Create a "filename" suitable for a function being generated. z.Hs1AFFdNqvv~!$$$,s 888 r:zdef __hash__(selfzhash((z))z):z, *zC, _cache_wrapper=__import__('attr._make')._make._CacheHashWrapper):z_cache_wrapper()c hj||zz|d dzgD]u}|jrEd|jd}|j|<j|d|d|jdzTj|d|jdzwj|dzzy ) z Generate the code for actually computing the hash code. Below this will either be returned directly or used to compute a value which is then cached, depending on the value of cache_hash r,r7_key(self.z), self. N)rr@rr) prefixindentrcmp_namer{closing_bracesrX hash_func method_lines type_hashs r!append_hash_computation_linesz8_make_hash_script..append_hash_computation_lines`s )+8I;a00   HAxxqvvhd+"#((h##xzxrBB##F}QVVHA-F$FG H FVOn<=r#zif self.z is None:zobject.__setattr__(self, '', rself. = z return self.zreturn r)rLr:rrrYr) rr{rrtabhash_defrrWrrXrrrs ` @@@@@r!rrEsF  E C.sF;>4CH->,?y"IIJ  ),->,?sCS1W    a# . ))*#.a  CL1B0C"DDE%i5 YY| $F 5=r#cnt||dd\}}t||t|d|d|_|S)z% Add a hash method to *cls*. FrrrZ)rr\rrrr{rWrXs r! _add_hashr'sG& U5UMFE 9#z J$CL Jr#cF|j|}|turtS| S)z^ Check equality and either forward a NotImplemented or return the result negated. )rNotImplemented)r otherresults r!rrs( [[ F :r#c ,|Dcgc]}|js|}}gd}i}|r|jd|D]}|jrRd|jd}|j||<|jd|d|jd|d|jd n+|jd |jd |j||d us|d d |d <|jdn|jddj |}||fScc}w)z6 Create __eq__ method for *cls* with *attrs*. )zdef __eq__(self, other):z- if other.__class__ is not self.__class__:z return NotImplementedz return (r7rrrz) == z(other.rrz == other.r^z andz )z return Truer)r?rr@rr)r{rrrXrrWs r!rrs &1Q &E & E E  _% /Axxqvvhd+#$((h xjqvvheH:WQVVHTUV }QVVHJqvvhGHb !$Ryk.b  /  W &' YYu F 5== 's DDcDcgc]}|js|c}fdfd}fd}fd}fd}||||fScc}w)z9 Create ordering methods for *cls* with *attrs*. c<tdfdDDS)z& Save us some typing. c3:K|]\}}|r||n|ywr/r)rrrs r!rz6_make_order..attrs_to_tuple..s' sCJ5 ( sc3bK|]&}t|j|jf(ywr/)rrrB)rrobjs r!rz6_make_order..attrs_to_tuple..s*89aff%q{{3s,/)rL)r1r{s`r!attrs_to_tuplez#_make_order..attrs_to_tuples) =B   r#cb|j|jur||kStSz1 Automatically created by attrs. rr)r r*r2s r!rz_make_order..__lt__0 ??dnn ,!$'.*?? ?r#cb|j|jur||kStSr4r5r6s r!rz_make_order..__le__0 ??dnn ,!$'>%+@@ @r#cb|j|jur||kDStSr4r5r6s r!rz_make_order..__gt__r7r#cb|j|jur||k\StSr4r5r6s r!rz_make_order..__ge__r9r#)rA)rr{rrrrrr2s ` @r!rrsK )1Q )E   666 ))c *s??c| |j}t|\}}t||t|d|d|_t |_|S)z5 Add equality methods to *cls* with *attrs*. rr%)rrr\rrrr&s r!_add_eqr=sR }###E*MFE 9#x HxCJCJ Jr#ctd|D}|Dcic]\}}}|tk7s|dz|}}}}t|d<t|d<t|d<g}|D]B\}}}|rd|znd|zdz} |tk(r|d | d n |d |d | d } |j | Dd j |} |d} n|dz} ddddddddddddd| d| dddg} d j | |fScc}}}w)!zC Create the source and globs for a __repr__ and return it. c3K|]I}|jdur9|j|jdurtn |j|jfKyw)FTN)r8rr;rs r!rz$_make_repr_script..sC" 66  !&&D.$affqvv>"sAA_reprr rJrr zgetattr(self, "z ", NOTHING)z={z!r}z_repr(z)}rz1{self.__class__.__qualname__.rsplit(">.", 1)[-1]}z.{self.__class__.__name__}zdef __repr__(self):z try:z: already_repring = _compat.repr_context.already_repringz except AttributeError:z! already_repring = {id(self),}z: _compat.repr_context.already_repring = already_repringz else:z# if id(self) in already_repring:z return '...'z else:z# already_repring.add(id(self))z return f'(z)'z finally:z$ already_repring.remove(id(self))r)rLr8r rJrrr)r{rzattr_names_with_reprsrrr7rXattribute_fragmentsroaccessorfragment repr_fragmentcls_name_fragmentrs r!ryrysg""" -B  (dAqQ$Yw E E),E E)+ - aGdN%6%= %M  Dy  *'+T8<  ""8, -II12M zO!== D"+D-- )*!M?"=. E$ 99U U ""U s C"C"c| |j}t||\}}t||t|d|d|_|S)z% Add a repr method to *cls*. r"r%)rryr\rr")rrzr{rWrXs r! _add_reprrJNsN }##%eR0MFE 9#z J$CL Jr#ct|}|t|ts d}t|t |dd}|*|t |dd}| ||_|S|d}t ||S)aG Return the tuple of *attrs* attributes for a class. The tuple also allows accessing the fields by their names (see below for examples). Args: cls (type): Class to introspect. Raises: TypeError: If *cls* is not a class. attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs* class. Returns: tuple (with name accessors) of `attrs.Attribute` .. versionchanged:: 16.2.0 Returned tuple allows accessing the fields by name. .. versionchanged:: 23.1.0 Add support for generic classes. NPassed object must be a class.r! is not an attrs-decorated class.)rrJr3rFrrr)r generic_baserQr{s r!rr]s.$C(LJsD$9.n C*D 1E }  #L*;TBE ',# 89"3'' Lr#ct|ts d}t|t|dd}||d}t ||Dcic]}|j |c}Scc}w)a Return an ordered dictionary of *attrs* attributes for a class, whose keys are the attribute names. Args: cls (type): Class to introspect. Raises: TypeError: If *cls* is not a class. attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs* class. Returns: dict[str, attrs.Attribute]: Dict of attribute name to definition .. versionadded:: 18.1.0 rLrNrM)rJr3rFrrr)rrQr{rs r! fields_dictrPse& c4 .n C*D 1E }89"3''$ %!AFFAI %% %sAc tjduryt|jD]/}|j}||||t ||j 1y)z Validate all attributes on *inst* that have a validator. Leaves all exceptions through. Args: inst: Instance of a class with *attrs* attributes. FN)r _run_validatorsrrr7rr)rrrcs r!r#r#sR%' DNN #. KK = dAwtQVV, -.r#cH|j|}|xrd|jvS)z> Check if the attribute name comes from a slot class. rQ)rr)a_namerrs r! _is_slot_attrrUs(   F #C  .;#,,..r#c | duxr| tju} |r| r d} t| |xs|}g}i}|D]}|js|jt ur"|j ||||j<|j|dur d} t| d}b| se|jtjusd}t||||||||| || | rdnd \}}}|jtjvr6|jtj|jj|jt |d|rtj |d<|||fS)Nz$Frozen classes can't use on_setattr.Trr1)r attr_dictr)r rrGr;r6rrrrC_attrs_to_init_scriptr'rSmodulesr5rrr)rr{pre_initpre_init_has_args post_initrrrrrcls_on_setattrrhas_cls_on_setattrrQneeds_cached_setattrfiltered_attrsrWrrWrXrs r!rrsj d"J~W]]'J$4o%/NI (vv!))w. a  !&& << #~< o%#' ALL $E#' ( "7 &J "FE; ~~$ S[[099: LLW9=>(4';';#$ 5+ %%r#cd|d|dS)zJ Use the cached object.setattr to set *attr_name* to *value_var*. _setattr('rrr)rw value_varhas_on_setattrs r!_setattrres {#i[ 22r# Converterc4d|d|j||dS)zk Use the cached object.setattr to set *attr_name* to *value_var*, but run its converter first. rbrr)_fmt_converter_callrwrcrdr<s r!_setattr_with_converterrjs( {#i&C&CIy&Y%ZZ[ \\r#c0|r t||dSd|d|S)zo Unless *attr_name* has an on_setattr hook, use normal assignment. Otherwise relegate to _setattr. Tr r!)re)rwrrds r!_assignrls)  5$// 9+S ((r#cR|rt||d|Sd|d|j||S)z Unless *attr_name* has an on_setattr hook, use normal assignment after conversion. Otherwise relegate to _setattr_with_converter. Tr r!)rjrhris r!_assign_with_converterrn#s9&y)T9MM 9+S!>!>y)!T U VVr#c|dur4|dur dttfS dfd } dfd }d||fSdttfS)zg Determine the correct setter functions based on whether a class is frozen and/or slotted. TrcFt|r t|||Sd|d|SN _inst_dict['z'] = )rUre)rwrcrdrs r! fmt_setterz&_determine_setters..fmt_setter@s1Y 6 9nEE!)E)= =r#cl|s t|rt||||Sd|d|j||Srq)rUrjrh)rwrcrdr<rs r!fmt_setter_with_converterz5_determine_setters..fmt_setter_with_converterHsL y-!H.y.)")E)2O2OPY[d2e1fg gr#)z_inst_dict = self.__dict__rwrrcrrdrrr rwrrcrrdrr<rfrr)rerjrlrn)rrrrsrus ` r!_determine_settersrx0s~ D=x!88 8 > >'* ><@ >  > h h h! h! h  h ,  %   w. ..r#c  |rdgng} | r| jdt|||\} }}| j| g}g}g}g}i}ddi}|D]}|jr|j||j}|j duxs |j t juxr| }|j}t|jt}|r|jjrdnd}|j0t|jtst|j}n |j}|jdur|rt |jfz}|J| j|||d|d z|||j||j#|j<n | j|||d|d z||jj$||<n |H| j||d |d |||j||j#|j<n| j||d |d |n|jt&ur|s|d |d }|j(r|j|n"|j||j||D| j||||||j||j#|j<n| j||||n|rY|d }|j(r|j|n"|j||j|| jd|dt |jfz}|}| jd|||||z| jd| jd|||dz|zd z||z|j||j#|j<nR| jd||||z| jd| jd|||dz|zd z|z|jj$||<n|j(r|j|n"|j||j||C| j||||||j||j#|j<n| j|||||jdus|j*||j*||<||j,s|j,||<|rxt.|d<| jd|D]Y}d|jz}d|jz}| jd|d|d|jd |j||<|||<[|r| jd|r5|r|r dt0d} ndt0d} n dt0d} | j| |r-d j3d!|D}!| jd"|!d d#j3|}d#j3|}|rV||rd#ndd$d#j3|z }d#j3d%|DD"cgc] }"|"d&|" c}"}#||rd#ndz }||#z }|r |r d'|d | d(<d)}$d*| d|d+| r|$j3| nd,d-||fScc}"w).z Return a script of an initializer for *attrs*, a dict of globals, and annotations for the initializer. The globals are required by the generated script. zself.__attrs_pre_init__()z$_setattr = _cached_setattr_get(self)rNr FrArz attr_dict['z '].defaultz =attr_dict['z=NOTHINGzif z is not NOTHING:rzelse:Tr z#if _config._run_validators is True:__attr_validator___attr_z(self, z, self.zself.__attrs_post_init__()rbz', None)rrz '] = Noner z = Nonerc3TK|] }|jsd|j"yw)r N)r;rrs r!rz(_attrs_to_init_script..E s!BQ166%x(Bs((zBaseException.__init__(self, rz*, c3DK|]}|jddyw)=rN)split)rkwas r!rz(_attrs_to_init_script..R s#N#CIIcN1$5#Ns rzself.__attrs_pre_init__(rz zdef z): passr)rrxrr7rrCr rrDrJr6rI takes_selfr<rfr;_INIT_FACTORY_PAT_get_global_namerPrr>r3_first_param_typer rYr)%r{rr call_pre_initr[call_post_initdoes_cache_hashrrr_r^ method_namer extra_linesrsrur pre_init_args kw_only_argsattrs_to_validatenames_for_globalsrrrwrdarg_name has_factory maybe_selfr<init_factory_nameargval_nameinit_hash_cachevals kw_arg_namepre_init_kw_only_argsNLs% r!rXrX_sh(.; ( )E  3  :L:}:6K6 LL DMLT"K XD ;;  $ $Q 'FF T1 LL - D2D  77 G4 *qyy/C/CV ;; ":akk9+M!!++.I I 66U?$5 $A!(LL1%-!Jvv!i&7() H%&9+F+F(1(C(C H%qXDt'.)$ :;" -A*QVV3H!AFF*I LL4z 7166(!L M*+++ h '+, i (  - 12 $./@.A"J$01B0C9"M %&7%8@O _%xxB%BB 4TF!<= 99T?DIIm,M 44R(DIIl,C+DEE $ $O#N  -q . !  B6 .. *-m_A>a B  WTF+RWWU^&)*     s[1c$|jdS)z The default __init__ parameter name for a field. This performs private-name adjustment via leading-unscore stripping, and is the default value of Attribute.alias if not provided. r7)lstriprs r!rrg s ;;s r#cneZdZdZdZ d dZdZe d d dZdZ dZ d Z d Z y)ra *Read-only* representation of an attribute. .. warning:: You should never instantiate this class yourself. The class has *all* arguments of `attr.ib` (except for ``factory`` which is only syntactic sugar for ``default=Factory(...)`` plus the following: - ``name`` (`str`): The name of the attribute. - ``alias`` (`str`): The __init__ parameter name of the attribute, after any explicit overrides and default private-attribute-name handling. - ``inherited`` (`bool`): Whether or not that attribute has been inherited from a base class. - ``eq_key`` and ``order_key`` (`typing.Callable` or `None`): The callables that are used for comparing and ordering objects by this attribute, respectively. These are set by passing a callable to `attr.ib`'s ``eq``, ``order``, or ``cmp`` arguments. See also :ref:`comparison customization `. Instances of this class are frequently used for introspection purposes like: - `fields` returns a tuple of them. - Validators get them passed as the first argument. - The :ref:`field transformer ` hook receives a list of them. - The ``alias`` property exposes the __init__ parameter name of the field, with any overrides and default private-attribute handling applied. .. versionadded:: 20.1.0 *inherited* .. versionadded:: 20.1.0 *on_setattr* .. versionchanged:: 20.2.0 *inherited* is not taken into account for equality checks and hashing anymore. .. versionadded:: 21.1.0 *eq_key* and *order_key* .. versionadded:: 22.2.0 *alias* For the full version history of the fields, see `attr.ib`. )rr6r7r8r?r@rArBr:r;r=r3r<r>rrCrDNct||xs| |xs|d\} }}}tj|}|d||d||d||d||d| |d||d||d ||d ||d ||d | |d | rtjt | nt |d| |d| |d||d||d|y)NTrr6r7r8r?r@rArBr:r;r<r=r3r>rrCrD)rErrtypesMappingProxyTyper_EMPTY_METADATA_SINGLETON)r rr6r7r8r9r:r;rr=r3r<r>r?r@rArBrCrD bound_setattrs r!r1zAttribute.__init__ s*(B 2y1E4( $FE9 %,,T2  fd#i)k9-fd#dBh'gu%k9-fd#fd#k9- &&tH~6.   fd#i)k9-lJ/gu%r#ctr/)rrs r!rzAttribute.__setattr__ s!!r#c| |j}n|jd|d}t||||j|j|jd|j |j d|j||j|j|n |j|j|j|j|j|j|jS)Nz>Type annotation and type argument cannot both be present for 'z'.F)r3rG_default _validatorr8r:r;r=r<r>r?r@rArBrCrD)rrrr>r3rQs r!rzAttribute.from_counting_attr s <77D WW RSWRXXZ[CS/ !  KK MM GG  GG GG  KK  LLzz)Grzz EE II HH LL MM HH%  r#c ntj|}|j|j|S)a  Copy *self* and apply *changes*. This works similarly to `attrs.evolve` but that function does not work with :class:`attrs.Attribute`. It is mainly meant to be used for `transform-fields`. .. versionadded:: 20.3.0 )copy _setattrsr)r rnews r!rzAttribute.evolve s(iio gmmo& r#c@tfdjDS)( Play nice with pickle. c3jK|]*}|dk7r t|ntj,yw)r=N)rrr=rrr s r!rz)Attribute.__getstate__..% s5 $(:#5GD$ 4 ;N N s03rLrQrs`r!rzAttribute.__getstate__! s#    r#cN|jt|j|yrN)rrrQr rs r!rzAttribute.__setstate__* s s4>>512r#c tj|}|D]A\}}|dk7r ||||||rtjt |nt Cy)Nr=)rrrrrr)r name_values_pairsrrrs r!rzAttribute._setattrs0 s^$,,T2 , KD%z!dE*!..tE{;6  r#) NNNFNNNNNNr/)rrrrOr>r) r&r'r(r)rQr1rr]rrrrrrr#r!rrr s~(XI<  '5&n"?C  ) 48  B$ 3 r#rr=) rr6r7r8r9r?rAr:r;rrD)r{rc|eZdZdZdZgeddDeddddddddddddddd Zd Zd Z d Z d Z y)rOa Intermediate representation of attributes that uses a counter to preserve the order in which the attributes have been defined. *Internal* data structure of the attrs library. Running into is most likely the result of a bug like a forgotten `@attr.s` decorator. )rrrDr<rr?r@r:r;r>r=rCrArBr8r3c#jK|]+}t|t|tdddddddddddd-yw)NTFrrDr6r7r8r9r:r;r>r?r@rArBrrC)rrr)rrs r!rz_CountingAttr.v sV $# -d3   s13) rrr8r?rAr:r;rCrDr=NTFrrc2txjdz c_tj|_||_||_||_||_| |_| |_| |_ ||_ ||_ ||_ ||_ | |_| |_||_||_yr)rO cls_counterrrrr<r8r?r@rArBr:r;r=r3r>rCrD)r r6r7r8r9r:r;r<r=r3r>r?r@rArBrCrDs r!r1z_CountingAttr.__init__ s& !!Q&!$00  #"   "      $ r#cf|j ||_|St|j||_|S)z Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0 )rrNr rs r!r7z_CountingAttr.validator s5 ?? ""DO #4??D9DO r#cZ|jturtt|d|_|S)z Decorator that allows to set the default for an attribute. Returns *meth* unchanged. Raises: DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0 T)r)rrrrIrs r!r6z_CountingAttr.default s) == '( (6  r#) r&r'r(r)rQrLrrrr1r7r6rr#r!rOrOZ sI$0  $ %  0>  ?0ObK#J r#rOc~eZdZdZGddej ZGddej ZdZdZ e dZ y ) ra Effective class properties as derived from parameters to `attr.s()` or `define()` decorators. This is the same data structure that *attrs* uses internally to decide how to construct the final class. Warning: This feature is currently **experimental** and is not covered by our strict backwards-compatibility guarantees. Attributes: is_exception (bool): Whether the class is treated as an exception class. is_slotted (bool): Whether the class is `slotted `. has_weakref_slot (bool): Whether the class has a slot for weak references. is_frozen (bool): Whether the class is frozen. kw_only (KeywordOnly): Whether / how the class enforces keyword-only arguments on the ``__init__`` method. collected_fields_by_mro (bool): Whether the class fields were collected by method resolution order. That is, correctly but unlike `dataclasses`. added_init (bool): Whether the class has an *attrs*-generated ``__init__`` method. added_repr (bool): Whether the class has an *attrs*-generated ``__repr__`` method. added_eq (bool): Whether the class has *attrs*-generated equality methods. added_ordering (bool): Whether the class has *attrs*-generated ordering methods. hashability (Hashability): How `hashable ` the class is. added_match_args (bool): Whether the class supports positional `match ` over its fields. added_str (bool): Whether the class has an *attrs*-generated ``__str__`` method. added_pickling (bool): Whether the class has *attrs*-generated ``__getstate__`` and ``__setstate__`` methods for `pickle`. on_setattr_hook (Callable[[Any, Attribute[Any], Any], Any] | None): The class's ``__setattr__`` hook. field_transformer (Callable[[Attribute[Any]], Attribute[Any]] | None): The class's `field transformers `. .. versionadded:: 25.4.0 c&eZdZdZdZ dZ dZ dZy)ClassProps.HashabilityzO The hashability of a class. .. versionadded:: 25.4.0 hashablehashable_cache unhashable leave_aloneN)r&r'r(r)rrrrrr#r!rr6 s) #*6! +# 'r#rc eZdZdZdZ dZ dZy)ClassProps.KeywordOnlyzw How attributes should be treated regarding keyword-only parameters. .. versionadded:: 25.4.0 ryesforceN)r&r'r(r)rrrrr#r!rrF s! .Q.r#rr rrrr>rrrrrrrrr%r!rc||_||_||_||_||_||_||_||_| |_| |_ | |_ | |_ | |_ ||_ ||_||_yr/r)r r rrrr>rrrrrrrrr%r!rs r!r1zClassProps.__init__g s}&)$ 0" '>$$$  ,& 0",.!2r#c|jtjjuxs&|jtjjuSr/)rrrrrrs r!rzClassProps.is_hashable sC    6 6 ? ? ? J:#9#9#I#II r#N) r&r'r(r)r*EnumrrrQr1rrrrr#r!rr sJBH(dii( /dii /I&"3H  r#rc(eZdZdZdZddZdZdZy)rIa Stores a factory callable. If passed as the default value to `attrs.field`, the factory is used to generate a new value. Args: factory (typing.Callable): A callable that takes either none or exactly one mandatory positional argument depending on *takes_self*. takes_self (bool): Pass the partially initialized instance that is being initialized as a positional argument. .. versionadded:: 17.1.0 *takes_self* rPrc ||_||_yr/r)r rPrs r!r1zFactory.__init__ s $r#c@tfdjDS)rc36K|]}t|ywr/rrs r!rz'Factory.__getstate__.. sDTWT4(Dsrrs`r!rzFactory.__getstate__ sDT^^DDDr#cZt|j|D]\}}t|||yr)rrQrL)r rrrs r!rzFactory.__setstate__ s.t~~u5 'KD% D$ & 'r#N)F)r&r'r(r)rQr1rrrr#r!rIrI s$*I%E 'r#rI) rr6r7r8r9r?rAr:r;rcHeZdZdZdZddddZed dZd dZdZ d Z y ) rfae Stores a converter callable. Allows for the wrapped converter to take additional arguments. The arguments are passed in the order they are documented. Args: converter (Callable): A callable that converts the passed value. takes_self (bool): Pass the partially initialized instance that is being initialized as a positional argument. (default: `False`) takes_field (bool): Pass the field definition (an :class:`Attribute`) into the converter as a positional argument. (default: `False`) .. versionadded:: 24.1.0 )__call__r _global_namer< takes_fieldrFrrc|_|_|_t|}|j _jsjs fd_nPjrjs fd_n-jsjr fd_n fd_|j}||j jd<yy)Nc&j|Sr/r<)rr7__r s r!rz$Converter.__init__.. s1Fr#c(j||Sr/r)rinstancerr s r!rz$Converter.__init__.. sx9r#c(j||Sr/r)rrrr s r!rz$Converter.__init__.. sT^^u6r#c*j|||Sr/r)rrrr s r!rz$Converter.__init__.. s4>>x<r#r) r<rrrget_first_param_typerrget_return_typer)r r<rrexrts` r!r1zConverter.__init__ s"$& !) ,!#!8!8!:4#3#3FDM __T%5%5DMT%5%5DMDM   ! >68DMM ) )( 3 r#c d|S)zh Return the name that a converter for an attribute name *attr_name* would have. __attr_converter_r)rws r!rzConverter._get_global_name s #9+..r#c>|js#|js|j|d|dS|jr&|jr|j|d|d|dS|jr|j|d|dS|j|d|d|dS)z Return a string that calls the converter for an attribute name *attr_name* and the value in variable named *value_var* according to `self.takes_self` and `self.takes_field`. rArz, self, attr_dict['z'])z, self)z , attr_dict[')rrr)r rwrcs r!rhzConverter._fmt_converter_call" s 4#3#3++I67q 1E E ??t//++I67q CVW`Vaade e ??++I67q 7K K'' 231YK}YKWZ[[r#cJ|j|j|jdS)zx Return a dict containing only converter and takes_self -- the rest gets computed when loading. r<rrrrs r!rzConverter.__getstate__3 s% //++  r#c(|jdi|y)z+ Load instance from state. Nrrrs r!rzConverter.__setstate__> s  r#N)rwrrr)rwrrcrrr) r&r'r(r)rQr1r^rrhrrrr#r!rfrf s>(I16596//\"  r#rc tjd|}t|tr|}n. s $r#r r&__main__r9r?rATrr) unicodedata normalizerJrrKrLrRrFpopr5r new_classrHrIrJrGrS _getframe f_globalsrr'rrrr3r)rr{bases class_bodyattributes_argumentsrwrrQrZr\ user_inittype_r9rrbrcrvs @r! make_classrZ s`   .D% ED%= ))./AAvxK//8n||0$7H 2D9I Z.I D J%- !"&/ "#$Z OOD%-G HE   ^Z 8 ==+5599     " "5$ /C "   &  )  T"W% 9& 8x 8#7 8 ?C'nn.a!&&2D166 C J_02  &sG5G*G*?G*G')rrc$eZdZdZeZdZy) _AndValidatorz2 Compose many validators to a single one. c:|jD] }||||yr/) _validators)r rrrrcs r!rz_AndValidator.__call__ s#!! !A dD%  !r#N)r&r'r(r)rRrrrr#r!rr s(K!r#rcg}|D]0}|jt|tr |jn|g2tt |S)a A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. Args: validators (~collections.abc.Iterable[typing.Callable]): Arbitrary number of validators. .. versionadded:: 17.1.0 )rrJrrrL) validatorsrr7s r!rNrN sO D  )]3  ! !   t %%r#ctdD}|rfd}nfd}s*td}|jj||dn~t dj }|r||jd<d}t st|tr |j}t |j}|r||jd <|rt|d d S|S) a A converter that composes multiple converters into one. When called on a value, it runs all wrapped converters, returning the *last* value. Type annotations will be inferred from the wrapped converters', if they have any. converters (~collections.abc.Iterable[typing.Callable]): Arbitrary number of converters. .. versionadded:: 20.1.0 c3<K|]}t|tywr/rJrf)rcs r!rzpipe.. sGq*Q 2GscZD]$}t|tr ||||n||}&|Sr/r)rrrr converterss r!pipe_converterzpipe..pipe_converter s9 +5a+CAc4'3  Jr#c&D] }||} |Sr/r)rrrs r!rzpipe..pipe_converter s" f Jr#A)rrrrr^rTr) rr rr5rrrrJrfrr)rreturn_instancerrtlastrs` r!rMrM s GJGGO    CL&&--a1.EF !A / D D F 45N * *5 1"~ 4 ;==D"$ ' 7 7 9 79N * *8 4DdKK r#)Nrz) rWrrXdict[str, Any] | NonerYMapping[str, object] | NonerZrrrr/) rWrrZrrXr rfr rzdict[str, Any])rsrrtz list[str]rr3)rz'tuple[list[Attribute], dict[str, type]])rrz)T)NNNNNNNFFTFFFFFNNFFNNNTNT)rr3r rrr) rr3r{r|rrrrrtuple[str, dict])rr3r{r|)r{rKrr )rr )NN)rtuple[str, dict, dict]rvrw)rwrrrrdrrr)rrrrrr~)r{r|rrrrrrr[rrrrrrr~rrr_rr^rrrrr)rrrr)n __future__rrBrHrr*rrZrcrSrrr>collections.abcrr functoolsrtypingrrr rzr r r rrrrrr exceptionsrrrrobjectrrrrrYrrrGrMr$r#r"rrrintr-rRr\rkrxrzrrrrrrrrrrrrErr{rrrrr'rrrr=ryrJrrPrUrrerjrlrnrxrXrrrQ_arr:rOr_casrI_frfrrrN)rrs00r!rs#   -%++('!! ')2E2226 H "gll7??G4D4DEtyy(    ( ("        kb)-       &      $+/     !  (   F1.$*$ 0"'#,#B%8uEuEp1h"7tF F R8((X.26         3BJ  /E E%E/3EAEEEP  "J5*p"6#r +\&:.$/B&B&J3]]"]48]EN]]) W W" W48 WEN W W,/ ,/,/.=,/^E EEE E  E  EE#E EEEEEPKKx##     j %d+ "  )2&6Q+ 5q6 =AFFqvv'<1 =   QQh -01 _ _ `$$       %d+ "Yz6d C $'$'h!!         GIgR8C2 Naab;          Iir *"5R  yTdVTt$ ! !% !&.9S(7 =z vns60#O'O<O O O -O ) O$6O):O.