Skip to content

Commit

Permalink
Enable rings shape in factory.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefmolin committed Sep 23, 2023
1 parent ff95a29 commit 847c818
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/data_morph/shapes/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ShapeFactory:
'up_parab': points.UpParabola,
'diamond': polygons.Diamond,
'rectangle': polygons.Rectangle,
'rings': circles.Rings,
'star': polygons.Star,
}

Expand All @@ -61,22 +62,25 @@ class ShapeFactory:
def __init__(self, dataset: Dataset) -> None:
self._dataset: Dataset = dataset

def generate_shape(self, shape: str) -> Shape:
def generate_shape(self, shape: str, **kwargs) -> Shape:
"""
Generate the shape object based on the dataset.
Parameters
----------
shape : str
The desired shape. See :attr:`.AVAILABLE_SHAPES`.
**kwargs
Additional keyword arguments to pass down when creating
the shape.
Returns
-------
Shape
An shape object of the requested type.
"""
try:
return self._SHAPE_MAPPING[shape](self._dataset)
return self._SHAPE_MAPPING[shape](self._dataset, **kwargs)
except KeyError as err:
raise ValueError(f'No such shape as {shape}.') from err

Expand Down

0 comments on commit 847c818

Please sign in to comment.