class documentation

class ZipPath(AbstractFilePath): (source)

Known subclasses: twisted.python.zippath.ZipArchive

Implements interfaces: twisted.python.filepath.IFilePath

View In Hierarchy

I represent a file or directory contained within a zip file.

Method __init__ Don't construct me directly. Use ZipArchive.child().
Instance Variable archive Undocumented
Instance Variable pathInArchive Undocumented
Instance Variable path Undocumented
Method __cmp__ Undocumented
Method __repr__ Undocumented
Property sep Return a zip directory separator.
Method parent A file path for the directory containing the file at this file path.
Method child Return a new ZipPath representing a path in self.archive which is a child of this path.
Method sibling Return a FilePath with the same directory as this instance but with a basename of path.
Method exists Check if this file path exists.
Method isdir Check if this file path refers to a directory.
Method isfile Check if this file path refers to a regular file.
Method islink Undocumented
Method listdir Undocumented
Method splitext Return a value similar to that returned by os.path.splitext.
Method basename Retrieve the final component of the file path's path (everything after the final path separator).
Method dirname Undocumented
Method open Opens this file path with the given mode.
Method changed Clear any cached information about the state of this path on disk.
Method getsize Retrieve this file's size.
Method getAccessTime Retrieve this file's last access-time. This is the same as the last access time for the archive.
Method getModificationTime Retrieve this file's last modification time. This is the time of modification recorded in the zipfile.
Method getStatusChangeTime Retrieve this file's last modification time. This name is provided for compatibility, and returns the same value as getmtime.

Inherited from AbstractFilePath:

Method getContent Retrieve the contents of the file at this path.
Method parents Retrieve an iterator of all the ancestors of this path.
Method children List the children of this path object.
Method walk Yield myself, then each of my children, and each of those children's children in turn.
Method descendant Retrieve a child or child's child of this path.
Method segmentsFrom Return a list of segments between a child and its ancestor.
Method __hash__ Hash the same as another FilePath with the same path as mine.
Method getmtime Deprecated. Use getModificationTime instead.
Method getatime Deprecated. Use getAccessTime instead.
Method getctime Deprecated. Use getStatusChangeTime instead.
def __init__(self, archive, pathInArchive): (source)

Don't construct me directly. Use ZipArchive.child().

Parametersarchivea ZipArchive instance.
pathInArchivea ZIP_PATH_SEP-separated string.
archive = (source)

Undocumented

pathInArchive = (source)

Undocumented

path = (source)

Undocumented

def __cmp__(self, other): (source)

Undocumented

def __repr__(self): (source)

Undocumented

ReturnsUndocumented (type: str)
@property
sep = (source)

Return a zip directory separator.

ReturnsUndocumented (type: The same type as self.path.)
def parent(self): (source)

A file path for the directory containing the file at this file path.

def child(self, path): (source)

Return a new ZipPath representing a path in self.archive which is a child of this path.

NoteRequesting the ".." (or other special name) child will not cause InsecurePath to be raised since these names do not have any special meaning inside a zip archive. Be particularly careful with the 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.
def sibling(self, path): (source)

Return a FilePath with the same directory as this instance but with a basename of path.

ParameterspathThe basename of the FilePath to return. (type: str)
ReturnsThe sibling path. (type: FilePath)
def exists(self): (source)

Check if this file path exists.

ReturnsTrue if the file at this file path exists, False otherwise. (type: bool)
def isdir(self): (source)

Check if this file path refers to a directory.

ReturnsTrue if the file at this file path is a directory, False otherwise.
def isfile(self): (source)

Check if this file path refers to a regular file.

ReturnsTrue if the file at this file path is a regular file, False otherwise.
def islink(self): (source)

Undocumented

def listdir(self): (source)

Undocumented

def splitext(self): (source)

Return a value similar to that returned by os.path.splitext.

def basename(self): (source)

Retrieve the final component of the file path's path (everything after the final path separator).

Returnsthe base name of this file path. (type: str)
def dirname(self): (source)

Undocumented

def open(self, mode='r'): (source)

Opens this file path with the given mode.

Returnsa file-like object.
RaisesExceptionif this file path cannot be opened.
def changed(self): (source)

Clear any cached information about the state of this path on disk.

def getsize(self): (source)

Retrieve this file's size.

Returnsfile size, in bytes
def getAccessTime(self): (source)

Retrieve this file's last access-time. This is the same as the last access time for the archive.

Returnsa number of seconds since the epoch
def getModificationTime(self): (source)

Retrieve this file's last modification time. This is the time of modification recorded in the zipfile.

Returnsa number of seconds since the epoch.
def getStatusChangeTime(self): (source)

Retrieve this file's last modification time. This name is provided for compatibility, and returns the same value as getmtime.

Returnsa number of seconds since the epoch.
API Documentation for Twisted, generated by pydoctor 21.2.0 at 2021-02-28 21:00:42.