From 00d2d9bb92bae4d4fa12b5eca6ca0935333028f0 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Fri, 14 Mar 2025 13:53:43 +0100 Subject: [PATCH] github: Map 'subscribers' instead of 'watchers' to ForgeFed 'followers' On Github's API, 'watchers' is synonymous with 'stargazers', which does NOT map to 'watching' on Github's UI. --- swh/indexer/metadata_dictionary/github.py | 4 ++-- swh/indexer/tests/metadata_dictionary/test_github.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swh/indexer/metadata_dictionary/github.py b/swh/indexer/metadata_dictionary/github.py index 7c0e221..0aec5ed 100644 --- a/swh/indexer/metadata_dictionary/github.py +++ b/swh/indexer/metadata_dictionary/github.py @@ -153,12 +153,12 @@ class GitHubMapping(BaseExtrinsicMapping, JsonMapping): ) @produce_terms(ACTIVITYSTREAMS.followers, ACTIVITYSTREAMS.totalItems) - def translate_watchers_count(self, graph: Graph, root: BNode, v: Any) -> None: + def translate_subscribers_count(self, graph: Graph, root: BNode, v: Any) -> None: """ >>> graph = Graph() >>> root = URIRef("http://example.org/test-software") - >>> GitHubMapping().translate_watchers_count(graph, root, 42) + >>> GitHubMapping().translate_subscribers_count(graph, root, 42) >>> prettyprint_graph(graph, root) { "@id": ..., diff --git a/swh/indexer/tests/metadata_dictionary/test_github.py b/swh/indexer/tests/metadata_dictionary/test_github.py index 70bc976..980a4a0 100644 --- a/swh/indexer/tests/metadata_dictionary/test_github.py +++ b/swh/indexer/tests/metadata_dictionary/test_github.py @@ -101,7 +101,7 @@ def test_compute_metadata_github(): "visibility": "public", "forks": 1, "open_issues": 0, - "watchers": 13, + "watchers": 12, "default_branch": "master", "temp_clone_token": null, "organization": { @@ -140,7 +140,7 @@ def test_compute_metadata_github(): "as:followers": { "as:totalItems": { "type": "xsd:nonNegativeInteger", - "@value": "12", + "@value": "6", }, "type": "as:Collection", }, -- GitLab