Coverage for src/history/model_data.py: 95%
41 statements
« prev ^ index » next coverage.py v7.9.0, created at 2025-11-25 13:05 +0000
« prev ^ index » next coverage.py v7.9.0, created at 2025-11-25 13:05 +0000
1from datetime import datetime
2from enum import StrEnum
3from typing import TYPE_CHECKING, Literal, NotRequired, TypedDict
5if TYPE_CHECKING: 5 ↛ 6line 5 didn't jump to line 6 because the condition on line 5 was never true
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 "import",
32 "download_pdf",
33 "matching",
34 "import-source",
35]
38class HistoryEventDict(TypedDict):
39 type: HistoryEventType
40 pid: str
41 col: "Collection | None"
43 source: NotRequired[str]
44 unique_id: NotRequired[str]
46 parent_id: NotRequired[str]
47 status: NotRequired["HistoryEventStatus"]
48 title: NotRequired[str]
49 userid: NotRequired[str]
50 type_error: NotRequired[str]
52 created_on: NotRequired[datetime]
53 message: NotRequired[str]
55 children: NotRequired[list["HistoryChildDict"]]
58class HistoryChildDict(TypedDict):
59 resource: "Resource"
60 type: str
61 status: str
62 status_message: NotRequired[str]
63 message: NotRequired[str]
64 score: NotRequired[int]
65 "Matching score for an item"
66 url: NotRequired[str]
67 "Matching url of the remote resource"