adaptix.integrations.msgspec package

Module contents

class adaptix.integrations.msgspec.ConvertParams

Bases: TypedDict

builtin_types: Iterable[type]
str_keys: bool
strict: bool
from_attributes: bool
dec_hook: Callable[[Any], Any]
class adaptix.integrations.msgspec.ToBuiltinsParams

Bases: TypedDict

builtin_types: Iterable[type]
str_keys: bool
enc_hook: Callable[[Any], Any]
adaptix.integrations.msgspec.native_msgspec(
*preds: str | Pattern | type | Any | LocStackChecker | LocStackPattern,
convert: ConvertParams | None = None,
to_builtins: ToBuiltinsParams | None = None,
) Provider

Provider that represents value via msgspec. You can use this function to validate or serialize msgspec structs via msgspec itself. Provider calls convert and to_builtins for a type to load and dump data.

Parameters:
  • preds – Predicates specifying where the provider should be used. The provider will be applied if any predicates meet the conditions, if no predicates are passed, the provider will be used for all Enums. See Predicate system for details.

  • convert – Dict directly unpacked to convert() function

  • to_builtins – Dict directly unpacked to to_builtins() function

Returns:

Desired provider