gtirb.auxdata module

class gtirb.auxdata.AuxData(data, type_name, lazy_container=None)[source]

Bases: object

AuxData objects can be attached to the gtirb.IR or individual gtirb.Module s to store additional client-specific data in a portable way.

AuxData represents a portable, language-independent manner of encoding rich data. To do this, all data is stored on disk as a series of bytes with a string describing the format of the data, called a type name. See gtirb.serialization for the list of all default types. Types may also be parameterized; for example, mapping<string,UUID> is a dict from str objects to UUID objects. All AuxData requires a valid type name in order to be serialized.

Variables:
  • ~.data – The value stored in this AuxData.

  • ~.type_name – A string describing the type of data. Used to determine the proper codec for serializing this AuxData.

__init__(data, type_name, lazy_container=None)[source]
Parameters:
  • data (object) – The value stored in this AuxData.

  • type_name (str) – A string describing the type of data. Used to determine the proper codec for serializing this AuxData.

  • lazy_container (typing.Optional[gtirb.auxdata._LazyDataContainer]) – An object that will lazily deserialize the auxdata table backing this object, or None.

property data: Any
serializer: typing.ClassVar[gtirb.serialization.Serialization] = <gtirb.serialization.Serialization object>

This is a gtirb.Serialization instance, used to encode and decode data fields of all AuxData. See gtirb.serialization for details.

class gtirb.auxdata.AuxDataContainer(aux_data={}, uuid=None)[source]

Bases: Node

The base class for anything that holds AuxData tables; that is, gtirb.IR and gtirb.Module.

Variables:

~.aux_data – The auxiliary data associated with the object, as a mapping from names to gtirb.AuxData.

__init__(aux_data={}, uuid=None)[source]
Parameters:
  • aux_data (typing.Union[typing.Mapping[str, gtirb.auxdata.AuxData], typing.Iterable[typing.Tuple[str, gtirb.auxdata.AuxData]]]) – The initial auxiliary data to be associated with the object, as a mapping from names to gtirb.AuxData. Defaults to an empty dict.

  • uuid (typing.Optional[uuid.UUID]) – the UUID of this AuxDataContainer, or None if a new UUID needs generated via uuid.uuid4(). Defaults to None.

deep_eq(other)[source]

This overrides gtirb.Node.deep_eq() to check for AuxData equality.

Because the values stored by AuxData are not necessarily amenable to deep checking, the auxiliary data dictionaries stored for self and other are not deeply checked. Instead, they are considered to be equal if their sets of keys are equal.

Return type:

bool