update
This commit is contained in:
+5
-2
@@ -219,10 +219,13 @@ def export_csv(path, rows):
|
||||
suffix += 1
|
||||
destination = base.with_name(f'{base.stem}-{suffix}.csv')
|
||||
with handle:
|
||||
writer = csv.DictWriter(handle, fieldnames=FIELDS + ['disk_size'])
|
||||
export_fields = [field for field in FIELDS if field != 'size_is_approximate']
|
||||
writer = csv.DictWriter(handle, fieldnames=export_fields + ['disk_size'])
|
||||
writer.writeheader()
|
||||
for row in rows:
|
||||
writer.writerow(dict(row, disk_size=format_size(row['size_bytes'], row.get('size_is_approximate', False))))
|
||||
exported = {field: row.get(field) for field in export_fields}
|
||||
exported['disk_size'] = format_size(row['size_bytes'], row.get('size_is_approximate', False))
|
||||
writer.writerow(exported)
|
||||
return destination
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user