Skip to content

Commit

Permalink
Improve if/else logic slightly and reduce complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Oct 29, 2024
1 parent 5cd0861 commit 07aaa04
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ppa/archive/gale.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,13 @@ def get_item_pages(self, item_id, gale_record=None):
ocr_text = None
if local_ocr_text:
ocr_text = local_ocr_text.get(page_number)
# if we have content, set local ocr tag
# if we have content, set tag to indicate local ocr
if ocr_text:
tags = ["local_ocr"]

# we expect empty string if page is present but empty
# (e.g., for blank pages)

# ocr text = None indicates not content not present in the data
if ocr_text is None:
# ocr text = None indicates page is not present in the data
elif ocr_text is None:
logger.warning(f"No local OCR for {item_id} {page_number}")
# try getting the ocr from the gale api result
# (may still be empty, since some pages have no text)
Expand Down

0 comments on commit 07aaa04

Please sign in to comment.