%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__/dup_threading.cpython-312.pyc

�

�2e��T�dZddlZddlZddlZddlmZd�Zd�Zd�ZGd�de	�Z
y)	z�
Duplicity specific but otherwise generic threading interfaces and
utilities.

(Not called "threading" because we do not want to conflict with
the standard threading module.)
�N)�errorsc�|�|j�	|�|j�S#|j�wxYw)a
    Call fn with lock acquired. Guarantee that lock is released upon
    the return of fn.

    Returns the value returned by fn, or raises the exception raised
    by fn.

    (Lock can actually be anything responding to acquire() and
    release().)
    )�acquire�release)�lock�fns  �9/usr/lib/python3/dist-packages/duplicity/dup_threading.py�	with_lockr
%s*��	�L�L�N���t����������s�)�;c�F�|�s|jd�|�s�yy)a�
    cv   - The threading.Condition instance to wait on
    test - Callable returning a boolean to indicate whether
           the criteria being waited on has been satisfied.

    Perform a wait on a condition such that it is keyboard
    interruptable when done in the main thread. Due to Python
    limitations as of <= 2.5, lock acquisition and conditions waits
    are not interruptable when performed in the main thread.

    Currently, this comes at a cost additional CPU use, compared to a
    normal wait. Future implementations may be more efficient if the
    underlying python supports it.

    The condition must be acquired.

    This function should only be used on conditions that are never
    expected to be acquired for extended periods of time, or the
    lock-acquire of the underlying condition could cause an
    uninterruptable state despite the efforts of this function.

    There is no equivalent for acquireing a lock, as that cannot be
    done efficiently.

    Example:

    Instead of:

      cv.acquire()
      while not thing_done:
        cv.wait(someTimeout)
      cv.release()

    do:

      cv.acquire()
      interruptable_condwait(cv, lambda: thing_done)
      cv.release()
    g�������?N)�wait)�cv�waitFors  r	�interruptably_waitr8s��^�i�
������i�c�d�����tj��ddddd����fd������fd�}�|fS)a�
    Splits the act of calling the given function into one front-end
    part for waiting on the result, and a back-end part for performing
    the work in another thread.

    Returns (waiter, caller) where waiter is a function to be called
    in order to wait for the results of an asynchronous invokation of
    fn to complete, returning fn's result or propagating it's
    exception.

    Caller is the function to call in a background thread in order to
    execute fn asynchronously. Caller will return (success, waiter)
    where success is a boolean indicating whether the function
    suceeded (did NOT raise an exception), and waiter is the waiter
    that was originally returned by the call to async_split().
    FN)�done�error�trace�valuec�����j�	t��fd���d��d�j�S�dj�d��#�j�wxYw)Nc����dS)Nr�)�states�r	�<lambda>z-async_split.<locals>.waiter.<locals>.<lambda>�s���5��=�rrrr)rrr�with_traceback)r
rs��r	�waiterzasync_split.<locals>.waiter�s^���
�
�
��	��r�#8�9��W�~�%��W�~�
�J�J�L��G�n�3�3�E�'�N�C�C���J�J�L�s�A�A�A%c�l��	��}�j�d�d<|�d<�j��j�d�fS#t$rb}�j�d�d<|�d<t	j
�d�d<�j��j�d�fcYd}~Sd}~wwxYw)NTrrr�rF)r�notifyr�	Exception�sys�exc_info)r�er
rrrs  ����r	�callerzasync_split.<locals>.caller�s����	!��D�E��J�J�L� �E�&�M�"�E�'�N��I�I�K��J�J�L���<����	!��J�J�L� �E�&�M��E�'�N� �\�\�^�A�.�E�'�N��I�I�K��J�J�L��&�=� ��	!�s�AA�	B3�AB.�(B3�.B3)�	threading�	Condition)rr$r
rrs` @@@r	�async_splitr'ks7���2
�	�	�	�B��T�D�4�H�E�
�!�*�6�>�rc�6�eZdZdZd	d�Zd�Zd�Zd�Zd�Zd�Z	y)
�Valuea�
    A thread-safe container of a reference to an object (but not the
    object itself).

    In particular this means it is safe to:

      value.set(1)

    But unsafe to:

      value.get()['key'] = value

    Where the latter must be done using something like:

      def _setprop():
        value.get()['key'] = value

      with_lock(value, _setprop)

    Operations such as increments are best done as:

      value.transform(lambda val: val + 1)
    Nc�D�||_tj�|_y)z2
        Initialuze with the given value.
        N)�
_Value__valuer%r&�
_Value__cv��selfrs  r	�__init__zValue.__init__�s������'�'�)��	rc�6��t�j�fd��S)z<
        Returns the value protected by this Value.
        c����jS�N�r+�r.s�r	rzValue.get.<locals>.<lambda>�s���D�L�L�r�r
r,r4s`r	�getz	Value.get�s�������$8�9�9rc�@�����fd�}t�j|�y)z;
        Resets the value protected by this Value.
        c�����_yr2r3r-s��r	�_setzValue.set.<locals>._set�s
��� �D�LrNr5)r.rr9s`` r	�setz	Value.set�s���
	!�	�$�)�)�T�"rc�>�����fd�}t�j|�S)ah
        Call fn with the current value as the parameter, and reset the
        value to the return value of fn.

        During the execution of fn, all other access to this Value is
        prevented.

        If fn raised an exception, the value is not reset.

        Returns the value returned by fn, or raises the exception
        raised by fn.
        c�J����j��_�jSr2r3)rr.s��r	�
_transformz#Value.transform.<locals>._transform�s����d�l�l�+�D�L��<�<�r)r
r
)r.rr=s`` r	�	transformzValue.transform�s���	 �����*�-�-rc�8�|jj�y)z�
        Acquire this Value for mutually exclusive access. Only ever
        needed when calling code must perform operations that cannot
        be done with get(), set() or transform().
        N)r,rr4s r	rz
Value.acquire�s��	
�	�	���rc�8�|jj�y)zC
        Release this Value for mutually exclusive access.
        N)r,rr4s r	rz
Value.release�s��	
�	�	���rr2)
�__name__�
__module__�__qualname__�__doc__r/r6r:r>rrrrr	r)r)�s%���0*�:�#�.�(�rr))rD�_threadr!r%�	duplicityrr
rr'�objectr)rrr	�<module>rHs7��,��
����&0�f=�@Q�F�Qr

Zerion Mini Shell 1.0