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

Method __call__

IPython/core/formatters.py:1016–1039  ·  view source on GitHub ↗

Compute the format for an object. Identical to parent's method but we pass extra parameters to the method. Unlike other _repr_*_ `_repr_mimebundle_` should allow extra kwargs, in particular `include` and `exclude`.

(self, obj, include=None, exclude=None)

Source from the content-addressed store, hash-verified

1014
1015 @catch_format_error
1016 def __call__(self, obj, include=None, exclude=None):
1017 """Compute the format for an object.
1018
1019 Identical to parent's method but we pass extra parameters to the method.
1020
1021 Unlike other _repr_*_ `_repr_mimebundle_` should allow extra kwargs, in
1022 particular `include` and `exclude`.
1023 """
1024 if self.enabled:
1025 # lookup registered printer
1026 try:
1027 printer = self.lookup(obj)
1028 except KeyError:
1029 pass
1030 else:
1031 return printer(obj)
1032 # Finally look for special method names
1033 method = get_real_method(obj, self.print_method)
1034
1035 if method is not None:
1036 return method(include=include, exclude=exclude)
1037 return None
1038 else:
1039 return None
1040
1041
1042FormatterABC.register(BaseFormatter)

Callers

nothing calls this directly

Calls 2

get_real_methodFunction · 0.85
lookupMethod · 0.80

Tested by

no test coverage detected