Skip to content

Commit a8c2ded

Browse files
author
janvanrijn
committed
changes pull request
1 parent 2c5c214 commit a8c2ded

2 files changed

Lines changed: 15 additions & 38 deletions

File tree

openml/datasets/functions.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ def list_datasets(offset=None, size=None, tag=None):
116116
117117
Parameters
118118
----------
119-
offset : int
119+
offset : int, optional
120120
the number of datasets to skip, starting from the first
121-
size : int
121+
size : int, optional
122122
the maximum datasets of tasks to show
123-
tag : str
123+
tag : str, optional
124124
the tag to include
125125
126126
Returns
@@ -132,26 +132,17 @@ def list_datasets(offset=None, size=None, tag=None):
132132
the following information:
133133
- dataset id
134134
- status
135-
135+
136136
If qualities are calculated for the dataset, some of
137137
these are also returned.
138138
"""
139139
api_call = "data/list"
140140
if offset is not None:
141-
try:
142-
offset = int(offset)
143-
api_call += "/offset/%d" % offset
144-
except:
145-
raise ValueError("Offset is neither an Integer nor can be "
146-
"cast to an Integer.")
141+
api_call += "/offset/%d" % int(offset)
147142

148143
if size is not None:
149-
try:
150-
size = int(size)
151-
api_call += "/limit/%d" % size
152-
except:
153-
raise ValueError("Size is neither an Integer nor can be "
154-
"cast to an Integer.")
144+
api_call += "/limit/%d" % int(size)
145+
155146
if tag is not None:
156147
api_call += "/tag/%s" % tag
157148

openml/tasks/functions.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ def list_tasks(task_type_id=None, offset=None, size=None, tag=None):
9494
9595
Parameters
9696
----------
97-
task_type_id : int
97+
task_type_id : int, optional
9898
ID of the task type as detailed
9999
`here <http://www.openml.org/search?type=task_type>`_.
100-
offset : int
100+
offset : int, optional
101101
the number of tasks to skip, starting from the first
102-
size : int
102+
size : int, optional
103103
the maximum number of tasks to show
104-
tag : str
104+
tag : str, optional
105105
the tag to include
106106
107107
Returns
@@ -115,28 +115,14 @@ def list_tasks(task_type_id=None, offset=None, size=None, tag=None):
115115
"""
116116
api_call = "task/list"
117117
if task_type_id is not None:
118-
try:
119-
task_type_id = int(task_type_id)
120-
api_call += "/task_type_id/%d" % task_type_id
121-
except:
122-
raise ValueError("Task_type_id is neither an Integer nor can be "
123-
"cast to an Integer.")
118+
api_call += "/task_type_id/%d" % int(task_type_id)
124119

125120
if offset is not None:
126-
try:
127-
offset = int(offset)
128-
api_call += "/offset/%d" % offset
129-
except:
130-
raise ValueError("Offset is neither an Integer nor can be "
131-
"cast to an Integer.")
121+
api_call += "/offset/%d" % int(offset)
132122

133123
if size is not None:
134-
try:
135-
size = int(size)
136-
api_call += "/limit/%d" % size
137-
except:
138-
raise ValueError("Size is neither an Integer nor can be "
139-
"cast to an Integer.")
124+
api_call += "/limit/%d" % int(size)
125+
140126
if tag is not None:
141127
api_call += "/tag/%s" % tag
142128

0 commit comments

Comments
 (0)