Return a random proxy from proxy config.
771356
def get_proxy():
    """"""
    proxies = _config['proxies']

    return proxies[
        random.randint(0, len(proxies) - 1)
    ] if len(proxies) > 0 else None
939842
def random_new(algo: int = RNG_CMWC) -> tcod.random.Random:
    
    return tcod.random.Random(algo)
969347
def enable_proxy(self, host, port):
        """"""

        self.proxy = [host, _number(port)]
        self.proxy_enabled = True
731574
def get_proxy(self, proxy_address):
        
        if not proxy_address:
            return None
        hostport = extract_proxy_hostport(proxy_address)
        return self.proxies_by_hostport.get(hostport, None)
340199
def configure_proxy(self, curl_object):
        """"""
        curl_object.setopt(curl_object.PROXY, self._proxy_hostname)
        curl_object.setopt(curl_object.PROXYPORT, self._proxy_port)
        curl_object.setopt(curl_object.PROXYTYPE, curl_object.PROXYTYPE_SOCKS5)
        if self._proxy_user and self._proxy_passwd:
            curl_object.setopt(curl_object.PROXYUSERPWD, '%s:%s' % (self._proxy_user, self._proxy_port))
1023870
def simulate(self):
        """"""
        min_ = (-sys.maxsize - 1) if self._min is None else self._min
        max_ = sys.maxsize if self._max is None else self._max
        return random.randint(min_, max_)
388273
def generate_random(number_of_bytes=None, region=None, key=None, keyid=None,
                    profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    r = {}
    try:
        random = conn.generate_random(number_of_bytes)
        r['random'] = random['Plaintext']
    except boto.exception.BotoServerError as e:
        r['error'] = __utils__['boto.get_error'](e)
    return r
400674
def _random(cls):
        
        pid = os.getpid()
        if pid != cls._pid:
            cls._pid = pid
            cls.__random = _random_bytes()
        return cls.__random
336796
def random_get_instance() -> tcod.random.Random:
    
    return tcod.random.Random._new_from_cdata(
        ffi.cast("mersenne_data_t*", lib.TCOD_random_get_instance())
    )
537855
def generator(self, random, args):
        """"""
        if self.duplicates:
            max_count = [self.capacity // item[0] for item in self.items]
            return [random.randint(0, m) for m in max_count]
        else:
            return [random.choice([0, 1]) for _ in range(len(self.items))]
388554
async def random_connection(self):
        
        addr = choice(list(self._connections.keys()))
        return await self.env.connect(addr)
163997
def random(cls, engine_or_session, limit=5):
        
        ses, auto_close = ensure_session(engine_or_session)
        result = ses.query(cls).order_by(func.random()).limit(limit).all()
        if auto_close:  # pragma: no cover
            ses.close()
        return result
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
25463
private void generateStoreNewProxyMatcher() {
        String proxyMatcherType = Types.PROXY_MATCHER.getInternalName();

        // stack:
        insert(new TypeInsnNode(NEW, proxyMatcherType));
        // stack: <proxyMatcher>
        insert(new InsnNode(DUP));
        // stack: <proxyMatcher> :: <proxyMatcher>
        insert(new MethodInsnNode(INVOKESPECIAL, proxyMatcherType, "<init>", "()V", false));
        // stack: <proxyMatcher>
        generateStoreInCache();
        // stack: <proxyMatcher>
    }
946009
def _random_x(self):
        """"""
        return (tuple(random.random() for _ in range(self.fmodel.dim_x)),)
60991
def proxy(self):
        """"""
        headers = self.request.headers.filter(self.ignored_request_headers)
        qs = self.request.query_string if self.pass_query_string else ''

        # Fix for django 1.10.0 bug https://code.djangoproject.com/ticket/27005
        if (self.request.META.get('CONTENT_LENGTH', None) == '' and
                get_django_version() == '1.10'):
            del self.request.META['CONTENT_LENGTH']

        request_kwargs = self.middleware.process_request(
            self, self.request, method=self.request.method, url=self.proxy_url,
            headers=headers, data=self.request.body, params=qs,
            allow_redirects=False, verify=self.verify_ssl, cert=self.cert,
            timeout=self.timeout)

        result = request(**request_kwargs)

        response = HttpResponse(result.content, status=result.status_code)

        # Attach forwardable headers to response
        forwardable_headers = HeaderDict(result.headers).filter(
            self.ignored_upstream_headers)
        for header, value in iteritems(forwardable_headers):
            response[header] = value

        return self.middleware.process_response(
            self, self.request, result, response)
749981
def proxy(ctx, bind, port):
    
    app = web.Application()
    app.on_startup.append(startup_proxy)
    app.on_cleanup.append(cleanup_proxy)

    app.router.add_route("GET", r'/stream/{path:.*$}', websocket_handler)
    app.router.add_route("GET", r'/wsproxy/{path:.*$}', websocket_handler)
    app.router.add_route('*', r'/{path:.*$}', web_handler)
    if getattr(ctx.args, 'testing', False):
        return app
    web.run_app(app, host=bind, port=port)