Breaking on function with docstring
fccoelho opened this issue · 6 comments
fccoelho commented
I am getting the error below for the following function:
@latexify.function(use_math_symbols=True)
def model(t: float, y: list, params: dict) -> list:
"""
SIR Model.
:param t: time step
:param y: state of the model at time t
:param params: parameter dictionary
:return:
"""
S, I, R = y
beta, gamma, N = params['beta'], params['gamma'], params['N']
return [
-beta * S * I / N,
beta * S * I / N - gamma * I,
gamma * I
]
LatexifyNotSupportedError: Codegen supports only Assign nodes in multiline functions, but got: Expr
If I remove the docstring, it works as expected
odashi commented
@fccoelho
Thank you for reporting the issue!
Yes this is somewhat expected: the Expr
represents the docstring and we should ignore the first Expr
statement with string values in the codegen. Let me raise the bug level to "major".
soosub commented
Casper-Guo commented
cc:@LakeBlair
Maybe you can investigate this issue
LakeBlair commented
@odashi Hi! I can take a look at this issue and see if I can find a solution to it.
odashi commented
Hi @LakeBlair , feel free to propose a pull request for this issue.