|
33 | 33 | (ld_dict.is_ld_dict, dict(ld_container=ld_dict)), |
34 | 34 |
|
35 | 35 | # Expand and access JSON data |
36 | | - (ld_container.is_json_id, dict(python=lambda c: c["@id"], expanded_json=lambda c, **_: [c])), |
| 36 | + (ld_container.is_json_id, dict(python=lambda c, **_: c["@id"], expanded_json=lambda c, **_: [c])), |
37 | 37 | (ld_container.is_typed_json_value, dict(python=ld_container.typed_ld_to_py)), |
38 | 38 | (ld_container.is_json_value, dict(python=lambda c, **_: c["@value"], expanded_json=lambda c, **_: [c])), |
39 | 39 | (ld_list.is_container, dict(ld_container=lambda c, **kw: ld_list([c], **kw))), |
| 40 | + |
| 41 | + # FIXME: add conversion from list and json dict to expanded_json |
| 42 | + # to parse nested dicts and lists when using for example __setitem__(key, value) from ld_dict |
| 43 | + # where value is converted to expanded_json bevor adding it to data_dict |
| 44 | + # Suggested: |
| 45 | + # ( |
| 46 | + # ld_dict.is_json_dict, |
| 47 | + # { |
| 48 | + # "ld_container": ld_dict.from_dict, |
| 49 | + # "expanded_json": lambda c, **kw: kw["parent"]._to_expanded_json(kw["key"], ld_dict.from_dict(c, **kw)) |
| 50 | + # } |
| 51 | + # ), |
| 52 | + # |
| 53 | + # ( |
| 54 | + # lambda c: isinstance(c, list), |
| 55 | + # { |
| 56 | + # "ld_container": ld_list.from_list, |
| 57 | + # "expanded_json": lambda c, **kw: kw["parent"]._to_expanded_json(kw["key"], ld_list.from_list(c, **kw)) |
| 58 | + # } |
| 59 | + # ), |
40 | 60 | (ld_dict.is_json_dict, dict(ld_container=ld_dict.from_dict)), |
41 | 61 |
|
42 | 62 | (lambda c: isinstance(c, list), dict(ld_container=ld_list.from_list)), |
|
0 commit comments