Skip to content
Snippets Groups Projects
Commit a4b89e4b authored by nugget's avatar nugget
Browse files

Further polish code. Adjust pylint failure to below 9 and do not allow the...

Further polish code. Adjust pylint failure to below 9 and do not allow the pipeline to fail anymore.
parent ab0bb40f
No related branches found
No related tags found
3 merge requests!12v.0.1 for alpha release,!11Draft: Merge version0.1 changes into dev,!10Version0.1
Pipeline #725337 passed
......@@ -47,8 +47,8 @@ PEP8:
Pylint:
stage: linting
allow_failure: true
script: find . -type f -name '*.py' | xargs pylint -rn --fail-under=7 # Find all python files and check the code with pylint.
# allow_failure: true
script: find . -type f -name '*.py' | xargs pylint -rn --fail-under=9 # Find all python files and check the code with pylint.
test:
stage: testing
......
......@@ -18,19 +18,19 @@ def create_id(id_method):
Returns
-------
ID
figure_id
"""
if id_method == 1:
ID = time.time() # UNIX Time
ID = hex(int(ID)) # convert time to hexadecimal
figure_id = time.time() # UNIX Time
figure_id = hex(int(figure_id)) # convert time to hexadecimal
time.sleep(0.5) # break for avoiding duplicate IDs
elif id_method == 2:
ID = str(uuid.uuid4()) # creates a random UUID
ID = ID[0:8] # only use first 8 numbers
figure_id = str(uuid.uuid4()) # creates a random UUID
figure_id = figure_id[0:8] # only use first 8 numbers
else:
raise ValueError(
f'Your chosen ID method "{id_method}" is not supported.\n'
'At the moment these methods are available:\n'
'"1": Unix time converted to hexadecimal\n'
'"2": Random UUID')
return ID
return figure_id
File moved
......@@ -36,18 +36,18 @@ def tagplot_matplotlib(plotid_object):
fontsize = 'small'
color = 'grey'
IDs = []
all_ids_as_list = []
# Loop to create and position the IDs
for fig in plotid_object.figs:
ID = create_id.create_id(plotid_object.id_method)
ID = plotid_object.prefix + str(ID)
IDs.append(ID)
figure_id = create_id.create_id(plotid_object.id_method)
figure_id = plotid_object.prefix + str(figure_id)
all_ids_as_list.append(figure_id)
plt.figure(fig.number)
plt.figtext(x=plotid_object.position[0], y=plotid_object.position[1],
s=ID, ha='left', wrap=True,
s=figure_id, ha='left', wrap=True,
rotation=plotid_object.rotation,
fontsize=fontsize, color=color)
fig.tight_layout()
return [plotid_object.figs, IDs]
return [plotid_object.figs, all_ids_as_list]
......@@ -5,9 +5,9 @@ Unittests for TagPlot_matplotlib
"""
import unittest
from tagplot_matplotlib import tagplot_matplotlib
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
from tagplot_matplotlib import tagplot_matplotlib
from plotoptions import PlotOptions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment