parameters: (self, evaluator, only_modules=False)
return_statement: return names
docstring: :param only_modules: Indicates wheter it's possible to import a
              definition that is not defined in a module.
docstring_summary: :param only_modules: Indicates wheter it's possible to import a
              definition that is not defined in a module.
docstring_tokens: : param only_modules : Indicates wheter it s possible to import a definition that is not defined in a module .
function: 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)
  
                  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
function_tokens: def completion_names ( self , evaluator , only_modules = False ) : 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 ) 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