m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
574 B

6 months ago
  1. from __future__ import print_function, unicode_literals, absolute_import
  2. import sys, textwrap
  3. from .py3k_compat import callable
  4. rlmain = sys.modules["readline"]
  5. rl = rlmain.rl
  6. def get_doc(rl):
  7. methods = [(x, getattr(rl, x)) for x in dir(rl) if callable(getattr(rl, x))]
  8. return [ (x, m.__doc__ )for x, m in methods if m.__doc__]
  9. def get_rest(rl):
  10. q = get_doc(rl)
  11. out = []
  12. for funcname, doc in q:
  13. out.append(funcname)
  14. out.append("\n".join(textwrap.wrap(doc, 80, initial_indent=" ")))
  15. out.append("")
  16. return out