ó Û_e[c@sJdZddlZdddgZdddfZedejd ƒZyeWne k rkd „ZnXydd l m Z Wne k r™e Z nXyeWne k r»eZnXyeWne k rÝeZnXd efd „ƒYZd„Zd„Zd„Zd„Zdefd„ƒYZe Zdefd„ƒYZiZded„Z2dS(?sPython EnumerationsiÿÿÿÿNtEnumtIntEnumtuniqueiis%s.%sicCsx|D]}|rtSqWtS(N(tTruetFalse(titerabletelement((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pytanys (t OrderedDictt_RouteClassAttributeToGetattrcBs8eZdZdd„Zdd„Zd„Zd„ZRS(sjRoute attribute access on a class to __getattr__. This is a descriptor, used to define attributes that act differently when accessed through an instance and through a class. Instance access remains normal, but access to an attribute through a class will be routed to the class's __getattr__ method; this is done by raising AttributeError. cCs ||_dS(N(tfget(tselfR ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__init__/scCs%|dkrtƒ‚n|j|ƒS(N(tNonetAttributeErrorR (R tinstancet ownerclass((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__get__2s  cCstdƒ‚dS(Nscan't set attribute(R(R Rtvalue((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__set__7scCstdƒ‚dS(Nscan't delete attribute(R(R R((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt __delete__:sN(t__name__t __module__t__doc__R R RRR(((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR &s    cCs+t|dƒp*t|dƒp*t|dƒS(s5Returns True if obj is a descriptor, False otherwise.RRR(thasattr(tobj((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt_is_descriptor>scCsZ|d |dkodknoY|dd!dkoY|dd!dkoYt|ƒdkS(s3Returns True if a __dunder__ name, False otherwise.iiþÿÿÿt__it_iýÿÿÿi(tlen(tname((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt _is_dunderFs$cCsZ|d|dkodknoY|dd!dkoY|dd!dkoYt|ƒdkS(s1Returns True if a _sunder_ name, False otherwise.iiÿÿÿÿRiiiþÿÿÿ(R(R((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt _is_sunderNs$cCs"dd„}||_d|_dS(s"Make the given class un-picklable.cSstd|ƒ‚dS(Ns%r cannot be pickled(t TypeError(R tprotocol((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt_break_on_call_reduceXss N(R t __reduce_ex__R(tclsR#((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt_make_class_unpicklableVs  t _EnumDictcBs eZdZd„Zd„ZRS(s§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. cCs tt|ƒjƒg|_dS(N(tsuperR'R t _member_names(R ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR escCsëtdkr|dkrdS|dkr1d}nt|ƒr[|dkrÎtdƒ‚qÎnst|ƒrjnd||jkrŒtd|ƒ‚nBt|ƒsÎ||kr»td||ƒ‚n|jj|ƒntt |ƒj ||ƒdS( sChanges anything not dundered or not a descriptor. If a descriptor is added with the same name as an enum member, the name is removed from _member_names (this may leave a hole in the numerical sequence of values). If an enum member name is used twice, an error is raised; duplicate values are not checked for. Single underscore (sunder) names are reserved. Note: in 3.x __order__ is simply discarded as a not necessary piece leftover from 2.x g@t_order_t __order__Ns(_names_ are reserved for future Enum usesAttempted to reuse key: %rsKey already defined as: %r(s_order_R+( tpyverR t ValueErrorRR)R!RtappendR(R't __setitem__(R tkeyR((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR/is        (RRRR R/(((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR'^s tEnumMetacBseZdZed„ƒZd„Zd„Zddddd„Zd„Z d„Z d„Z e d „ƒZ d „Zd „Zd „Zd „Zd„ZeZd„Zd„Zddddd„Zed„ƒZedkróed„ƒZned„ƒZRS(sMetaclass for EnumcCstƒS(N(R'(tmetaclsR%tbases((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt __prepare__•scsÑtˆƒtkrKˆ}tƒ‰x'|jƒD]\}}|ˆ|©sR*g@R0cSs|dS(Ni((titem((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt²st,t tmrosInvalid enum member name(s): %ss, t_value_R$t__getnewargs_ex__t__getnewargs__t __reduce__c3s|]}|ˆjkVqdS(N(t__dict__(R5tm(t member_type(s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pys st__repr__t__str__t __format__gÍÌÌÌÌÌ@t__cmp__t__le__t__lt__t__gt__t__ge__t__eq__t__ne__t__hash__t__member_new__t__new__(R>s__getnewargs__s __reduce_ex__s __reduce__(s__repr__s__str__s __format__s __reduce_ex__(s__le__s__lt__s__gt__s__ge__s__eq__s__ne__s__hash__(.ttypetdictR'titemst _get_mixins_t _find_new_R)tgetR R,tsortedR!tkeystreplacetsplittsetR-tjoinRAR(R1RPt_member_names_Rt _member_map_t _member_type_t_value2member_map_t isinstancettupleRR=t_name_t __objclass__R RR.tsetattrRtobjectRR&Rtgetattrt issubclasstintR(R2R%R3R7t original_dictR6tvt first_enumRPtsave_newtuse_argstmembersRR*Rtaliasest invalid_namestbtatbase_attributest enum_classt member_nametargst enum_membertcanonical_membert unpicklabletmethodst class_methodt obj_methodt enum_methodtmethod((R7RCs//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRP™sÎ     8 ,  % /!                            # cCstS(s6 classes/types should always be True. (R(R%((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__bool__Dsic Cs>|dkr|j||ƒS|j||d|d|d|ƒS(s¯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: `module`, if set, will be stored in the new class' __module__ attribute; `type`, if set, will be mixed in as the first base class. Note: if `module` is not set this routine will attempt to discover the calling module by walking the frame stack; if this is unsuccessful the resulting class will not be pickleable. tmoduleRQtstartN(R RPt_create_(R%RtnamesRRQR‚((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__call__Js cCst||ƒo|j|jkS(N(RaRR^(R%tmember((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt __contains___scCs?||jkr%td|jƒ‚ntt|ƒj|ƒdS(Ns%s: cannot delete Enum member.(R^RRR(R1t __delattr__(R%tattr((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRˆbscCsddddg|jS(Nt __class__Rt __members__R(R](R ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__dir__jscCs |jjƒS(s­Returns a mapping of member name->value. This mapping lists all enum members, including aliases. Note that this is a copy of the internal mapping. (R^tcopy(R%((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR‹nscCsNt|ƒrt|ƒ‚ny|j|SWntk rIt|ƒ‚nXdS(s5Return 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(RRR^tKeyError(R%R((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt __getattr__xs  cCs |j|S(N(R^(R%R((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt __getitem__ˆscs‡fd†ˆjDƒS(Nc3s|]}ˆj|VqdS(N(R^(R5R(R%(s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pys Œs(R](R%((R%s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__iter__‹scs‡fd†tˆjƒDƒS(Nc3s|]}ˆj|VqdS(N(R^(R5R(R%(s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pys s(treversedR](R%((R%s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt __reversed__ŽscCs t|jƒS(N(RR](R%((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt__len__‘scCs d|jS(Ns (R(R%((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRD–scCsM|jjdiƒ}||kr0tdƒ‚ntt|ƒj||ƒdS(sù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. R^sCannot reassign members.N(RARVRR(R1t __setattr__(R%RRt member_map((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR•™s cCs$tdkrXt|tƒrXy|jdƒ}WqUtk rQtd|ƒ‚qUXqXn|j}|d kry|f}n ||f}|j||ƒ}g} t|t ƒrÇ|j ddƒj ƒ}nt|t t fƒr!t|dt ƒr!gt|ƒD]\} } | | |f^qü}nd } xT|D]L} t| t ƒrW| || } }n | \} }||| <| j| ƒq.Wt| t ƒs£dj| ƒ|d value. g@tasciis %r is not representable in ASCIIR:R;iR*iRN(R,RatunicodetencodetUnicodeEncodeErrorR!RŠR R4t basestringRYRZRbtlistt enumerateR.R\RPt_syst _getframet f_globalsRR-R&R(R%t class_nameR„RRQR‚R2R3R7R*titeR8Rvt member_valueRu((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRƒ¦sF      (2       cCs| stdkrttfSd}}xA|D]9}|tk r.t|tƒr.|jr.tdƒ‚q.q.Wt|tƒs‰tdƒ‚nt|dtƒs³|d}|d}nTxQ|djD]B}t|tƒrî|dkr|}qqÁ|dkrÁ|}qÁqÁW||fS(sžReturns the type for creating enum members, and the first inherited enum class. bases: the tuple of bases that was given to __new__ sCannot extend enumerationssHnew enumerations must be created as `ClassName([mixin_type,] enum_type)`iiÿÿÿÿN(RR RfRhR]R!t__mro__(R3RCRltbase((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRTãs(           g@c Cst|jddƒ}|r%dttfStddƒ}ttdƒ}tdkrX|}n tjd}xádD]Ð}x·||fD]©}y|j|} Wn)ttfk rÁt||dƒ} nX| d|||gkr|dkrý| |dtk r|x.|jjƒD]}|j|kr\|Sq\WnXtd||jfƒ‚dS(Ns%s is not a valid %s(RQRR`R!R^tvaluesR-R(R%RR†((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRP„s   RPcCsd|jj|j|jfS(Ns <%s.%s: %r>(RŠRRcR=(R ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRDšsRDcCsd|jj|jfS(Ns%s.%s(RŠRRc(R ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRE sREg@cCsbg|jjƒD];}|jD]+}|ddkr||jkr|^qq}dddg|S(NiRRŠRR(RŠR<RAR^(R R%RBtadded_behavior((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRŒ¦s  .RŒcCsF|jtkr$t}t|ƒ}n|j}|j}|j||ƒS(N(R_RftstrRRF(R t format_specR%tval((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRF±s   RFgÍÌÌÌÌÌ@cCsUt|ƒ|jkr/||kr(dSndSntStd|jj|jjfƒ‚(Niiÿÿÿÿs unorderable types: %s() and %s()(RQRŠtNotImplementedR!R(R tother((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRGÈs  RGcCs&td|jj|jjfƒ‚dS(Nsunorderable types: %s() <= %s()(R!RŠR(R R¶((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRHÔsRHcCs&td|jj|jjfƒ‚dS(Nsunorderable types: %s() < %s()(R!RŠR(R R¶((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRIÙsRIcCs&td|jj|jjfƒ‚dS(Nsunorderable types: %s() >= %s()(R!RŠR(R R¶((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRKÞsRKcCs&td|jj|jjfƒ‚dS(Nsunorderable types: %s() > %s()(R!RŠR(R R¶((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRJãsRJcCs#t|ƒ|jkr||kStS(N(RQRŠRµ(R R¶((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRLés RLcCs#t|ƒ|jkr||k StS(N(RQRŠRµ(R R¶((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRMðs RMcCs t|jƒS(N(thashRc(R ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRN÷sRNcCs|j|jffS(N(RŠR=(R tproto((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR$üsR$cCs|jS(N(Rc(R ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRsRcCs|jS(N(R=(R ((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyRsRcsŒttj|ƒ}|r(t|ƒ}n|}t‡fd†|jƒDƒƒ}|||d|ƒ}t|_|j|jƒ|||<|S(sS Create a new Enum subclass that replaces a collection of global constants c3s-|]#\}}ˆ|ƒr||fVqdS(N((R5RR(tfilter(s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pys #sR( tvarsRžtmodulesRRRSt_reduce_ex_by_nameR$tupdateR‹(R%RRR¹tsourcetmodule_globalsRo((R¹s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyt_converts "  RÀcBseZdZRS(s.Enum where members are also (and must be) ints(RRR(((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR2scCs|jS(N(R(R R¸((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR¼5scCs£g}xE|jjƒD]4\}}||jkr|j||jfƒqqW|rŸdjg|D]\}}d||f^qaƒ}td||fƒ‚n|S(sIClass decorator that ensures only unique members exist in an enumeration.s, s%s -> %ssduplicate names found in %r: %s(R‹RSRR.R\R-(t enumerationt duplicatesRR†taliastduplicate_names((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyR8s,(3RtsysRžt__all__tversiontfloatt version_infoR,Rt NameErrort collectionsRt ImportErrorR R›R²R˜RfR RRR R&RRR'RRQR1ttemp_enum_dictRPRDRERŒRFRGRHRIRKRJRLRMRNR$RRR­RÀRiRR¼R(((s//tmp/pip-install-KP2Jbq/enum34/enum/__init__.pyts´             2ÿï