%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/debian/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/debian/__pycache__/arfile.cpython-312.pyc

�

Cf�c�5��(�dZddlmZddlZ	ddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZdZee�ZdZdZGd�d	e�ZGd
�de�ZGd�d
e�Zedk(r.ed�Zedj;ej=���yy#e$rY�jwxYw)z� Representation of ar archives for use with Debian binary packages

These classes are primarily intended to be used with the
:class:`debian.debfile.DebFile` class for working with Debian binary
packages.
�)�PathN)
�Any�BinaryIO�Dict�	Generator�IO�Iterator�List�NoReturn�Optional�Unions!<arch>
�<s`
c��eZdZdZy)�ArErrorz@ Common base for all exceptions raised within the arfile module N)�__name__�
__module__�__qualname__�__doc__���//usr/lib/python3/dist-packages/debian/arfile.pyrr5s��Jrrc�n�eZdZdZ					dd�Zd�Zd�Zd�Zd�Ze	e�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zy)�ArFilea Representation of an ar archive, see man 1 ar.

    The interface of this class tries to mimic that of the TarFile module in
    the standard library.

    ArFile objects have the following (read-only) properties:
        - members       same as getmembers()
    Nc��g|_i|_||_||_|xst	j
�|_|�d}||_|dk(r|j�yy)a� Build an ar file representation starting from either a filename or
        an existing file object. The only supported mode is 'r'.

        The encoding and errors parameters control how member
        names are decoded into Unicode strings. Like tarfile, the default
        encoding is sys.getfilesystemencoding() and the default error handling
        scheme is 'surrogateescape'.
        N�surrogateescape�r)	�_ArFile__members�_ArFile__members_dict�_ArFile__fname�_ArFile__fileobj�sys�getfilesystemencoding�_ArFile__encoding�_ArFile__errors�_ArFile__index_archive)�self�filename�mode�fileobj�encoding�errorss      r�__init__zArFile.__init__Cs_�� ��� ������ ���"�A�c�&?�&?�&A����>�&�F���
��3�;�� � �"�rc��|jr1t|jd�5}|j|�ddd�y|jr|j|j�yt	d��#1swYyxYw)N�rbzUnable to open valid file)r�open�_ArFile__collect_membersr r)r&�fps  r�__index_archivezArFile.__index_archive`sf���<�<��d�l�l�D�)�
+�R��&�&�r�*�
+�
+�
�^�^��"�"�4�>�>�2��5�6�6�
+�
+�s�A1�1A:c���|jt�tk7rtd��	tj||j|j|j��}|sy|jj|�||j|j<|jdzdk(r|j|jd�n|j|jdzd���)NzUnable to find global header)r*r+�r�)�read�GLOBAL_HEADER_LENGTH�
GLOBAL_HEADERr�ArMember�	from_filerr#r$r�appendr�name�size�seek)r&r1�	newmembers   r�__collect_memberszArFile.__collect_membersjs���
�7�7�'�(�M�9��8�9�9�� �*�*�2�t�|�|�48�O�O�26�-�-�+�A�I����N�N�!�!�)�,�2;�D���	���/��~�~��!�Q�&����	����*����	����*�A�.�rc� �|j|S)a Return the (last occurrence of a) member in the archive whose name
        is 'name'. Raise KeyError if no member matches the given name.

        Note that in case of name collisions the only way to retrieve all
        members matching a given name is to use getmembers. )r�r&r<s  r�	getmemberzArFile.getmember|s���"�"�4�(�(rc��|jS)z� Return a list of all members contained in the archive.

        The list has the same order of members in the archive and can contain
        duplicate members (i.e. members with the same name) if they are
        duplicate in the archive itself. )r�r&s r�
getmemberszArFile.getmembers�s���~�~�rc�T�|jD�cgc]}|j��c}Scc}w)z3 Return a list of all member names in the archive. )rr<)r&�fs  r�getnameszArFile.getnames�s ��!%���/�1����/�/��/s�%c��t��z Not (yet) implemented. ��NotImplementedErrorrEs r�
extractallzArFile.extractall��
��"�!rc��t�rKrL)r&�member�paths   r�extractzArFile.extract�rOrc��|jD]B}t|t�r|j|jk(r|cS||jk(s�@|cSy)z� Return a file object corresponding to the requested member. A member
        can be specified either as a string (its name) or as a ArMember
        instance. N)r�
isinstancer9r<)r&rQ�ms   r�extractfilezArFile.extractfile�sK�����	�A��&�(�+����&�+�+�0E����������		�
rc�,�t|j�S)z5 Iterate over the members of the present ar archive. )�iterrrEs r�__iter__zArFile.__iter__�s���D�N�N�#�#rc�$�|j|�S)z Same as .getmember(name). )rCrBs  r�__getitem__zArFile.__getitem__�s���~�~�d�#�#r)NrNNN)rrrrr,r%r0rCrF�property�membersrIrNrSrWrZr\rrrrr9s[��������#�:7�/�$)���z�"�G�0�"�"��.$�$rrc���eZdZdZd�Ze		dd��Zdd�Zdd�Zdd�Z	dd�Z
d	�Zd
�Zd�Z
d�Zd
�Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zy)r9a� Member of an ar archive.

    Implements most of a file object interface: read, readline, next,
    readlines, seek, tell, close.

    ArMember objects have the following (read-only) properties:
        - name      member name in an ar archive
        - mtime     modification time
        - owner     owner user
        - group     owner group
        - fmode     file permissions
        - size      size in bytes
        - fname     file namec��d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
