Skip to content

Commit

Permalink
Use customized unparser instead of ast.unparse
Browse files Browse the repository at this point in the history
  • Loading branch information
yunline committed Nov 30, 2024
1 parent e05f397 commit a5316ce
Show file tree
Hide file tree
Showing 2 changed files with 520 additions and 1 deletion.
3 changes: 2 additions & 1 deletion oneliner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from oneliner.convert import OnelinerConvertor
from oneliner.expr_unparse import unparse

__all__ = ["OnelinerConvertor", "convert_code_string"]

Expand All @@ -10,4 +11,4 @@ def convert_code_string(code: str, filename="<string>"):
ast_root = ast.parse(code, filename, "exec")
symtable_root = symtable.symtable(code, filename, "exec")
out = OnelinerConvertor().cvt(ast_root, symtable_root)
return ast.unparse(out).replace("\n", "")
return unparse(out)
Loading

0 comments on commit a5316ce

Please sign in to comment.