Skip to content

Commit dba5d58

Browse files
committed
changed 'save_conditions' to 'success_conditions'
1 parent 79db8b8 commit dba5d58

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ results = xl.excel_runner(
6969
"OptB": {"B2": 33},
7070
"OptC": {"B2": 55},
7171
},
72-
save_conditions={"B6": dcr2},
72+
success_conditions={"B6": dcr2},
7373
static_identifier_keys=["Labels"],
7474
result_labels={"B6": "meaningful_value"},
7575
save_dir=TEST_DATA_DIR / "design"

src/xl_engine/excel_engine.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def excel_runner(
1515
xlsx_filepath,
1616
static_inputs: dict[str, list],
1717
dynamic_inputs: dict[str, dict[str, float]],
18-
save_conditions: dict[str, callable],
18+
success_conditions: dict[str, callable],
1919
static_identifier_keys: Optional[list[str]] = None,
2020
result_labels: Optional[dict[str, str]] = None,
2121
save_dir: Optional[str] = None,
@@ -40,9 +40,9 @@ def excel_runner(
4040
label to describe the iteration, e.g. the name of the design element.
4141
The values are dictionaries keyed by cell references with single values which will
4242
populate the workbook for every static iteration.
43-
'save_conditions': a dictionary keyed by cell references whose values are unary callables
43+
'success_conditions': a dictionary keyed by cell references whose values are unary callables
4444
which return a bool when passed the value retrieved from the workbook at the cell
45-
reference during each iteration. If all callables in the 'save_conditions' dict
45+
reference during each iteration. If all callables in the 'success_conditions' dict
4646
return True, then that iteration of the workbook will be saved to disk. Use the
4747
create_condition_check() function in this module to quickly create such callables.
4848
'static_identifier_keys': The keys in 'static_inputs', which are not cell references,
@@ -105,7 +105,7 @@ def excel_runner(
105105
calculated_results = execute_workbook(
106106
xlsx_filepath,
107107
cells_to_change=cells_to_change,
108-
cells_to_retrieve=list(save_conditions.keys()),
108+
cells_to_retrieve=list(success_conditions.keys()),
109109
sheet_idx=sheet_idx
110110
)
111111
if isinstance(result_labels, dict):
@@ -116,7 +116,7 @@ def excel_runner(
116116
failed_results.update({design_tag: labeled_results})
117117

118118
save_condition_acc = []
119-
for result_cell_id, save_condition in save_conditions.items():
119+
for result_cell_id, save_condition in success_conditions.items():
120120
calculated_result = calculated_results[result_cell_id]
121121
save_condition_acc.append(save_condition(calculated_result))
122122
variations_progress.update(variations_task, advance=1)
@@ -133,7 +133,7 @@ def excel_runner(
133133
_ = execute_workbook(
134134
xlsx_filepath,
135135
cells_to_change=cells_to_change,
136-
cells_to_retrieve=list(save_conditions.keys()),
136+
cells_to_retrieve=list(success_conditions.keys()),
137137
new_filepath=f"{str(save_dir)}/{new_filename}",
138138
sheet_idx=sheet_idx,
139139
)

tests/test_excel_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_excel_runner():
5151
"OptB": {"B2": 33},
5252
"OptC": {"B2": 55},
5353
},
54-
save_conditions={"B6": dcr2},
54+
success_conditions={"B6": dcr2},
5555
static_identifier_keys=["Labels"],
5656
result_labels={"B6": "meaningful_value"},
5757
save_dir=TEST_DATA_DIR / "design"

0 commit comments

Comments
 (0)