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

Method _format_namespace_items

Lib/pprint.py:412–429  ·  view source on GitHub ↗
(self, items, stream, indent, allowance, context, level)

Source from the content-addressed store, hash-verified

410 write(delimnl)
411
412 def _format_namespace_items(self, items, stream, indent, allowance, context, level):
413 write = stream.write
414 delimnl = ',\n' + ' ' * indent
415 last_index = len(items) - 1
416 for i, (key, ent) in enumerate(items):
417 last = i == last_index
418 write(key)
419 write('=')
420 if id(ent) in context:
421 # Special-case representation of recursion to match standard
422 # recursive dataclass repr.
423 write("...")
424 else:
425 self._format(ent, stream, indent + len(key) + 1,
426 allowance if last else 1,
427 context, level)
428 if not last:
429 write(delimnl)
430
431 def _format_items(self, items, stream, indent, allowance, context, level):
432 write = stream.write

Callers 2

_pprint_dataclassMethod · 0.95

Calls 5

_formatMethod · 0.95
lenFunction · 0.85
enumerateFunction · 0.85
idFunction · 0.85
writeFunction · 0.70

Tested by

no test coverage detected