Repository: aeye-lab/pymovements
Pull request #657 (2024-01-11 20:11:41)

feat!: rename GazeDataFrame.copy() to clone()
We discussed this already in November when I added this function, but I forgot to do this apparently.

I guess nobody started to use this method in the meantime, so I would just rename it without deprecation

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/aeye-lab/pymovements/pull/657?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`4fd1b18`)](https://app.codecov.io/gh/aeye-lab/pymovements/commit/4fd1b18320bd401495779307e5895a80f9cf1502?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab) 100.00% compared to head [(`bd72da2`)](https://app.codecov.io/gh/aeye-lab/pymovements/pull/657?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab) 100.00%.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff            @@
##              main      #657   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           54        54           
  Lines         2356      2356           
  Branches       588       529   -59     
=========================================
  Hits          2356      2356           
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/aeye-lab/pymovements/pull/657?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab).


Patch:
diff --git a/src/pymovements/dataset/dataset_files.py b/src/pymovements/dataset/dataset_files.py
index f258b71..7930565 100644
--- a/src/pymovements/dataset/dataset_files.py
+++ b/src/pymovements/dataset/dataset_files.py
@@ -482,7 +482,7 @@ def save_preprocessed(
     disable_progressbar = not verbose
 
     for file_id, gaze_df in enumerate(tqdm(gaze, disable=disable_progressbar)):
-        gaze_df = gaze_df.copy()
+        gaze_df = gaze_df.clone()
 
         raw_filepath = paths.raw / Path(fileinfo[file_id, 'filepath'])
         preprocessed_filepath = paths.get_preprocessed_filepath(
diff --git a/src/pymovements/gaze/gaze_dataframe.py b/src/pymovements/gaze/gaze_dataframe.py
index 9853825..336f9a8 100644
--- a/src/pymovements/gaze/gaze_dataframe.py
+++ b/src/pymovements/gaze/gaze_dataframe.py
@@ -662,7 +662,7 @@ class GazeDataFrame:
                 ],
             ).drop(input_col)
 
-    def copy(self) -> GazeDataFrame:
+    def clone(self) -> GazeDataFrame:
         """Return a copy of the GazeDataFrame.
 
         Returns


Test patch:
diff --git a/tests/unit/gaze/gaze_dataframe_test.py b/tests/unit/gaze/gaze_dataframe_test.py
index e7ddaa6..d1dd599 100644
--- a/tests/unit/gaze/gaze_dataframe_test.py
+++ b/tests/unit/gaze/gaze_dataframe_test.py
@@ -173,7 +173,7 @@ def test_gaze_dataframe_copy_with_experiment():
         position_columns=['x', 'y'],
     )
 
-    gaze_copy = gaze.copy()
+    gaze_copy = gaze.clone()
 
     # We want to have separate dataframes but with the exact same data.
     assert gaze.frame is not gaze_copy.frame
@@ -197,7 +197,7 @@ def test_gaze_dataframe_copy_no_experiment():
         position_columns=['x', 'y'],
     )
 
-    gaze_copy = gaze.copy()
+    gaze_copy = gaze.clone()
 
     # We want to have separate dataframes but with the exact same data.
     assert gaze.frame is not gaze_copy.frame