
    daf*                     N    d dl Z d dlmZ d dl mZ  G d d      ZeeffdZddZy)	    N)deque)islicec                   "    e Zd ZdZd Zd Zd Zy)Counterz
    Wrap an iterable in an object that stores the count of items
    that pass through it.

    >>> items = Counter(range(20))
    >>> items.count
    0
    >>> values = list(items)
    >>> items.count
    20
    c                 Z    d| _         t        t        j                   d      |      | _        y )Nr      )countzip	itertoolsiter)selfis     =/root/Python-3.12.4/Lib/test/test_zipfile/_path/_itertools.py__init__zCounter.__init__   s     
	*A.	    c                     | S N )r   s    r   __iter__zCounter.__iter__   s    r   c                 @    t        | j                        \  | _        }|S r   )nextr   r	   )r   results     r   __next__zCounter.__next__   s    !$))_
Fr   N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s    
/r   r   c                     | t        d      S |t        | |      rt        | f      S 	 t        |       S # t        $ r t        | f      cY S w xY w)Nr   )r   
isinstance	TypeError)obj	base_types     r   always_iterabler#   !   sU    
{Bx:c9#=SF|Cy SF|s   
4 AAc                 R    |t        | d       yt        t        | ||      d       y)aS  Advance *iterable* by *n* steps. If *n* is ``None``, consume it
    entirely.
    Efficiently exhausts an iterator without returning values. Defaults to
    consuming the whole iterator, but an optional second argument may be
    provided to limit consumption.
        >>> i = (x for x in range(10))
        >>> next(i)
        0
        >>> consume(i, 3)
        >>> next(i)
        4
        >>> consume(i)
        >>> next(i)
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        StopIteration
    If the iterator has fewer items remaining than the provided limit, the
    whole iterator will be consumed.
        >>> i = (x for x in range(3))
        >>> consume(i, 5)
        >>> next(i)
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        StopIteration
    Nr   )maxlen)r   r   r   )iteratorns     r   consumer(   /   s(    6 	yhq! 	VHa#T*r   r   )	r   collectionsr   r   r   strbytesr#   r(   r   r   r   <module>r,      s+       4 %(< 
 +r   