Mixins¶
The galactic.context.mixins package defines mixins classes for defining new types of
contexts:
ConcreteIndividualfor defining individuals that own their identifier as a fieldConcreteAttributefor defining attributes that own their name and their type as fieldsContextHolderfor defining elements that own their context as a fieldPopulationHolderfor defining elements that own their population as a fieldModelHolderfor defining elements that own their model as a fieldAttributesHolderfor defining models that own their attributes as a fieldIndividualsHolderfor defining population that own their individuals as a fieldValuesHolderfor defining individuals that own their values as a field
They are widely used for defining
in the galactic.context.memory package.
New in version 0.0.1.
-
class
galactic.context.mixins.ConcreteIndividual(**kwargs)[source]¶ The
ConcreteIndividualclass is a mixin used in subclassing theIndividualclass for storing their identifier as a field.New in version 0.0.1.
-
class
galactic.context.mixins.ConcreteAttribute(**kwargs)[source]¶ The
ConcreteAttributeclass is a mixin used in subclassing theAttributeclass for storing their name and their type as a class.New in version 0.0.1.
-
class
galactic.context.mixins.ContextHolder(**kwargs)[source]¶ The
ContextHolder[C]is a mixin used for storing an element context as a field.It’s a generic class that depends of a
ContextsubclassC.New in version 0.0.1.
-
__init__(**kwargs)[source]¶ Initialise an element by setting its context.
Keyword Arguments: context ( C) – the contextNew in version 0.0.1.
-
context¶ Get the context.
Returns: the context Return type: CNew in version 0.0.1.
-
-
class
galactic.context.mixins.PopulationHolder(**kwargs)[source]¶ The
PopulationHolder[P]is a mixin used for storing an element population as a field.It’s a generic class that depends of a
PopulationsubclassP.New in version 0.0.1.
-
__init__(**kwargs)[source]¶ Initialise an element by setting its population.
Keyword Arguments: population ( P) – the populationNew in version 0.0.1.
-
population¶ Get the population.
Returns: the population Return type: PNew in version 0.0.1.
-
-
class
galactic.context.mixins.ModelHolder(**kwargs)[source]¶ The
ModelHolder[M]class is a mixin used for storing an element model as a field.It’s a generic class that depends of a
ModelsubclassM.New in version 0.0.1.
-
__init__(**kwargs)[source]¶ Initialise an element by setting its model.
Keyword Arguments: model ( M) – the modelNew in version 0.0.1.
-
model¶ Get the model.
Returns: the model Return type: MNew in version 0.0.1.
-
-
class
galactic.context.mixins.AttributesHolder(**kwargs)[source]¶ The
AttributesHolder[A]class is a mixin used for storing the model attributes in memory.It’s a generic class that depends of an
AttributesubclassA.New in version 0.0.1.
-
__init__(**kwargs)[source]¶ Initialise an attribute holder.
Keyword Arguments: attributes ( Iterable[A]) – the attributesNew in version 0.0.1.
-
-
class
galactic.context.mixins.IndividualsHolder(**kwargs)[source]¶ The
IndividualsHolder[X]class is a mixin used for storing the population individuals in memory.It’s a generic class that depends of an
IndividualsubclassX.New in version 0.0.1.
-
__init__(**kwargs)[source]¶ Initialise an individuals holder.
Keyword Arguments: individuals ( Iterable[A]) – the individualsNew in version 0.0.1.
-
-
class
galactic.context.mixins.ValuesHolder(**kwargs)[source]¶ The
ValuesHolder[A]class is a mixin for storing the individual values in memory.It’s a generic class that depends of an
AttributesubclassA.New in version 0.0.1.
-
__init__(**kwargs)[source]¶ Initialise a values holder.
Keyword Arguments: values ( Mapping[str, object]) – the initial (name, value) pairsNew in version 0.0.1.
-