Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9340839
D2840.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
D2840.diff
View Options
diff --git a/swh/journal/replay.py b/swh/journal/replay.py
--- a/swh/journal/replay.py
+++ b/swh/journal/replay.py
@@ -68,21 +68,20 @@
notify('WATCHDOG=1')
-def _fix_contents(
- contents: Iterable[Dict[str, Any]]) -> Iterable[Dict[str, Any]]:
+def _fix_content(content: Dict[str, Any]) -> Dict[str, Any]:
"""Filters-out invalid 'perms' key that leaked from swh.model.from_disk
to the journal.
- >>> list(_fix_contents([
- ... {'perms': 0o100644, 'sha1_git': b'foo'},
- ... {'sha1_git': b'bar'},
- ... ]))
- [{'sha1_git': b'foo'}, {'sha1_git': b'bar'}]
+ >>> _fix_content({'perms': 0o100644, 'sha1_git': b'foo'})
+ {'sha1_git': b'foo'}
+
+ >>> _fix_content({'sha1_git': b'bar'})
+ {'sha1_git': b'bar'}
+
"""
- for content in contents:
- content = content.copy()
- content.pop('perms', None)
- yield content
+ content = content.copy()
+ content.pop('perms', None)
+ return content
def _fix_revision_pypi_empty_string(rev):
@@ -338,8 +337,8 @@
if object_type == 'content':
contents: List[BaseContent] = []
skipped_contents: List[BaseContent] = []
- for content in _fix_contents(objects):
- c = BaseContent.from_dict(content)
+ for content in objects:
+ c = BaseContent.from_dict(_fix_content(content))
if isinstance(c, SkippedContent):
skipped_contents.append(c)
else:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 11:14 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221694
Attached To
D2840: journal.replay: Align _fix_content with other fix methods
Event Timeline
Log In to Comment