opentimelineio.core package

opentimelineio.core.deprecated_field()

For marking attributes on a SerializableObject deprecated.

opentimelineio.core.register_type(classobj, schemaname=None)
opentimelineio.core.serializable_field(name, required_type=None, doc=None)

Create a serializable_field for child classes of SerializableObject.

Convienence function for adding attributes to child classes of SerializableObject in such a way that they will be serialized/deserialized automatically.

Use it like this:

@core.register_type
class Foo(SerializableObject):
    bar = serializable_field("bar", required_type=int, doc="example")

This would indicate that class “foo” has a serializable field “bar”. So:

f = foo()
f.bar = "stuff"

# serialize & deserialize
otio_json = otio.adapters.from_name("otio")
f2 = otio_json.read_from_string(otio_json.write_to_string(f))

# fields should be equal
f.bar == f2.bar

Additionally, the “doc” field will become the documentation for the property.

opentimelineio.core.serialize_json_to_file(root, filename, indent=4)
opentimelineio.core.serialize_json_to_string(root, indent=4)
opentimelineio.core.upgrade_function_for(cls, version_to_upgrade_to)

Decorator for identifying schema class upgrade functions.

Example >>> @upgrade_function_for(MyClass, 5) … def upgrade_to_version_five(data): … pass

This will get called to upgrade a schema of MyClass to version 5. My class must be a class deriving from otio.core.SerializableObject.

The upgrade function should take a single argument - the dictionary to upgrade, and return a dictionary with the fields upgraded.

Remember that you don’t need to provide an upgrade function for upgrades that add or remove fields, only for schema versions that change the field names.

Submodules

opentimelineio.core.composable module

opentimelineio.core.composition module

opentimelineio.core.item module

opentimelineio.core.mediaReference module