class documentation

class FilteredDir(Dir): (source)

View In Hierarchy

Class implementing a folder with a filtered listing. Can be used to e.g. filter all objects that are also ignored by version control.
Method __init__ Constructor
Method filter Undocumented
Method ignore Add a file pattern to ignore @param glob: a file path pattern (e.g. "*.txt")
Method list List the file contents
Instance Variable _ignore Undocumented

Inherited from Dir:

Method __eq__ Undocumented
Method cleanup No summary
Method copyto No summary
Method exists No summary
Method file Get a File object for a path below this folder
Method get_file_tree_as_text No summary
Method new_file No summary
Method new_subdir No summary
Method remove Remove this folder, fails if it is not empty.
Method remove_children Recursively remove everything below this folder .
Method resolve_dir Get a Dir object for a path relative to this folder
Method resolve_file Get a File object for a path relative to this folder
Method subdir Get a Dir object for a path below this folder
Method touch Create this folder and any parent folders that do not yet exist. @param mode: creation mode (e.g. 0700)
Method walk No summary
Method _list Undocumented

Inherited from UnixPath (via Dir):

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 __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 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
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 filter(self, name): (source)

Undocumented

def ignore(self, glob): (source)
Add a file pattern to ignore
Parameters
globa file path pattern (e.g. "*.txt")
def list(self, includehidden=False, includetmp=False, raw=False): (source)
overrides zim.fs.Dir.list
List the file contents
Parameters
includehiddenif True include hidden files (e.g. names starting with "."), ignore otherwise
includetmpif True include temporary files (e.g. names ending in "~"), ignore otherwise
rawfor filtered folders (FilteredDir instances) setting raw to True will disable filtering
globa file name glob to filter the listed files, e.g "*.png"
Returns
a sorted list of names for files and subdirectories. Will not return names that could not be decoded properly and will throw warnings if those are encountered. Hidden files are silently ignored.
_ignore: list = (source)

Undocumented