Coverage for src/history/model_data.py: 100%
39 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-11-04 10:23 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-11-04 10:23 +0000
1from datetime import datetime
2from enum import StrEnum
3from typing import TYPE_CHECKING, Literal, NotRequired, TypedDict
5if TYPE_CHECKING:
6 from ptf.models import Collection, Resource
9class HistoryEventStatus(StrEnum):
10 OK = "OK"
11 WARNING = "WARNING"
12 ERROR = "ERROR"
13 PENDING = "PENDING"
16class MatchingEventResult(StrEnum):
17 ADDED = "added"
18 ALREADY_PRESENT = "already_present"
19 NOT_FOUND = "not_found"
20 LOW_SCORE = "score_too_low"
21 SKIPPED = "skipped"
24HistoryEventType = Literal[
25 "edit",
26 "marching",
27 "deploy",
28 "clockss",
29 "archive",
30 "archive-collections",
31 "augment",
32 "import-source",
33 "import-collection",
34 "download-pdf",
35 "download-collection",
36 "download-source",
37 "download-sources",
38 "matching",
39 "tex_conversion",
40]
43class HistoryEventDict(TypedDict):
44 type: HistoryEventType
45 pid: str
46 col: "Collection | None"
48 source: NotRequired[str]
49 unique_id: NotRequired[str]
51 parent_id: NotRequired[str]
52 status: NotRequired["HistoryEventStatus"]
53 title: NotRequired[str]
54 userid: NotRequired[str]
55 type_error: NotRequired[str]
57 created_on: NotRequired[datetime]
58 message: NotRequired[str]
60 children: NotRequired[list["HistoryChildDict"]]
63class HistoryChildDict(TypedDict):
64 resource: "Resource"
65 type: str
66 status: str
67 status_message: NotRequired[str]
68 message: NotRequired[str]
69 score: NotRequired[int]
70 "Matching score for an item"
71 url: NotRequired[str]
72 "Matching url of the remote resource"