Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[settings]
known_third_party = ConfigSpace,aif360,astunparse,autoai_libs,black,graphviz,h5py,hyperopt,imblearn,jsonschema,jsonsubschema,lightgbm,numpy,pandas,pytest,pytorch_pretrained_bert,scipy,setuptools,sklearn,smac,spacy,sphinx_rtd_theme,tensorflow,tensorflow_hub,torch,torchvision,xgboost
known_third_party = ConfigSpace,aif360,autoai_libs,black,graphviz,h5py,hyperopt,imblearn,jsonschema,jsonsubschema,lightgbm,numpy,pandas,pytest,pytorch_pretrained_bert,scipy,setuptools,sklearn,smac,spacy,sphinx_rtd_theme,tensorflow,tensorflow_hub,torch,torchvision,xgboost
profile = black
12 changes: 5 additions & 7 deletions lale/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
from copy import deepcopy
from typing import Any, Dict, Literal, Optional, Union, overload

import astunparse

AstLits = (ast.Num, ast.Str, ast.List, ast.Tuple, ast.Set, ast.Dict, ast.Constant)
AstLit = Union[ast.Num, ast.Str, ast.List, ast.Tuple, ast.Set, ast.Dict, ast.Constant]
AstExprs = (
Expand Down Expand Up @@ -229,7 +227,7 @@ def __ne__(self, other):
return False

def __str__(self) -> str:
result = astunparse.unparse(self._expr).strip()
result = ast.unparse(self._expr).strip()
if isinstance(self._expr, (ast.UnaryOp, ast.BinOp, ast.Compare, ast.BoolOp)):
if result.startswith("(") and result.endswith(")"):
result = result[1:-1]
Expand Down Expand Up @@ -585,7 +583,7 @@ def _it_column(expr):
return expr.attr
else:
raise ValueError(
f"Illegal {astunparse.unparse(expr)}. Only the access to `it` is supported"
f"Illegal {ast.unparse(expr)}. Only the access to `it` is supported"
)
elif isinstance(expr, ast.Subscript):
if isinstance(expr.slice, ast.Constant) or (
Expand All @@ -600,15 +598,15 @@ def _it_column(expr):
return v.s
else:
raise ValueError(
f"Illegal {astunparse.unparse(expr)}. Only the access to `it` is supported"
f"Illegal {ast.unparse(expr)}. Only the access to `it` is supported"
)
else:
raise ValueError(
f"Illegal {astunparse.unparse(expr)}. Only the access to `it` is supported"
f"Illegal {ast.unparse(expr)}. Only the access to `it` is supported"
)
else:
raise ValueError(
f"Illegal {astunparse.unparse(expr)}. Only the access to `it` is supported"
f"Illegal {ast.unparse(expr)}. Only the access to `it` is supported"
)


Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"pandas",
"packaging",
"decorator",
"astunparse",
"typing-extensions",
]

Expand Down
4 changes: 2 additions & 2 deletions test/test_core_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def test_transformers(self):

class TestUnparseExpr(unittest.TestCase):
def test_unparse_const38(self):
import astunparse
import ast

from lale.expressions import it

test_expr = it.hello["hi"]
str(astunparse.unparse(test_expr._expr))
str(ast.unparse(test_expr._expr))


class TestOperatorWithoutSchema(unittest.TestCase):
Expand Down
Loading