§
    Ètºfü/  ã            	      ó¬  — d Z ddlmZ ddlZddlZddlZddlmZmZm	Z	m
Z
mZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZmZ ddlmZmZ dd	lmZmZmZm Z m!Z!m"Z" d
Z# ede$e%¦  «        Z& ede$e%¦  «        Z' edd¬¦  «        Z(e ee¦  «         G d„ dee'e&f         ee'         ¦  «        ¦   «         ¦   «         Z) G d„ de)e
e
f         ¦  «        Z*ddgZ+dS )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Ú_ZipSelfzZipPath[Any, Any])Úboundc                  óì   — e Zd ZU dZded<   d2d	„Zd3d„Zd4d„Zed5d„¦   «         Z	d6d„Z
d7d„Zerd8d„Zd9d„Zd9d„Zd:d„Zd:d„Zd:d„Zd:d„Zd;d!„Zd<d#„Zd5d$„Zd5d%„Zd=d>d*„Zd?d+„Zd@d,„ZdAd.„ZdAd/„ZdAd0„Zd1S )BÚZipPathzF
    I represent a file or directory contained within a zip file.
    r   ÚpathÚarchiveúZipArchive[_ArchiveStr]ÚpathInArchiveÚreturnÚNonec                ó  — || _         || _        t          |j        |¦  «        | _        t          |t
          ¦  «        }t          ||j        ¦  «        }| j                             |¦  «        }t          j        j	        |g|¢R Ž }|| _        dS )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)
r#   r%   r   Ú_zipfileFilenameÚ_nativePathInArchiveÚZIP_PATH_SEPÚsplitÚosr"   Újoin)Úselfr#   r%   ÚsepÚarchiveFilenameÚsegmentsÚfakePaths          úU/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/zippath.pyÚ__init__zZipPath.__init__=   s‘   € ð 18ˆŒØ&3ˆÔÝ1LØÔ$ mñ2
ô 2
ˆÔ!õ *¨-½ÑFÔFˆÝ#>Ø˜7Ô3ñ$
ô $
ˆð #'Ô"4×":Ò":¸3Ñ"?Ô"?ˆÝœGœL¨ÐD¸8ÐDÐDÐDˆØ%ˆŒ	ˆ	ˆ	ó    ÚotherÚobjectÚintc                óŠ   — t          |t          ¦  «        st          S t          | j        | j        f|j        |j        f¦  «        S ©N)Ú
isinstancer!   ÚNotImplementedr   r#   r%   ©r/   r7   s     r4   Ú__cmp__zZipPath.__cmp__W   sE   € Ý˜%¥Ñ)Ô)ð 	"Ý!Ð!ÝØŒ\˜4Ô-Ð.°´ÀÔ@SÐ0Tñ
ô 
ð 	
r6   Ústrc                óP  — t          | j        t          j                             | j        j        ¦  «        ¦  «        g}|                     | j                             | j        ¦  «        ¦  «         t          | j        t          j        ¦  «        }d| 	                    |¦  «        ›d�S )NzZipPath(ú))
r   r0   r-   r"   Úabspathr#   Úextendr%   r,   r.   )r/   ÚpartsÚosseps      r4   Ú__repr__zZipPath.__repr__^   s„   € õ (¨¬µ"´'·/²/À$Ä,ÔBSÑ2TÔ2TÑUÔUð
ˆð 	�Š�TÔ'×-Ò-¨d¬hÑ7Ô7Ñ8Ô8Ð8Ý+¨D¬Hµb´fÑ=Ô=ˆØ0˜%Ÿ*š* UÑ+Ô+Ð0Ð0Ð0Ð0r6   c                ó6   — t          | j        t          ¦  «        S )z–
        Return a zip directory separator.

        @return: The zip directory separator.
        @returntype: The same type as C{self.path}.
        )r   r"   r+   ©r/   s    r4   r0   zZipPath.sepg   s   € õ +¨4¬9µlÑCÔCÐCr6   ú=Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ArchiveStr]]c                óÞ   — | j                              | j        ¦  «        }t          |¦  «        dk    r| j        S t          | j        | j                             |dd…         ¦  «        ¦  «        S )zk
        Return parent, discarding our own encoding in favor of whatever the
        archive's is.
        é   Néÿÿÿÿ)r%   r,   r0   Úlenr#   r!   r.   )r/   Úsplitups     r4   Ú_nativeParentzZipPath._nativeParentq   s]   € ð Ô$×*Ò*¨4¬8Ñ4Ô4ˆÝˆw‰<Œ<˜1ÒÐØ”<ÐÝ�t”| T¤X§]¢]°7¸3¸B¸3´<Ñ%@Ô%@ÑAÔAÐAr6   ú9Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ZipStr]]c                ó°   — |                       ¦   «         }t          |t          ¦  «        r,t          t          | j        | j        j        ¦  «        ¦  «        S |S r;   )rP   r<   Ú
