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

Function party_mapper

src/packagedcode/npm.py:1664–1688  ·  view source on GitHub ↗

Update package parties with party of `party_type` and return package. https://docs.npmjs.com/files/package.json#people-fields-author-contributors

(party, package, party_type)

Source from the content-addressed store, hash-verified

1662
1663
1664def party_mapper(party, package, party_type):
1665 """
1666 Update package parties with party of `party_type` and return package.
1667 https://docs.npmjs.com/files/package.json#people-fields-author-contributors
1668 """
1669 if isinstance(party, list):
1670 for auth in party:
1671 name, email, url = parse_person(auth)
1672 package.parties.append(models.Party(
1673 type=models.party_person,
1674 name=name,
1675 role=party_type,
1676 email=email,
1677 url=url))
1678 else:
1679 # a string or dict
1680 name, email, url = parse_person(party)
1681 package.parties.append(models.Party(
1682 type=models.party_person,
1683 name=name,
1684 role=party_type,
1685 email=email,
1686 url=url))
1687
1688 return package
1689
1690
1691def bugs_mapper(bugs, package):

Callers

nothing calls this directly

Calls 2

parse_personFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected