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

class ScopeManager: (source)

Constructor: ScopeManager()

View In Hierarchy

Undocumented

Async Method __aenter__ Enter the asynchronous context and set the current scope.
Async Method __aexit__ Exit the asynchronous context and clear the current scope.
Method __contains__ Check whether the given key exists in the scope.
Method __getitem__ Retrieve the instance associated with the given key.
Method __init__ Initialize the ScopeManager.
Method __setitem__ Store an instance under the specified key.
Method clear Remove all instances from the current scope.
Method creationLock Return the construction lock owned by this scope and service key.
Async Method get Retrieve the instance associated with the given key asynchronously.
Async Method resolve Resolve and return the instance for a given key.
Method set Store an instance in the scope.
Class Variable __slots__ Undocumented
Instance Variable __active Undocumented
Instance Variable __closed Undocumented
Instance Variable __creation_locks Undocumented
Instance Variable _instances Undocumented
Instance Variable _token Undocumented
Property isActive Report whether the owning scope is still open.
async def __aenter__(self) -> Self: (source)

Enter the asynchronous context and set the current scope.

Sets the current scope in the ScopedContext to this instance.

Returns
SelfThe current ScopeManager instance.
Raises
RuntimeErrorIf the scope is already active or has previously closed.
async def __aexit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None): (source)

Exit the asynchronous context and clear the current scope.

Parameters
exc_type:type[BaseException] | NoneThe exception type, if any.
exc_val:BaseException | NoneThe exception value, if any.
exc_tb:types.TracebackType | NoneThe traceback object, if any.
Returns
NoneThis method does not return a value.
def __contains__(self, key: object) -> bool: (source)

Check whether the given key exists in the scope.

Parameters
key:objectThe key to check for existence.
Returns
boolTrue if the key exists in the scope, otherwise False.
def __getitem__(self, key: object) -> object | None: (source)

Retrieve the instance associated with the given key.

Parameters
key:objectThe key identifying the instance.
Returns
object or NoneThe instance associated with the key, or None if not present.
def __init__(self): (source)

Initialize the ScopeManager.

Initializes an empty dictionary to store scoped instances.

Returns
NoneThis method does not return a value.
def __setitem__(self, key: object, value: object): (source)

Store an instance under the specified key.

Parameters
key:objectKey to associate with the instance.
value:objectInstance to store.
Returns
NoneThis method does not return a value.
Raises
RuntimeErrorIf the scope has already closed.
def clear(self): (source)

Remove all instances from the current scope.

Clears the internal dictionary of all stored instances.

Returns
NoneThis method does not return a value.
def creationLock(self, key: object) -> asyncio.Lock: (source)

Return the construction lock owned by this scope and service key.

Parameters
key:objectContract identifying a scoped service.
Returns
asyncio.LockLock shared by tasks resolving that service within this scope.
Raises
RuntimeErrorIf the scope has already closed.
async def get(self, key: object) -> Any | None: (source)

Retrieve the instance associated with the given key asynchronously.

Parameters
key:objectThe key identifying the instance.
Returns
Any or NoneThe resolved instance associated with the key, or None if not found.
async def resolve(self, key: object) -> Any: (source)

Resolve and return the instance for a given key.

This method retrieves the instance associated with the provided key. Raises a KeyError if the instance is not found in the scope.

Parameters
key:objectThe key identifying the instance.
Returns
AnyThe resolved instance associated with the key.
Raises
KeyErrorIf the instance for the given key is not found in the scope.
def set(self, key: object, value: Any): (source)

Store an instance in the scope.

Parameters
key:objectKey to associate with the instance.
value:AnyInstance to store, can be synchronous or a coroutine.
Returns
NoneThis method does not return a value.
__slots__: tuple[str, ...] = (source)

Undocumented

__active: bool = (source)

Undocumented

__closed: bool = (source)

Undocumented

__creation_locks: dict[object, asyncio.Lock] | None = (source)

Undocumented

Undocumented

Undocumented

Report whether the owning scope is still open.

Returns
boolFalse before entry and after exit, including in child tasks retaining a reference to this scope.