Send an already packed command to the Redis server
14862
async def send_packed_command(self, command):
        ""
        if not self._writer:
            await self.connect()
        try:
            if isinstance(command, str):
                command = [command]
            self._writer.writelines(command)
        except asyncio.futures.TimeoutError:
            self.disconnect()
            raise TimeoutError("Timeout writing to socket")
        except Exception:
            e = sys.exc_info()[1]
            self.disconnect()
            if len(e.args) == 1:
                errno, errmsg = 'UNKNOWN', e.args[0]
            else:
                errno = e.args[0]
                errmsg = e.args[1]
            raise ConnectionError("Error %s while writing to socket. %s." %
                                  (errno, errmsg))
        except:
            self.disconnect()
            raise
1324224
def execute_script(self, name, keys, *args, **options):
        '''
        '''
        script = get_script(name)
        if not script:
            raise redis.RedisError('No such script "%s"' % name)
        address = self.address()
        if address not in all_loaded_scripts:
            all_loaded_scripts[address] = set()
        loaded = all_loaded_scripts[address]
        toload = script.required_scripts.difference(loaded)
        for name in toload:
            s = get_script(name)
            yield self.script_load(s.script)
        loaded.update(toload)
        yield script(self, keys, args, options)
1095838
def sendcmd(self, cmd='AT', timeout=1.0):
        """"""
        import time
        if self.write(cmd):
            while self.get_response() == '' and timeout > 0:
                time.sleep(0.1)
                timeout -= 0.1
        return self.get_lines()
42574
protected void safeMulti(CommandOutput<?, ?, ?> output, int count, RedisCommand<?, ?, ?> command) {

        try {
            output.multi(count);
        } catch (Exception e) {
            command.completeExceptionally(e);
        }
    }
1286900
def write(obj, data=None, **kwargs):
    
    if obj.REDIS_ENABLED_FOR_DYNACONF is False:
        raise RuntimeError(
            "Redis is not configured \n"
            "export REDIS_ENABLED_FOR_DYNACONF=true\n"
            "and configure the REDIS_FOR_DYNACONF_* variables"
        )
    client = StrictRedis(**obj.REDIS_FOR_DYNACONF)
    holder = obj.get("ENVVAR_PREFIX_FOR_DYNACONF")
    data = data or {}
    data.update(kwargs)
    if not data:
        raise AttributeError("Data must be provided")
    redis_data = {
        key.upper(): unparse_conf_data(value) for key, value in data.items()
    }
    client.hmset(holder.upper(), redis_data)
    load(obj)
1285666
def send(self, load, tries=3, timeout=60, raw=False):
        '''
        
        '''
        if self.crypt == 'clear':
            ret = yield self._uncrypted_transfer(load, tries=tries, timeout=timeout)
        else:
            ret = yield self._crypted_transfer(load, tries=tries, timeout=timeout, raw=raw)
        raise tornado.gen.Return(ret)
1332908
def do_reload(bot, target, cmdargs, server_send=None):
    

    def send(msg):
        if server_send is not None:
            server_send("%s\n" % msg)
        else:
            do_log(bot.connection, bot.get_target(target), msg)

    confdir = bot.handler.confdir

    if cmdargs == 'pull':
        # Permission checks.
        if isinstance(target, irc.client.Event) and target.source.nick != bot.config['auth']['owner']:
            bot.connection.privmsg(bot.get_target(target), "Nope, not gonna do it.")
            return
        if exists(join(confdir, '.git')):
            send(misc.do_pull(srcdir=confdir))
        else:
            send(misc.do_pull(repo=bot.config['api']['githubrepo']))
    # Reload config
    importlib.reload(config)
    bot.config = config.load_config(join(confdir, 'config.cfg'), send)
    # Reimport helpers
    errored_helpers = modutils.scan_and_reimport('helpers')
    if errored_helpers:
        send("Failed to load some helpers.")
        for error in errored_helpers:
            send("%s: %s" % error)
        return False
    if not load_modules(bot.config, confdir, send):
        return False

    # preserve data
    data = bot.handler.get_data()
    bot.shutdown_mp()
    bot.handler = handler.BotHandler(bot.config, bot.connection, bot.channels, confdir)
    bot.handler.set_data(data)
    bot.handler.connection = bot.connection
    bot.handler.channels = bot.channels
    return True
688547
def _sendDDEcommand(self, cmd, timeout=None):
        """"""
        reply = self.conversation.Request(cmd, timeout)
        if self.pyver > 2:
            reply = reply.decode('ascii').rstrip()
        return reply
360659
def method_missing(meth, *args, &block)
      if !loaded?
        self.loaded = true
        reload
        send(meth, *args, &block)
      else
        super
      end
    end
541774
def dump(self, name):
        
        with self.pipe as pipe:
            return pipe.dump(self.redis_key(name))
173607
def _send(self, command):
        
        command = command.encode('utf-8')
        log.debug('>> ' + command)
        self.conn.oqueue.put(command)
732882
def start
      puts "== Connected to #{redis.client.id}"
      puts "== Waiting for commands from `#{options[:queue]}`"
      
      if options[:daemon]
        puts "== Daemonizing..."
        Daemons.daemonize
      end
      
      loop do
        begin 
          cid = redis.blpop(options[:queue], 10)[1]
          if cmd = commands[cid.to_s]
            puts "\e[33m[#{Time.now}]\e[0m Reacting for `#{cid}` command"
            threads.add(Thread.new { system(cmd) })
          end
        rescue Interrupt, SystemExit
          puts "\nCleaning up..."
          return 0
        rescue => ex
          puts "ERROR: #{ex}"
        end
      end
    end
1321875
def send(self, command, reps=REPS, wait=MIN_WAIT):
        
        # Enqueue the command.
        self._command_queue.put((command, reps, wait))
        # Wait before accepting another command.
        # This keeps individual groups relatively synchronized.
        sleep = reps * wait * self.active
        if command.select and self._selected_number != command.group_number:
            sleep += SELECT_WAIT
        time.sleep(sleep)
1243801
def SendCommand(self, Command):
        
        try:
            self._Api.send_command(Command)
        except SkypeAPIError:
            self.ResetCache()
            raise
1194123
def reload(*command, ignore_patterns=[]):
    """"""
    path = "."
    sig = signal.SIGTERM
    delay = 0.25
    ignorefile = ".reloadignore"

    ignore_patterns = ignore_patterns or load_ignore_patterns(ignorefile)

    event_handler = ReloadEventHandler(ignore_patterns)
    reloader = Reloader(command, signal)

    observer = Observer()
    observer.schedule(event_handler, path, recursive=True)
    observer.start()

    reloader.start_command()

    try:
        while True:
            time.sleep(delay)
            sys.stdout.write(reloader.read())
            sys.stdout.flush()
            if event_handler.modified:
                reloader.restart_command()
    except KeyboardInterrupt:
        observer.stop()
    observer.join()

    reloader.stop_command()
    sys.stdout.write(reloader.read())
    sys.stdout.flush()
796423
def call(self, command, *args):
        
        command = self._normalize_command_name(command)
        args = self._normalize_command_args(command, *args)

        redis_function = getattr(self, command)
        value = redis_function(*args)
        return self._normalize_command_response(command, value)
1196184
def send(transport, time, state, host, description, service, tag, attribute,
         ttl, metric_f, echo):
    """"""
    client = CommandLineClient(transport)
    event = client.create_event({
        'time': time,
        'state': state,
        'host': host,
        'description': description,
        'service': service,
        'tags': tag,
        'attributes': dict(attribute),
        'ttl': ttl,
        'metric_f': metric_f
    })

    with client:
        client.send_event(event)
    if echo:
        echo_event(client.create_dict(event))