MCPcopy Create free account
hub / github.com/ipython/ipython / pdef

Method pdef

IPython/core/oinspect.py:396–415  ·  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

394 print()
395
396 def pdef(self, obj, oname=''):
397 """Print the call signature for any callable object.
398
399 If the object is a class, print the constructor information."""
400
401 if not callable(obj):
402 print('Object is not callable.')
403 return
404
405 header = ''
406
407 if inspect.isclass(obj):
408 header = self.__head('Class constructor information:\n')
409
410
411 output = self._getdef(obj,oname)
412 if output is None:
413 self.noinfo('definition header',oname)
414 else:
415 print(header,self.format(output), end=' ')
416
417 # In Python 3, all classes are new-style, so they all have __init__.
418 @skip_doctest

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected