qblox_scheduler.structure#

Validated and serializable data structures using pydantic.

In this module we provide pre-configured Pydantic model and custom field types that allow serialization of typical data objects that we frequently use in qblox-scheduler, like functions and arrays.

Submodules#

Attributes#

Classes#

DataStructure

A parent for all data structures.

Graph

Pydantic-compatible version of networkx.Graph.

Package Contents#

class DataStructure(/, **data: Any)[source]#

Bases: _SerializableBaseModel

A parent for all data structures.

Data attributes are generated from the class’ type annotations, similarly to dataclasses. If data attributes are JSON-serializable, data structure can be serialized using json() method. This string can be deserialized using parse_raw() classmethod of a correspondent child class.

If required, data fields can be validated, see examples for more information. It is also possible to define custom field types with advanced validation.

This class is a pre-configured pydantic model. See its documentation for details of usage information.

model_config#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class Graph(incoming_graph_data=None, **attr)[source]#

Bases: networkx.Graph

Pydantic-compatible version of networkx.Graph.

classmethod validate(v: Any) Graph[source]#

Validate the data and cast from all known representations.

NDArray[source]#