%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/2318/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/2318/lib/python3.8/__pycache__/enum.cpython-38.pyc

U

k�]e���@s�ddlZddlmZmZddddddd	gZd
d�Zdd
�Zdd�Zdd�Ze	�Z
Gdd�d�ZGdd�de�Z
dZGdd�de�ZGdd�ded�ZGdd�dee�Zdd�ZGdd�de�ZGdd�dee�Zdd�Zdd	�Zd d!�Zd"d#�ZdS)$�N)�MappingProxyType�DynamicClassAttribute�EnumMeta�Enum�IntEnum�Flag�IntFlag�auto�uniquecCst|d�pt|d�pt|d�S)z?
    Returns True if obj is a descriptor, False otherwise.
    �__get__�__set__�
__delete__)�hasattr)�obj�r�/usr/lib/python3.8/enum.py�_is_descriptors

��rcCsLt|�dkoJ|dd�|dd�ko.dknoJ|ddkoJ|ddkS)z=
    Returns True if a __dunder__ name, False otherwise.
    �N�����__�_�����len��namerrr�
_is_dunders&�
�
�rcCsLt|�dkoJ|d|dko&dknoJ|dd�dkoJ|dd�dkS)z;
    Returns True if a _sunder_ name, False otherwise.
    rr���r�rrrrrr�
_is_sunder!s���r cCsdd�}||_d|_dS)z,
    Make the given class un-picklable.
    cSstd|��dS)Nz%r cannot be pickled)�	TypeError��self�protorrr�_break_on_call_reduce0sz6_make_class_unpicklable.<locals>._break_on_call_reducez	<unknown>N)�
__reduce_ex__�
__module__)�clsr%rrr�_make_class_unpicklable,sr)c@seZdZdZeZdS)r	zP
    Instances are replaced with an appropriate value in Enum class suites.
    N)�__name__r'�__qualname__�__doc__�
_auto_null�valuerrrrr	6scs,eZdZdZ�fdd�Z�fdd�Z�ZS)�	_EnumDictz�
    Track enum member order and ensure member names are not reused.

    EnumMeta will use the names found in self._member_names as the
    enumeration member names.
    cs&t���g|_g|_g|_d|_dS)NF)�super�__init__�
_member_names�_last_values�_ignore�_auto_called�r#��	__class__rrr1Ds

z_EnumDict.__init__csdt|�r�|dkrtd��|dkr<|jr.td��t|d|�nV|dkr�t|t�r`|�dd���}nt	|�}||_
t|�t|j�@}|r�td	|f��n�t
|�r�|d
kr�d}n�||jkr�td|��n�||j
kr�n�t|��sR||kr�td
|||f��t|t��r:|jtk�r4|�|dt|j�|jdd��|_d|_|j}|j�|�|j�|�t��||�dS)z�
        Changes anything not dundered or not a descriptor.

        If an enum member name is used twice, an error is raised; duplicate
        values are not checked for.

        Single underscore (sunder) names are reserved.
        )�_order_�_create_pseudo_member_�_generate_next_value_�	_missing_�_ignore_z(_names_ are reserved for future Enum user;z4_generate_next_value_ must be defined before members�_generate_next_valuer=�,� z-_ignore_ cannot specify already set names: %r�	__order__r9zAttempted to reuse key: %rz%r already defined as: %rrNT)r �
ValueErrorr5r!�setattr�
isinstance�str�replace�split�listr4�setr2rrr	r.r-r>rr3�appendr0�__setitem__)r#�keyr.�alreadyr7rrrKKsT	
��


�z_EnumDict.__setitem__)r*r'r+r,r1rK�
__classcell__rrr7rr/=sr/cs�eZdZdZedd��Z�fdd�Zdd�Zd/dddd	d
�dd�Zd
d�Z	�fdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��Zdd�Zdd �Z�fd!d"�Zdddd	d
�d#d$�Zd0d%d&�Zd'd(�Zed)d*��Zed+d,��Zed-d.��Z�ZS)1rz
    Metaclass for Enum
    cCs>|�||�t�}|�||�\}}|dk	r:t|dd�|d<|S)Nr;)�_check_for_existing_membersr/�_get_mixins_�getattr)�metaclsr(�bases�	enum_dict�member_type�
first_enumrrr�__prepare__�s�zEnumMeta.__prepare__c	s��dg��d��d}|D]}��|d�q|�||�\�}|���|�\}}}	�fdd��jD�}
�jD]
}�|=qn��dd�}t|
�ddh@}
|
r�td�d�	|
����d	�kr�d
�d	<t
��|||��}g|_i|_
�|_dd�|��D�}i|_d
�k�r2�tk	�r2d}t�fdd�|D���s2t|��jD�]*}|
|}t|t��sZ|f}n|}�tk�rn|f}|	�s�||�}t|d��s�||_n6||f|��}t|d��sƈtk�r�||_n
�|�|_|j}||_||_|j|�|j
��D]"\}}|j|jk�r�|}�q�q�|j�|�||k�r2t|||�||j
|<z||j|<Wntk
�r`YnX�q8dD]V}|�k�r|�qjt||�}t�|d�}t||d�}|dk	�rj||k�rjt|||��qjtdk	�r�|�r�||_ tj|_|dk	�rt|t!��r|�"dd��#�}||jk�rtd��|S)Nr=csi|]}|�|�qSrr)�.0�k)�	classdictrr�
<dictcomp>�sz$EnumMeta.__new__.<locals>.<dictcomp>r9�mro�zInvalid enum member name: {0}r?r,zAn enumeration.cSs.h|]&}|j��D]\}}t|t�r|�qqSr)�__dict__�itemsrDr)rX�crY�vrrr�	<setcomp>�s

