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

Function update_catalog_snapshots

Lib/test/test_tools/test_msgfmt.py:274–287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

272
273
274def update_catalog_snapshots():
275 for po_file in data_dir.glob('*.po'):
276 mo_file = po_file.with_suffix('.mo')
277 compile_messages(po_file, mo_file)
278 # Create a human-readable JSON file which is
279 # easier to review than the binary .mo file.
280 with open(mo_file, 'rb') as f:
281 translations = GNUTranslations(f)
282 catalog_file = po_file.with_suffix('.json')
283 with open(catalog_file, 'w') as f:
284 data = translations._catalog.items()
285 data = sorted(data, key=lambda x: (isinstance(x[0], tuple), x[0]))
286 json.dump(data, f, indent=4)
287 f.write('\n')
288
289
290if __name__ == '__main__':

Callers 1

test_msgfmt.pyFile · 0.85

Calls 8

GNUTranslationsClass · 0.90
compile_messagesFunction · 0.85
openFunction · 0.50
globMethod · 0.45
with_suffixMethod · 0.45
itemsMethod · 0.45
dumpMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…