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__/dup_time.cpython-310.pyc
o

��`-�@sbdZddlmZddlmZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZejdkr?eejfZnefZGd	d
�d
e�Zddd
ddddd�Ze	�d�Ze	�d�Ze	�d�Ze	�d�Ze	�d�Zdaadaae d�Z!e d�Z"d2dd�Z#dd�Z$dd�Z%d d!�Z&d"d#�Z'd$d%�Z(d&d'�Z)d(d)�Z*d*d+�Z+d,d-�Z,d.d/�Z-d2d0d1�Z.dS)3z-Provide time related exceptions and functions�)�division)�old_div)�mapN)�config)�util)�c@seZdZdS)�
TimeExceptionN)�__name__�
__module__�__qualname__�rr�4/usr/lib/python3/dist-packages/duplicity/dup_time.pyr+sr��<�i�Qi�:	i�'i�3�)�s�m�h�D�W�M�Yz^[0-9]+$z^([0-9]+)([smhDWMY])zD^(?P<year>[0-9]{4})[-/](?P<month>[0-9]{1,2})[-/](?P<day>[0-9]{1,2})$zD^(?P<month>[0-9]{1,2})[-/](?P<day>[0-9]{1,2})[-/](?P<year>[0-9]{4})$z9^(?P<year>[0-9]{4})(?P<month>[0-9]{2})(?P<day>[0-9]{2})Z$z�Bad interval string "%s"

Intervals are specified like 2Y (2 years) or 2h30m (2.5 hours).  The
allowed special characters are s, m, h, D, W, M, and Y.  See the man
page for more information.afBad time string "%s"

The acceptible time strings are intervals (like "3D64s"), w3-datetime
strings, like "2002-04-26T04:22:01-07:00" (strings like
"2002-04-26T04:22:01" are also acceptable - duplicity will use the
current time zone), or ordinary dates like 2/4/1997 or 2001-04-23
(various combinations are acceptable, but the month always precedes
the day).cCs2|ptt���}t|�tvsJ�|t|�aadS)z/Sets the current time in curtime and curtimestrN)�int�time�type�
integer_types�timetostring�curtime�
curtimestr)�time_in_secs�trrr
�
setcurtimeOsr!cCs&t|�tvs
Jt��|t|�aadS)z2Sets the previous time in prevtime and prevtimestrN)rr�prevtimer�prevtimestr)rrrr
�setprevtimeWsr$cCsRtjrt�|�}t�dtjdtjd|�t|d�St�|�}t�d|�S)zBReturn w3 or duplicity datetime compliant listing of timeinsecondsz%Y-%m-%dT%Hz%Mz%S���z%Y%m%dT%H%M%SZ)r�
old_filenamesr�	localtime�strftime�time_separator�gettzd�gmtime)�
timeinseconds�lcltimerrr
r^s
����
�
rc
Cs�z�|dd��d�\}}t|�dkrEttt|dd�|dd�|dd�g��\}}}ttt|dd	�|d	d�|dd�g��\}}}nttt|�d
���\}}}ttt|�tj���\}}}d|krmdksrJ|��J|��d
|kr}dks�J�J�d
|kr�dks�J�J�d|kr�dks�J�J�d|kr�dks�J�J�d|kr�dks�J�J�||||||dddf	}	t|�dkr�t�|	�}
n
t	�
|	�}|t	j}
t|�dkr�t|
�WSt|
t|dd���WSt
ttfy�YdSw)z�Return time in seconds from w3 or duplicity timestring

    If there is an error parsing the string, or it doesn't look
    like a valid datetime string, return None.
    N��T�r�����-ili4r����;�=r%)�split�len�listrrrr)�calendar�timegmr�mktime�timezone�tzdtoseconds�	TypeError�
ValueError�AssertionError)�
timestring�date�daytime�year�month�day�hour�minute�second�	timetuple�utc_in_secs�
local_in_secsrrr
�stringtotimeos< � �
�$


�rRcCst�t�|��S)zReturn pretty version of time)r�asctimer')r,rrr
�timetopretty�srTcCstt|��S)z2Return pretty version of time given w3 time string)rTrR)rFrrr
�stringtopretty�srUcCs�g}t|d�\}}|dkr|�d|�n	|dkr|�d�t|d�\}}|dkr1|�d|�n	|dkr:|�d�|dkrD|�d�n|rJ|dkr^t|t�rW|�d	|�n|�d
|�d�|�S)z9Convert num of seconds to readable string like "2 hours".rrz%d hoursz1 hourrz
%d minutesz1 minutez1 secondz
%s secondsz%.2f seconds� )�divmod�append�
isinstancer�join)�seconds�partlist�hours�minutesrrr
�inttopretty�s$



r_cs��fdd�}t��dkr|�d}�rHt���}|s|�t|�d��|�d�}}|tvs2|dkr5|�||t|7}�|�d�d���s|S)z@Convert a string expressing an interval (e.g. "4D2s") to secondsc�ttt������N)r�bad_interval_stringr�escaper��interval_stringrr
�error��z!intstringtoseconds.<locals>.errorr4rrN)r<�_interval_regexp�matchr�group�_interval_conv_dict�end)rerf�totalri�num�extrrdr
�intstringtoseconds�s
�	rpcCs�|dkr
tdtjd�}ntdtjd�}|dkrd}n	|dkr#d}ndStttt|d���\}}d|kr<dks?J�J�d|krJdksMJ�J�d	||tj	|fS)
z�Return w3's timezone identification string.

    Expresed as [+/-]hh:mm.  For instance, PST is -08:00.  Zone is
    coincides with what localtime(), etc., use.

    rr%r�+r5�Zr8r9z%s%02d%s%02d)
rr�altzonerAr=r�absrWrr))�dstflag�offset�prefixr]r^rrr
r*�s
r*cCsn|dkrdSt|�dksJ�|ddks|ddkr!|dtjks#J�ddt|d	d��t|d
d	��S)z3Given w3 compliant TZD, return how far ahead UTC isrrrr2r5rqri���rNr1)r<rr)r)�tzdrrr
rB�s(rBcCsdt|tdjf�rt|�}|dusJ�t|tdjf�r$t|�}|dus$J�||kr*dS||kr0dSdS)z.Compare time1 and time2 and return -1, 0, or 1�Nr%rr)rY�str�	__class__rR)�time1�time2rrr
�cmpsr~cs�|durt}�dkr|S�fdd�}t���rt��St��p&t�td��}|r+|Sz|t��WSty;Ynwt���pJt	���pJt
���}|sP|�d|�d�t|�d��t|�d	��td�f�t��}|ro|S|�dS)
z2Convert a generic time string to a time in secondsN�nowcr`ra)r�bad_time_stringrrcr��timestrrr
rfrgzgenstrtotime.<locals>.errorrz%s-%02d-%02dT00:00:00%srIrJrK)r�_integer_regexp�searchrrRr*rpr�_genstr_date_regexp1�_genstr_date_regexp2�_genstr_date_regexp3rj)r��override_curtimerfr rirr�r
�genstrtotimes>
	�
��
�
r�ra)/�__doc__�
__future__r�
past.utilsr�builtinsrr�types�rer>�sys�	duplicityrr�version_infor�LongTyper�	Exceptionrrk�compiler�rhr�r�r�rrr"r#�_rbr�r!r$rrRrTrUr_rpr*rBr~r�rrrr
�<module>sN
�






8


https://t.me/RX1948 - 2025