Why not do it in python?
Import the file using python (which does the parsing), created the dict using your knowledge of the data structure), then use pprint.pprint to output a new python file?
==== Edit ====
An idea that might work is this, assuming the code actually runs. Add some code to each method that has these Lists of Lists (LoLs) that looks something like this
# Unique Marker #1 Start
self.myValues = [
[<str literal>, <str literal>, <int literal>, <variable name>, <arbitrary literal>, <boolean literal>],
]
fixValues(self.myValues, "self.myValues", "Unique Marker 1")
# Unique Marker #1 End
Then fixValues
looks like this:
def fixValues(lols, varname, markertext):
lodicts = Whatever you need to do to convert the LoLs into a LoDs
content = open(__file__, "rt").read()
start = content.index(markertext) # Need to increment this to EOL
end = content.index(markertext, start+len(markertext)) # Need to decrement this to BOL
# Try it out on a temp file
f = open(__file__, "wt")
f.write(content[0:start])
f.write("%s%s = ", " "*indent, varname)
pprint.pprint(lodicts, f)
f.write(content[end+len(markertext):]
f.close()
You need to figure out the indent of for varname by counting spaces before it in the line it belongs on, some other things like that, and you probably want to write to a temp file while testing....