diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-23 15:48:36 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-23 15:48:36 -0800 |
commit | ac936ee49d4d63f9ac904b2fa03eaa4f8ff939f0 (patch) | |
tree | 6302f87c4c930211d81817f1ef8aaf3dec4531c6 /python/fatcat_tools/importers/matched.py | |
parent | 98c38ff45144fb06c308ad6d1a4176b65b6a876a (diff) | |
download | fatcat-ac936ee49d4d63f9ac904b2fa03eaa4f8ff939f0.tar.gz fatcat-ac936ee49d4d63f9ac904b2fa03eaa4f8ff939f0.zip |
matched importer: bezerk mode to skip file updates
Diffstat (limited to 'python/fatcat_tools/importers/matched.py')
-rw-r--r-- | python/fatcat_tools/importers/matched.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py index 055f9c6a..123e3530 100644 --- a/python/fatcat_tools/importers/matched.py +++ b/python/fatcat_tools/importers/matched.py @@ -42,7 +42,6 @@ class MatchedImporter(EntityImporter): editgroup_extra=eg_extra) self.default_link_rel = kwargs.get("default_link_rel", "web") self.default_mime = kwargs.get("default_mime", None) - self.skip_file_updates = kwargs.get("skip_file_updates", False) def make_url(self, raw): rel = self.default_link_rel @@ -115,16 +114,11 @@ class MatchedImporter(EntityImporter): def try_update(self, fe): # lookup sha1, or create new entity existing = None - if not self.skip_file_updates: - try: - existing = self.api.lookup_file(sha1=fe.sha1) - except fatcat_client.rest.ApiException as err: - if err.status != 404: - raise err - - if not existing: - # new match; go ahead and insert - return True + try: + existing = self.api.lookup_file(sha1=fe.sha1) + except fatcat_client.rest.ApiException as err: + if err.status != 404: + raise err fe.release_ids = list(set(fe.release_ids + existing.release_ids)) if set(fe.release_ids) == set(existing.release_ids) and len(existing.urls) > 0: |