Assign expected call args/kwargs to this call.

        Returns `self` for the common case of chaining a call to `Call.returns`

        >>> Call().passing('foo', bar='baz')
        <Call args=('foo',) kwargs={'bar': 'baz'}>
963562
def passing(self, *args, **kwargs):
        
        self.args = args
        self.kwargs = kwargs
        return self
866253
def with_args(self, *args, **kwargs):
        

        self.args = args
        self.kwargs = kwargs
        self.verify_arguments()
        return self
690525
def called_with(self, *args, **kwargs):
        
        self._args = args
        self._kwargs = kwargs
        self._call_subject = True
        return CallableInspector(self)
941016
def view_call(method_name, *args, **kwargs):
    

    def view_call(_value, context, **_params):
        method = getattr(context["view"], method_name)
        return _call(method, args, kwargs)

    return view_call
372379
def _get_parser_call_method(self, parser_to_method):
        
        def inner_call(args=None, instance=None):
            """Allows to call the method invoked from the command line or
            provided argument.

            Args:
                args: list of arguments to parse, defaults to command line
                arguments
                instance: an instance of the decorated class. If instance is
                None, the default, and __init__ is decorated the object will be
                instantiated on the fly from the command line arguments
            """
            parser = self._cls.parser
            namespace = parser.parse_args(_get_args_to_parse(args, sys.argv))
            if instance is None:
                # If the __init__ method is not part of the method to
                # decorate we cannot instantiate the class
                if "__init__" not in parser_to_method:
                    raise ParseThisError(("'__init__' method is not decorated. "
                                          "Please provide an instance to "
                                          "'{}.parser.call' or decorate the "
                                          "'__init___' method with "
                                          "'create_parser'"
                                          .format(self._cls.__name__)))
                # We instantiate the class from the command line arguments
                instance = _call_method_from_namespace(self._cls, "__init__",
                                                       namespace)
            method_name = parser_to_method[namespace.method]
            return _call_method_from_namespace(instance, method_name, namespace)
        return inner_call
656503
def call(method, *args)
      ok, param = call2(method, *args) 
      if ok
        param
      else
        raise param
      end
    end
620764
def call(self, op, args):
        
        converted = self.convert_list(args)
        return self._call(op, converted)
639940
def add_arg_scope(func):
  
  @functools.wraps(func)
  def func_with_args(*args, **kwargs):
    current_scope = _current_arg_scope()
    current_args = kwargs
    key_func = (func.__module__, func.__name__)
    if key_func in current_scope:
      current_args = current_scope[key_func].copy()
      current_args.update(kwargs)
    return func(*args, **current_args)
  _add_op(func)
  return func_with_args
1039369
def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
      new_chain = InvocationChain.append(self, invocation_chain)
      @lock.synchronize do
        if application.options.trace
          application.trace "** Invoke #{name} #{format_trace_flags}"
        end
        return if @already_invoked
        @already_invoked = true
        invoke_prerequisites(task_args, new_chain)
        execute(task_args) if needed?
      end
    rescue Exception => ex
      add_chain_to(ex, new_chain)
      raise ex
    end
878248
def call_with_asked_args(callback, args):
    
    # FIXME: support default args
    # FIXME: support kwargs
    # co_varnames contains both args and local variables, in order. 
    # We only pick the local variables
    asked_arg_names = callback.__code__.co_varnames[:callback.__code__.co_argcount]
    asked_arg_values = []
    missing_args = []
    for asked_arg_name in asked_arg_names:
        if asked_arg_name in args:
            asked_arg_values.append(args[asked_arg_name])
        else:
            missing_args.append(asked_arg_name)
    if missing_args:
        raise TypeError(
            '{}() missing required positional argument: {}'.format(
                callback.__code__.co_name,
                ', '.join(missing_args)
            )
        )
    return callback(*asked_arg_values)
774473
def use_kwargs(self, *args, **kwargs) -> typing.Callable:
        
        return super().use_kwargs(*args, **kwargs)
1029981
def visit_Call(self, node: ast.Call) -> Any:
        """"""
        func = self.visit(node=node.func)

        args = []  # type: List[Any]
        for arg_node in node.args:
            if isinstance(arg_node, ast.Starred):
                args.extend(self.visit(node=arg_node))
            else:
                args.append(self.visit(node=arg_node))

        kwargs = dict()  # type: Dict[str, Any]
        for keyword in node.keywords:
            if keyword.arg is None:
                kw = self.visit(node=keyword.value)
                for key, val in kw.items():
                    kwargs[key] = val

            else:
                kwargs[keyword.arg] = self.visit(node=keyword.value)

        result = func(*args, **kwargs)

        self.recomputed_values[node] = result
        return result
239076
def called_with(self, *args, **kwargs):
        
        expected_call = Call(*args, **kwargs)
        if expected_call in calls(self.spy):
            return True
        raise VerificationError(
            "expected %s to be called with %s, but it wasn't" % (
                self.spy, expected_call.formatted_args))
1026193
def call(__self, __context, __obj, *args, **kwargs):
        """"""
        # the double prefixes are to avoid double keyword argument
        # errors when proxying the call.
        if not __self.is_safe_callable(__obj):
            raise SecurityError('%r is not safely callable' % (__obj,))
        return __context.call(__obj, *args, **kwargs)
202950
def self_if_parameters(func):
    
    @wraps(func)
    def wrapper(self, *args, **kwargs):
        result = func(self, *args, **kwargs)
        if args or kwargs:
            return self
        else:
            return result
    return wrapper
738199
def call(self, command, *args):
        
        if isinstance(self.c, dict):
            return self._call_multi(self.c, command, *args)
        return self._call_single(self.c, command, *args)
121085
def _call_command(self, name, *args, **kwargs):
        
        obj = getattr(self, '_instance', self)  # _instance if a field, self if an instance

        # The object may not be already connected, so if we want to update a
        # field, connect it before.
        # If the object as no PK yet, let the object create itself
        if name in self.available_modifiers and obj._pk and not obj.connected:
            obj.connect()

        # Give priority to a "_call_{commmand}" method
        meth = getattr(self, '_call_%s' % name, self._traverse_command)
        return meth(name, *args, **kwargs)