MCPcopy Index your code
hub / github.com/RustPython/RustPython / update_catalog_snapshots

Function update_catalog_snapshots

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

Source from the content-addressed store, hash-verified

137
138
139def update_catalog_snapshots():
140 for po_file in data_dir.glob('*.po'):
141 mo_file = po_file.with_suffix('.mo')
142 compile_messages(po_file, mo_file)
143 # Create a human-readable JSON file which is
144 # easier to review than the binary .mo file.
145 with open(mo_file, 'rb') as f:
146 translations = GNUTranslations(f)
147 catalog_file = po_file.with_suffix('.json')
148 with open(catalog_file, 'w') as f:
149 data = translations._catalog.items()
150 data = sorted(data, key=lambda x: (isinstance(x[0], tuple), x[0]))
151 json.dump(data, f, indent=4)
152 f.write('\n')
153
154
155if __name__ == '__main__':

Callers 1

test_msgfmt.pyFile · 0.85

Calls 10

GNUTranslationsClass · 0.90
compile_messagesFunction · 0.85
sortedFunction · 0.85
isinstanceFunction · 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