EntityRecordBase

class app.portfolio.models.entity.entity_record_base.EntityRecordBase[source]

Bases: EntityRecordMeta, CachedTypeHintsMixin, LoggableHierarchicalRootModel, EntityImpl, EntitySchema, NamedMixinMinimal, Generic

Inheritance diagram of EntityRecordBase

Inheritance Diagram for EntityRecordBase

Methods

apply_deletion(*[, who, why])

by_uid(uid)

by_uid_or_none(uid)

call_entity_method(name, *args, **kwargs)

delete()

get_children_uids(*[, use_journal])

get_entity_class()

get_journal(*[, create, fail])

get_journal_class(cls[, source])

Resolve and cache the concrete parent argument defined by the descriptor.

get_journal_field(field, *[, create])

get_model_field_aliases()

get_model_field_reverse_aliases()

is_computed_field(field)

is_journal_field_edited(field)

is_model_field(field)

is_model_field_alias(alias)

is_newer_version_than(other)

is_protected_field_type(field)

is_reachable(*[, recursive, use_journal])

is_update_allowed(*[, in_commit_only, ...])

iter_children_uids(*[, use_journal])

iter_dependency_event_handlers()

iter_hierarchy(*[, condition, use_journal, ...])

Return a flat ordered set of all entities in this hierarchy.

model_post_init(context)

narrow_to_instance(value)

narrow_to_instance_or_none(value)

narrow_to_uid(value)

on_annotation_record_created(annotation_or_uid)

on_annotation_record_deleted(annotation_or_uid)

on_dependency_deleted(source)

on_dependency_updated(source)

propagate_deletion()

register_dependency_event_handler(record)

register_entity_class(entity_class)

resolve_field_alias(alias)

reverse_field_alias(name)

revert()

sort_key()

update(**kwargs)

Create a new instance of the entity record with the updated data.

Attributes

PROPAGATE_INSTANCE_NAME_FROM_PARENT

PROPAGATE_INSTANCE_PARENT_FROM_PARENT_TO_CHILDREN

STRICT_INSTANCE_NAME_VALIDATION

children

children_uids

deleted

dependent_uids

dependents

dirty

entity

entity_dependents

entity_log

entity_or_none

exists

extra_dependencies

has_diff

has_journal

in_session

instance_name

Get the instance name, or class name if not set.

instance_parent

is_journal

j

journal

journal_children_uids

marked_for_deletion

model_config

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

record_parent

record_parent_or_none

reverted

session

session_manager

session_manager_or_none

session_or_none

superseded

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

superseding

superseding_or_none

PROPAGATE_INSTANCE_NAME_FROM_PARENT: ClassVar[bool] = False
PROPAGATE_INSTANCE_PARENT_FROM_PARENT_TO_CHILDREN: ClassVar[bool] = True
STRICT_INSTANCE_NAME_VALIDATION: ClassVar[bool] = True
static __new__(cls, *args: Any, **kwargs: Any) Self[source]
Parameters:
Return type:

Self

apply_deletion(*, who: str | None = None, why: str | None = None) None[source]
Parameters:
  • who (str | None)

  • why (str | None)

Return type:

None

classmethod by_uid(uid: Uid) T[source]
Parameters:

uid (Uid)

Return type:

T

classmethod by_uid_or_none(uid: Uid) T | None[source]
Parameters:

uid (Uid)

Return type:

T | None

call_entity_method(name: str, *args, **kwargs) Any[source]
Parameters:

name (str)

Return type:

Any

property children: Iterable[EntityRecordBase]
property children_uids: Iterable[Uid][source]
delete() None[source]
Return type:

None

property deleted: bool
property dependent_uids: Iterable[Uid]
property dependents: Iterable[EntityRecordBase]
property dirty: bool
property entity: Entity
property entity_dependents: EntityDependents
property entity_log: EntityLog
property entity_or_none: Entity | None
property exists: bool
property extra_dependencies: UidProxySet[__annotationlib_name_1__]
get_children_uids(*, use_journal: bool = False) Iterable[Uid][source]
Parameters:

use_journal (bool)

Return type:

Iterable[Uid]

classmethod get_entity_class() type[Entity][source]
Return type:

type[Entity]

get_journal(*, create: bool = True, fail: bool = True) Journal | None[source]
Parameters:
Return type:

Journal | None

classmethod get_journal_class(cls: type[T], source: type[T] | None = None, **kwargs: Unpack[GetConcreteParentArgumentKwargs]) type[R]

Resolve and cache the concrete parent argument defined by the descriptor.

The descriptor caches the result per owning class via instance_lru_cache() so repeated introspections remain constant time.

Raises:

GenericsError – If the underlying parent argument cannot be resolved to a concrete type.

Parameters:
Return type:

type[R]

