• File: enum.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/enum.cpython-37.opt-1.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 23.8 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Mj@s&ddlZddlmZmZyddlmZWn ek
rHddlmZYnXdddddd	d
gZddZ	d
dZ
ddZddZe
ZGdd	d	ZGdddeZdZGdddeZGdddedZGdddeeZddZGdddeZGdddeeZddZd d
Zd!d"Zd#d$ZdS)%N)MappingProxyTypeDynamicClassAttribute)OrderedDictEnumMetaEnumIntEnumFlagIntFlagautouniquecCst|dpt|dpt|dS)z5Returns True if obj is a descriptor, False otherwise.__get____set__
__delete__)hasattr)objr)/opt/alt/python37/lib64/python3.7/enum.py_is_descriptors

rcCsLt|dkoJ|dd|ddko.dknoJ|ddkoJ|ddkS)z3Returns True if a __dunder__ name, False otherwise.N___)len)namerrr
_is_dunders(rcCsLt|dkoJ|d|dko&dknoJ|dddkoJ|dddkS)z1Returns True if a _sunder_ name, False otherwise.rrrr)r)rrrr
_is_sunder"s rcCsdd}||_d|_dS)z"Make the given class un-picklable.cSstd|dS)Nz%r cannot be pickled)	TypeError)selfprotorrr_break_on_call_reduce,sz6_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_nullvaluerrrrr
2scs,eZdZdZfddZfddZZS)	_EnumDictzTrack 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&tg|_g|_g|_d|_dS)NF)super__init__
_member_names_last_values_ignore_auto_called)r!)	__class__rrr/@s

