generics.py 740 B

12345678910111213141516171819202122232425262728293031323334
  1. # encoding: utf-8
  2. """Generic functions for extending IPython.
  3. See http://pypi.python.org/pypi/simplegeneric.
  4. """
  5. from IPython.core.error import TryNext
  6. from simplegeneric import generic
  7. @generic
  8. def inspect_object(obj):
  9. """Called when you do obj?"""
  10. raise TryNext
  11. @generic
  12. def complete_object(obj, prev_completions):
  13. """Custom completer dispatching for python objects.
  14. Parameters
  15. ----------
  16. obj : object
  17. The object to complete.
  18. prev_completions : list
  19. List of attributes discovered so far.
  20. This should return the list of attributes in obj. If you only wish to
  21. add to the attributes already discovered normally, return
  22. own_attrs + prev_completions.
  23. """
  24. raise TryNext