Skip to content

Commit

Permalink
[skip ci]: black/isort
Browse files Browse the repository at this point in the history
  • Loading branch information
black-isort-bot committed Feb 23, 2023
1 parent 6bdd6ad commit 3062534
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion PyPDFForm/core/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@
ELEMENT_ALIGNMENT_PATTERNS = [
{constants.TEXT_FIELD_ALIGNMENT_IDENTIFIER: True},
{constants.PARENT_KEY: {constants.TEXT_FIELD_ALIGNMENT_IDENTIFIER: True}},
]
]
12 changes: 6 additions & 6 deletions PyPDFForm/core/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from ..middleware.constants import ELEMENT_TYPES
from ..middleware.text import Text
from . import constants, utils
from .patterns import (DROPDOWN_CHOICE_PATTERNS, ELEMENT_KEY_PATTERNS,
ELEMENT_TYPE_PATTERNS, ELEMENT_ALIGNMENT_PATTERNS)
from .patterns import (DROPDOWN_CHOICE_PATTERNS, ELEMENT_ALIGNMENT_PATTERNS,
ELEMENT_KEY_PATTERNS, ELEMENT_TYPE_PATTERNS)


def remove_all_elements(pdf: bytes) -> bytes:
Expand Down Expand Up @@ -234,10 +234,10 @@ def get_draw_text_coordinates(
)
element_value = element_value[:length]
character_paddings = (
element_middleware.character_paddings[:length]
if element_middleware.character_paddings is not None
else element_middleware.character_paddings
)
element_middleware.character_paddings[:length]
if element_middleware.character_paddings is not None
else element_middleware.character_paddings
)

alignment = get_element_alignment(element) or 0
x = float(element[constants.ANNOTATION_RECTANGLE_KEY][0])
Expand Down
10 changes: 7 additions & 3 deletions tests/test_dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def test_dropdown_four(sample_template_with_dropdown, pdf_samples):


def test_dropdown_alignment(dropdown_alignment, pdf_samples):
with open(os.path.join(pdf_samples, "dropdown", "dropdown_alignment_expected.pdf"), "rb+") as f:
with open(
os.path.join(pdf_samples, "dropdown", "dropdown_alignment_expected.pdf"), "rb+"
) as f:
obj = PyPDFForm(dropdown_alignment).fill(
{
"dropdown_left": 0,
Expand All @@ -132,8 +134,10 @@ def test_dropdown_alignment(dropdown_alignment, pdf_samples):


def test_dropdown_alignment_sejda(dropdown_alignment_sejda, pdf_samples):
with open(os.path.join(pdf_samples,
"dropdown", "dropdown_alignment_sejda_expected.pdf"), "rb+") as f:
with open(
os.path.join(pdf_samples, "dropdown", "dropdown_alignment_sejda_expected.pdf"),
"rb+",
) as f:
obj = PyPDFForm(dropdown_alignment_sejda).fill(
{
"dropdown_left": 0,
Expand Down

0 comments on commit 3062534

Please sign in to comment.