0x1949 Team - FAZEMRX - MANAGER
Edit File: more.cpython-310.pyc
o *B;a�� � @ s d dl Z d dlmZmZmZmZ d dlmZ d dlm Z d dl mZmZm Z d dlmZmZmZmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZ d dl m!Z!m"Z"m#Z#m$Z$ d d l%m&Z&m'Z' d d l(m(Z(m)Z)m*Z* d dl+m,Z,m-Z-m.Z.m/Z/m0Z0 d dl1m2Z2m3Z3 d d l4m5Z5 ddl6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z< g d�Z=e>� Z?d�dd�Z@e?fdd�ZAe?fdd�ZBe?fdd�ZCG dd� d�ZDdd� ZEdd� ZFd d!� ZGd"d#� ZHd$d%� ZId�d&d'�ZJd�d(d)�ZKd�d*d+�ZLd,d-� ZMd�d.d/�ZNd0d1� ZOd�d2d3�ZPG d4d5� d5�ZQd�d6d7�ZRd8d9� ZSd:d;� ZTd�d<d=�ZUd�d>d?�ZVd�d@dA�ZWd�dBdC�ZXd�dEdF�ZYd�dGdH�ZZd�dIdJ�Z[d�dKdL�Z\dMdN� Z]d�dOdP�Z^d�dRdS�Z_d�dTdU�Z`dVdW� Zad�dYdZ�ZbG d[d\� d\ec�Zdd]d^� Zed_d`� Zfddda�dbdc�Zgd�dedf�Zhdgdh� Zididj� Zjekelffdkdl�Zmd�dmdn�Znd�dodp�ZoG dqdr� drejejp�Zqd�dsdt�Zrdudv� Zsetdfdwdx�Zudydz� Zvd{d|� Zwd}d~� ZxG dd�� d��Zyd�d�� Zzd�d�� Z{d�d�� fd�d��Z|e.fdd��d�d��Z}G d�d�� d�e�Z~G d�d�� d��ZG d�d�� d��Z�etfd�d��Z�d�d�� Z�ddd�d��Z�d�d�d��Z�etdfd�d��Z�d�d�d��Z�d�d�� Z�d�d�d��Z�G d�d�� d��Z�d�d�d��Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� fd�d��Z�d�d�� Z�d�d�� Z�d�d�d��Z�d�d�d��Z�G d�d�� d�e��Z�G d�d�� d��Z�d�d�� Z�d�d�d��Z�d�d Z�d�dĄ Z�d�dƄ Z�d�dȄ Z�d�dʄ Z�d�d̄ Z�G d�d΄ dZ�d�dЄ Z�d�d҄ Z�d�dԄ Z�ekelfdd՜d�dׄZ�dS )�� N)�Counter�defaultdict�deque�abc)�Sequence)�ThreadPoolExecutor)�partial�reduce�wraps)�merge�heapify�heapreplace�heappop)�chain�compress�count�cycle� dropwhile�groupby�islice�repeat�starmap� takewhile�tee�zip_longest)�exp� factorial�floor�log)�Empty�Queue)�random� randrange�uniform)� itemgetter�mul�sub�gt�lt)� hexversion�maxsize)� monotonic� )�consume�flatten�pairwise�powerset�take�unique_everseen)X�AbortThread�adjacent�always_iterable�always_reversible�bucket� callback_iter�chunked�chunked_even�circular_shifts�collapse�collate�consecutive_groups�consumer� countable�count_cycle� mark_ends� difference�distinct_combinations�distinct_permutations� distribute�divide� exactly_n� filter_except�first�groupby_transform�ilen�interleave_longest� interleave�interleave_evenly�intersperse�islice_extended�iterate�ichunked� is_sorted�last�locate�lstrip�make_decorator� map_except�map_if� map_reduce�nth_or_last�nth_permutation�nth_product� numeric_range�one�only�padded� partitions�set_partitions�peekable�repeat_each�repeat_last�replace�rlocate�rstrip� run_length�sample�seekable�SequenceView�side_effect�sliced� sort_together�split_at�split_after�split_before� split_when� split_into�spy�stagger�strip� substrings�substrings_indexes�time_limited�unique_to_each�unzip�windowed� with_iter�UnequalIterablesError� zip_equal� zip_offset�windowed_complete� all_unique�value_chain� product_index�combination_index�permutation_index� zip_broadcastFc sF t tt�t | ��g �� |r!�du rtd��� �fdd�}t |� �S � S )aJ Break *iterable* into lists of length *n*: >>> list(chunked([1, 2, 3, 4, 5, 6], 3)) [[1, 2, 3], [4, 5, 6]] By the default, the last yielded list will have fewer than *n* elements if the length of *iterable* is not divisible by *n*: >>> list(chunked([1, 2, 3, 4, 5, 6, 7, 8], 3)) [[1, 2, 3], [4, 5, 6], [7, 8]] To use a fill-in value instead, see the :func:`grouper` recipe. If the length of *iterable* is not divisible by *n* and *strict* is ``True``, then ``ValueError`` will be raised before the last list is yielded. Nz*n must not be None when using strict mode.c 3 �* � � D ]} t | ��krtd��| V qd S )Nziterable is not divisible by n.��len� ValueError)�chunk��iterator�n� �5/usr/lib/python3/dist-packages/more_itertools/more.py�ret� � ��zchunked.<locals>.ret)�iterr r1 r� )�iterabler� �strictr� r� r� r� r9 � s r9 c C sJ zt t| ��W S ty$ } z|tu rtd�|�|W Y d}~S d}~ww )a� Return the first item of *iterable*, or *default* if *iterable* is empty. >>> first([0, 1, 2, 3]) 0 >>> first([], 'some default') 'some default' If *default* is not provided and there are no items in the iterable, raise ``ValueError``. :func:`first` is useful when you have a generator of expensive-to-retrieve values and want any arbitrary one. It is marginally shorter than ``next(iter(iterable), default)``. zKfirst() was called on an empty iterable, and no default value was provided.N)�nextr� � StopIteration�_markerr� )r� �default�er� r� r� rJ � s ����rJ c C st z#t | t�r| d W S t| d�rtdkrtt| ��W S t| dd�d W S ttt fy9 |t u r5td��| Y S w )a Return the last item of *iterable*, or *default* if *iterable* is empty. >>> last([0, 1, 2, 3]) 3 >>> last([], 'some default') 'some default' If *default* is not provided and there are no items in the iterable, raise ``ValueError``. ����__reversed__i� r, ��maxlenzDlast() was called on an empty iterable, and no default was provided.)� isinstancer �hasattrr) r� �reversedr � IndexError� TypeErrorr� r� r� )r� r� r� r� r� rU � s ��rU c C s t t| |d �|d�S )ag Return the nth or the last item of *iterable*, or *default* if *iterable* is empty. >>> nth_or_last([0, 1, 2, 3], 2) 2 >>> nth_or_last([0, 1], 2) 1 >>> nth_or_last([], 0, 'some default') 'some default' If *default* is not provided and there are no items in the iterable, raise ``ValueError``. r, �r� )rU r )r� r� r� r� r� r� r\ � s r\ c @ sT e Zd ZdZdd� Zdd� Zdd� Zefdd �Zd d� Z dd � Z dd� Zdd� ZdS )re a Wrap an iterator to allow lookahead and prepending elements. Call :meth:`peek` on the result to get the value that will be returned by :func:`next`. This won't advance the iterator: >>> p = peekable(['a', 'b']) >>> p.peek() 'a' >>> next(p) 'a' Pass :meth:`peek` a default value to return that instead of raising ``StopIteration`` when the iterator is exhausted. >>> p = peekable([]) >>> p.peek('hi') 'hi' peekables also offer a :meth:`prepend` method, which "inserts" items at the head of the iterable: >>> p = peekable([1, 2, 3]) >>> p.prepend(10, 11, 12) >>> next(p) 10 >>> p.peek() 11 >>> list(p) [11, 12, 1, 2, 3] peekables can be indexed. Index 0 is the item that will be returned by :func:`next`, index 1 is the item after that, and so on: The values up to the given index will be cached. >>> p = peekable(['a', 'b', 'c', 'd']) >>> p[0] 'a' >>> p[1] 'b' >>> next(p) 'a' Negative indexes are supported, but be aware that they will cache the remaining items in the source iterator, which may require significant storage. To check whether a peekable is exhausted, check its truth value: >>> p = peekable(['a', 'b']) >>> if p: # peekable has items ... list(p) ['a', 'b'] >>> if not p: # peekable is exhausted ... list(p) [] c C s t |�| _t� | _d S �N)r� �_itr �_cache��selfr� r� r� r� �__init__, s zpeekable.__init__c C � | S r� r� �r� r� r� r� �__iter__0 � zpeekable.__iter__c C �$ z| � � W dS ty Y dS w �NFT��peekr� r� r� r� r� �__bool__3 � ��zpeekable.__bool__c C sH | j sz| j �t| j�� W n ty |tu r� | Y S w | j d S )z�Return the item that will be next returned from ``next()``. Return ``default`` if there are no items left. If ``default`` is not provided, raise ``StopIteration``. r )r� �appendr� r� r� r� )r� r� r� r� r� r� : s � z peekable.peekc G s | j �t|�� dS )a Stack up items to be the next ones returned from ``next()`` or ``self.peek()``. The items will be returned in first in, first out order:: >>> p = peekable([1, 2, 3]) >>> p.prepend(10, 11, 12) >>> next(p) 10 >>> list(p) [11, 12, 1, 2, 3] It is possible, by prepending items, to "resurrect" a peekable that previously raised ``StopIteration``. >>> p = peekable([]) >>> next(p) Traceback (most recent call last): ... StopIteration >>> p.prepend(1) >>> next(p) 1 >>> next(p) Traceback (most recent call last): ... StopIteration N)r� � extendleftr� )r� �itemsr� r� r� �prependJ s zpeekable.prependc C s | j r| j �� S t| j�S r� )r� �popleftr� r� r� r� r� r� �__next__i s zpeekable.__next__c C s� |j d u rdn|j }|dkr#|jd u rdn|j}|jd u rtn|j}n |dk r?|jd u r.dn|j}|jd u r;t d n|j}ntd��|dk sK|dk rS| j�| j� ntt ||�d t�}t | j�}||krr| j�t| j|| �� t| j�| S )Nr, r r� zslice step cannot be zero) �step�start�stopr* r� r� �extendr� �min�maxr� r �list)r� �indexr� r� r� r� � cache_lenr� r� r� � _get_sliceo s zpeekable._get_slicec C sd t |t�r | �|�S t| j�}|dk r| j�| j� n||kr-| j�t| j|d | �� | j| S �Nr r, )r� �slicer� r� r� r� r� r )r� r� r� r� r� r� �__getitem__� s zpeekable.__getitem__N) �__name__� __module__�__qualname__�__doc__r� r� r� r� r� r� r� r� r� r� r� r� r� re � s :re c O s t �dt� t| i |��S )a� Return a sorted merge of the items from each of several already-sorted *iterables*. >>> list(collate('ACDZ', 'AZ', 'JKL')) ['A', 'A', 'C', 'D', 'J', 'K', 'L', 'Z', 'Z'] Works lazily, keeping only the next value from each iterable in memory. Use :func:`collate` to, for example, perform a n-way mergesort of items that don't fit in memory. If a *key* function is specified, the iterables will be sorted according to its result: >>> key = lambda s: int(s) # Sort by numeric value, not by string >>> list(collate(['1', '10'], ['2', '11'], key=key)) ['1', '2', '10', '11'] If the *iterables* are sorted in descending order, set *reverse* to ``True``: >>> list(collate([5, 3, 1], [4, 2, 0], reverse=True)) [5, 4, 3, 2, 1, 0] If the elements of the passed-in iterables are out of order, you might get unexpected results. On Python 3.5+, this function is an alias for :func:`heapq.merge`. z<collate is no longer part of more_itertools, use heapq.merge)�warnings�warn�DeprecationWarningr )� iterables�kwargsr� r� r� r= � s �r= c s t � �� fdd��}|S )ab Decorator that automatically advances a PEP-342-style "reverse iterator" to its first yield point so you don't have to call ``next()`` on it manually. >>> @consumer ... def tally(): ... i = 0 ... while True: ... print('Thing number %s is %s.' % (i, (yield))) ... i += 1 ... >>> t = tally() >>> t.send('red') Thing number 0 is red. >>> t.send('fish') Thing number 1 is fish. Without the decorator, you would have to call ``next(t)`` before ``t.send()`` could be used. c s � | i |��}t |� |S r� )r� )�argsr� �gen��funcr� r� �wrapper� s zconsumer.<locals>.wrapper)r )r� r� r� r� r� r? � s r? c C s t � }tt| |�dd� t|�S )z�Return the number of items in *iterable*. >>> ilen(x for x in range(1000000) if x % 3 == 0) 333334 This consumes the iterable, so handle with care. r r� )r r �zipr� )r� �counterr� r� r� rL � s rL c c s � |V | |�}q)z�Return ``start``, ``func(start)``, ``func(func(start))``, ... >>> from itertools import islice >>> list(islice(iterate(lambda x: 2*x, 1), 10)) [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] r� )r� r� r� r� r� rR � s ��rR c c s6 � | �}|E dH W d � dS 1 sw Y dS )a: Wrap an iterable in a ``with`` statement, so it closes once exhausted. For example, this will close the file when the iterator is exhausted:: upper_lines = (line.upper() for line in with_iter(open('foo'))) Any context manager which returns an iterable is a candidate for ``with_iter``. Nr� )�context_managerr� r� r� r� r� � s �"�r� c C sv t | �}zt|�}W n ty } z|ptd�|�d}~ww zt|�}W n ty. Y |S w d�||�}|p:t|��)a� Return the first item from *iterable*, which is expected to contain only that item. Raise an exception if *iterable* is empty or has more than one item. :func:`one` is useful for ensuring that an iterable contains only one item. For example, it can be used to retrieve the result of a database query that is expected to return a single row. If *iterable* is empty, ``ValueError`` will be raised. You may specify a different exception with the *too_short* keyword: >>> it = [] >>> one(it) # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... ValueError: too many items in iterable (expected 1)' >>> too_short = IndexError('too few items') >>> one(it, too_short=too_short) # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... IndexError: too few items Similarly, if *iterable* contains more than one item, ``ValueError`` will be raised. You may specify a different exception with the *too_long* keyword: >>> it = ['too', 'many'] >>> one(it) # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... ValueError: Expected exactly one item in iterable, but got 'too', 'many', and perhaps more. >>> too_long = RuntimeError >>> one(it, too_long=too_long) # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... RuntimeError Note that :func:`one` attempts to advance *iterable* twice to ensure there is only one item. See :func:`spy` or :func:`peekable` to check iterable contents less destructively. z&too few items in iterable (expected 1)N�LExpected exactly one item in iterable, but got {!r}, {!r}, and perhaps more.)r� r� r� r� �format)r� � too_short�too_long�it�first_valuer� �second_value�msgr� r� r� r` s&