openhands openhands commited on
Commit
cdd40ba
·
1 Parent(s): b8aea20

Fix TypeError when summing costs with None values

Browse files

Filter out None values before summing costs to prevent TypeError.

Co-authored-by: openhands <openhands@all-hands.dev>

Files changed (1) hide show
  1. simple_data_loader.py +5 -3
simple_data_loader.py CHANGED
@@ -292,9 +292,11 @@ class SimpleLeaderboardViewer:
292
  record[f'{category} score'] = avg_score
293
  categories_with_scores += 1
294
  if data['costs']:
295
- cat_cost = sum(data['costs'])
296
- record[f'{category} cost'] = cat_cost
297
- total_cost += cat_cost
 
 
298
  else:
299
  # Category not submitted - will show as NA
300
  pass
 
292
  record[f'{category} score'] = avg_score
293
  categories_with_scores += 1
294
  if data['costs']:
295
+ valid_costs = [c for c in data['costs'] if c is not None]
296
+ if valid_costs:
297
+ cat_cost = sum(valid_costs)
298
+ record[f'{category} cost'] = cat_cost
299
+ total_cost += cat_cost
300
  else:
301
  # Category not submitted - will show as NA
302
  pass