MCPcopy Index your code
hub / github.com/python/cpython / loadmap

Function loadmap

Tools/unicode/genmap_support.py:183–198  ·  view source on GitHub ↗
(fo, natcol=0, unicol=1, sbcs=0)

Source from the content-addressed store, hash-verified

181
182
183def 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

Callers 5

mainFunction · 0.85
mainFunction · 0.85
load_big5_mapFunction · 0.85
load_cp950_mapFunction · 0.85
mainFunction · 0.85

Calls 4

seekMethod · 0.45
stripMethod · 0.45
splitMethod · 0.45
setdefaultMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…