From f0ac3920f10e493240f4558704a0d8661d770e46 Mon Sep 17 00:00:00 2001 From: black-isort-bot Date: Mon, 23 Dec 2024 21:07:15 +0000 Subject: [PATCH] [skip ci]: black/isort --- PyPDFForm/middleware/radio.py | 7 +++++-- PyPDFForm/patterns.py | 9 +++------ PyPDFForm/template.py | 4 ++-- tests/scenario/test_issues.py | 12 +++++++----- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/PyPDFForm/middleware/radio.py b/PyPDFForm/middleware/radio.py index 762a0d31..48d868ec 100644 --- a/PyPDFForm/middleware/radio.py +++ b/PyPDFForm/middleware/radio.py @@ -22,8 +22,11 @@ def __init__( def schema_definition(self) -> dict: """Json schema definition of the radiobutton.""" - return {"maximum": self.number_of_options - 1, - **super().schema_definition, "type": "integer"} + return { + "maximum": self.number_of_options - 1, + **super().schema_definition, + "type": "integer", + } @property def sample_value(self) -> int: diff --git a/PyPDFForm/patterns.py b/PyPDFForm/patterns.py index 3676f915..b5a31b66 100644 --- a/PyPDFForm/patterns.py +++ b/PyPDFForm/patterns.py @@ -5,8 +5,8 @@ TextStringObject) from .constants import (AP, AS, CA, DA, DV, FT, IMAGE_FIELD_IDENTIFIER, JS, MK, - MULTILINE, READ_ONLY, A, Btn, Ch, Ff, N, Off, Opt, - Parent, Q, Sig, T, Tx, TU, V, Yes) + MULTILINE, READ_ONLY, TU, A, Btn, Ch, Ff, N, Off, Opt, + Parent, Q, Sig, T, Tx, V, Yes) from .middleware.checkbox import Checkbox from .middleware.dropdown import Dropdown from .middleware.image import Image @@ -68,10 +68,7 @@ {Parent: {T: True}}, ] -WIDGET_DESCRIPTION_PATTERNS = [ - {TU: True}, - {Parent: {TU: True}} -] +WIDGET_DESCRIPTION_PATTERNS = [{TU: True}, {Parent: {TU: True}}] DROPDOWN_CHOICE_PATTERNS = [ {Opt: True}, diff --git a/PyPDFForm/template.py b/PyPDFForm/template.py index 70c5e054..13fecdc4 100644 --- a/PyPDFForm/template.py +++ b/PyPDFForm/template.py @@ -21,8 +21,8 @@ from .middleware.text import Text from .patterns import (BUTTON_STYLE_PATTERNS, DROPDOWN_CHOICE_PATTERNS, TEXT_FIELD_FLAG_PATTERNS, WIDGET_ALIGNMENT_PATTERNS, - WIDGET_KEY_PATTERNS, WIDGET_TYPE_PATTERNS, WIDGET_DESCRIPTION_PATTERNS, - update_annotation_name) + WIDGET_DESCRIPTION_PATTERNS, WIDGET_KEY_PATTERNS, + WIDGET_TYPE_PATTERNS, update_annotation_name) from .utils import find_pattern_match, stream_to_io, traverse_pattern from .watermark import create_watermarks_and_draw diff --git a/tests/scenario/test_issues.py b/tests/scenario/test_issues.py index 6ba69151..d2959ee2 100644 --- a/tests/scenario/test_issues.py +++ b/tests/scenario/test_issues.py @@ -4,9 +4,9 @@ import os from PyPDFForm import PdfWrapper +from PyPDFForm.constants import TU, Parent from PyPDFForm.middleware.radio import Radio -from PyPDFForm.template import get_widgets_by_page, get_widget_key -from PyPDFForm.constants import Parent, TU +from PyPDFForm.template import get_widget_key, get_widgets_by_page def test_pdf_form_with_pages_without_widgets(issue_pdf_directory, request): @@ -308,11 +308,11 @@ def test_get_desc_in_schema(issue_pdf_directory): assert ( obj.schema["properties"]["P1_checkbox4[0]"]["description"] - == "Part 1. Information About You. Your Full Name. 4. Has your name legally changed since the issuance of your Permanent Resident Card? Select Yes. (Proceed to Item Numbers 5. A. through 5. C.)." # noqa + == "Part 1. Information About You. Your Full Name. 4. Has your name legally changed since the issuance of your Permanent Resident Card? Select Yes. (Proceed to Item Numbers 5. A. through 5. C.)." # noqa ) assert ( obj.schema["properties"]["P1_checkbox4[1]"]["description"] - == "Part 1. Information About You. Your Full Name. 4. Has your name legally changed since the issuance of your Permanent Resident Card? Select No (Proceed to Item Numbers 6. A. through 6. I.)." # noqa + == "Part 1. Information About You. Your Full Name. 4. Has your name legally changed since the issuance of your Permanent Resident Card? Select No (Proceed to Item Numbers 6. A. through 6. I.)." # noqa ) assert ( obj.schema["properties"]["P1_checkbox4[2]"]["description"] @@ -333,4 +333,6 @@ def test_get_desc_in_schema_radio(issue_pdf_directory): key = get_widget_key(widget) if key in keys_to_check: - assert widget[Parent][TU] == obj.schema["properties"][key]["description"] + assert ( + widget[Parent][TU] == obj.schema["properties"][key]["description"] + )