destiny_sdk 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- destiny_sdk/references.py +23 -1
- destiny_sdk/robots.py +4 -0
- {destiny_sdk-0.1.1.dist-info → destiny_sdk-0.1.2.dist-info}/METADATA +1 -1
- {destiny_sdk-0.1.1.dist-info → destiny_sdk-0.1.2.dist-info}/RECORD +6 -6
- {destiny_sdk-0.1.1.dist-info → destiny_sdk-0.1.2.dist-info}/LICENSE +0 -0
- {destiny_sdk-0.1.1.dist-info → destiny_sdk-0.1.2.dist-info}/WHEEL +0 -0
destiny_sdk/references.py
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"""Reference classes for the Destiny SDK."""
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from typing import Self
|
|
4
|
+
|
|
5
|
+
from pydantic import UUID4, BaseModel, Field, TypeAdapter
|
|
4
6
|
|
|
5
7
|
from destiny_sdk.core import _JsonlFileInputMixIn
|
|
6
8
|
from destiny_sdk.enhancements import Enhancement, EnhancementFileInput
|
|
7
9
|
from destiny_sdk.identifiers import ExternalIdentifier
|
|
8
10
|
from destiny_sdk.visibility import Visibility
|
|
9
11
|
|
|
12
|
+
external_identifier_adapter = TypeAdapter(ExternalIdentifier)
|
|
13
|
+
|
|
10
14
|
|
|
11
15
|
class Reference(_JsonlFileInputMixIn, BaseModel):
|
|
12
16
|
"""Core reference class."""
|
|
@@ -27,6 +31,24 @@ class Reference(_JsonlFileInputMixIn, BaseModel):
|
|
|
27
31
|
description="A list of enhancements for the reference",
|
|
28
32
|
)
|
|
29
33
|
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_es(cls, es_reference: dict) -> Self:
|
|
36
|
+
"""Create a Reference from an Elasticsearch document."""
|
|
37
|
+
return cls(
|
|
38
|
+
id=es_reference["_id"],
|
|
39
|
+
visibility=Visibility(es_reference["_source"]["visibility"]),
|
|
40
|
+
identifiers=[
|
|
41
|
+
external_identifier_adapter.validate_python(identifier)
|
|
42
|
+
for identifier in es_reference["_source"].get("identifiers", [])
|
|
43
|
+
],
|
|
44
|
+
enhancements=[
|
|
45
|
+
Enhancement.model_validate(
|
|
46
|
+
enhancement | {"reference_id": es_reference["_id"]},
|
|
47
|
+
)
|
|
48
|
+
for enhancement in es_reference["_source"].get("enhancements", [])
|
|
49
|
+
],
|
|
50
|
+
)
|
|
51
|
+
|
|
30
52
|
|
|
31
53
|
class ReferenceFileInput(_JsonlFileInputMixIn, BaseModel):
|
|
32
54
|
"""Enhancement model used to marshall a file input."""
|
destiny_sdk/robots.py
CHANGED
|
@@ -212,6 +212,8 @@ class BatchEnhancementRequestStatus(StrEnum):
|
|
|
212
212
|
- `partial_failed`: Some enhancements failed to create.
|
|
213
213
|
- `failed`: All enhancements failed to create.
|
|
214
214
|
- `importing`: Enhancements have been received by the repo and are being imported.
|
|
215
|
+
- `indexing`: Enhancements have been imported and are being indexed.
|
|
216
|
+
- `indexing_failed`: Enhancements have been imported but indexing failed.
|
|
215
217
|
- `completed`: All enhancements have been created.
|
|
216
218
|
"""
|
|
217
219
|
|
|
@@ -221,6 +223,8 @@ class BatchEnhancementRequestStatus(StrEnum):
|
|
|
221
223
|
PARTIAL_FAILED = auto()
|
|
222
224
|
FAILED = auto()
|
|
223
225
|
IMPORTING = auto()
|
|
226
|
+
INDEXING = auto()
|
|
227
|
+
INDEXING_FAILED = auto()
|
|
224
228
|
COMPLETED = auto()
|
|
225
229
|
|
|
226
230
|
|
|
@@ -6,10 +6,10 @@ destiny_sdk/enhancements.py,sha256=wFaphXYEHEU6yRijsP4tBY7BC6V9O2MPnOisfvE5EfE,1
|
|
|
6
6
|
destiny_sdk/identifiers.py,sha256=JHxu-wM3T8kKtAYuk5dMec35Ay73KxYP7gthbSvOhuI,3480
|
|
7
7
|
destiny_sdk/imports.py,sha256=mfC1QXbAU27iD3hO9OFTRQes352F6DS1U4fSMw26-8w,8243
|
|
8
8
|
destiny_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
destiny_sdk/references.py,sha256=
|
|
10
|
-
destiny_sdk/robots.py,sha256=
|
|
9
|
+
destiny_sdk/references.py,sha256=Dx-WKcv9gNJkKU9n52AYoEey7siTHR5_wBVBKSHND6Q,2321
|
|
10
|
+
destiny_sdk/robots.py,sha256=3VztlZJv2l1qQWRSNrZdKyJHCCteNil0w7lSYmV_Fpg,12692
|
|
11
11
|
destiny_sdk/visibility.py,sha256=nDLqnWuSZSk0vG3ynzDpHAvaALsbk8cuEZujTsqf6no,684
|
|
12
|
-
destiny_sdk-0.1.
|
|
13
|
-
destiny_sdk-0.1.
|
|
14
|
-
destiny_sdk-0.1.
|
|
15
|
-
destiny_sdk-0.1.
|
|
12
|
+
destiny_sdk-0.1.2.dist-info/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
|
|
13
|
+
destiny_sdk-0.1.2.dist-info/METADATA,sha256=U-n5n9vDusuzXWJpDI5-67L7AY8ocPkJlJKGRlIXTqQ,2543
|
|
14
|
+
destiny_sdk-0.1.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
15
|
+
destiny_sdk-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|