Skip to content

Commit

Permalink
[ENH] make get_examples side effect safe via deepcopy (#6259)
Browse files Browse the repository at this point in the history
This PR makes `get_examples` safer against side effects on the data
fixtures, by adding a `deepcopy` at the end.

This should prevent issues like in
#6253 (review)
from occurring in the future.
  • Loading branch information
fkiraly committed Apr 8, 2024
1 parent 0026957 commit 9cec643
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sktime/datatypes/_examples.py
Expand Up @@ -13,6 +13,8 @@
e.g., metadata such as column names are missing
"""

from copy import deepcopy

from sktime.datatypes._registry import mtype_to_scitype

__author__ = ["fkiraly"]
Expand Down Expand Up @@ -124,4 +126,5 @@ def get_examples(
else:
fixtures[k[2]] = example_dict.get(k)

return fixtures
# deepcopy to avoid side effects
return deepcopy(fixtures)

0 comments on commit 9cec643

Please sign in to comment.