MCPcopy Index your code
hub / github.com/python/cpython / _pprint_counter

Method _pprint_counter

Lib/pprint.py:657–673  ·  view source on GitHub ↗
(self, object, stream, indent, allowance, context, level)

Source from the content-addressed store, hash-verified

655 _dispatch[_collections.defaultdict.__repr__] = _pprint_default_dict
656
657 def _pprint_counter(self, object, stream, indent, allowance, context, level):
658 if not len(object):
659 stream.write(repr(object))
660 return
661 cls = object.__class__
662 stream.write(self._format_block_start(cls.__name__ + '({', indent))
663 self._write_indent_padding(stream.write)
664 items = object.most_common()
665 self._format_dict_items(
666 items,
667 stream,
668 self._child_indent(indent, len(cls.__name__) + 1),
669 allowance + 2,
670 context,
671 level,
672 )
673 stream.write(self._format_block_end('})', indent))
674
675 _dispatch[_collections.Counter.__repr__] = _pprint_counter
676

Callers

nothing calls this directly

Calls 7

_format_block_startMethod · 0.95
_write_indent_paddingMethod · 0.95
_format_dict_itemsMethod · 0.95
_child_indentMethod · 0.95
_format_block_endMethod · 0.95
most_commonMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected