Coverage for repo_ctx/models.py: 100%

1"""Data models."""

2 from dataclasses import dataclass

3 from datetime import datetime

4 from typing import Optional

5

6

7@dataclass

8 class Library:

9 group_name: str

10 project_name: str

11 description: str

12 default_version: str

13 id: Optional[int] = None

14 last_indexed: Optional[datetime] = None

15

16

17@dataclass

18 class Version:

19 library_id: int

20 version_tag: str

21 commit_sha: str

22 id: Optional[int] = None

23

24

25@dataclass

26 class Document:

27 version_id: int

28 file_path: str

29 content: str

30 content_type: str = "markdown"

31 tokens: int = 0

32 id: Optional[int] = None

33

34

35@dataclass

36 class SearchResult:

37 library_id: str # /group/project

38 name: str

39 description: str

40 versions: list[str]

41 score: float = 0.0

42

43

44@dataclass

45 class FuzzySearchResult:

46 library_id: str # /group/project

47 name: str

48 group: str

49 description: str

50 score: float

51 match_type: str

52 matched_field: str