From 37e5f2b12bf1f05a475a004bf6fe9869cf66ad32 Mon Sep 17 00:00:00 2001 From: George Torianik Date: Fri, 13 Jan 2023 13:54:32 +0200 Subject: [PATCH] Add explanation why we ignore typing in api.py. --- hcl2/api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hcl2/api.py b/hcl2/api.py index cc43aa14..cbaaba55 100644 --- a/hcl2/api.py +++ b/hcl2/api.py @@ -15,4 +15,7 @@ def loads(text: str) -> dict: # Lark doesn't support a EOF token so our grammar can't look for "new line or end of file" # This means that all blocks must end in a new line even if the file ends # Append a new line as a temporary fix + # Ignoring type as the type-annotation of Lark.parse() claims that it always returns a Tree, + # but in the docs of the parse() said that it returns whatever the supplied transformer returns. + # We supply DictTransformer so the return type is Dict. return hcl2.parse(text + "\n") # type: ignore