Ë
    	š„j'�  ã                   ó"  — d Z ddlmZ ddlZddlmZ ddlmZ	m
Z ddlZddlZddlmZ ddlmZmZmZ ddlmZmZmZmZ dd	lmZmZm Z m!Z!m"Z" e r	dd
l#m$Z$m%Z% ndd
l&m$Z$m%Z% d„ Zddlm'Z' e!rd+d„Z(nddlm(Z( e"r	 ddl)m*Z* n	 ddl-m*Z* d,d„Z/ G d„ de0«      Z1 G d„ de2«      Z3	 ddlmZ ddlm4Z4 d„ Z5 G d„ de2«      Z6d„ Z7d+d„Z( G d„ de%«      Z8ddlm9Z9 e9dfd„Z:d „ Z;e3Z<e6Z=e7Z>e(Z?eZ@e5ZAe/ZBe8ZCe:ZDe;ZEejŒ                  d!k\  r!dd"l#m3Z3m6Z6 ddlm(Z( dd#lGm;Z; 	 dd$lm7Z7 dd%lm:Z: ejŒ                  d&k\  rddlmZ dd'l#m5Z5 ejŒ                  d(k\  rdd)lHm/Z/ dd*l#m8Z8 yy# e+$ r	 ddl,m*Z* Y Œßw xY w# e+$ r	 ddl.m*Z* Y Œðw xY w# e+$ r Y ŒÔw xY w# e+$ r Y Œrw xY w)-aê  
Miscellaneous function (re)definitions from the Py3.4+ standard library
for Python 2.6/2.7.

- math.ceil                (for Python 2.7)
- collections.OrderedDict  (for Python 2.6)
- collections.Counter      (for Python 2.6)
- collections.ChainMap     (for all versions prior to Python 3.3)
- itertools.count          (for Python 2.6, with step parameter)
- subprocess.check_output  (for Python 2.6)
- reprlib.recursive_repr   (for Python 2.6+)
- functools.cmp_to_key     (for Python 2.6)
é    )Úabsolute_importN)Úceil)Ú
itemgetterÚeq)Úproxy)ÚrepeatÚchainÚstarmap)ÚgetaddrinfoÚSOCK_STREAMÚerrorÚsocket)Ú	iteritemsÚ
itervaluesÚPY2ÚPY26ÚPY3)ÚMappingÚMutableMappingc                 ó*   — t        t        | «      «      S )zZ
    Return the ceiling of x as an int.
    This is the smallest integral value >= x.
    )ÚintÚoldceil)Úxs    úL/var/www/html/GAP/venv/lib/python3.12/site-packages/future/backports/misc.pyr   r   #   s   € ô
 Œw�q‹z‹?Ðó    )Úislicec              #   ó    K  — 	 | –— | |z  } Œ
­w©N© ©ÚstartÚsteps     r   Úcountr#   3   s   è ø€ ØØŠKØ�T‰MˆEð ùó   ‚)r#   )Ú	get_identc                 ó   ‡ — ˆ fd„}|S )zGDecorator to make a repr function return fillvalue for a recursive callc                 ó¸   •‡ ‡— t        «       Šˆˆˆ fd„}t        ‰ d«      |_        t        ‰ d«      |_        t        ‰ d«      |_        t        ‰ di «      |_        |S )Nc                 óÀ   •— t        | «      t        «       f}|‰v r‰S ‰j                  |«       	  ‰| «      }‰j                  |«       |S # ‰j                  |«       w xY wr   )Úidr%   ÚaddÚdiscard)ÚselfÚkeyÚresultÚ	fillvalueÚrepr_runningÚuser_functions      €€€r   Úwrapperz<recursive_repr.<locals>.decorating_function.<locals>.wrapperM   sc   ø€ Ü�T“(œI›KÐ'ˆCØ�lÑ"Ø Ð Ø×Ñ˜SÔ!ð*Ù& tÓ,�à×$Ñ$ SÔ)ØˆMøð ×$Ñ$ SÕ)ús   ¯A
 Á
