From 74423fa39ed5753d6e8eb0ec911c956d0f2dfbb0 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 14 Nov 2023 13:13:58 +0000 Subject: [PATCH] Updating the indent of saved jsons." --- cli/parse_htmls.py | 4 ++-- cli/parse_no_content_type.py | 2 +- cli/parse_pdfs.py | 4 ++-- cli/translate_outputs.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/parse_htmls.py b/cli/parse_htmls.py index 7604854..d5473d5 100644 --- a/cli/parse_htmls.py +++ b/cli/parse_htmls.py @@ -48,7 +48,7 @@ def copy_input_to_output_html( pdf_data=None, ) - output_path.write_text(blank_output.model_dump_json(indent=4)) + output_path.write_text(blank_output.model_dump_json(indent=2)) _LOGGER.info( "Blank html output saved.", @@ -109,7 +109,7 @@ def run_html_parser( parsed_html = html_parser.parse(task).detect_and_set_languages() try: - output_path.write_text(parsed_html.model_dump_json(indent=4)) + output_path.write_text(parsed_html.model_dump_json(indent=2)) except cloudpathlib.exceptions.OverwriteNewerCloudError as e: _LOGGER.error( "Attempted write to s3, received OverwriteNewerCloudError and therefore skipping.", diff --git a/cli/parse_no_content_type.py b/cli/parse_no_content_type.py index 1e9d25c..97a4e7b 100644 --- a/cli/parse_no_content_type.py +++ b/cli/parse_no_content_type.py @@ -43,7 +43,7 @@ def process_documents_with_no_content_type( output_path = output_dir / f"{task.document_id}.json" try: - output_path.write_text(output.model_dump_json(indent=4)) + output_path.write_text(output.model_dump_json(indent=2)) except cloudpathlib.exceptions.OverwriteNewerCloudError as e: _LOGGER.error( "Attempted write to s3, received OverwriteNewerCloudError and therefore skipping.", diff --git a/cli/parse_pdfs.py b/cli/parse_pdfs.py index 06b92bf..256a976 100644 --- a/cli/parse_pdfs.py +++ b/cli/parse_pdfs.py @@ -65,7 +65,7 @@ def copy_input_to_output_pdf( ) try: - output_path.write_text(blank_output.model_dump_json(indent=4)) + output_path.write_text(blank_output.model_dump_json(indent=2)) _LOGGER.info( "Blank output saved.", extra={ @@ -452,7 +452,7 @@ def parse_file( ) try: - output_path.write_text(document.model_dump_json(indent=4)) + output_path.write_text(document.model_dump_json(indent=2)) except cloudpathlib.exceptions.OverwriteNewerCloudError as e: _LOGGER.error( "Attempted write to s3, received OverwriteNewerCloudError and " diff --git a/cli/translate_outputs.py b/cli/translate_outputs.py index a14a6f6..a3a76df 100644 --- a/cli/translate_outputs.py +++ b/cli/translate_outputs.py @@ -164,7 +164,7 @@ def _translate_to_target_languages( try: output_path.write_text( # type: ignore - translated_parser_output.model_dump_json(indent=4) + translated_parser_output.model_dump_json(indent=2) ) _LOGGER.info( "Saved translated output for document.",