�z#EnumMeta.__new__.<locals>.<setcomp>r&)�__getnewargs_ex__�__getnewargs__r&�
__reduce__c3s|]}|�jkVqdS�N)r^�rX�m)rUrr�	<genexpr>�sz#EnumMeta.__new__.<locals>.<genexpr>�_value_)�__repr__�__str__�
__format__r&r@z#member order does not match _order_)$�
setdefaultrJ�poprP�
_find_new_r2rIrB�format�joinr0�__new__�_member_names_�_member_map_�
_member_type_r\�_value2member_map_�object�anyr)rD�tuplerrj�_name_�__objclass__r1r_rCr!rQr�__new_member__rErFrG)rRr(rSrZ�ignorerLrVrs�save_new�use_args�enum_membersrr9�
invalid_names�
enum_class�dynamic_attributes�methods�member_namer.�args�enum_member�canonical_member�class_method�
obj_method�enum_methodr7)rZrUrrs�s��

��













zEnumMeta.__new__cCsdS)z6
        classes/types should always be True.
        Trr6rrr�__bool__3szEnumMeta.__bool__Nr��module�qualname�type�startcCs*|dkr|�||�S|j||||||d�S)a!
        Either returns an existing member, or creates a new enum class.

        This method is used both when an enum class is given a value to match
        to an enumeration member (i.e. Color(3)) and for the functional API
        (i.e. Color = Enum('Color', names='RED GREEN BLUE')).

        When used for the functional API:

        `value` will be the name of the new class.

        `names` should be either a string of white-space/comma delimited names
        (values will start at `start`), or an iterator/mapping of name, value pairs.

        `module` should be set to the module this class is being created in;
        if it is not set, an attempt to find that module will be made, but if
        it fails the class will not be picklable.

        `qualname` should be set to the actual location this class can be found
        at in its module; by default it is set to the global scope.  If this is
        not correct, unpickling will fail in some circumstances.

        `type`, if set, will be mixed in as the first base class.
        Nr�)rs�_create_)r(r.�namesr�r�r�r�rrr�__call__9s�zEnumMeta.__call__cCs:t|t�s$tdt|�j|jjf��t||�o8|j|jkS)N�3unsupported operand type(s) for 'in': '%s' and '%s')rDrr!r�r+r8r{ru)r(�memberrrr�__contains__^s
��zEnumMeta.__contains__cs(||jkrtd|j��t��|�dS)Nz%s: cannot delete Enum member.)ru�AttributeErrorr*r0�__delattr__)r(�attrr7rrr�es
zEnumMeta.__delattr__cCsddddg|jS)Nr8r,�__members__r'�rtr6rrr�__dir__ls
��zEnumMeta.__dir__cCs@t|�rt|��z|j|WStk
r:t|�d�YnXdS)a=
        Return the enum member matching `name`

        We use __getattr__ instead of descriptors or inserting into the enum
        class' __dict__ in order to support `name` and `value` being both
        properties for enum members (which live in the class' __dict__) and
        enum members themselves.
        N)rr�ru�KeyError�r(rrrr�__getattr__rs	zEnumMeta.__getattr__cCs
|j|Srf�rur�rrr�__getitem__�szEnumMeta.__getitem__cs�fdd��jD�S)z6
        Returns members in definition order.
        c3s|]}�j|VqdSrfr��rXr�r(rrri�sz$EnumMeta.__iter__.<locals>.<genexpr>r�r�rr�r�__iter__�szEnumMeta.__iter__cCs
t|j�Srf)rrtr�rrr�__len__�szEnumMeta.__len__cCs
t|j�S)z�
        Returns a mapping of member name->value.

        This mapping lists all enum members, including aliases. Note that this
        is a read-only view of the internal mapping.
        )rrur�rrrr��szEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r*r�rrrrk�szEnumMeta.__repr__cs�fdd�t�j�D�S)z>
        Returns members in reverse definition order.
        c3s|]}�j|VqdSrfr�r�r�rrri�sz(EnumMeta.__reversed__.<locals>.<genexpr>)�reversedrtr�rr�r�__reversed__�szEnumMeta.__reversed__cs0|j�di�}||krtd��t��||�dS)a
        Block attempts to reassign Enum members.

        A simple assignment to the class namespace only changes one of the
        several possible ways to get an Enum member from the Enum class,
        resulting in an inconsistent Enumeration.
        ruzCannot reassign members.N)r^�getr�r0�__setattr__)r(rr.�
member_mapr7rrr��szEnumMeta.__setattr__c
Cs~|j}|dkr|fn||f}|�||�\}	}
|�||�}t|t�rR|�dd���}t|ttf�r�|r�t|dt�r�|g}}g}
t	|�D]8\}}|
�
||||
dd��}|
�|�|�||f�q�|D].}t|t�r�|||}}n|\}}|||<q�|�||||�}|dk�rPzt
�d�jd}Wn*tttfk
�rN}zW5d}~XYnX|dk�rdt|�n||_|dk	�rz||_|S)a�
        Convenience method to create a new Enum class.

        `names` can be:

        * A string containing member names, separated either with spaces or
          commas.  Values are incremented by 1 from `start`.
        * An iterable of member names.  Values are incremented by 1 from `start`.
        * An iterable of (member name, value) pairs.
        * A mapping of member name -> value pairs.
        Nr?r@rrr*)r8rPrWrDrErFrGrzrH�	enumerater;rJrs�sys�	_getframe�	f_globalsr�rBr�r)r'r+)r(�
