Coverage for src / history / model_data.py: 100%
39 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-02-04 10:50 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-02-04 10:50 +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",
33 "download_pdf",
34 "matching",
35 "import-source",
36]
39class HistoryEventDict(TypedDict):
40 type: HistoryEventType
41 pid: str
42 col: "Collection | None"
44 source: NotRequired[str]
45 unique_id: NotRequired[str]
47 parent_id: NotRequired[str]
48 status: NotRequired["HistoryEventStatus"]
49 title: NotRequired[str]
50 userid: NotRequired[str]
51 type_error: NotRequired[str]
53 created_on: NotRequired[datetime]
54 message: NotRequired[str]
56 children: NotRequired[list["HistoryChildDict"]]
59class HistoryChildDict(TypedDict):
60 resource: "Resource"
61 type: str
62 status: str
63 status_message: NotRequired[str]
64 message: NotRequired[str]
65 score: NotRequired[int]
66 "Matching score for an item"
67 url: NotRequired[str]
68 "Matching url of the remote resource"