Skip to content

Commit

Permalink
fix flake8 violations
Browse files Browse the repository at this point in the history
  • Loading branch information
FriedrichFroebel committed Sep 23, 2023
1 parent 03ac265 commit 988054a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 37 deletions.
4 changes: 3 additions & 1 deletion brother_ql_web/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def update_configuration_from_parameters(
if parameters.log_level:
# `log_level` will be numeric if parsed from argv, so we enforce the name here.
level = parameters.log_level
configuration.server.log_level = logging.getLevelName(level) if isinstance(level, int) else level
configuration.server.log_level = (
logging.getLevelName(level) if isinstance(level, int) else level
)
if parameters.font_folder:
configuration.server.additional_font_folder = parameters.font_folder

Expand Down
7 changes: 4 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ def test_invalid_label_size(self):
)
configuration.label.default_size = "dummy"

# Do not assert the label sizes, but make sure that the value list starts with a number.
# Do not assert the label sizes, but make sure that the value list starts with
# a number.
with self.assertRaisesRegex(
cli.InvalidLabelSize,
"^Invalid default label size\. Please choose one of the following:\\n\d.+$",
r"^Invalid default label size\. Please choose one of the following:\\n\d.+$", # noqa: E501
):
cli.update_configuration_from_parameters(
parameters=parameters, configuration=configuration
Expand All @@ -228,7 +229,7 @@ def test_no_fonts_found(self):
with mock.patch.object(cli, "collect_fonts", return_value=[]) as collect_mock:
with self.assertRaisesRegex(
cli.NoFontFound,
'^Not a single font was found on your system. Please install some or use the "--font-folder" argument.$',
'^Not a single font was found on your system. Please install some or use the "--font-folder" argument.$', # noqa: E501
):
cli.update_configuration_from_parameters(
parameters=parameters, configuration=configuration
Expand Down
64 changes: 32 additions & 32 deletions tests/test_font_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,52 @@ class GetFontsTestCase(TestCase):
# Reference: https://packages.ubuntu.com/lunar/all/fonts-roboto-unhinted/filelist
ROBOTO_FILES = {
"Roboto": {
"Thin": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf",
"Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf",
"Thin Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf",
"Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Italic.ttf",
"Black Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf",
"Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf",
"Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Bold.ttf",
"Black": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf",
"Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf",
"Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BoldItalic.ttf",
"Thin": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf", # noqa: E501
"Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf", # noqa: E501
"Thin Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf", # noqa: E501
"Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf", # noqa: E501
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Italic.ttf", # noqa: E501
"Black Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf", # noqa: E501
"Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf", # noqa: E501
"Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Bold.ttf", # noqa: E501
"Black": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf", # noqa: E501
"Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf", # noqa: E501
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf", # noqa: E501
"Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BoldItalic.ttf", # noqa: E501
},
"Roboto Black": {
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf", # noqa: E501
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf", # noqa: E501
},
"Roboto Condensed": {
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Italic.ttf",
"Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Bold.ttf",
"Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf",
"Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-BoldItalic.ttf",
"Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf",
"Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf",
"Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Regular.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Italic.ttf", # noqa: E501
"Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Bold.ttf", # noqa: E501
"Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf", # noqa: E501
"Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-BoldItalic.ttf", # noqa: E501
"Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf", # noqa: E501
"Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf", # noqa: E501
"Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf", # noqa: E501
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Regular.ttf", # noqa: E501
},
"Roboto Condensed Light": {
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf", # noqa: E501
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf", # noqa: E501
},
"Roboto Condensed Medium": {
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf", # noqa: E501
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf", # noqa: E501
},
"Roboto Light": {
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf", # noqa: E501
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf", # noqa: E501
},
"Roboto Medium": {
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf", # noqa: E501
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf", # noqa: E501
},
"Roboto Thin": {
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf",
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf",
"Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf", # noqa: E501
"Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf", # noqa: E501
},
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_unknown_backend(self):
utils.BackendGuessingError,
r"^Couln't guess the backend to use from the printer string descriptor$",
):
backend = utils.get_backend_class(configuration)
utils.get_backend_class(configuration)

def test_known_backend(self):
from brother_ql.backends.linux_kernel import BrotherQLBackendLinuxKernel
Expand Down

0 comments on commit 988054a

Please sign in to comment.