Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/zippath.pyc


~Mc@sdZeZddlZddlZddlZddlZejd d
krheZ	ddl
mZneZ	ddl
mZddlmZmZdZd	efd
YZdefdYZdd	gZdS(s
This module contains partial re-implementations of FilePath, pending some
specification of formal interfaces it is a duck-typing attempt to emulate them
for certain restricted uses.

See the constructor for ZipArchive for use.
iNii(tZipFile(tChunkingZipFile(tFilePatht_PathHelpert/tZipPathcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZRS(sF
    I represent a file or directory contained within a zip file.
    cCs@||_||_tjj|jj|jjt|_dS(s
        Don't construct me directly.  Use ZipArchive.child().

        @param archive: a ZipArchive instance.

        @param pathInArchive: a ZIP_PATH_SEP-separated string.
        N(	tarchivet
pathInArchivetostpathtjointzipfiletfilenametsplittZIP_PATH_SEP(tselfRR((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyt__init__+s		cCs8t|tstSt|j|jf|j|jfS(N(t
isinstanceRtNotImplementedtcmpRR(Rtother((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyt__cmp__:scCsZtjj|jjg}|j|jjttjj	|}d|j
dfS(Ns
ZipPath('%s')s
string-escape(RR	tabspathRtextendRR
RtsepR
tencode(RtpartsR	((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyt__repr__AscCsH|jjt}t|dkr+|jSt|jtj|d S(Nii(RR
RtlenRRR
(Rtsplitup((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytparentHscCs"t|jtj|j|gS(s&
        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.
        (RRRR
R(RR	((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytchildOscCs|jj|S(N(RR(RR	((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytsibling^scCs|jp|jS(N(tisdirtisfile(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytexistscscCs|j|jjkS(N(RRtchildmap(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR!fscCs|j|jjjkS(N(RRRt
NameToInfo(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR"iscCstS(N(tFalse(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytislinklscCsZ|jrD|jr/|jj|jjSttjdnttj	ddS(NsLeaf zip entry listedsNon-existent zip entry listed(
R#R!RR$RtkeystOSErrorterrnotENOTDIRtENOENT(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytlistdiros
cCstjj|jS(sN
        Return a value similar to that returned by os.path.splitext.
        (RR	tsplitext(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR.yscCs|jjtdS(Ni(RR
R(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytbasenamescCs
|jjS(N(RR	(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytdirnamescCs6tr|jjj|jS|jjj|jSdS(N(t_USE_ZIPFILERRtopenRtreadfile(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR2scCsdS(N((R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytrestatscCs
|jjS(s
        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
        (Rt
getAccessTime(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR5scCs$tj|jjj|jjdS(s
        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.
        i(iii(ttimetmktimeRRR%Rt	date_time(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytgetModificationTimescCs
|jS(s
        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.
        (R9(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pytgetStatusChangeTimes(t__name__t
__module__t__doc__RRRRRR R#R!R"R'R-R.R/R0R2R4R5R9R:(((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR's(											
	
					
	t
ZipArchivecBs\eZdZedZdZdZdZdZdZ	dZ
dZRS(	s] I am a FilePath-like object which can wrap a zip archive as if it were a
    directory.
    cCs|S(N((R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyt<lambda>scCstrt||_nt||_||_d|_i|_x|jjD]}|jt	}xit
t|D]U}||}t	j|| }||jkri|j|<nd|j||<qzWd}qRWdS(sCreate a ZipArchive, treating the archive at archivePathname as a zip file.

        @param archivePathname: a str, naming a path in the filesystem.
        tiN(
R1RRRR	RR$tnamelistR
RtrangeRR
(RtarchivePathnametnametxRR((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyRs			cCs
t||S(s
        Create a ZipPath pointing at a path within the archive.

        @param path: a str with no path separators in it, either '/' or the
        system path separator, if it's different.
        (R(RR	((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyRscCst|jjjS(s@
        Returns true if the underlying archive exists.
        (RRRR#(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR#scCst|jjjS(s=
        Return the archive file's last access time.
        (RRRR5(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR5scCst|jjjS(s>
        Return the archive file's modification time.
        (RRRR9(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR9scCst|jjjS(s?
        Return the archive file's status change time.
        (RRRR:(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR:scCsdtjj|jfS(NsZipArchive(%r)(RR	R(R((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyRs(R;R<R=tpropertyRRRR#R5R9R:R(((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyR>s							(ii(R=ttypet
__metaclass__RR6R*tsystversion_infotTrueR1RRR&ttwisted.python.zipstreamRttwisted.python.filepathRRRRR>t__all__(((s:/usr/lib/python2.7/dist-packages/twisted/python/zippath.pyt<module>sG