Skip to content

Commit

Permalink
Merge pull request #610 from chinapandaman/PPF-609
Browse files Browse the repository at this point in the history
PPF-609: add cache to get_widgets_by_page
  • Loading branch information
chinapandaman authored May 4, 2024
2 parents 8711cfd + 39a98dc commit 6c89a97
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions PyPDFForm/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""Contains helpers for generic template related processing."""

from functools import lru_cache
from sys import maxsize
from typing import Dict, List, Tuple, Union

Expand Down Expand Up @@ -138,6 +139,7 @@ def update_text_field_attributes(
)


@lru_cache()
def get_widgets_by_page(pdf: bytes) -> Dict[int, List[dict]]:
"""Iterates through a PDF and returns all widgets found grouped by page."""

Expand Down
2 changes: 1 addition & 1 deletion scripts/new_pdf_samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ if [[ "$VIRTUAL_ENV" == "" ]]; then
source "./venv/bin/activate"
fi

pytest -s --regenerate=1
pytest --regenerate=1
2 changes: 1 addition & 1 deletion scripts/pdf_diffs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if [[ "$VIRTUAL_ENV" == "" ]]; then
source "./venv/bin/activate"
fi

pytest -s --regenerate=1
pytest --regenerate=1

BEFORE=()

Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ if [[ "$VIRTUAL_ENV" == "" ]]; then
source "./venv/bin/activate"
fi

coverage run -m pytest -s && coverage report --fail-under=100
coverage run -m pytest && coverage report --fail-under=100

0 comments on commit 6c89a97

Please sign in to comment.