MCPcopy Index your code
hub / github.com/ipython/ipython / pdef

Method pdef

IPython/core/oinspect.py:460–479  ·  view source on GitHub ↗

Print the call signature for any callable object. If the object is a class, print the constructor information.

(self, obj, oname='')

Source from the content-addressed store, hash-verified

458 print()
459
460 def pdef(self, obj, oname=''):
461 """Print the call signature for any callable object.
462
463 If the object is a class, print the constructor information."""
464
465 if not callable(obj):
466 print('Object is not callable.')
467 return
468
469 header = ''
470
471 if inspect.isclass(obj):
472 header = self.__head('Class constructor information:\n')
473
474
475 output = self._getdef(obj,oname)
476 if output is None:
477 self.noinfo('definition header',oname)
478 else:
479 print(header,self.format(output), end=' ')
480
481 # In Python 3, all classes are new-style, so they all have __init__.
482 @skip_doctest

Callers 1

test_pdefFunction · 0.45

Calls 4

__headMethod · 0.95
_getdefMethod · 0.95
noinfoMethod · 0.95
formatMethod · 0.95

Tested by 1

test_pdefFunction · 0.36