Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/more_itertools/__pycache__/more.cpython-39.pyc
Ðазад
a g�h/\ � @ s� d dl Z d dlZd dlmZmZmZmZ d dlmZ d dl m Z d dlmZm Z mZmZ d dlmZmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z! d dl m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ d d l,m-Z-m.Z. d d l/m/Z/m0Z0m1Z1m2Z2 d dl3m4Z4m5Z5m6Z6m7Z7m8Z8 d dl9m:Z:m;Z; d d l<m=Z= ddl>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJ g d�ZKzd dl mLZM W n2 eN�y� eOd�dd�ZPdd� ZQdd� ZMY n0 �ddd�ZRe?fdd�ZSe?fdd�ZTe?fd d!�ZUG d"d#� d#�ZVd$d%� ZWd&d'� ZXd(d)� ZYd*d+� ZZ�dd,d-�Z[d.d/� Z\�dd0d1�Z]�dd2d3�Z^�dd4d5�Z_d6d7� Z`�dd8d9�Zad:d;� Zb�dd<d=�ZcG d>d?� d?�Zd�dd@dA�ZedBdC� ZfdDdE� Zg�ddFdG�Zh�ddHdI�Zi�ddJdK�Zj�ddLdM�Zk�ddOdP�Zl�ddQdR�Zm�ddSdT�Zn�d dUdV�ZodWdX� Zp�d!dYdZ�Zq�d"d\d]�Zr�d#d^d_�Zsd`da� Zt�d$dcdd�Zudedf� Zvdddg�dhdi�Zw�d%dkdl�Zxdmdn� Zydodp� Zze{e|ffdqdr�Z}�d&dsdt�Z~�d'dudv�ZG dwdx� dxejej��Z��d(dydz�Z�d{d|� Z�e�dfd}d~�Z�dd�� Z�d�d�� Z�d�d�� Z�d�d�� Z�G d�d�� d��Z�d�d�� Z�d�d�� Z�d�d�� fd�d��Z�e6fdd��d�d��Z�G d�d�� d�e�Z�G d�d�� d��Z�G d�d�� d��Z�e�fd�d��Z��d)d�d��Z��d*d�d��Z��d+d�d��Z�e�dfd�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�� Z�d�d�� Z�d�d�� fd�d��Z�d�d�� Z�d�d�� Z�d�d Z��d/dddÜd�dńZ��d0d�dDŽZ�G d�dɄ d�e��Z�G d�d˄ d˃Z�d�d̈́ Z��d1d�dτZ�d�dф Z�d�dӄ Z�d�dՄ Z�d�dׄ Z�d�dل Z�d�dۄ Z�d�d݄ Z�d�d߄ Z�G d�d� d�Z�d�d� Z�e{e|fdd�d�d�Z��d2d�d�Z��d3d�d�Z��d4d�d�Z��d5d�d�Z�de?d�d�d�Z�de�d�fd�d�Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z�d��d � ZĐd�d� ZŐd�d� ZƐd�d� Zǐd�d� ZȐd �d � Zɐd�d� Zʐd �d� Zːd�d� Z�dS (6 � N)�Counter�defaultdict�deque�abc)�Sequence)�suppress)�cached_property�partial�reduce�wraps)�heapify�heapreplace)�chain�combinations�compress�count�cycle� dropwhile�groupby�islice�repeat�starmap� takewhile�tee�zip_longest�product) �comb�e�exp� factorial�floor�fsum�log�log1p�perm�tau)�Empty�Queue)�random� randrange�shuffle�uniform)� itemgetter�mul�sub�gt�lt)� hexversion�maxsize)� monotonic� )�_marker� _zip_equal�UnequalIterablesError�consume�flatten�nth�powerset�sieve�take�unique_everseen� all_equal�batched)o�AbortThread�SequenceViewr7 �adjacent� all_unique�always_iterable�always_reversible�bucket� callback_iter�chunked�chunked_even�circular_shifts�collapse�combination_index�"combination_with_replacement_index�consecutive_groups�constrained_batches�consumer�count_cycle� countable�dft� difference�distinct_combinations�distinct_permutations� distribute�divide� doublestarmap�duplicates_everseen�duplicates_justseen�classify_unique� exactly_n� filter_except� filter_map�first�gray_product�groupby_transform�ichunked�iequals�idft�ilen� interleave�interleave_evenly�interleave_longest�intersperse� is_sorted�islice_extended�iterate� iter_suppress� join_mappings�last�locate�longest_common_prefix�lstrip�make_decorator� map_except�map_if� map_reduce� mark_ends�minmax�nth_or_last�nth_permutation� nth_prime�nth_product� nth_combination_with_replacement� numeric_range�one�only� outer_product�padded�partial_product� partitions�peekable�permutation_index�powerset_of_sets� product_index�raise_�repeat_each�repeat_last�replace�rlocate�rstrip� run_length�sample�seekable�set_partitions�side_effect�sliced� sort_together�split_after�split_at�split_before� split_into� split_when�spy�stagger�strip� strictly_n� substrings�substrings_indexes�takewhile_inclusive�time_limited�unique_in_window�unique_to_each�unzip�value_chain�windowed�windowed_complete� with_iter� zip_broadcast� zip_equal� zip_offset)�sumprod��xc C s$ | d }||| }| | }||fS )z1Split a float into two half-precision components.g �A� )r� �t�hi�lor� r� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/more_itertools/more.py�dl_split� s r� c C sT t | �\}}t |�\}}|| }|| || }|| }|| | || } || fS )zLossless multiplication.)r� ) r� �yZxx_hiZxx_loZyy_hiZyy_lo�p�q�z�zzr� r� r� �dl_mul� s r� c C s t t�tt| |���S �N)r! r � from_iterable�mapr� )r� r� r� r� r� � _fsumprod� s r� Fc sJ t tt�t | ��g �� |rB�du r*td��� �fdd�}t |� �S � S dS )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 s( � D ]} t | ��krtd��| V qd S )Nziterable is not divisible by n.��len� ValueError)�chunk��iterator�nr� r� �ret� s zchunked.<locals>.ret)�iterr r= r� )�iterabler� �strictr� r� r� r� rI � s rI c C s$ | D ] }| S |t u r td��|S )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.)r5 r� )r� �default�itemr� r� r� ra � s �ra c C sp z>t | t�r| d W S t| d�r.tt| ��W S t| dd�d W S tttfyj |t u rbt d��| Y S 0 dS )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__r4 ��maxlenzJlast() was called on an empty iterable, and no default value was provided.N)� isinstancer �hasattr�next�reversedr � IndexError� TypeError� StopIterationr5 r� )r� r� r� r� r� rq � s �rq 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``. r4 �r� )rq 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 )r� 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 r� )r� �_itr �_cache��selfr� r� r� r� �__init__f s zpeekable.__init__c C s | S r� r� �r� r� r� r� �__iter__j s zpeekable.__iter__c C s&