docstr: :param only_modules: Indicates wheter it's possible to import a
      definition that is not defined in a module.
docstr_tok: [":","param","only_modules",":","Indicates","wheter","it","'s","possible","to","import","a","definition","that","is","not","defined","in","a","module","."]
code: def completion_names(self, evaluator, only_modules=False):
      """
      :param only_modules: Indicates wheter it's possible to import a
          definition that is not defined in a module.
      """
      from jedi.evaluate.context import ModuleContext
      from jedi.evaluate.context.namespace import (
          ImplicitNamespaceContext,
      )
  
      names = []
      if self.import_path:
          # flask
          if self.str_import_path == ("flask", "ext"):
              # List Flask extensions like ``flask_foo``
              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))
              # Now the old style: ``flaskext.foo``
              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():
              # Non-modules are not completable.
              if context.api_type != "module":  # not a module
                  continue
              # namespace packages
              if isinstance(
                  context, ModuleContext
              ) and context.py__file__().endswith("__init__.py"):
                  paths = context.py__path__()
                  names += self._get_module_names(
                      paths, in_module=context
                  )
  
              # implicit namespace packages
              elif isinstance(context, ImplicitNamespaceContext):
                  paths = context.paths
                  names += self._get_module_names(
                      paths, in_module=context
                  )
  
              if only_modules:
                  # In the case of an import like `from x.` we don't need to
                  # add all the variables.
                  if ("os",) == self.str_import_path and not self.level:
                      # os.path is a hardcoded exception, because it's a
                      # ``sys.modules`` modification.
                      names.append(self._generate_name("path", context))
  
                  continue
  
              for filter in context.get_filters(search_global=False):
                  names += filter.values()
      else:
          # Empty import path=completion after import
          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
  
imports: import os
  from parso.python import tree
  from parso.tree import search_ancestor
  from parso import python_bytes_to_unicode
  from jedi._compatibility import FileNotFoundError, ImplicitNSInfo, force_unicode, unicode
  from jedi import debug
  from jedi import settings
  from jedi.parser_utils import get_cached_code_lines
  from jedi.evaluate import sys_path
  from jedi.evaluate import helpers
  from jedi.evaluate import compiled
  from jedi.evaluate import analysis
  from jedi.evaluate.utils import unite
  from jedi.evaluate.cache import evaluator_method_cache
  from jedi.evaluate.filters import AbstractNameDefinition
  from jedi.evaluate.base_context import ContextSet, NO_CONTEXTS
label_desc: Use image node_id 8 for calling the Importer obj's underlying member method code with example usage: obj.completion_names(evaluator, only_modules) and returns: names