Route interface descriptions for Path manipulations and File system controls.
File System Property Codes
File operations that analyze status properties use character codes to perform filtering. The codes listed here are primarily for POSIX filesystems and may have extensions or different meanings when used with emulated filesystems.
File System Property CodesPermissions
Character codes identifying available permissions.
File System Property CodesTypes
Character codes identifying a type of file.
abstractmethod
Hashable
Iterable
Sequence
Mapping
Protocol
TypeAlias
Type
ElementTypeAlias
Element: TypeAlias = tuple[str, Sequence['Element'], Mapping]
@Hashable.register
Path
Primitive operations for manipulating a sequence of identifiers.
PathcontainerPath
The route containing the final identifier in self.
Pathabsolutelist[Hashable]
The absolute sequence of identifiers.
PathidentifierHashable
The object identifying the resource relative to its immediate container. The last point in the route.
PathtruncatePath
truncate(self, identifier)
Construct a new route consisting of the existing sequence of points up to the last point specified by the point argument. Similar to slicing a sequence from a reverse index search.
Path__invert__Iterable[Path]
__invert__(self)
Stepwise root ascension.
assert list(~route) == [route ** 1, route ** 2, ..., route ** len(route)]
Path__lshift__Iterable[Path]
__lshift__(self, route)
Stepwise ascension path.
Path__rshift__Iterable[Path]
__rshift__(self, route)
Stepwise descension path.
Path__xor__Iterable[Path]
__xor__(self, route)
Stepwise traverse path.
Path__matmul__Path
__matmul__(self, path_expression)
Composite extension. Construct a new route by extending self with the points expressed in path.
Path__matmul__Parameters
Path__add__Path
__add__(self, points)
Extension by iterable. Construct a new route by extending self with points.
assert (route + points) == (route / points[0] / points[1] ... / points[n])
Path__floordiv__Path
__floordiv__(self, route)
Segment extension. Construct a new route by extending self with all the points in route.
assert (route // segment) == (route + segment.absolute)
Path__truediv__Path
__truediv__(self, point)
Single extension. Construct a new route by extending self with the sole point.
assert (route / identifier) == (route + [identifier])
Path__mul__Path
__mul__(self, identifier)
Identifier substitution. Construct a new route by extending self.container with identifier.
assert (route * 'replacement') == (route.container / 'replacement')
Path__pow__Path
__pow__(self, nth)
Numeric ascension operation. Construct a new route representing the nth container of self.
assert (route ** 1) == (route.container)
assert (route ** 2) == (route.container.container)
File
File system APIs for supporting common access functions.
FileViolationType[Exception]
Exception describing the property violations found by a call to fs_require.
Filefs_require
fs_require(self, properties, type)
Check the file for the expressed requirements. The properties string consists of characters described by File System Property Codes.
Filefs_requireParameters
typeThe required file type, inclusive. When None, the default, the file type must not be a directory.
Overrides any file type codes present in properties.
Filefs_requireExceptions
- Violation
Raised when a designated property is not present on the file.
Filefs_replace
fs_replace(self, replacement)
Destroy the existing file or directory, self, and replace it with the file or directory at the given route, replacement.
Filefs_replaceParameters
replacementThe route to the file or directory that will be used to replace the one at self.
Filefs_void
fs_void(self)
Destroy the file or directory at the location identified by self. For directories, this recursively removes content as well.
Filefs_reduce
fs_reduce(self, discarded)
Relocate the directory contents in discarded into self, and destroy the segment of directories between self and discarded.
Filefs_reduceReturns
Filefs_alloc
fs_alloc(self)
Allocate the necessary resources to create the target path as a file or directory.
Normally, this means creating the leading path to the identified resource.
Filefs_link_relative
fs_link_relative(self, path)
Create or update a symbolic link at self pointing to path, the target file. The linked target path will be relative to self' route.
Filefs_link_relativeParameters
Filefs_link_absolute
fs_link_absolute(self, path)
Create or update a symbolic link at self pointing to path, the target file. The linked target path will be absolute.
Filefs_link_absoluteParameters
Filefs_mkdir
fs_mkdir(self)
Create a directory at the location referenced by self.
Filefs_selectIterable[File]
fs_select(self)
Select the set of files contained within the directory identified by self that match the required properties.
The properties string consists of characters described by File System Property Codes.
Filefs_realFile
fs_real(self)
Identify the portion of the route that actually exists on the filesystem.
Filefs_linearFile
fs_linear(self)
Identify the next non-linear directory.
Recursively scan the filesystem until a directory is found containing zero files, more than one file, or a sole non-directory file is found.
Filefs_linearReturns
The path to the next non-linear directory as a File.
Filefs_status
fs_status(self)
Construct a data structure representing the latest status of the file.
Filefs_update
fs_update(self, name, size, created, modified)
Update the status properties of the file identified by self. If no arguments are supplied, not changes will be performed.
Filefs_updateParameters
Filefs_loadbytes
fs_load(self)
Retrieve the binary data stored at the location identified by self.
Filefs_store
fs_store(self, data)
Filefs_typestr
fs_type(self)
A string identifying the type of file selected by the Route. Often a shorthand for accessing the type from the structure returned by fs_status.
Filefs_executablebool
fs_executable(self)
Whether or not the regular file is executable.
Directories marked as executable are not considered executables.
Filefs_searchablebool
fs_searchable(self)
Whether or not the directory's listing can be retrieved.
Regular files marked as executable are not considered searchable.
Filefs_snapshotSequence[Element]
fs_snapshot(self)
Construct an element tree of files from the directory identified by self.
Exceptions raised by operations populating the tree are trapped as 'exception' elements that are filtered by process by default.
Filefs_snapshotParameters
Filefs_snapshotReturns
The sequence of elements that represent the directory's listing according to the given arguments.