From c53217f98d37118daf9f8e6236c6722da1e3be28 Mon Sep 17 00:00:00 2001 From: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> Date: Tue, 7 Sep 2021 11:59:32 +0300 Subject: [PATCH] Add implementation plan --- tomli/_parser.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tomli/_parser.py b/tomli/_parser.py index f3a2bb9..615e53c 100644 --- a/tomli/_parser.py +++ b/tomli/_parser.py @@ -117,6 +117,9 @@ def loads(s: str, *, parse_float: ParseFloat = float) -> Dict[str, Any]: # noqa second_char: Optional[str] = src[pos + 1] except IndexError: second_char = None + # TODO: + # finalize_current_table(): + # make pending_explicit_nests of current table explicit_nests if second_char == "[": pos, header = create_list_rule(src, pos, out) else: @@ -342,10 +345,15 @@ def key_value_rule( key_parent, key_stem = key[:-1], key[-1] abs_key_parent = header + key_parent + # TODO: + # Check if any of the keys in the relative path is explicit_nest. + # Fail if yes if out.flags.is_(abs_key_parent, Flags.FROZEN): raise suffixed_err( src, pos, f"Can not mutate immutable namespace {abs_key_parent}" ) + # TODO: + # set pending_explicit_nest instead of explicit_nest here # Containers in the relative path can't be opened with the table syntax after this out.flags.set_for_relative_key(header, key, Flags.EXPLICIT_NEST) try: