Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c848d7af7f
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 37 lines (36 sloc) 1.143 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
def func_info_x234(thing, completion_types):
  """helper function for Vim repl completion"""
  def toVim(thing):
    if type(thing) == type([]):
      return "[%s]" % (",".join([toVim(x) for x in thing]))
    elif type(thing) == type(""):
      return '"%s"' % thing.replace('\\','\\\\').replace('"', '\\"').replace("\n", "\\n")
    else:
      return str(thing)
  def toList(name, item, source):
      doc = "_"
      arity = 0
      spec = []
      try:
        doc = item.__doc__
      except Exception, e:
        doc = "-"
      try:
        spec = inspect.getargspec(item)
        spec = [spec.args, spec.varargs, spec.keywords, spec.defaults.__str__()]
      except Exception, e:
        spec = []
      type_ = "-"
      try:
        type_ = type(item)
      except Exception, e:
        type_ = "-"
      return [source, name, doc, spec, str(type_)]
  result = []
  if completion_types.__contains__("dict"):
    for d in thing.keys():
      result.append(toList(d, thing[d], 'key'))
  elif completion_types.__contains__("dir"):
    for d in dir(thing):
      result.append(toList(d, getattr(thing, d), "dir"))
  return toVim(result)
Something went wrong with that request. Please try again.