-
-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for PR #1149 #1150
Fix for PR #1149 #1150
Conversation
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
lark/tree_templates.py
Outdated
template_var = self.test_var(template) | ||
if template_var: | ||
if not isinstance(tree, Tree): | ||
raise TypeError(f"Template variables can only match Tree instances. Not {tree}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be either type(tree)
or {tree!r}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
_TEMPLATE_MARKER = '$' | ||
|
||
|
||
class TemplateConf: | ||
"""Template Configuration | ||
|
||
Allows customization for different uses of Template | ||
|
||
parse() must return a Tree instance. | ||
""" | ||
|
||
def __init__(self, parse=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be annotated with Callable[[str], Tree]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but there's a lot of "could be" to add there. We can do that in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, fair enough. This should fix all the mypy errors
No description provided.