Skip to content

Commit

Permalink
Merge pull request #120 from climatepolicyradar/bugfix/indent
Browse files Browse the repository at this point in the history
Updating the indent of saved jsons.
  • Loading branch information
THOR300 authored Nov 14, 2023
2 parents 77c8fec + 74423fa commit 235528f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cli/parse_htmls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion cli/parse_no_content_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 2 additions & 2 deletions cli/parse_pdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion cli/translate_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit 235528f

Please sign in to comment.