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

Function _get_mro

IPython/lib/pretty.py:323–339  ·  view source on GitHub ↗

Get a reasonable method resolution order of a class and its superclasses for both old-style and new-style classes.

(obj_class)

Source from the content-addressed store, hash-verified

321
322
323def _get_mro(obj_class):
324 """ Get a reasonable method resolution order of a class and its superclasses
325 for both old-style and new-style classes.
326 """
327 if not hasattr(obj_class, '__mro__'):
328 # Old-style class. Mix in object to make a fake new-style class.
329 try:
330 obj_class = type(obj_class.__name__, (obj_class, object), {})
331 except TypeError:
332 # Old-style extension type that does not descend from object.
333 # FIXME: try to construct a more thorough MRO.
334 mro = [obj_class]
335 else:
336 mro = obj_class.__mro__[1:-1]
337 else:
338 mro = obj_class.__mro__
339 return mro
340
341
342class RepresentationPrinter(PrettyPrinter):

Callers 2

prettyMethod · 0.85
_type_pprintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…