Returns a dict of { name => Completions }.
964269
def find_deref_completions(ast_rootpath, root_env=gcl.default_env):
  """"""
  with util.LogTime('find_deref_completions'):
    tup = inflate_context_tuple(ast_rootpath, root_env)
    path = path_until(ast_rootpath, is_deref_node)
    if not path:
      return {}
    deref = path[-1]
    haystack = deref.haystack(tup.env(tup))
    if not hasattr(haystack, 'keys'):
      return {}
    return {n: get_completion(haystack, n) for n in haystack.keys()}
749138
def _dict(self, with_name=True):
        

        d = dict([(k, getattr(self, k)) for k, _, _ in self.name_parts])

        return self.clear_dict(d)
1146345
def get_names(self):
        '''  '''
        # Overridden to support autocompletion for the ROBOFORTH commands.
        return (['do_' + x for x in self.commands['shell']]
              + ['do_' + x for x in self.commands['forth']])
856908
def generate_completions(frame, act_tok):
    '''
    
    '''
    if frame is None:
        return []

    # Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
    # (Names not resolved in generator expression in method)
    # See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
    updated_globals = {}
    updated_globals.update(frame.f_globals)
    updated_globals.update(frame.f_locals)  # locals later because it has precedence over the actual globals

    if pydevconsole.IPYTHON:
        completions = pydevconsole.get_completions(act_tok, act_tok, updated_globals, frame.f_locals)
    else:
        completer = Completer(updated_globals, None)
        # list(tuple(name, descr, parameters, type))
        completions = completer.complete(act_tok)

    return completions
674462
def get_name2value_dict(self):
        """"""
        x = {}
        for val, num in self._values:
            x[val] = num
        return x
236532
def get_completion_args(self, is_completion=False, comp_line=None):  # pylint: disable=no-self-use
        
        is_completion = is_completion or os.environ.get(ARGCOMPLETE_ENV_NAME)
        comp_line = comp_line or os.environ.get('COMP_LINE')
        # The first item is the exe name so ignore that.
        return comp_line.split()[1:] if is_completion and comp_line else None
964672
def complete_contexts(self):
        '''
        
        '''
        if self._complete_contexts:
            return self._complete_contexts
        self.context()
        return self._complete_contexts
1249382
def __complete_cmds(self, text):
        """"""
        return [ name for name in self._cmd_map_visible.keys() if name.startswith(text) ]
1280266
def get_names():
    """"""
    res = list(cmaps.keys())
    res = sorted(res, key=lambda s: s.lower())
    return res
751042
def _ipython_key_completions_(self) -> List[str]:
          # noqa
        item_lists = [item
                      for sublist in self._item_sources
                      for item in sublist
                      if isinstance(item, str)]
        return list(set(item_lists))
1008947
def complete(self):
        

        comp = []
        for k, v in self.key.items():

            # if we have reached a value, try to fetch valid completions
            if v['type'] == 'value':
                if 'complete' in v:
                    comp += v['complete'](self.inp_cmd[-1])

            # otherwise, k is our valid completion
            else:
                comp.append(k)

        return comp
538670
def dotted_completion(cls, line, sorted_keys, compositor_defs):
        
        completion_key, suggestions = None, []
        tokens = [t for t in reversed(line.replace('.', ' ').split())]
        for i, token in enumerate(tokens):
            key_checks =[]
            if i >= 0:  # Undotted key
                key_checks.append(tokens[i])
            if i >= 1:  # Single dotted key
                key_checks.append('.'.join([key_checks[-1], tokens[i-1]]))
            if i >= 2:  # Double dotted key
                key_checks.append('.'.join([key_checks[-1], tokens[i-2]]))
            # Check for longest potential dotted match first
            for key in reversed(key_checks):
                if key in sorted_keys:
                    completion_key = key
                    depth = completion_key.count('.')
                    suggestions = [k.split('.')[depth+1] for k in sorted_keys
                                   if k.startswith(completion_key+'.')]
                    return completion_key, suggestions
            # Attempting to match compositor definitions
            if token in compositor_defs:
                completion_key = compositor_defs[token]
                break
        return completion_key, suggestions
628905
def keys(self):
        """"""
        names = []
        for i in range(self.n_blocks):
            names.append(self.get_block_name(i))
        return names
418485
def getnamedargs(*args, **kwargs):
    """"""
    adict = {}
    for arg in args:
        if isinstance(arg, dict):
            adict.update(arg)
    adict.update(kwargs)
    return adict
876460
def rpc_get_completions(self, filename, source, offset):
        
        results = self._call_backend("rpc_get_completions", [], filename,
                                     get_source(source), offset)
        # Uniquify by name
        results = list(dict((res['name'], res) for res in results)
                       .values())
        results.sort(key=lambda cand: _pysymbol_key(cand["name"]))
        return results
461527
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'recognitions') and self.recognitions is not None:
            _dict['recognitions'] = [x._to_dict() for x in self.recognitions]
        return _dict
467701
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'key') and self.key is not None:
            _dict['key'] = self.key
        if hasattr(self,
                   'matching_results') and self.matching_results is not None:
            _dict['matching_results'] = self.matching_results
        if hasattr(self, 'aggregations') and self.aggregations is not None:
            _dict['aggregations'] = [x._to_dict() for x in self.aggregations]
        return _dict