AÚ
__module__Ú__doc__Ú__name__Ú__annotations__)ÚsetÚgetattrr3   r4   r5   r6   )r1   r2   r0   r/   s   ` @€r   Údecorating_functionz+recursive_repr.<locals>.decorating_functionJ   sT   ú€ Ü“uˆö		ô % ]°LÓAˆÔÜ! -°Ó;ˆŒÜ" =°*Ó=ˆÔÜ")¨-Ð9JÈBÓ"OˆÔØˆr   r   )r/   r9   s   ` r   Úrecursive_reprr:   G   s   ø€ ôð* Ðr   c                   ó   — e Zd ZdZy)Ú_Link)ÚprevÚnextr-   Ú__weakref__N)r5   r3   Ú__qualname__Ú	__slots__r   r   r   r<   r<   j   s   „ Ø4�Ir   r<   c                   óX  — e Zd ZdZd„ Zej                  eefd„Zej                  fd„Z	d„ Z
d„ Zd„ Zdd„Zdd	„Zd
„ Zej"                  xZZej&                  Zej(                  Zej*                  Zej,                  Z e«       Zefd„Zdd„Z e«       d„ «       Zd„ Zd„ Zedd„«       Z d„ Z!y)ÚOrderedDictz)Dictionary that remembers insertion orderc                  óX  — | st        d«      ‚| d   }| dd } t        | «      dkD  rt        dt        | «      z  «      ‚	 |j                    |j                  | i |¤Ž y# t        $ rC t	        «       |_        t        |j
                  «      x|_        }|x|_        |_        i |_	        Y Œ^w xY w)zÅInitialize an ordered dictionary.  The signature is the same as
        regular dictionaries, but keyword arguments are not recommended because
        their insertion order is arbitrary.

        z?descriptor '__init__' of 'OrderedDict' object needs an argumentr   é   Nú$expected at most 1 arguments, got %d)Ú	TypeErrorÚlenÚ_OrderedDict__rootÚAttributeErrorr<   Ú_OrderedDict__hardrootÚ_proxyr=   r>   Ú_OrderedDict__mapÚ_OrderedDict__update)ÚargsÚkwdsr,   Úroots       r   Ú__init__zOrderedDict.__init__|   s²   € ñ Üð 0ó 1ð 1à�A‰wˆØ�A�BˆxˆÜˆt‹9�qŠ=ÜÐBÄSÈÃYÑNÓOÐOð	Ø�KŠKð 	ˆ�‰�tÐ$˜tÓ$øô ò 	Ü#›gˆDŒOÜ!'¨¯©Ó!8Ð8ˆDŒK˜$Ø$(Ð(ˆDŒI˜œ	ØˆDŽJð		ús   ¾A ÁA	B)Â(B)c                 óÐ   — || vrX |«       x| j                   |<   }| j                  }|j                  }|||c|_        |_        |_        ||_         ||«      |_         || ||«       y)z!od.__setitem__(i, y) <==> od[i]=yN)rM   rI   r=   r>   r-   )	r,   r-   ÚvalueÚdict_setitemr   ÚLinkÚlinkrQ   Úlasts	            r   Ú__setitem__zOrderedDict.__setitem__’   se   € ð
 �d‰?Ù%)£VÐ+ˆD�J‰J�s‰O˜dØ—;‘;ˆDØ—9‘9ˆDØ-1°4¸Ð*ˆDŒI�t”y $¤(ØˆDŒIÙ˜d›ˆDŒIÙ�T˜3 Õ&r   c                 ó˜   —  || |«       | j                   j                  |«      }|j                  }|j                  }||_        ||_        y)z od.__delitem__(y) <==> del od[y]N)rM   Úpopr=   r>   )r,   r-   Údict_delitemrW   Ú	link_prevÚ	link_nexts         r   Ú__delitem__zOrderedDict.__delitem__    s@   € ñ 	�T˜3ÔØ�z‰z�~‰~˜cÓ"ˆØ—I‘Iˆ	Ø—I‘Iˆ	Ø"ˆ	ŒØ"ˆ	�r   c              #   ó„   K  — | j                   }|j                  }||ur |j                  –— |j                  }||urŒyy­w)zod.__iter__() <==> iter(od)N)rI   r>   r-   ©r,   rQ   Úcurrs      r   Ú__iter__zOrderedDict.__iter__«   ó>   è ø€ ð �{‰{ˆØ�y‰yˆØ˜$ÑØ—(‘(ŠNØ—9‘9ˆDð ˜$Ôùó
   ‚;A ¾A c              #   ó„   K  — | j                   }|j                  }||ur |j                  –— |j                  }||urŒyy­w)z#od.__reversed__() <==> reversed(od)N)rI   r=   r-   ra   s      r   Ú__reversed__zOrderedDict.__reversed__´   rd   re   c                 ó–   — | j                   }|x|_        |_        | j                  j	                  «        t
        j	                  | «       y)z.od.clear() -> None.  Remove all items from od.N)rI   r=   r>   rM   ÚclearÚdict)r,   rQ   s     r   ri   zOrderedDict.clear½   s5   € à�{‰{ˆØ $Ð$ˆŒ	�D”IØ�
‰
×ÑÔÜ�
‰
�4Õr   c                 ó8  — | st        d«      ‚| j                  }|r'|j                  }|j                  }||_        ||_        n&|j                  }|j                  }||_        ||_        |j                  }| j
                  |= t        j                  | |«      }||fS )z™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.

        zdictionary is empty)ÚKeyErrorrI   r=   r>   r-   rM   rj   r[   )r,   rX   rQ   rW   r]   r^   r-   rT   s           r   ÚpopitemzOrderedDict.popitemÄ   s�   € ñ
 ÜÐ0Ó1Ð1Ø�{‰{ˆÙØ—9‘9ˆDØŸ	™	ˆIØ!ˆIŒNØ!ˆD�Ià—9‘9ˆDØŸ	™	ˆIØ!ˆDŒIØ!ˆIŒNØ�h‰hˆØ�J‰J�sˆOÜ—‘˜˜sÓ#ˆØ�EˆzÐr   c                 ó,  — | j                   |   }|j                  }|j                  }||_        ||_        | j                  }|r)|j                  }||_        ||_        |x|_        |_        y|j                  }||_        ||_        |x|_        |_        y)zÑMove an existing element to the end (or beginning if last==False).

        Raises KeyError if the element does not exist.
        When last=True, acts like a fast version of self[key]=self.pop(key).

        N)rM   r=   r>   rI   )r,   r-   rX   rW   r]   r^   rQ   Úfirsts           r   Úmove_to_endzOrderedDict.move_to_endÛ   s‡   € ð �z‰z˜#‰ˆØ—I‘Iˆ	Ø—I‘Iˆ	Ø"ˆ	ŒØ"ˆ	ŒØ�{‰{ˆÙØ—9‘9ˆDØˆDŒIØˆDŒIØ$(Ð(ˆDŒI˜�	à—I‘IˆEØˆDŒIØˆDŒIØ%)Ð)ˆDŒI˜�
r   c                 óö   — t         j                  }t        | «      dz   } || j                  «      }| || j                  «      dz  z  }| || j
                  «      |z  z  }| || j                  «      |z  z  }|S )NrE   é   )ÚsysÚ	getsizeofrH   Ú__dict__rM   rK   rI   )r,   ÚsizeofÚnÚsizes       r   Ú
__sizeof__zOrderedDict.__sizeof__ó   ss   € Ü—‘ˆÜ�‹I˜‰MˆÙ�d—m‘mÓ$ˆØ‘�t—z‘zÓ" QÑ&Ñ&ˆØ‘�t—‘Ó'¨!Ñ+Ñ+ˆØ‘�t—{‘{Ó# aÑ'Ñ'ˆØˆr   c                 óT   — || v r
| |   }| |= |S || j                   u rt        |«      ‚|S )z²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.

        )Ú_OrderedDict__markerrl   )r,   r-   Údefaultr.   s       r   r[   zOrderedDict.pop  s;   € ð �$‰;Ø˜#‘YˆFØ�S�	ØˆMØ�d—m‘mÑ#Ü˜3“-ÐØˆr   Nc                 ó"   — || v r| |   S || |<   |S )zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr   ©r,   r-   r|   s      r   Ú
setdefaultzOrderedDict.setdefault  s!   € à�$‰;Ø˜‘9ÐØˆˆS‰	Øˆr   c                 óž   — | s| j                   j                  ›d�S | j                   j                  ›dt        | j                  «       «      ›d�S )zod.__repr__() <==> repr(od)z()ú(ú))Ú	__class__r5   ÚlistÚitems©r,   s    r   Ú__repr__zOrderedDict.__repr__  s:   € ñ Ø!Ÿ^™^×4Ó4Ð6Ð6ØŸ>™>×2Ó2´D¸¿¹»Õ4FÐGÐGr   c                 óà   — t        | «      j                  «       }t        t        «       «      D ]  }|j                  |d«       Œ | j                  d|xs ddt        | j                  «       «      fS )z%Return state information for picklingNr   )ÚvarsÚcopyrC   r[   rƒ   Úiterr…   )r,   Ú	inst_dictÚks      r   Ú
__reduce__zOrderedDict.__reduce__   s[   € ä˜“J—O‘OÓ%ˆ	Ü”k“mÓ$ò 	#ˆAØ�M‰M˜!˜TÕ"ð	#à�~‰~˜r 9Ò#4°°d¼DÀÇÁÃÓ<NÐNÐNr   c                 ó$   — | j                  | «      S )z!od.copy() -> a shallow copy of od©rƒ   r†   s    r   rŠ   zOrderedDict.copy'  ó   € à�~‰~˜dÓ#Ð#r   c                 ó,   —  | «       }|D ]  }|||<   Œ	 |S )zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
        If not specified, the value defaults to None.

        r   )ÚclsÚiterablerT   r,   r-   s        r   ÚfromkeyszOrderedDict.fromkeys+  s(   € ñ ‹uˆØò 	ˆCØˆD�ŠIð	àˆr   c                 ó²   — t        |t        «      r2t        j                  | |«      xr t	        t        t        | |«      «      S t        j                  | |«      S )z“od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
        while comparison to a regular mapping is order-insensitive.

        )Ú
isinstancerC   rj   Ú__eq__ÚallÚmapÚ_eq)r,   Úothers     r   r˜   zOrderedDict.__eq__6  sC   € ô
 �eœ[Ô)Ü—;‘;˜t UÓ+ÒJ´´C¼¸TÀ5Ó4IÓ0JÐJÜ�{‰{˜4 Ó'Ð'r   )Tr   )"r5   r3   r@   r4   rR   rj   rY   rL   r<   r_   rc   rg   ri   rm   rp   ry   r   ÚupdaterN   ÚkeysÚvaluesr…   Ú__ne__Úobjectr{   r[   r   r:   r‡   rŽ   rŠ   Úclassmethodr•   r˜   r   r   r   rC   rC   m   sÛ   „ Ù/ò%ð. "&×!1Ñ!1¸Àeó'ð -1×,<Ñ,<ó 	#òòòóó.*ò0ð '×-Ñ-Ð-€FˆXØ×Ñ€DØ×"Ñ"€FØ× Ñ €EØ×"Ñ"€Fá‹x€Hà'ó óñ ÓñHó ðHòOò$ð òó ðó(r   rC   )r   )Únlargestc                 óH   — | j                   }|D ]  } ||d«      dz   | |<   Œ y)z!Tally elements from the iterable.r   rE   N)Úget)Úmappingr”   Úmapping_getÚelems       r   Ú_count_elementsr©   L  s/   € à—+‘+€KØò 1ˆÙ# D¨!Ó,¨qÑ0ˆ�Šñ1r   c                   ó¶   ‡ — e Zd ZdZˆ fd„Zd„ Zdd„Zd„ Zedd„«       Z	ˆ fd„Z
d„ Zd	„ Zd
„ Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZS )ÚCounteraŸ  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)]

    c                  óÆ   •— | st        d«      ‚| d   }| dd } t        | «      dkD  rt        dt        | «      z  «      ‚t        t        |�  «         |j
                  | i |¤Ž y)a	  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

        z;descriptor '__init__' of 'Counter' object needs an argumentr   rE   NrF   )rG   rH   Úsuperr«   rR   r�   )rO   rP   r,   rƒ   s      €r   rR   zCounter.__init__…  sn   ø€ ñ Üð 0ó 1ð 1à�A‰wˆØ�A�BˆxˆÜˆt‹9�qŠ=ÜÐBÄSÈÃYÑNÓOÐOÜŒg�tÑ%Ô'Øˆ�‰�TÐ"˜TÓ"r   c                  ó   — y)z1The count of elements not in the Counter is zero.r   r   ©r,   r-   s     r   Ú__missing__zCounter.__missing__š  s   € ð r   c                 ó®   — |€%t        | j                  «       t        d«      d¬«      S t        j                  || j                  «       t        d«      ¬«      S )zð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)]

        rE   T)r-   Úreverse)r-   )Úsortedr…   Ú_itemgetterÚ_heapqr£   )r,   rw   s     r   Úmost_commonzCounter.most_commonŸ  s?   € ð ˆ9Ü˜$Ÿ*™*›,¬K¸«NÀDÔIÐIÜ�‰˜q $§*¡*£,´KÀ³NÔCÐCr   c                 ód   — t        j                  t        t        | j	                  «       «      «      S )a�  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.

        )Ú_chainÚfrom_iterableÚ_starmapÚ_repeatr…   r†   s    r   ÚelementszCounter.elements¬  s"   € ô( ×#Ñ#¤H¬W°d·j±j³lÓ$CÓDÐDr   c                 ó   — t        d«      ‚)Nz@Counter.fromkeys() is undefined.  Use Counter(iterable) instead.)ÚNotImplementedError)r“   r”   Úvs      r   r•   zCounter.fromkeysÄ  s   € ô "ØNóPð 	Pr   c                  óˆ  •— | st        d«      ‚| d   }| dd } t        | «      dkD  rt        dt        | «      z  «      ‚| r| d   nd}|�ft        |t        «      rJ|r4|j                  }|j                  «       D ]  \  }}| ||d«      z   ||<   Œ n t        t        |�#  |«       nt        ||«       |r|j                  |«       yy)aÉ  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

        z9descriptor 'update' of 'Counter' object needs an argumentr   rE   NrF   )
rG   rH   r—   r   r¥   r…   r­   r«   r�   r©   )rO   rP   r,   r”   Úself_getr¨   r#   rƒ   s          €r   r�   zCounter.updateË  sÕ   ø€ ñ( Üð 0ó 1ð 1à�A‰wˆØ�A�BˆxˆÜˆt‹9�qŠ=ÜÐBÄSÈÃYÑNÓOÐOÙ"�4˜’7¨ˆØÐÜ˜(¤GÔ,ÙØ#Ÿx™x�HØ'/§~¡~Ó'7ò ?™˜˜eØ%*©X°d¸AÓ->Ñ%>˜˜Tš
ñ?ô œ' 4Ñ/°Õ9ä  hÔ/ÙØ�K‰K˜Õð r   c                  ón  — | st        d«      ‚| d   }| dd } t        | «      dkD  rt        dt        | «      z  «      ‚| r| d   nd}|�Z|j                  }t        |t        «      r(|j                  «       D ]  \  }} ||d«      |z
  ||<   Œ n|D ]  } ||d«      dz
  ||<   Œ |r|j                  |«       yy)a·  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

        z;descriptor 'subtract' of 'Counter' object needs an argumentr   rE   NrF   )rG   rH   r¥   r—   r   r…   Úsubtract)rO   rP   r,   r”   rÁ   r¨   r#   s          r   rÃ   zCounter.subtractô  sÜ   € ñ  Üð 0ó 1ð 1à�A‰wˆØ�A�BˆxˆÜˆt‹9�qŠ=ÜÐBÄSÈÃYÑNÓOÐOÙ"�4˜’7¨ˆØÐØ—x‘xˆHÜ˜(¤GÔ,Ø#+§>¡>Ó#3ò ;‘K�D˜%Ù!)¨$°Ó!2°UÑ!:�D˜’Jñ;ð %ò 7�DÙ!)¨$°Ó!2°QÑ!6�D˜’Jð7áØ�M‰M˜$Õð r   c                 ó$   — | j                  | «      S )zReturn a shallow copy.r�   r†   s    r   rŠ   zCounter.copy  r‘   r   c                 ó2   — | j                   t        | «      ffS r   )rƒ   rj   r†   s    r   rŽ   zCounter.__reduce__  s   € Ø�~‰~¤ T£
