Write dictionary as a Python dictionary with the given name. If printValues is False, just output keys with None values.
(self, dict, name, printValues = True)
| 25 | return '}' |
| 26 | |
| 27 | def writeDict(self, dict, name, printValues = True): |
| 28 | """Write dictionary as a Python dictionary with the given name. |
| 29 | If printValues is False, just output keys with None values.""" |
| 30 | |
| 31 | write(self.beginDict(name), file=self.outFile) |
| 32 | for key in sorted(dict): |
| 33 | if printValues: |
| 34 | value = enquote(dict[key]) |
| 35 | else: |
| 36 | value = 'None' |
| 37 | write(f'{enquote(key)} : {value},', file=self.outFile) |
| 38 | write(self.endDict(), file=self.outFile) |
| 39 | |
| 40 | def writeList(self, l, name): |
| 41 | """Write list l as a Ruby hash with the given name""" |