y)N�r)�_ArMember__name�_ArMember__mtime�_ArMember__owner�_ArMember__group�_ArMember__fmode�_ArMember__size�_ArMember__fname�
_ArMember__fp�_ArMember__offset�_ArMember__end�_ArMember__currEs rr,zArMember.__init__�sQ�������������������������	���
���
���
rNc��|jt�}|syt|�tkrtd��|ddtk7rtd��|�tj�}|�d}t�}|ddjd	�dj�}|j||�|_t|dd
�|_
t|d
d�|_t|dd�|_|dd
|_t|d
d�|_||_|s||_|j)�|_|j*|j"z|_|j*|_|S)z�fp is an open File object positioned on a valid file header inside
        an ar archive. Return a new ArMember on success, None otherwise. NzIncorrect header length�:rzIncorrect file magicrr��/��"�(�0)r6�FILE_HEADER_LENGTH�len�IOError�
FILE_MAGICr!r"r9�split�strip�decoderb�intrcrdrerfrgrhri�tellrjrkrl)r1�fnamer*r+�bufrHr<s       rr:zArMember.from_file�s>���g�g�(�)�����s�8�(�(��3�4�4��r�"�:��#��0�1�1����0�0�2�H��>�&�F�
�J���1�R�y���t�$�Q�'�-�-�/���;�;�x��0�����B�r�
�O��	���B�r�
�O��	���B�r�
�O��	���2�J��	��s�2�b�z�?�����	���A�F��W�W�Y��
��*�*�q�x�x�'����*�*����rc��|j�2|j�td��t|jd�|_|jj	|j
�d|cxkr|j|j
z
kr?nn<|jj|�}|jj�|_|S|j
|jk\s|j
|jkry|jj|j|j
z
�}|jj�|_|S)N�'Cannot have both fp and fname undefinedr.rr)
rirh�
ValueErrorr/r>rlrkr6r}rj�r&r=rs   rr6z
ArMember.read.s����9�9���|�|�#� �!J�K�K��T�\�\�4�0�D�I��	�	���t�z�z�"��t�.�t�z�z�D�J�J�.�.��)�)�.�.��&�C������)�D�J��J��:�:����#�t�z�z�D�M�M�'A���i�i�n�n�T�Z�Z�$�*�*�4�5���Y�Y�^�^�%��
��
rc�"�|j�2|j�td��t|jd�|_|jj	|j
�|�V|jj
|�}|jj�|_|j
|jkDry|S|jj
�}|jj�|_|j
|jkDry|S)Nr�r.r)	rirhr�r/r>rl�readliner}rkr�s   rr�zArMember.readlineBs����9�9���|�|�#� �!J�K�K��T�\�\�4�0�D�I��	�	���t�z�z�"����)�)�$�$�T�*�C������)�D�J��z�z�D�J�J�&���J��i�i� � �"���Y�Y�^�^�%��
��:�:��
�
�"���
rc�Z�d}g}	|j�}|s	|S|j|��'�N)r�r;)r&�sizehintr�liness    r�	readlineszArMember.readlinesXs<��������-�-�/�C�����
�L�L���	rc�R�|j|jkr|j|_|dkr*||jz|jkrtd|z��|dk(r|j|z|_y|dk(r|j|z|_y|dk(r|j|z|_yy)Nr4zCan't seek at %dr5r)rlrjrwrk)r&�offset�whences   rr>z
ArMember.seekes����:�:��
�
�%����D�J��A�:�&�4�:�:�-��
�
�=��,�v�5�6�6��Q�;����f�,�D�J�
�q�[�����/�D�J�
�q�[����f�,�D�J�rc�h�|j|jkry|j|jz
S)Nr)rlrjrEs rr}z
ArMember.tellts(���:�:��
�
�%���z�z�D�M�M�)�)rc��y)NTrrEs r�seekablezArMember.seekablezs��rc�z�|j�/|j�"|jj�d|_yyyr�)rirh�closerEs rr�zArMember.close~s2���9�9� �T�\�\�%=��I�I�O�O���D�I�&>� rc�"�|j�Sr��r�rEs r�nextz
ArMember.next�s���}�}��rc�.���fd�}t|��S)Nc3�<�K��j�}|r|��yy�wr�r�)�liner&s �r�nextlinez#ArMember.__iter__.<locals>.nextline�s������=�=�?�D���
��s�)rY)r&r�s` rrZzArMember.__iter__�s���	��H�J��rc��|jSr�)rbrEs r�<lambda>zArMember.<lambda>��
�����rc��|jSr�)rcrEs rr�zArMember.<lambda>��
��$�,�,�rc��|jSr�)rdrEs rr�zArMember.<lambda>�r�rc��|jSr�)rerEs rr�zArMember.<lambda>�r�rc��|jSr�)rfrEs rr�zArMember.<lambda>�r�rc��|jSr�)rgrEs rr�zArMember.<lambda>�r�rc��|jSr�)rhrEs rr�zArMember.<lambda>�r�r)NN)rr�)rrrrr,�staticmethodr:r6r�r�r>r}r�r�r�rZr]r<�mtime�owner�group�fmoder=r~rrrr9r9�s���!��2� ��8��8�z�(�,�
-�*���� ��,�-�D��.�/�E��.�/�E��.�/�E��.�/�E��,�-�D��.�/�Err9�__main__ztest.ar�
)r�pathlibrr!�typingrrrrrr	r
rrr
�ImportErrorr8rvr7rurx�	Exceptionr�objectrr9r�a�print�joinrIrrr�<module>r�s����.�
�	����"�
��=�)����
�
�K�i�K�L$�V�L$�^P0�v�P0�f�z��	�y��A�	�$�)�)�A�J�J�L�
!�"�	��e�	��	�s�B	�	B�B

Zerion Mini Shell 1.0