Skip to content
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

Added support for returning Inline in transformers (Issue #763) #765

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

erezsh
Copy link
Member

@erezsh erezsh commented Nov 17, 2020

No description provided.

@erezsh erezsh requested a review from MegaIng November 17, 2020 22:40
Copy link
Member

@MegaIng MegaIng left a comment

Choose a reason for hiding this comment

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

Left a few comments.

res = self._call_userfunc_token(c)
else:
res = c
if type(res) is Inline:
Copy link
Member

Choose a reason for hiding this comment

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

bad style: isinstance should be used.


def a(self, children):
return Inline('c', 'd')

Copy link
Member

Choose a reason for hiding this comment

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

Adding a test to test for a Token would be nice just in case we somehow break that in the future.

@@ -15,9 +15,16 @@ class Discard(Exception):
"""
pass

# Transformers
class Inline(object):
"""When returning an Inline instance in a transformer callback,
Copy link
Member

Choose a reason for hiding this comment

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

Question: Will this make sure that it is added to the docs?

Anyway, an example would be nice, as well as pointing out to use it Inline(a, b, c) and not Inline((a,b,c)).

And it should be added to the stubs.

@MegaIng
Copy link
Member

MegaIng commented Nov 17, 2020

And this PR is certainly not complete as can be seen from comments on #763. (e.g. still missing for the transformer parameter. That should also be in the tests.

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.

2 participants