Skip to content

Commit dcd4e5f

Browse files
committed
applied clements review
1 parent 246f1de commit dcd4e5f

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

dataikuapi/dss/projectfolder.py

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,14 @@ def get_parent(self):
4848
else:
4949
return DSSProjectFolder(self.client, parent)
5050

51-
def get_children(self):
51+
def list_child_folders(self):
5252
"""
53-
Get this project folder's children
53+
List the child project folders inside this project folder
5454
55-
:returns list: A list of :class:`dataikuapi.dss.projectfolders.DSSProjectFolder` to interact with its children
55+
:returns list: A list of :class:`dataikuapi.dss.projectfolders.DSSProjectFolder` to interact with its sub-folders
5656
"""
5757
children = self.client._perform_json("GET", "/project-folders/%s" % self.project_folder_id).get("children", [])
58-
ret = []
59-
for child in children:
60-
ret.append(DSSProjectFolder(self.client, child))
61-
return ret
58+
return [DSSProjectFolder(self.client, child) for child in children]
6259

6360
def list_project_keys(self):
6461
"""
@@ -75,17 +72,15 @@ def list_projects(self):
7572
:returns list: A list of :class:`dataikuapi.dss.project.DSSProject` to interact with its projects
7673
"""
7774
project_keys = self.client._perform_json("GET", "/project-folders/%s" % self.project_folder_id).get("projectKeys", [])
78-
ret = []
79-
for pkey in project_keys:
80-
ret.append(DSSProject(self.client, pkey))
81-
return ret
75+
return [DSSProject(self.client, pkey) for pkey in project_keys]
8276

8377
########################################################
8478
# Project folder deletion
8579
########################################################
8680
def delete(self):
8781
"""
8882
Delete the project folder
83+
Note: it must be empty (cannot contain any sub-project folders nor projects), you must move or remove all its content before deleting it
8984
9085
This call requires an API key with admin rights
9186
"""
@@ -180,7 +175,7 @@ def __init__(self, client, project_folder_id, settings):
180175
self.settings = settings
181176

182177
def get_raw(self):
183-
"""Gets all settings as a raw dictionary. This returns a reference to the raw settings, not a copy,
178+
"""Gets all settings as a raw dictionary. This returns a reference to the raw retrieved settings, not a copy,
184179
so changes made to the returned object will be reflected when saving.
185180
186181
:rtype: dict
@@ -216,20 +211,13 @@ def set_owner(self, owner):
216211
self.settings["owner"] = owner
217212

218213
def get_permissions(self):
219-
"""Get the permissions of the project folder
220-
Warning: the returned list is the direct object of the settings, modifying it will modify the current settings
214+
"""Get the permissions of the project folder. This returns a reference to the retrieved permissions, not a copy,
215+
so changes made to the returned list will be reflected when saving.
221216
222217
:return list: the current permissions of the project folder
223218
"""
224219
return self.settings["permissions"]
225220

226-
def set_permissions(self, permissions):
227-
"""Set the permissions of the project folder
228-
229-
:param list permissions: the new permissions of the project folder
230-
"""
231-
self.settings["permissions"] = permissions
232-
233221
def save(self):
234222
"""Saves back the settings to the project folder"""
235223
self.client._perform_empty("PUT", "/project-folders/%s/settings" % (self.project_folder_id), body = self.settings)

0 commit comments

Comments
 (0)