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 Apr 20, 2024
1 parent 4c926d7 commit d86b5b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 4 additions & 2 deletions PyPDFForm/filler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions PyPDFForm/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
6 changes: 1 addition & 5 deletions tests/scenario/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d86b5b9

Please sign in to comment.