Skip to content

Commit 4fd326b

Browse files
committed
Fixed some pre-commit hook issues
1 parent c7640ba commit 4fd326b

File tree

12 files changed

+41
-31
lines changed

12 files changed

+41
-31
lines changed

.flake8

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ extend-exclude =
66
.venv
77
build
88
extend-ignore =
9-
E203 # No whitespace before ':' in [x : y]
10-
E731 # No lambdas — too strict
9+
# No whitespace before ':' in [x : y]
10+
E203,
11+
# No lambdas — too strict
12+
E731,

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 1.1.4
2+
3+
## Bug-Fixes
4+
-
5+
16
# Version 1.1.3
27

38
## Bug-Fixes

deepcave/evaluators/epm/random_forest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,9 @@ def predict_marginalized(self, X: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
432432
# marginalized predictions for each tree
433433
dat_ = np.zeros((X.shape[0], self._model_options.num_trees))
434434
for i, x in enumerate(X):
435-
436435
# marginalize over instances
437436
# 1. get all leaf values for each tree
438-
# type: list[list[float]]
437+
# type= list[list[float]]
439438
preds_trees = [[] for i in range(self._model_options.num_trees)]
440439

441440
for feat in self.instance_features:

deepcave/layouts/sidebar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def update_navigation_items(pathname): # type: ignore
4343
]
4444