˜}Ð,Ð,r   c                 ó6   •— || v rt         t        | �  |«       yy)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)r­   r«   r_   )r,   r¨   rƒ   s     €r   r_   zCounter.__delitem__  s   ø€ à�4‰<Ü”'˜4Ñ,¨TÕ2ð r   c                 óT  — | sd| j                   j                  z  S 	 dj                  t        dj                  | j                  «       «      «      }| j                   j                  ›d|›d�S # t        $ r2 dj                  | j                   j                  t        | «      «      cY S w xY w)Nz%s()ú, z%r: %rz({z})z
{0}({1!r}))	rƒ   r5   Újoinrš   Ú__mod__r¶   rG   Úformatrj   )r,   r…   s     r   r‡   zCounter.__repr__#  s‹   € ÙØ˜DŸN™N×3Ñ3Ñ3Ð3ð	LØ—I‘Iœc (×"2Ñ"2°D×4DÑ4DÓ4FÓGÓHˆEØ!%§¡×!8Ó!8º%Ð@Ð@øÜò 	Là×&Ñ& t§~¡~×'>Ñ'>ÄÀTÃ
ÓKÒKð	Lús   �AA, Á,8B'Â&B'c                 óì   — t        |t        «      st        S t        «       }| j                  «       D ]  \  }}|||   z   }|dkD  sŒ|||<   Œ |j                  «       D ]  \  }}|| vsŒ|dkD  sŒ|||<   Œ |S )zAdd counts from two counters.

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

        r   ©r—   r«   ÚNotImplementedr…   ©r,   rœ   r.   r¨   r#   Únewcounts         r   Ú__add__zCounter.__add__6  s‹   € ô ˜%¤Ô)Ü!Ð!Ü“ˆØŸ:™:›<ò 	(‰KˆD�%Ø˜u T™{Ñ*ˆHØ˜!‹|Ø'��t’ð	(ð !Ÿ;™;›=ò 	%‰KˆD�%Ø˜4Ò E¨A£IØ$��t’ð	%ð ˆr   c                 óò   — t        |t        «      st        S t        «       }| j                  «       D ]  \  }}|||   z
  }|dkD  sŒ|||<   Œ |j                  «       D ]  \  }}|| vsŒ|dk  sŒd|z
  ||<   Œ |S )z˜ Subtract count, but keep only results with positive counts.

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

        r   rÍ   rÏ   s         r   Ú__sub__zCounter.__sub__I  s�   € ô ˜%¤Ô)Ü!Ð!Ü“ˆØŸ:™:›<ò 	(‰KˆD�%Ø˜u T™{Ñ*ˆHØ˜!‹|Ø'��t’ð	(ð !Ÿ;™;›=ò 	)‰KˆD�%Ø˜4Ò E¨A£IØ  5™y��t’ð	)ð ˆr   c                 óø   — t        |t        «      st        S t        «       }| j                  «       D ]  \  }}||   }||k  r|n|}|dkD  sŒ|||<   Œ  |j                  «       D ]  \  }}|| vsŒ|dkD  sŒ|||<   Œ |S )z Union is the maximum of value in either of the input counters.

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

        r   rÍ   ©r,   rœ   r.   r¨   r#   Úother_countrÐ   s          r   Ú__or__zCounter.__or__\  s”   € ô ˜%¤Ô)Ü!Ð!Ü“ˆØŸ:™:›<ò 	(‰KˆD�%Ø ™+ˆKØ&+¨kÒ&9‘{¸uˆHØ˜!‹|Ø'��t’ð		(ð
 !Ÿ;™;›=ò 	%‰KˆD�%Ø˜4Ò E¨A£IØ$��t’ð	%ð ˆr   c                 ó¨   — t        |t        «      st        S t        «       }| j                  «       D ]  \  }}||   }||k  r|n|}|dkD  sŒ|||<   Œ  |S )z‡ Intersection is the minimum of corresponding counts.

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

        r   rÍ   rÕ   s          r   Ú__and__zCounter.__and__p  sb   € ô ˜%¤Ô)Ü!Ð!Ü“ˆØŸ:™:›<ò 	(‰KˆD�%Ø ™+ˆKØ %¨Ò 3‘u¸ˆHØ˜!‹|Ø'��t’ð		(ð
 ˆr   c                 ó   — | t        «       z   S )zEAdds an empty counter, effectively stripping negative and zero counts©r«   r†   s    r   Ú__pos__zCounter.__pos__�  s   € à”g“iÑÐr   c                 ó   — t        «       | z
  S )z{Subtracts from an empty counter.  Strips positive and zero counts,
        and flips the sign on negative counts.

        rÛ   r†   s    r   Ú__neg__zCounter.__neg__…  s   € ô
 ‹y˜4ÑÐr   c                 óv   — | j                  «       D ��cg c]  \  }}|dkD  rŒ|‘Œ }}}|D ]  }| |= Œ | S c c}}w )z?Internal method to strip elements with a negative or zero countr   )r…   )r,   r¨   r#   Únonpositives       r   Ú_keep_positivezCounter._keep_positiveŒ  sF   € à/3¯z©z«|×M¡  eÀ5È1Ã9’tÐMˆÑMØò 	ˆDØ�T‘
