Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/filter.py
Show All 28 Lines | def __init__(self, storage): | ||||
self.objects_seen = { | self.objects_seen = { | ||||
'content': set(), # sha256 | 'content': set(), # sha256 | ||||
'skipped_content': set(), # sha1_git | 'skipped_content': set(), # sha1_git | ||||
'directory': set(), # sha1_git | 'directory': set(), # sha1_git | ||||
'revision': set(), # sha1_git | 'revision': set(), # sha1_git | ||||
} | } | ||||
def __getattr__(self, key): | def __getattr__(self, key): | ||||
if key == 'storage': | |||||
raise AttributeError(key) | |||||
return getattr(self.storage, key) | return getattr(self.storage, key) | ||||
def content_add(self, content: Iterable[Dict]) -> Dict: | def content_add(self, content: Iterable[Dict]) -> Dict: | ||||
contents = list(content) | contents = list(content) | ||||
contents_to_add = self._filter_missing_contents(contents) | contents_to_add = self._filter_missing_contents(contents) | ||||
return self.storage.content_add( | return self.storage.content_add( | ||||
x for x in contents if x['sha256'] in contents_to_add | x for x in contents if x['sha256'] in contents_to_add | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |