def GetCollection(self, typ):
    collection = self.collections.get(typ, ())
    if typ == vimdoc.FUNCTION:
      # Sort by namespace, but preserve order within the same namespace. This
      # lets us avoid variability in the order files are traversed without
      # losing all useful order information.
      collection = sorted(collection,
          key=lambda x: x.locals.get('namespace', ''))
    elif typ == vimdoc.DICTIONARY:
      collection = sorted(collection)
    non_default_names = set(x.TagName() for x in collection
        if not x.IsDefault())
    return [x for x in collection
        if not x.IsDefault() or x.TagName() not in non_default_names]
Gets a collection by type, sorting and filtering as necessary.
dataset/ETHPy150Open google/vimdoc/vimdoc/module.py/Module.GetCollection