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 ReflectionInstance(IReflectionInstance): (source)
Constructor: ReflectionInstance(instance)
Undocumented
| Method | __contains__ |
Check if the cache contains the specified key. |
| Method | __delitem__ |
Remove an item from the memory cache by key. |
| Method | __getitem__ |
Retrieve a cached value by key. |
| Method | __init__ |
Initialize the ReflectionInstance with the given object instance. |
| Method | __setitem__ |
Store a value in the cache with the specified key. |
| Method | _classify |
Categorize a class method by visibility and append to the accumulator. |
| Method | _classify |
Categorize an instance method by visibility and append to the accumulator. |
| Method | _classify |
Categorize a static method by visibility and append to the accumulator. |
| Method | _scan |
Discover and categorize all class members in a single traversal. |
| Method | _scan |
Categorize instance variables into visibility groups in a single traversal. |
| Method | _scan |
Scan the class dict for property descriptors and sort by visibility. |
| Method | clear |
Clear the internal memory cache. |
| Method | constructor |
Analyze and return constructor dependencies of the instance's class. |
| Method | get |
Retrieve type annotations of the class. |
| Method | get |
Retrieve the value of an attribute by name from the instance. |
| Method | get |
Retrieve the docstring of a specific attribute. |
| Method | get |
Aggregate all attributes of the instance. |
| Method | get |
Return the base classes of the instance's class. |
| Method | get |
Return the class of the instance. |
| Method | get |
Return the name of the instance's class. |
| Method | get |
Return the docstring of the instance's class. |
| Method | get |
Retrieve all dunder (double underscore) attributes of the instance. |
| Method | get |
Return all dunder (double underscore) method names of the instance. |
| Method | get |
Return the file path where the class is defined. |
| Method | get |
Return the reflected object instance. |
| Method | get |
Return all magic attributes of the instance. |
| Method | get |
Return all magic method names of the instance. |
| Method | get |
Retrieve the docstring of a method. |
| Method | get |
Retrieve all method names associated with the instance. |
| Method | get |
Retrieve the signature of a method. |
| Method | get |
Return the name of the module where the class is defined. |
| Method | get |
Return the module and class name as a single string. |
| Method | get |
Retrieve all private asynchronous method names of the instance. |
| Method | get |
Retrieve all private attributes of the instance. |
| Method | get |
Retrieve all private asynchronous class method names of the instance. |
| Method | get |
Return all private class method names of the instance. |
| Method | get |
Retrieve all private synchronous class method names of the instance. |
| Method | get |
Return all private method names of the instance. |
| Method | get |
Retrieve all private properties of the instance. |
| Method | get |
Retrieve all private asynchronous static method names of the instance. |
| Method | get |
Return all private static method names of the instance. |
| Method | get |
Retrieve all private synchronous static method names of the instance. |
| Method | get |
Retrieve all private synchronous method names of the instance. |
| Method | get |
Return all property names of the instance. |
| Method | get |
Retrieve the value of a property from the instance. |
| Method | get |
Retrieve the docstring for a property. |
| Method | get |
Return the signature of a property getter. |
| Method | get |
Retrieve all protected asynchronous method names of the instance. |
| Method | get |
Return all protected attributes of the instance. |
| Method | get |
Retrieve all protected asynchronous class method names of the instance. |
| Method | get |
Return all protected class method names of the instance. |
| Method | get |
Return all protected synchronous class method names of the instance. |
| Method | get |
Return all protected method names of the instance. |
| Method | get |
Retrieve all protected properties of the instance. |
| Method | get |
Retrieve all protected asynchronous static method names. |
| Method | get |
Return all protected static method names of the instance. |
| Method | get |
Retrieve all protected synchronous static method names. |
| Method | get |
Return all protected synchronous method names of the instance. |
| Method | get |
Return all public asynchronous method names of the instance. |
| Method | get |
Return all public attributes of the instance. |
| Method | get |
Return all public asynchronous class method names of the instance. |
| Method | get |
Return all public class method names of the instance. |
| Method | get |
Return all public synchronous class method names of the instance. |
| Method | get |
Return all public method names of the instance. |
| Method | get |
Return all public properties of the instance. |
| Method | get |
Retrieve all public asynchronous static method names of the instance. |
| Method | get |
Return the names of all public static methods of the instance's class. |
| Method | get |
Return all public synchronous static method names of the instance. |
| Method | get |
Return all public synchronous method names of the instance. |
| Method | get |
Retrieve the source code for the class or a specific method. |
| Method | has |
Check if the instance has a specific attribute. |
| Method | has |
Determine if the instance has a specific method. |
| Method | method |
Analyze and return dependencies for a method of the instance's class. |
| Method | remove |
Remove an attribute from the instance. |
| Method | remove |
Remove a method from the instance. |
| Method | set |
Set the value of an attribute on the instance. |
| Method | set |
Set a callable attribute as a method. |
| Instance Variable | _class |
Undocumented |
| Instance Variable | _cls |
Undocumented |
| Instance Variable | _instance |
Undocumented |
| Instance Variable | _memory |
Undocumented |
| Instance Variable | _module |
Undocumented |
| Instance Variable | _private |
Undocumented |
Initialize the ReflectionInstance with the given object instance.
| Parameters | |
instance:Any | The object instance to reflect. |
| Returns | |
None | This method does not return a value. |
| Raises | |
TypeError | If the provided instance is not a valid object instance or is of a built-in/abstract base class. |
ValueError | If the instance is from '__main__'. |
Discover and categorize all class members in a single traversal.
Walks the class dict for properties and dir() for methods, building all method and property category lists and populating the cache in one pass.
| Returns | |
None | This method does not return a value. |
Categorize instance variables into visibility groups in a single traversal.
Populates the cache with public, protected, private, dunder, and combined attribute dictionaries derived from the reflected instance.
| Returns | |
None | This method does not return a value. |
Clear the internal memory cache.
Removes all cached entries stored in the reflection instance. Subsequent method calls will recompute and cache results.
| Returns | |
None | This method does not return a value. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.constructorSignatureAnalyze and return constructor dependencies of the instance's class.
| Returns | |
Signature | Structured representation of the constructor dependencies. Contains:
|
Retrieve the value of an attribute by name from the instance.
Notes
This method first checks the instance's attributes dictionary for the
given name. If not found, it attempts to retrieve the attribute directly
from the instance using getattr. If the attribute is still not found,
the default value is returned.
| Parameters | |
name:str | Name of the attribute to retrieve. |
default:Any, optional | Value to return if the attribute does not exist. Defaults to None. |
| Returns | |
Any | Value of the specified attribute if it exists, otherwise the provided
default value. |
| Raises | |
AttributeError | If the attribute does not exist and no default value is provided. |
Retrieve the docstring of a specific attribute.
| Parameters | |
name:str | Name of the attribute. |
| Returns | |
str or None | The docstring of the attribute, or None if not available. |
| Raises | |
AttributeError | If the attribute does not exist on the instance. |
Aggregate all attributes of the instance.
Combines public, protected, private, and dunder attributes into a single dictionary. Private attribute names are unmangled. The result is cached for performance.
| Returns | |
dict[str, Any] | Dictionary mapping attribute names to their values for all visibility levels. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getDunderAttributesRetrieve all dunder (double underscore) attributes of the instance.
| Parameters | |
self:ReflectionInstance | |
| Returns | |
dict[str, Any] | Dictionary mapping dunder attribute names to their values. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getMethodDocstringRetrieve the docstring of a method.
| Parameters | |
name:str | Name of the method. |
| Returns | |
str | None | The docstring of the method, or None if not available. |
| Raises | |
AttributeError | If the method does not exist on the class. |
Retrieve all method names associated with the instance.
Aggregates method names from public, protected, private, class, and static categories by calling their respective getter methods. The result is cached for performance.
| Returns | |
list of str | List of all method names (instance, class, static) defined on the instance's class, including public, protected, and private methods. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getMethodSignatureRetrieve the signature of a method.
| Parameters | |
name:str | Name of the method. |
| Returns | |
inspect.Signature | Signature object representing the method's parameters and return type. |
| Raises | |
AttributeError | If the method does not exist or is not callable. |
Return the name of the module where the class is defined.
| Returns | |
str | The module name where the class is defined. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getModuleWithClassNameReturn the module and class name as a single string.
| Returns | |
str | The module name and class name in the format 'module.ClassName'. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPrivateAttributesRetrieve all private attributes of the instance.
| Parameters | |
self:ReflectionInstance | |
| Returns | |
dict[str, Any] | Dictionary mapping unmangled private attribute names to their values. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPrivateClassAsyncMethodsRetrieve all private asynchronous class method names of the instance.
| Parameters | |
self:ReflectionInstance | The ReflectionInstance object. |
| Returns | |
list of str | List of private asynchronous class method names. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPrivatePropertiesRetrieve all private properties of the instance.
| Returns | |
list | List of private property names (unmangled). |
Retrieve the value of a property from the instance.
| Parameters | |
name:str | Name of the property to retrieve. |
| Returns | |
Any | Value of the specified property. |
| Raises | |
AttributeError | If the property does not exist or is not accessible. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPropertyDocstringRetrieve the docstring for a property.
| Parameters | |
name:str | Name of the property. |
| Returns | |
str | The docstring of the property, or an empty string if not present. |
| Raises | |
AttributeError | If the property does not exist on the class. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPropertySignatureReturn the signature of a property getter.
| Parameters | |
name:str | Name of the property. |
| Returns | |
inspect.Signature | Signature of the property's getter method. |
| Raises | |
AttributeError | If the property does not exist on the class. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getProtectedAsyncMethodsRetrieve all protected asynchronous method names of the instance.
Notes
Protected asynchronous methods start with a single underscore, are not private, and are coroutine functions.
| Parameters | |
self:ReflectionInstance | The ReflectionInstance object. |
| Returns | |
list of str | List of protected asynchronous method names. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getProtectedAttributesReturn all protected attributes of the instance.
| Parameters | |
self:ReflectionInstance | |
| Returns | |
dict[str, Any] | Dictionary containing protected attribute names and their values. Protected attributes start with a single underscore, are not dunder, and are not private (do not start with the class name). |
Return all protected synchronous class method names of the instance.
| Parameters | |
self:ReflectionInstance | The ReflectionInstance object. |
| Returns | |
list of str | List of protected synchronous class method names. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getProtectedMethodsReturn all protected method names of the instance.
| Parameters | |
self:ReflectionInstance | The ReflectionInstance object. |
| Returns | |
list of str | List of protected method names. Protected methods start with a single underscore, are not private (do not start with the class name), and are not dunder methods. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getProtectedPropertiesRetrieve all protected properties of the instance.
| Returns | |
list | List of protected property names (unmangled). |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getProtectedSyncMethodsReturn all protected synchronous method names of the instance.
| Parameters | |
self:ReflectionInstance | The ReflectionInstance object. |
| Returns | |
list of str | List of protected synchronous method names. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPublicAsyncMethodsReturn all public asynchronous method names of the instance.
| Parameters | |
self:ReflectionInstance | The ReflectionInstance object. |
| Returns | |
list of str | List of public asynchronous method names. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPublicAttributesReturn all public attributes of the instance.
| Parameters | |
self:ReflectionInstance | |
| Returns | |
dict[str, Any] | Dictionary mapping public attribute names to their values. Excludes dunder, protected, and private attributes. |
Return all public method names of the instance.
| Parameters | |
self:ReflectionInstance | The ReflectionInstance object. |
| Returns | |
list of str | List of public method names. Public methods are not static, class, private, protected, or magic methods. |
orionis.introspection.instances.contracts.reflection.IReflectionInstance.getPublicPropertiesReturn all public properties of the instance.
| Returns | |
list | List of public property names. |
Retrieve the source code for the class or a specific method.
Notes
Handles name mangling for private methods. Returns None if the source code cannot be retrieved (e.g., for built-in or dynamically generated objects).
| Parameters | |
method:str or None, optional | Name of the method to retrieve source code for. If None, retrieves the source code of the class. |
| Returns | |
str or None | The source code as a string if available, otherwise None. |
Analyze and return dependencies for a method of the instance's class.
| Parameters | |
methodstr | Name of the method to inspect. |
| Returns | |
Signature | Structured representation of the method dependencies, including:
|
| Raises | |
AttributeError | If the method does not exist on the class. |
Remove an attribute from the instance.
Notes
Clears the memory cache after removal.
| Parameters | |
name:str | Name of the attribute to remove. |
| Returns | |
bool | True if the attribute was removed successfully. |
| Raises | |
AttributeError | If the attribute does not exist or is read-only. |
Remove a method from the instance.
| Parameters | |
name:str | Name of the method to remove. |
| Returns | |
None | This method does not return a value. |
| Raises | |
AttributeError | If the method does not exist or is not callable. |
Set the value of an attribute on the instance.
| Parameters | |
name:str | Name of the attribute to set. |
value:Any | Value to assign to the attribute. |
| Returns | |
bool | True if the attribute was set successfully. |
| Raises | |
AttributeError | If the attribute name is invalid, is a keyword, or the value is callable. |
Set a callable attribute as a method.
| Parameters | |
name:str | Name of the method to set. |
method:Callable | Callable object to assign as the method. |
| Returns | |
bool | True if the method was set successfully. |
| Raises | |
AttributeError | If the name is not a valid identifier, is a keyword, or the method is not callable. |