https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/duplicity/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/duplicity/__pycache__/lazy.cpython-310.pyc
o

�~�_L;�@s�dZddlmZddlmZddlmZddlmZddlmZddlZddl	m
Z
dd	l	mZdd
l	mZGdd�de�Z
Gd
d�de�ZGdd�de�ZGdd�de�ZdS)z=Define some lazy data structures and functions acting on them�)�print_function)�map)�next)�range)�objectN)�log)�robust)�utilc@s�eZdZdZedd��Zedd��Zedd��Zedd	��Zed
d��Z	edd
��Z
eddd�fdd��Zedd��Zedd��Z
edd��Zedd��Zedd��Zeddd��ZdS) �Iterz:Hold static methods for the manipulation of lazy iteratorsccs�|D]	}||�r|VqdS)z5Like filter in a lazy functional programming languageN�)�	predicate�iterator�irr�0/usr/lib/python3/dist-packages/duplicity/lazy.py�filter)s���zIter.filterccs�|D]}||�VqdS)z2Like map in a lazy functional programming languageNr��functionr
rrrrr0s��zIter.mapcCs|D]}||�qdS)z(Run function on each element in iteratorNrrrrr�foreach6s
�zIter.foreachcg� �|D]
}|D]}|VqqdS)zLazily concatenate iteratorsNr)�iters�iterrrrr�cat<����zIter.catccr)z6Lazily concatenate iterators, iterated by big iteratorNr)�
iter_of_itersrrrrr�cat2Crz	Iter.cat2cCs|D]}dSdS)zTrue if iterator has length 0N�r�rrrrr�emptyJsz
Iter.emptyNcCs||kS�Nr)�x�yrrr�<lambda>Rsz
Iter.<lambda>c	Cs�|D]/}zt|�}Wnty|rtd|f�YdSw|||�s1|r.td||f�dSqzt|�}Wn
tyBYdSw|rLtd|f�dS)zxTrue if iterator 1 has same elements as iterator 2

        Use equality operator, or == if it is unspecified.

        zEnd when i1 = %sNz%s not equal to %srzEnd when i2 = %s)r�
StopIteration�print)�iter1�iter2�verbose�operator�i1�i2rrr�equalQs*�
��z
Iter.equalcCsd}|D]}|r|Sq|S)z:True if any element in iterator is true.  Short circuitingNrrrrr�Ork��zIter.OrcCsd}|D]}|s|Sq|S)z<True if all elements in iterator are true.  Short circuitingrrrrrr�Andtr,zIter.AndcCs4d}	zt|�Wnty|YSw|d}q)zReturn length of iteratorrr�rr"rrrr�len}s��zIter.lencCs8zt|�}Wnty|YSw||t�|||��S)z0foldr the "fundamental list recursion operator"?)rr"r
�foldr��f�defaultr�	next_itemrrrr0�s�z
Iter.foldrcCs2	zt|�}Wnty|YSw|||�}q)z)the fundamental list iteration operator..r.r1rrr�foldl�s�
�z
Iter.foldlcs��dkr�s�st��}|��|��fS�sdd���s dd��g�dg���dd��dg���������fdd���fd	d
�}tt|tt�����S)axSplit a single iterater into a number of streams

        The return val will be a list with length num_of_forks, each
        of which will be an iterator like iter.  final_func is the
        function that will be called on each element in iter just as
        it is being removed from the buffer.  closing_func is called
        when all the streams are finished.

        �cS�dSrr)rrrrr!��z Iter.multiplex.<locals>.<lambda>cSr7rrrrrrr!�r8���Ncs��|dkr8z
��dt���Wnty(��kr&�ds&��d�d<t�wt��D]
}�|d7<q-��|}�|d8<t��}|d�vrg�||dksZJ���|d��|d=|S)z-Return the next element requested by fork_numr9rNrr6)�insertrr"rr/)�fork_numr�
return_val�blen)�buffer�called_closing_func�closing_func�
final_func�forkpositionr�num_of_forks�starting_forkpositionrr�get_next�s*��
z Iter.multiplex.<locals>.get_nextc3s.�	z�|�}Wn
tyYdSw|Vqr)r")r;�ret)rErr�
make_iterator�s���z%Iter.multiplex.<locals>.make_iterator)�IterMultiplex2�yielda�yieldb�tupler�listr)rrCrAr@�im2rGr)	r>r?r@rArBrErrCrDr�	multiplex�s
zIter.multiplex)NN)�__name__�
__module__�__qualname__�__doc__�staticmethodrrrrrrr*r+r-r/r0r5rNrrrrr
&s8











	r
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rHz�Multiplex an iterator into 2 parts

    This is a special optimized case of the Iter.multiplex function,
    used when there is no closing_func or final_func, and we only want
    to split it into 2.  By profiling, this is a time sensitive class.

    cCsd|_g|_||_dS)Nr)�a_leading_byr>r)�selfrrrr�__init__�s
