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

�

�2e�%��<�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZdd�Zd�Zd�Zd�Zd	�ZGd
�de�ZGd�d
e�Zd�Zd�Zd�Zej8d��Zdd�Zd�Zd�Z d�Z!d�Z"Gd�dejF�Z$y)z
Miscellaneous utilities.
�N)�StringIO)�tarfilec��tj�\}}}tj||�}|j	tj
||��d}|tjd|dd�d�d|d��z}|S)zx
    @return A string representation in typical Python format of the
            currently active/raised exception.
    zTraceback (innermost last):
�N����20� )�sys�exc_info�	traceback�	format_tb�extend�format_exception_only�str�join)�limit�type�value�tb�lines�msgs      �0/usr/lib/python3/dist-packages/duplicity/util.py�exception_tracebackr(sn��
�l�l�n�O�D�%������E�*�E�	�L�L��0�0��u�=�>�
)�C�

�c�h�h�r�5��"�:�6��b�	�B�
B�C��J�c��tj|�jdd�}d|jdd�j	dd�zS)zIConvert a (bytes) filename to a format suitable for logging (quoted utf8)zunicode-escape�replacez'%s'�utf8�'z\x27)�os�fsdecode�encode�decoder)�strings r�escaper$8sA��
�[�[��
 �
'�
'�(8�)�
D�F��F�M�M�&�)�4�<�<�S�'�J�J�Jrc��|r=tjjtt	tj
|���Sy)z@Convert an index (a tuple of path parts) to unicode for printing�.)r�pathr�list�mapr )�indexs r�uindexr+>s+����w�w�|�|�T�#�b�k�k�5�"9�:�;�;�rc���|rc|jrW|jD]=}t|t�r|cSt|t�s�(t	j
|�cSt|�Sy)z(Returns the exception message in Unicoder)�args�
isinstancer�bytesrr )�e�ms  r�uexcr2FsU��	�Q�V�V����	&�A��!�S�!����A�u�%��{�{�1�~�%�
	&��1�v�
�rc���	|�S#t$r[}tjrEtjtd�|jjt|�fz�Yd}~y�d}~wwxYw)a
    Execute fn. If the global configuration setting ignore_errors is
    set to True, catch errors and log them but do continue (and return
    None).

    @param fn: A callable.
    @return Whatever fn returns when called, or None if it failed and ignore_errors is true.
    z;IGNORED_ERROR: Warning: ignoring error as requested: %s: %sN)	�	Exception�config�
ignore_errors�log�Warn�_�	__class__�__name__r2)�fnr0s  r�maybe_ignore_errorsr=\s]����t���������H�H�Q�T�U�YZ�Yd�Yd�Ym�Ym�os�tu�ov�Xw�w�x�����s�	�	A-�AA(�'A(�(A-c��eZdZd�Zy)�
BlackHoleListc��y�N�)�self�xs  r�appendzBlackHoleList.appendp���rN)r;�
__module__�__qualname__rErBrrr?r?os��
rr?c��eZdZdZd�Zd�Zy)�FakeTarFilerc��tg�SrA)�iter�rCs r�__iter__zFakeTarFile.__iter__ws���B�x�rc��yrArBrMs r�closezFakeTarFile.closezrFrN)r;rGrH�debugrNrPrBrrrJrJts��
�E��
rrJc��	tjd||�}t�|_|S#tj$r
t�cYSwxYw)N�	arbitrary)r�TarFiler?�members�	ReadErrorrJ)�mode�fp�tfs   r�make_tarfilerZ~sF���
�_�_�[�$��
3��#�_��
��	�������}���s�'*�A
�	A
c��|j�r*|jjd�s|j�d�S|jS)N�/)�isdir�name�endswith)�tis r�get_tarinfo_namera�s7��
�x�x�z�"�'�'�*�*�4�0��'�'��!�}���w�w�rc��	||�y#t$r)}|jtjk(rn�Yd}~yd}~wwxYw)z�
    Execute fn on filename.  Ignore ENOENT errors, otherwise raise exception.

    @param fn: callable
    @param filename: string
    N)�OSError�errno�ENOENT)r<�filename�exs   r�ignore_missingrh�s9���
�8�����
�8�8�u�|�|�#���
���s��	=�8�=c�$�tjr�tjj	tj
�r�t
jtd�tjtj
�z�	tjj�tjtj
�dt_dt_yyy#t$r+}t
jdt|����Yd}~yd}~wwxYw)NzReleasing lockfile %srzCould not release lockfile: )r5�lockfilerr'�exists�lockpathr7�Debugr9r �release�remover4�Errorr)r0s r�release_lockfilerq�s���
���2�7�7�>�>�&�/�/�:��	�	�!�+�,�r�{�{�6�?�?�/K�K�L�	��O�O�#�#�%��I�I�f�o�o�&�"�F�O� �F�O�
;����	��I�I�4�S��V�H�=�>���	�s�AC�	D�$!D
�
Dc�t�d}d}|dkr7	|j|�}|s	|S|t|�z
}|j|��6||z|kr<|j|�}|sn(|t|�z
}|j|�||z|kr�<|j||z
�}|t|�z
}|j|�|S)z�Copy byte_count bytes from infp to outfp, or all if byte_count < 0

    Returns the number of bytes actually written (may be less than
    byte_count if find eof.  Does not close either fileobj.

    ir)�read�len�write)�infp�outfp�
