Skip to content

Commit

Permalink
Use plural
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Dec 3, 2024
1 parent da279ac commit e089347
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/optimagic/optimization/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,17 @@ def _batch_apply(
other values of that batch are set to zero.
"""
batch_start = _get_batch_start(batch_ids)
batch_stop = [*batch_start, len(data)][1:]
batch_starts = _get_batch_start(batch_ids)
batch_stops = [*batch_starts, len(data)][1:]

batch_result = []
batch_results = []
for batch, (start, stop) in zip(
batch_ids, zip(batch_start, batch_stop, strict=False), strict=False
batch_ids, zip(batch_starts, batch_stops, strict=False), strict=False
):
try:
batch_data = data[start:stop]
reduced = func(batch_data)
batch_result.append(reduced)
batch_results.append(reduced)
except Exception as e:
msg = (

Check warning on line 418 in src/optimagic/optimization/history.py

View check run for this annotation

Codecov / codecov/patch

src/optimagic/optimization/history.py#L417-L418

Added lines #L417 - L418 were not covered by tests
f"Calling function {func.__name__} on batch {batch} of the History "
Expand All @@ -423,7 +423,7 @@ def _batch_apply(
raise ValueError(msg) from e

Check warning on line 423 in src/optimagic/optimization/history.py

View check run for this annotation

Codecov / codecov/patch

src/optimagic/optimization/history.py#L423

Added line #L423 was not covered by tests

out = np.zeros_like(data)
out[batch_start] = batch_result
out[batch_starts] = batch_results
return out


Expand Down

0 comments on commit e089347

Please sign in to comment.