AlkantarClanX12

Your IP : 52.14.6.41


Current Path : /proc/thread-self/root/proc/self/root/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib64/python2.7/collections.pyc

�
zfc@s�dZdddddgZddlTddlZeej7Zdd	lmZmZdd
lmZm	Z
ddlmZ
ddlZddlZddlmZmZmZdd
lmZyddlmZWn!ek
r�ddlmZnXde fd��YZ!dZ"dZ#dZ$e%e%d�Z&de fd��YZ'e(dkr�ddl)m*Z*m+Z+e&dde,�Z-e-dddd�Z.e.e*e+e.��ks�t/�de&dd�fd��YZ-x/e-dd �e-d!d"d#�fD]Z.e.GHq�Wde&dd�fd$��YZ-e-d%d&�j0dd'�GHe&d(e-j1d)f�Z2e2jGHddl3Z3e&d*d+�Z4e4e3j5��GHndS(,sThis module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.

* namedtuple   factory function for creating tuple subclasses with named fields
* deque        list-like container with fast appends and pops on either end
* Counter      dict subclass for counting hashable objects
* OrderedDict  dict subclass that remembers the order entries were added
* defaultdict  dict subclass that calls a factory function to supply missing values

tCountertdequetdefaultdictt
namedtupletOrderedDicti����(t*N(RR(t
itemgetterteq(t	iskeyword(trepeattchaintstarmap(timap(t	get_identcBseZdZd�Zejd�Zejd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�ZejZeZe�Zed
�Zdd�Zed�Zid�Zd�Zd�Zedd��Zd�Zd�Z d�Z!d�Z"d�Z#RS(s)Dictionary that remembers insertion ordercOs�|std��n|d}|d}t|�dkrTtdt|���ny|jWn7tk
r�g|_}||dg|(i|_nX|j||�dS(s�Initialize an ordered dictionary.  The signature is the same as
        regular dictionaries, but keyword arguments are not recommended because
        their insertion order is arbitrary.

        s?descriptor '__init__' of 'OrderedDict' object needs an argumentiis$expected at most 1 arguments, got %dN(t	TypeErrortlent_OrderedDict__roottAttributeErrortNonet_OrderedDict__mapt_OrderedDict__update(targstkwdstselftroot((s#/usr/lib64/python2.7/collections.pyt__init__2s




cCsX||krH|j}|d}|||g|d<|d<|j|<n||||�S(s!od.__setitem__(i, y) <==> od[i]=yii(RR(Rtkeytvaluetdict_setitemRtlast((s#/usr/lib64/python2.7/collections.pyt__setitem__Gs
	
)cCs@|||�|jj|�\}}}||d<||d<dS(s od.__delitem__(y) <==> del od[y]iiN(Rtpop(RRtdict_delitemt	link_prevt	link_nextt_((s#/usr/lib64/python2.7/collections.pyt__delitem__Qs

ccs=|j}|d}x#||k	r8|dV|d}qWdS(sod.__iter__() <==> iter(od)iiN(R(RRtcurr((s#/usr/lib64/python2.7/collections.pyt__iter__Zs
	
	ccs=|j}|d}x#||k	r8|dV|d}qWdS(s#od.__reversed__() <==> reversed(od)iiN(R(RRR%((s#/usr/lib64/python2.7/collections.pyt__reversed__cs
	
	cCs7|j}||dg|(|jj�tj|�dS(s.od.clear() -> None.  Remove all items from od.N(RRRtcleartdict(RR((s#/usr/lib64/python2.7/collections.pyR(ls	
cCs
t|�S(sod.keys() -> list of keys in od(tlist(R((s#/usr/lib64/python2.7/collections.pytkeysuscCsg|D]}||^qS(s#od.values() -> list of values in od((RR((s#/usr/lib64/python2.7/collections.pytvaluesyscCs!g|D]}|||f^qS(s.od.items() -> list of (key, value) pairs in od((RR((s#/usr/lib64/python2.7/collections.pytitems}scCs
t|�S(s0od.iterkeys() -> an iterator over the keys in od(titer(R((s#/usr/lib64/python2.7/collections.pytiterkeys�sccsx|D]}||VqWdS(s2od.itervalues -> an iterator over the values in odN((Rtk((s#/usr/lib64/python2.7/collections.pyt
itervalues�s
ccs$x|D]}|||fVqWdS(s=od.iteritems -> an iterator over the (key, value) pairs in odN((RR0((s#/usr/lib64/python2.7/collections.pyt	iteritems�s
cCsC||kr!||}||=|S||jkr?t|��n|S(s�od.pop(k[,d]) -> v, remove specified key and return the corresponding
        value.  If key is not found, d is returned if given, otherwise KeyError
        is raised.

        (t_OrderedDict__markertKeyError(RRtdefaulttresult((s#/usr/lib64/python2.7/collections.pyR�s
cCs"||kr||S|||<|S(sDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od((RRR5((s#/usr/lib64/python2.7/collections.pyt
setdefault�s
cCsR|std��nt|r*t|�n	t|��}|j|�}||fS(s�od.popitem() -> (k, v), return and remove a (key, value) pair.
        Pairs are returned in LIFO order if last is true or FIFO order if false.

        sdictionary is empty(R4tnexttreversedR.R(RRRR((s#/usr/lib64/python2.7/collections.pytpopitem�s
$cCsst|�t�f}||kr%dSd||<z5|sId|jjfSd|jj|j�fSWd||=XdS(sod.__repr__() <==> repr(od)s...is%s()s%s(%r)N(tidt
_get_identt	__class__t__name__R-(Rt
_repr_runningtcall_key((s#/usr/lib64/python2.7/collections.pyt__repr__�s
cCs�g|D]}|||g^q}t|�j�}x'tt��D]}|j|d�qEW|rx|j|f|fS|j|ffS(s%Return state information for picklingN(tvarstcopyRRRR=(RR0R-t	inst_dict((s#/usr/lib64/python2.7/collections.pyt
__reduce__�s#cCs
|j|�S(s!od.copy() -> a shallow copy of od(R=(R((s#/usr/lib64/python2.7/collections.pyRC�scCs(|�}x|D]}|||<qW|S(sOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
        If not specified, the value defaults to None.

        ((tclstiterableRRR((s#/usr/lib64/python2.7/collections.pytfromkeys�s	
cCsGt|t�r7tj||�o6ttt||��Stj||�S(s�od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
        while comparison to a regular mapping is order-insensitive.

        (t
isinstanceRR)t__eq__tallt_imapt_eq(Rtother((s#/usr/lib64/python2.7/collections.pyRJ�s(cCs||kS(sod.__ne__(y) <==> od!=y((RRN((s#/usr/lib64/python2.7/collections.pyt__ne__�scCs
t|�S(s@od.viewkeys() -> a set-like object providing a view on od's keys(tKeysView(R((s#/usr/lib64/python2.7/collections.pytviewkeys�scCs
t|�S(s<od.viewvalues() -> an object providing a view on od's values(t
ValuesView(R((s#/usr/lib64/python2.7/collections.pyt
viewvalues�scCs
t|�S(sBod.viewitems() -> a set-like object providing a view on od's items(t	ItemsView(R((s#/usr/lib64/python2.7/collections.pyt	viewitems�sN($R>t
__module__t__doc__RR)RR$R&R'R(R+R,R-R/R1R2tMutableMappingtupdateRtobjectR3RRR7tTrueR:RARERCtclassmethodRHRJRORQRSRU(((s#/usr/lib64/python2.7/collections.pyR&s:	
															
	
	
					s�class {typename}(tuple):
    '{typename}({arg_list})'

    __slots__ = ()

    _fields = {field_names!r}

    def __new__(_cls, {arg_list}):
        'Create new instance of {typename}({arg_list})'
        return _tuple.__new__(_cls, ({arg_list}))

    @classmethod
    def _make(cls, iterable, new=tuple.__new__, len=len):
        'Make a new {typename} object from a sequence or iterable'
        result = new(cls, iterable)
        if len(result) != {num_fields:d}:
            raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result))
        return result

    def __repr__(self):
        'Return a nicely formatted representation string'
        return '{typename}({repr_fmt})' % self

    def _asdict(self):
        'Return a new OrderedDict which maps field names to their values'
        return OrderedDict(zip(self._fields, self))

    def _replace(_self, **kwds):
        'Return a new {typename} object replacing specified fields with new values'
        result = _self._make(map(kwds.pop, {field_names!r}, _self))
        if kwds:
            raise ValueError('Got unexpected field names: %r' % kwds.keys())
        return result

    def __getnewargs__(self):
        'Return self as a plain tuple.  Used by copy and pickle.'
        return tuple(self)

    __dict__ = _property(_asdict)

    def __getstate__(self):
        'Exclude the OrderedDict from pickling'
        pass

{field_defs}
s	{name}=%rsW    {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}')
cBs@e|e�r*|jdd�j�}nee|�}e|�}|r�e�}x�e|�D]\}}ed�|D��s�e	|�s�|s�|dj
�s�|jd�s�||kr�d|||<n|j|�qaWnx�|g|D]�}e
|�ekred��ned�|D��sEed	|��ne	|�rded
|��n|dj
�r�ed|��q�q�We�}xc|D][}|jd�r�|r�ed|��n||kr�ed
|��n|j|�q�Wejd|de|�de|�dee|��jdd�dd!ddjd�|D��ddjd�e|�D���}|r�|GHnededd|ded ed!e�}y||UWn*ek
r�}	e|	jd"|��nX||}
y%ejd�jjdd#�|
_ Wne!efk
r;nX|
S($sCReturns a new subclass of tuple with named fields.

    >>> Point = namedtuple('Point', ['x', 'y'])
    >>> Point.__doc__                   # docstring for the new class
    'Point(x, y)'
    >>> p = Point(11, y=22)             # instantiate with positional args or keywords
    >>> p[0] + p[1]                     # indexable like a plain tuple
    33
    >>> x, y = p                        # unpack like a regular tuple
    >>> x, y
    (11, 22)
    >>> p.x + p.y                       # fields also accessible by name
    33
    >>> d = p._asdict()                 # convert to a dictionary
    >>> d['x']
    11
    >>> Point(**d)                      # convert from a dictionary
    Point(x=11, y=22)
    >>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields
    Point(x=100, y=22)

    t,t css'|]}|j�p|dkVqdS(R#N(tisalnum(t.0tc((s#/usr/lib64/python2.7/collections.pys	<genexpr>RsiR#s_%ds*Type names and field names must be stringscss'|]}|j�p|dkVqdS(R#N(R_(R`Ra((s#/usr/lib64/python2.7/collections.pys	<genexpr>]ssWType names and field names can only contain alphanumeric characters and underscores: %rs2Type names and field names cannot be a keyword: %rs9Type names and field names cannot start with a number: %rs/Field names cannot start with an underscore: %rs$Encountered duplicate field name: %rttypenametfield_namest
num_fieldstarg_listt'tii����trepr_fmts, css!|]}tjd|�VqdS(tnameN(t_repr_templatetformat(R`Ri((s#/usr/lib64/python2.7/collections.pys	<genexpr>ust
field_defss
css-|]#\}}tjd|d|�VqdS(tindexRiN(t_field_templateRk(R`RmRi((s#/usr/lib64/python2.7/collections.pys	<genexpr>wst_itemgetterR>s
namedtuple_%sRt	_propertyt_tuples:
t__main__("RIt
basestringtreplacetsplittmaptstrtsett	enumerateRKt
_iskeywordtisdigitt
startswithtaddttypeRt
ValueErrort_class_templateRkttupleRtreprtjoinR)RoRtpropertytSyntaxErrortmessaget_syst	_getframet	f_globalstgetRVR(RbRctverbosetrenametseenRmRitclass_definitiont	namespaceteR6((s#/usr/lib64/python2.7/collections.pyR1st	

	

	%

%cBs�eZdZd�Zd�Zdd�Zd�Zedd��Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�ZRS(s�Dict subclass for counting hashable items.  Sometimes called a bag
    or multiset.  Elements are stored as dictionary keys and their counts
    are stored as dictionary values.

    >>> c = Counter('abcdeabcdabcaba')  # count elements from a string

    >>> c.most_common(3)                # three most common elements
    [('a', 5), ('b', 4), ('c', 3)]
    >>> sorted(c)                       # list all unique elements
    ['a', 'b', 'c', 'd', 'e']
    >>> ''.join(sorted(c.elements()))   # list elements with repetitions
    'aaaaabbbbcccdde'
    >>> sum(c.values())                 # total of all counts
    15

    >>> c['a']                          # count of letter 'a'
    5
    >>> for elem in 'shazam':           # update counts from an iterable
    ...     c[elem] += 1                # by adding 1 to each element's count
    >>> c['a']                          # now there are seven 'a'
    7
    >>> del c['b']                      # remove all 'b'
    >>> c['b']                          # now there are zero 'b'
    0

    >>> d = Counter('simsalabim')       # make another counter
    >>> c.update(d)                     # add in the second counter
    >>> c['a']                          # now there are nine 'a'
    9

    >>> c.clear()                       # empty the counter
    >>> c
    Counter()

    Note:  If a count is set to zero or reduced to zero, it will remain
    in the counter until the entry is deleted or the counter is cleared:

    >>> c = Counter('aaabbc')
    >>> c['b'] -= 2                     # reduce the count of 'b' by two
    >>> c.most_common()                 # 'b' is still in, but its count is zero
    [('a', 3), ('c', 1), ('b', 0)]

    cOs{|std��n|d}|d}t|�dkrTtdt|���ntt|�j�|j||�dS(s	Create a new, empty Counter object.  And if given, count elements
        from an input iterable.  Or, initialize the count from another mapping
        of elements to their counts.

        >>> c = Counter()                           # a new, empty counter
        >>> c = Counter('gallahad')                 # a new counter from an iterable
        >>> c = Counter({'a': 4, 'b': 2})           # a new counter from a mapping
        >>> c = Counter(a=4, b=2)                   # a new counter from keyword args

        s;descriptor '__init__' of 'Counter' object needs an argumentiis$expected at most 1 arguments, got %dN(RRtsuperRRRY(RRR((s#/usr/lib64/python2.7/collections.pyR�s

cCsdS(s1The count of elements not in the Counter is zero.i((RR((s#/usr/lib64/python2.7/collections.pyt__missing__�scCsP|dkr.t|j�dtd�dt�Stj||j�dtd��S(s�List the n most common elements and their counts from the most
        common to the least.  If n is None, then list all element counts.

        >>> Counter('abcdeabcdabcaba').most_common(3)
        [('a', 5), ('b', 4), ('c', 3)]

        RitreverseN(RtsortedR2RoR[t_heapqtnlargest(Rtn((s#/usr/lib64/python2.7/collections.pytmost_common�s	"cCstjtt|j���S(s�Iterator over elements repeating each as many times as its count.

        >>> c = Counter('ABCABC')
        >>> sorted(c.elements())
        ['A', 'A', 'B', 'B', 'C', 'C']

        # Knuth's example for prime factors of 1836:  2**2 * 3**3 * 17**1
        >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
        >>> product = 1
        >>> for factor in prime_factors.elements():     # loop over factors
        ...     product *= factor                       # and multiply them
        >>> product
        1836

        Note, if an element's count has been set to zero or is a negative
        number, elements() will ignore it.

        (t_chaint
from_iterablet_starmapt_repeatR2(R((s#/usr/lib64/python2.7/collections.pytelements�scCstd��dS(Ns@Counter.fromkeys() is undefined.  Use Counter(iterable) instead.(tNotImplementedError(RFRGtv((s#/usr/lib64/python2.7/collections.pyRH	scOs2|std��n|d}|d}t|�dkrTtdt|���n|rd|dnd}|dk	rt|t�r�|r�|j}xJ|j�D]#\}}||d�|||<q�Wqtt|�j	|�q|j}x(|D]}||d�d||<q�Wn|r.|j	|�ndS(s�Like dict.update() but add counts instead of replacing them.

        Source can be an iterable, a dictionary, or another Counter instance.

        >>> c = Counter('which')
        >>> c.update('witch')           # add elements from another iterable
        >>> d = Counter('watch')
        >>> c.update(d)                 # add elements from another counter
        >>> c['h']                      # four 'h' in which, witch, and watch
        4

        s9descriptor 'update' of 'Counter' object needs an argumentiis$expected at most 1 arguments, got %dN(
RRRRItMappingR�R2R�RRY(RRRRGtself_gettelemtcount((s#/usr/lib64/python2.7/collections.pyRYs&

		
cOs
|std��n|d}|d}t|�dkrTtdt|���n|rd|dnd}|dk	r�|j}t|t�r�x\|j�D]#\}}||d�|||<q�Wq�x(|D]}||d�d||<q�Wn|r|j|�ndS(s�Like dict.update() but subtracts counts instead of replacing them.
        Counts can be reduced below zero.  Both the inputs and outputs are
        allowed to contain zero and negative counts.

        Source can be an iterable, a dictionary, or another Counter instance.

        >>> c = Counter('which')
        >>> c.subtract('witch')             # subtract elements from another iterable
        >>> c.subtract(Counter('watch'))    # subtract elements from another counter
        >>> c['h']                          # 2 in which, minus 1 in witch, minus 1 in watch
        0
        >>> c['w']                          # 1 in which, minus 1 in witch, minus 1 in watch
        -1

        s;descriptor 'subtract' of 'Counter' object needs an argumentiis$expected at most 1 arguments, got %dN(RRRR�RIR�R-tsubtract(RRRRGR�R�R�((s#/usr/lib64/python2.7/collections.pyR�;s 

	
cCs
|j|�S(sReturn a shallow copy.(R=(R((s#/usr/lib64/python2.7/collections.pyRC^scCs|jt|�ffS(N(R=R)(R((s#/usr/lib64/python2.7/collections.pyREbscCs)||kr%tt|�j|�ndS(sGLike dict.__delitem__() but does not raise KeyError for missing values.N(R�RR$(RR�((s#/usr/lib64/python2.7/collections.pyR$escCsI|sd|jjSdjtdj|j���}d|jj|fS(Ns%s()s, s%r: %rs%s({%s})(R=R>R�Rvt__mod__R�(RR-((s#/usr/lib64/python2.7/collections.pyRAjs!cCs�t|t�stSt�}xA|j�D]3\}}|||}|dkr)|||<q)q)Wx?|j�D]1\}}||krm|dkrm|||<qmqmW|S(sAdd counts from two counters.

        >>> Counter('abbb') + Counter('bcc')
        Counter({'b': 4, 'c': 2, 'a': 1})

        i(RIRtNotImplementedR-(RRNR6R�R�tnewcount((s#/usr/lib64/python2.7/collections.pyt__add__ys	cCs�t|t�stSt�}xA|j�D]3\}}|||}|dkr)|||<q)q)WxC|j�D]5\}}||krm|dkrmd|||<qmqmW|S(s� Subtract count, but keep only results with positive counts.

        >>> Counter('abbbc') - Counter('bccd')
        Counter({'b': 2, 'a': 1})

        i(RIRR�R-(RRNR6R�R�R�((s#/usr/lib64/python2.7/collections.pyt__sub__�s	cCs�t|t�stSt�}xU|j�D]G\}}||}||krQ|n|}|dkr)|||<q)q)Wx?|j�D]1\}}||kr�|dkr�|||<q�q�W|S(s�Union is the maximum of value in either of the input counters.

        >>> Counter('abbb') | Counter('bcc')
        Counter({'b': 3, 'c': 2, 'a': 1})

        i(RIRR�R-(RRNR6R�R�tother_countR�((s#/usr/lib64/python2.7/collections.pyt__or__�s	
cCsxt|t�stSt�}xU|j�D]G\}}||}||krQ|n|}|dkr)|||<q)q)W|S(s� Intersection is the minimum of corresponding counts.

        >>> Counter('abbb') & Counter('bcc')
        Counter({'b': 1})

        i(RIRR�R-(RRNR6R�R�R�R�((s#/usr/lib64/python2.7/collections.pyt__and__�s	
N(R>RVRWRR�RR�R�R\RHRYR�RCRER$RAR�R�R�R�(((s#/usr/lib64/python2.7/collections.pyR�s"+		
		+	#							Rr(tloadstdumpstPointsx, ytxi
tyisx ycBs&eZdZed��Zd�ZRS(cCs|jd|jddS(Nig�?(R�R�(R((s#/usr/lib64/python2.7/collections.pythypot�scCsd|j|j|jfS(Ns$Point: x=%6.3f  y=%6.3f  hypot=%6.3f(R�R�R�(R((s#/usr/lib64/python2.7/collections.pyt__str__�s((R>RVt	__slots__R�R�R�(((s#/usr/lib64/python2.7/collections.pyR��siiiig@cBs/eZdZdZeej�Zed�Z	RS(sHPoint class with optimized _make() and _replace() without error-checkingcKs|j||jd|��S(NR�R�(R�R�(t_makeR�(Rt_mapR((s#/usr/lib64/python2.7/collections.pyt_replace�s((
R>RVRWR�R\R�t__new__R�RvR�(((s#/usr/lib64/python2.7/collections.pyR��siiidtPoint3DtztTestResultssfailed attempted(6RWt__all__t_abcollt_collectionsRRtoperatorRRoRRMtkeywordRRztsysR�theapqR�t	itertoolsR	R�R
R�RR�RRLtthreadR
R<tImportErrortdummy_threadR)RR�RjRntFalseRRR>tcPickleR�R�R[R�tptAssertionErrorR�t_fieldsR�tdoctestR�ttestmod(((s#/usr/lib64/python2.7/collections.pyt<module>sL


�f�/)