%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/duplicity/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/duplicity/__pycache__/lazy.cpython-312.pyc

�

�2ec:���dZddlZddlZddlmZddlmZddlmZGd�de�ZGd�d	e�Z	Gd
�de�Z
Gd�d
e�Zy)z=Define some lazy data structures and functions acting on them�N)�log)�robust)�utilc���eZdZdZed��Zed��Zed��Zed��Zed��Z	ed��Z
edd	�fd
��Zed��Zed��Z
ed
��Zed��Zed��Zedd��Zy)�Iterz:Hold static methods for the manipulation of lazy iteratorsc#�4K�|D]}||�s�|���y�w)z5Like filter in a lazy functional programming languageN�)�	predicate�iterator�is   �0/usr/lib/python3/dist-packages/duplicity/lazy.py�filterzIter.filter#s#�����	�A���|���	�s��c#�.K�|D]}||����y�w)z2Like map in a lazy functional programming languageNr	��functionrrs   r
�mapzIter.map*s!�����	�A��1�+��	�s�c�"�|D]
}||��y)z(Run function on each element in iteratorNr	rs   r
�foreachzIter.foreach0s���	�A��Q�K�	�c'�0K�|D]
}|D]}|����y�w)zLazily concatenate iteratorsNr	)�iters�iterrs   r
�catzIter.cat6s+�����	�D��
����
�	���c#�0K�|D]
}|D]}|����y�w)z6Lazily concatenate iterators, iterated by big iteratorNr	)�
iter_of_itersrrs   r
�cat2z	Iter.cat2=s+����"�	�D��
����
�	�rc��|D]}yy)zTrue if iterator has length 0N�r	�rrs  r
�emptyz
Iter.emptyDs���	�A��	�rNc��||k(S�Nr	)�x�ys  r
�<lambda>z
Iter.<lambda>Ls
���Q��rc�Z�|D];}	t|�}|||�r�|r t|�d|��tj��y	t|�}|rtd|��tj��y#t$r$|rtd|��tj��YywxYw#t$rYywxYw)zxTrue if iterator 1 has same elements as iterator 2

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

        zEnd when i1 = )�fileNz not equal to rzEnd when i2 = )�next�
StopIteration�print�sys�stderr)�iter1�iter2�verbose�operator�i1�i2s      r
�equalz
Iter.equalKs����
	�B�
��%�[��
�B��#���R�D��r�d�3�#�*�*�E��
	�	��e��B���N�2�$�'�c�j�j�9���!�
���N�2�$�/�c�j�j�A��
���	��	�s#�A.�B�.)B�B�	B*�)B*c�$�d}|D]}|s�|cS|S)z:True if any element in iterator is true.  Short circuitingNr	r s  r
�OrzIter.Ores'��
���	�A����	��rc�$�d}|D]}|r�|cS|S)z<True if all elements in iterator are true.  Short circuitingrr	r s  r
�AndzIter.Andns'��
���	�A����	��rc�N�d}		t|�|dz}�#t$r|cYSwxYw)zReturn length of iteratorrr�r)r*r s  r
�lenzIter.lenws>��
���
��T�
��A��A���!�
���
�s��$�$c�x�	t|�}||tj|||��S#t$r|cYSwxYw)z0foldr the "fundamental list recursion operator"?)r)r*r�foldr��f�defaultr�	next_items    r
r=z
Iter.foldr�sB��	��T�
�I���D�J�J�q�'�4�8�9�9���	��N�	�s�+�9�9c�R�		t|�}|||�}�#t$r|cYSwxYw)z)the fundamental list iteration operator..r:r>s    r
�foldlz
Iter.foldl�s>���
� ��J�	����+�G���!�
���
�s��&�&c���������	�
��dk(r/�s-�s+t��}|j�|j�fS�sd���sd��g�dg�z�
�
dd�dg���������
fd��	�	fd�}tt	|t����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.

        �c��yr#r	)rs r
