benedict.core.items_sorted   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 7
dl 0
loc 11
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A _items_sorted_by_item_at_index() 0 2 2
A items_sorted_by_keys() 0 2 1
A items_sorted_by_values() 0 2 1
1
def _items_sorted_by_item_at_index(d, index, reverse):
2
    return sorted(d.items(), key=lambda item: item[index], reverse=reverse)
3
4
5
def items_sorted_by_keys(d, reverse=False):
6
    return _items_sorted_by_item_at_index(d, 0, reverse)
7
8
9
def items_sorted_by_values(d, reverse=False):
10
    return _items_sorted_by_item_at_index(d, 1, reverse)
11