Component
Attributes
attribute
__slots__= ('id', 'name', 'strict', 'spec', 'yaml_path', 'registry', '_initial_data')
attribute
specS
= spec
attribute
spec_typetype[S]
attribute
yaml_path= yaml_path
attribute
strict= strict
attribute
registry= registry
attribute
id= self.generate_id()
attribute
name= self.spec.name
attribute
full_namestr
Functions
func
__init____init__(self, /, spec, registry, *, initial_data=None, yaml_path=None, strict=False) -> None
param
selfparam
specS
param
registryRegistry
param
initial_datadict[str, Any] | None
= None
param
yaml_pathstr | None
= None
param
strictbool
= False
Returns
None
func
__repr____repr__(self) -> str
param
selfReturns
str
func
from_dictfrom_dict(cls, /, data, registry, *, yaml_path=None, strict=False, **kwargs) -> Self
Create a Component from a dict spec
Args: data (dict[str, Any]): Dictionary containing the BaseNode spec. yaml_path (str | None): Path to the YAML file if the data is loaded from a YAML file. strict (bool): Whether to enforce strict validation of the spec and other internal checks. **kwargs: Additional keyword arguments specific to the subclass.
Returns: Component: An instance of initialized Component
param
clsparam
datadict[str, Any]
param
registryRegistry
param
yaml_pathstr | None
= None
param
strictbool
= False
param
kwargsAny
= {}
Returns
Self
func
from_yaml_pathfrom_yaml_path(cls, /, yaml_path, registry, *, strict=True, **kwargs) -> ComponentT
Create a Component from a YAML file.
Args: yaml_path (str | Path): Path to the YAML file. registry (Registry): Registry instance for plugins.
Returns: Component: An instance of Component initialized with the YAML data.
param
clstype[ComponentT]
param
yaml_pathstr | Path
param
registryRegistry
param
strictbool
= True
param
kwargsAny
= {}
Returns
ComponentT
func
generate_idgenerate_id(self) -> UUID
param
selfReturns
UUID
func
create_extended_speccreate_extended_spec(cls, /, base_spec_class, plugins, data) -> type[S]
Create extended spec class with plugin fields and validate data.
Returns: Tuple of (ExtendedSpecClass, validated_data)
param
clsparam
base_spec_classtype[S]
param
pluginsSequence[Plugin]
param
datadict[str, Any]
Returns
type[S]
func
print_specprint_spec(self, /, initial=False) -> None
Print the tool node specification in YAML format. Args: raw (bool): If True, print the raw declaration; otherwise, print the validated spec.
param
selfparam
initialbool
= False
Returns
None
Last updated on