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

Function main_tw

Tools/unicode/genmap_tchinese.py:153–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151
152
153def main_tw():
154 big5decmap, big5encmap = load_big5_map()
155 cp950decmap, cp950encmap = load_cp950_map()
156
157 # CP950 extends Big5, and the codec can use the Big5 lookup tables
158 # for most entries. So the CP950 tables should only include entries
159 # that are not in Big5:
160 for c1, m in list(cp950encmap.items()):
161 for c2, code in list(m.items()):
162 if (c1 in big5encmap and c2 in big5encmap[c1]
163 and big5encmap[c1][c2] == code):
164 del cp950encmap[c1][c2]
165 for c1, m in list(cp950decmap.items()):
166 for c2, code in list(m.items()):
167 if (c1 in big5decmap and c2 in big5decmap[c1]
168 and big5decmap[c1][c2] == code):
169 del cp950decmap[c1][c2]
170
171 with open('mappings_tw.h', 'w') as fp:
172 print_autogen(fp, os.path.basename(__file__))
173 write_big5_maps(fp, 'BIG5', 'big5', big5decmap, big5encmap)
174 write_big5_maps(fp, 'CP950', 'cp950ext', cp950decmap, cp950encmap)
175
176
177def write_big5_maps(fp, display_name, table_name, decode_map, encode_map):

Callers 1

genmap_tchinese.pyFile · 0.85

Calls 8

load_big5_mapFunction · 0.85
load_cp950_mapFunction · 0.85
listClass · 0.85
print_autogenFunction · 0.85
write_big5_mapsFunction · 0.85
openFunction · 0.50
itemsMethod · 0.45
basenameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…