class_namer�r�r�r�r�rRrSrrVrZ�original_names�last_values�countrr.�itemr��member_valuer��excrrrr��s<
 







zEnumMeta._create_cs�ttj|�}|rt|�}n|}�fdd�|��D�}z|jdd�d�Wn$tk
rn|jdd�d�YnX||||d�}t|_|�|j	�|||<|S)z[
        Create a new Enum subclass that replaces a collection of global constants
        cs g|]\}}�|�r||f�qSrr)rXrr.��filterrr�
<listcomp>�s�z&EnumMeta._convert_.<locals>.<listcomp>cSs|d|dfS)Nrrr��trrr�<lambda>��z$EnumMeta._convert_.<locals>.<lambda>)rLcSs|dS�Nrrr�rrrr��r�)r�)
�varsr��modulesr_�sortr!�_reduce_ex_by_namer&�updater�)r(rr�r��source�module_globals�membersrr�r�	_convert_�s 	

�zEnumMeta._convert_cOs$ddl}|jdtdd�|j||�S)NrzI_convert is deprecated and will be removed in 3.9, use _convert_ instead.r)�
stacklevel)�warnings�warn�DeprecationWarningr�)r(r��kwargsr�rrr�_converts�zEnumMeta._convertcCs<|D]2}|jD]&}t|t�r|jrtd||jf��qqdS)Nz %s: cannot extend enumeration %r)�__mro__�
issubclassrrtr!r*)r�rS�chain�baserrrrO
s
��z$EnumMeta._check_for_existing_memberscsT|sttfS�fdd�}|d}t|t�s2td��||�p<t}|jrLtd��||fS)z�
        Returns the type for creating enum members, and the first inherited
        enum class.

        bases: the tuple of bases that was given to __new__
        cs�g}|D]t}d}|jD]d}|tkr&qqt|t�rL|jtk	rz|�|j�qqd|jkrvt|t�rbq|�|pl|�qq|}qqt|�dkr�td�|f��n|r�|dSdSdS)Nrsrz%r: too many data types: %rr)	r�rxr�rrvrJr^rr!)rS�
data_typesr��	candidater��r�rr�_find_data_types*




