def _switch_buffer(self) -> None:
    split = self._context['split']
    if ((split != 'no') and (self._winid > 0) and self._vim.call('win_gotoid', self._winid)):
        if ((split != 'vertical') and (not self._floating)):
            self._vim.command('wincmd J')
        self._winrestcmd = ''
        return
    self._floating = (split in ['floating', 'floating_relative'])
    self._filter_floating = False
    command = 'edit'
    if (split == 'tab'):
        self._vim.command('tabnew')
    elif self._floating:
        if (self._vim.current.buffer.options['filetype'] != 'denite'):
            self._titlestring = self._vim.options['titlestring']
        if (split == 'floating'):
            self._vim.call('nvim_open_win', self._vim.call('bufnr', '%'), True, {'relative': 'editor', 'row': int(self._context['winrow']), 'col': int(self._context['wincol']), 'width': int(self._context['winwidth']), 'height': int(self._context['winheight'])})
        elif (split == 'floating_relative'):
            opened_pos = ((self._vim.call('nvim_win_get_position', 0)[0] + self._vim.call('winline')) - 1)
            if self._context['auto_resize']:
                height = max(self._winheight, 1)
                width = max(self._winwidth, 1)
            else:
                width = int(self._context['winwidth'])
                height = int(self._context['winheight'])
            if (((opened_pos + height) + 3) > self._vim.eval('&lines')):
                anchor = 'SW'
                row = 0
                self._context['filter_winrow'] = (row + opened_pos)
            else:
                anchor = 'NW'
                row = 1
                self._context['filter_winrow'] = ((row + height) + opened_pos)
            self._vim.call('nvim_open_win', self._vim.call('bufnr', '%'), True, {'relative': 'cursor', 'row': row, 'col': 0, 'width': width, 'height': height, 'anchor': anchor})
    elif (self._context['filter_split_direction'] == 'floating'):
        self._titlestring = self._vim.options['titlestring']
        self._filter_floating = True
    elif (split != 'no'):
        command = self._get_direction()
        command += (' vsplit' if (split == 'vertical') else ' split')
    bufname = ('[denite]-' + self._context['buffer_name'])
    if self._vim.call('exists', '*bufadd'):
        bufnr = self._vim.call('bufadd', bufname)
        vertical = ('vertical' if (split == 'vertical') else '')
        command = ('buffer' if (split in ['no', 'tab', 'floating', 'floating_relative']) else 'sbuffer')
        self._vim.command(('silent keepalt %s %s %s %s' % (self._get_direction(), vertical, command, bufnr)))
    else:
        self._vim.call('denite#util#execute_path', f'silent keepalt {command}', bufname)
def _switch_buffer(self) -> None:
    split = self._context['split']
    if ((split != 'no') and (self._winid > 0) and self._vim.call('win_gotoid', self._winid)):
        if ((split != 'vertical') and (not self._floating)):
            self._vim.command('wincmd J')
        self._winrestcmd = 
        return
    self._floating = (split in ['floating', 'floating_relative'])
    self._filter_floating = False
    command = 'edit'
    if (split == 'tab'):
        self._vim.command('tabnew')
    elif self._floating:
        if (self._vim.current.buffer.options['filetype'] != 'denite'):
            self._titlestring = self._vim.options['titlestring']
        if (split == 'floating'):
            self._vim.call('nvim_open_win', self._vim.call('bufnr', '%'), True, {'relative': 'editor', 'row': int(self._context['winrow']), 'col': int(self._context['wincol']), 'width': int(self._context['winwidth']), 'height': int(self._context['winheight'])})
        elif (split == 'floating_relative'):
            opened_pos = ((self._vim.call('nvim_win_get_position', 0)[0] + self._vim.call('winline')) - 1)
            if self._context['auto_resize']:
                height = max(self._winheight, 1)
                width = max(self._winwidth, 1)
            else:
                width = int(self._context['winwidth'])
                height = int(self._context['winheight'])
            if (((opened_pos + height) + 3) > self._vim.eval('&lines')):
                anchor = 'SW'
                row = 0
                self._context['filter_winrow'] = (row + opened_pos)
            else:
                anchor = 'NW'
                row = 1
                self._context['filter_winrow'] = ((row + height) + opened_pos)
            self._vim.call('nvim_open_win', self._vim.call('bufnr', '%'), True, {'relative': 'cursor', 'row': row, 'col': 0, 'width': width, 'height': height, 'anchor': anchor})
    elif (self._context['filter_split_direction'] == 'floating'):
        self._titlestring = self._vim.options['titlestring']
        self._filter_floating = True
    elif (split != 'no'):
        command = self._get_direction()
        command += (' vsplit' if (split == 'vertical') else ' split')
    bufname = ('[denite]-' + self._context['buffer_name'])
    if self._vim.call('exists', '*bufadd'):
        bufnr = self._vim.call('bufadd', bufname)
        vertical = ('vertical' if (split == 'vertical') else )
        command = ('buffer' if (split in ['no', 'tab', 'floating', 'floating_relative']) else 'sbuffer')
        self._vim.command(('silent keepalt %s %s %s %s' % (self._get_direction(), vertical, command, bufnr)))
    else:
        self._vim.call('denite#util#execute_path', f'silent keepalt {command}', bufname)