Skip to content

Commit f095a74

Browse files
committed
Made some changes to visit_call. I know its wrong but adding this commit to test out normally with floor(1) + floor(2)
1 parent a0c4e2b commit f095a74

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

pandas/core/computation/expr.py

+22-7
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,15 @@ def visit_Call(self, node, side=None, **kwargs):
659659
raise ValueError(f"Invalid function call {node.func.id}")
660660
if hasattr(res, "value"):
661661
res = res.value
662-
663-
if isinstance(res, FuncNode):
664-
665-
new_args = [self.visit(arg) for arg in node.args]
666-
662+
print(type(res))
663+
if isinstance(res, FuncNode) or isinstance(res, np.ufunc):
664+
# new_args = [self.visit(arg) for arg in node.args]
665+
new_args = []
666+
for arg in node.args:
667+
temp_visit = self.visit(arg)
668+
if hasattr(temp_visit, "value"):
669+
temp_visit = temp_visit.value
670+
new_args.append(temp_visit)
667671
if node.keywords:
668672
raise TypeError(
669673
f'Function "{res.name}" does not support keyword arguments'
@@ -672,9 +676,20 @@ def visit_Call(self, node, side=None, **kwargs):
672676
return res(*new_args)
673677

674678
else:
675-
679+
import logging, sys
680+
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
681+
logging.debug(str(self.visit(arg).value for arg in node.args))
682+
logging.debug(ast.dump(node))
683+
# for arg in node.args:
684+
# logging.debug("this is the next arg")
685+
# logging.debug(arg)
686+
# logging.debug(self.visit(arg).value)
687+
print([self.visit(arg) for arg in node.args])
688+
689+
print([self.visit(arg).value for arg in node.args])
676690
new_args = [self.visit(arg).value for arg in node.args]
677-
691+
# import copy
692+
# new_args = copy.deepcopy(node.args)
678693
for key in node.keywords:
679694
if not isinstance(key, ast.keyword):
680695
raise ValueError(f"keyword error in function call '{node.func.id}'")

0 commit comments

Comments
 (0)