types#
Types that support validation in Pydantic.
Pydantic recognizes magic method __get_validators__
to receive additional
validators, that can be used, i.e., for custom serialization and deserialization.
We implement several custom types here to tune behavior of our models.
See Pydantic documentation for more information about implementing new types.
Module Contents#
Classes#
Pydantic-compatible version of |
|
Pydantic-compatible version of |
- class NDArray(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)[source]#
Bases:
numpy.ndarray
Pydantic-compatible version of
numpy.ndarray
.Serialization is implemented using custom methods
to_dict()
andfrom_dict()
. Data array is encoded in Base64.- classmethod from_dict(serialized: collections.abc.Mapping[str, Any]) NDArray [source]#
Construct an instance from a dictionary generated by :meth`to_dict`.
- Parameters:
serialized – Dictionary that has
"data"
,"shape"
and"dtype"
keys.”, where data is a base64-encoded bytes array, shape is a tuple and dtype is a string representation of a Numpy data type.
- class Graph(incoming_graph_data=None, **attr)[source]#
Bases:
networkx.Graph
Pydantic-compatible version of
networkx.Graph
.