From f58fd5f325f6ca2eaffc6eef9e87df0ed1f9815e Mon Sep 17 00:00:00 2001 From: Mustafa Abdulrahman Date: Sat, 24 Jun 2023 20:18:33 -0400 Subject: [PATCH] ran black --- openadapt/crud.py | 13 +++++++++---- openadapt/share.py | 2 +- tests/openadapt/test_share.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/openadapt/crud.py b/openadapt/crud.py index 2cdbb0ef3..dfb47f3a2 100644 --- a/openadapt/crud.py +++ b/openadapt/crud.py @@ -151,7 +151,7 @@ def export_sql(recording_id): recording.double_click_interval_seconds, recording.double_click_distance_pixels, recording.platform, - recording.task_description + recording.task_description, ) logger.info(f"Recording with ID {recording_id} exported successfully.") @@ -178,13 +178,17 @@ def create_db(recording_id, sql, values): timestamp = time.time() source_file_path = config.ENV_FILE_PATH target_file_path = f"{config.ENV_FILE_PATH}-{timestamp}" - logger.info(f"source_file_path={source_file_path}, target_file_path={target_file_path}") + logger.info( + f"source_file_path={source_file_path}, target_file_path={target_file_path}" + ) shutil.copyfile(source_file_path, target_file_path) config.set_db_url(db_fname) with open(config.ENV_FILE_PATH, "r") as env_file: env_file_lines = [ - f"DB_FNAME={db_fname}\n" if env_file_line.startswith("DB_FNAME") else env_file_line + f"DB_FNAME={db_fname}\n" + if env_file_line.startswith("DB_FNAME") + else env_file_line for env_file_line in env_file.readlines() ] @@ -231,6 +235,7 @@ def export_recording(recording_id): restore_db(timestamp) return db_file_path + def get_recording(timestamp): return db.query(Recording).filter(Recording.timestamp == timestamp).first() @@ -264,4 +269,4 @@ def get_screenshots(recording, precompute_diffs=False): def get_window_events(recording): - return _get(WindowEvent, recording.timestamp) \ No newline at end of file + return _get(WindowEvent, recording.timestamp) diff --git a/openadapt/share.py b/openadapt/share.py index 9f22c01e9..3f3eec3a0 100644 --- a/openadapt/share.py +++ b/openadapt/share.py @@ -107,4 +107,4 @@ def receive_recording(wormhole_code): "send": send_recording, "receive": receive_recording, } - ) \ No newline at end of file + ) diff --git a/tests/openadapt/test_share.py b/tests/openadapt/test_share.py index ece26762a..8c31acae4 100644 --- a/tests/openadapt/test_share.py +++ b/tests/openadapt/test_share.py @@ -14,7 +14,9 @@ def test_export_recording_to_folder(self): f.write("Recording data") # Mock the crud.export_recording() function to return the temporary file path - with patch("openadapt.share.crud.export_recording", return_value=recording_db_path): + with patch( + "openadapt.share.crud.export_recording", return_value=recording_db_path + ): zip_file_path = share.export_recording_to_folder(recording_id) self.assertIsNotNone(zip_file_path) @@ -34,14 +36,18 @@ def test_send_file(self): share.send_file(file_path) # Verify that the command is called with the correct arguments - mock_run.assert_called_once_with(["wormhole", "send", file_path], check=True) + mock_run.assert_called_once_with( + ["wormhole", "send", file_path], check=True + ) # Clean up the temporary file os.remove(file_path) def test_send_recording(self): # Mock the export_recording_to_folder() function to return a zip file path - with patch("openadapt.share.export_recording_to_folder", return_value="temp.zip"): + with patch( + "openadapt.share.export_recording_to_folder", return_value="temp.zip" + ): # Mock the send_file() function to avoid sending the file with patch("openadapt.share.send_file"): share.send_recording(1) @@ -62,4 +68,4 @@ def test_receive_recording(self): if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main()