| 7 | encoding = 'utf-8' |
| 8 | |
| 9 | def __init__(self, fs): |
| 10 | |
| 11 | self.keynames = [] |
| 12 | self.chardefs = {} |
| 13 | |
| 14 | for line in fs: |
| 15 | |
| 16 | line = line.strip() |
| 17 | |
| 18 | key, root = safeSplit(line) |
| 19 | key = key.strip() |
| 20 | |
| 21 | rootlist = rootSplit(root) |
| 22 | |
| 23 | if len(rootlist) > 0: |
| 24 | for rootstr in rootlist: |
| 25 | stripstr = rootstr.strip() |
| 26 | try: |
| 27 | self.chardefs[key].append(stripstr) |
| 28 | except KeyError: |
| 29 | self.chardefs[key] = [stripstr] |
| 30 | |
| 31 | if key not in self.keynames: |
| 32 | self.keynames.append(key) |
| 33 | |
| 34 | def __del__(self): |
| 35 | del self.keynames |