z.EnumMeta._get_mixins_.<locals>._find_data_typerzZnew enumerations should be created as `EnumName([mixin_type, ...] [data_type,] enum_type)`zCannot extend enumerations)rxrr�r!rt)r�rSr�rVrUrr�rrPs
zEnumMeta._get_mixins_c	Cs�|�dd�}|dk	}|dkrpdD]H}||fD].}t||d�}|ddjtjtjhkr,|}q\q,|dk	r qpq tj}|tjkr�d}nd}|||fS)a
        Returns the __new__ to be used for creating the enum members.

        classdict: the class dictionary given to __new__
        member_type: the data type whose __new__ will be used by default
        first_enum: enumeration to check for an overriding __new__
        rsN)r}rsFT)r�rQrsrxr)	rZrUrVrsr�method�possible�targetr�rrrrpCs*�
zEnumMeta._find_new_)N)N)r*r'r+r,�classmethodrWrsr�r�r�r�r�r�r�r�r��propertyr�rkr�r�r�r�r��staticmethodrOrPrprNrrr7rr�s8

%
	
5
!
	
.c@steZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
edd��Zedd��ZdS)rzV
    Generic enumeration.

    Derive from this class to define new enumerations.
    c
Cst|�|kr|Sz|j|WStk
r0Yn:tk
rh|j��D]}|j|krH|YSqHYnXzd}|�|�}Wn*tk
r�}z|}d}W5d}~XYnXzdt	||�r�|W�TSt
d||jf�}|dkr�|dkr�|�n|dk�rtd|j|f�}||_|�W5d}d}XdS)N�%r is not a valid %szDerror in %s._missing_: returned %r instead of None or a valid member)
r�rwr�r!ru�valuesrjr<�	ExceptionrDrBr*�__context__)r(r.r�r��result�e�ve_excrrrrsws@


��zEnum.__new__c	Cs6t|�D](}z|dWStk
r.YqXq|S)��
        Generate the next value when not given.

        name: the name of the member
        start: the initial start value or None
        count: the number of existing members
        last_value: the last value assigned or None
        rN)r�r!)rr�r�r��
last_valuerrrr;�s	zEnum._generate_next_value_cCsdSrfr)r(r.rrrr<�szEnum._missing_cCsd|jj|j|jfS)N�<%s.%s: %r>)r8r*r{rjr6rrrrk�s
�z
Enum.__repr__cCsd|jj|jfS)N�%s.%s)r8r*r{r6rrrrl�szEnum.__str__cs6�fdd��j��D�dd��jD�}dddg|S)z<
        Returns all members and all public methods
        cs2g|]*}|jD]}|ddkr|�jkr|�qqS�rr)r^ru)rXr(rhr6rrr��s
�z Enum.__dir__.<locals>.<listcomp>cSsg|]}|ddkr|�qSr�rrgrrrr��sr8r,r')r8r\r^)r#�added_behaviorrr6rr��s
��zEnum.__dir__cCsJt|�jtjtjfk}|jtks$|r2t}t|�}n|j}|j}|�||�S)z\
        Returns format using actual value type unless __str__ has been overridden.
        )	r�rlrrrvrxrErjrm)r#�format_spec�str_overriddenr(�valrrrrm�s	
zEnum.__format__cCs
t|j�Srf)�hashr{r6rrr�__hash__�sz
Enum.__hash__cCs|j|jffSrf�r8rjr"rrrr&�szEnum.__reduce_ex__cCs|jS)zThe name of the Enum member.)r{r6rrrr�sz	Enum.namecCs|jS)zThe value of the Enum member.�rjr6rrrr.�sz
Enum.valueN)r*r'r+r,rsr;r�r<rkrlr�rmr�r&rrr.rrrrrqs-


)�	metaclassc@seZdZdZdS)rz.Enum where members are also (and must be) intsN)r*r'r+r,rrrrr�scCs|jSrfrr"rrrr��sr�c@speZdZdZdd�Zedd��Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)rz
    Support for flags
    c	Csd|s|dk	r|SdSt|�D]:}zt|�}WqXWqtk
rTtd|�d�YqXqd|dS)r�NrzInvalid Flag value: %rr)r��	_high_bitr�r!)rr�r�r�r��high_bitrrrr;s	
zFlag._generate_next_value_cCs.|}|dkr|}|�|�}|dkr*|}|S)�V
        Returns member (possibly creating it) if one can be found for value.
        r)r:)r(r.�original_value�possible_memberrrrr<s
zFlag._missing_cCsb|j�|d�}|dkr^t||�\}}|r:td||jf��t�|�}d|_||_|j�	||�}|S)�L
        Create a composite member iff value contains only members.
        Nr�)
