HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/lib64/python3.9/site-packages/borg/helpers/__pycache__/datastruct.cpython-39.pyc
a

HZ�h��@s<ddlmZGdd�de�ZGdd�d�ZGdd�d�ZdS)	�)�Errorcs eZdZdZ�fdd�Z�ZS)�
StableDictz,A dict subclass with stable items() orderingcstt����S�N)�sorted�super�items��self��	__class__��=/usr/lib64/python3.9/site-packages/borg/helpers/datastruct.pyrszStableDict.items)�__name__�
__module__�__qualname__�__doc__r�
__classcell__rrr
r
rsrc@sHeZdZdZGdd�dee�Zddd�Zdd	�Zddd�Z	dd
d�Z
dS)�Bufferz/
    Provides a managed, resizable buffer.
    c@seZdZdZdS)zBuffer.MemoryLimitExceededz2Requested buffer size {} is above the limit of {}.N�rrrrrrrr
�MemoryLimitExceededsr�NcCsFt|�sJd��|dus(||ks(Jd��||_||_|j|dd�dS)z�
        Initialize the buffer: use allocator(size) call to allocate a buffer.
        Optionally, set the upper <limit> for the buffer size.
        z-must give alloc(size) function as first paramNzinitial size must be <= limitT)�init)�callable�	allocator�limit�resize)r	r�sizerrrr
�__init__s
zBuffer.__init__cCs
t|j�Sr)�len�bufferrrrr
�__len__szBuffer.__len__FcCsJt|�}|jdur*||jkr*t�||j��|s:t|�|krF|�|�|_dS)a$
        resize the buffer - to avoid frequent reallocation, we usually always grow (if needed).
        giving init=True it is possible to first-time initialize or shrink the buffer.
        if a buffer size beyond the limit is requested, raise Buffer.MemoryLimitExceeded (OSError).
        N)�intrrrrrr�r	rrrrr
r s
z
Buffer.resizecCs|dur|�||�|jS)z�
        return a buffer of at least the requested size (None: any current size).
        init=True can be given to trigger shrinking of the buffer to the given size.
        N)rrr"rrr
�get,sz
Buffer.get)rN)F)NF)rrrrr�OSErrorrrr rr#rrrr
r
s

rc@sPeZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�EfficientCollectionQueuezL
    An efficient FIFO queue that splits received elements into chunks.
    c@seZdZdZdS)z&EfficientCollectionQueue.SizeUnderflowzHCould not pop_front first {} elements, collection only has {} elements..Nrrrrr
�
SizeUnderflow;sr&cCsg|_d|_||_||_dS)z�
        Initializes empty queue.
        Requires split_size to define maximum chunk size.
        Requires member_type to be type defining what base collection looks like.
        �N)�buffersr�
split_size�member_type)r	r)r*rrr
r>sz!EfficientCollectionQueue.__init__cCs|js|��S|jd}|S)z�
        Returns first chunk from queue without removing it.
        Returned collection will have between 1 and split_size length.
        Returns empty collection when nothing is queued.
        r')r(r*)r	rrrr
�
peek_frontIs
z#EfficientCollectionQueue.peek_frontcCsx||jkrt�||j��|dkrt|jd}t|t|��}||d�}|rT||jd<n|jd=||8}|j|8_qdS)z~
        Removes first size elements from queue.
        Throws if requested removal size is larger than whole queue.
        r'N)rr%r&r(�minr)r	rr�	to_removerrr
�	pop_frontTs

z"EfficientCollectionQueue.pop_frontcCs�|js|��g|_|r�|jd}t|�|jkrB|��}|j�|�tt|�|jt|��}||d|�7}||d�}||jd<|j|7_qdS)zm
        Adds data at end of queue.
        Takes care to chunk data into split_size sized elements.
        ���N)r(r*rr)�appendr,r)r	�datarZto_addrrr
�	push_backfs

z"EfficientCollectionQueue.push_backcCs|jS)zF
        Current queue length for all elements in all chunks.
        �rrrrr
r ysz EfficientCollectionQueue.__len__cCs
|jdkS)z4
        Returns true if queue isn't empty.
        r'r3rrrr
�__bool__sz!EfficientCollectionQueue.__bool__N)rrrrrr&rr+r.r2r r4rrrr
r%6sr%N)�errorsr�dictrrr%rrrr
�<module>s,