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

Function _dict_pprinter_factory

IPython/lib/pretty.py:590–609  ·  view source on GitHub ↗

Factory that returns a pprint function used by the default pprint of dicts and dict proxies.

(start, end)

Source from the content-addressed store, hash-verified

588
589
590def _dict_pprinter_factory(start, end):
591 """
592 Factory that returns a pprint function used by the default pprint of
593 dicts and dict proxies.
594 """
595 def inner(obj, p, cycle):
596 if cycle:
597 return p.text('{...}')
598 step = len(start)
599 p.begin_group(step, start)
600 keys = obj.keys()
601 for idx, key in p._enumerate(keys):
602 if idx:
603 p.text(',')
604 p.breakable()
605 p.pretty(key)
606 p.text(': ')
607 p.pretty(obj[key])
608 p.end_group(step, end)
609 return inner
610
611
612def _super_pprint(obj, p, cycle):

Callers 1

pretty.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected