abstract0python.module
fault.route

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.

'r'

Readable.

'w'

Writable.

'x'

Executable or searchable.

File System Property CodesTypes

Character codes identifying a type of file.

'*'

Any.

'!'

Void; file must not exist.

'/'

Directory.

'.'

Data. A "regular" file.

'&'

A symbolic link.

'|'

A named pipe.

'@'

A file system socket file.

'#'

A device file.

'?'

Unknown type. File exists, but it's type is not known and may be inaccessible.

abstractmethod
import

Hashable
import

Iterable
import

Sequence
import

Mapping
import

Protocol
import

TypeAlias
import

Type
import

Element
data
TypeAlias

Element: TypeAlias = tuple[str, Sequence['Element'], Mapping]

@Hashable.register

Path
class

Primitive operations for manipulating a sequence of identifiers.

Pathcontainer
property
Path

The route containing the final identifier in self.

Pathabsolute
property
list[Hashable]

The absolute sequence of identifiers.

Pathidentifier
property
Hashable

The object identifying the resource relative to its immediate container. The last point in the route.

Pathtruncate
abstractmethod
Path

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__
abstractmethod
Iterable[Path]

__invert__(self)

Stepwise root ascension.

assert list(~route) == [route ** 1, route ** 2, ..., route ** len(route)]

Path__lshift__
abstractmethod
Iterable[Path]

__lshift__(self, route)

Stepwise ascension path.

Path__rshift__
abstractmethod
Iterable[Path]

__rshift__(self, route)

Stepwise descension path.

Path__xor__
abstractmethod
Iterable[Path]

__xor__(self, route)

Stepwise traverse path.

Path__matmul__
abstractmethod
Path

__matmul__(self, path_expression)

Composite extension. Construct a new route by extending self with the points expressed in path.

Path__matmul__Parameters

self

Undocumented.

path_expression

A string that represents a relative or absolute path.

Path__add__
abstractmethod
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__
abstractmethod
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__
abstractmethod
Path

__truediv__(self, point)

Single extension. Construct a new route by extending self with the sole point.

assert (route / identifier) == (route + [identifier])

Path__mul__
abstractmethod
Path

__mul__(self, identifier)

Identifier substitution. Construct a new route by extending self.container with identifier.

assert (route * 'replacement') == (route.container / 'replacement')

Path__pow__
abstractmethod
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
class

File system APIs for supporting common access functions.

FileViolation
property
Type[Exception]

Exception describing the property violations found by a call to fs_require.

Filefs_require
abstractmethod

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

self

Undocumented.

properties

The required type, permissions and option control flags.

type

The 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
abstractmethod

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

self

Undocumented.

replacement

The route to the file or directory that will be used to replace the one at self.

Filefs_void
abstractmethod

fs_void(self)

Destroy the file or directory at the location identified by self. For directories, this recursively removes content as well.

Filefs_reduce
abstractmethod

fs_reduce(self, discarded)

Relocate the directory contents in discarded into self, and destroy the segment of directories between self and discarded.

Filefs_reduceReturns

self

Filefs_alloc
abstractmethod

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_mkdir
abstractmethod

fs_mkdir(self)

Create a directory at the location referenced by self.

Filefs_select
abstractmethod
Iterable[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_real
abstractmethod
File

fs_real(self)

Identify the portion of the route that actually exists on the filesystem.

Filefs_linear
abstractmethod
File

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
abstractmethod

fs_status(self)

Construct a data structure representing the latest status of the file.

Filefs_update
abstractmethod

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

self

Undocumented.

name

Change the identifier used to select the file relative to its parent directory.

size

Adjust the size of the file, truncating or zero-padding as needed.

created

The time that the file was said to be created.

modified

The time that the file was said to be modified.

Filefs_load
abstractmethod
bytes

fs_load(self)

Retrieve the binary data stored at the location identified by self.

Filefs_store
abstractmethod

fs_store(self, data)

Store the given data at the location referenced by self.

Filefs_type
abstractmethod
str

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_executable
abstractmethod
bool

fs_executable(self)

Whether or not the regular file is executable.

Directories marked as executable are not considered executables.

Filefs_searchable
abstractmethod
bool

fs_searchable(self)

Whether or not the directory's listing can be retrieved.

Regular files marked as executable are not considered searchable.

Filefs_snapshot
abstractmethod
Sequence[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

self

Undocumented.

Filefs_snapshotReturns

The sequence of elements that represent the directory's listing according to the given arguments.