ð	àˆùó Ns   ”5¢5c                 ól   — |j                  «       D ]  \  }}| |xx   |z  cc<   Œ | j                  «       S )zÂInplace add from another counter, keeping only positive counts.

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

        ©r…   rá   ©r,   rœ   r¨   r#   s       r   Ú__iadd__zCounter.__iadd__“  ó:   € ð !Ÿ;™;›=ò 	 ‰KˆD�%Ø�‹J˜%ÑŒJð	 à×"Ñ"Ó$Ð$r   c                 ól   — |j                  «       D ]  \  }}| |xx   |z  cc<   Œ | j                  «       S )zÂInplace subtract counter, but keep only results with positive counts.

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

        rã   rä   s       r   Ú__isub__zCounter.__isub__   ræ   r   c                 ór   — |j                  «       D ]  \  }}| |   }||kD  sŒ|| |<   Œ | j                  «       S )z½Inplace union is the maximum of value from either counter.

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

        rã   )r,   rœ   r¨   rÖ   r#   s        r   Ú__ior__zCounter.__ior__­  sI   € ð "'§¡£ò 	)ÑˆD�+Ø˜‘JˆEØ˜UÓ"Ø(��T’
ð	)ð ×"Ñ"Ó$Ð$r   c                 ór   — | j                  «       D ]  \  }}||   }||k  sŒ|| |<   Œ | j                  «       S )z¯Inplace intersection is the minimum of corresponding counts.

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

        rã   )r,   rœ   r¨   r#   rÖ   s        r   Ú__iand__zCounter.__iand__¼  sH   € ð  Ÿ:™:›<ò 	)‰KˆD�%Ø ™+ˆKØ˜UÓ"Ø(��T’
ð	)ð ×"Ñ"Ó$Ð$r   r   )r5   r3   r@   r4   rR   r°   r¶   r¼   r¢   r•   r�   rÃ   rŠ   rŽ   r_   r‡   rÑ   rÓ   r×   rÙ   rÜ   rÞ   rá   rå   rè   rê   rì   Ú__classcell__r�   s   @r   r«   r«   R  s�   ø„ ñ*ôd#ò*ó
DòEð0 òPó ðPô'òR! òF$ò-ô3ò
Lò&ò&ò&ò(ò" ò òò%ò%ò%ö%r   r«   c                  ó  — d|v rt        d«      ‚t        j                  | dt        j                  i|¤Ž}|j	                  «       \  }}|j                  «       }|r.|j                  d«      }|€| d   }t        j                  ||«      ‚|S )z[
    For Python 2.6 compatibility: see
    http://stackoverflow.com/questions/4814970/
    Ústdoutz3stdout argument not allowed, it will be overridden.rO   r   )Ú
ValueErrorÚ
subprocessÚPopenÚPIPEÚcommunicateÚpollr¥   ÚCalledProcessError)Ú	popenargsÚkwargsÚprocessÚoutputÚ
unused_errÚretcodeÚcmds          r   Úcheck_outputrþ   Ì  s‹   € ð �6ÑÜÐNÓOÐOÜ×Ñ¸	ÐL¤j§o¡oÐLÀVÑL€GØ ×,Ñ,Ó.Ñ€FˆJØ�l‰l‹n€GÙØ�j‰j˜Ó ˆØˆ;Ø˜A‘,ˆCÜ×+Ñ+¨G°SÓ9Ð9Ø€Mr   c              #   ó    K  — 	 | –— | |z  } Œ
­w)z¿
    ``itertools.count`` in Py 2.6 doesn't accept a step
    parameter. This is an enhanced version of ``itertools.count``
    for Py2.6 equivalent to ``itertools.count`` in Python 2.7+.
    r   r    s     r   r#   r#   ß  s   è ø€ ð ØŠØ�‰ˆð ùr$   c                   ó°   — e Zd ZdZd„ Zd„ Zd„ Zdd„Zd„ Zd„ Z	d	„ Z
