You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following pieces describe what happens in handle_files before, at least, in this case, we call
53
52
the handle_files_helper function:
54
53
55
-
1) The parameter, query_line_args, is all the query line arguments you include on the nbgitpuller link. This means you
54
+
1) The parameter, helper_args, includes the progress function used to monitor the download_q
55
+
for messages; messages in the download_q are written to the UI so users can see the progress and
56
+
steps being taken to download their archives. You will notice the progress function is passed into
57
+
handle_files_helper and accessed like this:
58
+
```python
59
+
helper_args["wait_for_sync_progress_queue"]
60
+
helper_args["download_q"]
61
+
```
62
+
2) The parameter, query_line_args, is all the query line arguments you include on the nbgitpuller link. This means you
56
63
can put keyword arguments into your nbgitpuller links and have access to these arguments in the handle_files
57
64
function.
58
65
For example, you might set up a link like this:
@@ -63,33 +70,22 @@ the handle_files_helper function:
63
70
query_line_args["keyword1"]
64
71
query_line_args["keyword2"]
65
72
```
66
-
2) The query_line_args parameter also includes the progress function used to monitor the download_q
67
-
for messages; messages in the download_q are written to the UI so users can see the progress and
68
-
steps being taken to download their archives. You will notice the progress function is passed into
69
-
handle_files_helper and accessed like this:
70
-
```python
71
-
query_line_args["progress_func"]
72
-
query_line_args["download_q"]
73
-
```
74
73
3) The first line of the handle_files function for the dropbox downloader is specific to DropBox. The URL to a file
75
74
in DropBox contains one URL query parameter(dl=0). This parameter indicates to Dropbox whether to download the
76
75
file or open it in their browser-based file system. In order to download the file, this parameter
77
-
needs to be changed to dl=1.
78
-
4) The next line determines the file extension (zip, tar.gz, etc).
79
-
This is added to the query_lines_args map and passed off to the handle_files_helper to
80
-
help the application know which utility to use to decompress the archive -- unzip or tar -xzf.
81
-
5) Since we don't want the user to have to wait while the download process finishes, we have made
76
+
needs to be changed to dl=1.
77
+
4) Since we don't want the user to have to wait while the download process finishes, we have made
82
78
downloading of the archive a non-blocking process using the package asyncio. Here are the steps:
83
79
- get the event loop
84
80
- setup two tasks:
85
81
- a call to the handle_files_helper with our arguments
86
82
- the progress_loop function
87
83
- execute the two tasks in the event loop.
88
-
6) The function returns two pieces of information to nbgitpuller:
89
-
- the directory name of the decompressed archive
84
+
5) The function returns two pieces of information to nbgitpuller:
85
+
- the directory name of the decompressed archive, output_dir
90
86
- the local_origin_repo path.
91
87
92
-
The details of what happens in handle_files_helper can be found by studying the function. Essentially, the archive is downloaded, decompressed, and set up in a file
93
-
system to act as a remote repository(e.g. the local_origin_repo path).
94
-
95
-
88
+
The plugin_helper.py's `handle_files_helper`function does the following:
89
+
- the archive is downloaded,
90
+
- decompressed, and
91
+
- set up in a file system to act as a remote repository(e.g. the local_origin_repo path).
0 commit comments