musicisians   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 18
dl 0
loc 22
rs 10
c 0
b 0
f 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