byte_count�	blocksize�
bytes_written�bufs      r�copyfileobjr|�s����I��M��A�~���)�)�I�&�C�����
�S��X�%�M��K�K�����i�'�:�5��)�)�I�&�C����S��X�%�M��K�K����i�'�:�5��i�i�
�]�2�3����S��!�
�
���C���rc��d�}tjj|�\}}|r||�r|Sytjd�jtj�D]\}|jd�}tjj
tjj||��}||�s�Z|cSy)zW
    Return absolute path for program name.
    Returns None if program not found.
    c���tjj|�xrEtjj|�xr$tj|tj
�SrA)rr'�isfile�isabs�access�X_OK)�fpaths r�is_exezwhich.<locals>.is_exe�s>���w�w�~�~�e�$�[������u�)=�[�"�)�)�E�SU�SZ�SZ�B[�[r�PATH�"N)rr'�split�getenv�pathsep�strip�abspathr)�programr�r��fnamer'�exe_files      r�whichr��s���\��7�7�=�=��)�L�E�5���'�?��N��
�I�I�f�%�+�+�B�J�J�7�	 �D��:�:�c�?�D��w�w���r�w�w�|�|�D�'�'B�C�H��h����		 �rc��dtjvs!tjj	dd��rr	ddl}d}d}d}tjj	dd�}|rCttt|jd	���\}}|tj�k(ry|rt|�d
z}	j||ddd��tjd
|�d	|�d��tj$j'd�}|jtj$j(�dd}tj$j(j+|�}tj$j-d|�tj��d	|��tjd<yy#t$rtjd�Y���wxYw#t $r2}tjd
|�d	|�dt#|����Yd}~��d}~wwxYw)Nz--pydevd�PYDEVDrz�Module pydevd_pycharm must be available for debugging.
Remove '--pydevd' from command line and unset 'PYDEVD'
from the environment to avoid starting the debugger.zdione.locali,�
DEBUG_RUNNINGF�:�T)�port�suspend�stdoutToServer�stderrToServerzConnection z accepted for debug.z refused for debug: r)r
�argvr�environ�get�pydevd_pycharm�ImportErrorr7�
FatalErrorr(r)�intr��getpid�settrace�Info�ConnectionRefusedErrorrr'�pop�sepr�insert)r��
debug_host�
debug_port�	prev_port�
debug_running�prev_pidr0�bases        r�start_debuggerr��s����S�X�X��������$�!?�	�!�#�
��
��	��
�
�����>�
��"&�s�3�
�0C�0C�C�0H�'I�"J��H�i��2�9�9�;�&����Y��!�+�J�	Z��#�#����#�#�
$�
�
�H�H�{�:�,�a�
�|�;O�P�Q�
�x�x�|�|�A����z�z�"�'�'�+�+�&�s��+���w�w�{�{����%��������4� �*,����
�Q�z�l�&C��
�
�?�#�a"@���	��N�N�G�
�	��F&�	Z��H�H�{�:�,�a�
�|�;O�PS�TU�PV�x�X�Y�Y��	Z�s)�F'�52G�'G	�G	�	H�'H�Hc�:�i}|D]}|j|��|S)z�
    Given any number of dictionaries, shallow copy and merge into a new dict,
    precedence goes to key-value pairs in latter dictionaries.
    )�update)�	dict_args�result�
dictionarys   r�merge_dictsr�s)��
�F��"�
��
�
�j�!�"��Mrc���i}t|�5}tj|�}|D]+}tdt	|�d�D]}||dz|||<��-	ddd�|S#1swY|SxYw)z�
    Given the string arg in single line csv format, split into pairs (key, val)
    and produce a dictionary from those key:val pairs.
    r�r�N)r�csv�reader�rangert)�arg�mydict�infile�rows�row�is      r�csv_args_to_dictr�(s~��
�F�	�#��,�&��z�z�&�!���	,�C��1�c�#�h��*�
,��!$�Q��U���s�1�v��
,�	,�,�
�M�,�
�M�s�AA�A)c��eZdZdZd�Zy)�BytesEncoderzQ
    JSON doesn't allow byte type values. Converting them to unicode strings
    c��t|t�r|j�Stjj||�SrA)r.r/r"�json�JSONEncoder�default)rC�objs  rr�zBytesEncoder.default;s1���c�5�!��:�:�<�����'�'��c�2�2rN)r;rGrH�__doc__r�rBrrr�r�6s���3rr�)�2)r)%r��atexitr�rdr�rr
r�ior�duplicity.configr5�
duplicity.logr7�	duplicityrrr$r+r2r=r(r?�objectrJrZrarh�registerrqr|r�r�r�r�r�r�rBrr�<module>r�s���,��
���	�
���!���
� K���,�&
�D�
�

�&�
���
� ���
��
��:�.1D�h��3�4�#�#�3r

Zerion Mini Shell 1.0