Skip to content

Commit 0518210

Browse files
committed
Better API consistency
1 parent e123eb7 commit 0518210

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

dataikuapi/dss/flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def get_successor_computables(self, node, as_type="dict"):
162162
return self._convert_nodes_list(computables, as_type)
163163

164164
def _convert_nodes_list(self, nodes, as_type):
165-
if as_type == "object":
165+
if as_type == "object" or as_type == "objects":
166166
return [self._get_object_from_graph_node(node) for node in nodes]
167167
else:
168168
return nodes

dataikuapi/dss/project.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,22 @@ def set_permissions(self, permissions):
208208
# Datasets
209209
########################################################
210210

211-
def list_datasets(self, rtype="listitems"):
211+
def list_datasets(self, as_type="listitems"):
212212
"""
213213
List the datasets in this project.
214214
215-
:param str rtype: How to return the list. Supported values are "listitems" and "objects".
216-
:returns: The list of the datasets. If "rtype" is "listitems", each one as a :class:`dataset.DSSDatasetListItem`.
217-
If "rtype" is "objects", each one as a :class:`dataset.DSSDataset`
215+
:param str as_type: How to return the list. Supported values are "listitems" and "objects".
216+
:returns: The list of the datasets. If "as_type" is "listitems", each one as a :class:`dataset.DSSDatasetListItem`.
217+
If "as_type" is "objects", each one as a :class:`dataset.DSSDataset`
218218
:rtype: list
219219
"""
220220
items = self.client._perform_json("GET", "/projects/%s/datasets/" % self.project_key)
221-
if rtype == "listitems":
221+
if as_type == "listitems" or as_type == "listitem":
222222
return [DSSDatasetListItem(self.client, item) for item in items]
223-
elif rtype == "objects":
223+
elif as_type == "objects" or as_type == "object":
224224
return [DSSDataset(self.client, self.project_key, item["name"]) for item in items]
225225
else:
226-
raise ValueError("Unknown rtype")
226+
raise ValueError("Unknown as_type")
227227

228228
def get_dataset(self, dataset_name):
229229
"""

0 commit comments

Comments
 (0)