File: //opt/saltstack/salt/lib/python3.10/site-packages/more_itertools/__pycache__/more.cpython-310.pyc
o
�N�g�! � @ sn d dl mZ d dlmZmZmZ d dlmZmZ d dl m
Z
d dlmZm
Z
mZmZmZmZmZmZmZmZmZ d dlmZmZmZmZ d dlmZmZ zd dlm Z W n e!yc d dlm Z Y nw d d l"m#Z#m$Z$m%Z% d d
l&m'Z'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/ g d
�Z0e1� Z2dd� Z3e2fdd�Z4e2fdd�Z5G dd� de1�Z6dd� Z7dd� Z8edkr�e8j9Z:ee
�Z8e:e8_9dd� Z;dd� Z<dd � Z=d!d"� Z>d�d$d%�Z?d&d'� Z@d�d(d)�ZAd*d+� ZBd�d,d-�ZCd�d.d/�ZDG d0d1� d1e1�ZEd�d2d3�ZFd4d5� ZGd6d7� ZHd�d8d9�ZId�d:d;�ZJd<d=� ZKd>d?� ZLd@dA� ZMdBdC� ZNdDdE� ZOd�dGdH�ZPdIdJ� ZQd�dLdM�ZRdNdO� ZSd�dQdR�ZTdSdT� ZUdUdV� ZVe%e#ffdWdX�ZWd�dYdZ�ZXd�d[d\�ZYd]d^� ZZd�d_d`�Z[e\d#fdadb�Z]dcdd� Z^dedf� Z_dgdh� Z`didj� Zadkdl� Zbdmdn� fdodp�Zcefdqdr�ZdG dsdt� dte �ZeG dudv� dve1�ZfG dwdx� dxe1�Zge\fdydz�Zhd{d|� ZidPd}d~�Zjd�dd��Zke\d#fd�d��Zld�d�d��Zmd#S )�� )�print_function)�Counter�defaultdict�deque)�partial�wraps)�merge)�chain�compress�count�cycle� dropwhile�groupby�islice�repeat�starmap� takewhile�tee)�
itemgetter�lt�gt�sub)�maxsize�version_info)�Sequence)�binary_type�string_types� text_type)�filter�map�range�zip�zip_longest� )�consume�flatten�take)7�adjacent�always_iterable�always_reversible�bucket�chunked�circular_shifts�collapse�collate�consecutive_groups�consumer�count_cycle�
difference�distinct_permutations�
distribute�divide� exactly_n�first�groupby_transform�ilen�interleave_longest�
interleave�intersperse�islice_extended�iterate�last�locate�lstrip�make_decorator�
map_reduce�
numeric_range�one�padded�peekable�replace�rlocate�rstrip�
run_length�seekable�SequenceView�side_effect�sliced�
sort_together�split_at�split_after�split_before�
split_into�spy�stagger�strip�
substrings�unique_to_each�unzip�windowed� with_iter�
zip_offsetc C s t tt|t | ��g �S )a� Break *iterable* into lists of length *n*:
>>> list(chunked([1, 2, 3, 4, 5, 6], 3))
[[1, 2, 3], [4, 5, 6]]
If the length of *iterable* is not evenly divisible by *n*, the last
returned list will be shorter:
>>> 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.
:func:`chunked` is useful for splitting up a computation on a large number
of keys into batches, to be pickled and sent off to worker processes. One
example is operations on rows in MySQL, which does not implement
server-side cursors properly and would otherwise load the entire dataset
into RAM on the client.
)�iterr r&