class documentation

class UnixPath(object): (source)

Known subclasses: zim.fs.Dir, zim.fs.File, zim.fs.WindowsPath

View In Hierarchy

Base class for Dir and File objects, represents a file path
Unknown Field: signal
changed (file, other_file, event_type): emitted when file changed - availability based on gio support for file monitors on this platform
Class Method new_from_zim_config Returns a new object based on the string representation for that path
Method __add__ Concatenates paths, only creates objects of the same class. See Dir.file() and Dir.subdir() instead to create other objects.
Method __eq__ Undocumented
Method __init__ Constructor
Method __iter__ Undocumented
Method __ne__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method commonparent No summary
Method ctime Get the creation time of the file path. @returns: the mtime timestamp
Method exists No summary
Method ischild Check if this path is a child path of a folder @returns: True if this path is a child path of parent
Method isdir Check if this path is a folder or not. Used to detect if e.g. a File object should have really been a Dir object. @returns: True when this path is a folder
Method isequal No summary
Method iswritable Check if a file or folder is writable. Uses permissions of parent folder if the file or folder does not (yet) exist. @returns: True if the file or folder is writable
Method monitor Creates a FSObjectMonitor for this path
Method mtime Get the modification time of the file path. @returns: the mtime timestamp
Method relpath No summary
Method rename No summary
Method serialize_zim_config Returns the file path as string for serializing the object
Method size Get file size in bytes See format_file_size() to get a human readable label @returns: file size in bytes
Method split No summary
Instance Variable path the absolute file path as string file system encoding (should only be used by low-level functions)
Property basename Basename property
Property dir Returns a Dir object for the parent dir
Property dirname Dirname property
Property uri File uri property
Property user_path User_path property
Static Method _parse_uri Undocumented
Method _set_path Undocumented
Instance Variable _serialized Undocumented
@classmethod
def new_from_zim_config(klass, string): (source)
Returns a new object based on the string representation for that path
def __add__(self, other): (source)
Concatenates paths, only creates objects of the same class. See Dir.file() and Dir.subdir() instead to create other objects.
def __eq__(self, other): (source)
overridden in zim.fs.Dir, zim.fs.File

Undocumented

def __init__(self, path): (source)
Constructor
Parameters
pathan absolute file path, file URL, FilePath object or a list of path elements. When a list is given, the first element is allowed to be an absolute path, URL or FilePath object as well.
def __iter__(self): (source)

Undocumented

def __ne__(self, other): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __str__(self): (source)

Undocumented

def commonparent(self, other): (source)
Find a comon parent folder between two file paths.
Parameters
otheranother FilePath
Returns
a Dir object for the common parent folder, or None when there is no common parent
def ctime(self): (source)
Get the creation time of the file path.
Returns
the mtime timestamp
def exists(self): (source)
overridden in zim.fs.Dir, zim.fs.File
Check if a file or folder exists.
Returns
True if the file or folder exists
Unknown Field: implementation
must be implemented by sub classes in order that they enforce the type of the resource as well
def ischild(self, parent): (source)
Check if this path is a child path of a folder
Returns
True if this path is a child path of parent
def isdir(self): (source)
Check if this path is a folder or not. Used to detect if e.g. a File object should have really been a Dir object.
Returns
True when this path is a folder
def isequal(self, other): (source)
Check file paths are equal based on stat results (inode number etc.). Intended to detect when two files or dirs are the same on case-insensitive filesystems. Does not explicitly check the content is the same. If you just want to know if two files have the same content, see File.compare()
Parameters
otheran other FilePath object
Returns
True when the two paths are one and the same file
def iswritable(self): (source)
Check if a file or folder is writable. Uses permissions of parent folder if the file or folder does not (yet) exist.
Returns
True if the file or folder is writable
def monitor(self): (source)
Creates a FSObjectMonitor for this path
def mtime(self): (source)
Get the modification time of the file path.
Returns
the mtime timestamp
def relpath(self, reference, allowupward=False): (source)
Get a relative path for this file path with respect to another path. This method always returns paths using "/" as separator, even on windows.
Parameters
referencea reference FilePath
allowupwardif True the relative path is allowed to start with '../', if False the reference should be a parent folder of this path.
Returns
a relative file path
Raises
AssertionErrorwhen allowupward is False and reference is not a parent folder
def rename(self, newpath): (source)
Rename (move) the content this file or folder to another location. This will not change the current file path, so the object keeps pointing to the old location.
Parameters
newpaththe destination FilePath which can either be a file or a folder.
Unknown Field: emits
path-moved
def serialize_zim_config(self): (source)
Returns the file path as string for serializing the object
def size(self): (source)
Get file size in bytes See format_file_size() to get a human readable label
Returns
file size in bytes
def split(self): (source)
Split the parts of the path on the path separator. If the OS uses the concept of a drive the first part will include the drive. (So using split() to count the number of path elements will not be robust for the path "/".)
Returns
a list of path elements
path = (source)
overridden in zim.fs.WindowsPath
the absolute file path as string file system encoding (should only be used by low-level functions)
@property
basename = (source)
Basename property
Returns a Dir object for the parent dir
@property
dirname = (source)
Dirname property
overridden in zim.fs.WindowsPath
File uri property
@property
user_path = (source)
User_path property
@staticmethod
def _parse_uri(uri): (source)

Undocumented

def _set_path(self, path): (source)
overridden in zim.fs.WindowsPath

Undocumented

_serialized = (source)

Undocumented