aries_cloudagent.messaging.models package

Submodules

aries_cloudagent.messaging.models.base module

Base classes for Models and Schemas.

class aries_cloudagent.messaging.models.base.BaseModel[source]

Bases: abc.ABC

Base model that provides convenience methods.

class Meta[source]

Bases: object

BaseModel meta data.

schema_class = None
Schema

Accessor for the model’s schema class.

Returns:The schema class
classmethod deserialize(obj)[source]

Convert from JSON representation to a model instance.

Parameters:obj – The dict to load into a model instance
Returns:A model instance for this data
classmethod from_json(json_repr: Union[str, bytes])[source]

Parse a JSON string into a model instance.

Parameters:json_repr – JSON string
Returns:A model instance representation of this JSON
serialize(as_string=False) → dict[source]

Create a JSON-compatible dict representation of the model instance.

Parameters:as_string – Return a string of JSON instead of a dict
Returns:A dict representation of this model, or a JSON string if as_string is True
to_json() → str[source]

Create a JSON representation of the model instance.

Returns:A JSON representation of this message
exception aries_cloudagent.messaging.models.base.BaseModelError(*args, error_code: str = None, **kwargs)[source]

Bases: aries_cloudagent.error.BaseError

Base exception class for base model errors.

class aries_cloudagent.messaging.models.base.BaseModelSchema(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

BaseModel schema.

class Meta[source]

Bases: object

BaseModelSchema metadata.

model_class = None
ordered = True
skip_values = [None]
Model

Accessor for the schema’s model class.

Returns:The model class
make_model(data: dict)[source]

Return model instance after loading.

Returns:A model instance
remove_skipped_values(data)[source]

Remove values that are are marked to skip.

Returns:Returns this modified data
skip_dump_only(data)[source]

Skip fields that are only expected during serialization.

Parameters:data – The incoming data to clean
Returns:The modified data
aries_cloudagent.messaging.models.base.resolve_class(the_cls, relative_cls: type = None)[source]

Resolve a class.

Parameters:
  • the_cls – The class to resolve
  • relative_cls – Relative class to resolve from
Returns:

The resolved class

Raises:

ClassNotFoundError – If the class could not be loaded

aries_cloudagent.messaging.models.base.resolve_meta_property(obj, prop_name: str, defval=None)[source]

Resolve a meta property.

Parameters:
  • prop_name – The property to resolve
  • defval – The default value
Returns:

The meta property