Skip to content

Commit f38894b

Browse files
using getattr
1 parent de5cbd1 commit f38894b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/spatialdata_plot/pl/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ def _validate_render_params(
15671567
raise TypeError("Parameter 'elements' must be a string or a list of strings.")
15681568

15691569
elements = [elements] if isinstance(elements, str) else elements
1570-
sdata_elements = eval(f"sdata.{element_type}") # noqa: PGH001
1570+
sdata_elements = getattr(sdata, element_type)
15711571
if any(e not in sdata_elements for e in elements):
15721572
raise ValueError(
15731573
f"Not all specified {element_type} elements were found. Available elements are: "
@@ -1814,7 +1814,7 @@ def _get_wanted_render_elements(
18141814
wanted_elements = (
18151815
params.elements
18161816
if params.elements is not None
1817-
else list(eval(f"sdata.{element_type}.keys()")) # noqa: PGH001
1817+
else list(getattr(sdata, element_type).keys())
18181818
)
18191819

18201820
wanted_elements_on_cs = [

0 commit comments

Comments
 (0)