everest.representers.dataelements

Data elements.

class everest.representers.dataelements.CollectionDataElement[source]

Bases: everest.representers.dataelements.DataElement

Abstract base class for collection data elements.

__len__()[source]

Returns the number of member data elements in this collection data element.

add_member(data_element)[source]

Adds the given member data element to this collection data element.

get_members()[source]

Returns all member data elements added to this collection data element.

class everest.representers.dataelements.DataElement[source]

Bases: object

Abstract base class for data element classes.

Data elements manage value state during serialization and deserialization. Implementations may need to be adapted to the format of the external representation they manage.

__weakref__

list of weak references to the object (if defined)

classmethod create()[source]

Basic factory method.

classmethod create_from_resource(resource)[source]

(Abstract) factory method taking a resource as input.

mapping = None

Static attribute mapping.

class everest.representers.dataelements.DataElementAttributeProxy(data_element)[source]

Bases: object

Convenience proxy for accessing data from data elements.

The proxy allows you to transparently access terminal, member, and collection attributes. Nested access is also supported.

Example:

prx = DataElementAttributeProxy(data_element)
de_id = prx.id                              # terminal access
de_parent = prx.parent                      # member access
de_child = prx.children[0]                  # collection access
de_grandchild = prx.children[0].children[0] # nested collection access
__weakref__

list of weak references to the object (if defined)

class everest.representers.dataelements.LinkedDataElement[source]

Bases: everest.representers.dataelements.DataElement

Data element managing a linked resource during serialization and deserialization.

class everest.representers.dataelements.MemberDataElement[source]

Bases: everest.representers.dataelements.DataElement

Abstract base class for member data element classes.

get_mapped_nested(attr)[source]

Returns the mapped nested resource attribute (either a member or a collection resource attribute).

Returns:object implementing :class:IDataelement or None if no nested resource is found for the given attribute name.
get_mapped_terminal(attr)[source]

Returns the value for the given mapped terminal resource attribute.

Parameters:attr (everest.representers.attributes.MappedAttribute) – attribute to retrieve.
Returns:attribute value or None if no value is found for the given attribute name.
set_mapped_nested(attr, data_element)[source]

Sets the value for the given mapped nested resource attribute (either a member or a collection resource attribute).

Parameters:data_element – a :class:DataElement or :class:LinkedDataElement object containing nested resource data.
set_mapped_terminal(attr, value)[source]

Sets the value for the given mapped terminal resource attribute.

Parameters:value – value of the attribute to set.
class everest.representers.dataelements.SimpleCollectionDataElement[source]

Bases: everest.representers.dataelements._SimpleDataElementMixin, everest.representers.dataelements.CollectionDataElement

Basic implementation of a collection data element.

class everest.representers.dataelements.SimpleLinkedDataElement[source]

Bases: everest.representers.dataelements.LinkedDataElement

Basic implementation of a linked data element.

class everest.representers.dataelements.SimpleMemberDataElement[source]

Bases: everest.representers.dataelements._SimpleDataElementMixin, everest.representers.dataelements.MemberDataElement

Basic implementation of a member data element.

get_nested(attr_name)[source]

Returns the (raw) value of the specified attribute.

Parameters:attr_name (str) – name of the attribute to retrieve.
get_terminal(attr_name)[source]

Returns the (raw) value of the specified attribute.

Parameters:attr_name (str) – name of the attribute to retrieve.
set_nested(attr_name, data_element)[source]

Sets the (raw) value of the specified attribute.

Parameters:
  • attr_name (str) – name of the attribute to set.
  • data_element – a DataElement or LinkedDataElement object containing nested resource data.
set_terminal(attr_name, value)[source]

Sets the (raw) value of the specified attribute.

Parameters:
  • attr_name (str) – name of the attribute to set.
  • value (str) – value of the attribute to set.

Project Versions

Previous topic

everest.representers.csv

Next topic

everest.representers.interfaces

This Page