rwr��
_decomposerBr*rxrsr{rjrn)r(r.�
pseudo_memberr�extra_flagsrrrr:#s
zFlag._create_pseudo_member_cCs8t||j�s&tdt|�j|jjf��|j|j@|jkS)zP
        Returns True if self has at least the same flags set as other.
        r�)rDr8r!r�r+rj�r#�otherrrrr�7s��zFlag.__contains__cCsV|j}|jdk	r$d|j|j|jfSt||j�\}}d|jd�dd�|D��|jfS)Nr��|cSsg|]}t|jp|j��qSr�rEr{rjrgrrrr�Hsz!Flag.__repr__.<locals>.<listcomp>)r8r{r*rjr�rr�r#r(r��	uncoveredrrrrkAs
�z
Flag.__repr__cCs�|j}|jdk	r d|j|jfSt||j�\}}t|�dkr^|djdkr^d|j|djfSd|jd�dd�|D��fSdS)Nr�rrz%s.%rr�cSsg|]}t|jp|j��qSrr�rgrrrr�Vsz Flag.__str__.<locals>.<listcomp>)r8r{r*r�rjrrrr�rrrrlLs
�zFlag.__str__cCs
t|j�Srf)�boolrjr6rrrr�Ysz
Flag.__bool__cCs"t||j�stS|�|j|jB�Srf�rDr8�NotImplementedrjr�rrr�__or__\szFlag.__or__cCs"t||j�stS|�|j|j@�Srfrr�rrr�__and__aszFlag.__and__cCs"t||j�stS|�|j|jA�Srfrr�rrr�__xor__fszFlag.__xor__cCsNt|j|j�\}}|�d�}|jD] }||kr"|j|j@s"||B}q"|�|�Sr�)r�r8rj)r#r�r�invertedrhrrr�
__invert__ks


zFlag.__invert__N)r*r'r+r,r;r�r<r:r�rkrlr�rrrrrrrrr�s



c@sTeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	eZ
eZe	Zdd
�Z
dS)rz)
    Support for integer-based Flags
    cCs*t|t�std||jf��|�|�}|S)r�r�)rD�intrBr*r:)r(r.�
new_memberrrrr<ys

zIntFlag._missing_cCs�|j�|d�}|dkr�|g}t||�\}}|rtt|�}d|}||jkrZ||krZ|�|�||krjd}q*||N}q*t|�D]*}t�||�}d|_||_	|j�
||�}q||S)r�Nrr)rwr�r�r�rJr�r	rsr{rjrn)r(r.r��need_to_createrr��bit�
flag_valuerrrr:�s(
�


zIntFlag._create_pseudo_member_cCs0t||jtf�stS|�|j|�|�jB�}|Srf�rDr8r	rrj)r#r�r�rrrr�szIntFlag.__or__cCs,t||jtf�stS|�|j|�|�j@�Srfrr�rrrr�szIntFlag.__and__cCs,t||jtf�stS|�|j|�|�jA�Srfrr�rrrr�szIntFlag.__xor__cCs|�|j�}|Srfr�)r#r�rrrr�szIntFlag.__invert__N)r*r'r+r,r�r<r:rrr�__ror__�__rand__�__rxor__rrrrrrts
	
 cCs|��dS)zJ
    returns index of highest bit, or -1 if value is zero or negative
    r)�
bit_length�r.rrrr��sr�cCs^g}|j��D]"\}}||jkr|�||jf�q|rZd�dd�|D��}td||f��|S)zI
    Class decorator for enumerations ensuring unique member values.
    z, cSsg|]\}}d||f�qS)z%s -> %sr)rX�aliasrrrrr��szunique.<locals>.<listcomp>z duplicate values found in %r: %s)r�r_rrJrrrB)�enumeration�
duplicatesrr��
alias_detailsrrrr
�s
��cCs�|}|dk}|r*dd�t|j���D�}ndd�t|j���D�}g}|D],\}}|rJ||@|krJ|�|�||M}qJ|s�||jkr�|�|j|�|jdd�dd�t|�d	kr�|dj|kr�|�d�||fS)
z-
    Extract all members from the value.
    rcSs"g|]\}}|jdk	r||f�qSrfr�rXrarhrrrr��s
�z_decompose.<locals>.<listcomp>cSs*g|]"\}}|jdk	st|�r||f�qSrf)r�
_power_of_tworrrrr��s
�cSs|jSrfr�)rhrrrr��r�z_decompose.<locals>.<lambda>T)rL�reverser)rHrwr_rJr�rr.ro)�flagr.�not_covered�negative�flags_to_checkr�r�r�rrrr��s(��

r�cCs|dkrdS|dt|�kS)NrFr)r�rrrrr�sr)r��typesrr�__all__rrr r)rxr-r	�dictr/rr�rr	rr�rrr�r
r�rrrrr�<module>s>�
	LivI%

Zerion Mini Shell 1.0