Coverage for fastblocks/adapters/sitemap/_base.py: 0%

22 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-10-09 00:47 -0700

1import typing as t 

2from dataclasses import dataclass 

3from datetime import datetime 

4 

5from acb.config import AdapterBase, Settings 

6 

7 

8@dataclass 

9class SitemapURL: 

10 loc: str 

11 lastmod: datetime | None = None 

12 changefreq: ( 

13 t.Literal["always", "hourly", "daily", "weekly", "monthly", "yearly", "never"] 

14 | None 

15 ) = None 

16 priority: float | None = None 

17 

18 

19class SitemapBaseSettings(Settings): # type: ignore[misc] 

20 module: str = "native" 

21 domain: str = "" 

22 change_freq: t.Literal[ 

23 "always", 

24 "hourly", 

25 "daily", 

26 "weekly", 

27 "monthly", 

28 "yearly", 

29 "never", 

30 ] = "weekly" 

31 cache_ttl: int = 3600 

32 

33 strategy_options: dict[str, t.Any] = { 

34 "include_patterns": [], 

35 "exclude_patterns": ["^/admin/.*", "^/api/.*", ".*/__.*"], 

36 "static_urls": [], 

37 "model_configs": [], 

38 "background_refresh": True, 

39 "cache_warmup": False, 

40 } 

41 

42 

43class SitemapProtocol(t.Protocol): 

44 sitemap: t.Any = None 

45 

46 

47class SitemapBase(AdapterBase): # type: ignore[misc] 

48 category = "sitemap" 

49 settings_klass = SitemapBaseSettings 

50 sitemap: t.Any = None