Return a list of ordered mapping of {value:val, count:cnt} built from a `counter` mapping of {value: count} and sortedd by decreasing count then by value.
(counter)
| 44 | |
| 45 | |
| 46 | def sorted_counter(counter): |
| 47 | """ |
| 48 | Return a list of ordered mapping of {value:val, count:cnt} built from a |
| 49 | `counter` mapping of {value: count} and sortedd by decreasing count then by |
| 50 | value. |
| 51 | """ |
| 52 | |
| 53 | def by_count_value(value_count): |
| 54 | value, count = value_count |
| 55 | return -count, value or '' |
| 56 | |
| 57 | summarized = [ |
| 58 | dict([('value', value), ('count', count)]) |
| 59 | for value, count in sorted(counter.items(), key=by_count_value)] |
| 60 | return summarized |
| 61 | |
| 62 | |
| 63 | def get_resource_tallies(resource, key, as_attribute=False): |
no outgoing calls
no test coverage detected