Make a patche requests (this returns a coroutine)
778308
def patch(self, service, path, body, **kwargs):
        
        return self.make_request(Methods.PATCH, service, path, body=body,
                                 **kwargs)
540436
def patch(*args, **kwargs):
    
    from caliendo.patch import patch as p
    return p(*args, **kwargs)
1103549
def patch(self, instance, errors):
        
        if errors:
            return self.errors(errors)
        return self.updated(instance)
1260557
def _make_request(self, conn, method, url, timeout=_Default,
                      **httplib_request_kw):
        
        self.num_requests += 1

        if timeout is _Default:
            timeout = self.timeout

        conn.request(method, url, **httplib_request_kw)
        conn.sock.settimeout(timeout)
        httplib_response = conn.getresponse()

        log.debug("\"%s %s %s\" %s %s" %
                  (method, url,
                   conn._http_vsn_str, # pylint: disable-msg=W0212
                   httplib_response.status, httplib_response.length))

        return httplib_response
265319
def patch(self, url: StrOrURL,
              *, data: Any=None, **kwargs: Any) -> '_RequestContextManager':
        """"""
        return _RequestContextManager(
            self._request(hdrs.METH_PATCH, url,
                          data=data,
                          **kwargs))
400016
async def run_with_reloader(loop, coroutine, cleanup=None, *args, **kwargs):
    

    clear_screen()
    print("🤖  Running in debug mode with live reloading")
    print("    (don't forget to disable it for production)")

    # Create watcher
    handler = Handler(loop)
    watcher = Observer()

    # Setup
    path = realpath(os.getcwd())
    watcher.schedule(handler, path=path, recursive=True)
    watcher.start()

    print("    (watching {})".format(path))

    # Run watcher and coroutine together
    done, pending = await asyncio.wait(
        [coroutine, handler.changed], return_when=asyncio.FIRST_COMPLETED
    )

    # Cleanup
    cleanup and cleanup()
    watcher.stop()

    for fut in done:
        # If change event, then reload
        if isinstance(fut.result(), Event):
            print("Reloading...")
            reload()
721128
def call_requests(
    requests: Union[Request, Iterable[Request]], methods: Methods, debug: bool
) -> Response:
    
    if isinstance(requests, collections.Iterable):
        return BatchResponse(safe_call(r, methods, debug=debug) for r in requests)
    return safe_call(requests, methods, debug=debug)
21128
def run_coroutine_threadsafe(self, coro, loop=None, callback=None):
        """"""
        if not asyncio.iscoroutine(coro):
            raise TypeError("A await in coroutines. object is required")
        loop = loop or self.loop
        future = NewFuture(callback=callback)

        def callback_func():
            try:
                asyncio.futures._chain_future(NewTask(coro, loop=loop), future)
            except Exception as exc:
                if future.set_running_or_notify_cancel():
                    future.set_exception(exc)
                raise

        loop.call_soon_threadsafe(callback_func)
        return future
364763
def coroutine(f):
    
    @wraps(f)
    def g(*args, **kwargs):
        sink = f(*args, **kwargs)
        sink.send(None)
        return sink

    return g
112190
def patch(self, endpoint, json=None, params=None, **kwargs):
        
        json = kwargs['data'] if 'data' in kwargs else json
        return self._make_request('patch', endpoint, data=json, params=params)
827454
def _make_request(self, method, endpoint, **kwargs):
        
        if isinstance(kwargs.get('file_type'), string_types):
            file_type = kwargs['file_type'].lower()
        else:
            file_type = 'json'
        params = kwargs.get('params')

        data = kwargs.get('data', kwargs.get('json', None))
        url = '{}/{}'.format(self.api_url, endpoint)
        self._validate_request(endpoint, file_type, data, params)

        if method == 'get':
            stream = kwargs.get('stream', False)
            url = '{}.{}'.format(url, file_type)
            r = self.session.get(url, params=params, stream=stream)

        elif method == 'post':
            r = self.session.post(url=url, json=data, params=params)

        elif method == 'put':
            r = self.session.put(url=url, json=data, params=params)

        elif method == 'patch':
            r = self.session.patch(url=url, json=data, params=params)

        elif method == 'delete':
            r = self.session.delete(url=url, params=params)

        else:
            raise ClientException("Non-supported HTTP method: {}".format(method))

        return self._validate_response(r)
51782
function() {
			global.requestSSLInitializing = false;
			global.requestSSLInitialized = true;
			global.requestSSLHooks = null;
			// unpatch ourselves
			request.Request.prototype.init = patchedInit;
			debug('init done');
			return patchedInit.apply(self,args);
		}
236541
def submit(self, fn, *args, **kwargs):
        """"""
        corofn = asyncio.coroutine(lambda: fn(*args, **kwargs))
        return run_coroutine_threadsafe(corofn(), self.loop)
377810
function makeHttpRequest(next) {
  var start = Date.now();

  sepia.fixtureDir(path.join(process.cwd(), 'fixtures/custom'));

  request({
    url: 'http://localhost:1337',
    method: 'GET'
  }, function(err, data, body) {
    var time = Date.now() - start;

    console.log('FIXTURE DIR');
    console.log('  status:', data.statusCode);
    console.log('  body  :', body);
    console.log('  time  :', time);

    common.verify(function() {
      fs.existsSync('fixtures/custom').should.equal(true);
      common.shouldBeDynamicallyTimed(time);
    });

    console.log();

    next();
  });
}
279651
def coroutine(func):
    """"""
    def __start(*args, **kwargs):
        """Automatically calls next() on the internal generator function."""
        __cr = func(*args, **kwargs)
        next(__cr)
        return __cr
    return __start
1120759
def add_patch(self, *args, **kwargs):
        
        return self.add_route(hdrs.METH_PATCH, *args, **kwargs)
1257962
def patch_requests():
    
    config.create_config_directory()
    ca_certs_file = config.CERT_FILE
    ca_certs_contents = requests.__loader__.get_data('requests/cacert.pem')

    should_write_certs = True

    if os.path.isfile(ca_certs_file):
        with open(ca_certs_file, 'rb') as f:
            existing_certs = f.read()
            if existing_certs != ca_certs_contents:
                should_write_certs = True
                print("Updating local SSL certificates")
            else:
                should_write_certs = False

    if should_write_certs:
        with open(ca_certs_file, 'wb') as f:
            f.write(ca_certs_contents)

    os.environ['REQUESTS_CA_BUNDLE'] = ca_certs_file