engforge.attr_slots.Slot
- class Slot(name, default, validator, repr, cmp, hash, init, inherited, metadata=None, type=None, converter=None, kw_only=False, eq=None, eq_key=None, order=None, order_key=None, on_setattr=None, alias=None)[source]
Bases:
ATTR_BASESlot defines a way to accept different components or systems in a system
Methods
validates onetime A method to validate the kwargs passed to the define method
collects all the attribute instances for a system
collects all the attributes for a system
add the config class, and perform checks with `class_validate) :returns: [optional] a dictionary of options to be used in the make_attribute method
validates the instance given attr's init routine
Create an instance of the instance_class
taking a component or system class as possible input valid input is later validated as an instance of that class or subclass
taking a type of component iterator, defines an interface that can be 'wide' where all items are executed in the same row on System.run().
A method to validate the kwargs passed to the define method
Copy self and apply changes.
from_counting_attra passthrough
make_acceptedmakes an attrs.Attribute for the class
make_factoryprocess_combosreturn all subclasses of components, including their subclasses :type out: :param out: out is to pass when the middle of a recursive operation, do not use it!
unpack_atrsAttributes
namedefaultvalidatorrepreqeq_keyorderorder_keyhashinitmetadatatypeconverterkw_onlyinheritedon_setattraliasattr_prefixdefault_okdefault_optionsdflt_kwinstance_classnone_oktemplate_classacceptedconfig_clsis_iterwideactivecombos- classmethod class_validate(instance, **kwargs)
validates onetime A method to validate the kwargs passed to the define method
- classmethod collect_attr_inst(system, handle_inst=True)
collects all the attribute instances for a system
- Return type:
dict
- classmethod collect_cls(system)
collects all the attributes for a system
- Return type:
dict
- classmethod configure_for_system(name, config_class, cb=None, **kwargs)
add the config class, and perform checks with `class_validate) :returns: [optional] a dictionary of options to be used in the make_attribute method
- classmethod configure_instance(instance, attribute, value)[source]
validates the instance given attr’s init routine
- classmethod create_instance(instance)
Create an instance of the instance_class
- Return type:
- Parameters:
instance (Configuration)
- classmethod define(*component_or_systems, none_ok=False, default_ok=True, dflt_kw=None)[source]
taking a component or system class as possible input valid input is later validated as an instance of that class or subclass
- Parameters:
#TODO: add default_args,default_kwargs
- classmethod define_iterator(*component_or_systems, none_ok=False, default_ok=True, wide=True, dflt_kw=None)[source]
taking a type of component iterator, defines an interface that can be ‘wide’ where all items are executed in the same row on System.run().
Conversely if wide is false the system will loop over each item as if it was included in System.run(). Multiple ComponentIterators with wide=False will result in a outer join of the items.
- Parameters:
none_ok (
bool) – will allow no component on that item, otherwise will faildefault_ok (
bool) – will create the slot class with no input if truedflt_kw (
dict) – a dictionary of input in factory for custom initswide (
bool) – default is true, will determine if wide dataframe format, or outerproduct format when System.run() is calledcomponent_or_systems (ComponentIterator)
- classmethod define_validate(**kwargs)
A method to validate the kwargs passed to the define method
- evolve(**changes)
Copy self and apply changes.
This works similarly to attrs.evolve but that function does not work with Attribute.
It is mainly meant to be used for transform-fields.
Added in version 20.3.0.
- classmethod make_attribute(name, comp_class, **kwargs)
makes an attrs.Attribute for the class
- classmethod subclasses(out=None)
return all subclasses of components, including their subclasses :type out: :param out: out is to pass when the middle of a recursive operation, do not use it!