ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Persist named cache entries in a filesystem directory.

Method __collectFiles Collect monitored files for hashing and deduplicate them.
Method __collectFromDirs Collect deduplicated Python files from monitored directories.
Method __collectFromFiles Add deduplicated monitored files to the result list.
Method __computeSourcesHash Compute and return a hash representing the state of monitored sources.
Method __init__ Initialize the FileBasedCache instance.
Method clear Remove the cache file if it exists.
Method get Retrieve cached data if valid.
Method save Save the provided data to the cache file if it has changed.
Constant CACHE_VERSION Cache version value used by FileBasedCache.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable __file Resolved filesystem path of the persistent cache entry.
Instance Variable __file_resolved Store the resolved cache file path for later access.
Instance Variable __hashInterval Hash interval value used by FileBasedCache.
Instance Variable __lasthashcheck Lasthashcheck value used by FileBasedCache.
Instance Variable __monitored_dirs List of directories to monitor for changes.
Instance Variable __monitored_files List of files to monitor for changes.
Instance Variable __path Directory path where the cache file will be stored.
Instance Variable __sourceshashcache Internal cache for source hash and timing.
def __collectFiles(self) -> list[tuple[str, Path]]: (source)

Collect monitored files for hashing and deduplicate them.

Gather Python files from monitored directories and explicit monitored files, excluding the cache file itself.

Returns
list[tuple[str, pathlib.Path]]Sorted (posix_path, resolved_path) pairs for unique monitored files.
def __collectFromDirs(self, cache_file: Path, seen: set[str], result: list[tuple[str, Path]]): (source)

Collect deduplicated Python files from monitored directories.

Parameters
cache_file:pathlib.PathResolved cache file path to exclude from collection.
seen:set[str]Set of already collected POSIX paths used for deduplication.
result:list[tuple[str, pathlib.Path]]Output list updated in place with (posix_path, resolved_path) tuples.
Returns
NoneNo return value.
def __collectFromFiles(self, cache_file: Path, seen: set[str], result: list[tuple[str, Path]]): (source)

Add deduplicated monitored files to the result list.

Parameters
cache_file:pathlib.PathResolved cache file path to exclude from collection.
seen:set[str]Set of already collected POSIX paths used for deduplication.
result:list[tuple[str, pathlib.Path]]Output list updated in place with (posix_path, resolved_path) tuples.
Returns
NoneNo return value.
def __computeSourcesHash(self) -> str: (source)

Compute and return a hash representing the state of monitored sources.

This method generates a SHA-1 hash based on the modification time and size of all monitored files and Python files in monitored directories, excluding the cache file itself. The hash is cached for a short interval to avoid redundant computation.

Returns
strThe computed SHA-1 hash as a hexadecimal string.
def __init__(self, path: Path, filename: str, monitored_dirs: list[Path] | None = None, monitored_files: list[Path] | None = None): (source)

Initialize the FileBasedCache instance.

Parameters
path:pathlib.PathDirectory path where the cache file will be stored.
filename:strName of the cache file.
monitored_dirs:list[pathlib.Path] or None, optionalList of directories to monitor for changes.
monitored_files:list[pathlib.Path] or None, optionalList of files to monitor for changes.
Returns
NoneNo return value.
Raises
TypeErrorIf path is not a Path or filename is not a string.
ValueErrorIf filename is empty or contains path components.
def clear(self) -> bool: (source)

Remove the cache file if it exists.

Returns
boolTrue if the cache file was removed, False if it did not exist.
def get(self) -> dict | None: (source)

Retrieve cached data if valid.

Returns
dict or NoneThe cached data if valid, otherwise None.
def save(self, data: dict) -> tuple[int, str]: (source)

Save the provided data to the cache file if it has changed.

Parameters
data:dictThe data to be cached.
Returns
tuple[int, str]A tuple containing the cache version and the sources hash.
CACHE_VERSION: int = (source)

Cache version value used by FileBasedCache.

Value
1
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

Resolved filesystem path of the persistent cache entry.

__file_resolved = (source)

Store the resolved cache file path for later access.

__hashInterval: float = (source)

Hash interval value used by FileBasedCache.

__lasthashcheck: float = (source)

Lasthashcheck value used by FileBasedCache.

__monitored_dirs = (source)

List of directories to monitor for changes.

__monitored_files = (source)

List of files to monitor for changes.

Directory path where the cache file will be stored.

__sourceshashcache: str | None = (source)

Internal cache for source hash and timing.