d
„ ZeZ e«       d„ «       Zed„ «       Zd„ ZeZdd„Zed„ «       Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚChainMapa±   A ChainMap groups multiple dicts (or other mappings) together
    to create a single, updateable view.

    The underlying mappings are stored in a list.  That list is public and can
    accessed or updated using the *maps* attribute.  There is no other state.

    Lookups search the underlying mappings successively until a key is found.
    In contrast, writes, updates, and deletions only operate on the first
    mapping.

    c                 ó.   — t        |«      xs i g| _        y)z�Initialize a ChainMap by setting *maps* to the given mappings.
        If no mappings are provided, a single empty dictionary is used.

        N)r„   Úmaps)r,   r  s     r   rR   zChainMap.__init__ý  s   € ô
 ˜“JÒ& 2 $ˆ�	r   c                 ó   — t        |«      ‚r   )rl   r¯   s     r   r°   zChainMap.__missing__  s   € Ü�s‹mÐr   c                 ór   — | j                   D ]	  }	 ||   c S  | j                  |«      S # t        $ r Y Œ(w xY wr   )r  rl   r°   )r,   r-   r¦   s      r   Ú__getitem__zChainMap.__getitem__  sK   € Ø—y‘yò 	ˆGðØ˜s‘|Ò#ð	ð
 ×Ñ Ó$Ð$øô ò Ùðús   ‘*ª	6µ6Nc                 ó   — || v r| |   S |S r   r   r~   s      r   r¥   zChainMap.get  s   € Ø 4™Kˆt�C‰yÐ4¨WÐ4r   c                 óV   — t         t        «       j                  | j                  Ž «      S r   )rH   r7   Úunionr  r†   s    r   Ú__len__zChainMap.__len__  s   € Ü�;”3“5—;‘; §	¡	Ð*Ó+Ð+r   c                 óV   — t         t        «       j                  | j                  Ž «      S r   )r‹   r7   r	  r  r†   s    r   rc   zChainMap.__iter__  s   € Ü�K”C“E—K‘K §¡Ð+Ó,Ð,r   c                 ó@   ‡— t        ˆfd„| j                  D «       «      S )Nc              3   ó&   •K  — | ]  }‰|v –— Œ
 y ­wr   r   )Ú.0Úmr-   s     €r   ú	<genexpr>z(ChainMap.__contains__.<locals>.<genexpr>  s   øè ø€ Ò/ �3˜!”8Ñ/ùs   ƒ©Úanyr  r¯   s    `r   Ú__contains__zChainMap.__contains__  s   ø€ ÜÓ/ T§Y¡YÔ/Ó/Ð/r   c                 ó,   — t        | j                  «      S r   r  r†   s    r   Ú__bool__zChainMap.__bool__  s   € Ü�4—9‘9‹~Ðr   c           	      ót   — dj                  | dj                  t        t        | j                  «      «      «      S )Nz{0.__class__.__name__}({1})rÈ   )rË   rÉ   rš   Úreprr  r†   s    r   r‡   zChainMap.__repr__!  s.   € à,×3Ñ3Ø�$—)‘)œC¤ d§i¡iÓ0Ó1ó3ð 	3r   c                 ó:   —  | t        j                  |g|¢­Ž «      S )z?Create a ChainMap with a single dict created from the iterable.)rj   r•   )r“   r”   rO   s      r   r•   zChainMap.fromkeys&  s   € ñ ”4—=‘= Ð1¨DÒ1Ó2Ð2r   c                 óx   —  | j                   | j                  d   j                  «       g| j                  dd ¢­Ž S )zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r   rE   N)rƒ   r  rŠ   r†   s    r   rŠ   zChainMap.copy+  s3   € àˆt�~‰~˜dŸi™i¨™l×/Ñ/Ó1ÐB°D·I±I¸a¸b°MÒBÐBr   c                 óD   — |€i } | j                   |g| j                  ¢­Ž S )z‚
        New ChainMap with a new map followed by all previous maps. If no
        map is provided, an empty dict is used.
        ©rƒ   r  )r,   r  s     r   Ú	new_childzChainMap.new_child1  s(   € ð
 ˆ9ØˆAØˆt�~‰~˜aÐ, $§)¡)Ò,Ð,r   c                 ó:   —  | j                   | j                  dd Ž S )zNew ChainMap from maps[1:].rE   Nr  r†   s    r   ÚparentszChainMap.parents:  s   € ð ˆt�~‰~˜tŸy™y¨¨˜}Ð-Ð-r   c                 ó(   — || j                   d   |<   y ©Nr   )r  )r,   r-   rT   s      r   rY   zChainMap.__setitem__?  s   € Ø!ˆ�	‰	�!‰�SÒr   c                 ót   — 	 | j                   d   |= y # t        $ r t        dj                  |«      «      ‚w xY w)Nr   ú)Key not found in the first mapping: {0!r})r  rl   rË   r¯   s     r   r_   zChainMap.__delitem__B  s@   € ð	TØ—	‘	˜!‘˜SÑ!øÜò 	TÜÐF×MÑMÈcÓRÓSÐSð	Tús   ‚ “$7c                 ón   — 	 | j                   d   j                  «       S # t        $ r t        d«      ‚w xY w)zPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.r   z#No keys found in the first mapping.)r  rm   rl   r†   s    r   rm   zChainMap.popitemH  s<   € ð	BØ—9‘9˜Q‘<×'Ñ'Ó)Ð)øÜò 	BÜÐ@ÓAÐAð	Bús   ‚ Ÿ4c                 ó’   — 	  | j                   d   j                  |g|¢­Ž S # t        $ r t        dj                  |«      «      ‚w xY w)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r   r"  )r  r[   rl   rË   )r,   r-   rO   s      r   r[   zChainMap.popO  sP   € ð	TØ#�4—9‘9˜Q‘<×#Ñ# CÐ/¨$Ò/Ð/øÜò 	TÜÐF×MÑMÈcÓRÓSÐSð	Tús	   ‚" ¢$Ac                 ó>   — | j                   d   j                  «        y)z'Clear maps[0], leaving maps[1:] intact.r   N)r  ri   r†   s    r   ri   zChainMap.clearV  s   € à�	‰	�!‰×ÑÕr   r   )r5   r3   r@   r4   rR   r°   r  r¥   r
  rc   r  r  Ú__nonzero__r:   r‡   r¢   r•   rŠ   Ú__copy__r  Úpropertyr  rY   r_   rm   r[   ri   r   r   r   r  r  ð  s¡   „ ñ
ò'òò%ó5ò,ò-ò0òð €KáÓñ3ó ð3ð ñ3ó ð3òCð €Hó-ð ñ.ó ð.ò"òTòBòTór   r  )Ú_GLOBAL_DEFAULT_TIMEOUTc                 ó`  — | \  }}d}t        ||dt        «      D ]Z  }|\  }}}	}
}d}	 t        |||	«      }|t        ur|j	                  |«       |r|j                  |«       |j                  |«       |c S  |�|‚t        d«      ‚# t        $ r}|}|�|j                  «        Y d}~ŒŽd}~ww xY w)aŸ  Backport of 3-argument create_connection() for Py2.6.

    Connect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    An host of '' or port 0 tells the OS to use the default.
    Nr   z!getaddrinfo returns an empty list)	r   r   r   r)  Ú