get_journal_field(field: str, *, create: bool = False) Any[source]
Parameters:
Return type:

Any

classmethod get_model_field_aliases() frozendict[str, str][source]
Return type:

frozendict[str, str]

classmethod get_model_field_reverse_aliases() frozendict[str, str][source]
Return type:

frozendict[str, str]

property has_diff: bool
property has_journal: bool
property in_session: bool
property instance_name: str

Get the instance name, or class name if not set.

property instance_parent: HierarchicalProtocol | NamedProtocol | None
classmethod is_computed_field(field: str) bool[source]
Parameters:

field (str)

Return type:

bool

property is_journal: bool
is_journal_field_edited(field: str) bool[source]
Parameters:

field (str)

Return type:

bool

classmethod is_model_field(field: str) bool[source]
Parameters:

field (str)

Return type:

bool

classmethod is_model_field_alias(alias: str) bool[source]
Parameters:

alias (str)

Return type:

bool

is_newer_version_than(other: EntityRecordBase) bool[source]
Parameters:

other (EntityRecordBase)

Return type:

bool

classmethod is_protected_field_type(field: str) bool[source]
Parameters:

field (str)

Return type:

bool

is_reachable(*, recursive: bool = True, use_journal: bool = False) bool[source]
Parameters:
Return type:

bool

classmethod is_update_allowed(*, in_commit_only: bool = True, allow_in_abort: bool = False, force_session: bool = False) bool[source]
Parameters:
  • in_commit_only (bool)

  • allow_in_abort (bool)

  • force_session (bool)

Return type:

bool

iter_children_uids(*, use_journal: bool = False) Iterable[Uid][source]
Parameters:

use_journal (bool)

Return type:

Iterable[Uid]

classmethod iter_dependency_event_handlers() Iterable[EntityDependencyEventHandlerBase][source]
Return type:

Iterable[EntityDependencyEventHandlerBase]

iter_hierarchy(*, condition: Callable[[EntityRecordBase], bool] | None = None, use_journal: bool = False, check_condition_on_return: bool = True) Iterable[EntityRecordBase][source]

Return a flat ordered set of all entities in this hierarchy.

Parameters:
Return type:

Iterable[EntityRecordBase]

property j: T_Journal
property journal: T_Journal
property journal_children_uids: Iterable[Uid]
property marked_for_deletion: bool
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True, 'serialize_by_alias': True, 'validate_assignment': True, 'validate_by_alias': True}

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

model_post_init(context: Any) None[source]
Parameters:

context (Any)

Return type:

None

classmethod narrow_to_instance(value: T | Uid) T[source]
Parameters:

value (T | Uid)

Return type:

T

classmethod narrow_to_instance_or_none(value: T | Uid) T | None[source]
Parameters:

value (T | Uid)

Return type:

T | None

classmethod narrow_to_uid(value: T | Uid) Uid[source]
Parameters:

value (T | Uid)

Return type:

Uid

on_annotation_record_created(annotation_or_uid: AnnotationRecord | __annotationlib_name_1__) None[source]
Parameters:

annotation_or_uid (AnnotationRecord | __annotationlib_name_1__)

Return type:

None

on_annotation_record_deleted(annotation_or_uid: AnnotationRecord | __annotationlib_name_1__) None[source]
Parameters:

annotation_or_uid (AnnotationRecord | __annotationlib_name_1__)

Return type:

None

on_dependency_deleted(source: Journal) None[source]
Parameters:

source (Journal)

Return type:

None

on_dependency_updated(source: Journal) None[source]
Parameters:

source (Journal)

Return type:

None

propagate_deletion() None[source]
Return type:

None

property record_parent: EntityRecordBase
property record_parent_or_none: EntityRecordBase | None
classmethod register_dependency_event_handler(record: EntityDependencyEventHandlerBase) None[source]
Parameters:

record (EntityDependencyEventHandlerBase)

Return type:

None

classmethod register_entity_class(entity_class: type[Entity]) None[source]
Parameters:

entity_class (type[Entity])

Return type:

None

classmethod resolve_field_alias(alias: str) str[source]
Parameters:

alias (str)

Return type:

str

classmethod reverse_field_alias(name: str) str[source]
Parameters:

name (str)

Return type:

str

revert() None[source]
Return type:

None

property reverted: bool
property session: Session
property session_manager: SessionManager
property session_manager_or_none: SessionManager | None
property session_or_none: Session | None
sort_key() SupportsRichComparison[source]
Return type:

SupportsRichComparison

property superseded: bool

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

property superseding: T
property superseding_or_none: T | None
update(**kwargs: Any) T[source]

Create a new instance of the entity record with the updated data.

The new instance will have an incremented version and the same UID, superseding the current instance.

Parameters:
  • self (T)

  • kwargs (Any)

Return type:

T