Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use Lark with its cache feature, instead of creating a standalone parser#53

Merged
htorianik merged 6 commits into
amplify-education:masterfrom
erezsh:lark_cache
Jan 13, 2023
Merged

Use Lark with its cache feature, instead of creating a standalone parser#53
htorianik merged 6 commits into
amplify-education:masterfrom
erezsh:lark_cache

Conversation

@erezsh

@erezsh erezsh commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

The behavior and performance are the same, but the code is much shorter.

@aoskotsky-amplify aoskotsky-amplify left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks a lot for this PR! This cleans it up a lot.

I noticed tox was failing so committed some lint fixes. I left a couple of questions in the comments. Let me know what you think and we can merge this.

Comment thread test/unit/test_load.py Outdated
Comment thread hcl2/api.py
# This means that all blocks must end in a new line even if the file ends
# Append a new line as a temporary fix
return hcl2.parse(text + "\n")
return hcl2.parse(text + "\n") # type: ignore

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy was complaining that parse returns a Tree instead of a Dict. We can leave the ignore here but was curious why it does that.

@nyurik

nyurik commented May 5, 2021

Copy link
Copy Markdown

From dev-ops perspective, it would be great if python-hcl2 lib had no external dependencies. Lark is a fairly complex project to do a full security check on, thus reducing the usefulness of this amazing library. My (limited) understanding is that Lark can generate a custom python file for the specific grammar, making the Lark itself not required. Would it be possible to do that? Thanks!

See also #64

@htorianik htorianik requested a review from a team January 12, 2023 20:15
@rddimon rddimon dismissed aoskotsky-amplify’s stale review January 13, 2023 11:58

We added a comment with the explanation

@htorianik htorianik merged commit ac6d89f into amplify-education:master Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants