conkit.core.Entity module

Base class for all entities used in this interface.

class Entity(id)[source]

Bases: object

Base class for all entities used in this interface.

It handles the storage of data. It also provides a high-efficiency methods to allow fast lookup and iterations of each entity. It also provides a hierarchical structure to remember parent and child entities.

Notes

It is strongly advised against the use of the Entity class directly. Instead, use one or more of the the remaining data models.

Attributes

id The ID of the selected entity
full_id A traceback id including all parent classes
parent An attribute to store the reference to the parent Entity
child_list A list storing the child entities
child_dict A dictionary storing the child entities

Methods

add(entity) Add a child to the Entity
copy() Create a shallow copy of Entity
deepcopy() Create a deep copy of Entity
remove(id) Remove a child
add(entity)[source]

Add a child to the Entity

Parameters:entity : Entity
child_dict

A dictionary storing the child entities

child_list

A list storing the child entities

copy()[source]

Create a shallow copy of Entity

deepcopy()[source]

Create a deep copy of Entity

full_id

A traceback id including all parent classes

The full id is a tuple containing all id’s starting from the top object (ContactFile) down to the current object. A full id for a Contact e.g. is something like: (‘1aa’, 1, (1, 10))

This corresponds to:

ContactFile identifier => 1aaa ContactMap identifier => 1 Contact identifier => (1, 10)

id

The ID of the selected entity

parent

An attribute to store the reference to the parent Entity

remove(id)[source]

Remove a child

Parameters:id : str, int, list, tuple

Warning

If id is of type int, then the Entity in the child_list at index id will be deleted