MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / tally_values

Function tally_values

src/summarycode/tallies.py:271–287  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

269
270
271def 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

Callers 2

tally_codebase_key_filesFunction · 0.85
tally_codebase_by_facetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected