paramak
paramak copied to clipboard
Simplify the shape.py points setter
Currently the setter in the shape.py checks quite a lot of things about the points
https://github.com/ukaea/paramak/blob/785c3ed7304e22eac7d58bb1bdc6515fbd20b9a8/paramak/shape.py#L412-L471
This should be simplified and some of the logica can be moved into parametric shape classes that inherit from shape.
For example this could be added to the RotateStraightShape.py as a new setter that makes use of the existing points setter in Shape.py but also extends it
@RotateMixedShape.points.setter
def points(self, values):
if values is not None:
# Checks that the length of each tuple in points is 2
for value in values:
if len(value) != 2:
msg = "individual points must contain 2 coordinates {} has a \
length of {}".format(value, len(values[0]))
raise ValueError(msg)
super(RotateStraightShape, self.__class__).points.fset(self, values)