Element: Registry-Backed Base Class#
- class arch.code.Element.Element(data)#
The base class of all architectonic elements, wrapping an ElementData instance.
Subclasses register themselves (and their inferred datatype) in a global class registry keyed by IDX, and gain moment aliases for any methods marked with the antithesis, thesis, or synthesis decorators.
- classmethod new(idx, subclass='', **kwargs)#
Build an element of the registered type for the given index, coercing data as needed.
- property uid#
Return the unique identifier from the underlying data.
- property idx#
Return the class-level index.
- static log(message, level='info', prefix='')#
Log a prefixed message at the given level through the shared Element logger.
- property log_prefix#
its idx plus a name or title if present.
- Type:
Return the log prefix for this instance
- classmethod types_for(idx, subclass='')#
Retrieve the correct subclass pair for the parameters from the existing class registry.
If nothing is passed, it will simply return whatever class this was called on.
- Returns:
The dataclass and elemclass of the matching type.
- classmethod type_for(idx, subclass='')#
Retrieve just the element class for the given index and optional subclass name.
- classmethod serialize_registry(idx)#
Render the registry entries for an index as a readable string.
- classmethod is_architectonic()#
Return True if this class is defined in an architectonic (underscore-prefixed) module.
- classmethod is_actual()#
Return True if this class’s index reaches the maximum architectonic depth.
- classmethod architectonic_root()#
Return the architectonic base class registered for this class’s index.
- classmethod datatype()#
Return the ElementData type registered alongside this class.
- classmethod infer_datatype()#
Infer the ElementData type from this class’s __init__ annotation or the registry.
- classmethod index_file()#
Return the path to the index file for this Element type, if it exists.
- classmethod index_data()#
Return the parsed contents of this element’s index file, cached globally.
- classmethod dirname()#
Return the architectonic directory name for this element’s index.
- info(message)#
Log an info-level message with this instance’s prefix.
- warn(message)#
Log a warning-level message with this instance’s prefix.
- error(message)#
Log an error-level message with this instance’s prefix.
- debug(message)#
Log a debug-level message with this instance’s prefix.
- span(message, **kwargs)#
Wrap all logs produced while yielding in this span.