Skip to content

Commit

Permalink
支持解析嵌套函数块中的表达式
Browse files Browse the repository at this point in the history
  • Loading branch information
wukan1986 committed Dec 30, 2024
1 parent 269877c commit 41b8a37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion expr_codegen/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.10.8"
__version__ = "0.10.9"
4 changes: 4 additions & 0 deletions expr_codegen/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
from ast import expr

from black import Mode, format_str
from sympy import Add, Mul, Pow, Eq, Not, Xor

from expr_codegen.expr import register_symbols, dict_to_exprs
Expand Down Expand Up @@ -316,6 +317,9 @@ def source_replace(source: str) -> str:
# break
# 或、与
source = source.replace('||', '|').replace('&&', '&')
# IndentationError: unexpected indent
# 嵌套函数前有空格,会报错
source = format_str(source, mode=Mode(line_length=600, magic_trailing_comma=True))
return source


Expand Down

0 comments on commit 41b8a37

Please sign in to comment.