destiny_sdk 0.2.2__tar.gz → 0.2.3__tar.gz
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-0.2.2 → destiny_sdk-0.2.3}/PKG-INFO +1 -1
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/pyproject.toml +1 -1
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/core.py +15 -1
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_references.py +29 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/uv.lock +1 -1
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/.gitignore +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/LICENSE +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/README.md +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/__init__.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/auth.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/client.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/enhancements.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/identifiers.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/imports.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/parsers/__init__.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/parsers/eppi_parser.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/py.typed +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/references.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/robots.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/src/destiny_sdk/visibility.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/__init__.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/conftest.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/parsers/test_eppi_parser.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_auth.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_client.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_data/eppi_import.jsonl +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_data/eppi_import_with_annotations.jsonl +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_data/eppi_report.json +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_enhancements.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_identifiers.py +0 -0
- {destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_robots.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: destiny_sdk
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: A software development kit (sdk) to support interaction with the DESTINY repository
|
|
5
5
|
Author-email: Adam Hamilton <adam@futureevidence.org>, Andrew Harvey <andrew@futureevidence.org>, Daniel Breves <daniel@futureevidence.org>, Jack Walmisley <jack@futureevidence.org>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -4,6 +4,18 @@ from typing import Self
|
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel
|
|
6
6
|
|
|
7
|
+
# These are non-standard newline characters that are not escaped by model_dump_json().
|
|
8
|
+
# We want jsonl files to have empirical new lines so they can be streamed line by line.
|
|
9
|
+
# Hence we replace each occurrence with standard new lines.
|
|
10
|
+
_ESCAPED_NEW_LINE = "\\n"
|
|
11
|
+
_UNSUPPORTED_NEWLINE_TRANSLATION = str.maketrans(
|
|
12
|
+
{
|
|
13
|
+
"\u0085": _ESCAPED_NEW_LINE,
|
|
14
|
+
"\u2028": _ESCAPED_NEW_LINE,
|
|
15
|
+
"\u2029": _ESCAPED_NEW_LINE,
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
|
|
7
19
|
|
|
8
20
|
class _JsonlFileInputMixIn(BaseModel):
|
|
9
21
|
"""
|
|
@@ -20,7 +32,9 @@ class _JsonlFileInputMixIn(BaseModel):
|
|
|
20
32
|
:return: The JSONL string representation of the model.
|
|
21
33
|
:rtype: str
|
|
22
34
|
"""
|
|
23
|
-
return self.model_dump_json(exclude_none=True)
|
|
35
|
+
return self.model_dump_json(exclude_none=True).translate(
|
|
36
|
+
_UNSUPPORTED_NEWLINE_TRANSLATION
|
|
37
|
+
)
|
|
24
38
|
|
|
25
39
|
@classmethod
|
|
26
40
|
def from_jsonl(cls, jsonl: str) -> Self:
|
|
@@ -83,3 +83,32 @@ def test_es_parsing():
|
|
|
83
83
|
assert reference.enhancements[0].id == uuid.UUID(
|
|
84
84
|
"52f3fc92-db0b-4e65-a18c-31d091242c3a"
|
|
85
85
|
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_jsonl_serialization():
|
|
89
|
+
reference = destiny_sdk.references.Reference(
|
|
90
|
+
id=(_id := uuid.uuid4()),
|
|
91
|
+
enhancements=[
|
|
92
|
+
destiny_sdk.enhancements.Enhancement(
|
|
93
|
+
reference_id=_id,
|
|
94
|
+
source="testing",
|
|
95
|
+
visibility=destiny_sdk.visibility.Visibility.PUBLIC,
|
|
96
|
+
content=destiny_sdk.enhancements.AbstractContentEnhancement(
|
|
97
|
+
process=destiny_sdk.enhancements.AbstractProcessType.UNINVERTED,
|
|
98
|
+
abstract="This is a funky paragraph separator: \u2029.",
|
|
99
|
+
),
|
|
100
|
+
)
|
|
101
|
+
],
|
|
102
|
+
identifiers=[
|
|
103
|
+
destiny_sdk.identifiers.OpenAlexIdentifier(identifier="W12345678")
|
|
104
|
+
],
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
reference_jsonl = reference.to_jsonl()
|
|
108
|
+
assert "This is a funky paragraph separator: \\n." in reference_jsonl
|
|
109
|
+
|
|
110
|
+
round_trip_reference = destiny_sdk.references.Reference.from_jsonl(reference_jsonl)
|
|
111
|
+
assert (
|
|
112
|
+
reference.enhancements[0].content.abstract.replace("\u2029", "\n")
|
|
113
|
+
== round_trip_reference.enhancements[0].content.abstract
|
|
114
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{destiny_sdk-0.2.2 → destiny_sdk-0.2.3}/tests/unit/test_data/eppi_import_with_annotations.jsonl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|