nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: CartoDB/cartoframes
Pull request #1583 (2020-03-10 16:05:41)

Fix None check in catalog subscriptions


Patch:
diff --git a/cartoframes/data/observatory/catalog/repository/repo_client.py b/cartoframes/data/observatory/catalog/repository/repo_client.py
index b55e9831..7522b478 100644
--- a/cartoframes/data/observatory/catalog/repository/repo_client.py
+++ b/cartoframes/data/observatory/catalog/repository/repo_client.py
@@ -72,7 +72,7 @@ class RepoClient:
 
     def _fetch_entity_id(self, entity, filter_id):
         if isinstance(filter_id, list):
-            return [self._fetch_entity(os.path.join(entity, _id)) for _id in filter_id]
+            return list(filter(None, [self._fetch_entity(os.path.join(entity, _id)) for _id in filter_id]))
         else:
             return self._fetch_entity(os.path.join(entity, filter_id))
 


Test patch:
diff --git a/tests/unit/data/observatory/catalog/repository/test_repo_client.py b/tests/unit/data/observatory/catalog/repository/test_repo_client.py
index a8fafaa1..6974bf04 100644
--- a/tests/unit/data/observatory/catalog/repository/test_repo_client.py
+++ b/tests/unit/data/observatory/catalog/repository/test_repo_client.py
@@ -144,3 +144,16 @@ class TestRepoClient:
 
         fetch_entity_mock.assert_any_call('geographies/slug_1')
         fetch_entity_mock.assert_any_call('geographies/slug_2')
+
+    @patch.object(RepoClient, '_fetch_entity')
+    def test_fetch_entity_id_list(self, fetch_entity_mock):
+        fetch_entity_mock.side_effect = lambda _id: None if _id == 'datasets/x' else _id
+        repo = RepoClient()
+        filters = {'id': ['x', 'a', 'b', 'x', 'c', 'x']}
+        datasets = repo.get_datasets(filters)
+
+        fetch_entity_mock.assert_any_call('datasets/a')
+        fetch_entity_mock.assert_any_call('datasets/b')
+        fetch_entity_mock.assert_any_call('datasets/c')
+        fetch_entity_mock.assert_any_call('datasets/x')
+        assert datasets == ['datasets/a', 'datasets/b', 'datasets/c']