DSearchPath

from acron.core import DSearchPath
class DSearchPath

Bases:

This class stores a list of directories that can be searched, in order, to locate a particular file. It is normally constructed by passing it a traditional searchpath-style string, e.g. a list of directory names delimited by spaces or colons, but it can also be built up explicitly.

Inheritance diagram

digraph inheritance5bc237539b { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DSearchPath" [URL="acron.core.DSearchPath.html#acron.core.DSearchPath",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "DSearchPath" [arrowsize=0.75,style=""]; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; }
class Results

Bases:

__getitem__()
__init__()
assign()
clear()

Removes all the files from the list.

get_file()

Returns the nth file on the result list.

get_num_files()

Returns the number of files on the result list.

output()
size()

Returns the num of filenames in the set. This method is defined to make the Results object appear to be a list in Python.

write()
__init__()
append_directory()

Adds a new directory to the end of the search list.

append_path()

Adds all of the directories listed in the search path to the end of the search list.

Adds all of the directories listed in the search path to the end of the search list.

assign()
clear()

Removes all the directories from the search list.

property directories → Sequence[Filename]

Returns the nth directory on the search list.

find_all_files()

This variant of find_all_files() returns the new Results object, instead of filling on in on the parameter list. This is a little more convenient to call from Python.

Searches all the directories in the search list for the indicated file, in order. Fills up the results list with all of the matching filenames found, if any. Returns the number of matches found.

It is the responsibility of the the caller to clear the results list first; otherwise, the newly-found files will be appended to the list.

find_file()

Searches all the directories in the search list for the indicated file, in order. Returns the full matching pathname of the first match if found, or the empty string if not found.

get_directories() → list
get_directory()

Returns the nth directory on the search list.

get_num_directories()

Returns the number of directories on the search list.

is_empty()

Returns true if the search list is empty, false otherwise.

output()
prepend_directory()

Adds a new directory to the front of the search list.

prepend_path()

Adds all of the directories listed in the search path to the beginning of the search list.

static search_path()

A quick-and-easy way to search a searchpath for a file when you don’t feel like building or keeping around a DSearchPath object. This simply constructs a temporary DSearchPath based on the indicated path string, and searches that.

write()