neels has uploaded this change for review.

View Change

saip/batch: add blacklist to to_csv_rows()

Allow calling code to mute specific parameters from an output CSV.

For example, the SUCI CalcInfo data should be identical for all profiles
of a batch, and is also very long data. After this patch, an application
can name specific parameters to omit from an output CSV.

Change-Id: I5e567e59a007cf4b5d75a4dcea5371ff4404bf24
Jenkins: skip-card-test
---
M pySim/esim/saip/batch.py
1 file changed, 4 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/16/43516/1
diff --git a/pySim/esim/saip/batch.py b/pySim/esim/saip/batch.py
index 338c5d1..5939d65 100644
--- a/pySim/esim/saip/batch.py
+++ b/pySim/esim/saip/batch.py
@@ -324,12 +324,15 @@

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."""
columns = set()
for audit in self:
columns.update(audit.keys())

+ if column_blacklist:
+ columns.difference_update(set(column_blacklist))
+
columns = tuple(sorted(columns, key=sort_key))

if headers:

To view, visit change 43516. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I5e567e59a007cf4b5d75a4dcea5371ff4404bf24
Gerrit-Change-Number: 43516
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>