You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are preconfigured converters for the various serialization formats, but I have found need for a converter specific to what I will call "plain" Python.
Basically:
PassThroughTypes: TypeAlias=str|bool|int|float|bytes|Nonedefpython_make_converter(
*args: Any,
**kwargs: Any,
) ->PythonConverter:
# configure specific overrides for this converterkwargs["unstruct_collection_overrides"] = {
# rich built-in types are maintained, rather than all dumped# into listsSequence: tuple,
MutableSequence: list,
Set: frozenset,
MutableSet: set,
Counter: lambdac: Counter(**{k: vfork, vinc}),
}
converter=PythonConverter(*args, **kwargs)
# passthrough union typesconfigure_union_passthrough(PassThroughTypes, converter)
returnconverter
Just some context for what I am doing that warranted making this concrete versus the more plain cattrs.global_converter. I am using the converter to generate "patches" that all happens within Python and the above to be very useful.
I would propose that a new preconfigured converter be made similar to the others. But I can understand it not being high priority, in which case this issue may help someone else :)
The text was updated successfully, but these errors were encountered:
There are preconfigured converters for the various serialization formats, but I have found need for a converter specific to what I will call "plain" Python.
Basically:
Just some context for what I am doing that warranted making this concrete versus the more plain
cattrs.global_converter
. I am using the converter to generate "patches" that all happens within Python and the above to be very useful.I would propose that a new preconfigured converter be made similar to the others. But I can understand it not being high priority, in which case this issue may help someone else :)
The text was updated successfully, but these errors were encountered: