MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //usr/local/ssl/lib/python2.4/Demo/metaclasses/Enum.pyc
mò
‚=5Dc@sldZdkZdfd„ƒYZdfd„ƒYZedfhƒZd„ZedjoeƒndS(	sCEnumeration metaclass.

XXX This is very much a work in progress.

Nt
EnumMetaClasscBs)tZdZd„Zd„Zd„ZRS(shMetaclass for enumeration.

    To define your own enumeration, do something like

    class Color(Enum):
        red = 1
        green = 2
        blue = 3

    Now, Color.red, Color.green and Color.blue behave totally
    different: they are enumerated values, not integers.

    Enumerations cannot be instantiated; however they can be
    subclassed.

    cCs•x+|D]#}|itj	o
td‚qqWtd„|ƒ}||_||_	h|_
x3|iƒD]%\}}t|||ƒ|i
|<qhWdS(sœConstructor -- create an enumeration.

        Called at the end of the class statement.  The arguments are
        the name of the new class, a tuple containing the base
        classes, and a dictionary containing everything that was
        entered in the class' namespace during execution of the class
        statement.  In the above example, it would be {'red': 1,
        'green': 2, 'blue': 3}.

        s*Enumeration base class must be enumerationcCs
|tj	S(N(txtEnum(R((t+/usr/lib/python2.4/Demo/metaclasses/Enum.pyt<lambda>)sN(tbasestbaset	__class__Rt	TypeErrortfiltertnametselft__name__t	__bases__t_EnumMetaClass__dicttdicttitemstkeytvaluetEnumInstance(RR
RRRRR((Rt__init__s
			
cCsŽ|djo|iiƒSny|i|SWnQtj
oEx@|iD]0}yt||ƒSWqHtj
o
qHqHXqHWnXt|‚dS(sÁReturn an enumeration value.

        For example, Color.red returns the value corresponding to red.

        XXX Perhaps the values should be created in the constructor?

        This looks in the class dictionary and if it is not found
        there asks the base classes.

        The special attribute __members__ returns the list of names
        defined in this class (it does not merge in the names defined
        in base classes).

        t__members__N(	R
RRtkeystKeyErrorR
RtgetattrtAttributeError(RR
R((Rt__getattr__0s

cCsµ|i}|io1|dtitd„|iƒdƒd}n|iocg}x:|ii	ƒD])\}}|id|t
|ƒfƒqdWd|ti|dƒf}n|S(Nt(cCs|iS(N(RR(R((RRPss, t)s%s: %ss%s: {%s}(RRtsR
tstringtjointmapRtlistRRRtappendtint(RR!RRR((Rt__repr__Ms	
	
! (Rt
__module__t__doc__RRR$(((RR	s		RcBs;tZdZd„Zd„Zd„Zd„Zd„ZRS(s
Class to represent an enumeration value.

    EnumInstance('Color', 'red', 12) prints as 'Color.red' and behaves
    like the integer 12 when compared, but doesn't support arithmetic.

    XXX Should it record the actual enumeration rather than just its
    name?

    cCs||_||_||_dS(N(t	classnameRt_EnumInstance__classnametenumnamet_EnumInstance__enumnameRt_EnumInstance__value(RR'R)R((RRes		cCs|iS(N(RR+(R((Rt__int__jscCsd|i|i|ifS(NsEnumInstance(%r, %r, %r)(RR(R*R+(R((RR$mscCsd|i|ifS(Ns%s.%s(RR(R*(R((Rt__str__rscCst|it|ƒƒS(N(tcmpRR+R#tother(RR/((Rt__cmp__us(RR%R&RR,R$R-R0(((RRZs					RcCsõdtfd„ƒY}|iGHt|ƒGH|i|ijGH|i|ijGH|idjGH|idjGHd|fd„ƒY}|iGH|iGH|i|ijGHdtfd„ƒY}d	||fd
„ƒY}|iGH|i	GH|GH|GH|GH|GHdS(NtColorcBstZdZdZdZRS(Niii(RR%tredtgreentblue(((RR1€siit
ExtendedColorcBs&tZdZdZdZdZdZRS(Niiiii(RR%twhitetorangetyellowtpurpletblack(((RR5s
t
OtherColorcBstZdZdZRS(Nii(RR%R6R4(((RR;™stMergedColorcBstZRS(N(RR%(((RR<s(
RR1R2tdirR4R5R7R;R<R6(R5R1R<R;((Rt_test~s&t__main__(R&RRRRR>R(RR>RRR((Rt?s	Q!	*