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__/progress.cpython-39.opt-1.pyc
a

HZ�h&�@s�ddlZddlZddlZddlZddlmZddlmZe�Zddlm	Z	dd�Z
Gd	d
�d
�ZGdd�de�ZGd
d�de�Z
Gdd�d�ZdS)�N)�get_terminal_size�)�
create_logger�)�ellipsis_truncatecCs$tdd�d}|dkr |�|�S|S)N����r��fallbackrr)r�ljust)�message�terminal_space�r�;/usr/lib64/python3.9/site-packages/borg/helpers/progress.py�justify_to_terminal_size
s
rc@sPeZdZdZdZdZdZedd��Zddd�Z	d	d
�Z
dd�dd
�Zdd�ZdS)�ProgressIndicatorBasezborg.output.progressNFrcCs|jd7_|jS)zYUnique number, can be used by receiving applications to distinguish different operations.r)�operation_id_counter)�clsrrr�operation_idsz"ProgressIndicatorBase.operation_idcCs�d|_t�|j�|_|��|_||_|jjs�tj	t
jd�|_|j�tj
�t�d�}z |j}|jrfdnd}|j|_Wnty�d}Yn0|j�|�||j_|j�|j�|jjtjkr�|j�tj�d|j_|j��tj
k|_dS)N)�streamZborg�
�
F)�handler�loggingZ	getLogger�LOGGER�loggerr�id�msgid�handlersZ
StreamHandler�sys�stderrZsetLevel�INFO�	formatter�json�AttributeErrorZsetFormatter�
terminatorZ
addHandler�levelZNOTSETZWARNZ	propagateZgetEffectiveLevel�emit)�selfrrr"r%rrr�__init__"s*


	zProgressIndicatorBase.__init__cCs&|jdur"|j�|j�|j��dS�N)rrZ
removeHandler�close�r(rrr�__del__Is
zProgressIndicatorBase.__del__��finishedc	KsF|js
dS|�t|j|j|j|t��d��tt�	|�t
jdd�dS)N)Z	operationr�typer/�timeT)�file�flush)r'�update�dictrr�	JSON_TYPEr1�printr#�dumpsrr )r(r/�kwargsrrr�output_jsonNs�z!ProgressIndicatorBase.output_jsoncCs"|jr|jdd�n
|�d�dS)NTr.�)r#r:�outputr,rrr�finish[szProgressIndicatorBase.finish)N)
�__name__�
__module__�__qualname__rr6r#r�classmethodrr)r-r:r=rrrrrs

'
rc@seZdZdZdd�ZdS)�ProgressIndicatorMessageZprogress_messagecCs(|jr|j|d�n|j�t|��dS)N)r)r#r:r�infor)r(�msgrrrr<eszProgressIndicatorMessage.outputN)r>r?r@r6r<rrrrrBbsrBcs@eZdZdZd�fdd�	Zdd	d
�Zddd�Zddd�Z�ZS)�ProgressIndicatorPercentZprogress_percentr��%3.0f%%Ncs0d|_||_||_||_||_t�j|d�dS)a
        Percentage-based progress indicator

        :param total: total amount of items
        :param step: step size in percent
        :param start: at which percent value to start
        :param msg: output message, must contain one %f placeholder for the percentage
        r)rN)�counter�total�
trigger_at�steprD�superr))r(rIrK�startrDr��	__class__rrr)os	z!ProgressIndicatorPercent.__init__rcCsN|dur||_|jd|j}|j|7_||jkrJ|j|j7_|SdS)N�d)rHrIrJrK)r(�current�increase�pctrrr�progress�s
z!ProgressIndicatorPercent.progresscCs�|�||�}|dur�|dur�|js�ddlm}tdd�d}|dkr�|||jt|g|dd�dg��}t|d|�|d<|j|jt|g|�d	|d
�S|�|j|�SdS)z�
        Show and output the progress message

        :param current: set the current percentage [None]
        :param increase: increase the current percentage [None]
        :param info: array of strings to be formatted with msg [None]
        Nr)�swidthrr	rrr;F)�justifyrC)	rTr#�platformrUrrD�tuplerr<)r(rQrRrCrSrUr
�spacerrr�show�s* zProgressIndicatorPercent.showTcCs:|jr|j||j|j|d�n|r*t|�}|j�|�dS)N)rrQrIrC)r#r:rHrIrrrC)r(rrVrCrrrr<�s
zProgressIndicatorPercent.output)rrFrrGN)Nr)NrN)TN)	r>r?r@r6r)rTrZr<�
__classcell__rrrNrrEls

	
rEc@s6eZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�ProgressIndicatorEndless�
NcCs*d|_d|_||_|dur tj}||_dS)z�
        Progress indicator (long row of dots)

        :param step: every Nth call, call the func
        :param file: output file, default: sys.stderr
        rN)rH�	triggeredrKrr r2)r(rKr2rrrr)�sz!ProgressIndicatorEndless.__init__cCs4|jd7_|j|jdk}|r0|jd7_|S)Nrr)rHrKr^�r(ZtriggerrrrrT�s
z!ProgressIndicatorEndless.progresscCs|��}|r|�|j�SdSr*)rTr<r^r_rrrrZ�szProgressIndicatorEndless.showcCstdd|jdd�dS)N�.r;T)�endr2r3�r7r2)r(r^rrrr<�szProgressIndicatorEndless.outputcCst|jd�dS)N)r2rbr,rrrr=�szProgressIndicatorEndless.finish)r]N)r>r?r@r)rTrZr<r=rrrrr\�s

r\)rr#rr1�shutilrrrZparseformatrrrrBrEr\rrrr�<module>sM
>