Skip to content

Commit

Permalink
Add explanation why we ignore typing in api.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
htorianik-amplify committed Jan 13, 2023
1 parent b31d9ec commit 37e5f2b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hcl2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 37e5f2b

Please sign in to comment.