ZipArchiver   r"   r#   r)   )r/   Úparents     r4   rT   zZipPath.parent}   sR   € Ø×#Ò#Ñ%Ô%ˆÝ�f�jÑ)Ô)ð 	ÝÝ+¨D¬I°t´|Ô7TÑUÔUñô ð ð ˆr6   úCIterable[Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ZipStr]]]c                ó   — d S r;   © rI   s    r4   ÚparentszZipPath.parents‡   s	   € ð ˆCr6   r   ú!ZipPath[OtherAnyStr, _ArchiveStr]c                óª   — t          |t          ¦  «        }t          || j        ¦  «        }t          | 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.
        )r   r+   r%   r!   r#   r.   )r/   r"   Újoinerr%   s       r4   ÚchildzZipPath.childŒ   sH   € õ -¨Tµ<Ñ@Ô@ˆÝ3°D¸$Ô:LÑMÔMˆÝ�t”| V§[¢[°-ÀÐ1FÑ%GÔ%GÑHÔHÐHr6   c                ó”   — |                       ¦   «         }t          |t          ¦  «        r| j        n|}|                     |¦  «        }|S r;   )rT   r<   rS   r#   r\   )r/   r"   rT   ÚrightTypedParentr\   s        r4   ÚsiblingzZipPath.siblingœ   sD   € ð —’‘”ˆÝ+5°f½jÑ+IÔ+IÐU˜4œ<˜<ÈvÐØ3C×3IÒ3IÈ$Ñ3OÔ3OˆØˆr6   Úboolc                óR   — |                       ¦   «         p|                      ¦   «         S r;   )ÚisdirÚisfilerI   s    r4   ÚexistszZipPath.exists¥   s   € Ø�zŠz‰|Œ|Ð,˜tŸ{š{™}œ}Ð,r6   c                ó(   — | j         | j        j        v S r;   )r%   r#   ÚchildmaprI   s    r4   rb   zZipPath.isdir¨   s   € ØÔ! T¤\Ô%:Ð:Ð:r6   c                ó2   — | j         | j        j        j        v S r;   )r%   r#   ÚzipfileÚ
NameToInforI   s    r4   rc   zZipPath.isfile«   s   € ØÔ! T¤\Ô%9Ô%DÐDÐDr6   c                ó   — dS )NFrW   rI   s    r4   ÚislinkzZipPath.islink®   s   € Øˆur6   úList[_ZipStr]c                óŽ  ‡ — ‰                       ¦   «         rŠ‰                      ¦   «         rOt          ‰ j        j        ‰ j        ¦  «        }ˆ fd„‰ j        j        |                              ¦   «         D ¦   «         S t          t          t          j        d¦  «        ¦  «        ‚t          t          t          j        d¦  «        ¦  «        ‚)Nc                ó:   •— g | ]}t          ‰j        |¦  «        ‘ŒS rW   )r   r"   )Ú.0Úeachr/   s     €r4   ú
<listcomp>z#ZipPath.listdir.<locals>.<listcomp>·   s5   ø€ ð ð ð àõ 0°´	¸4Ñ@Ô@ðð ð r6   zLeaf zip entry listedzNon-existent zip entry listed)rd   rb   r   r#   r)   r%   rf   Úkeysr   ÚOSErrorÚerrnoÚENOTDIRÚENOENT)r/   ÚparentArchivePaths   ` r4   ÚlistdirzZipPath.listdir±   sÂ   ø€ Ø�;Š;‰=Œ=ð 	Ø�zŠz‰|Œ|ð 	WÝ1LØ”LÔ1°4Ô3Eñ2ô 2Ð!ðð ð ð à $¤Ô 5Ð6GÔ H× MÒ MÑ OÔ Oðñ ô ð õ
 &¥g­e¬mÐ=TÑ&UÔ&UÑVÔVÐVå!Ý�œÐ&EÑFÔFñô ð r6   úTuple[_ZipStr, _ZipStr]c                óJ   — t           j                             | j        ¦  «        S )zQ
        Return a value similar to that returned by C{os.path.splitext}.
        )r-   r"   ÚsplitextrI   s    r4   r{   zZipPath.splitextÂ   s   € õ Œw×Ò ¤	Ñ*Ô*Ð*r6   c                óL   — | j                              | j        ¦  «        d         S )NrM   )r%   r,   r0   rI   s    r4   ÚbasenamezZipPath.basenameË   s    € ØÔ!×'Ò'¨¬Ñ1Ô1°"Ô5Ð5r6   c                ó4   — |                       ¦   «         j        S r;   )rT   r"   rI   s    r4   ÚdirnamezZipPath.dirnameÎ   s   € ð �{Š{‰}Œ}Ô!Ð!r6   ÚrÚmodeúLiteral['r', 'w']ú	IO[bytes]c                ón   — t          d| j        ¦  «        }| j        j                             ||¬¦  «        S )NÚ )r�   )r   r%   r#   rh   Úopen)r/   r�   r%   s      r4   r†   zZipPath.openÓ   s4   € õ 4°B¸Ô8JÑKÔKˆØŒ|Ô#×(Ò(¨¸TÐ(ÑBÔBÐBr6   c                ó   — d S r;   rW   rI   s    r4   ÚchangedzZipPath.changedÚ   s   € Øˆr6   c                ód   — t          d| j        ¦  «        }| j        j        j        |         j        S )zR
        Retrieve this file's size.

        @return: file size, in bytes
        r…   )r   r%   r#   rh   ri   Ú	file_size©r/   r%   s     r4   ÚgetsizezZipPath.getsizeÝ   s,   € õ 4°B¸Ô8JÑKÔKˆØŒ|Ô#Ô.¨}Ô=ÔGÐGr6   Úfloatc                ó4   — | j                              ¦   «         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#   ÚgetAccessTimerI   s    r4   r�   zZipPath.getAccessTimeæ   s   € ð Œ|×)Ò)Ñ+Ô+Ð+r6   c                óŽ   — t          d| j        ¦  «        }t          j        | j        j        j        |         j        dz   ¦  «        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.
        r…   )r   r   r   )r   r%   ÚtimeÚmktimer#   rh   ri   Ú	date_timer‹   s     r4   ÚgetModificationTimezZipPath.getModificationTimeï   sB   € õ 4°B¸Ô8JÑKÔKˆÝŒ{ØŒLÔ Ô+¨MÔ:ÔDÀyÑPñ
ô 
ð 	
r6   c                ó*   — |                       ¦   «         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”   rI   s    r4   ÚgetStatusChangeTimezZipPath.getStatusChangeTimeû   s   € ð ×'Ò'Ñ)Ô)Ð)r6   N)r#   r$   r%   r   r&   r'   ©r7   r8   r&   r9   ©r&   r@   )r&   r   )r&   rJ   )r&   rQ   )r&   rU   )r"   r   r&   rY   ©r&   r`   )r&   rl   )r&   ry   )r€   )r�   r‚   r&   rƒ   )r&   r'   )r&   r9   ©r&   r�   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r5   r?   rG   Úpropertyr0   rP   rT   r   rX   r\   r_   rd   rb   rc   rk   rx   r{   r}   r   r†   rˆ   rŒ   r�   r”   r–   rW   r6   r4   r!   r!   4   s+  € € € € € € ðð ð €M€M�Mð&ð &ð &ð &ð4
ð 
ð 
ð 
ð1ð 1ð 1ð 1ð ðDð Dð Dñ „XðDð
Bð 
Bð 
Bð 
Bðð ð ð ð ð ð	ð 	ð 	ð 	ð
Ið Ið Ið Ið ð ð ð ð-ð -ð -ð -ð;ð ;ð ;ð ;ðEð Eð Eð Eðð ð ð ðð ð ð ð"+ð +ð +ð +ð6ð 6ð 6ð 6ð"ð "ð "ð "ð
Cð Cð Cð Cð Cðð ð ð ðHð Hð Hð Hð,ð ,ð ,ð ,ð

ð 

ð 

ð 

ð*ð *ð *ð *ð *ð *r6   r!   c                  óv   — e Zd ZU dZded<   edd„¦   «         Zdd	„Zdd„Zdd„Z	dd„Z
d d„Zd d„Zd d„Zd!d„ZdS )"rS   aì  
    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.
    r   r)   r&   r   c                ó   — | S r;   rW   rI   s    r4   r#   zZipArchive.archive  s   € àˆr6   ÚarchivePathnamer'   c                óx  — || _         t          t          d|¦  «        ¦  «        | _        | j        j        }|€
J d¦   «         ‚t          ||¦  «        | _        t          |d¦  «        | _        i | _        | j                             ¦   «         D ]­}t          | j         |¦  «         	                    | j
        ¦  «        }t          t          |¦  «        ¦  «        D ]Q}||          }| j
                             |d| …         ¦  «        }|| j        vr
i | j        |<   d| j        |         |<   ŒRt          |d¦  «        }Œ®dS )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.
        r…   Nz7zipfile must have filename when initialized with a pathrL   )r"   r   r   rh   Úfilenamer)   r%   rf   Únamelistr,   r0   ÚrangerN   r.   )r/   r£   ÚzfnameÚnameÚ	splitNameÚxr\   rT   s           r4   r5   zZipArchive.__init__  sB  € ð $ˆŒ	ÝÕ:¸2¸ÑOÔOÑPÔPˆŒØ”Ô&ˆàÐÐØDñ ÔÐå ;¸OÈVÑ TÔ TˆÔÝ8¸È"ÑMÔMˆÔð :<ˆŒà”L×)Ò)Ñ+Ô+ð 	Fð 	FˆDÝ3°D´I¸tÑDÔD×JÒJÈ4Ì8ÑTÔTˆIÝ�3˜y™>œ>Ñ*Ô*ð 1ð 1�Ø! 1 "œ�ØœŸš y°°1°"°¤~Ñ6Ô6�Ø ¤Ð.Ð.Ø,.�D”M &Ñ)Ø/0�”˜fÔ% eÑ,Ð,Ý0°À"ÑEÔEˆFˆFð	Fð 	Fr6   r7   r8   r9   c                ón   — t          |t          ¦  «        st          S t          | j        |j        ¦  «        S r;   )r<   rS   r=   r   r"   r>   s     r4   r?   zZipArchive.__cmp__6  s.   € Ý˜%¥Ñ,Ô,ð 	"Ý!Ð!Ý�4”9˜eœjÑ)Ô)Ð)r6   r"   r   úZipPath[OtherAnyStr, AnyStr]c                ó"   — 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     r4   r\   zZipArchive.child;  s   € õ �t˜TÑ"Ô"Ð"r6   r`   c                óN   — t          | j        ¦  «                             ¦   «         S )zC
        Returns C{True} if the underlying archive exists.
        )r   r)   rd   rI   s    r4   rd   zZipArchive.existsD  s!   € õ ˜Ô-Ñ.Ô.×5Ò5Ñ7Ô7Ð7r6   r�   c                óN   — t          | j        ¦  «                             ¦   «         S )z=
        Return the archive file's last access time.
        )r   r)   r�   rI   s    r4   r�   zZipArchive.getAccessTimeJ  s!   € õ ˜Ô-Ñ.Ô.×<Ò<Ñ>Ô>Ð>r6   c                óN   — t          | j        ¦  «                             ¦   «         S )z>
        Return the archive file's modification time.
        )r   r)   r”   rI   s    r4   r”   zZipArchive.getModificationTimeP  ó!   € õ ˜Ô-Ñ.Ô.×BÒBÑDÔDÐDr6   c                óN   — t          | j        ¦  «                             ¦   «         S )z?
        Return the archive file's status change time.
        )r   r)   r–   rI   s    r4   r–   zZipArchive.getStatusChangeTimeV  r²   r6   r@   c                óR   — dt           j                             | j        ¦  «        ›d�S )NzZipArchive(rB   )r-   r"   rC   rI   s    r4   rG   zZipArchive.__repr__\  s#   € Ø<�RœWŸ_š_¨T¬YÑ7Ô7Ð<Ð<Ð<Ð<r6   N)r&   r   )r£   r   r&   r'   r—   )r"   r   r&   r­   r™   rš   r˜   )r›   rœ   r�   rž   rŸ   r    r#   r5   r?   r\   rd   r�   r”   r–   rG   rW   r6   r4   rS   rS     sø   € € € € € € ð
ð 
ð ÐÐÑàðð ð ñ „XððFð Fð Fð Fð<*ð *ð *ð *ð
#ð #ð #ð #ð8ð 8ð 8ð 8ð?ð ?ð ?ð ?ðEð Eð Eð EðEð Eð Eð Eð=ð =ð =ð =ð =ð =r6   rS   ),rž   Ú
__future__r   rt   r-   r‘   Útypingr   r   r   r   r   r	   r
   r   r   r   r   rh   r   Úzope.interfacer   Útyping_extensionsr   r   Útwisted.python.compatr   r   Útwisted.python.filepathr   r   r   r   r   r   r+   Úbytesr@   r   r   r   r!   rS   Ú__all__rW   r6   r4   ú<module>r½      s\  ðð
ð ð
 #Ð "Ð "Ð "Ð "Ð "à €€€Ø 	€	€	€	Ø €€€ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð Ð Ð Ð Ð Ð à &Ð &Ð &Ð &Ð &Ð &à +Ð +Ð +Ð +Ð +Ð +Ð +Ð +à 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð €ð ˆg�m U¨CÑ0Ô0€Ø
ˆ'�)˜U CÑ
(Ô
(€Øˆ7�:Ð%8Ð9Ñ9Ô9€ð Ø€ˆYÑÔðL*ð L*ð L*ð L*ð L*ˆg�g˜{Ð*Ô+Ð-=¸gÔ-Fñ L*ô L*ñ Ôñ „ðL*ð^X=ð X=ð X=ð X=ð X=�˜ ˜Ô(ñ X=ô X=ð X=ðv ˜Ð
#€€€r6   