great_expectations.marshmallow__shade.class_registry

A registry of Schema classes. This allows for string lookup of schemas, which may be used with class:fields.Nested <marshmallow.fields.Nested>.

Warning

This module is treated as private API. Users should not need to use this module directly.

Module Contents

Functions

register(classname: str, cls: SchemaType)

Add a class to the registry of serializer classes. When a class is

get_class(classname: str, all: bool = False)

Retrieve a class from the registry.

great_expectations.marshmallow__shade.class_registry.SchemaType
great_expectations.marshmallow__shade.class_registry._registry :typing.Dict[str, typing.List['SchemaType']]
great_expectations.marshmallow__shade.class_registry.register(classname: str, cls: SchemaType) → None

Add a class to the registry of serializer classes. When a class is registered, an entry for both its classname and its full, module-qualified path are added to the registry.

Example:

class MyClass:
    pass

register('MyClass', MyClass)
# Registry:
# {
#   'MyClass': [path.to.MyClass],
#   'path.to.MyClass': [path.to.MyClass],
# }
great_expectations.marshmallow__shade.class_registry.get_class(classname: str, all: bool = False) → typing.Union[typing.List['SchemaType'], 'SchemaType']

Retrieve a class from the registry.

Raises

marshmallow.exceptions.RegistryError if the class cannot be found or if there are multiple entries for the given class name.