Skip to content

Commit 36234af

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ca86c9e commit 36234af

25 files changed

+96
-102
lines changed

openml/__init__.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -91,35 +91,35 @@ def populate_cache(
9191

9292

9393
__all__ = [
94-
"OpenMLDataset",
94+
"OpenMLBenchmarkSuite",
95+
"OpenMLClassificationTask",
96+
"OpenMLClusteringTask",
9597
"OpenMLDataFeature",
96-
"OpenMLRun",
97-
"OpenMLSplit",
98+
"OpenMLDataset",
9899
"OpenMLEvaluation",
99-
"OpenMLSetup",
100-
"OpenMLParameter",
101-
"OpenMLTask",
102-
"OpenMLSupervisedTask",
103-
"OpenMLClusteringTask",
100+
"OpenMLFlow",
104101
"OpenMLLearningCurveTask",
102+
"OpenMLParameter",
105103
"OpenMLRegressionTask",
106-
"OpenMLClassificationTask",
107-
"OpenMLFlow",
104+
"OpenMLRun",
105+
"OpenMLSetup",
106+
"OpenMLSplit",
108107
"OpenMLStudy",
109-
"OpenMLBenchmarkSuite",
108+
"OpenMLSupervisedTask",
109+
"OpenMLTask",
110+
"__version__",
111+
"_api_calls",
112+
"config",
110113
"datasets",
111114
"evaluations",
112115
"exceptions",
113116
"extensions",
114-
"config",
115-
"runs",
116117
"flows",
117-
"tasks",
118+
"runs",
118119
"setups",
119120
"study",
121+
"tasks",
120122
"utils",
121-
"_api_calls",
122-
"__version__",
123123
]
124124

125125
# Load the scikit-learn extension by default

openml/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,10 @@ def overwrite_config_context(config: dict[str, Any]) -> Iterator[_Config]:
513513

514514
__all__ = [
515515
"get_cache_directory",
516+
"get_config_as_dict",
516517
"set_root_cache_directory",
517518
"start_using_configuration_for_example",
518519
"stop_using_configuration_for_example",
519-
"get_config_as_dict",
520520
]
521521

522522
_setup()

openml/datasets/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
)
1818

1919
__all__ = [
20+
"OpenMLDataFeature",
21+
"OpenMLDataset",
2022
"attributes_arff_from_df",
2123
"check_datasets_active",
2224
"create_dataset",
25+
"delete_dataset",
26+
"edit_dataset",
27+
"fork_dataset",
2328
"get_dataset",
2429
"get_datasets",
2530
"list_datasets",
26-
"OpenMLDataset",
27-
"OpenMLDataFeature",
28-
"status_update",
2931
"list_qualities",
30-
"edit_dataset",
31-
"fork_dataset",
32-
"delete_dataset",
32+
"status_update",
3333
]

