| } | } | ||||
| def parse_ucd_data(ucd_rootdir, dataset): | def parse_ucd_data(ucd_rootdir, dataset): | ||||
| keys = data_items[dataset] | |||||
| keys = data_items[dataset] | |||||
| first = None | |||||
| with open(os.path.join(ucd_rootdir, '%s.txt' % dataset)) as f: | with open(os.path.join(ucd_rootdir, '%s.txt' % dataset)) as f: | ||||
| for line in f: | for line in f: | ||||
| line = line.replace('\n', '').split('#')[0] | line = line.replace('\n', '').split('#')[0] | ||||
| linedata = [' '.join(x.split()) for x in line.split(';')] | linedata = [' '.join(x.split()) for x in line.split(';')] | ||||
| if len(linedata) == len(keys): | if len(linedata) == len(keys): | ||||
| if linedata[1].endswith(', First>'): | |||||
| first = linedata | |||||
| continue | |||||
| if linedata[1].endswith(', Last>'): | |||||
| linedata[0] = '%s..%s' % (first[0], linedata[0]) | |||||
| linedata[1] = linedata[1].replace(', Last>', '').replace('<', '') | |||||
| first = None | |||||
| data = {} | data = {} | ||||
| for keydata, value in zip(keys, linedata): | for keydata, value in zip(keys, linedata): | ||||
| key, typemap = keydata | key, typemap = keydata |