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

�

�2e
4����dZddlZddlZddlZddlZddlZddlmZejdddk(rddl	m
ZnddlZddl	mZddl	m
Z
dd	l	mZdd
l	mZddl	mZddl	mZej$d
�Zej$d�Zed�ZGd�dej.�Zd�ZGd�dej4�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Z Gd�d e�Z!Gd!�d"ejD�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6d6�Z7d7�Z8d8�Z9d9�Z:d:�Z;d;�Z<d<�Z=d=�Z>d>�Z?d?�Z@d@�ZAdA�ZBdB�ZCdC�ZDdD�ZEdE�ZFy)FzE
Utils for parse command line, check for consistency, and set config
�N)�md5�)��)�argparse311)�config)�dup_time)�errors)�log)�path)�	selectionz7^(0x)?([0-9A-Fa-f]{8}|[0-9A-Fa-f]{16}|[0-9A-Fa-f]{40})$z^[\w\+]+://z)Enter 'duplicity --help' for help screen.c��eZdZde_y)�CommandLineError�N)�__name__�
__module__�__qualname__�sys�tracebacklimit���4/usr/lib/python3/dist-packages/duplicity/cli_util.pyrr3s
���C��rrc�*�t|�dt����)z0
    Indicate a command line error and exit
    �
)r�help_footer)�messages r�command_line_errorr8s���g�Y�b��
�6�
7�7rc�&��eZdZ�fd�Zdd�Z�xZS)�DuplicityActionc�(��t�|�||fi|��y�N��super�__init__��self�option_strings�dest�kwargs�	__class__s    �rr$zDuplicityAction.__init__@����
�����8��8rc��t�r!)�NotImplementedError�r&�parser�	namespace�values�
option_strings     r�__call__zDuplicityAction.__call__Cs��!�!rr!�rrrr$r3�
__classcell__�r*s@rrr?s
���9�"rrc��eZdZd�Zy)�DoNothingActionc��yr!r)r&r/�args�kws    rr3zDoNothingAction.__call__Hs��rN)rrrr3rrrr8r8Gs��
rr8c�&��eZdZ�fd�Zdd�Z�xZS)�AddSelectionActionc�(��t�|�||fi|��yr!r"r%s    �rr$zAddSelectionAction.__init__Mr+rc���t|t�rtjt�n|}t
jjtj|�|f�yr!)�
isinstance�bytes�os�fsdecode�valuer�select_opts�append)r&r/r0r1r2�addargs      rr3zAddSelectionAction.__call__Ps=��'1�&�%�'@����U�#�f�����!�!�2�;�;�}�#=�v�"F�Grr!r4r6s@rr=r=Ls���9�Hrr=c�&��eZdZ�fd�Zdd�Z�xZS)�AddFilelistActionc�(��t�|�||fi|��yr!r"r%s    �rr$zAddFilelistAction.__init__Vr+rc�R�tjjtj|�tj|�f�	tj
jt
j|dd���y#t$r}tt|��Yd}~yd}~wwxYw)N�rtzUTF-8)�encoding)rrErFrBrC�select_files�io�open�	Exceptionr�str)r&r/r0r1r2�es      rr3zAddFilelistAction.__call__Ysr�����!�!�2�;�;�}�#=�r�{�{�6�?R�"S�T�	'����&�&�r�w�w�v�t�g�'N�O���	'��s�1�v�&�&��	'�s�	5A?�?	B&�B!�!B&r!r4r6s@rrIrIUs
���9�'rrIc�&��eZdZ�fd�Zdd�Z�xZS)�AddRenameActionc�(��t�|�||fi|��yr!r"r%s    �rr$zAddRenameAction.__init__br+rc��tjtjjtjj	|d���}tj|d�t
j|<y)Nr�)rB�fsencoder�normcase�normpathr�rename)r&r/r0r1r2�keys      rr3zAddRenameAction.__call__esM���k�k�"�'�'�*�*�2�7�7�+;�+;�F�1�I�+F�G�H���[�[����3��
�
�c�rr!r4r6s@rrUrUas
���9�4rrUc�&��eZdZ�fd�Zdd�Z�xZS)�SplitOptionsActionc�(��t�|�||fi|��yr!r"r%s    �rr$zSplitOptionsAction.__init__kr+rc��t|�}t||�}|jd�jd�}|dk(r|}n|�d|��}t|||�y)N�"�'�� )�opt2var�getattr�strip�setattr)r&r/r0r1r2�var�optss       rr3zSplitOptionsAction.__call__nsY���m�$���y�#�&�����c�"�(�(��-���2�:��D��V�1�V�H�%�D��	�3��%rr!r4r6s@rr_r_js
���9�&rr_c�&��eZdZ�fd�Zdd�Z�xZS)�IgnoreErrorsActionc�(��t�|�||fi|��yr!r"r%s    �rr$zIgnoreErrorsAction.__init__zr+rc�V�tjtd��dt_y)NzbRunning in 'ignore errors' mode due to --ignore-errors.
Please reconsider if this was not intendedT)r�Warn�_r�
ignore_errorsr.s     rr3zIgnoreErrorsAction.__call__}s!�����
�v�w�	
� $��rr!r4r6s@rrmrmys
���9�$rrmc�(��eZdZd�fd�	Zdd�Z�xZS)�WarnAsyncStoreConstActionc�(��t�|�||fi|��yr!r")r&r'r(�nargsr)r*s     �rr$z"WarnAsyncStoreConstAction.__init__�r+rc��tjtd��t||j|j
�y)Nz�Use of the --asynchronous-upload option is experimental and not safe for production! There are reported cases of undetected data loss during upload. Be aware and periodically verify your backups to be safe.)rrprqrir(�constr.s     rr3z"WarnAsyncStoreConstAction.__call__�s1�����
�?�
�	
�	�	�4�9�9�d�j�j�1rr!r4r6s@rrtrt�s
���9�	2rrtc��	t|�S#t$r-}ttd|�dt	|�����Yd}~yd}~wwxYw)Nrcz' is not an int: )�intrQrrqrR��valrSs  r�
_check_intr}�sE��B��3�x����B��1�q���%6�s�1�v�h�?�@�A�A��B�s�

�	A�#>�Ac��	tj|�S#tj$r}tt	|��Yd}~yd}~wwxYwr!)r	�genstrtotime�
TimeExceptionrrRr{s  r�_check_timer��s=��#��$�$�S�)�)���!�!�#��3�q�6�"�"��#����A�A�Ac�T�t|�dk(r|Sttd|�d���y)NrXrcz is not a single character.)�lenrrq�r|s r�
check_charr��s)��
�3�x�1�}��
��1�q���%@�A�B�Crc��t|�Sr!�r}r�s r�check_countr��s���c�?�rc��	tjt|��S#t$r#}t	|�dt|����Yd}~yd}~wwxYw)Nz is not a valide pathname: )rBrY�	expand_fnrQrrRr{s  r�
check_filer��sH��H��{�{�9�S�>�*�*���H��c�U�"=�c�!�f�X�F�G�G��H�s� �	A�A�Ac��	tj|�S#tj$r}tt	|��Yd}~yd}~wwxYwr!)r	�intstringtosecondsr�rrRr{s  r�check_intervalr��s=��#��*�*�3�/�/���!�!�#��3�q�6�"�"��#�r�c��t|�Sr!�r�r�s r�check_remove_timer���
���s��rc��t|�sttd|�d���tjj|�sttd|�d���|S)Nz*Source should be pathname, not url.  Got '�
' instead.zArgument source_path 'z' does not exist.)�is_pathrrqrBr�existsr�s r�check_source_pathr��sM���3�<��1�I�#��j�Y�Z�[�
�7�7�>�>�#���1�5�c�U�:K�L�M�N��Jrc�L�t|�sttd|�d���|S)Nz+Source should be url, not directory.  Got 'r���is_urlrrqr�s r�check_source_urlr���%���#�;��1�J�3�%�z�Z�[�\��Jrc�2�t|�sttd|�d���tjj|�s	tj|d��|S|S#t$r.}ttd|�dt|�����Yd}~|Sd}~wwxYw)Nz+Target should be directory, not url.  Got 'r�T)�exist_okzUnable to create target dir 'z': )	r�rrqrBrr��makedirsrQrRr{s  r�check_target_dirr��s����3�<��1�J�3�%�z�Z�[�\�
�7�7�>�>�#��	T��K�K��d�+��J�3�J���	T��q�#@���S��Q���!Q�R�S�S��J��	T�s�A�	B�(#B�Bc�L�t|�sttd|�d���|S)Nz+Target should be url, not directory.  Got 'r�r�r�s r�check_target_urlr��r�rc��t|�Sr!r�r�s r�
check_timer��r�rc�F�t|�}tj|�|S)z"
    set timeout for backends
    )r}�socket�setdefaulttimeoutr�s r�
check_timeoutr��s ���S�/�C�
���S�!��Jrc���d}tj}|j�}|dvrtj}nl|dvrtj}nW|dvrtj}nB|dvrtj
}n-|dvrtj}n	t|�}|dks|dkDrd	}|rttd
��tj|�|S#t$rd	}Y�:wxYw)NF)rS�error)�w�warning)�n�notice)�i�info)�d�debugr�	Tz�Verbosity must be one of: digit [0-9], character [ewnid],
or word ['error', 'warning', 'notice', 'info', 'debug'].
The default is 3 (Notice).  It is strongly recommended
that verbosity level is set at 2 (Warning) or higher.)r�NOTICE�lower�ERROR�WARNING�INFO�DEBUGrz�
ValueErrorrrq�setverbosity)r|�fail�verbs   r�check_verbosityr��s����D��:�:�D�

�)�)�+�C�
�n���y�y��	� �	 ��{�{��	��	��z�z��	�
�	��x�x��	��	��y�y��	��s�8�D��a�x�4�!�8����	�
�H�
�	
����T���K��#�	��D�	�s�
C�C�Cc��|S)z-
    Return printable value for default.
    rr�s r�dfltr�s	���Jrc�z�tjjtjj|��Sr!)rBr�
expanduser�
expandvars)�filenames rr�r�s&��
�7�7���b�g�g�0�0��:�;�;rc��tjdusJd��ttjj|tj|���S)zB
    Return expanded version of archdir joined with backname.
    FzAexpand_archive_dir() called prior to config.backup_name being set)r�backup_namer�rBr�joinrY)�archdir�backnames  r�expand_archive_dirr�sA�����U�*�o�,o�o�*��R�W�W�\�\�'�2�;�;�x�+@�A�B�Brc�t�t�}|j|j��|j�S)zZ
    @param backend_url: URL to backend.
    @returns A default backup name (string).
    )r�update�encode�	hexdigest)�backend_url�burlhashs  r�generate_default_backup_namer�&s/�� �u�H��O�O�K�&�&�(�)�����rc�h�t|j��dkxrtj|�S)z
    Check if val is URL
    rX)r��
splitlines�
url_regexp�matchr�s rr�r�;s+���s�~�~�� �A�%�?�*�*:�*:�3�*?�?rc��t|�S)z
    Check if val is PATH
    )r�r�s rr�r�Bs���c�{�?�rc�<�t|t�rt|d�Sy)Nzutf-8)r@rRrA)rDs r�
make_bytesr�Is���%����U�G�$�$�rc�&�|jdd�S)z,
    Convert var name to command string
    rq�-��replace��ss r�var2cmdr�N���
�9�9�S�#��rc�R�t|�dkDrd|jdd���Sd|��S)z+
    Convert var name to option string
    rXz--rqr�)r�r�r�s r�var2optr�Us3���1�v��z��A�I�I�c�3�'�(�)�)��1�#�w�rc�&�|jdd�S)z,
    Convert command string to var name
    r�rqr�r�s r�cmd2varr�_r�rc�D�|jd�jdd�S)z+
    Convert option string to var name
    r�rq)�lstripr�r�s rrfrffs��
