From bf1ba34820411ae5551234e717865678a1783e76 Mon Sep 17 00:00:00 2001 From: "Mayr, Hannes" <hannes.mayr@stud.tu-darmstadt.de> Date: Tue, 10 Jan 2023 12:02:25 +0100 Subject: [PATCH] Fix linting errors. --- plotid/resources/__init__.py | 2 +- plotid/tagplot_image.py | 4 +++- plotid/tagplot_matplotlib.py | 8 ++++++-- tests/test_tagplot_matplotlib.py | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plotid/resources/__init__.py b/plotid/resources/__init__.py index 8d1c8b6..8b13789 100644 --- a/plotid/resources/__init__.py +++ b/plotid/resources/__init__.py @@ -1 +1 @@ - + diff --git a/plotid/tagplot_image.py b/plotid/tagplot_image.py index 51be3b8..282b2b0 100644 --- a/plotid/tagplot_image.py +++ b/plotid/tagplot_image.py @@ -44,7 +44,9 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: color = tuple(rgb_value * 255 for rgb_value in plotid_object.fontcolor) # font = ImageFont.load_default() - font_path = files("plotid.resources").joinpath("OpenSans", "OpenSans-Regular.ttf") + font_path = ( + files("plotid.resources").joinpath("OpenSans").joinpath("OpenSans-Regular.ttf") + ) font = ImageFont.truetype(str(font_path), plotid_object.fontsize) if plotid_object.font: diff --git a/plotid/tagplot_matplotlib.py b/plotid/tagplot_matplotlib.py index 98ec025..1da6cce 100644 --- a/plotid/tagplot_matplotlib.py +++ b/plotid/tagplot_matplotlib.py @@ -41,8 +41,12 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer: matplotlib.font_manager.fontManager.addfont(plotid_object.font) font = matplotlib.font_manager.FontProperties(fname=plotid_object.font) else: - font = files("plotid.resources").joinpath("OpenSans", "OpenSans-Regular.ttf") - matplotlib.font_manager.fontManager.addfont(font) + font = ( + files("plotid.resources") + .joinpath("OpenSans") + .joinpath("OpenSans-Regular.ttf") + ) + matplotlib.font_manager.fontManager.addfont(str(font)) font = matplotlib.font_manager.FontProperties(fname=font) # Loop to create and position the IDs diff --git a/tests/test_tagplot_matplotlib.py b/tests/test_tagplot_matplotlib.py index 3cdfc37..d7e59d9 100644 --- a/tests/test_tagplot_matplotlib.py +++ b/tests/test_tagplot_matplotlib.py @@ -5,7 +5,6 @@ Unittests for tagplot_matplotlib """ import unittest -from importlib.resources import files import matplotlib.pyplot as plt from matplotlib.figure import Figure from plotid.tagplot_matplotlib import tagplot_matplotlib -- GitLab