Skip to content

Commit

Permalink
Add initializer to handle empty sequence when reducing
Browse files Browse the repository at this point in the history
closes: #83
  • Loading branch information
nuwang committed Feb 28, 2023
1 parent 46bb546 commit 34ec897
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tpv/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def sum_total(prev, current):
def calculate_dataset_total(datasets):
if datasets:
unique_datasets = {inp_ds.dataset.dataset.id: inp_ds.dataset.dataset for inp_ds in datasets if inp_ds.dataset}
return reduce(sum_total,
map(get_dataset_size, unique_datasets.values()))
return reduce(sum_total, map(get_dataset_size, unique_datasets.values()), 0.0)
else:
return 0.0

Expand Down

0 comments on commit 34ec897

Please sign in to comment.