r&z Iter.multiplex.<locals>.<lambda>���rc��yr#r	r	rr
r&z Iter.multiplex.<locals>.<lambda>�rGr���Nc�l���|dk(r9	�jdt�	��t�
�D]}�|xxdz
cc<���|}�|xxdzcc<t	��}|dz
�vr!�||dz
k(sJ���|dz
��|dz
=|S#t$r��k(r�ds��d�d<t�wxYw)z-Return the next element requested by fork_numrIrNrrE)�insertr)r*�ranger;)�fork_numr�
return_val�blen�buffer�called_closing_func�closing_func�
final_func�forkpositionr�num_of_forks�starting_forkpositions    ��������r
�get_nextz Iter.multiplex.<locals>.get_next�s�����H�%��+�(��M�M�!�T�$�Z�0��|�,�)�A� ��O�q�(�O�)� ��X� 6�7�J���"�a�'�"��v�;�D��1�H��-�#�H�-����9�9�9��6�$��(�+�,��4�!�8�$����%%�(�#�'<�<�EX�YZ�E[�$��15�+�A�.�'�'�(�s�B
�
&B3c3�H�K�		�|�}|���#t$rYywxYw�wr#)r*)rM�retrWs  �r
�
make_iteratorz%Iter.multiplex.<locals>.make_iterator�s8�������"�8�,�C��	���%����s�"��"�	�"��")�IterMultiplex2�yielda�yieldb�tuplerrL)rrUrSrR�im2rZrPrQrTrWrVs````  @@@@@r
�	multiplexzIter.multiplex�s������1��Z�� ��&�C��:�:�<�����-�-��'�J��'�L���"$��|� 3��,�Q�/��#�f��	�	�2	��S���l�(;�<�=�=r)NN)�__name__�
__module__�__qualname__�__doc__�staticmethodrrrrrr!r4r6r8r;r=rCr`r	rr
rr s
��D���������
����
�������������$(�3F����2�������������:��:��,��,��=>��=>rrc�"�eZdZdZd�Zd�Zd�Zy)r[z�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.

    c�.�d|_g|_||_y)Nr)�a_leading_byrPr)�selfrs  r
�__init__zIterMultiplex2.__init__�s����������	rc#�
K�|j|j}}	|jdk\r	t|�}|j|�n|j
d�}|xjdz
c_|���X#t$rYywxYw�w)zReturn first iteratorrNr�rPrrhr)r*�append�pop�ri�bufr�elems    r
r\zIterMultiplex2.yielda�������K�K����T���� � �A�%����:�D��
�
�4� ��w�w�q�z������"���J���
%�����'�)B�A4�=B�4	B�=B�?B�Bc#�
K�|j|j}}	|jdkr	t|�}|j|�n|j
d�}|xjdzc_|���X#t$rYywxYw�w)zReturn second iteratorrNrrlros    r
r]zIterMultiplex2.yieldb�rrrsN)rarbrcrdrjr\r]r	rr
r[r[�s����
�"rr[c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�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.

    c�f�||_||_d|_||�|_|jg|_y)zITR initializerN)�branch_class�branch_args�index�root_branch�branches)rirxrys   r
rjzIterTreeReducer.__init__s6��(���&�����
�'��5����)�)�*��
rc��|j}	|d}|j}||dt|�k7r+|j�|d=|sy|dj	|�ny�O)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.

        rINr)r|�
base_indexr;�
call_end_proc�branch_process)rirzr|�to_be_finishedr~s     r
�finish_brancheszIterTreeReducer.finish_branchessk���=�=���%�b�\�N�'�2�2�J��U�#4�S��_�5�5��,�,�.��R�L������+�+�N�;��rc�n�|j|j�}|jj|�|S)z;Return branch of type self.branch_class, add to branch list)rxryr|rm�ri�branchs  r
�
add_branchzIterTreeReducer.add_branch5s1��"��"�"�D�$4�$4�5���
�
���V�$��
rc��tj|j|j|�|jsd|_||_y)z"Run start_process on latest branchrN)r�check_common_error�on_error�
start_process�caught_exception�start_successfulr~)rirzr��argss    r
�process_w_branchz IterTreeReducer.process_w_branch;s7���!�!�&�/�/�6�3G�3G��N��&�&�&'�F�#�!��rc��	|jj�}|j�|jsy|jdj|��V)z,Call at end of sequence to tie everything uprIN)r|rnrr�)rir�s  r
�FinishzIterTreeReducer.FinishBsI���!�]�]�.�.�0�N��(�(�*��=�=���M�M�"��,�,�^�<�rc��|d}|j�%|j||j|�||_y||jkrTtjtd�t
j|j�t
j|�fz�y|j|��y|jd}|jrm|j|�r3tj|j|j|�||_y|j!�}|j|||�||_y|j#|�||_y)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 %srI)rzr�r{r�Warn�_r�uindexr�r|r��can_fast_processrr�r��fast_processr��log_prev_error)rir�rz�last_branchr�s     r
�__call__zIterTreeReducer.__call__Ks*���Q����:�:���!�!�%��)9�)9�4�@��D�J���D�J�J���H�H�Q�<�=����T�Z�Z�AX�Z^�Ze�Ze�fk�Zl�@m�m�n������&�.���m�m�B�'���'�'�+�{�+�+�T�2��)�)�+�*>�*>��@X�@X�Z^�_���
��
���*���%�%�e�V�T�:���
��
�&�&�u�-���
�rN)
rarbrcrdrjr�r�r�r�r�r	rr
rvrvs%���+��.�"�=�"rrvc�T�eZdZdZdxZZdZdxZZd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zy)�	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.

    Nc��|js|jsd|_tj|j
|j�d|_y)z1Runs the end_process on self, checking for errorsrN)�finishedr�r�rr�r��end_process�ris r
rzITRBranch.call_end_proc~s<���=�=�� 5� 5�$%�D�!�	�!�!�$�-�-��1A�1A�B���
rc��y)z!Do some initial processing (stub)Nr	�rir�s  r
r�zITRBranch.start_process����rc��y)z4Do any final processing before leaving branch (stub)Nr	r�s r
r�zITRBranch.end_process�r�rc� �|jsJ�y)z2Process a branch right after it is finished (stub)N)r�r�s  r
r�zITRBranch.branch_process�s�������rc��y)z9True if object can be processed without new branch (stub)Nr	r�s  r
r�zITRBranch.can_fast_process�s��rc��y)z,Process args without new child branch (stub)Nr	r�s  r
r�zITRBranch.fast_process�r�rc��d|_|r8|dr3t|dt�r tjj
|d�}n5|jr'tjj
|j�}nd}tjtd�|tj|�fztjjtj|��y)z1This is run on any exception in start/end-processrr�.zError '%s' processing %sN)r��
isinstancer^�os�path�joinrzrr�r��fsdecode�WarningCode�cannot_processr�escape)ri�excr��filenames    r
r�zITRBranch.on_error�s��� !����D��G�
�4��7�E� :��w�w�|�|�T�!�W�-�H�
�Z�Z��w�w�|�|�T�Z�Z�0�H��H����
�(�)�S�"�+�+�h�2G�,H�H��O�O�*�*��K�K��!�	
rc��|sd}ntjj|�}tjtd�tj|�ztjjtj|��y)z%Call function if no pending exceptionr�z%Skipping %s because of previous errorN)r�r�r�rr�r�r�r��process_skippedrr�)rirz�	index_strs   r
r�zITRBranch.log_prev_error�sX����I������e�,�I����
�5�6����Y�9O�O��O�O�+�+��K�K�	�"�	
r)rarbrcrdr~rzr�r�r�rr�r�r�r�r�r�r�r	rr
r�r�psL�����J���H�*.�.��'�	�
�
�
�
�
�

�

rr�)rdr�r,�	duplicityrrr�objectrr[rvr�r	rr
�<module>r�sS��,D�	�
����s>�6�s>�l.�V�.�bf�f�f�RG
��G
r

Zerion Mini Shell 1.0