@@ -121,8 +121,7 @@ def delete_all_user_projects(session, user=None):
121
121
122
122
123
123
def delete_project (session , guid , user = None ):
124
- """Delete a single project. Simply pass in the guid
125
- """
124
+ """Delete a single project. Simply pass in the guid"""
126
125
if not user :
127
126
user = current_user (session )
128
127
nodes_url = user .relationships .nodes ['links' ]['related' ]['href' ]
@@ -135,8 +134,7 @@ def delete_project(session, guid, user=None):
135
134
136
135
137
136
def create_custom_collection (session ):
138
- """Create a new custom collection. You can modify the title of the collection here as well.
139
- """
137
+ """Create a new custom collection. You can modify the title of the collection here as well."""
140
138
collections_url = '{}/v2/collections/' .format (session .api_base_url )
141
139
142
140
payload = {
@@ -147,8 +145,7 @@ def create_custom_collection(session):
147
145
148
146
149
147
def delete_custom_collections (session ):
150
- """Delete all custom collections for the current user.
151
- """
148
+ """Delete all custom collections for the current user."""
152
149
collections_url = '{}/v2/collections/' .format (session .api_base_url )
153
150
data = session .get (collections_url )
154
151
@@ -161,8 +158,7 @@ def delete_custom_collections(session):
161
158
# TODO rename this to get_node_providers, and create new function that actually IS get_node_addons -
162
159
# note, this is confusing, talk to BrianG before we change this
163
160
def get_node_addons (session , node_id ):
164
- """Return a list of the names of all the addons connected to the given node.
165
- """
161
+ """Return a list of the names of all the addons connected to the given node."""
166
162
url = '/v2/nodes/{}/files/' .format (node_id )
167
163
data = session .get (url , query_parameters = {'page[size]' : 20 })
168
164
providers = []
@@ -222,8 +218,7 @@ def upload_fake_file(
222
218
223
219
224
220
def delete_addon_files (session , provider , current_browser , guid ):
225
- """Delete all files for the given addon.
226
- """
221
+ """Delete all files for the given addon."""
227
222
files_url = '{}/v2/nodes/{}/files/{}/' .format (session .api_base_url , guid , provider )
228
223
229
224
data = session .get (url = files_url , query_parameters = {'page[size]' : 20 })
@@ -245,8 +240,7 @@ def delete_file(session, delete_url):
245
240
246
241
247
242
def get_providers_list (session = None , type = 'preprints' ):
248
- """Return the providers list data. The default is the preprint providers list.
249
- """
243
+ """Return the providers list data. The default is the preprint providers list."""
250
244
if not session :
251
245
session = get_default_session ()
252
246
url = '/v2/providers/' + type
@@ -265,14 +259,13 @@ def get_provider(session=None, type='registrations', provider_id='osf'):
265
259
266
260
267
261
def get_provider_submission_status (provider ):
268
- """Return the boolean attribute `allow_submissions` from the dictionary object (provider)
269
- """
262
+ """Return the boolean attribute `allow_submissions` from the dictionary object (provider)"""
270
263
return provider ['attributes' ]['allow_submissions' ]
271
264
272
265
273
266
def get_providers_total (provider_name , session ):
274
- """ Return the total number of preprints for a given service provider.
275
- Note: Reformat provider names to all lowercase and remove white spaces.
267
+ """Return the total number of preprints for a given service provider.
268
+ Note: Reformat provider names to all lowercase and remove white spaces.
276
269
"""
277
270
provider_url = '/v2/providers/preprints/{}/preprints/' .format (
278
271
provider_name .lower ().replace (' ' , '' )
@@ -281,7 +274,10 @@ def get_providers_total(provider_name, session):
281
274
282
275
283
276
def connect_provider_root_to_node (
284
- session , provider , external_account_id , node_id = settings .PREFERRED_NODE ,
277
+ session ,
278
+ provider ,
279
+ external_account_id ,
280
+ node_id = settings .PREFERRED_NODE ,
285
281
):
286
282
"""Initialize the node<=>addon connection, add the given external_account_id, and configure it
287
283
to connect to the root folder of the provider."""
0 commit comments