Wrapper for nvim.request.
545011
def request(self, name, *args, **kwargs):
        """"""
        return self._session.request(name, self, *args, **kwargs)
1356373
def _status_request(self, url, length):
        """"""
        return requests.put(
            url=url,
            headers={'Content-Length': '0',
                     'Content-Range': 'bytes */%i' % length}
        )
1012140
def rpc_export(rpc_method_name, sync=False):
    """"""
    def dec(f):
        f._nvim_rpc_method_name = rpc_method_name
        f._nvim_rpc_sync = sync
        f._nvim_bind = True
        f._nvim_prefix_plugin_path = False
        return f
    return dec
74690
def decode(mode=unicode_errors_default):
    """"""
    def dec(f):
        f._nvim_decode = mode
        return f
    return dec
554508
def log_request(self, code='-', size='-'):
        """"""
        print_size = getattr(thread_local, 'size', -1)
        if size != '-':
            size_str = ' (%s)' % size
        elif print_size >= 0:
            size_str = self.log_size_string(print_size) + ' '
        else:
            size_str = ''
        if not self.server.suppress_noise or (code != 200 and code != 304):
            self.log_message(
                '%s"%s" %s', size_str, self.requestline, str(code))
        if print_size >= 0:
            thread_local.size = -1
1075160
def _request(self, method, path, params=None):
        """"""
        url = self._base_url + path

        try:
            if method == 'GET':
                response = requests.get(url, timeout=TIMEOUT)
            elif method == "POST":
                response = requests.post(url, params, timeout=TIMEOUT)
            elif method == "PUT":
                response = requests.put(url, params, timeout=TIMEOUT)
            elif method == "DELETE":
                response = requests.delete(url, timeout=TIMEOUT)

            if response:
                return response.json()
            else:
                return {'status': 'error'}
        except requests.exceptions.HTTPError:
            return {'status': 'error'}
        except requests.exceptions.Timeout:
            return {'status': 'offline'}
        except requests.exceptions.RequestException:
            return {'status': 'offline'}
30715
def vms(message, level=1):
    """"""
    if verbose is not None and verbose != False:
        if isinstance(verbose, bool) or (isinstance(verbose, int) and level <= verbose):
            std(message)
17806
def ask_input(self, prompt):
        """"""
        self._vim.command('call inputsave()')
        self._vim.command('let user_input = input("{} ")'.format(prompt))
        self._vim.command('call inputrestore()')
        response = self._vim.eval('user_input')
        self._vim.command('unlet user_input')
        return response
721861
def in_cmd(argv):
    """"""

    if len(argv) == 1:
        return workon_cmd(argv)

    parse_envname(argv, lambda : sys.exit('You must provide a valid virtualenv to target'))

    return inve(*argv)
1090583
def gpu_mem_get(id=None):
    ""
    if not use_gpu: return GPUMemory(0, 0, 0)
    if id is None: id = torch.cuda.current_device()
    try:
        handle = pynvml.nvmlDeviceGetHandleByIndex(id)
        info = pynvml.nvmlDeviceGetMemoryInfo(handle)
        return GPUMemory(*(map(b2mb, [info.total, info.free, info.used])))
    except:
        return GPUMemory(0, 0, 0)
1241431
def _request(self, function, params, method='POST', headers={}):
        """"""
        
        if method is 'POST':
            params = urllib.parse.urlencode(params)
            headers = { "Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain" }
        
        path = '/%s/%s' % (self._version, function)
        
        self._conn.request(method, path, params, headers)
        return self._conn.getresponse()
823557
def ui_attach(self, width, height, rgb=None, **kwargs):
        
        options = kwargs
        if rgb is not None:
            options['rgb'] = rgb
        return self.request('nvim_ui_attach', width, height, options)
101245
def w(self):
        """"""
        w = ffi.new('int *')
        check_int_err(lib.SDL_QueryTexture(self._ptr, ffi.NULL, ffi.NULL, w, ffi.NULL))
        return w[0]
1251360
def request(self, action):
    """"""
    ev = threading.Event()
    first = False
    with self.__lock:
      if len(self.__events) == 0:
        first = True
      self.__events.append(ev)
    if first:
      action()
    return ev
1301977
def WriteMessageHandlerRequests(self, requests, cursor=None):
    """"""
    query = ("INSERT IGNORE INTO message_handler_requests "
             "(handlername, request_id, request) VALUES ")

    value_templates = []
    args = []
    for r in requests:
      args.extend([r.handler_name, r.request_id, r.SerializeToString()])
      value_templates.append("(%s, %s, %s)")

    query += ",".join(value_templates)
    cursor.execute(query, args)
537457
def _inner_func_anot(func):
    """"""
    @wraps(func)
    def new_func(*args):
        return func(*_lmap(_wrap_surface, args))
    return new_func
490920
def request(self, method, url, url_params=empty.dict, headers=empty.dict, timeout=None, **params):
        """"""
        raise NotImplementedError("Concrete services must define the request method")