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

Method _pprint_dataclass

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

Source from the content-addressed store, hash-verified

206 stream.write(rep)
207
208 def _pprint_dataclass(self, object, stream, indent, allowance, context, level):
209 # Lazy import to improve module import time
210 from dataclasses import fields as dataclass_fields
211
212 cls_name = object.__class__.__name__
213 indent += len(cls_name) + 1
214 items = [(f.name, getattr(object, f.name)) for f in dataclass_fields(object) if f.repr]
215 stream.write(cls_name + '(')
216 self._format_namespace_items(items, stream, indent, allowance, context, level)
217 stream.write(')')
218
219 _dispatch = {}
220

Callers 1

_formatMethod · 0.95

Calls 4

lenFunction · 0.85
getattrFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected