def _get_direction(self) -> str:
    direction = str(self._context['direction'])
    if ((direction == 'dynamictop') or (direction == 'dynamicbottom')):
        self._update_displayed_texts()
        winwidth = self._vim.call('winwidth', 0)
        is_fit = (not [x for x in self._displayed_texts if (self._vim.call('strwidth', x) > winwidth)])
        if (direction == 'dynamictop'):
            direction = ('aboveleft' if is_fit else 'topleft')
        else:
            direction = ('belowright' if is_fit else 'botright')
    return direction
def _get_direction(self) -> str:
    direction = str(self._context['direction'])
    if ((direction == 'dynamictop') or (direction == 'dynamicbottom')):
        self._update_displayed_texts()
        winwidth = self._vim.call('winwidth', 0)
        is_fit = (not [x for x in self._displayed_texts if (self._vim.call('strwidth', x) > winwidth)])
        if (direction == 'dynamictop'):
            direction = ('aboveleft' if is_fit else 'topleft')
        else:
            direction = ('belowright' if is_fit else 'botright')
    return direction