settimeoutÚbindÚconnectr   Úclose)ÚaddressÚtimeoutÚsource_addressÚhostÚportÚerrÚresÚafÚsocktypeÚprotoÚ	canonnameÚsaÚsockÚ_s                 r   Úcreate_connectionr=  `  sÈ   € ð  �J€Dˆ$Ø
€CÜ˜4  q¬+Ó6ò ˆØ-0Ñ*ˆˆH�e˜Y¨Øˆð	Ü˜"˜h¨Ó.ˆDØÔ5Ñ5Ø—‘ Ô(ÙØ—	‘	˜.Ô)Ø�L‰L˜ÔØŠKðð" €Øˆ	äÐ7Ó8Ð8øô ò 	ØˆCØÐØ—
‘
”ÿøð	ús   ¨ABÂ	B-ÂB(Â(B-c                 ó*   ‡ —  G ˆ fd„dt         «      }|S )z,Convert a cmp= function into a key= functionc                   ó\   •— e Zd ZdgZd„ Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd„Z	ˆ fd„Z
d	„ Zy
)úcmp_to_key.<locals>.KÚobjc                 ó   — || _         y r   ©rA  )r,   rA  rO   s      r   rR   zcmp_to_key.<locals>.K.__init__�  s	   € ØˆD�Hr   c                 óD   •—  ‰| j                   |j                   «      dk  S r   rC  ©r,   rœ   Úmycmps     €r   Ú__lt__zcmp_to_key.<locals>.K.__lt__�  ó   ø€ Ù˜Ÿ™ 5§9¡9Ó-°Ñ1Ð1r   c                 óD   •—  ‰| j                   |j                   «      dkD  S r   rC  rE  s     €r   Ú__gt__zcmp_to_key.<locals>.K.__gt__‘  rH  r   c                 óD   •—  ‰| j                   |j                   «      dk(  S r   rC  rE  s     €r   r˜   zcmp_to_key.<locals>.K.__eq__“  ó   ø€ Ù˜Ÿ™ 5§9¡9Ó-°Ñ2Ð2r   c                 óD   •—  ‰| j                   |j                   «      dk  S r   rC  rE  s     €r   Ú__le__zcmp_to_key.<locals>.K.__le__•  rL  r   c                 óD   •—  ‰| j                   |j                   «      dk\  S r   rC  rE  s     €r   Ú__ge__zcmp_to_key.<locals>.K.__ge__—  rL  r   c                 óD   •—  ‰| j                   |j                   «      dk7  S r   rC  rE  s     €r   r    zcmp_to_key.<locals>.K.__ne__™  rL  r   c                 ó   — t        d«      ‚)Nzhash not implemented)rG   r†   s    r   Ú__hash__zcmp_to_key.<locals>.K.__hash__›  s   € ÜÐ2Ó3Ð3r   N)r5   r3   r@   rA   rR   rG  rJ  r˜   rN  rP  r    rS  )rF  s   €r   ÚKr@  ‹  s2   ø„ Ø�Gˆ	ò	ô	2ô	2ô	3ô	3ô	3ô	3ó	4r   rT  )r¡   )rF  rT  s   ` r   Ú
cmp_to_keyrU  ‰  s   ø€ ö4ŒFô 4ð$ €Hr   )rr   é   )rC   r«   )rU  )rþ   )r=  )é   r   )r©   )rW  rW  )r:   )r  )r   rE   )z...)Ir4   Ú
__future__r   rñ   Úmathr   r   Úoperatorr   r´   r   r›   rs   Úheapqrµ   Ú_weakrefr   rL   Ú	itertoolsr   r»   r	   r¸   r
   rº   r   r   r   r   Úfuture.utilsr   r   r   r   r   Úcollectionsr   r   Úcollections.abcr   r#   Ú_threadr%   ÚImportErrorÚ_dummy_threadÚthreadÚdummy_threadr:   r¡   r<   rj   rC   r£   r©   r«   rþ   r  r)  r=  rU  Ú_OrderedDictÚ_CounterÚ_check_outputÚ_countÚ_ceilÚ__count_elementsÚ_recursive_reprÚ	_ChainMapÚ_create_connectionÚ_cmp_to_keyÚversion_infoÚ	functoolsÚreprlibr   r   r   ú<module>rs     sµ  ðñõ 'ã Ý  ç 9Û 
Û Ý $ß MÑ Mß :Ó :ç >Õ >áß3Ð3ç7òõ áôõ
  ñ ð,Þ%ð+Ý$ó
ôF5ˆFô 5ôP(�$ô P(ðj	Ý#Ýò1ôw%ˆdô w%òtó&ô"hˆ~ô hõX +ð (?Ø%)ó&9òRð. €Ø€Ø€Ø	€Ø€Ø"Ð Ø €Ø€	Ø&Ð Ø€ð ×Ñ�vÒß0ÝÝ$ðÝ+õ )à×Ñ�vÒÝÝ+à×Ñ�vÒÝ&Þ$ð øð} ò ,ß+ð,ûð
 ò +ß*ð+ûðD ò 	Ùð	ûð\ ò áðúsH   Á9E ÂE* Â"E; ÄF ÅE'Å&E'Å*E8Å7E8Å;FÆFÆFÆF