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

Method writeDict

scripts/jsgenerator.py:33–45  ·  view source on GitHub ↗

Write dictionary as a JavaScript object with the given name. If printValues is False, just output keys with undefined values.

(self, dict, name, printValues = True)

Source from the content-addressed store, hash-verified

31 return '}'
32
33 def writeDict(self, dict, name, printValues = True):
34 """Write dictionary as a JavaScript object with the given name.
35 If printValues is False, just output keys with undefined
36 values."""
37
38 write(self.beginDict(name), file=self.outFile)
39 for key in sorted(dict):
40 if printValues:
41 value = undefquote(dict[key])
42 else:
43 value = 'undefined'
44 write(f'{enquote(key)} : {value},', file=self.outFile)
45 write(self.endDict(), file=self.outFile)
46
47 def writeList(self, l, name):
48 """Write list l as a JavaScript hash with the given name"""

Callers 2

writeListMethod · 0.95
endFileMethod · 0.95

Calls 5

beginDictMethod · 0.95
endDictMethod · 0.95
writeFunction · 0.90
enquoteFunction · 0.90
undefquoteFunction · 0.70

Tested by

no test coverage detected