MCPcopy Index your code
hub / github.com/RustPython/RustPython / _pprint_counter

Method _pprint_counter

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

Source from the content-addressed store, hash-verified

499 _dispatch[_collections.defaultdict.__repr__] = _pprint_default_dict
500
501 def _pprint_counter(self, object, stream, indent, allowance, context, level):
502 if not len(object):
503 stream.write(repr(object))
504 return
505 cls = object.__class__
506 stream.write(cls.__name__ + '({')
507 if self._indent_per_level > 1:
508 stream.write((self._indent_per_level - 1) * ' ')
509 items = object.most_common()
510 self._format_dict_items(items, stream,
511 indent + len(cls.__name__) + 1, allowance + 2,
512 context, level)
513 stream.write('})')
514
515 _dispatch[_collections.Counter.__repr__] = _pprint_counter
516

Callers

nothing calls this directly

Calls 5

_format_dict_itemsMethod · 0.95
lenFunction · 0.85
reprFunction · 0.85
most_commonMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected