Your IP : 18.222.161.57


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/enum.cpython-310.opt-2.pyc

o

6��f���@s�ddlZddlmZmZgd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	e
�ZGdd�d�ZGdd�de
�ZdZGdd�de�ZGdd�ded�ZGdd�dee�Zdd�ZGdd�de�ZGdd�dee�Zdd �Zd!d"�Zd#d$�ZdS)%�N)�MappingProxyType�DynamicClassAttribute)�EnumMeta�Enum�IntEnum�Flag�IntFlag�auto�uniquecCs 	t|d�pt|d�pt|d�S)N�__get__�__set__�
__delete__)�hasattr)�obj�r�+/opt/alt/python310/lib64/python3.10/enum.py�_is_descriptors
��rcCsN	t|�dko&|dd�|dd�kodkno&|ddko&|ddkS)N������__�_�����len��namerrr�
_is_dunders&�
�
�rcCsN	t|�dko&|d|dkodkno&|dd�dko&|dd�dkS)Nrr���r�rrrrrr�
_is_sunder!s���r cCs^d|f}t|�}t|�|kr-|�|�r-|||d�dgkr-|ddks+|ddkr-dSdS)Nz_%s__rrrrTF)r�
startswith)�cls_namer�pattern�pat_lenrrr�_is_private,s
�r%cCs	dd�}||_d|_dS)NcSstd|��)Nz%r cannot be pickled)�	TypeError��self�protorrr�_break_on_call_reduce>sz6_make_class_unpicklable.<locals>._break_on_call_reducez	<unknown>)�
__reduce_ex__�
__module__)�clsr*rrr�_make_class_unpicklable:s
r.c@seZdZ	eZdS)r	N)�__name__r,�__qualname__�
_auto_null�valuerrrrr	Dsr	cs*eZdZ	�fdd�Z�fdd�Z�ZS)�	_EnumDictcs&t���g|_g|_g|_d|_dS)NF)�super�__init__�
_member_names�_last_values�_ignore�_auto_called�r(��	__class__rrr5Rs


z_EnumDict.__init__cs�	t|j|�rddl}|jd|ftdd�t|�r`|dvr"td��|dkr4|jr-td��t	|d	|�n�|d
kr_t
|t�rF|�dd��
�}nt|�}||_t|�t|j�@}|r_td
|f��n[t|�rk|dkrjd}nP||jvrvtd|��||jvr|n?t|�s�||vr�td|||f��t
|t�r�|jtkr�|�|dt|j�|jdd��|_d|_|j}|j�|�|j�|�t��||�dS)Nrz@private variables, such as %r, will be normal attributes in 3.11r��
stacklevel)�_order_�_create_pseudo_member_�_generate_next_value_�	_missing_�_ignore_z(_names_ are reserved for future Enum userAz4_generate_next_value_ must be defined before members�_generate_next_valuerC�,� z-_ignore_ cannot specify already set names: %r�	__order__r?zAttempted to reuse key: %rz%r already defined as: %rrT)r%�	_cls_name�warnings�warn�DeprecationWarningr �
ValueErrorr9r&�setattr�
isinstance�str�replace�split�listr8�setr6rrr	r2r1rDrr7�appendr4�__setitem__)r(�keyr2rI�alreadyr;rrrUYsl��
����



�z_EnumDict.__setitem__)r/r,r0r5rU�
__classcell__rrr;rr3Ksr3cs�eZdZ	edd��Z�fdd�Zdd�Zd,ddddd	�d
d�Zdd
�Z�fdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zdd�Zdd�Z�fd d!�Zddddd	�d"d#�Zd,d$d%�Zed&d'��Zed(d)��Zed*d+��Z�ZS)-rcKsD|�||�t�}||_|�||�\}}|dur t|dd�|d<|S)NrA)�_check_for_existing_membersr3rH�_get_mixins_�getattr)�metaclsr-�bases�kwds�	enum_dict�member_type�
first_enumrrr�__prepare__�s�zEnumMeta.__prepare__c	s���dg��d��d}|D]}��|d�q|�||�\�}|���|�\}}	}
�fdd��jD�}�jD]}�|=q7��dd�}
t|�ddh@}|rWtd�d�	|����d	�vr_d
�d	<t
�j|||�fi|��}g|_i|_
�|_dd�|��D�}i|_d
�vrՈtur�d}t�fdd�|D��s�d�vr�t|�n6d}|D]+}|jD]��tur�q�t�fdd�|D��r�d}n
d�jvr�d}nq�|dur�nq�|r�t|��jD]�}||}t|t�s�|f}n|}�tur�|f}|
s�||�}t|d�s�||_n||g|�R�}t|d��s�tu�r||_n�|�|_|j}||_||_|j|�|j
��D]\}}|j|jk�r=|}n�q.|j�|�||v�rPt|||�||j
|<z||j|<Wq�t�yfYq�wdD]+}|�v�rr�qit ||�}t �|d�}t ||d�}|du�r�||u�r�t|||��qit!du�r�|	�r�||_"t!j|_|
du�r�t|
t#��r�|
�$dd��%�}
|
|jk�r�td��|S)NrCcsi|]}|�|�qSrr)�.0�k)�	classdictrr�
<dictcomp>�sz$EnumMeta.__new__.<locals>.<dictcomp>r?�mro�zInvalid enum member name: {0}rE�__doc__zAn enumeration.cSs.h|]}|j��D]\}}t|t�r	|�q	qSr)�__dict__�itemsrNr)rc�crd�vrrr�	<setcomp>�s���z#EnumMeta.__new__.<locals>.<setcomp>r+)�__getnewargs_ex__�__getnewargs__r+�
__reduce__c3��|]}|�jvVqdS�N�rj�rc�m)r`rr�	<genexpr>���z#EnumMeta.__new__.<locals>.<genexpr>�__new__c3rrrsrtru)�baserrrwrxFT�_value_)�__repr__�__str__�
__format__r+rFz#member order does not match _order_)&�
setdefaultrT�poprZ�
_find_new_r6rSrL�format�joinr4ry�_member_names_�_member_map_�
_member_type_rg�_value2member_map_�object�anyr.�__mro__rjrN�tuplerr{�_name_�__objclass__r5rkrMr&r[r�__new_member__rOrPrQ)r\r-r]rer^�ignorerVrary�save_new�use_args�enum_membersrr?�
invalid_names�
enum_class�dynamic_attributes�methods�sabotage�chain�member_namer2�args�enum_member�canonical_member�class_method�
obj_method�enum_methodr;)rzrer`rry�s�
�
��


��


�


�

�

�

zEnumMeta.__new__cCs	dS)NTrr:rrr�__bool__aszEnumMeta.__bool__Nr��module�qualname�type�startcCs,	|dur|�||�S|j||||||d�S)Nr�)ry�_create_)r-r2�namesr�r�r�r�rrr�__call__gs�zEnumMeta.__call__cCsRt|t�sddl}|jdtdd�tdt|�j|jjf��t||�o(|j	|j
vS)Nrzpin 3.12 __contains__ will no longer raise TypeError, but will return True if
obj is a member or a member's valuerr=�3unsupported operand type(s) for 'in': '%s' and '%s')rNrrIrJrKr&r�r0r<r�r�)r-rrIrrr�__contains__�s
���zEnumMeta.__contains__cs(||jvrtd|j��t��|�dS)Nz%s: cannot delete Enum member.)r��AttributeErrorr/r4�__delattr__)r-�attrr;rrr��s
zEnumMeta.__delattr__cCsgd�|jS)N)r<ri�__members__r,�r�r:rrr�__dir__�s��zEnumMeta.__dir__cCs8	t|�r	t|��z|j|WStyt|�d�wrs)rr�r��KeyError�r-rrrr�__getattr__�s
�zEnumMeta.__getattr__cCs
|j|Srs�r�r�rrr�__getitem__��
zEnumMeta.__getitem__cs	�fdd��jD�S)Nc3��|]}�j|VqdSrsr��rcr�r-rrrw�rxz$EnumMeta.__iter__.<locals>.<genexpr>r�r�rr�r�__iter__�szEnumMeta.__iter__cC�
t|j�Srs)rr�r�rrr�__len__�r�zEnumMeta.__len__cCs	t|j�Srs)rr�r�rrrr��s
zEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r/r�rrrr|�r�zEnumMeta.__repr__cs	�fdd�t�j�D�S)Nc3r�rsr�r�r�rrrw�rxz(EnumMeta.__reversed__.<locals>.<genexpr>)�reversedr�r�rr�r�__reversed__�szEnumMeta.__reversed__cs2	|j�di�}||vrtd��t��||�dS)Nr�zCannot reassign members.)rj�getr�r4�__setattr__)r-rr2�
member_mapr;rrr��s
zEnumMeta.__setattr__c
Csh	|j}|dur|fn||f}|�||�\}	}
|�||�}t|t�r*|�dd���}t|ttf�rb|rbt|dt�rb|g}}g}
t	|�D]\}}|
�
||||
dd��}|
�|�|�||f�qE|D]}t|t�rs|||}}n|\}}|||<qd|�||||�}|dur�z
t
�d�jd}Wntttfy�Ynw|dur�t|�n||_|dur�||_|S)NrErFrrr/)r<rZrbrNrOrPrQr�rR�	enumeraterArTry�sys�	_getframe�	f_globalsr�rLr�r.r,r0)r-�
class_namer�r�r�r�r�r\r]rrare�original_names�last_values�countrr2�itemr��member_valuer�rrrr��s@
 



�
zEnumMeta._create_cs�	ttj|�}|rt|�}n|}�fdd�|��D�}z
|jdd�d�Wnty7|jdd�d�Ynw||||d�}t|_|�|j	�|||<|S)Ncs g|]\}}�|�r||f�qSrr)rcrr2��filterrr�
<listcomp>)s��z&EnumMeta._convert_.<locals>.<listcomp>cSs|d|dfS)Nrrr��trrr�<lambda>/sz$EnumMeta._convert_.<locals>.<lambda>)rVcSs|dS�Nrrr�rrrr�2s)r�)
�varsr��modulesrk�sortr&�_reduce_ex_by_namer+�updater�)r-rr�r��source�module_globals�membersrr�r�	_convert_s$

��zEnumMeta._convert_cCs<|D]}|jD]}t|t�r|jrtd||jf��qqdS)Nz %s: cannot extend enumeration %r)r��
issubclassrr�r&r/)r�r]r�rzrrrrY9s
�����z$EnumMeta._check_for_existing_memberscsV	|sttfS�fdd�}|d}t|t�std��||�pt}|jr'td��||fS)Ncs�t�}|D]:}d}|jD]2}|turqt|t�r&|jtur%|�|j�nqd|jvr:t|t�r1q|�|p6|�n|p=|}qqt|�dkrNt	d�|f��|rT|�
�SdS)Nryrz%r: too many data types: %r)rSr�r�r�rr��addrjrr&r�)r]�
data_typesr��	candidaterz�r�rr�_find_data_typeNs.


�


�z.EnumMeta._get_mixins_.<locals>._find_data_typerzZnew enumerations should be created as `EnumName([mixin_type, ...] [data_type,] enum_type)`zCannot extend enumerations)r�rr�r&r�)r�r]r�rar`rr�rrZCs
zEnumMeta._get_mixins_c	Cs�	|�dd�}|du}|dur9dD]$}||fD]}t||d�}|ddjtjtjhvr.|}nq|dur5nqtj}|tjurAd}nd}|||fS)Nry)r�ryFT)r�r[ryr�r)	rer`raryr��method�possible�targetr�rrrr�rs0
���

zEnumMeta._find_new_rs)r/r,r0�classmethodrbryr�r�r�r�r�r�r�r�r��propertyr�r|r�r�r�r��staticmethodrYrZr�rXrrr;rr�s8
.%
	
5!
	
.rc@sreZdZ	dd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Ze
dd��Ze
dd��ZdS)rc
Cst|�|ur|Sz|j|WStyYnty2|j��D]
}|j|kr/|YSq"Ynwz	d}|�|�}WntyR}z
|}d}WYd}~nd}~wwz6t	||�r`|Wd}d}St
d||jf�}|durs|durs|�|dur�td|j|f�}t	|t
�s�||_
|�d}d}w)N�%r is not a valid %szDerror in %s._missing_: returned %r instead of None or a valid member)r�r�r�r&r��valuesr{rB�	ExceptionrNrLr0r/�__context__)r-r2�member�exc�result�e�ve_excrrrry�sP
�����
���
zEnum.__new__c	Cs4	t|�D]}z|dWStyYqw|S�Nr)r�r&)rr�r�r��
last_valuerrrrA�s�zEnum._generate_next_value_cCsdSrsr)r-r2rrrrB�szEnum._missing_cCsd|jj|j|jfS)N�<%s.%s: %r>)r<r/r�r{r:rrrr|�s�z
Enum.__repr__cCsd|jj|jfS)N�%s.%s)r<r/r�r:rrrr}�szEnum.__str__cs6	�fdd��j��D�dd��jD�}gd�|S)Ncs2g|]}|jD]}|ddkr|�jvr|�qqS�rr)rjr�)rcr-rvr:rrr��s��z Enum.__dir__.<locals>.<listcomp>cSsg|]
}|ddkr|�qSr�rrurrrr���)r<rir,)r<rgrj)r(�added_behaviorrr:rr��s
��zEnum.__dir__cCsL	t|�jtjtjfv}|jtus|rt}t|�}n|j}|j}|�||�Srs)	r�r}rrr�r�rOr{r~)r(�format_spec�str_overriddenr-�valrrrr~�s
zEnum.__format__cCr�rs)�hashr�r:rrr�__hash__r�z
Enum.__hash__cCs|j|jffSrs�r<r{r'rrrr+szEnum.__reduce_ex__cC�	|jSrs)r�r:rrrr�z	Enum.namecCr�rs�r{r:rrrr2!r�z
Enum.valueN)r/r,r0ryrAr�rBr|r}r�r~r�r+rrr2rrrrr�s .


r)�	metaclassc@seZdZdS)rN)r/r,r0rrrrr'srcC�|jSrsrr'rrrr�+sr�c@sneZdZ	dd�Zedd��Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)rc	CsZ	|s|dur	|SdSt|�D]}zt|�}Wnty&td|�d�wd|dS)NrzInvalid Flag value: %rr)r��	_high_bitr�r&)rr�r�r�r��high_bitrrrrA3s�zFlag._generate_next_value_cCs0	|}|dkr
|}|�|�}|dkr|}|Sr�)r@)r-r2�original_value�possible_memberrrrrBFs
zFlag._missing_cCsd	|j�|d�}|dur0t||�\}}|rtd||jf��t�|�}d|_||_|j�	||�}|S�Nr�)
r�r��
_decomposerLr0r�ryr�r{r)r-r2�
pseudo_memberr�extra_flagsrrrr@Ss
zFlag._create_pseudo_member_cCs:	t||j�stdt|�j|jjf��|j|j@|jkS)Nr�)rNr<r&r�r0r{�r(�otherrrrr�gs��zFlag.__contains__cCsV|j}|jdurd|j|j|jfSt||j�\}}d|jd�dd�|D��|jfS)Nr��|cS�g|]
}t|jp
|j��qSr�rOr�r{rurrrr�xr�z!Flag.__repr__.<locals>.<listcomp>)r<r�r/r{rr��r(r-r��	uncoveredrrrr|qs
�z
Flag.__repr__cCs||j}|jdurd|j|jfSt||j�\}}t|�dkr/|djdur/d|j|djfSd|jd�dd�|D��fS)Nr�rrz%s.%rr
cSrrrrurrrr��r�z Flag.__str__.<locals>.<listcomp>)r<r�r/rr{rr�rrrrr}|s
�zFlag.__str__cCr�rs)�boolr{r:rrrr��r�z
Flag.__bool__cCs"t||j�stS|�|j|jB�Srs�rNr<�NotImplementedr{rrrr�__or__��zFlag.__or__cCs"t||j�stS|�|j|j@�Srsrrrrr�__and__�rzFlag.__and__cCs"t||j�stS|�|j|jA�Srsrrrrr�__xor__�rzFlag.__xor__cCsNt|j|j�\}}|�d�}|jD]}||vr!|j|j@s!||B}q|�|�Sr�)rr<r{)r(r�r�invertedrvrrr�
__invert__�s

�
zFlag.__invert__N)r/r,r0rAr�rBr@r�r|r}r�rrrrrrrrr.s



rc@sReZdZ	edd��Zedd��Zdd�Zdd�Zd	d
�ZeZ	eZ
eZdd�Zd
S)rcCs,	t|t�std||jf��|�|�}|Sr)rN�intrLr0r@)r-r2�
new_memberrrrrB�s


zIntFlag._missing_cCs�	|j�|d�}|durV|g}t||�\}}|r<t|�}d|}||jvr.||vr.|�|�||kr6d}n||N}|st|�D]}t�||�}d|_||_	|j�
||�}q@|S)Nrr)r�r�rrrTr�rryr�r{r)r-r2r	�need_to_createrr
�bit�
flag_valuerrrr@�s*


�zIntFlag._create_pseudo_member_cCs0t||jtf�s
tS|�|j|�|�jB�}|Srs�rNr<rrr{)r(rr�rrrr�szIntFlag.__or__cCs,t||jtf�s
tS|�|j|�|�j@�Srsr rrrrr��zIntFlag.__and__cCs,t||jtf�s
tS|�|j|�|�jA�Srsr rrrrr�r!zIntFlag.__xor__cCs|�|j�}|Srsr�)r(r�rrrr�szIntFlag.__invert__N)
r/r,r0r�rBr@rrr�__ror__�__rand__�__rxor__rrrrrr�s
	
 rcCs	|��dSr�)�
bit_length)r2rrrr�srcCs`	g}|j��D]\}}||jkr|�||jf�q|r.d�dd�|D��}td||f��|S)Nz, cSsg|]
\}}d||f�qS)z%s -> %sr)rc�aliasrrrrr��r�zunique.<locals>.<listcomp>z duplicate values found in %r: %s)r�rkrrTr�rL)�enumeration�
duplicatesrr��
alias_detailsrrrr
�s
���r
c	Cs�	|}|dk}g}|D]}|j}|r"||@|kr"|�|�||M}q|sH|}|rHdt|�}||jvrA|�|j|�||M}||M}|s)|sW||jvrW|�|j|�|jdd�dd�t|�dkrr|dj|krr|�d�||fS)NrrcSrrsr)rvrrrr�sz_decompose.<locals>.<lambda>T)rV�reverser)r2rTrr�r�rr�)	�flagr2�not_covered�negativer�r�r��tmprrrrrs2

�


�
r)r��typesrr�__all__rrr r%r.r�r1r	�dictr3rr�rrrr�rrrr
rrrrr�<module>s4
	TvI

?>