Skip to content

Commit

Permalink
Sort output
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed Oct 18, 2021
1 parent 9e0f960 commit 3dd9fb0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions traceability.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@
for link in store:
dedupe_store[link] += 1

dedupe_store = [{
'type': k[0],
'source': k[1],
'target': k[2],
'weight': v,
} for k, v in dedupe_store.items()]
dedupe_store = sorted([{
'type': k[0],
'source': k[1],
'target': k[2],
'weight': v,
} for k, v in dedupe_store.items()],
key=lambda x: list(x.values()))

fieldnames = ['source', 'target', 'type', 'weight']
with open(join('output', 'links.csv'), 'w') as handler:
Expand Down

0 comments on commit 3dd9fb0

Please sign in to comment.