Bundle#

class omni.graph.core.Bundle(attribute_name: str, read_only: bool)#

Bases: object

—– FOR USE BY GENERATED CODE ONLY —–

Deferred implementation of the bundle concept

Methods

__init__(attribute_name, read_only)

Initialize the access points for the bundle attribute

attribute_by_name(attribute_name)

Get an attribute by name from the underlying buffer or the buffer masking it.

clear()

Empties out the bundle contents

create_attribute(name, type_desc)

Create an attribute inside the buffered bundle data structure

from_accessor(bundle_contents)

-------- FOR GENERATED CODE USE ONLY -------- Convert a BundleContents object to a python Bundle.

insert(to_insert)

Insert new content in the existing bundle

remove(attribute_name)

Removes the attribute with the given name from the bundle, silently succeeding if it is not in the bundle.

Attributes

attribute_names

Returns the list of interface objects corresponding to the attributes contained within the bundle

is_runtime_resident

Does the bundle content exist and is it valid

name

The bundle's name

runtime_accessor

exposes the runtime bundle accessor.

size

Returns the number of attributes within this bundle, 0 if the bundle is not valid

valid

Is the underlying bundle valid, or None if it does not even exist

__init__(attribute_name: str, read_only: bool)#

Initialize the access points for the bundle attribute

Parameters:
  • attribute_name – the bundle’s name. This name will only be used if the bundle is nested.

  • read_only – Is the bundle data read-only?

attribute_by_name(
attribute_name: str,
) RuntimeAttribute | None#

Get an attribute by name from the underlying buffer or the buffer masking it.

Parameters:

attribute_name – the attribute being queried.

Returns:

the named attribute within the bundle, or None if no such attribute exists in the bundle

clear()#

Empties out the bundle contents

Raises:

og.OmniGraphError – if the bundle is not writable

create_attribute(
name: str,
type_desc: type,
) OmniAttribute#

Create an attribute inside the buffered bundle data structure

Parameters:
  • name – name of the attribute to create

  • type_desc – python type object of the attribute to create. Accepts all Omnigraph types. Will attempt to convert non-omnigraph types, but raise an error if it fails.

Returns:

the OmniAttribute it created.

Raises:

OmniGraphError if no type conversion was found.

classmethod from_accessor(
bundle_contents: BundleContents,
)#

——– FOR GENERATED CODE USE ONLY ——– Convert a BundleContents object to a python Bundle.

Parameters:

bundle_contents – the graph object representing the bundle

insert(
to_insert: Bundle | OmniAttribute | Tuple[OmniAttribute, str] | Tuple[Type, str],
)#

Insert new content in the existing bundle

Parameters:

to_insert

Object to insert. It can be one of three different types of object:

Bundle: Another bundle, whose contents are entirely copied into this one

RuntimeAttribute: A single attribute from another bundle to be copied with the same name

(RuntimeAttribute, str): A single attribute from another bundle and the name to use for the copy

AttributeDescription: Information required to create a brand new typed attribute

Returns:

Attribute object of the new attribute if inserting an attribute, else None

remove(attribute_name: str)#

Removes the attribute with the given name from the bundle, silently succeeding if it is not in the bundle.

Parameters:

attribute_name – attribute to be deleted.

property attribute_names: List[OmniAttribute]#

Returns the list of interface objects corresponding to the attributes contained within the bundle

property is_runtime_resident#

Does the bundle content exist and is it valid

Type:

bool

property name#

The bundle’s name

property runtime_accessor: BundleContents#

exposes the runtime bundle accessor.

Returns:

the BundleContents object if it exists, None otherwise.

property size: int#

Returns the number of attributes within this bundle, 0 if the bundle is not valid

Type:

int

property valid: bool | None#

Is the underlying bundle valid, or None if it does not even exist

Type:

bool