(fo, natcol=0, unicol=1, sbcs=0)
| 181 | |
| 182 | |
| 183 | def loadmap(fo, natcol=0, unicol=1, sbcs=0): |
| 184 | print("Loading from", fo) |
| 185 | fo.seek(0, 0) |
| 186 | decmap = {} |
| 187 | for line in fo: |
| 188 | line = line.split('#', 1)[0].strip() |
| 189 | if not line or len(line.split()) < 2: |
| 190 | continue |
| 191 | |
| 192 | row = [eval(e) for e in line.split()] |
| 193 | loc, uni = row[natcol], row[unicol] |
| 194 | if loc >= 0x100 or sbcs: |
| 195 | decmap.setdefault((loc >> 8), {}) |
| 196 | decmap[(loc >> 8)][(loc & 0xff)] = uni |
| 197 | |
| 198 | return decmap |
no test coverage detected
searching dependent graphs…