| Total Complexity | 0 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import json |
||
| 2 | from collections import defaultdict |
||
| 3 | |||
| 4 | with open("albums.json") as f: |
||
| 5 | albums = json.load(f) |
||
| 6 | |||
| 7 | artist_titles = defaultdict(list) |
||
| 8 | title_performers = defaultdict(set) |
||
| 9 | performer_instruments = defaultdict(set) |
||
| 10 | for album in albums: |
||
| 11 | artist_titles[album.get('Artist')].append(album.get('Title')) |
||
| 12 | performers = [tuple(p.strip().split(':')) for p in album.get('Performer').split('/')] |
||
| 13 | for items in performers: |
||
| 14 | performer = items[0].strip() |
||
| 15 | title_performers[album.get('Title')].add(performer) |
||
| 16 | |||
| 17 | if len(items) > 1: |
||
| 18 | for instrument in items[1].strip().split(','): |
||
| 19 | performer_instruments[performer].add(instrument) |
||
| 20 | |||
| 21 | print('a') |
||
| 22 |