Given a list of `values` for a given `attribute`, return a mapping of {value: count of occurences} using a tallier specific to the attribute.
(values, attribute)
| 269 | |
| 270 | |
| 271 | def tally_values(values, attribute): |
| 272 | """ |
| 273 | Given a list of `values` for a given `attribute`, return a mapping of |
| 274 | {value: count of occurences} using a tallier specific to the attribute. |
| 275 | """ |
| 276 | if attribute not in TALLYABLE_ATTRS: |
| 277 | return {} |
| 278 | from summarycode.copyright_tallies import tally_copyrights, tally_persons |
| 279 | |
| 280 | value_talliers_by_attr = dict( |
| 281 | detected_license_expression=tally_licenses, |
| 282 | copyrights=tally_copyrights, |
| 283 | holders=tally_persons, |
| 284 | authors=tally_persons, |
| 285 | programming_language=tally_languages, |
| 286 | ) |
| 287 | return value_talliers_by_attr[attribute](values) |
| 288 | |
| 289 | |
| 290 | @post_scan_impl |
no outgoing calls
no test coverage detected