Qf ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddlm Z m Z gdZ Gdde ZGddZeZGdd ZeZGd d ZeZej*iZGd d ZedZedZedZdZdZdZej<dZe ejBe"e#e$e%e&e'ejPejRejTejVeje,e-e.hZ/dZ0GddZ1GddZ2GddZ3eedddddeddZ4dZ5d Z6dded!d"Z7d#Z8d$Z9d%Z:d&Z;d'Zd*Z?d+Z@d,ZAd-ZBd.ZCd/ZDd0ZEd1ZFd2ZGd3ZHd4ZIid5dd6dd7dd8dd9eGd:dd;eHdeId?eHd@eIdAeHdBeIdCeHdDeIZJdEZKdFZLdGZMdHZNdIZOdZddddJdJdJddJdJdJdK dLZPdMZQdNZRdOZSeTdPdQZUdRZVeWdSdTZXdUZYdVdddddJdJdJddJdJdJddW dXZZdYZ[y)[N) FunctionType GenericAlias) dataclassfieldFieldFrozenInstanceErrorInitVarKW_ONLYMISSINGfieldsasdictastuplemake_dataclassreplace is_dataclassc eZdZy)rN__name__ __module__ __qualname__2/opt/alt/python312/lib64/python3.12/dataclasses.pyrrsrrceZdZdZy)_HAS_DEFAULT_FACTORY_CLASScy)Nz rselfs r__repr__z#_HAS_DEFAULT_FACTORY_CLASS.__repr__srN)rrrrrrrrrsrrc eZdZy) _MISSING_TYPENrrrrr!r!rr!c eZdZy) _KW_ONLY_TYPENrrrrr$r$r"rr$ceZdZdZdZy) _FIELD_BASEc||_yNnamerr*s r__init__z_FIELD_BASE.__init__  rc|jSr(r)rs rrz_FIELD_BASE.__repr__s yyrN)rrrr,rrrrr&r&s rr&_FIELD_FIELD_CLASSVAR_FIELD_INITVAR__dataclass_fields____dataclass_params__ __post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)cZttjfd}|S)Nct|tjf}|vryj| |}j ||S#j |wxYw)Nz...)id_thread get_identadddiscard)rkeyresult repr_running user_functions rwrapperz _recursive_repr..wrappersgh))++ ,  &"4(F   %    %s AA&)set functoolswraps)r?r@r>s` @r_recursive_reprrDs.5L__]# $  Nrc"eZdZdZdZdZdZy)r typec||_yr(rF)rrGs rr,zInitVar.__init__r-rct|jtr|jj}nt|j}d|dS)Nzdataclasses.InitVar[]) isinstancerGrrepr)r type_names rrzInitVar.__repr__s= dii & **ITYYI%i[22rct|Sr()r )clsrGs r__class_getitem__zInitVar.__class_getitem__s t}rN)rrr __slots__r,rrPrrrr r sI3rr c<eZdZdZdZedZdZee Z y)r) r*rGdefaultdefault_factoryrLhashinitcomparemetadatakw_only _field_typec d|_d|_||_||_||_||_||_||_|tntj||_ ||_ d|_ yr()r*rGrSrTrVrLrUrW_EMPTY_METADATAtypesMappingProxyTyperXrYrZ) rrSrTrVrLrUrWrXrYs rr,zField.__init__5sl   .    $,)//9  rc&d|jd|jd|jd|jd|jd|j d|j d|jd |jd |jd |jd S) Nz Field(name=z,type=z ,default=z,default_factory=z,init=,repr=z,hash=z ,compare=z ,metadata= ,kw_only=z ,_field_type=)) r*rGrSrTrVrLrUrWrXrYrZrs rrzField.__repr__Es }% }%<<*+##'#7#7":; }% }% }%<<*+ MM,-<<*+#//0  rcrtt|jdd}|r||j||yy)N __set_name__)getattrrGrS)rownerr*funcs rrdzField.__set_name__]s3tDLL)>4@  ud + rN) rrrrQr,rDrrd classmethodrrPrrrrr's4 I   .,$L1rrceZdZdZdZdZy)_DataclassParams rVrLeqorder unsafe_hashfrozen match_argsrYslots weakref_slotc ||_||_||_||_||_||_||_||_| |_| |_ yr(rk) rrVrLrlrmrnrorprYrqrrs rr,z_DataclassParams.__init__tsL   & $  (rc d|jd|jd|jd|jd|jd|j d|j d|jd |jd |jd S) Nz_DataclassParams(init=r`z,eq=z,order=z ,unsafe_hash=z,frozen=z ,match_args=raz,slots=z,weakref_slot=rbrkrs rrz_DataclassParams.__repr__s }% }%gg[!'#//23++)"oo01<<*+' $ 1 14  rN)rrrrQr,rrrrrjrjgs I ) rrjTrSrTrVrLrUrWrXrYc \|tur|tur tdt||||||||S)aReturn an object to identify dataclass fields. default is the default value of the field. default_factory is a 0-argument function called to initialize a field's value. If init is true, the field will be a parameter to the class's __init__() function. If repr is true, the field will be included in the object's repr(). If hash is true, the field will be included in the object's hash(). If compare is true, the field will be used in comparison functions. metadata, if specified, must be a mapping which is stored but not otherwise examined by dataclass. If kw_only is true, the field will become a keyword-only parameter to __init__(). It is an error to specify both default and default_factory. z/cannot specify both default and default_factory)r ValueErrorrrus rrrs=$g/"@JKK /4tW7 $$rcJtd|Dtd|DfS)Nc3TK|] }|js|jr|"ywr(rVrY.0fs r z(_fields_in_init_order..s@Vqvvaii!V ( ((c3TK|] }|js|js|"ywr(rzr{s rr~z(_fields_in_init_order..s__dataclass_return_type__r c3&K|] }d| yw)z Nr)r|bs rr~z_create_fn..s,t!r!Xtsz def rrbz: , zdef __create_fn__(z): z return __create_fn__r)r rkeysexec) r*argsbodyrrrreturn_annotationtxt local_varsnss r _create_fnrs ~'!.9*+9 88D>D 99,t, ,D $qa 12#dV .\s'Bf!".!@ fffs(*rrrbpass*r,)rrr)rVrSr rT TypeErrorr*rGupdate_HAS_DEFAULT_FACTORYobjectrappendr_POST_INIT_NAMErr)r std_fieldskw_only_fieldsro has_post_initrrrq seen_defaultr}r body_linesline params_str _init_paramss r_init_fnr8sL  66II(Q->->'-I# "7zB;!;<< ?E Ef!!&&,aff4fF E MM-A)/ J 1ffi?    d # XXBfBB YKq(9:,aHI X ,67JqKNJL7  @AQ@@ j kL0 #%"&  ((?F08 As"E E+E!ctddddj|Dcgc]}|jd|jd c}zdzg|}t|Scc}w) Nrrz(return self.__class__.__qualname__ + f"(rz={self.z!r}z)"r)rrr*rD)r rr}fns r_repr_fnrss{ J?YY)/ 1)/A$%66((166($ ?)/ 122%  &B 2   1s#Ac|td}d}|r!|ddjd|Dzdzz }tddd |d d d f|| tddd |d ddf|| fS)N)rOrztype(self) is clsz or name in {rc3FK|]}t|jywr()rLr*r{s rr~z'_frozen_get_del_attr..s0Nv!affvs!} __setattr__)rr*rzif :z> raise FrozenInstanceError(f"cannot assign to field {name!r}")z)super(cls, self).__setattr__(name, value))rr __delattr__r+z; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrr)rOr rr conditions r_frozen_get_del_attrr~s%8:F#I _tyy0Nv0N'NNQTTT }/YKq)XBE%&  ( }&YKq)U;>%&  ( rc 4t|ddd|||dg|S)N)rotherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr)r)r*op self_tuple other_tuplers r_cmp_fnrs8 d'?!*bT+?/1&  ''rcBtd|}tddd|dg|S)Nr__hash__rz return hash(rbr)rr)r rrs r_hash_fnrs2FF+J j%j\34% ''rc||juxs1t||juxr|j|juSr()ClassVarrG _GenericAlias __origin__)a_typetypings r _is_classvarrsC foo % :V  4 449%%8;rcP||juxst||juSr()r rGr dataclassess r _is_initvarrs. k)) ) 3F|{2224rc||juSr()r rs r _is_kw_onlyrs [(( ((rctj|}|rd}|jd}|s4tjj |j j}n{tjj |j }|rP|jj ||ur3tjj |j j}|r(||j |jd|ryy)NTF)_MODULE_IDENTIFIER_REmatchgroupsysmodulesgetr__dict__) annotationrOa_moduleris_type_predicaterr module_namemodules r_is_typersR " ' ' 3E kk!n 099B[[__S^^4F&//--k:hF[[__V%6%67@@ #BFF5;;q>$:HE rct||t}t|tr|}n,t|tj rt}t |}||_||_t|_ tjjd}|rXt||sAt|jtr2t!|j|||j"tr t$|_ |jturotjt&}t)||sAt|jtr2t!|j|||j*t(r t,|_ |jt$t,fvr+|j.turt1d|jd|jtt,fvr|j2tur3||_n+|j2turt1d|jd|jturO|j4j6j8/t;dt|j4d|jd|S) N)rSrfield z cannot have a default factoryz$ is a ClassVar but specifies kw_onlyzmutable default z for field z$ is not allowed: use default_factory)rer rKrr]MemberDescriptorTyperr*rGr/rZrrrrstrrrr0rrr r1rTrrYrS __class__rrw)rOa_namerdefault_kw_onlyrSr}rrs r _get_fieldrsc67+G'5!  gu99 :G ' "AF AF AM [[__X &F  (1663'QVVS&&//)++AM }}kk(+  ,1663'QVVS+{7J7J(**AM }}.99  G +fQVVH-../ / }}00 99 'AI 99G #fQVVH-&&' '  }}199#6#6#?#?#G+DO+>2BC LrcT||jvryt||t|||y)NTF)rrsetattr)rOr*rs r_set_new_attributer`s, s||#u Cu rcyr(rrOr rs r_hash_set_noneros rc|Dcgc]+}|j|jsn |js*|-}}t|t||Scc}wr()rUrWrr)rOr rr}fldss r _hash_addrrsD Kv!qvv~!))166AvD K htW5 66 LsA  A A c2td|j)Nz-Cannot overwrite attribute __hash__ in class )rrrs r_hash_exceptionrvs"  # ~/ 00r)FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTc  i} |jtjvr(tj|jj} ni} t |t t ||||||||| | d} d}|jdddD]Y}t|td}|d}|jD]}|| |j<t|t jsXd} [tj|}g}d}tjt}|j!D]p\}}t#||s-t%|t&r2t)||||j*t"r|rt-|dd}d}T|j/t1||||r|D]}|| |j<t%t||jdt2s8|j4t6urt9||jat ||j|j4|jj!D](\}}t%|t2s||vst-|d|r| r |s t-d| s |r t-dt |t| |jj;d t6}|t6uxs|duxrd |jv }|r |s t=d | jDcgc]}|j>t@tBfvr|}}tE|\}}|r3tG|tH}tK|d tM|||||d | vrdnd | | | jDcgc]}|j>t@us|}}|r3|Dcgc]}|jNs|} }tK|dtQ| | |rO|Dcgc]}|jRs|} }tUd | }!tUd| }"tK|d tWd d|!|"| |ru|Dcgc]}|jRs|} }tUd | }!tUd| }"dD]<\}}#tK||tW||#|!|"| s"t-d|d|jd|rNtY||| D]>}$tK||$j|$st-d|$jd|jtZt]|t]|t]||f}%|%r|%||| |_/t|dsC t'tj`|jcdd}&|j|&z|_2|rtK|dtgd|D| r | s t-d| r ti||| }tkjl||Scc}wcc}wcc}wcc}wcc}w#t,t<f$rd}&YwxYw)NFrTz3 is KW_ONLY, but KW_ONLY has already been specifiedz& is a field but has no type annotationz5cannot inherit non-frozen dataclass from a frozen onez5cannot inherit frozen dataclass from a non-frozen oner__eq__z eq must be true if order is truer,r__dataclass_self__rrz==r))__lt__<)__le__z<=)__gt__>)__ge__z>=zCannot overwrite attribute z in class z). Consider using functools.total_ordering__doc__z -> Noner__match_args__c34K|]}|jywr(r)r{s rr~z!_process_class..vs AAz'weakref_slot is True but slots is False)7rrrrr_PARAMSrj__mro__re_FIELDSvaluesr*roinspectget_annotationsritemsrrKrrr rrrrrSr delattrrrwrZr/r1rhasattrrrrrLrrWrrr _hash_actionboolr signaturerrr _add_slotsabcupdate_abstractmethods)'rOrVrLrlrmrnrorprYrqrrr rany_frozen_basehas_dataclass_basesr base_fieldsr}cls_annotations cls_fields KW_ONLY_seenrr*rGr class_hashhas_explicit_hashall_init_fieldsstd_init_fieldskw_only_init_fieldsr field_listrrrrr hash_actiontext_sigs' r_process_classr3s F ~~$++cnn-66 C*4r5+6+5w+0,@AO [[Ab !a$/  ""&  '')!"qvv*q'"))"&"(--c2O JL++h'K%++- d k *4%T3 [5H5H(*4(+=!=>>LG   jdD'B C."qvv gc16640% 8yyG#QVV$QVVQYY/#(||))+ e eU #DO,Cth&LMN N,  6)* *6-. .  C&!!!*g6J'72O(D0MX5MP  R;<< #)--/E/Q--FN+CC/OE2/B_ _5 3 #O$3$7$*$1=Cf:;!;<<&sJ@B!#r{{B7"=bkk]K,,/LL>!;<<A tK0#Bx#F|0 12K#3 G< 3 " 7,,S12:::rJH||h. 3 0 A AA CEABB fl3s# JGE4I1 44J:& H sH-!V,%V1=V1 V6V6>V;V;W!W.WWWcft|Dcgc]}t||jc}Scc}wr()r rer*)rr}s r_dataclass_getstater5s)+1$< 8.s4 1 rrr )r<rrr<r __getstate__ __setstate__)rrrdictrr rA itertoolschain from_iterablemaprAr filterfalse __contains__poprerG __bases__rr5rDr9rE)rO is_frozenrrcls_dict field_namesinherited_slots field_namequalnames rr"r"sW cll"3<<.(DEFFCLL!H4s 44K%%c*ckk!B6G&HIO "  ( ( OO-2   H["   Z&"  LLT" LL%sND1H $s)CLL#-- :C#  )2C   )2C  JrFrkc J   f d} || S| |S)aAdd dunder methods based on the fields defined in the class. Examines PEP 526 __annotations__ to determine fields. If init is true, an __init__() method is added to the class. If repr is true, a __repr__() method is added. If order is true, rich comparison dunder methods are added. If unsafe_hash is true, a __hash__() method is added. If frozen is true, fields may not be assigned to after instance creation. If match_args is true, the __match_args__ tuple is added. If kw_only is true, then by default all fields are keyword-only. If slots is true, a new class with a __slots__ attribute is returned. c . t|  Sr()r3) rOrlrorVrYrprmrLrqrnrrs rwrapzdataclass..wraps(c4r5+$j'5*, ,rr) rOrVrLrlrmrnrorprYrqrrrWs `````````` rrrs&",,  {  9rc t|t}t d|j DS#t$r tddwxYw)zReturn a tuple describing the fields of this dataclass. Accepts a dataclass or an instance of one. Tuple elements are of type Field. z0must be called with a dataclass type or instanceNc3FK|]}|jtus|ywr()rZr/r{s rr~zfields.. sGOqq}}/FOs!!)rerAttributeErrorrrr)class_or_instancer s rr r sPV*G4 GFMMOG GG VJKQUUVs 2Ac4tt|tS)z2Returns True if obj is an instance of a dataclass.)rrGr)objs r_is_dataclass_instancer^s 49g &&rc\t|tr|n t|}t|tS)zEReturns True if obj is a dataclass or an instance of a dataclass.)rKrGrr)r]rOs rrrs%C&#DIC 3  r) dict_factorycFt|s tdt||S)aReturn the fields of a dataclass instance as a new dictionary mapping field names to field values. Example usage:: @dataclass class C: x: int y: int c = C(1, 2) assert asdict(c) == {'x': 1, 'y': 2} If given, 'dict_factory' will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'. z0asdict() should be called on dataclass instances)r^r _asdict_inner)r]r`s rr r s%& "# &JKK l ++rc t|tvr|St|rturFt |Dcic]1}|j t t||j t3c}Sg}t |D]?}t t||j }|j|j |fA|St|tr2t|dr&t||Dcgc]}t |c}St|ttfrt|fd|DSt|trtt|drNt|t|d}|jD]\}}t ||t |< |St|fd|jDStj|Scc}wcc}w)N_fieldsc36K|]}t|ywr(rb)r|vr`s rr~z _asdict_inner..]sEAq,7rTc3TK|]\}}t|t|f!ywr(rf)r|krgr`s rr~z _asdict_inner..fs32%0TQ(<8'<8:%0%()rG _ATOMIC_TYPESr^rFr r*rbrerrKrrlistrcopydeepcopy)r]r`r}r=rrgrjs ` rrbrb4s CyM!  $ 4  $A gc166&:DAA$  FC[%gc166&:LI qvvuo.! ' ' C GC$;(tCy3G3a=L93GHH C$ 'tCyEEEE C  49/ 0T#Yws,=>?F 19Fq,9W}Q 56$MtCy2%(YY[22 2}}S!!a<Hs 6G'0G,) tuple_factorycFt|s tdt||S)aReturn the fields of a dataclass instance as a new tuple of field values. Example usage:: @dataclass class C: x: int y: int c = C(1, 2) assert astuple(c) == (1, 2) If given, 'tuple_factory' will be used instead of built-in tuple. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'. z1astuple() should be called on dataclass instances)r^r_astuple_inner)r]rps rrrms%& "# &KLL #} --rc t|tvr|St|rKg}t|D]3}t t ||j }|j|5|St|tr2t|dr&t||Dcgc]}t |c}St|ttfrt|fd|DSt|tr{t|}t|drE|t |d}|jD]\}}t ||t |< |S|fd|jDStj|Scc}w)Nrdc36K|]}t|ywr(rr)r|rgrps rr~z!_astuple_inner..sG3a=93rhrTc3TK|]\}}t|t|f!ywr(ru)r|rjrgrps rr~z!_astuple_inner..s03&1da(=9>!];[\&1rk)rGrlr^r rrrer*rrKrrrmrFrrnro)r]rpr=r}rrgobj_typerjs ` rrrrrs\ CyM!  $A"73#7GE MM% V$$ C GC$;tCySIS>!];SIJJ C$ 'tCyG3GGG C 9 8. /gc+<=>F 1;I!];[~a78$M3&)iik33 3}}S!!%JsE=r) bases namespacerVrLrlrmrnrorprYrqrrrc ,it}ii|D]}t|tr|}d}n.exec_body_callbacks& ) ( + rr__main__rrk)rArKrlenr isidentifierkeyword iskeywordr:r] new_classr_getframemodulenamerZ _getframe f_globalsrrwrr)cls_namer rxryrVrLrlrmrnrorprYrqrrrseenitemr*tpspecrrOr~rs ` @@rrrs<  5DKH dC DB Y!^ID" Y!^!ND"d!HTNodX67 7$$D,=,=,?EdXNO O   T "@IJ J 4<5dX>? ?  D)., //(E2/A BC~ ,,Q/=:F  St$2U!,V *G5". 00  q)3377 JO"J/   s6 E F /E;:F;F  F F  FFc t|s tdt|tj D]}|j t ur|js(|j|vrtd|jdJ|j|vsY|j tur+|jturtd|jdt||j||j<|jdi|S)a+Return a new object replacing specified fields with new values. This is especially useful for frozen classes. Example usage:: @dataclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = replace(c, x=3) assert c1.x == 3 and c1.y == 2 z1replace() should be called on dataclass instancesrzC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace()r)r^rrerrrZr0rVr*rwr1rSr r)r]changesr}s rrrs$ "# &KLL S' " ) ) + ==O + vvvv  6!&&2-"-..  66 }}.1993G 8AFF:6D"DEE%c1662GAFFO#,0 3== #7 ##rr()\rerrnr]rrrBrGr#r8rr__all__rZrrrr!r r$r r^r\r&r/r0r1rrrcompiler frozensetNoneTyper intfloatrcomplexbytes EllipsisTypeNotImplementedTypeCodeTypeBuiltinFunctionTyperGrangepropertyrlrDr rrjrrrrrrrrrrrrrrrrrrrrrrrr3r5r9rAr"rr r^rrFr rbrrrrrrrrrrsG  , |0./ 23  /  /)%((, X /0-. ! !" # #AB NN      NN    % .$6=2=2@''ZgDtTD'$0 F-1")8 )9;x<&8(v. '';4 )8v_ B70,d,d,d-d-n  -d  -i -d-i-o-i-o-i-o-i-o *g\94 O.4n4dt5$5u>H$' !!%,06"r#(.0""J/1DtUD%u %dW0t0$r