forked from public/pysim
saip/batch: add blacklist to to_csv_rows()
Change-Id: I5e567e59a007cf4b5d75a4dcea5371ff4404bf24
This commit is contained in:
@@ -325,12 +325,15 @@ class BatchAudit(list):
|
|||||||
|
|
||||||
return batch_audit
|
return batch_audit
|
||||||
|
|
||||||
def to_csv_rows(self, headers=True, sort_key=None):
|
def to_csv_rows(self, headers=True, sort_key=None, column_blacklist=None):
|
||||||
'''generator that yields all audits' values as rows, useful feed to a csv.writer.'''
|
'''generator that yields all audits' values as rows, useful feed to a csv.writer.'''
|
||||||
columns = set()
|
columns = set()
|
||||||
for audit in self:
|
for audit in self:
|
||||||
columns.update(audit.keys())
|
columns.update(audit.keys())
|
||||||
|
|
||||||
|
if column_blacklist:
|
||||||
|
columns.difference_update(set(column_blacklist))
|
||||||
|
|
||||||
columns = tuple(sorted(columns, key=sort_key))
|
columns = tuple(sorted(columns, key=sort_key))
|
||||||
|
|
||||||
if headers:
|
if headers:
|
||||||
|
|||||||
Reference in New Issue
Block a user