golden hour
/opt/saltstack/salt/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__pycache__
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.cpython-310.pyc
331 B
Del
OK
more.cpython-310.pyc
122.63 KB
Del
OK
recipes.cpython-310.pyc
26.15 KB
Del
OK
Edit: recipes.cpython-310.pyc
o �xeHc � @ s^ d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z ddl mZmZm Z mZmZmZmZmZmZmZmZmZ ddlmZmZmZ ddlmZ g d �Ze� Zd d� Z dddd �Z!dd� Z"dedd�Z#dedd�Z$dd� Z%e&fdd�Z'dd� Z(e(Z)dd� Z*dd� Z+dd� Z,ded d!�Z-d"d#� Z.zdd$l m/Z0 W n e1y� e.Z/Y n w d%d&� Z/e.j e/_ G d'd(� d(e2�Z3d)d*� Z4d+d,� Z5dfd.d/�Z6d0d1� Z7d2d3� Z8d4d5� Z9ded6d7�Z:ded8d9�Z;ded:d;�Z<dgd<d=�Z=d>d?�d@dA�Z>dedBdC�Z?dDdE� Z@dFdG� ZAdHdI� ZBdJdK� ZCdLdM� ZDdNdO� ZEdPdQ� ZFdRdS� ZGdTdU� ZHdVdW� ZIdddXdY�ZJdZd[� ZKd\d]� ZLd^d_� ZMd`da� ZNdbdc� ZOdS )ha Imported from the recipes section of the itertools documentation. All functions taken from the recipes section of the itertools library docs [1]_. Some backward-compatible usability improvements have been made. .. [1] http://docs.python.org/library/itertools.html#recipes � N)�deque)�Sized)�reduce)�chain�combinations�compress�count�cycle�groupby�islice�product�repeat�starmap�tee�zip_longest)� randrange�sample�choice)� hexversion)(� all_equal�batched�before_and_after�consume�convolve� dotproduct� first_true�factor�flatten�grouper�iter_except� iter_index�matmul�ncycles�nth�nth_combination�padnone�pad_none�pairwise� partition�polynomial_from_roots�powerset�prepend�quantify�#random_combination_with_replacement�random_combination�random_permutation�random_product� repeatfunc� roundrobin�sieve�sliding_window� subslices�tabulate�tail�take� transpose� triplewise�unique_everseen�unique_justseenc C � t t|| ��S )z�Return first *n* items of the iterable as a list. >>> take(3, range(10)) [0, 1, 2] If there are fewer than *n* items in the iterable, all of them are returned. >>> take(10, range(3)) [0, 1, 2] )�listr ��n�iterable� rB �`/opt/saltstack/salt/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/recipes.pyr8 P s r8 c C s t | t|��S )a� Return an iterator over the results of ``func(start)``, ``func(start + 1)``, ``func(start + 2)``... *func* should be a function that accepts one integer argument. If *start* is not specified it defaults to 0. It will be incremented each time the iterator is advanced. >>> square = lambda x: x ** 2 >>> iterator = tabulate(square, -3) >>> take(4, iterator) [9, 4, 1, 0] )�mapr )�function�startrB rB rC r6 ` s r6 c c sJ � t |t�rt|tdt|�| �d�E dH dS tt|| d��E dH dS )z�Return an iterator over the last *n* items of *iterable*. >>> t = tail(3, 'ABCDEFG') >>> list(t) ['E', 'F', 'G'] r N��maxlen)� isinstancer r �max�len�iterr r? rB rB rC r7 r s � $r7 c C s. |du rt | dd� dS tt| ||�d� dS )aX 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 rG )r �nextr )�iteratorr@ rB rB rC r � s r c C s t t| |d�|�S )z�Returns the nth item or a default value. >>> l = range(10) >>> nth(l, 3) 3 >>> nth(l, 20, "zebra") 'zebra' N)rM r )rA r@ �defaultrB rB rC r# � s r# c C s t | �}t|d�ot|d� S )z� Returns ``True`` if all the elements are equal to each other. >>> all_equal('aaaa') True >>> all_equal('aaab') False TF)r rM )rA �grB rB rC r � s r c C r= )zcReturn the how many times the predicate is true. >>> quantify([True, False, True]) 2 )�sumrD )rA �predrB rB rC r, � s r, c C s t | td��S )a Returns the sequence of elements and then returns ``None`` indefinitely. >>> take(5, pad_none(range(3))) [0, 1, 2, None, None] Useful for emulating the behavior of the built-in :func:`map` function. See also :func:`padded`. N)r r �rA rB rB rC r&