Coverage for src/secchi/api/sparse.py: 75%

20 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-08-04 22:15 +0000

1"""Defaults for registries with limited package-level time-series APIs.""" 

2 

3from __future__ import annotations 

4 

5from secchi.api.base import AdapterBase 

6from secchi.models import ( 

7 Dependency, 

8 DownloadCounts, 

9 DownloadTrendPoint, 

10 ReverseDependency, 

11 Version, 

12) 

13 

14 

15class SparseAdapter(AdapterBase): 

16 """Honest empty implementations for optional registry capabilities.""" 

17 

18 async def fetch_versions(self, name: str) -> list[Version]: 

19 return [] 

20 

21 async def fetch_dependencies(self, name: str, version: str) -> list[Dependency]: 

22 return [] 

23 

24 async def fetch_download_trend( 

25 self, name: str, days: int = 30 

26 ) -> list[DownloadTrendPoint]: 

27 return [] 

28 

29 async def fetch_download_counts(self, name: str) -> DownloadCounts: 

30 return DownloadCounts() 

31 

32 async def fetch_release_notes(self, name: str, version: str) -> str: 

33 return "" 

34 

35 async def fetch_reverse_dependencies( 

36 self, name: str, limit: int = 5 

37 ) -> list[ReverseDependency]: 

38 return [] 

39 

40 async def fetch_reverse_dependency_count(self, name: str) -> int | None: 

41 return None 

42 

43 async def fetch_version_download_breakdown(self, name: str) -> dict[int | str, int]: 

44 return {}