Skip to content

Commit b4851cb

Browse files
authored
Merge pull request #590 from neuroinformatics-unit/rename_setup_google_drive_connection
Rename setup_google_drive_connection -> setup_gdrive_connection.
2 parents 4d24922 + 58dc123 commit b4851cb

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

datashuttle/datashuttle_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ def write_public_key(self, filepath: str) -> None:
846846
# -------------------------------------------------------------------------
847847

848848
@check_configs_set
849-
def setup_google_drive_connection(self) -> None:
849+
def setup_gdrive_connection(self) -> None:
850850
"""Set up a connection to Google Drive using the provided credentials.
851851
852852
Assumes `gdrive_root_folder_id` is set in configs.

datashuttle/tui/interface.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self) -> None:
3838
self.name_templates: Dict = {}
3939
self.tui_settings: Dict = {}
4040

41-
self.google_drive_rclone_setup_process: subprocess.Popen | None = None
41+
self.gdrive_rclone_setup_process: subprocess.Popen | None = None
4242
self.gdrive_setup_process_killed: bool = False
4343

4444
def select_existing_project(self, project_name: str) -> InterfaceOutput:
@@ -512,7 +512,7 @@ def setup_key_pair_and_rclone_config(
512512
# Setup Google Drive
513513
# ----------------------------------------------------------------------------------
514514

515-
def setup_google_drive_connection(
515+
def setup_gdrive_connection(
516516
self,
517517
gdrive_client_secret: Optional[str] = None,
518518
config_token: Optional[str] = None,
@@ -521,7 +521,7 @@ def setup_google_drive_connection(
521521
522522
This is done by running the rclone setup function which returns a
523523
subprocess.Popen object. The process object is stored in
524-
`self.google_drive_rclone_setup_process` to allow for termination
524+
`self.gdrive_rclone_setup_process` to allow for termination
525525
of the process if needed. The `self.gdrive_setup_process_killed`
526526
flag is set to false to signal normal operation. The process is then
527527
awaited to ensure it completes successfully. If the process is killed
@@ -532,7 +532,7 @@ def setup_google_drive_connection(
532532
process = self.project._setup_rclone_gdrive_config(
533533
gdrive_client_secret, config_token
534534
)
535-
self.google_drive_rclone_setup_process = process
535+
self.gdrive_rclone_setup_process = process
536536
self.gdrive_setup_process_killed = False
537537

538538
self.await_successful_gdrive_connection_setup_raise_on_fail(
@@ -558,11 +558,11 @@ def get_rclone_message_for_gdrive_without_browser(
558558
except BaseException as e:
559559
return False, str(e)
560560

561-
def terminate_google_drive_setup(self) -> None:
561+
def terminate_gdrive_setup(self) -> None:
562562
"""Terminate rclone setup for Google Drive by killing the rclone process."""
563-
assert self.google_drive_rclone_setup_process is not None
563+
assert self.gdrive_rclone_setup_process is not None
564564

565-
process = self.google_drive_rclone_setup_process
565+
process = self.gdrive_rclone_setup_process
566566

567567
# Check if the process is still running
568568
if process.poll() is None:

datashuttle/tui/screens/setup_gdrive.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
9191
# see setup_gdrive_connection_and_update_ui()
9292
if self.setup_worker and self.setup_worker.is_running:
9393
self.setup_worker.cancel() # fix
94-
self.interface.terminate_google_drive_setup()
94+
self.interface.terminate_gdrive_setup()
9595
self.dismiss()
9696

9797
elif event.button.id == "setup_gdrive_ok_button":
@@ -244,7 +244,7 @@ async def setup_gdrive_connection_and_update_ui(
244244
thread for Google Drive setup, sets `self.setup_worker` to the worker and
245245
awaits the worker to finish. After completion, it displays a
246246
success / failure screen. The setup on the lower level is a bit complicated.
247-
The worker thread runs the `setup_google_drive_connection` method of the
247+
The worker thread runs the `setup_gdrive_connection` method of the
248248
`Interface` class which spawns an rclone process to set up the connection.
249249
The rclone process object is stored in the `Interface` class to handle closing
250250
the process as the thread does not kill the process itself upon cancellation and
@@ -283,7 +283,7 @@ def setup_gdrive_connection(
283283
by this function are responsible for opening google's auth page to authenticate
284284
with Google Drive.
285285
"""
286-
success, output = self.interface.setup_google_drive_connection(
286+
success, output = self.interface.setup_gdrive_connection(
287287
gdrive_client_secret, config_token
288288
)
289289
return success, output

docs/source/pages/get_started/set-up-a-project.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ the Google API Console. If not provided, [RClone's](https://rclone.org/) shared
341341
If not provided, it is assumed the `gdrive_root_folder_id` points directly to the project folder.
342342

343343
Once the configs are saved, we can set up the connection by clicking `Set Up Google Drive Connection`
344-
(through the TUI) or running the function [](setup_google_drive_connection()) in Python.
344+
(through the TUI) or running the function [](setup_gdrive_connection()) in Python.
345345

346346
```{important}
347347
If you change the `gdrive_root_folder_id`, you must re-run the connection set up.
@@ -428,10 +428,10 @@ project.make_config_file(
428428
Next, a one-time command to set up the connection must be run:
429429

430430
```{code-block} python
431-
project.setup_google_drive_connection()
431+
project.setup_gdrive_connection()
432432
```
433433

434-
Running [](setup_google_drive_connection()) will prompt to you to enter your
434+
Running [](setup_gdrive_connection()) will prompt to you to enter your
435435
Google Drive client secret.
436436

437437
Finally, you will be required to authenticate to Google Drive via your browser.

tests/tests_transfers/gdrive/gdrive_test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def mock_input(_: str) -> str:
5252
"GDRIVE_CLIENT_SECRET"
5353
]
5454

55-
project.setup_google_drive_connection()
55+
project.setup_gdrive_connection()
5656

5757
builtins.input = original_input
5858
gdrive.get_client_secret = original_get_secret

0 commit comments

Comments
 (0)