Skip to content

storage*: origin_get(Iterable[str]) -> Iterable[Optional[Origin]]

This:

  • drops the legacy behavior (no more input as list of dicts or even one dict).
  • aligns with other _get endpoints (only 1 iterable of identifiers as input, here the origin urls).
  • migrates towards returning an iterable of optional origin model objects (again the optional part is alignment with existing get endpoint)

Impacts foreseen, mostly tests (but not only):

$ grep -r 'origin_get(' */swh/** | grep -v "swh-storage"
swh-deposit/swh/deposit/migrations/0018_migrate_swhids.py:        check_origin = storage.origin_get({"url": origin})
swh-deposit/swh/deposit/migrations/0018_migrate_swhids.py:        check_origin = storage.origin_get({"url": origin})
swh-loader-git/swh/loader/git/loader.py:            base_origin = self.storage.origin_get(base_origin)
swh-loader-svn/swh/loader/svn/loader.py:            origin = self.storage.origin_get({"url": svn_url})
swh-web/swh/web/common/service.py:        origin_info = storage.origin_get(orig)
swh-web/swh/web/common/service.py:        origin = storage.origin_get({"url": match["id"]})
swh-web/swh/web/common/service.py:    origin_info = storage.origin_get(origin_dict)
swh-web/swh/web/tests/api/views/test_origin.py:    expected_origin = archive_data.origin_get(origin)
swh-web/swh/web/tests/data.py:        origin.update(storage.origin_get(origin))  # add an 'id' key if enabled
swh-web/swh/web/tests/common/test_service.py:    expected_origin = archive_data.origin_get({"url": new_origin.url})
swh-web/swh/web/tests/conftest.py:    def origin_get(self, origin_info):
swh-web/swh/web/tests/conftest.py:        origin = self.storage.origin_get(origin_info)
swh-web/swh/web/tests/strategies.py:        lambda origin: get_tests_data()["storage"].origin_get([origin.to_dict()])[0]

Related to T645

Test Plan

tox


Migrated from D3605 (view on Phabricator)

Merge request reports