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

Function _seq_pprinter_factory

IPython/lib/pretty.py:636–655  ·  view source on GitHub ↗

Factory that returns a pprint function useful for sequences. Used by the default pprint for tuples and lists.

(start, end)

Source from the content-addressed store, hash-verified

634
635
636def _seq_pprinter_factory(start, end):
637 """
638 Factory that returns a pprint function useful for sequences. Used by
639 the default pprint for tuples and lists.
640 """
641 def inner(obj, p, cycle):
642 if cycle:
643 return p.text(start + '...' + end)
644 step = len(start)
645 p.begin_group(step, start)
646 for idx, x in p._enumerate(obj):
647 if idx:
648 p.text(',')
649 p.breakable()
650 p.pretty(x)
651 if len(obj) == 1 and isinstance(obj, tuple):
652 # Special case for 1-item tuples.
653 p.text(',')
654 p.end_group(step, end)
655 return inner
656
657
658def _set_pprinter_factory(start, end):

Callers 1

pretty.pyFile · 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…