':param only_modules: Indicates wheter it\'s possible to import a
definition that is not defined in a module.'

def completion_names(self, evaluator, only_modules=False):

    from jedi.evaluate.representation import ModuleContext, ImplicitNamespaceContext
    names = []
    if self.import_path:
        if (self.str_import_path == ('flask', 'ext')):
            for mod in self._get_module_names():
                modname = mod.string_name
                if modname.startswith('flask_'):
                    extname = modname[len('flask_'):]
                    names.append(self._generate_name(extname))
            for dir in self.sys_path_with_modifications():
                flaskext = os.path.join(dir, 'flaskext')
                if os.path.isdir(flaskext):
                    names += self._get_module_names([flaskext])
        for context in self.follow():
            if (context.api_type != 'module'):
                continue
            if (isinstance(context, ModuleContext) and context.py__file__().endswith('__init__.py')):
                paths = context.py__path__()
                names += self._get_module_names(paths, in_module=context)
            elif isinstance(context, ImplicitNamespaceContext):
                paths = context.paths
                names += self._get_module_names(paths)
            if only_modules:
                if ((('os',) == self.str_import_path) and (not self.level)):
                    names.append(self._generate_name('path', context))
                continue
            for filter in context.get_filters(search_global=False):
                names += filter.values()
    else:
        if (not self.level):
            names += self._get_module_names()
        if (self.file_path is not None):
            path = os.path.abspath(self.file_path)
            for i in range((self.level - 1)):
                path = os.path.dirname(path)
            names += self._get_module_names([path])
    return names