4545
point_layouts = []
46-
for (id, name, icon) in points:
46+
for id, name, icon in points:
4747
href = f"/plugins/{id}"
4848
point_layouts += [
4949
html.Li(
@@ -106,7 +106,6 @@ def update_queue_info() -> List[Component]:
106106

107107
collect = []
108108
for jobs, status in zip(all_jobs, job_stati):
109-
110109
for job in jobs:
111110
name = job.meta["display_name"]
112111
job_id = job.id

deepcave/plugins/__init__.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def plugin_input_update(pathname: str, *inputs_list: str) -> List[str]:
314314
update_dict(inputs, new_inputs)
315315

316316
# Set not used inputs
317-
for (id, attribute, _, _) in self.inputs:
317+
for id, attribute, _, _ in self.inputs:
318318
if id not in inputs:
319319
inputs[id] = {}
320320

@@ -421,7 +421,7 @@ def toggle_help_modal(n: Optional[int], is_open: bool) -> Tuple[bool, str]:
421421
return is_open
422422

423423
# Register callback to click on configurations
424-
for (id, *_) in self.outputs:
424+
for id, *_ in self.outputs:
425425
internal_id = self.get_internal_output_id(id)
426426

427427
@app.callback(
@@ -470,8 +470,7 @@ def _inputs_changed(
470470
# If only filters changed, then we don't need to
471471
# calculate the results again.
472472
if last_inputs is not None:
473-
for (id, attribute, filter, _) in self.inputs:
474-
473+
for id, attribute, filter, _ in self.inputs:
475474
if self.activate_run_selection:
476475
if id == "run":
477476
continue
@@ -524,7 +523,7 @@ def _process_raw_outputs(
524523
# We have to add no_updates here for the mode we don't want
525524
count_outputs = 0
526525
count_mpl_outputs = 0
527-
for (_, _, mpl_mode) in self.outputs:
526+
for _, _, mpl_mode in self.outputs:
528527
if mpl_mode:
529528
count_mpl_outputs += 1
530529
else:
@@ -600,7 +599,7 @@ def _dict_to_list(
600599
order = self.outputs # type: ignore
601600

602601
result: List[Optional[str]] = []
603-
for (id, attribute, instance, *_) in order:
602+
for id, attribute, instance, *_ in order:
604603
if not input:
605604
# Instance is mlp_mode in case of outputs
606605
# Simply ignore other outputs.
@@ -637,7 +636,7 @@ def _dict_as_key(self, d: Dict[str, Any], remove_filters: bool = False) -> Optio
637636

638637
new_d = copy.deepcopy(d)
639638
if remove_filters:
640-
for (id, _, filter, _) in self.inputs:
639+
for id, _, filter, _ in self.inputs:
641640
if filter:
642641
if id in new_d:
643642
del new_d[id]
@@ -662,10 +661,9 @@ def _cast_inputs(self, inputs: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str,
662661
casted_inputs: Dict[str, Dict[str, str]] = defaultdict(dict)
663662
for id, attributes in inputs.items():
664663
for attribute in attributes:
665-
666664
# Find corresponding input
667665
type = None
668-
for (id_, attribute_, _, type_) in self.inputs:
666+
for id_, attribute_, _, type_ in self.inputs:
669667
if id == id_ and attribute == attribute_:
670668
type = type_
671669
break
@@ -702,7 +700,7 @@ def _clean_inputs(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
702700
"""
703701
used_ids = []
704702
cleaned_inputs = {}
705-
for (id, attribute, *_) in self.inputs:
703+
for id, attribute, *_ in self.inputs:
706704
# Since self.inputs is ordered, we use the first occuring attribute and add
707705
# the id so it is not used again.
708706
if id not in used_ids:
@@ -1332,7 +1330,7 @@ def generate_inputs(self, **kwargs: Any) -> Dict[str, Any]:
13321330
The inputs for the run.
13331331
"""
13341332
mapping = {}
1335-
for (id, attribute, *_) in self.inputs:
1333+
for id, attribute, *_ in self.inputs:
13361334
# Since `self.inputs` is ordered, we use the first occuring attribute and add
13371335
# the id so it is not used again.
13381336
if id not in mapping:

deepcave/plugins/objective/cost_over_time.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ def check_runs_compatibility(self, runs: List[AbstractRun]) -> None:
3232
if run_inequality == RunInequality.INEQ_BUDGET:
3333
notification.update("The budgets of the runs are not equal.", color="warning")
3434
elif run_inequality == RunInequality.INEQ_CONFIGSPACE:
35-
notification.update("The configuration spaces of the runs are not equal.", color="warning")
35+
notification.update(
36+
"The configuration spaces of the runs are not equal.", color="warning"
37+
)
3638
elif run_inequality == RunInequality.INEQ_META:
3739
notification.update("The meta data of the runs is not equal.", color="warning")
3840
elif run_inequality == RunInequality.INEQ_OBJECTIVE:
3941
notification.update("The objectives of the runs are not equal.", color="warning")
40-
42+
4143
# Set some attributes here
4244
run = runs[0]
4345

deepcave/plugins/objective/pareto_front.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def check_runs_compatibility(self, runs):
3232
if run_inequality == RunInequality.INEQ_BUDGET:
3333
notification.update("The budgets of the runs are not equal.", color="warning")
3434
elif run_inequality == RunInequality.INEQ_CONFIGSPACE:
35-
notification.update("The configuration spaces of the runs are not equal.", color="warning")
35+
notification.update(
36+
"The configuration spaces of the runs are not equal.", color="warning"
37+
)
3638
elif run_inequality == RunInequality.INEQ_META:
3739
notification.update("The meta data of the runs is not equal.", color="warning")
3840
elif run_inequality == RunInequality.INEQ_OBJECTIVE:
@@ -186,7 +188,6 @@ def process(run, inputs):
186188

187189
is_front: Union[List, np.ndarray] = np.ones(points.shape[0], dtype=bool)
188190
for point_idx, costs in enumerate(points):
189-
190191
if is_front[point_idx]:
191192
# Keep any point with a lower/upper cost
192193
# This loop is a little bit complicated than

deepcave/plugins/summary/overview.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ def load_outputs(run, *_):
291291
}
292292

293293
for hp_name, hp in run.configspace.get_hyperparameters_dict().items():
294-
295294
log = False
296295
value = None
297296
if (

deepcave/runs/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,9 @@ def check_equality(
939939
continue
940940

941941
if k not in m2 or m2[k] != v:
942-
raise NotMergeableError("Meta data of runs are not equal.", RunInequality.INEQ_META)
942+
raise NotMergeableError(
943+
"Meta data of runs are not equal.", RunInequality.INEQ_META
944+
)
943945

944946
result["meta"] = m1
945947

@@ -951,7 +953,9 @@ def check_equality(
951953
for run in runs:
952954
cs2 = run.configspace
953955
if cs1 != cs2:
954-
raise NotMergeableError("Configspace of runs are not equal.", RunInequality.INEQ_CONFIGSPACE)
956+
raise NotMergeableError(
957+
"Configspace of runs are not equal.", RunInequality.INEQ_CONFIGSPACE
958+
)
955959

956960
result["configspace"] = cs1
957961

@@ -978,7 +982,9 @@ def check_equality(
978982
continue
979983

980984
if len(o1) != len(o2):
981-
raise NotMergeableError("Objectives of runs are not equal.", RunInequality.INEQ_OBJECTIVE)
985+
raise NotMergeableError(
986+
"Objectives of runs are not equal.", RunInequality.INEQ_OBJECTIVE
987+
)
982988

983989
for o1_, o2_ in zip(o1, o2):
984990
o1_.merge(o2_)
@@ -988,4 +994,4 @@ def check_equality(
988994
if meta:
989995
result["meta"]["objectives"] = serialized_objectives
990996

991-
return result
997+
return result

deepcave/runs/converters/bohb.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def from_path(cls, path):
4949

5050
first_starttime = None
5151
for bohb_run in bohb.get_all_runs():
52-
5352
times = bohb_run.time_stamps
5453
starttime = times["started"]
5554
endtime = times["finished"]

0 commit comments

Comments
 (0)