%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/zippath.cpython-312.pyc

�

Ϫ�f�/�	�h�dZddlmZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZddlmZddlmZddlmZmZddlmZmZdd	lmZmZmZmZm Z m!Z!d
Z"ede#e$�Z%ede#e$�Z&ed
d��Z'eee�Gd�dee&e%fee&���Z(Gd�de(e
e
f�Z)ddgZ*y)zt
This module contains implementations of L{IFilePath} for zip files.

See the constructor of L{ZipArchive} for use.
�)�annotationsN)�IO�
TYPE_CHECKING�Any�AnyStr�Dict�Generic�Iterable�List�Tuple�TypeVar�Union)�ZipFile)�implementer)�Literal�Self)�cmp�
comparable)�AbstractFilePath�FilePath�	IFilePath�OtherAnyStr�UnlistableError�_coerceToFilesystemEncoding�/�_ArchiveStr�_ZipStr�_ZipSelfzZipPath[Any, Any])�boundc��eZdZUdZded<						dd�Zdd�Zdd�Zedd��Z			d d�Z
d!d	�Zer		d"d
�Z
d#d�Zd#d�Zd$d
�Zd$d�Zd$d�Zd$d�Zd%d�Zd&d�Zdd�Zdd�Zd'd(d�Zd)d�Zd*d�Zd+d�Zd+d�Zd+d�Zy),�ZipPathzF
    I represent a file or directory contained within a zip file.
    r�pathc�&�||_||_t|j|�|_t|t
�}t||j�}|jj
|�}tjj|g|���}||_y)z�
        Don't construct me directly.  Use C{ZipArchive.child()}.

        @param archive: a L{ZipArchive} instance.

        @param pathInArchive: a ZIP_PATH_SEP-separated string.
        N)
�archive�
pathInArchiver�_zipfileFilename�_nativePathInArchive�ZIP_PATH_SEP�split�osr"�join)�selfr$r%�sep�archiveFilename�segments�fakePaths       �8/usr/lib/python3/dist-packages/twisted/python/zippath.py�__init__zZipPath.__init__=s���18���&3���1L��$�$�m�2
��!�*�-��F��#>��7�3�3�$
��#'�"4�"4�":�":�3�"?���G�G�L�L��D�8�D��%��	�c��t|t�stSt|j|j
f|j|j
f�S�N)�
isinstancer!�NotImplementedrr$r%�r,�others  r1�__cmp__zZipPath.__cmp__WsB���%��)�!�!��
�\�\�4�-�-�.�����@S�@S�0T�
�	
r3c�l�t|jtjj	|j
j��g}|j
|jj|j��t|jtj�}d|j|��d�S)NzZipPath(�))
rr-r*r"�abspathr$�extendr%r)r+)r,�parts�osseps   r1�__repr__zZipPath.__repr__^s���
(����"�'�'�/�/�$�,�,�BS�BS�2T�U�
��	���T�'�'�-�-�d�h�h�7�8�+�D�H�H�b�f�f�=���%�*�*�U�+�.�a�0�0r3c�6�t|jt�S)z�
        Return a zip directory separator.

        @return: The zip directory separator.
        @returntype: The same type as C{self.path}.
        )rr"r(�r,s r1r-zZipPath.sepgs��+�4�9�9�l�C�Cr3c���|jj|j�}t|�dk(r|jSt|j|jj
|dd��S)zk
        Return parent, discarding our own encoding in favor of whatever the
        archive's is.
        �N���)r%r)r-�lenr$r!r+)r,�splitups  r1�
_nativeParentzZipPath._nativeParentqsX���$�$�*�*�4�8�8�4���w�<�1���<�<���t�|�|�T�X�X�]�]�7�3�B�<�%@�A�Ar3c��|j�}t|t�r3tt|j|j
j��S|Sr5)rIr6�
ZipArchiverr"r$r&)r,�parents  r1rLzZipPath.parent}sF���#�#�%���f�j�)��+�D�I�I�t�|�|�7T�7T�U��
��
r3c��yr5�rCs r1�parentszZipPath.parents�s��
r3c��t|t�}t||j�}t|j|j||g��S)a&
        Return a new ZipPath representing a path in C{self.archive} which is
        a child of this path.

        @note: Requesting the C{".."} (or other special name) child will not
            cause L{InsecurePath} to be raised since these names do not have
            any special meaning inside a zip archive.  Be particularly
            careful with the C{path} attribute (if you absolutely must use
            it) as this means it may include special names with special
            meaning outside of the context of a zip archive.
        )rr(r%r!r$r+)r,r"�joinerr%s    r1�childz
ZipPath.child�sA��-�T�<�@��3�D�$�:L�:L�M�
��t�|�|�V�[�[�-��1F�%G�H�Hr3c��|j�}t|t�r|jn|}|j	|�}|Sr5)rLr6rKr$rR)r,r"rL�rightTypedParentrRs     r1�siblingzZipPath.sibling�s9�������+5�f�j�+I�4�<�<�v��3C�3I�3I�$�3O���r3c�F�|j�xs|j�Sr5)�isdir�isfilerCs r1�existszZipPath.exists�s���z�z�|�,�t�{�{�}�,r3c�F�|j|jjvSr5)r%r$�childmaprCs r1rWz
ZipPath.isdir�s���!�!�T�\�\�%:�%:�:�:r3c�Z�|j|jjjvSr5)r%r$�zipfile�
NameToInforCs r1rXzZipPath.isfile�s#���!�!�T�\�\�%9�%9�%D�%D�D�Dr3c��y)NFrNrCs r1�islinkzZipPath.islink�s��r3c��|j�r�|j�rst|jj|j
�}|jj|j�D�cgc]}t|j|���c}Stttjd���tttjd���cc}w)NzLeaf zip entry listedzNon-existent zip entry listed)rYrWrr$r&r%r[�keysr"r�OSError�errno�ENOTDIR�ENOENT)r,�parentArchivePath�eachs   r1�listdirzZipPath.listdir�s����;�;�=��z�z�|�1L��L�L�1�1�4�3E�3E�2�!�
!%��� 5� 5�6G� H� M� M� O���0��	�	�4�@���
&�g�e�m�m�=T�&U�V�V�!�����&E�F��
��s�4Cc�T�tjj|j�S)zQ
        Return a value similar to that returned by C{os.path.splitext}.
        )r*r"�splitextrCs r1rkzZipPath.splitext�s���w�w����	�	�*�*r3c�R�|jj|j�dS)NrF)r%r)r-rCs r1�basenamezZipPath.basename�s"���!�!�'�'����1�"�5�5r3c�6�|j�jSr5)rLr"rCs r1�dirnamezZipPath.dirname�s���{�{�}�!�!�!r3c�|�td|j�}|jjj	||��S)N�)�mode)rr%r$r]�open)r,rrr%s   r1rszZipPath.open�s6��4�B��8J�8J�K�
��|�|�#�#�(�(��T�(�B�Br3c��yr5rNrCs r1�changedzZipPath.changed�s��r3c��td|j�}|jjj|j
S)zR
        Retrieve this file's size.

        @return: file size, in bytes
        rq)rr%r$r]r^�	file_size�r,r%s  r1�getsizezZipPath.getsize�s7��4�B��8J�8J�K�
��|�|�#�#�.�.�}�=�G�G�Gr3c�6�|jj�S)z�
        Retrieve this file's last access-time.  This is the same as the last access
        time for the archive.

        @return: a number of seconds since the epoch
        )r$�
getAccessTimerCs r1r{zZipPath.getAccessTime�s���|�|�)�)�+�+r3c��td|j�}tj|jj
j|jdz�S)z�
        Retrieve this file's last modification time.  This is the time of
        modification recorded in the zipfile.

        @return: a number of seconds since the epoch.
        rq)rrr)rr%�time�mktimer$r]r^�	date_timerxs  r1�getModificationTimezZipPath.getModificationTime�sJ��4�B��8J�8J�K�
��{�{��L�L� � �+�+�M�:�D�D�y�P�
�	
r3c�"�|j�S)z�
        Retrieve this file's last modification time.  This name is provided for
        compatibility, and returns the same value as getmtime.

        @return: a number of seconds since the epoch.
        )r�rCs r1�getStatusChangeTimezZipPath.getStatusChangeTime�s���'�'�)�)r3N)r$zZipArchive[_ArchiveStr]r%r�return�None�r9�objectr��int�r��str)r�r)r�z=Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ArchiveStr]])r�z9Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ZipStr]])r�zCIterable[Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ZipStr]]])r"rr�z!ZipPath[OtherAnyStr, _ArchiveStr]�r��bool)r�z
List[_ZipStr])r�zTuple[_ZipStr, _ZipStr])�r)rrzLiteral['r', 'w']r�z	IO[bytes])r�r�)r�r��r��float)�__name__�
__module__�__qualname__�__doc__�__annotations__r2r:rA�propertyr-rIrLrrOrRrUrYrWrXr`rirkrmrorsruryr{r�r�rNr3r1r!r!4s�����M�&�.�&�?F�&�	
�&�4
�1��D��D�
B�	F�
B���	�
P�	�
I� �-�;�E���"+�6�"�
C�
�H�,�

�*r3r!c�n�eZdZUdZded<edd��Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
dd�Zy
)rKa�
    I am a L{FilePath}-like object which can wrap a zip archive as if it were a
    directory.

    It works similarly to L{FilePath} in L{bytes} and L{unicode} handling --
    instantiating with a L{bytes} will return a "bytes mode" L{ZipArchive},
    and instantiating with a L{unicode} will return a "text mode"
    L{ZipArchive}. Methods that return new L{ZipArchive} or L{ZipPath}
    instances will be in the mode of the argument to the creator method,
    converting if required.
    rr&c��|Sr5rNrCs r1r$zZipArchive.archives���r3c�d�||_ttd|��|_|jj}|�Jd��t||�|_t|d�|_i|_|jj�D]�}t|j|�j|j�}tt|��D]V}||}|jj|d|�}||jvri|j|<d|j||<�Xt|d�}��y)z�
        Create a ZipArchive, treating the archive at archivePathname as a zip
        file.

        @param archivePathname: a L{bytes} or L{unicode}, naming a path in the
            filesystem.
        rqNz7zipfile must have filename when initialized with a pathrE)r"rrr]�filenamer&r%r[�namelistr)r-�rangerGr+)r,�archivePathname�zfname�name�	splitName�xrRrLs        r1r2zZipArchive.__init__s"��$��	��:�2��O�P������&�&����	E�D�	E�� ;�O�V� T���8��"�M���:<��
��L�L�)�)�+�	F�D�3�D�I�I�t�D�J�J�4�8�8�T�I��3�y�>�*�
1��!�1�"�
�������y��1�"�~�6������.�,.�D�M�M�&�)�/0��
�
�f�%�e�,�
1�1��"�E�F�	Fr3c�n�t|t�stSt|j|j�Sr5)r6rKr7rr"r8s  r1r:zZipArchive.__cmp__6s'���%��,�!�!��4�9�9�e�j�j�)�)r3c��t||�S)z�
        Create a ZipPath pointing at a path within the archive.

        @param path: a L{bytes} or L{unicode} with no path separators in it
            (either '/' or the system path separator, if it's different).
        )r!)r,r"s  r1rRzZipArchive.child;s���t�T�"�"r3c�H�t|j�j�S)zC
        Returns C{True} if the underlying archive exists.
        )rr&rYrCs r1rYzZipArchive.existsDs����-�-�.�5�5�7�7r3c�H�t|j�j�S)z=
        Return the archive file's last access time.
        )rr&r{rCs r1r{zZipArchive.getAccessTimeJs����-�-�.�<�<�>�>r3c�H�t|j�j�S)z>
        Return the archive file's modification time.
        )rr&r�rCs r1r�zZipArchive.getModificationTimeP�����-�-�.�B�B�D�Dr3c�H�t|j�j�S)z?
        Return the archive file's status change time.
        )rr&r�rCs r1r�zZipArchive.getStatusChangeTimeVr�r3c�\�dtjj|j��d�S)NzZipArchive(r<)r*r"r=rCs r1rAzZipArchive.__repr__\s#���R�W�W�_�_�T�Y�Y�7�:�!�<�<r3N)r�r)r�rr�r�r�)r"rr�zZipPath[OtherAnyStr, AnyStr]r�r�r�)r�r�r�r�r�r�r$r2r:rRrYr{r�r�rArNr3r1rKrKsL��
���
����F�<*�
#�8�?�E�E�=r3rK)+r��
__future__rrdr*r}�typingrrrrrr	r
rrr
rr]r�zope.interfacerrr�twisted.python.compatrr�twisted.python.filepathrrrrrrr(�bytesr�rrrr!rK�__all__rNr3r1�<module>r�s���
�
#��	�������&� �1������m�U�C�0��
�)�U�C�
(���:�%8�9����Y��L*�g�g�{�*�+�-=�g�-F�L*���L*�^X=�����(�X=�v��
#�r3

Zerion Mini Shell 1.0