Return rTorrent condition to speed up data transfer.
343318
def pre_filter(self):
        
        inner = self._inner.pre_filter()
        if inner:
            if inner.startswith('"not=$') and inner.endswith('"') and '\\' not in inner:
                return inner[6:-1]  # double negation, return inner command
            elif inner.startswith('"'):
                inner = '"$' + inner[1:]
            else:
                inner = '$' + inner
            return 'not=' + inner
        else:
            return ''
1328457
def recv(self, filename, dest_file, timeout=None):
    """"""
    transport = DataFilesyncTransport(self.stream)
    transport.write_data('RECV', filename, timeout)
    for data_msg in transport.read_until_done('DATA', timeout):
      dest_file.write(data_msg.data)
709718
def Pull(cls, connection, filename, dest_file, progress_callback):
        """"""
        if progress_callback:
            total_bytes = cls.Stat(connection, filename)[1]
            progress = cls._HandleProgress(lambda current: progress_callback(filename, current, total_bytes))
            next(progress)

        cnxn = FileSyncConnection(connection, b'<2I')
        try:
            cnxn.Send(b'RECV', filename)
            for cmd_id, _, data in cnxn.ReadUntil((b'DATA',), b'DONE'):
                if cmd_id == b'DONE':
                    break
                dest_file.write(data)
                if progress_callback:
                    progress.send(len(data))
        except usb_exceptions.CommonUsbError as e:
            raise PullFailedError('Unable to pull file %s due to: %s' % (filename, e))
532472
def stat(self):
        """"""
        return (self._opened_conns, len(self._free_conn), len(self._waitings))
118460
def download(self, remote_url, local_path, buffer_size=8 * 1024):
        """"""
        bucket, key = _parse_url(remote_url)

        response_file = self.call("GetObject", bucket=bucket, key=key)['Body']
        with open(local_path, 'wb') as fp:
            buf = response_file.read(buffer_size)
            while buf:
                fp.write(buf)
                buf = response_file.read(buffer_size)
575133
def download(self, force=False, silent=False):
        """"""
        def _download():
            if self.url.startswith("http"):
                self._download_http(silent=silent)
            elif self.url.startswith("ftp"):
                self._download_ftp(silent=silent)
            else:
                raise ValueError("Invalid URL %s" % self.url)
            logger.debug("Moving %s to %s" % (
                self._temp_file_name,
                self.destination))
            shutil.move(self._temp_file_name, self.destination)
            logger.debug("Successfully downloaded %s" % self.url)

        try:
            is_already_downloaded = os.path.isfile(self.destination)
            if is_already_downloaded:
                if force:
                    try:
                        os.remove(self.destination)
                    except Exception:
                        logger.error("Cannot delete %s" % self.destination)
                    logger.info(
                        "Downloading %s to %s" % (self.url, self.destination))
                    logger.debug(
                        "Downloading %s to %s" % (self.url,
                                                  self._temp_file_name))
                    _download()
                else:
                    logger.info(("File %s already exist. Use force=True if you"
                                 " would like to overwrite it.") %
                                self.destination)
            else:
                _download()
        finally:
            try:
                os.remove(self._temp_file_name)
            except OSError:
                pass
292320
def cluster_meet(self, ip, port):
        """"""
        fut = self.execute(b'CLUSTER', b'MEET', ip, port)
        return wait_ok(fut)
1049245
def get(self, timeout=None):
        """"""
        if timeout:
            # Todo: Consider locking the poll/recv block.
            # Otherwise, this method is not thread safe.
            if self._conn1.poll(timeout):
                return (True, self._conn1.recv())
            else:
                return (False, None)
        return self._conn1.recv()
335243
def conditions(self, full_path, environ):
        """"""
        mtime = int(time.time())
        return str(mtime), rfc822.formatdate(mtime)
1301232
def send(self, out, addr=_MDNS_ADDR, port=_MDNS_PORT):
        """"""
        # This is a quick test to see if we can parse the packets we generate
        #temp = DNSIncoming(out.packet())
        for i in self.intf.values():
            try:
                return i.sendto(out.packet(), 0, (addr, port))
            except:
                traceback.print_exc()
                # Ignore this, it may be a temporary loss of network connection
                return -1
1017199
def recv(self, mac_addr=broadcast_addr, timeout=0):
        """"""
        # recv on the broadcast address "00:..:00" will give you all packets (for promiscuous mode)
        if self.keep_listening:
            try:
                return self.inq[str(mac_addr)].get(timeout=timeout)
            except Empty:
                return ""
        else:
            self.log("is down.")
26032
def get_condition(self, service_id, version_number, name):
		""""""
		content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name))
		return FastlyCondition(self, content)
344872
def send(self, diff):
        
        if not self.dryrun:
            self._fileSystemSync()

        return self.butter.send(
            self.getSendPath(diff.toVol),
            self.getSendPath(diff.fromVol),
            diff,
            self.showProgress is True,
        )
381264
def status(self):
        ''''''
        transfered = self.download - self.prev_download
        now = time.time()
        interval = now - self.last_status_time
        self.last_status_time = now
        return("DFLogger: %(state)s Rate(%(interval)ds):%(rate).3fkB/s Block:%(block_cnt)d Missing:%(missing)d Fixed:%(fixed)d Abandoned:%(abandoned)d" %
              {"interval": interval,
               "rate": transfered/(interval*1000),
               "block_cnt": self.block_cnt,
               "missing": len(self.missing_blocks),
               "fixed": self.missing_found,
               "abandoned": self.abandoned,
               "state": "Inactive" if self.stopped else "Active"
           })
375619
public function throttle () {
        $now = $this->milliseconds ();
        $elapsed = $now - $this->lastRestRequestTimestamp;
        if ($elapsed < $this->rateLimit) {
            $delay = $this->rateLimit - $elapsed;
              usleep ((int)($delay * 1000.0));
        }
    }
897778
def connection_made(self, transport):
        """"""
        self._transport = transport
        self._raw_transport = transport
        if isinstance(transport, asyncio.SubprocessTransport):
            self._transport = transport.get_pipe_transport(0)
1182224
def transport(self):
        """"""
        transport = "Transport: RTP/AVP;unicast;client_port={}-{}\r\n"
        return transport.format(
            str(self.session.rtp_port), str(self.session.rtcp_port))