Skip to content
Snippets Groups Projects

Draft: Merge version0.1 changes into dev

Closed Hock, Martin requested to merge version0.1 into dev
2 files
+ 41
18
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 40
1
@@ -9,7 +9,12 @@ class PlotOptions:
Methods
-------
__init__figs : figure object
__init__
validate_input: Check if input is correct type.
Attributes
----------
figs : figure object
Figure that will be tagged.
prefix : str
Prefix that is placed before the ID.
@@ -28,3 +33,37 @@ class PlotOptions:
self.id_method = id_method
self.rotation = rotation
self.position = position
def validate_input(self):
"""
Validate if input for PlotOptions is correct type.
Raises
------
TypeError
TypeError is thrown if one of the attributes is not the correct
type.
Returns
-------
0, if all checks succeeded.
"""
# %% Validate inputs
if isinstance(self.prefix, str):
pass
else:
raise TypeError("Prefix is not a string.")
if isinstance(self.figs, list):
pass
else:
raise TypeError("Figures are not a list.")
# TODO: Change id_method key from integer to (more meaningful) string.
try:
self.id_method = int(self.id_method)
except ValueError:
raise TypeError('The chosen ID id_method is not an integer.')
return 0
Loading