Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/benchmark_radar/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def fetch_arxiv(config: dict[str, Any], since: datetime, limit: int) -> list[Rad


def fetch_huggingface(config: dict[str, Any], since: datetime, limit: int) -> list[RadarItem]:
found: dict[str, RadarItem] = {}
found: dict[tuple[str, str], RadarItem] = {}
for kind in config.get("kinds", ["datasets"]):
for search in config.get("searches", []):
rows = get_json(
Expand Down Expand Up @@ -476,7 +476,7 @@ def fetch_huggingface(config: dict[str, Any], since: datetime, limit: int) -> li
or _reject_future(config, str(item_id), created, changed)
):
continue
found[item_id] = RadarItem(
found[(kind, item_id)] = RadarItem(
Comment thread
rudycelekli marked this conversation as resolved.
source="Hugging Face",
source_id=item_id,
title=item_id,
Expand Down
33 changes: 33 additions & 0 deletions tests/test_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3375,3 +3375,36 @@ def test_collection_method_falls_back_to_a_static_default_without_items():
assert collection_method("brave", []) == "API"
assert collection_method("datacite", []) == "API"
assert collection_method("openaire", []) == "API"


def test_huggingface_preserves_same_named_repositories_of_different_kinds(monkeypatch):
from benchmark_radar.pipeline import deduplicate

def get_hub_rows(url, **_kwargs):
return [
{
"id": "lab/suite",
"createdAt": "2026-08-08T12:00:00Z",
"lastModified": "2026-08-08T13:00:00Z",
"downloads": 3,
"likes": 2,
}
]

monkeypatch.setattr("benchmark_radar.sources.get_json", get_hub_rows)
items = fetch_huggingface(
{"kinds": ["datasets", "models", "spaces"], "searches": ["suite", "suite"]},
datetime(2026, 8, 8, tzinfo=UTC),
10,
)
# Hub namespaces are independent: a lab can own a dataset, model and Space
# under the same name. Keying only on owner/name silently keeps the last.
assert len(items) == 3
assert {item.source_id for item in items} == {"lab/suite"}
urls = {item.to_dict()["url"] for item in items}
assert len(urls) == 3
assert {
"https://huggingface.co/datasets/lab/suite",
"https://huggingface.co/spaces/lab/suite",
} <= urls
assert len(deduplicate(items)) == 3
Loading