�8�8�C�=� � ��c�*�*rc��	t|�}|dkrtd�tj|�|S#t$rtd�Y�=wxYw)Nzlog_fd must be an integer.rXz!log-fd must be greater than zero.)rzr�rr�add_fd)�fds r�
set_log_fdr�msL��9�
��W��
�A�v��>�?��J�J�r�N�
�I���9��7�8�9�s�4�A�
Ac�F�t|�}tj|�|Sr!)r�r�add_file)�fns r�set_log_filer�xs��	�B��B��L�L���
�Irc��t|�dzS�Nir���nums r�	set_kilosr�~s���c�?�T�!�!rc�$�t|�dzdzSr�r�r�s r�set_megsr��s���c�?�T�!�D�(�(rc�0�tjj|�s	tj|�tj
|�}|j
�s"ttd|j�d���|t_y#t$rY�^wxYw)z Check archive dir and set globalzSpecified archive directory 'z' is not a directoryN)rBrr�r�rQ�Path�isdirrrq�uc_namer�archive_dir_path)�	dirstringr�s  r�set_archive_dirr��s|��
�7�7�>�>�)�$�	��K�K�	�"��y�y��+���!�!�#��1�<�=M�=U�=U�<V�Vj�k�l�m�.�F����	��	�s�B	�		B�Bc
�&�tj|�s$ttd|�dt	|��d���t
jj�gt
j_t
jjj|�y)z<Set config.gpg_profile.encrypt_key assuming proper key givenzWEncrypt key should be an 8, 16, or 40 character hex string, like 'AA0E73D2'.
Received '�	' length=�	 instead.N)	�gpg_key_pattr�rrqr�r�gpg_profile�
recipientsrF)�encrypt_keys r�set_encrypt_keyr�sz�����k�*��
��(�M��3�{�3C�2D�I�O�
�	
����$�$�,�(*����%�
���!�!�(�(��5rc�0�t|�t|�y)zASet config.gpg_profile.encrypt_sign_key assuming proper key givenN)r�set_sign_key)�encrypt_sign_keys r�set_encrypt_sign_keyr	�s���$�%��!�"rc
�&�tj|�s$ttd|�dt	|��d���t
jj�gt
j_t
jjj|�y)zCSet config.gpg_profile.hidden_encrypt_key assuming proper key givenz^Hidden dncrypt key should be an 8, 16, or 40 character hex string, like 'AA0E73D2'.
Received 'r�rN)	rr�rrqr�rr�hidden_recipientsrF)�hidden_encrypt_keys r�set_hidden_encrypt_keyr
�s�����0�1��
��/�0�	�#�>P�:Q�9R�R[�]�
�	
����+�+�3�/1����,�
���(�(�/�/�0B�Crc
��tj|�s$ttd|�dt	|��d���|t
j_y)z9Set config.gpg_profile.sign_key assuming proper key givenzTSign key should be an 8, 16, or 40 character hex string, like 'AA0E73D2'.
Received 'r�rN)rr�rrqr�rr�sign_key)rs rrr�sL�����h�'��
��%�J�i��H�
��i�I�
�	
�#+�F���rc���tjtj�}|j	tj
tj�|j�t_y)zAReturn selection iter starting at filename with arguments appliedN)	r
�Selectr�
local_path�	ParseArgsrErN�set_iter�select)�sels r�
set_selectionr�s?��
�
�
�6�,�,�
-�C��M�M�&�$�$�f�&9�&9�:��L�L�N�F�Mr)G�__doc__rOrB�rer�r�hashlibr�version_info�	duplicityr�argparserr	r
rrr
�compilerr�rqr�	UserErrorrr�Actionrr8r=rIrUr_rm�_StoreConstActionrtr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rfr�r�r�r�r�rr	r
rrrrr�<module>r"s���*�
�	�	�
�
�����A�a��F�"�1���������r�z�z�T�U��
�R�Z�Z��
'�
��;�<��	�v�'�'�	�
8�"�h�o�o�"�
�o�
�
H��H�	'��	'�4�o�4�&��&�$��$�
2�� :� :�
2� B�#�D��H�#��������$�N�<�C� �*@��%�
���+���"�)�
/�6�#�D�	+�#r

Zerion Mini Shell 1.0