Entity

class app.portfolio.models.entity.Entity[source]

Bases: LoggableHierarchicalModel

Inheritance diagram of Entity

Inheritance Diagram for Entity

Methods

calculate_instance_name_from_arbitrary_data(data)

calculate_instance_name_from_dict(data)

calculate_instance_name_from_instance(instance)

from_uid(uid)

model_post_init(context)

uid_namespace(data)

Returns the namespace for the UID.

update(**kwargs)

Creates a new instance of the entity with the updated data.

Attributes

model_config

Configuration for the model, should be a dictionary conforming to ConfigDict.

superseded

Indicates whether this entity instance has been superseded by another instance with an incremented version.

uid

entity_log

version

instance_parent

classmethod calculate_instance_name_from_arbitrary_data(data)[source]
Return type:

str

Parameters:

data (Any)

abstractmethod classmethod calculate_instance_name_from_dict(data)[source]
Return type:

str

Parameters:

data (dict[str, Any])

classmethod calculate_instance_name_from_instance(instance)[source]
Return type:

str

Parameters:

instance (Entity)

entity_log: EntityAuditLog
classmethod from_uid(uid)[source]
Return type:

Entity | None

Parameters:

uid (Uid)

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to ConfigDict.

model_post_init(context)[source]
Return type:

None

Parameters:

context (Any)

property superseded: bool

Indicates whether this entity instance has been superseded by another instance with an incremented version.

uid: Uid
classmethod uid_namespace(data)[source]

Returns the namespace for the UID. This can be overridden in subclasses to provide a custom namespace.

Return type:

str

Parameters:

data (dict[str, Any])

update(**kwargs)[source]

Creates a new instance of the entity with the updated data. The new instance will have an incremented version and the same UID, superseding the current instance.

Return type:

TypeVar(T, bound= Entity)

Parameters:
  • self (T)

  • kwargs (Any)

version: Annotated[int]