def parse_csv(self, infile, delimiter="<STR_LIT:U+002C>", decimal_sep="<STR_LIT:.>"):
keys = ('<STR_LIT:name>','<STR_LIT:type>','<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT:size>',<EOL>'<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>',<EOL>'<STR_LIT>','<STR_LIT:text>','<STR_LIT>', '<STR_LIT>')<EOL>self.elements = []<EOL>self.pg_no = <NUM_LIT:0><EOL>if not PY3K:<EOL><INDENT>f = open(infile, '<STR_LIT:rb>')<EOL><DEDENT>else:<EOL><INDENT>f = open(infile)<EOL><DEDENT>for row in csv.reader(f, delimiter=delimiter):<EOL><INDENT>kargs = {}<EOL>for i,v in enumerate(row):<EOL><INDENT>if not v.startswith("<STR_LIT:'>") and decimal_sep!="<STR_LIT:.>": <EOL><INDENT>v = v.replace(decimal_sep,"<STR_LIT:.>")<EOL><DEDENT>else:<EOL><INDENT>v = v<EOL><DEDENT>if v=='<STR_LIT>':<EOL><INDENT>v = None<EOL><DEDENT>else:<EOL><INDENT>v = eval(v.strip())<EOL><DEDENT>kargs[keys[i]] = v<EOL><DEDENT>self.elements.append(kargs)<EOL><DEDENT>self.keys = [v['<STR_LIT:name>'].lower() for v in self.elements]<EOL>
Parse template format csv file and create elements dict