Skip to content

Commit

Permalink
Merge pull request #35 from climatepolicyradar/feature/pods-1317-bugf…
Browse files Browse the repository at this point in the history
…ix-for-hugging-face-sync

Updating the conditional of whether to assign a page number.
  • Loading branch information
THOR300 authored Jun 3, 2024
2 parents e68dda6 + 772b9af commit 00d8182
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cpr_sdk/parser_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ def to_passage_level_json(self) -> list[dict[str, Any]]:
]

for passage in passages_array:
page_number = passage.get("page_number")
page_number = passage.get("page_number", None)
passage[PDF_PAGE_METADATA_KEY] = (
self.get_page_metadata_by_page_number(page_number)
if page_number
if page_number is not None
else None
)

Expand Down
2 changes: 1 addition & 1 deletion src/cpr_sdk/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
_MAJOR = "1"
_MINOR = "1"
_PATCH = "4"
_PATCH = "5"
_SUFFIX = ""

VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR)
Expand Down
1 change: 1 addition & 0 deletions tests/test_parser_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def test_to_passage_level_json_method(
)

if passage["document_content_type"] == CONTENT_TYPE_PDF:
assert passage[PDF_PAGE_METADATA_KEY] is not None
assert set(passage["pdf_data"].keys()) == expected_pdf_data_fields
elif passage["document_content_type"] == CONTENT_TYPE_HTML:
assert set(passage["html_data"].keys()) == expected_html_data_fields
Expand Down

0 comments on commit 00d8182

Please sign in to comment.