Return random proxy
7685
def get_random_proxy(self):
        """"""
        idx = randint(0, len(self._list) - 1)
        return self._list[idx]
1214399
def filter_by_rand(self, p:float, seed:int=None):
        ""
        if seed is not None: np.random.seed(seed)
        return self.filter_by_func(lambda o: rand_bool(p))
159596
def get_random(min_pt, max_pt):
        """"""
        result = Point(random.random(), random.random())
        return result.get_component_product(max_pt - min_pt) + min_pt
321685
def replicate(self):
        """"""
        return np.sum(
            self.proxies[self.window :] * self._xs[:-1], axis=1
        ).reindex(self.r.index)
1294433
def wsgi_proxyfix(factory=None):
    
    def create_wsgi(app, **kwargs):
        wsgi_app = factory(app, **kwargs) if factory else app.wsgi_app
        if app.config.get('WSGI_PROXIES'):
            return ProxyFix(wsgi_app, num_proxies=app.config['WSGI_PROXIES'])
        return wsgi_app
    return create_wsgi
946009
def _random_x(self):
        """"""
        return (tuple(random.random() for _ in range(self.fmodel.dim_x)),)
1007136
function getProxyMiddleware(context, uri) {
  const pathRewrite = {};
  pathRewrite[`^${context}`] = url.parse(uri).pathname;

  return proxy({
    target: getHost(uri),
    changeOrigin: true,
    logLevel: 'warn',
    pathRewrite: pathRewrite,
  });
}
804771
def get_proxies():
    """"""
    proxies = getproxies()
    filtered_proxies = {}
    for key, value in proxies.items():
        if key.startswith('http://'):
            if not value.startswith('http://'):
                filtered_proxies[key] = 'http://{0}'.format(value)
            else:
                filtered_proxies[key] = value
    return filtered_proxies
624035
function proxyStream(err, stats) {
    return through.obj(function(chunk, enc, cb) {
        processStats.call(this, chunk, stats);

        if (_.isError(err)) {
            this.emit('error', wrapError(err));
        }

        cb(null, chunk);
    });
}
583293
function (id) {
        var proxy = CommandProxyMap[id];
        delete CommandProxyMap[id];
        CommandProxyMap[id] = null;
        return proxy;
    }
1064953
function generateRandomBytes (size, attempts, callback) {
  crypto.randomBytes(size, function onRandomBytes (err, buf) {
    if (!err) return callback(null, buf)
    if (!--attempts) return callback(err)
    setTimeout(generateRandomBytes.bind(null, size, attempts, callback), 10)
  })
}
533157
def random_connection(self):
        ''''''
        # While at the moment there's no need for this to be a context manager
        # per se, I would like to use that interface since I anticipate
        # adding some wrapping around it at some point.
        yield random.choice(
            [conn for conn in self.connections() if conn.alive()])
148007
def randombytes(n):
    """"""
    # Use /dev/urandom if it is available.  Fall back to random module
    # if not.  It might be worthwhile to extend this function to use
    # other platform-specific mechanisms for getting random bytes.
    if os.path.exists("/dev/urandom"):
        f = open("/dev/urandom")
        s = f.read(n)
        f.close()
        return s
    else:
        L = [chr(random.randrange(0, 256)) for i in range(n)]
        return "".join(L)
274741
def random(self, *args, **kwargs):
        
        indexer = Random()
        self.add(indexer)

        return self
1107995
def get_proxy(self):
        
        if self.proxy_list is None or len(self.proxy_list) <= 0:
            return None, None, None, None
        self.proxy_index += 1
        self.proxy_index = self.proxy_index % len(self.proxy_list)
        item = self.proxy_list[self.proxy_index]
        if len(item) == 2:
            return item[0], item[1], None, None
        else:
            return item[0], item[1], item[2], item[3]
554413
function random(len) {
    if (subtle) {
        return safeRandom(len);
    } else if (nodeCrypto) {
        return new Uint8Array(nodeCrypto.randomBytes(len));
    } else {
        throw new KdbxError(Consts.ErrorCodes.NotImplemented, 'Random not implemented');
    }
}
271926
def select_proxy(url, proxies):
    
    proxies = proxies or {}
    urlparts = urlparse(url)
    if urlparts.hostname is None:
        return proxies.get(urlparts.scheme, proxies.get('all'))

    proxy_keys = [
        urlparts.scheme + '://' + urlparts.hostname,
        urlparts.scheme,
        'all://' + urlparts.hostname,
        'all',
    ]
    proxy = None
    for proxy_key in proxy_keys:
        if proxy_key in proxies:
            proxy = proxies[proxy_key]
            break

    return proxy