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
For a thing at work, I implemented some [un]structure hook factories that wrap make_dict_structure_fn and make_dict_unstructure_fn to support flattening an attribute, like this:
@defineclassA:
a: intb: int@defineclassC:
a: Ac: intconverter= ... # set up a converter with my wrappersassertconverter.unstructure(C(A(1, 2), 3)) == {'a': 1, 'b': 2, 'c': 3}
I'd like to upstream this support. The basic idea is to implement functionality similar to Serde's Struct flattening by extending the override function to take a flatten: bool argument that defaults to False and then adjusting make_dict_structure_fn and make_dict_unstructure_fn to use it.
I'm willing to work on this, but wanted to get feedback from folks here before I start.
The text was updated successfully, but these errors were encountered:
For a thing at work, I implemented some [un]structure hook factories that wrap
make_dict_structure_fn
andmake_dict_unstructure_fn
to support flattening an attribute, like this:I'd like to upstream this support. The basic idea is to implement functionality similar to Serde's Struct flattening by extending the
override
function to take aflatten: bool
argument that defaults toFalse
and then adjustingmake_dict_structure_fn
andmake_dict_unstructure_fn
to use it.I'm willing to work on this, but wanted to get feedback from folks here before I start.
The text was updated successfully, but these errors were encountered: