Registry

class statey.registry.Registry

A type registry is used to parse annotations into types

abstract get_caster(from_type: statey.syms.types.Type, to_type: statey.syms.types.Type) → Object

Get a caster given from_type and to_type

abstract get_differ(type: statey.syms.types.Type) → Differ

Given a type, get a differ instance to diff the data

abstract get_encoder(type: statey.syms.types.Type, serializable: bool = False) → Encoder

Given a type, return an Encoder instance to encode the type, raising an exc.NoEncoderFound to indicate failure

abstract get_impl_serializer(impl: ObjectImplementation, type: statey.syms.types.Type) → ObjectImplementationSerializer

Get an object implementation serializer for the given implementation and type

abstract get_impl_serializer_from_data(data: Any) → ObjectImplementationSerializer

Get an object implementation serializer from the given data

abstract get_methods(type: statey.syms.types.Type) → ObjectMethods

Get ObjectMethods for the given type

abstract get_namespace_serializer(ns: Namespace) → NamespaceSerializer

Get a namespace serializer for the given namespace

abstract get_namespace_serializer_from_data(data: Any) → NamespaceSerializer

Get a namespace serializer from the given data

abstract get_object(value: Any) → Object

Get a statey object given a value

abstract get_object_serializer(obj: Object) → ObjectSerializer

Get an object serializer for the given object

abstract get_object_serializer_from_data(data: Any) → ObjectSerializer

Get an object serializer from the given data

abstract get_plugin_installer(name: str) → PluginInstaller

Get a plugin installer for a given plugin name

abstract get_provider(name: str, params: Optional[Dict[str, Any]] = None) → Provider

Get a provider with the given name and params

abstract get_semantics(type: statey.syms.types.Type) → Semantics

Given a type, get the semantics to use for objects of that type.

abstract get_session_serializer(session: Session) → SessionSerializer

Get a session serializer for the given session

abstract get_session_serializer_from_data(data: Any) → SessionSerializer

Get a session serializer from the given data

abstract get_state_manager() → StateManager

Get a state manager to use for the current module

abstract get_type(annotation: Any, meta: Optional[Dict[str, Any]] = None) → statey.syms.types.Type

Parse the given annotation and return a Type. This will properly handle dataclasses similarly to how case classes are handled in spark encoding

abstract get_type_serializer(type: statey.syms.types.Type) → TypeSerializer

Given a type, get the type serializer to turn it into a JSON-serializable value.

abstract get_type_serializer_from_data(data: Any) → TypeSerializer

Given serialized data, get a type serializer that can decode the serialized type of into a native Type

abstract infer_type(obj: Any) → statey.syms.types.Type

Attempt to infer the type of obj, falling back on Any

object(*args, **kwargs) → Object

Create an object bound to this registry

abstract register(plugin: Any) → None

Register a plugin within this registry

class statey.registry.HookBasedRegistry

Registry based on pluggy hooks