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

Method _pprint_simplenamespace

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

Source from the content-addressed store, hash-verified

378 _dispatch[_types.MappingProxyType.__repr__] = _pprint_mappingproxy
379
380 def _pprint_simplenamespace(self, object, stream, indent, allowance, context, level):
381 if type(object) is _types.SimpleNamespace:
382 # The SimpleNamespace repr is "namespace" instead of the class
383 # name, so we do the same here. For subclasses; use the class name.
384 cls_name = 'namespace'
385 else:
386 cls_name = object.__class__.__name__
387 indent += len(cls_name) + 1
388 items = object.__dict__.items()
389 stream.write(cls_name + '(')
390 self._format_namespace_items(items, stream, indent, allowance, context, level)
391 stream.write(')')
392
393 _dispatch[_types.SimpleNamespace.__repr__] = _pprint_simplenamespace
394

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
itemsMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected