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

Method __call__

IPython/core/formatters.py:332–348  ·  view source on GitHub ↗

Compute the format for an object.

(self, obj)

Source from the content-addressed store, hash-verified

330
331 @catch_format_error
332 def __call__(self, obj):
333 """Compute the format for an object."""
334 if self.enabled:
335 # lookup registered printer
336 try:
337 printer = self.lookup(obj)
338 except KeyError:
339 pass
340 else:
341 return printer(obj)
342 # Finally look for special method names
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
345 return method()
346 return None
347 else:
348 return None
349
350 def __contains__(self, typ):
351 """map in to lookup_by_type"""

Callers

nothing calls this directly

Calls 2

lookupMethod · 0.95
get_real_methodFunction · 0.85

Tested by

no test coverage detected