arjuna.tpi.data.entity module

arjuna.tpi.data.entity.data_entity(entity_name, *attrs, bases=, **attrs_with_defaults)

Create a new Data Entity class with provided name and attributes.

Parameters
  • entity_name – The class name for this new Data Entity type.

  • *attrs – Arbitrary names for Python attributes to be associated with objects of this entity.

Keyword Arguments
  • bases – Base data entities for this entity. Can be a string or tuple or list.

  • **attrs_with_defaults – Arbitrary attributes to be associated with objects of this entity, with the defaults that are provided.

Note

The defaults that are provided can be any of the following:
  • Any Python Object

  • A Python callable

  • Arjuna generator

  • Arjuna composite

Note

When you provide one or more bases, the overriding order is B1 -> B2 -> B3 ….. -> This Entity.

At each stage of this chain, you can

  • Add one or more mandatory attributes.

  • Add one or more optional attributes

  • Make an optional attribute in base entity as mandatory.

  • Make a mandatory attribute as optional by assigning a default value.

  • Change the default for an existing default attribute to something else.