z_EnumDict.__init__csdt|r|dkrtd|dkr<|jr.tdt|d|nV|dkrt|tr`|dd}nt	|}||_
t|t|j@}|rtd	|fnt
|r|d
krd}n||jkrtd|n||j
krnt|sR||krtd
|||ft|tr:d|_|jtkr4||dt|j|jdd|_|j}|j||j|t||dS)zChanges 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 user7z4_generate_next_value_ must be defined before members_generate_next_valuer9, z-_ignore_ cannot specify already set names: %r	__order__r5zAttempted to reuse key: %rz%r already defined as: %rTrN)r
ValueErrorr3r setattr
isinstancestrreplacesplitlistr2setr0rrr
r,r+r:rr1appendr.__setitem__)r!keyr,already)r4rrrGGsD	



"z_EnumDict.__setitem__)r(r%r)r*r/rG
__classcell__rr)r4rr-9sr-cseZdZdZeddZfddZddZd)dddd	d
ddZd
dZ	fddZ
ddZddZddZ
ddZddZeddZddZdd Zfd!d"Zdddd	d
d#d$Zed%d&Zed'd(ZZS)*rzMetaclass for EnumcCs0t}||\}}|dk	r,t|dd|d<|S)Nr7)r-_get_mixins_getattr)metaclsr&bases	enum_dictmember_type
first_enumrrr__prepare__s
zEnumMeta.__prepare__c	s"dgdd}x|D]}|dq W||\}||\}}}	fddjD}
xjD]
}|=qrWdd}t|
ddh@}
|
rtdd	|
d	krd
d	<t
|||}g|_t
|_|_dd|D}i|_d
kr:tk	r:d}tfdd|Ds:t|x6jD]*}|
|}t|tsf|f}n|}tkrz|f}|	s||}t|ds||_n6||f|}t|ds҈tkr||_n
||_|j}||_||_|j|x8|jD]\}}|j|jkr|}PqW|j|||kr>t|||||j|<y||j|<Wntk
rlYnXqDWxPdD]H}t||}t|d}t||d}|dk	rz||krzt|||qzWt dk	r|r||_!t j|_|dk	rt|t"r
|#dd$}||jkrtd|S)Nr9csi|]}||qSrr).0k)	classdictrr
<dictcomp>sz$EnumMeta.__new__.<locals>.<dictcomp>r5mrozInvalid enum member name: {0}r;r*zAn enumeration.cSs.h|]&}|jD]\}}t|tr|qqSr)__dict__itemsr@r)rScrTvrrr	<setcomp>sz#EnumMeta.__new__.<locals>.<setcomp>r$)__getnewargs_ex____getnewargs__r$
__reduce__c3s|]}|jkVqdS)N)rY)rSm)rPrr	<genexpr>sz#EnumMeta.__new__.<locals>.<genexpr>_value_)__repr____str__
__format__r$r<z#member order does not match _order_)%
setdefaultrFpoprK
_find_new_r0rEr>formatjoinr.__new___member_names_r_member_map_
_member_type_rW_value2member_map_objectanyr'r@tuplerrc_name___objclass__r/rZr?r rLr__new_member__rArBrC)rMr&rNrUignorerHrQrlsave_newuse_argsenum_membersrr5
invalid_names
enum_classdynamic_attributesmethodsmember_namer,argsenum_membercanonical_memberclass_method
obj_methodenum_method)r4)rUrPrrls













zEnumMeta.__new__cCsdS)z6
        classes/types should always be True.
        Tr)r!rrr__bool__szEnumMeta.__bool__Nr)modulequalnametypestartcCs*|dkr|||S|j||||||dS)aEither 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.

        N)rrrr)rl_create_)r&r,namesrrrrrrr__call__!szEnumMeta.__call__cCs6t|ts ddl}|dtdt||o4|j|jkS)NrzHusing non-Enums in containment checks will raise TypeError in Python 3.8r)r@rwarningswarnDeprecationWarningrtrn)r&memberrrrr__contains__?s
zEnumMeta.__contains__cs(||jkrtd|jt|dS)Nz%s: cannot delete Enum member.)rnAttributeErrorr(r.__delattr__)r&attr)r4rrrHs
zEnumMeta.__delattr__cCsddddg|jS)Nr4r*__members__r%)rm)r!rrr__dir__Ps
zEnumMeta.__dir__cCs>t|rt|y
|j|Stk
r8t|dYnXdS)a5Return 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)rrrnKeyError)r&rrrr__getattr__Ts	
zEnumMeta.__getattr__cCs
|j|S)N)rn)r&rrrr__getitem__dszEnumMeta.__getitem__csfddjDS)Nc3s|]}j|VqdS)N)rn)rSr)r&rrrbhsz$EnumMeta.__iter__.<locals>.<genexpr>)rm)r&r)r&r__iter__gszEnumMeta.__iter__cCs
t|jS)N)rrm)r&rrr__len__jszEnumMeta.__len__cCs
t|jS)zReturns 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.

        )rrn)r&rrrrmszEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r()r&rrrrdwszEnumMeta.__repr__csfddtjDS)Nc3s|]}j|VqdS)N)rn)rSr)r&rrrb{sz(EnumMeta.__reversed__.<locals>.<genexpr>)reversedrm)r&r)r&r__reversed__zszEnumMeta.__reversed__cs0|jdi}||krtdt||dS)zBlock 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.

        rnzCannot reassign members.N)rYgetrr.__setattr__)r&rr,
member_map)r4rrr}szEnumMeta.__setattr__c
Cs|j}|dkr|fn||f}||\}	}
|||}t|trP|dd}t|ttfr|rt|dtr|g}}g}
xDt	|D]8\}}|

||||
dd}|
||||fqWx6|D].}t|tr|||}}n|\}}|||<qW|||||}|dkrVyt
djd}Wn*tttfk
rT}zWdd}~XYnX|dkrjt|n||_|dk	r||_|S)aConvenience 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()r4rKrRr@rArBrCrsrD	enumerater7rFrlsys	_getframe	f_globalsrr>rr'r%r))r&
class_namerrrrrrMrNrrQrUoriginal_nameslast_valuescountrr,itemrmember_valuer|excrrrrs<
 







zEnumMeta._create_cCsP|sttfSdd}|d}t|ts.td||p8t}|jrHtd||fS)zReturns the type for creating enum members, and the first inherited
        enum class.

        bases: the tuple of bases that was given to __new__

        cSsHxB|D]:}x4|jD]*}|tkr"qqd|jkrt|tr8q|SqWqWdS)Nrl)__mro__rqrY
issubclassr)rNchainbaserrr_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)rqrrr rm)rNrrQrPrrrrKs
zEnumMeta._get_mixins_c	Cs|dd}|dk	}|dkrtxVdD]H}x8||fD],}t||d}|ddjtjtjhkr0|}Pq0W|dk	r"Pq"Wtj}|tjkrd}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__

        rlN)rvrlFT)rrLrlrqr)	rUrPrQrlrxmethodpossibletargetryrrrris(


zEnumMeta._find_new_)N)r(r%r)r*classmethodrRrlrrrrrrrrrpropertyrrdrrrstaticmethodrKrirJrr)r4rrs(
	

5 c@seZdZdZddZddZeddZdd	Zd
dZ	dd
Z
ddZddZddZ
eddZeddZedddZdS)rzRGeneric enumeration.

    Derive from this class to define new enumerations.

    c
Cst||kr|Sy
|j|Stk
r.Yn6tk
rbx |jD]}|j|krH|SqHWYnXyd}||}Wn*tk
r}z|}d}Wdd}~XYnXt	||r|St
d||jf}|dkr|dkr|n|dkrtd|j|f}||_|dS)Nz%r is not a valid %szDerror in %s._missing_: returned %r instead of None or a valid member)
rrprr rnvaluesrcr8	Exceptionr@r>r(__context__)r&r,rrresulteve_excrrrrls6


zEnum.__new__c	Cs8x2t|D]"}y|dStk
r*Yq
Xq
W|SdS)Nr)rr )rrrr
last_valuerrrr7;s
zEnum._generate_next_value_cCstd||jfdS)Nz%r is not a valid %s)r>r()r&r,rrrr8DszEnum._missing_cCsd|jj|j|jfS)Nz<%s.%s: %r>)r4r(rtrc)r!rrrrdHsz
Enum.__repr__cCsd|jj|jfS)Nz%s.%s)r4r(rt)r!rrrreLszEnum.__str__cs&fddjD}dddg|S)Ncs2g|]*}|jD]}|ddkr|jkr|qqS)rr)rYrn)rSr&ra)r!rr
<listcomp>Qs
z Enum.__dir__.<locals>.<listcomp>r4r*r%)r4rW)r!added_behaviorr)r!rrOs
zEnum.__dir__cCs0|jtkrt}t|}n|j}|j}|||S)N)rorqrArcrf)r!format_specr&valrrrrfXs

zEnum.__format__cCs
t|jS)N)hashrt)r!rrr__hash__gsz
Enum.__hash__cCs|j|jffS)N)r4rc)r!r"rrrr$jszEnum.__reduce_ex__cCs|jS)zThe name of the Enum member.)rt)r!rrrrtsz	Enum.namecCs|jS)zThe value of the Enum member.)rc)r!rrrr,ysz
Enum.valueNcsttj|}rtn|fddD}y|jdddWn$tk
rp|jdddYnX||||d}t|_||j	|||<|S)z[
        Create a new Enum subclass that replaces a collection of global constants
        cs g|]}|r||fqSrr)rSr)filtersourcerrrsz!Enum._convert.<locals>.<listcomp>cSs|d|dfS)Nrrr)trrr<lambda>zEnum._convert.<locals>.<lambda>)rHcSs|dS)Nrr)rrrrrr)r)
varsrmoduleskeyssortr _reduce_ex_by_namer$updater)r&rrrrmodule_globalsmembersr)rrr_convert~s

z
Enum._convert)N)r(r%r)r*rlr7rr8rdrerrfrr$rrr,rrrrrr
s(		
)	metaclassc@seZdZdZdS)rz.Enum where members are also (and must be) intsN)r(r%r)r*rrrrrscCs|jS)N)r)r!r"rrrrsrc@speZdZdZddZeddZeddZdd	Zd
dZ	dd
Z
ddZddZddZ
ddZddZdS)rzSupport for flagsc	Csd|s|dk	r|SdSxBt|D]6}yt|}PWqtk
rRtd|dYqXqWd|dS)z
        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
        NrzInvalid Flag value: %rr)r	_high_bitrr )rrrrrhigh_bitrrrr7s	zFlag._generate_next_value_cCs.|}|dkr|}||}|dkr*|}|S)Nr)r6)r&r,original_valuepossible_memberrrrr8s
zFlag._missing_cCsb|j|d}|dkr^t||\}}|r:td||jft|}d|_||_|j	||}|S)zL
        Create a composite member iff value contains only members.
        Nz%r is not a valid %s)
rpr
_decomposer>r(rqrlrtrcrg)r&r,
pseudo_memberrextra_flagsrrrr6s
zFlag._create_pseudo_member_cCs8t||js&ddl}|dtddS|j|j@|jkS)NrzHusing non-Flags in containment checks will raise TypeError in Python 3.8rF)r@r4rrrrc)r!otherrrrrrszFlag.__contains__cCsV|j}|jdk	r$d|j|j|jfSt||j\}}d|jddd|D|jfS)Nz<%s.%s: %r>|cSsg|]}t|jp|jqSr)rArtrc)rSrarrrrsz!Flag.__repr__.<locals>.<listcomp>)r4rtr(rcrrk)r!r&r	uncoveredrrrrds
z
Flag.__repr__cCs|j}|jdk	r d|j|jfSt||j\}}t|dkr^|djdkr^d|j|djfSd|jddd|DfSdS)Nz%s.%srrz%s.%rrcSsg|]}t|jp|jqSr)rArtrc)rSrarrrrsz Flag.__str__.<locals>.<listcomp>)r4rtr(rrcrrk)r!r&rrrrrres
zFlag.__str__cCs
t|jS)N)boolrc)r!rrrrsz
Flag.__bool__cCs"t||jstS||j|jBS)N)r@r4NotImplementedrc)r!rrrr__or__szFlag.__or__cCs"t||jstS||j|j@S)N)r@r4rrc)r!rrrr__and__szFlag.__and__cCs"t||jstS||j|jAS)N)r@r4rrc)r!rrrr__xor__
szFlag.__xor__cCsRt|j|j\}}|d}x*|jD] }||kr$|j|j@s$||B}q$W||S)Nr)rr4rc)r!rrinvertedrarrr
__invert__s
zFlag.__invert__N)r(r%r)r*r7rr8r6rrdrerrrrrrrrrrs


c@sTeZdZdZeddZeddZddZdd	Zd
dZ	eZ
eZe	Zdd
Z
dS)r	zSupport for integer-based FlagscCs*t|tstd||jf||}|S)Nz%r is not a valid %s)r@intr>r(r6)r&r,
new_memberrrrr8s

zIntFlag._missing_cCs|j|d}|dkr|g}t||\}}xL|rvt|}d|}||jkr\||kr\||||krld}q,||N}q,Wx6t|D]*}t||}d|_||_	|j
||}qW|S)Nrr)rprrrrFrrrlrtrcrg)r&r,rneed_to_createrrbit
flag_valuerrrr6%s&


zIntFlag._create_pseudo_member_cCs0t||jtfstS||j||jB}|S)N)r@r4rrrc)r!rrrrrrCszIntFlag.__or__cCs,t||jtfstS||j||j@S)N)r@r4rrrc)r!rrrrrIszIntFlag.__and__cCs,t||jtfstS||j||jAS)N)r@r4rrrc)r!rrrrrNszIntFlag.__xor__cCs||j}|S)N)r4rc)r!rrrrrWszIntFlag.__invert__N)r(r%r)r*rr8r6rrr__ror____rand____rxor__rrrrrr	scCs|dS)z@returns index of highest bit, or -1 if value is zero or negativer)
bit_length)r,rrrr\srcCsbg}x0|jD]"\}}||jkr|||jfqW|r^ddd|D}td||f|S)z?Class decorator for enumerations ensuring unique member values.z, cSsg|]\}}d||fqS)z%s -> %sr)rSaliasrrrrrhszunique.<locals>.<listcomp>z duplicate values found in %r: %s)rrZrrFrkr>)enumeration
duplicatesrr
alias_detailsrrrr`s
cCs|}|dk}|r*ddt|jD}nddt|jD}g}x4|D],\}}|rL||@|krL||||M}qLW|s||jkr||j||jddddt|d	kr|dj|kr|d||fS)
z#Extract all members from the value.rcSs"g|]\}}|jdk	r||fqS)N)r)rSr\rarrrrxsz_decompose.<locals>.<listcomp>cSs*g|]"\}}|jdk	st|r||fqS)N)r
_power_of_two)rSr\rarrrrscSs|jS)N)rc)rarrrrrz_decompose.<locals>.<lambda>T)rHreverser)rDrprZrFrrr,rh)flagr,not_coverednegativeflags_to_checkrrrrrrrms$

rcCs|dkrdS|dt|kS)NrFr)r)r,rrrrsr)rtypesrr_collectionsrImportErrorcollections__all__rrrr'rqr+r
dictr-rrrrrrrr	rrrrrrrr<module>s<DqA
#