+
    Dfj/              	         R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHtH	t	H
t
HtHtHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHtHt ^ RIHtHtHtHtH t H!t! R	t"]! R
]#]$4      t%]! R]#]$4      t&]! RRR7      t']]! ]4       ! R R]]&]%3,          ]]&,          4      4       4       t( ! R R](]
]
3,          4      t)RR.t*R# )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                  X   ] tR t^4t$ RtR]R&   R R ltR R ltR R	 lt]	R
 R l4       t
R R ltR R lt]'       d   R R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltR4R& R' lltR( R) ltR* R+ ltR, R- ltR. R/ ltR0 R1 ltR2tR3# )5ZipPathz>
I represent a file or directory contained within a zip file.
r   pathc               $    V ^8  d   QhRRRRRR/# )   archivezZipArchive[_ArchiveStr]pathInArchiver   returnNone )formats   "8/usr/lib/python3/dist-packages/twisted/python/zippath.py__annotate__ZipPath.__annotate__=   s$     & &.&?F&	&    c                $   Wn         W n        \        VP                  V4      V n        \        V\
        4      p\        W!P                  4      pV P                  P                  V4      p\        P                  P                  ! V.VO5!  pW`n        R# )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   &&&    r*   __init__ZipPath.__init__=   s|     18&31L$$m2
! *-F#>33$
 #'"4"4":":3"?GGLLD8D%	r-   c                    V ^8  d   QhRRRR/# r#   otherobjectr&   intr(   )r)   s   "r*   r+   r,   W   s     
 
V 
 
r-   c                	    \        V\        4      '       g   \        # \        V P                  V P
                  3VP                  VP
                  34      # N)
isinstancer    NotImplementedr   r$   r%   r5   r>   s   &&r*   __cmp__ZipPath.__cmp__W   sE    %))!!\\4--.@S@S0T
 	
r-   c                   V ^8  d   QhRR/# r#   r&   strr(   )r)   s   "r*   r+   r,   ^   s     1 1# 1r-   c                	n   \        V P                  \        P                  P	                  V P
                  P                  4      4      .pVP                  V P                  P                  V P                  4      4       \        V P                  \        P                  4      pR VP                  V4      : R2# )zZipPath())
r   r6   r3   r!   abspathr$   extendr%   r2   r4   )r5   partsosseps   &  r*   __repr__ZipPath.__repr__^   s     ("''//$,,BSBS2TU
 	T''--dhh78+DHHbff=%**U+.a00r-   c                   V ^8  d   QhRR/# r#   r&   r   r(   )r)   s   "r*   r+   r,   h   s     D DW Dr-   c                6    \        V P                  \        4      # )zv
Return a zip directory separator.

@return: The zip directory separator.
@returntype: The same type as C{self.path}.
)r   r!   r1   r5   s   &r*   r6   ZipPath.sepg   s     +499lCCr-   c                   V ^8  d   QhRR/# )r#   r&   z=Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ArchiveStr]]r(   )r)   s   "r*   r+   r,   q   s     
B 
B	F
Br-   c                    V P                   P                  V P                  4      p\        V4      ^8X  d   V P                  # \        V P                  V P                  P                  VRR 4      4      # )zS
Return parent, discarding our own encoding in favor of whatever the
archive's is.
N)r%   r2   r6   lenr$   r    r4   )r5   splitups   & r*   _nativeParentZipPath._nativeParentq   sX     $$**4884w<1<<t||TXX]]73B<%@AAr-   c                   V ^8  d   QhRR/# )r#   r&   z9Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ZipStr]]r(   )r)   s   "r*   r+   r,   }   s      Q r-   c                	    V P                  4       p\        V\        4      '       d4   \        \        V P                  V P
                  P                  4      4      # V# rB   )r]   rC   
ZipArchiver   r!   r$   r/   )r5   parents   & r*   rb   ZipPath.parent}   sI    ##%fj))+DIIt||7T7TU  r-   c                   V ^8  d   QhRR/# )r#   r&   zCIterable[Union[ZipPath[_ZipStr, _ArchiveStr], ZipArchive[_ZipStr]]]r(   )r)   s   "r*   r+   r,      s     	 	P	r-   c                	    R # rB   r(   rV   s   &r*   parentsZipPath.parents   s     r-   c                    V ^8  d   QhRRRR/# r#   r!   r   r&   z!ZipPath[OtherAnyStr, _ArchiveStr]r(   )r)   s   "r*   r+   r,      s     I I+ I*K Ir-   c                    \        V\        4      p\        WP                  4      p\        V P                  VP                  W1.4      4      # )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   r1   r%   r    r$   r4   )r5   r!   joinerr%   s   &&  r*   childZipPath.child   s=     -T<@3D:L:LMt||V[[-1F%GHHr-   c                    V ^8  d   QhRRRR/# ri   r(   )r)   s   "r*   r+   r,      s      K ,M r-   c                	    V P                  4       p\        V\        4      '       d   V P                  MTpVP	                  V4      pV# rB   )rb   rC   ra   r$   rl   )r5   r!   rb   rightTypedParentrl   s   &&   r*   siblingZipPath.sibling   s<     +5fj+I+I4<<v3C3I3I$3Or-   c                   V ^8  d   QhRR/# r#   r&   boolr(   )r)   s   "r*   r+   r,      s     - - -r-   c                	R    V P                  4       ;'       g    V P                  4       # rB   )isdirisfilerV   s   &r*   existsZipPath.exists   s    zz|,,t{{},r-   c                   V ^8  d   QhRR/# rt   r(   )r)   s   "r*   r+   r,      s     ; ;t ;r-   c                	H    V P                   V P                  P                  9   # rB   )r%   r$   childmaprV   s   &r*   rw   ZipPath.isdir   s    !!T\\%:%:::r-   c                   V ^8  d   QhRR/# rt   r(   )r)   s   "r*   r+   r,      s     E E Er-   c                	\    V P                   V P                  P                  P                  9   # rB   )r%   r$   zipfile
NameToInforV   s   &r*   rx   ZipPath.isfile   s#    !!T\\%9%9%D%DDDr-   c                   V ^8  d   QhRR/# rt   r(   )r)   s   "r*   r+   r,      s       r-   c                	    R # )Fr(   rV   s   &r*   islinkZipPath.islink   s    r-   c                   V ^8  d   QhRR/# )r#   r&   zList[_ZipStr]r(   )r)   s   "r*   r+   r,      s       r-   c                	   V P                  4       '       d   V P                  4       '       dz   \        V P                  P                  V P
                  4      pV P                  P                  V,          P                  4        Uu. uF  p\        V P                  V4      NK  	  up# \        \        \        P                  R 4      4      h\        \        \        P                  R4      4      hu upi )zLeaf zip entry listedzNon-existent zip entry listed)ry   rw   r   r$   r/   r%   r}   keysr!   r   OSErrorerrnoENOTDIRENOENT)r5   parentArchivePatheachs   &  r*   listdirZipPath.listdir   s    ;;==zz||1LLL1143E3E2!
 !% 5 56G H M M O O 0		4@ O 
 &gemm=T&UVV!&EF s   C,c                   V ^8  d   QhRR/# )r#   r&   zTuple[_ZipStr, _ZipStr]r(   )r)   s   "r*   r+   r,      s     + +1 +r-   c                T    \         P                  P                  V P                  4      # )zA
Return a value similar to that returned by C{os.path.splitext}.
)r3   r!   splitextrV   s   &r*   r   ZipPath.splitext   s     ww		**r-   c                   V ^8  d   QhRR/# rT   r(   )r)   s   "r*   r+   r,      s     6 6' 6r-   c                	Z    V P                   P                  V P                  4      R,          # )   rZ   )r%   r2   r6   rV   s   &r*   basenameZipPath.basename   s"    !!''1"55r-   c                   V ^8  d   QhRR/# rT   r(   )r)   s   "r*   r+   r,      s     " " "r-   c                	6    V P                  4       P                  # rB   )rb   r!   rV   s   &r*   dirnameZipPath.dirname   s     {{}!!!r-   c                    V ^8  d   QhRRRR/# )r#   modezLiteral['r', 'w']r&   z	IO[bytes]r(   )r)   s   "r*   r+   r,      s     C C* CY Cr-   c                	z    \        R V P                  4      pV P                  P                  P	                  W!R7      # ) )r   )r   r%   r$   r   open)r5   r   r%   s   && r*   r   ZipPath.open   s4     4B8J8JK||##(((BBr-   c                   V ^8  d   QhRR/# )r#   r&   r'   r(   )r)   s   "r*   r+   r,      s       r-   c                	    R # rB   r(   rV   s   &r*   changedZipPath.changed   s    r-   c                   V ^8  d   QhRR/# )r#   r&   r@   r(   )r)   s   "r*   r+   r,      s     H H Hr-   c                    \        RV P                  4      pV P                  P                  P                  V,          P
                  # )z:
Retrieve this file's size.

@return: file size, in bytes
r   )r   r%   r$   r   r   	file_sizer5   r%   s   & r*   getsizeZipPath.getsize   s7     4B8J8JK||##..}=GGGr-   c                   V ^8  d   QhRR/# r#   r&   floatr(   )r)   s   "r*   r+   r,      s     , ,u ,r-   c                6    V P                   P                  4       # )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$   getAccessTimerV   s   &r*   r   ZipPath.getAccessTime   s     ||))++r-   c                   V ^8  d   QhRR/# r   r(   )r)   s   "r*   r+   r,      s     

 

U 

r-   c                    \        RV P                  4      p\        P                  ! V P                  P
                  P                  V,          P                  R,           4      # )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%   timemktimer$   r   r   	date_timer   s   & r*   getModificationTimeZipPath.getModificationTime   sJ     4B8J8JK{{LL  ++M:DDyP
 	
r-   c                   V ^8  d   QhRR/# r   r(   )r)   s   "r*   r+   r,      s     * *U *r-   c                "    V P                  4       # )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   rV   s   &r*   getStatusChangeTimeZipPath.getStatusChangeTime   s     ''))r-   )r0   r$   r!   r%   N)r) __name__
__module____qualname____firstlineno____doc____annotations__r:   rF   rQ   propertyr6   r]   rb   r   rf   rl   rq   ry   rw   rx   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__r(   r-   r*   r    r    4   s     M&4
1 D D
B 	
I -;E"+6"
CH,

* *r-   r    c                      ] tR tRt$ RtR]R&   ]R R l4       tR R ltR	 R
 lt	R R lt
R R ltR R ltR R ltR R ltR R ltRtR# )ra   i  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/   c                   V ^8  d   QhRR/# )r#   r&   r   r(   )r)   s   "r*   r+   ZipArchive.__annotate__  s       r-   c                	    V # rB   r(   rV   s   &r*   r$   ZipArchive.archive  s    r-   c                    V ^8  d   QhRRRR/# )r#   archivePathnamer   r&   r'   r(   )r)   s   "r*   r+   r     s     F F F4 Fr-   c                   Wn         \        \        RV4      4      V n        V P                  P                  pVf   Q R4       h\        W4      V n        \        VR4      V n        / V n        V P                  P                  4        F  p\        V P                   V4      P                  V P                  4      p\        \        V4      4       F`  pWE) ,          pV P                  P                  VRV)  4      pWpP                  9  d   / V P                  V&   ^V P                  V,          V&   Kb  	  \        VR4      pK  	  R# )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 path)r!   r   r   r   filenamer/   r%   r}   namelistr2   r6   ranger[   r4   )r5   r   zfnamename	splitNamexrl   rb   s   &&      r*   r:   ZipArchive.__init__  s    $	:2OP&&	ED	E ;O T8"M :<LL))+D3DIItDJJ488TI3y>*!"y1"~6.,.DMM&)/0f%e, + 1"EF ,r-   c                    V ^8  d   QhRRRR/# r=   r(   )r)   s   "r*   r+   r   6  s     * *V * *r-   c                	z    \        V\        4      '       g   \        # \        V P                  VP                  4      # rB   )rC   ra   rD   r   r!   rE   s   &&r*   rF   ZipArchive.__cmp__6  s*    %,,!!499ejj))r-   c                    V ^8  d   QhRRRR/# )r#   r!   r   r&   zZipPath[OtherAnyStr, AnyStr]r(   )r)   s   "r*   r+   r   ;  s     # #+ #*F #r-   c                    \        W4      # )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    )r5   r!   s   &&r*   rl   ZipArchive.child;  s     t""r-   c                   V ^8  d   QhRR/# rt   r(   )r)   s   "r*   r+   r   D  s     8 8 8r-   c                H    \        V P                  4      P                  4       # )z3
Returns C{True} if the underlying archive exists.
)r   r/   ry   rV   s   &r*   ry   ZipArchive.existsD  s     --.5577r-   c                   V ^8  d   QhRR/# r   r(   )r)   s   "r*   r+   r   J  s     ? ?u ?r-   c                H    \        V P                  4      P                  4       # )z-
Return the archive file's last access time.
)r   r/   r   rV   s   &r*   r   ZipArchive.getAccessTimeJ  s     --.<<>>r-   c                   V ^8  d   QhRR/# r   r(   )r)   s   "r*   r+   r   P       E EU Er-   c                H    \        V P                  4      P                  4       # )z.
Return the archive file's modification time.
)r   r/   r   rV   s   &r*   r   ZipArchive.getModificationTimeP       --.BBDDr-   c                   V ^8  d   QhRR/# r   r(   )r)   s   "r*   r+   r   V  r   r-   c                H    \        V P                  4      P                  4       # )z/
Return the archive file's status change time.
)r   r/   r   rV   s   &r*   r   ZipArchive.getStatusChangeTimeV  r   r-   c                   V ^8  d   QhRR/# rI   r(   )r)   s   "r*   r+   r   \  s     = =# =r-   c                	^    R \         P                  P                  V P                  4      : R2# )zZipArchive(rL   )r3   r!   rM   rV   s   &r*   rQ   ZipArchive.__repr__\  s#    RWW__TYY7:!<<r-   )r/   r}   r!   r%   r   N)r   r   r   r   r   r   r   r$   r:   rF   rl   ry   r   r   r   rQ   r   r(   r-   r*   ra   ra     sQ    
  F<*
#8?EE= =r-   ra   )+r   
__future__r   r   r3   r   typingr   r   r   r   r   r   r	   r
   r   r   r   r   r   zope.interfacer   r   r   twisted.python.compatr   r   twisted.python.filepathr   r   r   r   r   r   r1   bytesrJ   r   r   r   r    ra   __all__r(   r-   r*   <module>r      s   

 #  	      &   1   mUC0
)UC
(:%89 YL*gg{*+-=g-F L*  L*^X=( X=v 
#r-   