From d86b5b9d0726175aa374dad9bdb7e3b30e95399b Mon Sep 17 00:00:00 2001 From: black-isort-bot Date: Sat, 20 Apr 2024 21:37:08 +0000 Subject: [PATCH] [skip ci]: black/isort --- PyPDFForm/filler.py | 6 ++++-- PyPDFForm/patterns.py | 8 ++++---- tests/conftest.py | 4 +++- tests/scenario/test_issues.py | 6 +----- tests/test_functional.py | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/PyPDFForm/filler.py b/PyPDFForm/filler.py index 67638164..3d564a10 100644 --- a/PyPDFForm/filler.py +++ b/PyPDFForm/filler.py @@ -16,10 +16,10 @@ from .image import any_image_to_jpg from .middleware.checkbox import Checkbox from .middleware.dropdown import Dropdown +from .middleware.image import Image from .middleware.radio import Radio from .middleware.signature import Signature from .middleware.text import Text -from .middleware.image import Image from .patterns import (simple_flatten_generic, simple_flatten_radio, simple_update_checkbox_value, simple_update_dropdown_value, simple_update_radio_value, @@ -75,7 +75,9 @@ def fill( if stream is not None: any_image_to_draw = True stream = any_image_to_jpg(stream) - x, y, width, height = get_draw_image_coordinates_resolutions(_widget) + x, y, width, height = get_draw_image_coordinates_resolutions( + _widget + ) images_to_draw[page].append( [ stream, diff --git a/PyPDFForm/patterns.py b/PyPDFForm/patterns.py index eef4f6a8..a1258d83 100644 --- a/PyPDFForm/patterns.py +++ b/PyPDFForm/patterns.py @@ -4,14 +4,14 @@ from pypdf.generic import (DictionaryObject, NameObject, NumberObject, TextStringObject) -from .constants import (A, AP, AS, CA, DA, FT, MK, READ_ONLY, Btn, Ch, D, Ff, Off, - Opt, Parent, Q, Sig, Subtype, T, Tx, V, Widget, JS, - IMAGE_FIELD_IDENTIFIER) +from .constants import (AP, AS, CA, DA, FT, IMAGE_FIELD_IDENTIFIER, JS, MK, + READ_ONLY, A, Btn, Ch, D, Ff, Off, Opt, Parent, Q, Sig, + Subtype, T, Tx, V, Widget) from .middleware.checkbox import Checkbox from .middleware.dropdown import Dropdown +from .middleware.image import Image from .middleware.radio import Radio from .middleware.signature import Signature -from .middleware.image import Image from .middleware.text import Text WIDGET_TYPE_PATTERNS = [ diff --git a/tests/conftest.py b/tests/conftest.py index a6822ab6..5822be74 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -183,7 +183,9 @@ def sample_template_with_dropdown(pdf_samples): @pytest.fixture def sample_template_with_image_field(pdf_samples): - with open(os.path.join(pdf_samples, "sample_template_with_image_field.pdf"), "rb+") as f: + with open( + os.path.join(pdf_samples, "sample_template_with_image_field.pdf"), "rb+" + ) as f: return f.read() diff --git a/tests/scenario/test_issues.py b/tests/scenario/test_issues.py index 483d08bf..6c5c156e 100644 --- a/tests/scenario/test_issues.py +++ b/tests/scenario/test_issues.py @@ -126,11 +126,7 @@ def test_encrypted_edit_pdf_form(issue_pdf_directory, request): def test_fill_image(issue_pdf_directory, image_samples, request): obj = PdfWrapper(os.path.join(issue_pdf_directory, "560.pdf")) - obj = obj.fill( - { - "ImageSign": os.path.join(image_samples, "sample_image.jpg") - } - ) + obj = obj.fill({"ImageSign": os.path.join(image_samples, "sample_image.jpg")}) expected_path = os.path.join(issue_pdf_directory, "560_expected.pdf") request.config.results["expected_path"] = expected_path request.config.results["stream"] = obj.read() diff --git a/tests/test_functional.py b/tests/test_functional.py index f433d427..5be726ef 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -612,13 +612,13 @@ def test_radio_change_size_and_button_style( assert obj.stream == expected -def test_fill_image(sample_template_with_image_field, image_samples, pdf_samples, request): +def test_fill_image( + sample_template_with_image_field, image_samples, pdf_samples, request +): expected_path = os.path.join(pdf_samples, "sample_filled_image.pdf") with open(expected_path, "rb+") as f: obj = PdfWrapper(sample_template_with_image_field).fill( - { - "image_1": os.path.join(image_samples, "sample_image.jpg") - }, + {"image_1": os.path.join(image_samples, "sample_image.jpg")}, ) request.config.results["expected_path"] = expected_path