# cattr.preconf package

## Submodules

## cattr.preconf.bson module

Preconfigured converters for bson.

class cattr.preconf.bson.BsonConverter(dict_factory=<class 'dict'>, unstruct_strat=UnstructureStrategy.AS_DICT, omit_if_default=False, forbid_extra_keys=False, type_overrides={}, unstruct_collection_overrides={}, prefer_attrib_converters=False, detailed_validation=True)

  Bases: `Converter`

  Parameters:

    - dict_factory (Callable[[], Any]) –

    - unstruct_strat (UnstructureStrategy) –

    - omit_if_default (bool) –

    - forbid_extra_keys (bool) –

    - type_overrides (Mapping[Type, AttributeOverride]) –

    - unstruct_collection_overrides (Mapping[Type, Callable]) –

    - prefer_attrib_converters (bool) –

    - detailed_validation (bool) –

  dumps(obj, unstructure_as=None, check_keys=False, codec_options=(<class 'dict'>, False, 3, 'strict', None, TypeRegistry(type_codecs=[], fallback_encoder=None)))
    Parameters:

      - obj (Any) –

      - check_keys (bool) –

      - codec_options (CodecOptions) –

    Return type:

      bytes

  forbid_extra_keys
  loads(data, cl, codec_options=(<class 'dict'>, False, 3, 'strict', None, TypeRegistry(type_codecs=[], fallback_encoder=None)))
    Parameters:

      - data (bytes) –

      - cl (Type[T]) –

      - codec_options (CodecOptions) –

    Return type:

      T

  omit_if_default
  type_overrides

cattr.preconf.bson.configure_converter(converter)

  Configure the converter for use with the bson library.

  - sets are serialized as lists

  - byte mapping keys are base85-encoded into strings when unstructuring, and reverse

  - non-string, non-byte mapping keys are coerced into strings when unstructuring

  - a deserialization hook is registered for bson.ObjectId by default

  Parameters:

    converter (BaseConverter) –

cattr.preconf.bson.make_converter(*args, **kwargs)
  Return type:

    BsonConverter

## cattr.preconf.json module

Preconfigured converters for the stdlib json.

class cattr.preconf.json.JsonConverter(dict_factory=<class 'dict'>, unstruct_strat=UnstructureStrategy.AS_DICT, omit_if_default=False, forbid_extra_keys=False, type_overrides={}, unstruct_collection_overrides={}, prefer_attrib_converters=False, detailed_validation=True)

  Bases: `Converter`

  Parameters:

    - dict_factory (Callable[[], Any]) –

    - unstruct_strat (UnstructureStrategy) –

    - omit_if_default (bool) –

    - forbid_extra_keys (bool) –

    - type_overrides (Mapping[Type, AttributeOverride]) –

    - unstruct_collection_overrides (Mapping[Type, Callable]) –

    - prefer_attrib_converters (bool) –

    - detailed_validation (bool) –

  dumps(obj, unstructure_as=None, **kwargs)
    Parameters:

      obj (Any) –

    Return type:

      str

  forbid_extra_keys
  loads(data, cl, **kwargs)
    Parameters:

      - data (bytes | str) –

      - cl (Type[T]) –

    Return type:

      T

  omit_if_default
  type_overrides

cattr.preconf.json.configure_converter(converter)

  Configure the converter for use with the stdlib json module.

  - bytes are serialized as base64 strings

  - datetimes are serialized as ISO 8601

  - counters are serialized as dicts

  - sets are serialized as lists

  Parameters:

    converter (BaseConverter) –

cattr.preconf.json.make_converter(*args, **kwargs)
  Return type:

    JsonConverter

## cattr.preconf.msgpack module

Preconfigured converters for msgpack.

class cattr.preconf.msgpack.MsgpackConverter(dict_factory=<class 'dict'>, unstruct_strat=UnstructureStrategy.AS_DICT, omit_if_default=False, forbid_extra_keys=False, type_overrides={}, unstruct_collection_overrides={}, prefer_attrib_converters=False, detailed_validation=True)

  Bases: `Converter`

  Parameters:

    - dict_factory (Callable[[], Any]) –

    - unstruct_strat (UnstructureStrategy) –

    - omit_if_default (bool) –

    - forbid_extra_keys (bool) –

    - type_overrides (Mapping[Type, AttributeOverride]) –

    - unstruct_collection_overrides (Mapping[Type, Callable]) –

    - prefer_attrib_converters (bool) –

    - detailed_validation (bool) –

  dumps(obj, unstructure_as=None, **kwargs)
    Parameters:

      obj (Any) –

    Return type:

      bytes

  forbid_extra_keys
  loads(data, cl, **kwargs)
    Parameters:

      - data (bytes) –

      - cl (Type[T]) –

    Return type:

      T

  omit_if_default
  type_overrides

cattr.preconf.msgpack.configure_converter(converter)

  Configure the converter for use with the msgpack library.

  - datetimes are serialized as timestamp floats

  - sets are serialized as lists

  Parameters:

    converter (BaseConverter) –

cattr.preconf.msgpack.make_converter(*args, **kwargs)
  Return type:

    MsgpackConverter

## cattr.preconf.orjson module

## cattr.preconf.pyyaml module

Preconfigured converters for pyyaml.

class cattr.preconf.pyyaml.PyyamlConverter(dict_factory=<class 'dict'>, unstruct_strat=UnstructureStrategy.AS_DICT, omit_if_default=False, forbid_extra_keys=False, type_overrides={}, unstruct_collection_overrides={}, prefer_attrib_converters=False, detailed_validation=True)

  Bases: `Converter`

  Parameters:

    - dict_factory (Callable[[], Any]) –

    - unstruct_strat (UnstructureStrategy) –

    - omit_if_default (bool) –

    - forbid_extra_keys (bool) –

    - type_overrides (Mapping[Type, AttributeOverride]) –

    - unstruct_collection_overrides (Mapping[Type, Callable]) –

    - prefer_attrib_converters (bool) –

    - detailed_validation (bool) –

  dumps(obj, unstructure_as=None, **kwargs)
    Parameters:

      obj (Any) –

    Return type:

      str

  forbid_extra_keys
  loads(data, cl)
    Parameters:

      - data (str) –

      - cl (Type[T]) –

    Return type:

      T

  omit_if_default
  type_overrides

cattr.preconf.pyyaml.configure_converter(converter)

  Configure the converter for use with the pyyaml library.

  - frozensets are serialized as lists

  - string enums are converted into strings explicitly

  Parameters:

    converter (BaseConverter) –

cattr.preconf.pyyaml.make_converter(*args, **kwargs)
  Return type:

    PyyamlConverter

## cattr.preconf.tomlkit module

Preconfigured converters for tomlkit.

class cattr.preconf.tomlkit.TomlkitConverter(dict_factory=<class 'dict'>, unstruct_strat=UnstructureStrategy.AS_DICT, omit_if_default=False, forbid_extra_keys=False, type_overrides={}, unstruct_collection_overrides={}, prefer_attrib_converters=False, detailed_validation=True)

  Bases: `Converter`

  Parameters:

    - dict_factory (Callable[[], Any]) –

    - unstruct_strat (UnstructureStrategy) –

    - omit_if_default (bool) –

    - forbid_extra_keys (bool) –

    - type_overrides (Mapping[Type, AttributeOverride]) –

    - unstruct_collection_overrides (Mapping[Type, Callable]) –

    - prefer_attrib_converters (bool) –

    - detailed_validation (bool) –

  dumps(obj, unstructure_as=None, **kwargs)
    Parameters:

      obj (Any) –

    Return type:

      str

  forbid_extra_keys
  loads(data, cl)
    Parameters:

      - data (str) –

      - cl (Type[T]) –

    Return type:

      T

  omit_if_default
  type_overrides

cattr.preconf.tomlkit.configure_converter(converter)

  Configure the converter for use with the tomlkit library.

  - bytes are serialized as base85 strings

  - sets are serialized as lists

  - tuples are serializas as lists

  - mapping keys are coerced into strings when unstructuring

  Parameters:

    converter (BaseConverter) –

cattr.preconf.tomlkit.make_converter(*args, **kwargs)
  Return type:

    TomlkitConverter

## cattr.preconf.ujson module

Preconfigured converters for ujson.

## Module contents

cattr.preconf.validate_datetime(v, _)