Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9346053
D301.id1001.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D301.id1001.diff
View Options
diff --git a/swh/indexer/storage/__init__.py b/swh/indexer/storage/__init__.py
--- a/swh/indexer/storage/__init__.py
+++ b/swh/indexer/storage/__init__.py
@@ -8,6 +8,8 @@
import dateutil.parser
import psycopg2
+from collections import defaultdict
+
from swh.storage.common import db_transaction_generator, db_transaction
from swh.storage.exc import StorageDBError
from .db import Db
@@ -292,15 +294,20 @@
list: dictionaries with the following keys:
- id (bytes)
- - licenses ([str]): associated licenses for that content
"""
db = self.db
db.store_tmp_bytea(ids, cur)
+ d = defaultdict(list)
for c in db.content_fossology_license_get_from_temp():
license = dict(zip(db.content_fossology_license_cols, c))
- yield converters.db_to_fossology_license(license)
+
+ id_ = license['id']
+ d[id_].append(converters.db_to_fossology_license(license))
+
+ for id_, facts in d.items():
+ yield {id_: facts}
@db_transaction
def content_fossology_license_add(self, licenses,
diff --git a/swh/indexer/storage/converters.py b/swh/indexer/storage/converters.py
--- a/swh/indexer/storage/converters.py
+++ b/swh/indexer/storage/converters.py
@@ -129,7 +129,6 @@
def db_to_fossology_license(license):
return {
- 'id': license['id'],
'licenses': license['licenses'],
'tool': {
'id': license['tool_id'],
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 3:41 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3230208
Attached To
D301: swh.indexer.storage: Refactor fossology license get
Event Timeline
Log In to Comment