Closed mileslucas closed 5 years ago
Update allowing deeply nisted dicts and other iterables in FlatterDict (#21 solved).
Simple example:
>>> a = [[1, 2], [3, 4]] >>> d = FlatterDict({'a': a}) >>> print(d) { 'a:0:0': 1, 'a:0:1': 2, 'a:1:0': 3, 'a:1:1': 4 } >>> print(d.as_dict()) { 'a': [[1, 2], [3, 4]] }
Similaraly
>>> a = [{'a': 1, 'b':2}] >>> d = FlatterDict({'a': a}) >>> print(d) { 'a:0:a': 1, 'a:0:b': 2 } >>> print(d.as_dict()) { 'a': [{ 'a': 1, 'b': 2 }] }
(Above printing may not be doctest ready but the underlying logic should still stand).
As before I've formatted everything with YAPF and made sure to keep maximal coverage (99%).
I left this under version 3.1.1 to make that patch a little more substantial.
3.1.1
Going to drop 3.2.0 unless you have any other PRs pending
I have one more pending to fix the setting and updating of the nested dicts/iterables!
Update allowing deeply nisted dicts and other iterables in FlatterDict (#21 solved).
Simple example:
Similaraly
(Above printing may not be doctest ready but the underlying logic should still stand).
As before I've formatted everything with YAPF and made sure to keep maximal coverage (99%).
I left this under version
3.1.1
to make that patch a little more substantial.