MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/site-packages/mx/Misc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/site-packages/mx/Misc/OrderedMapping.pyc
mò
ö.Ë;c@sçdZdkZdkZdkZdklZdkZdfd„ƒYZdefd„ƒYZ	ee	ƒe
djoleƒZded	<d
ed<ded
<eƒZded
<ded<eddfddfddfƒZ
ndS(sú OrderedMapping - A compromise between a dictionary and a list.

    Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    See the documentation for further information on copyrights,
    or contact the author. All Rights Reserved.
N(sfreezetOrderedMappingcBs1tZdZed„Zd„Zd„Zd„Zd„Ze	i
d„Ze	i
d„Ze	i
d„Z
d	„Zd
„Zd„Zd„ZeZd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!ed„Z"d„Z#RS(sÎ OrderedMapping - A compromise between a dictionary and a list.

        The object stores the keys in a list and a the items (key,value)
        in a dictionary. Order in the dictionary is implied by the key
        list. New dictionary keys are appended to the key list and thus
        newer keys have higher order.

        Note that you can manipulate the ordering with several methods.
        Also, assignment, retrieval and deletion using the order integers
        is possible.

        The object differentiates between queries referring to order and
        ones referring to keys by checking the query index's
        type. Integers are interpreted as order index and all other types
        as keys.

    cCsZg|_h|_|dj	o7t|dƒo|iƒ}n|}|i|ƒndS(sæ Create an OrderedMapping object.

            presets may be given as list of tuples to initialize the
            object with (key,value) pairs. The objects are inserted in
            order given by in presets object.

        titemsN(tselftlisttdicttpresetstNonethasattrRtadditems(RRR((t:/usr/lib/python2.4/site-packages/mx/Misc/OrderedMapping.pyt__init__ s		
cCsw|i}|i}|i}|i}xL|D]D\}}||ƒot
dt|ƒ‚n||ƒ|||<q+WdS(sj Adds the (key, value) pairs in items to the object
            in the order they are specified.

        smore than one value for key %sN(RRtltappendRtdthas_keyRtkeytvaluet
ValueErrortrepr(RRR
RRRRR((R	R3s				

cCs`g}x?|iD]4}|i|}|it|ƒdt|ƒƒqWdti	|dƒdS(su Returns a string representation of the object comparable to
            to the dictionary built-in object.

        s: t{s, t}N(
RRRRRRRRtstringtjoin(RRRR((R	t__repr__Ds

%cCsMt|tƒo)t|i|if|i|ifƒSnt|i|ƒSdS(sû Compares the object against another OrderedMapping object
            or dictionary.

            Ordering of the contents is important when comparing
            OrderedMapping objects. It is not when comparing to
            dictionaries.

        N(t
isinstancetotherRtcmpRRR(RR((R	t__cmp__Ps	)cCs
t|iƒS(s. Returns the number of object stored.
        N(tlenRR(R((R	t__len___scCs8t|ƒ|jo|i|i|Sn|i|SdS(sã Returns the object at position keyindex.

            keyindex may either be an integer to index an object by
            position or an arbitrary key object which is then used for
            dictionary like lookup.

        N(ttypetkeyindextIntTypeRRR(RRR ((R	t__getitem__es
cCspt|ƒ|jo||i|i|<nB|ii|ƒo||i|<n||i|<|ii|ƒdS(sA Sets the position keyindex to value.

            keyindex may either be an integer to index an object by
            position or an arbitrary key object which is then used for
            dictionary like lookup.

            In the latter case, if no key is found, value is appended
            to the object.

        N(	RRR RRRRRR(RRRR ((R	t__setitem__xs

cCsVt|ƒ|jo%|i|}|i|=|i|=n|i|=|ii|ƒdS(sã Deletes the object at position keyindex.

            keyindex may either be an integer to index an object by
            position or an arbitrary key object which is then used for
            dictionary like lookup.

        N(RRR RRRRtremove(RRR R((R	t__delitem__”s



cCsItƒ}|i||!|_}x"|D]}|i||i|<q'W|S(s_ Return the slice [i:j] of the object as OrderedMapping
            instance.
        
        N(	RtomRRtitjtkeysRR(RR&R'R%R(R((R	t__getslice__©s	cCsŠt|tƒp
td‚n|i||!}x|D]}|i
|=q4W|i}||i||+x"|D]}|i
||i
|<qhWdS(st Set the slice [i:j] of the object to the contents of the
            OrderedMapping object other.
        
        s)assigned object must be an OrderedMappingN(RRRt	TypeErrorRRR&R'R(RRt	otherkeys(RR&R'RR(R+R((R	t__setslice__¶s
	cCs<|i||!}x|D]}|i|=qW|i||5dS(s8 Delete the slice [i:j] of the object.
        
        N(RRR&R'R(RR(RR&R'R(R((R	t__delslice__ÉscCst|tƒp
td‚ntƒ}|iiƒ|_x8|iD]-}|i
|ƒotdt|ƒ‚qBqBW|ii
|iƒ|i|i|_|S(s¡ Concatenate the contents of an OrderedMapping object other
            to self and return the result as new OrderedMapping object.
                    
        s&other object must be an OrderedMappings.result would have more than one value for key N(RRRR*R%RRtcopyRRRRRtupdate(RRR%R((R	t__add__Ôs
	
cCsd|\}}|ii|ƒotdt|ƒ‚n|ii	|ƒ||i|<t
|iƒdS(sÖ Append an item (key, value) to the object and return
            the position of the new value.

            The item is addressable under key and the position
            returned by the method.
        
        smore than one value for key iN(titemRRRRRRRRRR(RR1RR((R	Rès
cCs¦|\}}|ii|ƒotdt|ƒ‚nt|ƒt
ijo$|ii
||ƒ||i|<n3|ii|ƒ}|ii
||ƒ||i|<dS(sã Returns the object at position keyindex.

            keyindex may either be an integer to index an object by
            position or an arbitrary key object which is then used for
            dictionary like lookup.

        smore than one value for key N(R1RRRRRRRRRttypesR Rtinserttindex(RRR1R4RR((R	R3ùscCsVxOtt|iƒƒD]8\}}|i||jo|i|=|i|=qqWdS(s: Remove all occurrences of value from the object.
        N(treversetirangeRRR&RRR(RRRR&((R	R#s
cCs@d}x3|iD](}|i||jo|d}qqW|S(s9 Count all occurrences of value from the object.
        iiN(tcountRRRRR(RRR7R((R	R7s
cCsSx9t|iƒD](\}}|i||jo|SqqWtt|ƒd‚dS(s` Return the index of the first occurrences of value in the
            object.
        
        s not as value in OrderedMappingN(	R6RRR4RRRRR(RRR4R((R	R4"scCs|ii|ƒS(sã Returns the object at position keyindex.

            keyindex may either be an integer to index an object by
            position or an arbitrary key object which is then used for
            dictionary like lookup.

        N(RRR4R(RR((R	R-scCs|iiƒdS(s) Reverses the order of the keys.
        N(RRR5(R((R	R58scGst|ii|ƒdS(sS Sorts the keys.

            This changes the order of the stored items.

        N(tapplyRRtsorttargs(RR:((R	R9>scCsg|_|iiƒdS(s Clear the object.
        N(RRRtclear(R((R	R;Gs	cCsdk}|i|ƒS(s. Return a shallow copy of the object.
        N(R.R(RR.((R	R.Ns	cCs|i|S(s, Returns the key at position index.
        N(RRR4(RR4((R	RUscCs|iS(s\ Returns a list of keys in the order they are maintained
            by the object.
        N(RR(R((R	R([scCs(|i}t|i|ƒ}t||ƒS(sj Returns a list of (key,value) tuples in the order they are
            maintained by the object.
        N(RRR(textractRtvaluesttuples(RR(R=((R	Rbs	cCs|i}t|i|ƒ}|S(s^ Returns a list of values in the order they are maintained
            by the object.
        N(RRR(R<RR=(RR(R=((R	R=ks	cCs|ii|ƒS(sS Returns 1/0 depending on whether the given key exists
            or not.
        N(RRRR(RR((R	RtscCs|ii||ƒS(sx Return the value for key or default in case it is not found.

            This only works for non-index keys.

        N(RRtgetRtdefault(RRR@((R	R?~scCsd|i}g}|i}xE|iD]:}||}|||ƒ}|dj	o||ƒq"q"W|S(sA Filters the mapping's keys and values according to
            a filterfct.

            The filterfct is called with (k,v) for each key value pair
            in the current order. If its return value is non-None, it
            is appended to the result list.

            The list is returned to the caller.

        N(
RRRRRtktvt	filterfcttresultR(RRCRARRRDRBR((R	tfilter‡s		


($t__name__t
__module__t__doc__RR
RRRRR2R R!R"R$R)R,R-R0t__radd__RR3R#R7R4RR5R9R;R.RR(RR=RR?RE(((R	R
s>					
								
														
	tOrderedMappingWithDefaultcBs&tZdZdZeied„ZRS(s¦ OrderedMapping with default values.

        This version returns self._default in case a lookup fails.
        self._default is set to '' for this base class.

    tcCs€||ƒ|jo=y|i|}Wntj
o|iSq|X|i|Sn-y|i|SWnt	j
o|iSnXdS(s Returns the object at position keyindex.

            If not found, ._default is returned.

            keyindex may either be an integer to index an object by
            position or an arbitrary key object which is then used for
            dictionary like lookup.

        N(
RRR RRRt
IndexErrort_defaultRtKeyError(RRR RR((R	R!©s(RFRGRHRMR2R RR!(((R	RJŸst__main__tbtatcR
tBtAtCt1it2it3i(RHR2Rtoperatortmx.Toolstfreezetmx.Tools.NewBuiltinstmxRRJRFtotptr(
RRR^R[R_R`RYRJR]R2((R	t?s 
	ÿ“'

	


	



Anon7 - 2021