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

Method _pprint_set

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

Source from the content-addressed store, hash-verified

266 _dispatch[tuple.__repr__] = _pprint_tuple
267
268 def _pprint_set(self, object, stream, indent, allowance, context, level):
269 if not len(object):
270 stream.write(repr(object))
271 return
272 typ = object.__class__
273 if typ is set:
274 stream.write('{')
275 endchar = '}'
276 else:
277 stream.write(typ.__name__ + '({')
278 endchar = '})'
279 indent += len(typ.__name__) + 1
280 object = sorted(object, key=_safe_key)
281 self._format_items(object, stream, indent, allowance + len(endchar),
282 context, level)
283 stream.write(endchar)
284
285 _dispatch[set.__repr__] = _pprint_set
286 _dispatch[frozenset.__repr__] = _pprint_set

Callers

nothing calls this directly

Calls 5

_format_itemsMethod · 0.95
lenFunction · 0.85
reprFunction · 0.85
sortedFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected