etna icon indicating copy to clipboard operation
etna copied to clipboard

[BUG] Make deep copy of attributes during creation of a new `TSDataset`

Open Mr-Geekman opened this issue 2 years ago • 0 comments

🐛 Bug Report

There are few cases where we create a new TSDataset from the old one and assign the same attributes instead of copying them:

Probably, there are more. It isn't a good practice because if this values are mutable then changing them inplace will change it in both TSDatasets. It is better to replace assignment with copy or deepcopy.

Probably the problem can arise with:

  • ts.transforms -- they are mutable
  • ts.df_exog -- we can do inplace operations on it
  • ts._regressors -- we can see some inplace operations on it

Expected behavior

Created TSDataset doesn't hold a reference to value of original TSDataset if this value is mutable. If it is immutable then there is no problem.

How To Reproduce

Environment

No response

Additional context

No response

Checklist

  • [X] Bug appears at the latest library version

Mr-Geekman avatar Jul 21 '22 07:07 Mr-Geekman