Call the commands when_called block with _args_.
540589
def call(args = [])
      object, meth = @when_called[0, 2]
      meth ||= :call
      options = proxy_option_struct

      case object
      when Proc then object.call(args, options)
      when Class then meth != :call ? object.new.send(meth, args, options) : object.new(args, options)
      else object.send(meth, args, options) if object
      end
    end
103938
def on_complete(&block)
      on do |_, value, reason|
        block.call(reason == nil, value, reason)
      end
    end
1113109
def call(self, cmd, **kwargs):
        """"""
        if isinstance(cmd, basestring):
            cmd = cmd.split()
        self.log.info('Running %s', cmd)
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE, **kwargs)
        out, err = p.communicate()
        if out:
            self.log.info(out)
        if err:
            if p.returncode == 0:
                self.log.info(err)
            else:
                self.log.error(err)
        if p.returncode != 0:
            self.log.error('returncode = %d' % p.returncode)
            raise Exception
        return out, err, p.returncode
294688
def with(&block)
      raise ArgumentError.new("Must pass a block") unless block_given?
      case block.arity
        when 1
          yield self
        when 0
          instance_methods_eval(&block)
        else
          raise "block arity must be 0 or 1"
      end
    end
341987
def _on_select(self, *args):
        
        if callable(self.__callback):
            self.__callback(self.selection)
993961
def invoke(object, args, block, called_from)
      check_arity!(args.size)

      if base_object.is_a? Class
        result = if @plan
                   check_for_too_many_arguments!(@plan)
                   @plan.call(object, *args, &block)
                 end
      else
        result = if @plan
                   check_for_too_many_arguments!(@plan)
                   @plan.call(*args, &block)
                 end
      end
    ensure
      calls << CallLog.new(object, called_from, args, block, result)
    end
312341
def or_call(self, _callable, *args, **kwargs):
        
        if self._exception:
            _callable(*args, **kwargs)
1171962
def execute(cls, command, shell=True):
        
        cls.debug('execute command (shell flag:%r): %r ' % (shell, command))
        try:
            check_call(command, shell=shell)
            return True
        except CalledProcessError:
            return False
308064
def do_command(self):
        """"""
        method = self.args[0]

        raw_args = self.args[1:]
        if '=' in method:
            if raw_args:
                self.parser.error("Please don't mix rTorrent and shell argument styles!")
            method, raw_args = method.split('=', 1)
            raw_args = raw_args.split(',')

        self.execute(self.open(), method, self.cooked(raw_args))
385878
def do_help(self, arg):
        """"""
        if not arg or arg not in self.argparse_names():
            cmd.Cmd.do_help(self, arg)
        else:
            try:
                self.argparser.parse_args([arg, '--help'])
            except Exception:
                pass
354162
def on_success(&block)
      on do |_, value, reason|
        block.call(value) unless reason
      end
    end
826400
def call_command(self, cmd, *argv):
        
        parser = self.get_parser()
        args = [cmd] + list(argv)
        namespace = parser.parse_args(args)
        self.run_command(namespace)
319841
def dispatch(argdict):
    ''''''
    cmd = argdict['command']
    ftc = getattr(THIS_MODULE, 'do_'+cmd)
    ftc(argdict)
106643
def call(self, command, *args):
        

        if not command:
            return

        # Look for local methods first
        try:
            res = self.registered[command]['function'](self, *args)
            return Response('local', res, None)

        # Method not found, try remote
        except KeyError:

            # Execute remote command
            res, err = self.client.call(command, *args)
            return Response('remote', res, err, self.client.is_multi())

        # Local exception
        except Exception as e:
            return Response('local', res, str(e))
1257745
def user_call(self, frame, argument_list):
        """"""
        if self.stop_here(frame):
            pdb.Pdb.user_call(self, frame, argument_list)
663695
def caller(self, fun, **kwargs):
        '''
        
        '''
        self.client_cache['caller'].cmd(fun, *kwargs['arg'], **kwargs['kwarg'])
885088
def call(self, module, *args, **kwargs):
        '''
        
        '''

        module = self._resolver.load_module(module)
        if not hasattr(module, 'main'):
            raise CommandExecutionError('This module is not callable '
                                        '(see "ansible.help {0}")'.format(module.__name__.replace('ansible.modules.',
                                                                                                  '')))
        if args:
            kwargs['_raw_params'] = ' '.join(args)
        js_args = str('{{"ANSIBLE_MODULE_ARGS": {args}}}')  # future lint: disable=blacklisted-function
        js_args = js_args.format(args=salt.utils.json.dumps(kwargs))

        proc_out = salt.utils.timed_subprocess.TimedProc(
            ["echo", "{0}".format(js_args)],
            stdout=subprocess.PIPE, timeout=self.timeout)
        proc_out.run()
        proc_exc = salt.utils.timed_subprocess.TimedProc(
            ['python', module.__file__],
            stdin=proc_out.stdout, stdout=subprocess.PIPE, timeout=self.timeout)
        proc_exc.run()

        try:
            out = salt.utils.json.loads(proc_exc.stdout)
        except ValueError as ex:
            out = {'Error': (proc_exc.stderr and (proc_exc.stderr + '.') or six.text_type(ex))}
            if proc_exc.stdout:
                out['Given JSON output'] = proc_exc.stdout
            return out

        if 'invocation' in out:
            del out['invocation']

        out['timeout'] = self.timeout

        return out