Skip to content

Commit 215f892

Browse files
authored
Merge branch 'develop' into fix373
2 parents 0e4b1bf + 1819b63 commit 215f892

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

openml/datasets/functions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _get_cached_dataset_arff(dataset_id):
137137
"cached" % dataset_id)
138138

139139

140-
def list_datasets(offset=None, size=None, tag=None):
140+
def list_datasets(offset=None, size=None, tag=None, status=None):
141141
"""Return a list of all dataset which are on OpenML.
142142
143143
Parameters
@@ -148,6 +148,10 @@ def list_datasets(offset=None, size=None, tag=None):
148148
The maximum number of datasets to show.
149149
tag : str, optional
150150
Only include datasets matching this tag.
151+
status : str, optional
152+
Should be {active, in_preparation, deactivated}. By
153+
default active datasets are returned, but also datasets
154+
from another status can be requested.
151155
152156
Returns
153157
-------
@@ -174,6 +178,9 @@ def list_datasets(offset=None, size=None, tag=None):
174178
if tag is not None:
175179
api_call += "/tag/%s" % tag
176180

181+
if status is not None:
182+
api_call += "/status/%s" %status
183+
177184
return _list_datasets(api_call)
178185

179186

openml/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ def list_all(listing_call, batch_size=10000, *args, **filters):
118118
dict
119119
"""
120120
page = 0
121+
has_more = 1
121122
result = {}
122123

123-
while True:
124+
while has_more:
124125
try:
125126
new_batch = listing_call(
126127
*args,
@@ -135,5 +136,6 @@ def list_all(listing_call, batch_size=10000, *args, **filters):
135136
break
136137
result.update(new_batch)
137138
page += 1
139+
has_more = (len(new_batch) == batch_size)
138140

139141
return result

0 commit comments

Comments
 (0)