gddlddgZdZGddeZGddeZeejde fd e Z e dd Z e d Z e d Zede fe jZeZ[ y))* NamedConstantConstantNc,eZdZdZfdZfdZxZS)NamedConstantDictzTrack constant order and ensure names are not reused. NamedConstantMeta will use the names found in self._names as the Constant names. c8tt| g|_yN)superr__init___names)self __class__s >/opt/hc_python/lib/python3.12/site-packages/aenum/_constant.pyr zNamedConstantDict.__init__s /1 cLt|rtd|dt|rni||jvrt d|t |t s t|s2||vrt |d|||jj|tt|/||y)zChanges anything not dundered or not a constant descriptor. If an constant name is used twice, an error is raised; duplicate values are not checked for. Single underscore (sunder) names are reserved. z_sunder_ names, such as z+, are reserved for future NamedConstant usezattempt to reuse name: z already defined as: N) is_sunder ValueError is_dunderr TypeError isinstanceconstant is_descriptorappendr r __setitem__)r keyvaluers rrzNamedConstantDict.__setitem__s S> s^  DKK 3AB B x ( e0Dd{sDI NOO KK  s # 23>r)__name__ __module__ __qualname____doc__r r __classcell__rs@rrr s ??rrcbeZdZdZedZfdZdZfdZdZ dZ dZ eZ fd Z xZS) NamedConstantMetaz> Block attempts to reassign NamedConstant attributes. c tSr )r)metaclsclsbaseskwdss r __prepare__zNamedConstantMeta.__prepare__4s  ""rct|tur)|}t}|jD] \}}|||< i}i}|jD]:\} } | |jvr| || <t | t r | j} | || <<tt|+||||} i| _ i| _ |jD]'\} } | j| | | } | | j| <)| Sr ) typedictritemsr r nonmemberrr r$__new___named_constant_cache_ _members_)r&r'r(clsdict original_dictkvnewdict constantsnameobjnewclsnew_krs rr0zNamedConstantMeta.__new__8s =D #M')G%++-1 .  ID#w~~%"% $C+iiGDM )(':7CPWX(*%"*ID#NN645E%*F  T "+ rcy)NTr's r__bool__zNamedConstantMeta.__bool__Osrc|jj|}t@t|tr0t d|j j d|jdtt|+|y)Nzcannot delete constant <.>) __dict__getrrAttributeErrorrr_name_r r$ __delattr__)r'attrcur_objrs rrHzNamedConstantMeta.__delattr__RsY,,""4(  $G])K WEVEVE_E_ahaoao!pq q 1$7rcDd|jjDS)Nc3 K|]}|ywr r>.0r5s r z-NamedConstantMeta.__iter__..Ys21a1 )r2valuesr?s r__iter__zNamedConstantMeta.__iter__Xs23==//122rcVdt|jjDS)Nc3 K|]}|ywr r>rMs rrOz1NamedConstantMeta.__reversed__..\s<;a;rP)reversedr2rQr?s r __reversed__zNamedConstantMeta.__reversed__[s<8CMM$8$8$:;<r)rrrr classmethodr*r0r@rHrRrVrY __nonzero__r\r!r"s@rr$r$/sK##.8 3="K??rr$zPNamedConstants protection. Derive from this class to lock NamedConstants. )r-docnscz|^|}|jjD]%\}}t||s|j|k(s#|cSt |d|j |jj |}t|tr0td|jj d|jdt|tr|xs |j}|j}|j}t|tr |j}t|}|jj |}|:t|j |t|fi}||jt|<|j!||}||_ ||_||_ ||j"|<|j%||||S)Nz does not exist in r[rBrC)rDr.r_value_rrrErrFrrGrr rr,r1r0r2r\) r'r9rr_r:rJr& actual_type value_types rr0r0qsu }++-ID##s# u(< .%NO Ollt$G'=)ARARA[A[]d]k]klmm E8 $"U]] mmG%' u+K++// t|j|jffSr )getattrrrG)r protos r __reduce_ex__rks T^^T[[1 11r)NN)_common__all__rr-rr,r$ _Addendumr*objectglobals constant_dictr0rgrkresolverr>rrrss    !?!?H:?:?x  * *?VJ G b 9 @@@22"/F:}?T?T?VW r