Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/in_memory.py
Show First 20 Lines • Show All 407 Lines • ▼ Show 20 Lines | def content_fossology_license_get(self, ids): | ||||
Yields: | Yields: | ||||
`{id: facts}` where `facts` is a dict with the following keys: | `{id: facts}` where `facts` is a dict with the following keys: | ||||
- **licenses** ([str]): associated licenses for that content | - **licenses** ([str]): associated licenses for that content | ||||
- **tool** (dict): Tool used to compute the license | - **tool** (dict): Tool used to compute the license | ||||
""" | """ | ||||
# TODO: remove this reformatting in order to yield items with the | # Rewrites the output of SubStorage.get from the old format to | ||||
olasd: one all -> once all | |||||
# same format as other _get methods. | # the new one. SubStorage.get should be updated once all other | ||||
# *_get methods use the new format. | |||||
# See: https://forge.softwareheritage.org/T1433 | |||||
res = {} | res = {} | ||||
for d in self._licenses.get(ids): | for d in self._licenses.get(ids): | ||||
res.setdefault(d.pop('id'), []).append(d) | res.setdefault(d.pop('id'), []).append(d) | ||||
for (id_, facts) in res.items(): | for (id_, facts) in res.items(): | ||||
yield {id_: facts} | yield {id_: facts} | ||||
def content_fossology_license_add(self, licenses, conflict_update=False): | def content_fossology_license_add(self, licenses, conflict_update=False): | ||||
"""Add licenses not present in storage. | """Add licenses not present in storage. | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |
one all -> once all