diff --git a/openml/utils.py b/openml/utils.py index c80fa0593..cc976b4c3 100644 --- a/openml/utils.py +++ b/openml/utils.py @@ -118,9 +118,10 @@ def list_all(listing_call, batch_size=10000, *args, **filters): dict """ page = 0 + has_more = 1 result = {} - while True: + while has_more: try: new_batch = listing_call( *args, @@ -135,5 +136,6 @@ def list_all(listing_call, batch_size=10000, *args, **filters): break result.update(new_batch) page += 1 + has_more = (len(new_batch) == batch_size) return result