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 Jan 25, 2024
1 parent ef8eb3e commit e222cde
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
7 changes: 4 additions & 3 deletions PyPDFForm/core/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
from ..middleware.dropdown import Dropdown
from ..middleware.radio import Radio
from ..middleware.text import Text
from .constants import (ANNOTATION_FIELD_KEY, CHOICE_FIELD_IDENTIFIER,
from .constants import (ANNOTATION_FIELD_KEY, BUTTON_IDENTIFIER,
BUTTON_STYLE_IDENTIFIER, CHOICE_FIELD_IDENTIFIER,
CHOICES_IDENTIFIER, FIELD_FLAG_KEY, PARENT_KEY,
SELECTABLE_IDENTIFIER, SUBTYPE_KEY,
TEXT_FIELD_ALIGNMENT_IDENTIFIER,
TEXT_FIELD_APPEARANCE_IDENTIFIER,
TEXT_FIELD_IDENTIFIER, WIDGET_SUBTYPE_KEY,
WIDGET_TYPE_KEY, BUTTON_STYLE_IDENTIFIER, BUTTON_IDENTIFIER)
WIDGET_TYPE_KEY)

WIDGET_TYPE_PATTERNS = [
(
Expand Down Expand Up @@ -74,5 +75,5 @@

BUTTON_STYLE_PATTERNS = [
{BUTTON_IDENTIFIER: {BUTTON_STYLE_IDENTIFIER: True}},
{PARENT_KEY: {BUTTON_IDENTIFIER: {BUTTON_STYLE_IDENTIFIER: True}}}
{PARENT_KEY: {BUTTON_IDENTIFIER: {BUTTON_STYLE_IDENTIFIER: True}}},
]
6 changes: 3 additions & 3 deletions PyPDFForm/core/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from ..middleware.text import Text
from .constants import (ANNOTATION_RECTANGLE_KEY, COMB, MULTILINE,
NEW_LINE_SYMBOL, TEXT_FIELD_MAX_LENGTH_KEY)
from .patterns import (DROPDOWN_CHOICE_PATTERNS, TEXT_FIELD_FLAG_PATTERNS,
WIDGET_ALIGNMENT_PATTERNS, WIDGET_KEY_PATTERNS,
WIDGET_TYPE_PATTERNS, BUTTON_STYLE_PATTERNS)
from .patterns import (BUTTON_STYLE_PATTERNS, DROPDOWN_CHOICE_PATTERNS,
TEXT_FIELD_FLAG_PATTERNS, WIDGET_ALIGNMENT_PATTERNS,
WIDGET_KEY_PATTERNS, WIDGET_TYPE_PATTERNS)
from .utils import find_pattern_match, stream_to_io, traverse_pattern


Expand Down
5 changes: 3 additions & 2 deletions PyPDFForm/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from ..middleware.constants import WIDGET_TYPES
from ..middleware.radio import Radio
from ..middleware.text import Text
from .constants import (DEFAULT_CHECKBOX_STYLE, BUTTON_STYLES, DEFAULT_FONT, DEFAULT_FONT_COLOR,
DEFAULT_FONT_SIZE, PREVIEW_FONT_COLOR, DEFAULT_RADIO_STYLE)
from .constants import (BUTTON_STYLES, DEFAULT_CHECKBOX_STYLE, DEFAULT_FONT,
DEFAULT_FONT_COLOR, DEFAULT_FONT_SIZE,
DEFAULT_RADIO_STYLE, PREVIEW_FONT_COLOR)


def stream_to_io(stream: bytes) -> BinaryIO:
Expand Down
10 changes: 5 additions & 5 deletions PyPDFForm/middleware/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

from typing import Dict

from ..core.template import (construct_widget, get_character_x_paddings,
get_dropdown_choices, get_text_field_max_length,
get_widget_key, get_widgets_by_page,
is_text_field_comb, get_button_style)
from .constants import WIDGET_TYPES
from ..core.template import (construct_widget, get_button_style,
get_character_x_paddings, get_dropdown_choices,
get_text_field_max_length, get_widget_key,
get_widgets_by_page, is_text_field_comb)
from .checkbox import Checkbox
from .constants import WIDGET_TYPES
from .dropdown import Dropdown
from .radio import Radio
from .text import Text
Expand Down
12 changes: 3 additions & 9 deletions tests/test_create_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ def test_create_checkbox_complex(template_stream, pdf_samples, request):


def test_create_checkbox_check(template_stream, pdf_samples, request):
expected_path = os.path.join(
pdf_samples, "widget", "create_checkbox_check.pdf"
)
expected_path = os.path.join(pdf_samples, "widget", "create_checkbox_check.pdf")
with open(expected_path, "rb+") as f:
obj = PdfWrapper(template_stream).create_widget(
"checkbox",
Expand All @@ -106,9 +104,7 @@ def test_create_checkbox_check(template_stream, pdf_samples, request):


def test_create_checkbox_circle(template_stream, pdf_samples, request):
expected_path = os.path.join(
pdf_samples, "widget", "create_checkbox_circle.pdf"
)
expected_path = os.path.join(pdf_samples, "widget", "create_checkbox_circle.pdf")
with open(expected_path, "rb+") as f:
obj = PdfWrapper(template_stream).create_widget(
"checkbox",
Expand All @@ -130,9 +126,7 @@ def test_create_checkbox_circle(template_stream, pdf_samples, request):


def test_create_checkbox_cross(template_stream, pdf_samples, request):
expected_path = os.path.join(
pdf_samples, "widget", "create_checkbox_cross.pdf"
)
expected_path = os.path.join(pdf_samples, "widget", "create_checkbox_cross.pdf")
with open(expected_path, "rb+") as f:
obj = PdfWrapper(template_stream).create_widget(
"checkbox",
Expand Down

0 comments on commit e222cde

Please sign in to comment.