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.
Undocumented
| Class Method | __get |
Extract the underlying items from a Collection or return the input as-is. |
| Method | __check |
Check if the given callback is callable. |
| Method | __data |
Retrieve a value from an item using a nested key notation. |
| Method | __delitem__ |
Delete an item from the collection at the specified key. |
| Method | __eq__ |
Compare the collection with another object for equality. |
| Method | __ge__ |
Compare if the current collection is greater than or equal to another object. |
| Method | __getitem__ |
Retrieve an item or a slice from the collection. |
| Method | __get |
Retrieve values from items using a key or callback. |
| Method | __gt__ |
Compare if the current collection is greater than another object. |
| Method | __hash__ |
Compute the hash value of the collection. |
| Method | __init__ |
Initialize a new Collection instance. |
| Method | __iter__ |
Iterate over the items in the collection. |
| Method | __le__ |
Compare if the current collection is less than or equal to another object. |
| Method | __len__ |
Return the number of items in the collection. |
| Method | __lt__ |
Compare if the current collection is less than another object. |
| Method | __make |
Compare two values using the specified operator. |
| Method | __ne__ |
Determine if the collection is not equal to another object. |
| Method | __setitem__ |
Set the value at the specified key in the collection. |
| Method | __value |
Return the evaluated value if callable, otherwise return the value itself. |
| Method | _add |
Add a unique item to the collection based on the comparison value. |
| Method | _get |
Get unique items from the collection based on a specified key. |
| Method | _get |
Return unique items from the collection without using a key. |
| Method | add |
Add relation data to the collection. |
| Method | all |
Return all items in the collection. |
| Method | avg |
Compute the average of the items. |
| Method | chunk |
Divide the collection into smaller collections of a specified size. |
| Method | collapse |
Collapse the collection of arrays into a single, flat collection. |
| Method | contains |
Check if the collection contains a given item. |
| Method | count |
Return the number of items in the collection. |
| Method | diff |
Return items not present in the given collection. |
| Method | each |
Iterate over items and apply the callback to each. |
| Method | every |
Determine whether all items satisfy the given callback condition. |
| Method | filter |
Filter items in the collection using a callback. |
| Method | first |
Return the first item in the collection, optionally filtered by a callback. |
| Method | flatten |
Flatten the collection into a single dimension. |
| Method | forget |
Remove items from the collection by their keys. |
| Method | for |
Slice the collection for pagination. |
| Method | get |
Retrieve an item from the collection by key. |
| Method | group |
Group items in the collection by a specified key. |
| Method | implode |
Join all items in the collection into a single string. |
| Method | is |
Check if the collection is empty. |
| Method | last |
Return the last item in the collection, optionally filtered by a callback. |
| Method | map |
Apply a function to each item in the collection. |
| Method | map |
Map items into instances of the given class. |
| Method | max |
Return the maximum value from the items. |
| Method | merge |
Merge the collection with the given items. |
| Method | min |
Return the minimum value from the items. |
| Method | pluck |
Extract values for a given key from all items. |
| Method | pop |
Remove and return the last item from the collection. |
| Method | prepend |
Prepend an item to the beginning of the collection. |
| Method | pull |
Remove and return an item from the collection by key. |
| Method | push |
Add an item to the end of the collection. |
| Method | put |
Insert or update an item in the collection at the specified key. |
| Method | random |
Return one or more random items from the collection. |
| Method | reduce |
Reduce the collection to a single value using a callback. |
| Method | reject |
Reject items that pass a given truth test. |
| Method | reverse |
Reverse the order of items in the collection. |
| Method | serialize |
Serialize the collection items as a list. |
| Method | set |
Set the attributes to append to the Collection. |
| Method | shift |
Remove and return the first item from the collection. |
| Method | sort |
Sort the items in the collection. |
| Method | sum |
Compute the sum of the given values. |
| Method | take |
Take a specific number of items from the collection. |
| Method | to |
Return the collection items as a JSON string. |
| Method | transform |
Transform each item in the collection using a callback. |
| Method | unique |
Return unique items from the collection. |
| Method | where |
Filter items by a given key-value pair or comparison. |
| Method | where |
Filter items where a given key's value is in a list of values. |
| Method | where |
Filter items where a given key's value is not in a list of values. |
| Method | zip |
Zip the collection with the given items by index. |
| Instance Variable | __appends__ |
Undocumented |
| Instance Variable | _items |
Undocumented |
Extract the underlying items from a Collection or return the input as-is.
| Parameters | |
items:list[Any] | Collection | object | The input to extract items from. If a Collection, its items are returned; otherwise, the input is returned unchanged. |
| Returns | |
list[Any] | object | The extracted items if items is a Collection, otherwise the
original input. |
Check if the given callback is callable.
| Parameters | |
callback:Any | The callback to check. |
raisebool, optional | Whether to raise an exception if not callable. Default is True. |
| Returns | |
bool | True if the callback is callable, otherwise False. |
| Raises | |
ValueError | If callback is not callable and raise_exception is True. |
Retrieve a value from an item using a nested key notation.
| Parameters | |
item:Any | The item to extract data from. |
key:str | The key to look for, supports nested notation. |
default:Any, optional | The value to return if the key is not found. Defaults to None. |
| Returns | |
Any | The extracted value if found, otherwise the default value. |
Delete an item from the collection at the specified key.
| Parameters | |
key:Any | The index or key of the item to remove. |
| Returns | |
None | This method does not return a value. |
Retrieve an item or a slice from the collection.
| Parameters | |
item:int or slice | The index or slice to retrieve. |
| Returns | |
Any or Collection | The item at the given index, or a new Collection for a slice. |
Retrieve values from items using a key or callback.
| Parameters | |
key:str | Callable | None | The key to extract or callback to apply. |
| Returns | |
list[Any] | None | List of extracted values, or None if key is not provided. |
Set the value at the specified key in the collection.
| Parameters | |
key:Any | The index or key at which to set the value. |
value:Any | The value to assign at the specified key. |
| Returns | |
None | This method does not return a value. |
Return the evaluated value if callable, otherwise return the value itself.
| Parameters | |
value:Any | The value or callable to evaluate. |
| Returns | |
Any | The result of calling the value if it is callable, otherwise the value itself. |
Get unique items from the collection based on a specified key.
| Parameters | |
key:str | The key to determine uniqueness for each item. |
| Returns | |
Collection | A new Collection containing only unique items by the given key. |
Return unique items from the collection without using a key.
| Returns | |
Collection | A new Collection containing only unique items. |
Add relation data to the collection.
| Parameters | |
relationdict[str, Any] | The relation data to add. |
| Returns | |
Collection | The current collection instance. |
Compute the average of the items.
| Parameters | |
key:str | None, optional | The key to use for calculating the average of values. If None, use all items. |
| Returns | |
float | The average value of the items. Returns 0 if calculation fails. |
Divide the collection into smaller collections of a specified size.
| Parameters | |
size:int | Number of items in each chunk. |
| Returns | |
Collection | A new Collection containing sub-collections (chunks) of the specified size. |
Collapse the collection of arrays into a single, flat collection.
| Returns | |
Collection | A new Collection containing all items from nested arrays, flattened. |
Return items not present in the given collection.
| Parameters | |
items:list[Any] | Collection | The items to compare against. |
| Returns | |
Collection | A new collection containing items not found in the provided collection. |
Iterate over items and apply the callback to each.
| Parameters | |
callback:Callable | The callback function to apply to each item. |
| Returns | |
Collection | The current collection instance. |
Determine whether all items satisfy the given callback condition.
| Parameters | |
callback:Callable | The callback function to test each item. |
| Returns | |
bool | True if all items pass the test, otherwise False. |
Filter items in the collection using a callback.
| Parameters | |
callback:Callable | Function to determine if an item should be included. |
| Returns | |
Collection | A new Collection containing items for which the callback returns True. |
Return the first item in the collection, optionally filtered by a callback.
| Parameters | |
callback:Callable | None, optional | A function to filter items before returning the first one, by default None. |
| Returns | |
object | The first item in the filtered collection, or None if empty. |
Flatten the collection into a single dimension.
| Returns | |
Collection | A new Collection containing all items, flattened to a single dimension. |
Remove items from the collection by their keys.
| Parameters | |
*keys:Any | The keys of the items to remove from the collection. |
| Returns | |
Collection | The current collection instance after removal. |
Slice the collection for pagination.
| Parameters | |
page:int | The page number to retrieve. |
number:int | The number of items per page. |
| Returns | |
Collection | A new Collection containing the paginated items. |
Retrieve an item from the collection by key.
| Parameters | |
key:Any | The key or index to retrieve from the collection. |
default:Any, optional | The value to return if the key is not found. Defaults to None. |
| Returns | |
Any | The item at the specified key, or the default value if not found. |
Group items in the collection by a specified key.
| Parameters | |
key:str | The key to group items by. |
| Returns | |
Collection | A new Collection instance containing a dictionary where each key is a unique value from the specified key, and each value is a list of items sharing that key. |
Return the last item in the collection, optionally filtered by a callback.
| Parameters | |
callback:Callable | None, optional | Function to filter items before returning the last one, by default None. |
| Returns | |
object | The last item in the filtered collection, or None if empty. |
Apply a function to each item in the collection.
| Parameters | |
callback:Callable | Function to apply to each item. |
| Returns | |
Collection | A new Collection containing the mapped items. |
Map items into instances of the given class.
| Parameters | |
cls:type | The class to map items into. |
method:str | None, optional | The method to call on the class, by default None. |
**kwargs:Any | Additional keyword arguments to pass to the constructor or method. |
| Returns | |
Collection | A new collection with the mapped instances. |
Return the maximum value from the items.
| Parameters | |
key:str | None, optional | The key to use for finding the maximum value. If None, use all items. |
| Returns | |
object | The maximum value found, or 0 if not found or on error. |
Merge the collection with the given items.
| Parameters | |
items:list[Any] | Collection | The items to merge into the collection. |
| Returns | |
Collection | The current collection instance with merged items. |
| Raises | |
TypeError | If items cannot be merged due to incompatible types. |
Return the minimum value from the items.
| Parameters | |
key:str | None, optional | The key to use for finding the minimum value. If None, use all items. |
| Returns | |
object | The minimum value found, or 0 if not found or on error. |
Extract values for a given key from all items.
| Parameters | |
value:str | The key to extract from each item. |
key:str | None, optional | The key to use as the result key, by default None. |
| Returns | |
Collection | A new collection containing the plucked values. |
Remove and return the last item from the collection.
| Returns | |
Any | The last item from the collection, or None if empty. |
Prepend an item to the beginning of the collection.
| Parameters | |
value:Any | The value to prepend to the collection. |
| Returns | |
Collection | The current collection instance with the new item prepended. |
Remove and return an item from the collection by key.
| Parameters | |
key:Any | The key of the item to remove. |
| Returns | |
Any | The removed item, or None if not found. |
Add an item to the end of the collection.
| Parameters | |
value:Any | The value to add to the collection. |
| Returns | |
Collection | The current collection instance with the new item appended. |
Insert or update an item in the collection at the specified key.
| Parameters | |
key:Any | The key or index at which to set the value. |
value:Any | The value to assign at the specified key. |
| Returns | |
Collection | The current collection instance with the updated item. |
Return one or more random items from the collection.
| Parameters | |
count:int | None, optional | The number of items to return. If None, returns a single item. |
| Returns | |
Any | Collection | None | A single random item if count is None, a Collection if count is given, or None if the collection is empty. |
| Raises | |
ValueError | If count is greater than the number of items in the collection. |
Reduce the collection to a single value using a callback.
| Parameters | |
callback:Callable | The function to apply cumulatively to the items. |
initial:Any, optional | The initial value to start the reduction, by default 0. |
| Returns | |
Any | The reduced value after applying the callback. |
Reject items that pass a given truth test.
| Parameters | |
callback:Callable | The callback function to test items. |
| Returns | |
Collection | The current collection instance with items not passing the test. |
Reverse the order of items in the collection.
| Returns | |
Collection | The current collection instance with items in reversed order. |
Set the attributes to append to the Collection.
| Parameters | |
appends:list[str] | The attributes to append. |
| Returns | |
Collection | The current collection instance. |
Remove and return the first item from the collection.
| Returns | |
Any | The first item from the collection, or None if the collection is empty. |
Sort the items in the collection.
| Parameters | |
key:str | None, optional | The key to sort by. If None, sort items directly. |
| Returns | |
Collection | The current collection instance with sorted items. |
Compute the sum of the given values.
| Parameters | |
key:str | None, optional | The key to sum by. If None, sum all items. |
| Returns | |
float | The sum of the values. Returns 0 if calculation fails. |
Take a specific number of items from the collection.
| Parameters | |
number:int | The number of items to take. If negative, takes from the end. |
| Returns | |
Collection | A new Collection containing the specified number of items. |
Transform each item in the collection using a callback.
| Parameters | |
callback:Callable | The callback function to transform items. |
| Returns | |
Collection | The current collection instance with transformed items. |
Return unique items from the collection.
| Parameters | |
key:str | None, optional | The key to use for uniqueness comparison. If None, use items directly. |
| Returns | |
Collection | A new Collection containing only unique items. |
Filter items by a given key-value pair or comparison.
| Parameters | |
key:str | The key to filter by. |
*args:Any | The operator and value, or just the value. |
| Returns | |
Collection | A new Collection instance containing filtered items. |
Filter items where a given key's value is in a list of values.
| Parameters | |
key:str | The key to filter by. |
values:list[Any] | Collection | The list of values to check against. |
| Returns | |
Collection | A new collection containing items where the key's value is in values. |
Filter items where a given key's value is not in a list of values.
| Parameters | |
key:str | The key to filter by. |
values:list[Any] | Collection | The list of values to check against. |
| Returns | |
Collection | A new Collection containing items where the key's value is not in values. |
Zip the collection with the given items by index.
| Parameters | |
items:list[Any] | Collection | The items to zip with. |
| Returns | |
Collection | A new Collection containing pairs of items from both collections. |
| Raises | |
ValueError | If the 'items' parameter is not a list or Collection. |