openml/datasets/data_feature.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ def __init__( # noqa: PLR0913
5151
if data_type == "nominal":
5252
if nominal_values is None:
5353
raise TypeError(
54-
"Dataset features require attribute `nominal_values` for nominal "
55-
"feature type.",
54+
"Dataset features require attribute `nominal_values` for nominal feature type.",
5655
)
5756

5857
if not isinstance(nominal_values, list):

openml/datasets/dataset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def _parse_data_from_arff( # noqa: C901, PLR0912, PLR0915
448448
data = self._get_arff(self.format)
449449
except OSError as e:
450450
logger.critical(
451-
f"Please check that the data file {arff_file_path} is " "there and can be read.",
451+
f"Please check that the data file {arff_file_path} is there and can be read.",
452452
)
453453
raise e
454454

openml/datasets/functions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def list_qualities() -> list[str]:
7272
raise ValueError('Error in return XML, does not contain "oml:data_qualities_list"')
7373

7474
if not isinstance(qualities["oml:data_qualities_list"]["oml:quality"], list):
75-
raise TypeError("Error in return XML, does not contain " '"oml:quality" as a list')
75+
raise TypeError('Error in return XML, does not contain "oml:quality" as a list')
7676

7777
return qualities["oml:data_qualities_list"]["oml:quality"]
7878

@@ -177,7 +177,7 @@ def list_datasets(
177177
"""
178178
if output_format not in ["dataframe", "dict"]:
179179
raise ValueError(
180-
"Invalid output format selected. " "Only 'dict' or 'dataframe' applicable.",
180+
"Invalid output format selected. Only 'dict' or 'dataframe' applicable.",
181181
)
182182

183183
# TODO: [0.15]

openml/evaluations/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
__all__ = [
77
"OpenMLEvaluation",
8-
"list_evaluations",
98
"list_evaluation_measures",
9+
"list_evaluations",
1010
"list_evaluations_setups",
1111
]

openml/evaluations/evaluation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __repr__(self) -> str:
103103
"Run ID",
104104
"OpenML Run URL",
105105
"Task ID",
106-
"OpenML Task URL" "Flow ID",
106+
"OpenML Task URLFlow ID",
107107
"OpenML Flow URL",
108108
"Setup ID",
109109
"Data ID",

openml/evaluations/functions.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def __list_evaluations(
234234
# Minimalistic check if the XML is useful
235235
if "oml:evaluations" not in evals_dict:
236236
raise ValueError(
237-
"Error in return XML, does not contain " f'"oml:evaluations": {evals_dict!s}',
237+
f'Error in return XML, does not contain "oml:evaluations": {evals_dict!s}',
238238
)
239239

240240
assert isinstance(evals_dict["oml:evaluations"]["oml:evaluation"], list), type(
@@ -321,9 +321,9 @@ def list_evaluation_measures() -> list[str]:
321321
qualities = xmltodict.parse(xml_string, force_list=("oml:measures"))
322322
# Minimalistic check if the XML is useful
323323
if "oml:evaluation_measures" not in qualities:
324-
raise ValueError("Error in return XML, does not contain " '"oml:evaluation_measures"')
324+
raise ValueError('Error in return XML, does not contain "oml:evaluation_measures"')
325325
if not isinstance(qualities["oml:evaluation_measures"]["oml:measures"][0]["oml:measure"], list):
326-
raise TypeError("Error in return XML, does not contain " '"oml:measure" as a list')
326+
raise TypeError('Error in return XML, does not contain "oml:measure" as a list')
327327
return qualities["oml:evaluation_measures"]["oml:measures"][0]["oml:measure"]
328328

329329

@@ -343,13 +343,13 @@ def list_estimation_procedures() -> list[str]:
343343

344344
# Minimalistic check if the XML is useful
345345
if "oml:estimationprocedures" not in api_results:
346-
raise ValueError("Error in return XML, does not contain " '"oml:estimationprocedures"')
346+
raise ValueError('Error in return XML, does not contain "oml:estimationprocedures"')
347347
if "oml:estimationprocedure" not in api_results["oml:estimationprocedures"]:
348-
raise ValueError("Error in return XML, does not contain " '"oml:estimationprocedure"')
348+
raise ValueError('Error in return XML, does not contain "oml:estimationprocedure"')
349349

350350
if not isinstance(api_results["oml:estimationprocedures"]["oml:estimationprocedure"], list):
351351
raise TypeError(
352-
"Error in return XML, does not contain " '"oml:estimationprocedure" as a list',
352+
'Error in return XML, does not contain "oml:estimationprocedure" as a list',
353353
)
354354

355355
return [
@@ -415,7 +415,7 @@ def list_evaluations_setups(
415415
"""
416416
if parameters_in_separate_columns and (flows is None or len(flows) != 1):
417417
raise ValueError(
418-
"Can set parameters_in_separate_columns to true " "only for single flow_id",
418+
"Can set parameters_in_separate_columns to true only for single flow_id",
419419
)
420420

421421
# List evaluations

openml/extensions/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
__all__ = [
1212
"Extension",
13-
"register_extension",
14-
"get_extension_by_model",
1513
"get_extension_by_flow",
14+
"get_extension_by_model",
15+
"register_extension",
1616
]

openml/extensions/sklearn/extension.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1254,8 +1254,7 @@ def _check_dependencies(
12541254
else:
12551255
raise NotImplementedError(f"operation '{operation}' is not supported")
12561256
message = (
1257-
"Trying to deserialize a model with dependency "
1258-
f"{dependency_string} not satisfied."
1257+
f"Trying to deserialize a model with dependency {dependency_string} not satisfied."
12591258
)
12601259
if not check:
12611260
if strict_version:
@@ -1497,7 +1496,7 @@ def _prevent_optimize_n_jobs(self, model):
14971496
)
14981497
if len(n_jobs_vals) > 0:
14991498
raise PyOpenMLError(
1500-
"openml-python should not be used to " "optimize the n_jobs parameter.",
1499+
"openml-python should not be used to optimize the n_jobs parameter.",
15011500
)
15021501

15031502
################################################################################################
@@ -1555,7 +1554,7 @@ def _seed_current_object(current_value):
15551554

15561555
if current_value is not None:
15571556
raise ValueError(
1558-
"Models should be seeded with int or None (this should never " "happen). ",
1557+
"Models should be seeded with int or None (this should never happen). ",
15591558
)
15601559

15611560
return True
@@ -2006,7 +2005,7 @@ def is_subcomponent_specification(values):
20062005
# (mixed)). OpenML replaces the subcomponent by an
20072006
# OpenMLFlow object.
20082007
if len(subcomponent) < 2 or len(subcomponent) > 3:
2009-
raise ValueError("Component reference should be " "size {2,3}. ")
2008+
raise ValueError("Component reference should be size {2,3}. ")
20102009

20112010
subcomponent_identifier = subcomponent[0]
20122011
subcomponent_flow = subcomponent[1]

openml/flows/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
__all__ = [
1414
"OpenMLFlow",
15-
"get_flow",
16-
"list_flows",
17-
"get_flow_id",
18-
"flow_exists",
1915
"assert_flows_equal",
2016
"delete_flow",
17+
"flow_exists",
18+
"get_flow",
19+
"get_flow_id",
20+
"list_flows",
2121
]

openml/flows/flow.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def publish(self, raise_error_if_exists: bool = False) -> OpenMLFlow: # noqa: F
438438
if not flow_id:
439439
if self.flow_id:
440440
raise openml.exceptions.PyOpenMLError(
441-
"Flow does not exist on the server, " "but 'flow.flow_id' is not None.",
441+
"Flow does not exist on the server, but 'flow.flow_id' is not None.",
442442
)
443443
super().publish()
444444
assert self.flow_id is not None # for mypy
@@ -448,7 +448,7 @@ def publish(self, raise_error_if_exists: bool = False) -> OpenMLFlow: # noqa: F
448448
raise openml.exceptions.PyOpenMLError(error_message)
449449
elif self.flow_id is not None and self.flow_id != flow_id:
450450
raise openml.exceptions.PyOpenMLError(
451-
"Local flow_id does not match server flow_id: " f"'{self.flow_id}' vs '{flow_id}'",
451+
f"Local flow_id does not match server flow_id: '{self.flow_id}' vs '{flow_id}'",
452452
)
453453

454454
flow = openml.flows.functions.get_flow(flow_id)
@@ -520,7 +520,7 @@ def get_subflow(self, structure: list[str]) -> OpenMLFlow:
520520
sub_identifier = structure[0]
521521
if sub_identifier not in self.components:
522522
raise ValueError(
523-
f"Flow {self.name} does not contain component with " f"identifier {sub_identifier}",
523+
f"Flow {self.name} does not contain component with identifier {sub_identifier}",
524524
)
525525
if len(structure) == 1:
526526
return self.components[sub_identifier] # type: ignore

openml/flows/functions.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _get_cached_flow(fid: int) -> OpenMLFlow:
6767
return _create_flow_from_xml(fh.read())
6868
except OSError as e:
6969
openml.utils._remove_cache_dir_for_id(FLOWS_CACHE_DIR_NAME, fid_cache_dir)
70-
raise OpenMLCacheException("Flow file for fid %d not " "cached" % fid) from e
70+
raise OpenMLCacheException("Flow file for fid %d not cached" % fid) from e
7171

7272

7373
@openml.utils.thread_safe_if_oslo_installed
@@ -217,7 +217,7 @@ def list_flows(
217217
"""
218218
if output_format not in ["dataframe", "dict"]:
219219
raise ValueError(
220-
"Invalid output format selected. " "Only 'dict' or 'dataframe' applicable.",
220+
"Invalid output format selected. Only 'dict' or 'dataframe' applicable.",
221221
)
222222

223223
# TODO: [0.15]
@@ -514,11 +514,11 @@ def assert_flows_equal( # noqa: C901, PLR0912, PLR0913, PLR0915
514514
for name in set(attr1.keys()).union(attr2.keys()):
515515
if name not in attr1:
516516
raise ValueError(
517-
f"Component {name} only available in " "argument2, but not in argument1.",
517+
f"Component {name} only available in argument2, but not in argument1.",
518518
)
519519
if name not in attr2:
520520
raise ValueError(
521-
f"Component {name} only available in " "argument2, but not in argument1.",
521+
f"Component {name} only available in argument2, but not in argument1.",
522522
)
523523
assert_flows_equal(
524524
attr1[name],
@@ -547,9 +547,9 @@ def assert_flows_equal( # noqa: C901, PLR0912, PLR0913, PLR0915
547547
)
548548

549549
if ignore_parameter_values_on_older_children:
550-
assert (
551-
flow1.upload_date is not None
552-
), "Flow1 has no upload date that allows us to compare age of children."
550+
assert flow1.upload_date is not None, (
551+
"Flow1 has no upload date that allows us to compare age of children."
552+
)
553553
upload_date_current_flow = dateutil.parser.parse(flow1.upload_date)
554554
upload_date_parent_flow = dateutil.parser.parse(
555555
ignore_parameter_values_on_older_children,
@@ -579,7 +579,7 @@ def assert_flows_equal( # noqa: C901, PLR0912, PLR0913, PLR0915
579579
params2 = set(flow2.parameters_meta_info)
580580
if params1 != params2:
581581
raise ValueError(
582-
"Parameter list in meta info for parameters differ " "in the two flows.",
582+
"Parameter list in meta info for parameters differ in the two flows.",
583583
)
584584
# iterating over the parameter's meta info list
585585
for param in params1:

openml/runs/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
"OpenMLRun",
2020
"OpenMLRunTrace",
2121
"OpenMLTraceIteration",
22-
"run_model_on_task",
23-
"run_flow_on_task",
22+
"delete_run",
2423
"get_run",
25-
"list_runs",
26-
"get_runs",
2724
"get_run_trace",
28-
"run_exists",
25+
"get_runs",
2926
"initialize_model_from_run",
3027
"initialize_model_from_trace",
31-
"delete_run",
28+
"list_runs",
29+
"run_exists",
30+
"run_flow_on_task",
31+
"run_model_on_task",
3232
]

0 commit comments

Comments
 (0)