Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/fossology_license.py
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | def index(self, id, data): | ||||
dict: A dict, representing a content_license, with keys: | dict: A dict, representing a content_license, with keys: | ||||
- id (bytes): content's identifier (sha1) | - id (bytes): content's identifier (sha1) | ||||
- license (bytes): license in bytes | - license (bytes): license in bytes | ||||
- path (bytes): path | - path (bytes): path | ||||
- indexer_configuration_id (int): tool used to compute the output | - indexer_configuration_id (int): tool used to compute the output | ||||
""" | """ | ||||
assert isinstance(id, bytes) | |||||
content_path = self.write_to_temp( | content_path = self.write_to_temp( | ||||
filename=hashutil.hash_to_hex(id), # use the id as pathname | filename=hashutil.hash_to_hex(id), # use the id as pathname | ||||
data=data) | data=data) | ||||
try: | try: | ||||
properties = self.compute_license(path=content_path, log=self.log) | properties = self.compute_license(path=content_path, log=self.log) | ||||
properties.update({ | properties.update({ | ||||
'id': id, | 'id': id, | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |