pyhaystack.client.entity package

Submodules

pyhaystack.client.entity.entity module

High-level Entity interface.

class pyhaystack.client.entity.entity.DeletableEntity(session, entity_id)

Bases: pyhaystack.client.entity.entity.Entity

Class to represent entities that can be deleted from the Haystack server (the server implements the ‘delete’ operation).

Initialise a new high-level entity object.

Parameters:
  • session – The connection session object.
  • entity_id – The entity’s fully qualified ID.
delete(callback=None)

Delete the entity.

class pyhaystack.client.entity.entity.Entity(session, entity_id)

Bases: object

A base class for Project Haystack entities. This is a base class that is then combined with mix-ins depending on the tags present for the entity and the tagging model in use (by default, we use the “Project Haystack” tagging model, but others such as ISA-95 may exist).

This base class just exposes the tags, and if supported by the server, may expose the ability to update those tags.

Initialise a new high-level entity object.

Parameters:
  • session – The connection session object.
  • entity_id – The entity’s fully qualified ID.
dis

Return the description field of the entity.

id

Return the fully qualified ID of this entity.

tags

Return the tags of this entity.

exception pyhaystack.client.entity.entity.StaleEntityInstanceError

Bases: exceptions.Exception

Exception thrown when an entity instance is “stale”, that is, the entity class type no longer matches the tag set present in the entity.

pyhaystack.client.entity.model module

Tagging Model Interface.

class pyhaystack.client.entity.model.TaggingModel(session)

Bases: object

A base class for representing tagging models. The tagging model is responsible for considering the tags present on a new entity then instantiating an appropriate data type based on those tags seen.

Initialise a new tagging model.

create_entity(entity_id, tags)

Create an Entity instance based on the tags present.

pyhaystack.client.entity.tags module

Entity tag interface. This file implements the interfaces that will be used to access and store tags of an entity.

class pyhaystack.client.entity.tags.BaseEntityTags(entity)

Bases: object

A base class for storing entity tags.

Initialise a new high-level entity tag storage object.

Parameters:
  • session – The connection session object.
  • entity_id – The entity’s fully qualified ID.
class pyhaystack.client.entity.tags.BaseMutableEntityTags(entity)

Bases: pyhaystack.client.entity.tags.BaseEntityTags

A base class for entity tags that supports modifications to the tag set.

commit(callback=None)

Commit any to-be-sent updates for this entity.

is_dirty

Returns true if there are modifications pending submission.

revert(tags=None)

Revert the named attribute changes, or all changes.

class pyhaystack.client.entity.tags.MutableEntityTags(entity)

Bases: pyhaystack.client.entity.tags.BaseMutableEntityTags, _abcoll.MutableMapping

class pyhaystack.client.entity.tags.ReadOnlyEntityTags(entity)

Bases: pyhaystack.client.entity.tags.BaseEntityTags, _abcoll.Mapping

Initialise a new high-level entity tag storage object.

Parameters:
  • session – The connection session object.
  • entity_id – The entity’s fully qualified ID.

Module contents