zIterMultiplex2.__init__ccsj�|j|j}}	|jdkr%zt|�}Wn
tyYdSw|�|�n|�d�}|jd7_|Vq	)zReturn first iteratorrrN�r>rrTrr"�append�pop�rU�bufr�elemrrrrI���
�
�zIterMultiplex2.yieldaccsj�|j|j}}	|jdkr%zt|�}Wn
tyYdSw|�|�n|�d�}|jd8_|Vq	)zReturn second iteratorrrNrWrZrrrrJ�r]zIterMultiplex2.yieldbN)rOrPrQrRrVrIrJrrrrrH�s
rHc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�IterTreeReduceraHTree style reducer object for iterator - stolen from rdiff-backup

    The indicies of a RORPIter form a tree type structure.  This class
    can be used on each element of an iter in sequence and the result
    will be as if the corresponding tree was reduced.  This tries to
    bridge the gap between the tree nature of directories, and the
    iterator nature of the connection between hosts and the temporal
    order in which the files are processed.

    This will usually be used by subclassing ITRBranch below and then
    call the initializer below with the new class.

    cCs*||_||_d|_||�|_|jg|_dS)zITR initializerN)�branch_class�branch_args�index�root_branch�branches)rUr_r`rrrrVs

zIterTreeReducer.__init__cCsV|j}	|d}|j}||dt|��kr(|��|d=|s dS|d�|�ndSq)aRun Finish() on all branches index has passed

        When we pass out of a branch, delete it and process it with
        the parent.  The innermost branches will be the last in the
        list.  Return None if we are out of the entire tree, and 1
        otherwise.

        rr9N)rc�
base_indexr/�
call_end_proc�branch_process)rUrarc�to_be_finishedrdrrr�finish_branches#s	�zIterTreeReducer.finish_branchescCs|j|j�}|j�|�|S)z;Return branch of type self.branch_class, add to branch list)r_r`rcrX�rU�branchrrr�
add_branch:szIterTreeReducer.add_branchcCs(t�|j|j|�|jsd|_||_dS)z"Run start_process on latest branchrN)r�check_common_error�on_error�
start_process�caught_exception�start_successfulrd)rUrarj�argsrrr�process_w_branch@s�
z IterTreeReducer.process_w_branchcCs0	|j��}|��|jsdS|jd�|�q)z,Call at end of sequence to tie everything uprr9N)rcrYrerf)rUrgrrr�FinishHs
�zIterTreeReducer.FinishcGs�|d}|jdur|�||j|�||_dS||jkr/t�td�t�|j�t�|�f�dS|�|�dur8dS|j	d}|j
r[|j|�rOt�
|j|j|�n|��}|�|||�n|�|�||_dS)adProcess args, where args[0] is current position in iterator

        Returns true if args successfully processed, false if index is
        not in the current tree and thus the final result is
        available.

        Also note below we set self.index after doing the necessary
        start processing, in case there is a crash in the middle.

        rNrz#Warning: oldindex %s >= newindex %sr9)rarrrbr�Warn�_r	�uindexrhrcrp�can_fast_processrrlrm�fast_processrk�log_prev_error)rUrqra�last_branchrjrrr�__call__Qs.


�

�
zIterTreeReducer.__call__N)
rOrPrQrRrVrhrkrrrsr{rrrrr^
s
	r^c@sdeZdZdZdZZdZdZZdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�ZdS)�	ITRBranchaHelper class for IterTreeReducer above

    There are five stub functions below: start_process, end_process,
    branch_process, fast_process, and can_fast_process.  A class that
    subclasses this one will probably fill in these functions to do
    more.

    NcCs,|js|js	d|_t�|j|j�d|_dS)z1Runs the end_process on self, checking for errorsrN)�finishedrprorrlrm�end_process�rUrrrre�s
zITRBranch.call_end_proccG�dS)z!Do some initial processing (stub)Nr�rUrqrrrrn��zITRBranch.start_processcCr�)z4Do any final processing before leaving branch (stub)Nrrrrrr~�r�zITRBranch.end_processcCs|jsJ�dS)z2Process a branch right after it is finished (stub)N)r}rirrrrf�s
zITRBranch.branch_processcGr�)z9True if object can be processed without new branch (stub)Nrr�rrrrw�r�zITRBranch.can_fast_processcGr�)z,Process args without new child branch (stub)Nrr�rrrrx�r�zITRBranch.fast_processcGszd|_|r|drt|dt�rtjj|d�}n
|jr$tjj|j�}nd}t�t	d�|t
�|�ftjj
t
�|��dS)z1This is run on any exception in start/end-processrr�.zError '%s' processing %sN)ro�
isinstancerK�os�path�joinrarrtrur	�fsdecode�WarningCode�cannot_process�escape)rU�excrq�filenamerrrrm�s�zITRBranch.on_errorcCs@|sd}ntjj|�}t�td�t�|�tjj	t�
|��dS)z%Call function if no pending exceptionr�z%Skipping %s because of previous errorN)r�r�r�rrtrur	r�r��process_skippedr�)rUra�	index_strrrrry�s�zITRBranch.log_prev_error)rOrPrQrRrdrar}rorprernr~rfrwrxrmryrrrrr|xs
r|)rR�
__future__r�builtinsrrrrr��	duplicityrrr	r
rHr^r|rrrr�<module>s80k

https://t.me/RX1948 - 2025