MCPcopy
hub / github.com/KhronosGroup/Vulkan-Docs / _pprint_dataclass

Method _pprint_dataclass

scripts/print_vulkan_object.py:43–57  ·  view source on GitHub ↗
(self, object, stream, indent, allowance, context, level)

Source from the content-addressed store, hash-verified

41 self._entity_depth = 0 # >0 means we are currently inside an entity
42
43 def _pprint_dataclass(self, object, stream, indent, allowance, context, level):
44 if isinstance(object, _ENTITY_TYPES):
45 if self._entity_depth > 0:
46 # Compact reference: just print the type and name
47 name = getattr(object, 'name', None)
48 label = repr(name) if name is not None else '?'
49 stream.write(f'{object.__class__.__name__}({label})')
50 return
51 self._entity_depth += 1
52 try:
53 super()._pprint_dataclass(object, stream, indent, allowance, context, level)
54 finally:
55 self._entity_depth -= 1
56 else:
57 super()._pprint_dataclass(object, stream, indent, allowance, context, level)
58
59
60class MyGenerator(BaseGenerator):

Callers

nothing calls this directly

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected