Skip to content
Snippets Groups Projects
Commit 8afd265f authored by Christophe Benz's avatar Christophe Benz
Browse files

Do not pretty-print huge files

parent 898abf9a
No related branches found
No related tags found
No related merge requests found
Pipeline #1095 failed with stage
in 5 minutes and 28 seconds
......@@ -176,7 +176,7 @@ def main():
for metadata_zip_info in metadata_zip_file.infolist():
if metadata_zip_info.filename.endswith('.xml'):
with metadata_zip_file.open(metadata_zip_info) as metadata_file:
xml_tree = etree.parse(metadata_file, parser=xml_parser)
xml_tree = etree.parse(metadata_file)
xml_file_path = os.path.join(metadata_dir, metadata_zip_info.filename)
write_normalized_xml_element(xml_file_path, xml_tree.getroot())
else:
......@@ -199,7 +199,7 @@ def main():
for data_zip_info in data_zip_file.infolist():
if data_zip_info.filename.endswith('.xml'):
with data_zip_file.open(data_zip_info) as data_file:
xml_tree = etree.parse(data_file, parser=xml_parser)
xml_tree = etree.parse(data_file)
xml_file_path = os.path.join(dataset_dir, data_zip_info.filename)
write_normalized_xml_element(xml_file_path, xml_tree.getroot())
else:
......@@ -251,7 +251,7 @@ def write_normalized_xml_element(xml_file_path, xml_element):
prepared_element.text = '1111-11-11T11:11:11'
with open(xml_file_path, 'wb') as xml_file:
etree.ElementTree(xml_element).write(xml_file, encoding='utf-8', pretty_print=True, xml_declaration=True)
etree.ElementTree(xml_element).write(xml_file, encoding='utf-8', xml_declaration=True)
if __name__ == '__main__':
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment