model
=====

.. py:module:: quantify_scheduler.structure.model 

.. autoapi-nested-parse::

   Root models for data structures used within the package.



Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   quantify_scheduler.structure.model.DataStructure



Functions
~~~~~~~~~

.. autoapisummary::

   quantify_scheduler.structure.model.deserialize_function
   quantify_scheduler.structure.model.deserialize_class



.. py:class:: DataStructure(/, **data: Any)

   Bases: :py:obj:`pydantic.BaseModel`


   A parent for all data structures.

   Data attributes are generated from the class' type annotations, similarly to
   `dataclasses <https://docs.python.org/3/library/dataclasses.html>`_. 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 <https://docs.pydantic.dev/>`_
   model. See its documentation for details of usage information.

   .. admonition:: Examples
       :class: dropdown

       .. include:: /examples/structure.DataStructure.rst


   .. py:attribute:: model_config

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


.. py:function:: deserialize_function(fun: str) -> Callable[Ellipsis, Any]

   Import a python function from a dotted import string (e.g.,
   "quantify_scheduler.structure.model.deserialize_function").

   :param fun: A dotted import path to a function (e.g.,
               "quantify_scheduler.waveforms.square"), or a function pointer.
   :type fun: str

   :rtype: Callable[[Any], Any]

   :raises ValueError: Raised if the function cannot be imported from path in the string.


.. py:function:: deserialize_class(cls: str) -> type

   Import a python class from a dotted import string (e.g.,
   "quantify_scheduler.structure.model.DataStructure").

   :param cls: A dotted import path to a class (e.g.,
               "quantify_scheduler.structure.model.DataStructure"), or a class pointer.
   :type cls: str

   :returns: The type you are trying to import.

   :raises ValueError: Raised if the class cannot be imported from path in the string.