%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�2e�(���dZddlZddlZddlZddlmZddlmZGd�de�Zddd	d
ddd
d�Z	ejd�Zejd�Zejd�Z
ejd�Zejd�Zdxaadxaaed�Zed�Zd"d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d"d!�Z"y)#z-Provide time related exceptions and functions�N)�config)�utilc��eZdZy)�
TimeExceptionN)�__name__�
__module__�__qualname__���4/usr/lib/python3/dist-packages/duplicity/dup_time.pyrr s��rr��<�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).c��|xsttj��}t|t�sJ�|t|�caay)z/Sets the current time in curtime and curtimestrN)�int�time�
isinstance�timetostring�curtime�
curtimestr)�time_in_secs�ts  r�
setcurtimer Ks9��	�(��D�I�I�K�(�A��a������\�!�_��G�Zrc�V�t|t�sJt��|t|�caay)z2Sets the previous time in prevtime and prevtimestrN)rr�prevtimer�prevtimestr)rs r�setprevtimer$Ss*���l�C�(�2�(�2�(�(�,�|�*D��H�krc�X�tj|�}tjd|�S)zBReturn w3 or duplicity datetime compliant listing of timeinsecondsz%Y%m%dT%H%M%SZ)r�gmtime�strftime)�
timeinseconds�lcltimes  rrrZs$���k�k�-�(�G��=�=�)�7�3�3rc
���	|ddjd�\}}t|�dk(rSttt|dd|dd|ddg��\}}}ttt|dd	|d	d|ddg��\}}}nfttt|jd
���\}}}ttt|jt
j���\}}}d|cxkrdksJ|��J|��d
|cxkrdksJ�J�d
|cxkrdksJ�J�d|cxkrdksJ�J�d|cxkrdksJ�J�d|cxkrdksJ�J�||||||dddf	}	t|�dk(rtj|	�}
n(tj|	�}|tjz
}
t|�dk(rt	|
�St	|
t|dd�z�S#tttf$rYywxYw)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
����;�=���)�split�len�list�maprr�time_separator�calendar�timegmr�mktime�timezone�tzdtoseconds�	TypeError�
ValueError�AssertionError)�
timestring�date�daytime�year�month�day�hour�minute�second�	timetuple�utc_in_secs�
local_in_secss            r�stringtotimerRbs��,�"�3�B��-�-�c�2�
��g��z�?�b� �#�C��d�1�Q�i��a���D��1�I�-N�$O�P��D�%��#'��C�'�!�A�,���!��g�VW�XY�l�1[�(\�#]� �D�&�&� $�C��T�Z�Z��_�$=�>��D�%��#'��C����v�?T�?T�1U�(V�#W� �D�&�&��d�!�T�!�'�4�'�!�'�4�'�!��E��R�������C�~�2�~��~��~��D��B�������F� �b� � � � � ��F� �b� � � � � �
�5�#�t�V�V�R��Q�G�	��z�?�b� �
#�/�/�)�4�K�!�K�K�	�2�M�'�$�-�-�7�K�
�z�?�b� ��{�#�#��{�\�*�R�S�/�%B�B�C�C���z�>�2����s�F7G�:G�G+�*G+c�R�tjtj|��S)zReturn pretty version of time)r�asctime�	localtime)r(s r�timetoprettyrV�s���<�<����}�5�6�6rc�*�tt|��S)z2Return pretty version of time given w3 time string)rVrR)rFs r�stringtoprettyrX�s����Z�0�1�1rc��g}t|d�\}}|dkDr|jt|��d��n|dk(r|jd�t|d�\}}|dkDr|jt|��d��n|dk(r|jd�|dk(r|jd�nA|r|dkDr:t|t�r|j|�d	��n|j|d
�d	��dj	|�S)z9Convert num of seconds to readable string like "2 hours".rr
z hoursz1 hourrz minutesz1 minutez1 secondz secondsz.2f� )�divmod�appendrr�join)�seconds�partlist�hours�minutess    r�inttoprettyrb�s����H��G�T�*�N�E�7��q�y����3�u�:�,�f�-�.�	�!������!��g�r�*��G�W���{����3�w�<�.��1�2�	�A�����
�#��!�|����
�#�
��1���g�s�#��O�O�w�i�x�0�1��O�O�w�s�m�8�4�5��8�8�H��rc�J���fd�}t��dkr|�d}�r�tj��}|s|�t|j	d��|j	d�}}|t
vs|dkr|�||t
|zz
}�|j
d�d��r��|S)z@Convert a string expressing an interval (e.g. "4D2s") to secondsc�N��tttj��z���N)r�bad_interval_stringr�escape)�interval_strings�r�errorz!intstringtoseconds.<locals>.error�s����/�$�+�+�o�2N�N�O�Orr1rr
N)r:�_interval_regexp�matchr�group�_interval_conv_dict�end)rhri�totalrk�num�exts`     r�intstringtosecondsrr�s����P��?��a��
��
�E�
� �&�&��7����G��u�{�{�1�~�&����A��S���)�)�S�1�W��G�
��*�3�/�/�/��)�%�)�)�A�,�.�9����Lrc	�l�|dkDrdtjzdz}ndtjzdz}|dkDrd}n	|dkrd}nytt	t
t
|d���\}}d|cxkrdksJ�J�d|cxkrdksJ�J�|�t|�d	�tj�t|�d	��S)
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.

    rr8r�+r2�Zr5r6�02)
r�altzonerAr;r<�absr[rrr=)�dstflag�offset�prefixr`ras     r�gettzdr|�s�����{��d�l�l�"�b�(���d�m�m�#�r�)��
��z���	�!������#�c�6�&�"�#5�6�7�N�E�7�������������2�������X�c�%�j��_�V�%:�%:�$;�C��L��;L�M�Mrc���|dk(ryt|�dk(sJ�|ddk(s|ddk(r|dtjk(sJ�ddt|d	d�zt|d
d	�zzS)z3Given w3 compliant TZD, return how far ahead UTC isrurr/r2rt�i���rNr.)r:rr=r)�tzds rrBrB�sq��
�c�z���s�8�q�=��=���F�c�M�S��V�s�]��A��&�:O�:O�0O�O�O��"�s�3�r��7�|�#�c�#�a�b�'�l�2�3�3rc��t|ttf�rt|�}|�J�t|tdjf�rt|�}|�J�||kry||k(ryy)z.Compare time1 and time2 and return -1, 0, or 1�r8rr
)r�str�stringrR�	__class__)�time1�time2s  r�cmpr��sf���%�#�v��'��U�#��� � � ��%�#�r�|�|�,�-��U�#��� � � ��u�}��	�%���rc���|�t}�dk(r|S�fd�}tj��rt��St	��xst	�td�z�}|r|S	|t
��z
S#t$rYnwxYwtj��xs,tj��xstj��}|s|�|jd��dtt|jd���d�dtt|jd	���d�d
td����t	��}|r|S|�y)z2Convert a generic time string to a time in secondsN�nowc�N��tttj��z��re)r�bad_time_stringrrg)�timestrs�rrizgenstrtotime.<locals>.errors����O�d�k�k�'�.B�B�C�CrrrIr2rJrvrKz	T00:00:00)r�_integer_regexp�searchrrRr|rrr�_genstr_date_regexp1�_genstr_date_regexp2�_genstr_date_regexp3rl)r��override_curtimerirrks`    r�genstrtotimer�sH�����"���%����D����g�&��7�|��	�W��B��g��q�	�.A�!B�A����
��"4�W�"=�=�=���
��
��
	�#�#�G�,�	0��&�&�w�/�	0��&�&�w�/�
�
�
���;�;�v��
�q��S����W�)=�%>�!?�� C�1�S��U�[�[�Y^�M_�I`�Ea�bd�De�
�F�1�I�;�	 ��	�W��A����
�s�
A-�-	A9�8A9re)#�__doc__r>�rer�	duplicityrr�	Exceptionrrm�compiler�rjr�r�r�rrr"r#�_rfr�r r$rrRrVrXrbrrr|rBr�r�r
rr�<module>r�s��,4��	����	�I�	�

�	�	
�	�	�	�	����"�*�*�Z�(���2�:�:�4�5��!�r�z�z�"n�o��!�r�z�z�"n�o��!�r�z�z�"c�d�����*����;������
�
��-�E�4�2�j7�
2�
�2�,N�<4��".r

Zerion Mini Shell 1.0