Skip to content

Commit 229592f

Browse files
committed
remove unused func
1 parent 9accf24 commit 229592f

1 file changed

Lines changed: 0 additions & 119 deletions

File tree

openml/runs/functions.py

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,125 +1092,6 @@ def list_runs( # noqa: PLR0913
10921092
return pd.concat(batches)
10931093

10941094

1095-
def _list_runs( # noqa: PLR0913, C901
1096-
limit: int,
1097-
offset: int,
1098-
*,
1099-
id: list | None = None, # noqa: A002
1100-
task: list | None = None,
1101-
setup: list | None = None,
1102-
flow: list | None = None,
1103-
uploader: list | None = None,
1104-
study: int | None = None,
1105-
tag: str | None = None,
1106-
display_errors: bool = False,
1107-
task_type: TaskType | int | None = None,
1108-
) -> pd.DataFrame:
1109-
"""
1110-
Perform API call `/run/list/{filters}'
1111-
<https://www.openml.org/api_docs/#!/run/get_run_list_filters>`
1112-
1113-
Parameters
1114-
----------
1115-
The arguments that are lists are separated from the single value
1116-
ones which are put into the kwargs.
1117-
display_errors is also separated from the kwargs since it has a
1118-
default value.
1119-
1120-
id : list, optional
1121-
1122-
task : list, optional
1123-
1124-
setup: list, optional
1125-
1126-
flow : list, optional
1127-
1128-
tag: str, optional
1129-
1130-
uploader : list, optional
1131-
1132-
study : int, optional
1133-
1134-
display_errors : bool, optional (default=None)
1135-
Whether to list runs which have an error (for example a missing
1136-
prediction file).
1137-
1138-
task_type : str, optional
1139-
1140-
Returns
1141-
-------
1142-
dict, or dataframe
1143-
List of found runs.
1144-
"""
1145-
api_call = "run/list"
1146-
if limit is not None:
1147-
api_call += f"/limit/{limit}"
1148-
if offset is not None:
1149-
api_call += f"/offset/{offset}"
1150-
if id is not None:
1151-
api_call += f"/run/{','.join([str(int(i)) for i in id])}"
1152-
if task is not None:
1153-
api_call += f"/task/{','.join([str(int(i)) for i in task])}"
1154-
if setup is not None:
1155-
api_call += f"/setup/{','.join([str(int(i)) for i in setup])}"
1156-
if flow is not None:
1157-
api_call += f"/flow/{','.join([str(int(i)) for i in flow])}"
1158-
if uploader is not None:
1159-
api_call += f"/uploader/{','.join([str(int(i)) for i in uploader])}"
1160-
if study is not None:
1161-
api_call += f"/study/{study}"
1162-
if display_errors:
1163-
api_call += "/show_errors/true"
1164-
if tag is not None:
1165-
api_call += f"/tag/{tag}"
1166-
if task_type is not None:
1167-
tvalue = task_type.value if isinstance(task_type, TaskType) else task_type
1168-
api_call += f"/task_type/{tvalue}"
1169-
return __list_runs(api_call=api_call)
1170-
1171-
1172-
def __list_runs(api_call: str) -> pd.DataFrame:
1173-
"""Helper function to parse API calls which are lists of runs"""
1174-
xml_string = openml._api_calls._perform_api_call(api_call, "get")
1175-
runs_dict = xmltodict.parse(xml_string, force_list=("oml:run",))
1176-
# Minimalistic check if the XML is useful
1177-
if "oml:runs" not in runs_dict:
1178-
raise ValueError(f'Error in return XML, does not contain "oml:runs": {runs_dict}')
1179-
1180-
if "@xmlns:oml" not in runs_dict["oml:runs"]:
1181-
raise ValueError(
1182-
f'Error in return XML, does not contain "oml:runs"/@xmlns:oml: {runs_dict}'
1183-
)
1184-
1185-
if runs_dict["oml:runs"]["@xmlns:oml"] != "http://openml.org/openml":
1186-
raise ValueError(
1187-
"Error in return XML, value of "
1188-
'"oml:runs"/@xmlns:oml is not '
1189-
f'"http://openml.org/openml": {runs_dict}',
1190-
)
1191-
1192-
if not isinstance(runs_dict["oml:runs"]["oml:run"], list):
1193-
raise TypeError(
1194-
f"Expected runs_dict['oml:runs']['oml:run'] to be a list, "
1195-
f"got {type(runs_dict['oml:runs']['oml:run']).__name__}"
1196-
)
1197-
1198-
runs = {
1199-
int(r["oml:run_id"]): {
1200-
"run_id": int(r["oml:run_id"]),
1201-
"task_id": int(r["oml:task_id"]),
1202-
"setup_id": int(r["oml:setup_id"]),
1203-
"flow_id": int(r["oml:flow_id"]),
1204-
"uploader": int(r["oml:uploader"]),
1205-
"task_type": TaskType(int(r["oml:task_type_id"])),
1206-
"upload_time": str(r["oml:upload_time"]),
1207-
"error_message": str((r["oml:error_message"]) or ""),
1208-
}
1209-
for r in runs_dict["oml:runs"]["oml:run"]
1210-
}
1211-
return pd.DataFrame.from_dict(runs, orient="index")
1212-
1213-
12141095
def format_prediction( # noqa: PLR0913
12151096
task: OpenMLSupervisedTask,
12161097
repeat: int,

0 commit comments

Comments
 (0)