Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _dispatch_call(__data, *args, **kwargs):
# TODO: want to just create call, for now use hack of creating a symbolic
# call and getting the source off of it...
return strip_symbolic(create_sym_call(FuncArg(dispatch_func), __data, *args, **kwargs))
def _dispatch_symbol(__data, *args, **kwargs):
return create_sym_call(FuncArg(dispatch_func), strip_symbolic(__data), *args, **kwargs)
obj, *rest = node.args
args = tuple(self.enter_if_call(child) for child in rest)
kwargs = {k: self.enter_if_call(child) for k, child in node.kwargs.items()}
attr_chain, target = get_attr_chain(obj, max_n = 2)
if attr_chain:
# want _.x.method() -> method(_.x), need to transform
if attr_chain[0] in self.call_sub_attr:
# e.g. _.dt.round()
call_name = ".".join(attr_chain) if self.chain_sub_attr else attr_chain[-1]
entered_target = self.enter_if_call(target)
else:
call_name = attr_chain[-1]
entered_target = self.enter_if_call(obj.args[0])
elif isinstance(obj, FuncArg) and self.dispatch_cls is None:
# want function(_.x) -> new_function(_.x), has form
call_name = obj.obj_name()
# the first argument is basically "self"
entered_target, *args = args
else:
# default to generic enter
return self.generic_enter(node)
return self.create_local_call(
call_name, entered_target, node.__class__,
args, kwargs
)