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

Function docstring and reduce_assignments enabled does not play nice #196

Closed
ckming102 opened this issue Dec 2, 2023 · 2 comments · Fixed by #197
Closed

Function docstring and reduce_assignments enabled does not play nice #196

ckming102 opened this issue Dec 2, 2023 · 2 comments · Fixed by #197
Assignees

Comments

@ckming102
Copy link

Environment

  • OS: Windows10
  • Python: 3.10.8
  • Latexify version: 0.4.1

Description

Enabling assignment reductions with a function docstring gives LatexifyNotSupportedError.

Reproduction

Running

@latexify.function(
    reduce_assignments=True,
)
def f(x):
    """doc string"""
    y = x + 1
    return 2 * y

f

gives LatexifyNotSupportedError: AssignmentReducer supports only Assign nodes, but got: Expr

Expected behavior

$$ f(x) = 2 \mathopen{}\left( x + 1 \mathclose{}\right) $$

@odashi
Copy link
Collaborator

odashi commented Dec 2, 2023

Thanks! It looks we need a specific conditioning to ignore docstrings from this processing.

@ckming102
Copy link
Author

sugoi !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants