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

22 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-02 20:00 -0800

1import typing as t 

2from dataclasses import dataclass 

3from datetime import datetime 

4 

5# Oneiric imports 

6from oneiric.core.config import OneiricSettings 

7 

8 

9@dataclass 

10class SitemapURL: 

11 loc: str 

12 lastmod: datetime | None = None 

13 changefreq: ( 

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

15 | None 

16 ) = None 

17 priority: float | None = None 

18 

19 

20class SitemapBaseSettings(OneiricSettings): 

21 module: str = "native" 

22 domain: str = "" 

23 change_freq: t.Literal[ 

24 "always", 

25 "hourly", 

26 "daily", 

27 "weekly", 

28 "monthly", 

29 "yearly", 

30 "never", 

31 ] = "weekly" 

32 cache_ttl: int = 3600 

33 

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

35 "include_patterns": [], 

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

37 "static_urls": [], 

38 "model_configs": [], 

39 "background_refresh": True, 

40 "cache_warmup": False, 

41 } 

42 

43 def __init__(self, **data: dict) -> None: 

44 super().__init__(**data) 

45 

46 

47class SitemapProtocol(t.Protocol): 

48 sitemap: t.Any = None 

49 

50 

51class SitemapBase: 

52 category = "sitemap" 

53 settings_klass = SitemapBaseSettings 

54 sitemap: t.Any = None