Format: text/x-python
⬇ Download File (706 B)
   1  # encoding: utf-8
   2  """Generic functions for extending IPython.
   3  """
   4  
   5  from IPython.core.error import TryNext
   6  from functools import singledispatch
   7  
   8  
   9  @singledispatch
  10  def inspect_object(obj):
  11      """Called when you do obj?"""
  12      raise TryNext
  13  
  14  
  15  @singledispatch
  16  def complete_object(obj, prev_completions):
  17      """Custom completer dispatching for python objects.
  18  
  19      Parameters
  20      ----------
  21      obj : object
  22          The object to complete.
  23      prev_completions : list
  24          List of attributes discovered so far.
  25      This should return the list of attributes in obj. If you only wish to
  26      add to the attributes already discovered normally, return
  27      own_attrs + prev_completions.
  28      """
  29      raise TryNext
  30