cineon-api-format 3.4.0__tar.gz → 3.5.0__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.
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/.gitignore +1 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/PKG-INFO +2 -2
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/pyproject.toml +2 -2
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/src/cineon_api_format/requests.py +16 -16
- cineon_api_format-3.5.0/src/cineon_api_format/responses.py +31 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/tests/test_all.py +22 -6
- cineon_api_format-3.5.0/uv.lock +2870 -0
- cineon_api_format-3.4.0/src/cineon_api_format/responses.py +0 -33
- cineon_api_format-3.4.0/uv.lock +0 -941
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/.env.example +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/.githooks/pre-push +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/.github/workflows/main.yml +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/.github/workflows/publish.yml +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/.python-version +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/README.md +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/badges/complexity.svg +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/badges/coverage.svg +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/badges/version.svg +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/scripts/badges/complexity.py +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/scripts/badges/version.py +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/scripts/badges.sh +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/scripts/format.sh +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/scripts/publish.sh +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/scripts/test.sh +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/src/cineon_api_format/__init__.py +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/src/cineon_api_format/definitions.py +0 -0
- {cineon_api_format-3.4.0 → cineon_api_format-3.5.0}/src/cineon_api_format/version.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cineon-api-format
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.0
|
|
4
4
|
Summary: Types used by the ELE API, and other Cineon APIs.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
|
-
Requires-Dist: cineon-format<4,>=3.
|
|
6
|
+
Requires-Dist: cineon-format[cineon-model]<4,>=3.5.2
|
|
7
7
|
Requires-Dist: pydantic>=2.12.5
|
|
8
8
|
Requires-Dist: typeguard>=4.4.4
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cineon-api-format"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.5.0"
|
|
4
4
|
description = "Types used by the ELE API, and other Cineon APIs."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"pydantic>=2.12.5",
|
|
9
9
|
"typeguard>=4.4.4",
|
|
10
|
-
"cineon-format (>=3.
|
|
10
|
+
"cineon-format[cineon-model] (>=3.5.2,<4)",
|
|
11
11
|
]
|
|
12
12
|
|
|
13
13
|
[dependency-groups]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Self
|
|
2
2
|
|
|
3
|
-
from cineon_format import
|
|
3
|
+
from cineon_format.cineon_data import RawData
|
|
4
4
|
from pydantic import BaseModel, field_validator, model_validator
|
|
5
5
|
|
|
6
6
|
from cineon_api_format.definitions import Construct, Metric
|
|
@@ -16,22 +16,22 @@ DEFAULT_METRICS = [
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class ClientInfo(BaseModel, extra="forbid"):
|
|
19
|
-
platform:
|
|
20
|
-
version:
|
|
19
|
+
platform: str | None = None
|
|
20
|
+
version: str | None = None
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class InferenceRequest(BaseModel, extra="forbid"):
|
|
24
|
-
constructs:
|
|
25
|
-
metrics:
|
|
26
|
-
models:
|
|
27
|
-
device:
|
|
28
|
-
client:
|
|
29
|
-
eye_data:
|
|
24
|
+
constructs: list[Construct] | None = None
|
|
25
|
+
metrics: list[Metric] | None = None
|
|
26
|
+
models: list[str] | None = None
|
|
27
|
+
device: str | None = None
|
|
28
|
+
client: ClientInfo | None = None
|
|
29
|
+
eye_data: RawData
|
|
30
30
|
|
|
31
31
|
# Check data list is not empty
|
|
32
32
|
@field_validator("eye_data")
|
|
33
33
|
@classmethod
|
|
34
|
-
def check_data_not_empty(cls, eye_data:
|
|
34
|
+
def check_data_not_empty(cls, eye_data: RawData) -> RawData:
|
|
35
35
|
if len(eye_data.timestamp) == 0:
|
|
36
36
|
raise ValueError("Data list must not be empty.")
|
|
37
37
|
return eye_data
|
|
@@ -54,14 +54,14 @@ class InferenceRequest(BaseModel, extra="forbid"):
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
class CineonInferenceRequest(BaseModel, extra="forbid"):
|
|
57
|
-
device:
|
|
58
|
-
client:
|
|
59
|
-
eye_data:
|
|
57
|
+
device: str | None = None
|
|
58
|
+
client: ClientInfo | None = None
|
|
59
|
+
eye_data: RawData
|
|
60
60
|
|
|
61
61
|
# Check data list is not empty
|
|
62
62
|
@field_validator("eye_data")
|
|
63
63
|
@classmethod
|
|
64
|
-
def check_data_not_empty(cls, eye_data:
|
|
64
|
+
def check_data_not_empty(cls, eye_data: RawData) -> RawData:
|
|
65
65
|
if len(eye_data.timestamp) == 0:
|
|
66
66
|
raise ValueError("eye_data must contain at least one timestamp.")
|
|
67
67
|
return eye_data
|
|
@@ -92,7 +92,7 @@ class ModelRecalculateRequest(BaseModel, extra="forbid"):
|
|
|
92
92
|
# The ELE-api will automatically decide which models to use when not
|
|
93
93
|
# specified. It will also validate that the requested models
|
|
94
94
|
# calculate the construct expected.
|
|
95
|
-
models:
|
|
95
|
+
models: dict[Construct, str] | None = None
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
class UserReceiveMarketingRequest(BaseModel, extra="forbid"):
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from cineon_format import CineonPrediction
|
|
2
|
+
from deprecated import deprecated
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class RootResponse(BaseModel, extra="forbid"):
|
|
7
|
+
name: str
|
|
8
|
+
version: str
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class PingResponse(BaseModel, extra="forbid"):
|
|
12
|
+
message: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class VersionResponse(BaseModel, extra="forbid"):
|
|
16
|
+
ele_api: str
|
|
17
|
+
cineon_format: str
|
|
18
|
+
gazeprocessing: str
|
|
19
|
+
gazetools: str
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@deprecated(
|
|
23
|
+
reason="InferenceOutput is deprecated, use cineon_format.CineonPrediction instead.",
|
|
24
|
+
version="3.4.1",
|
|
25
|
+
)
|
|
26
|
+
class InferenceOutput(CineonPrediction):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class InferenceResponse(BaseModel, extra="forbid"):
|
|
31
|
+
data: list[CineonPrediction]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import pytest
|
|
2
|
-
from cineon_format import
|
|
2
|
+
from cineon_format import RawInferenceData
|
|
3
3
|
from pydantic import ValidationError
|
|
4
4
|
from typeguard import typechecked
|
|
5
5
|
|
|
@@ -20,7 +20,7 @@ def test_cineon_request_to_ele_request():
|
|
|
20
20
|
duration, frequency = 10, 60
|
|
21
21
|
|
|
22
22
|
client_info = ClientInfo(platform="test-suite", version="0.0.1")
|
|
23
|
-
eye_data =
|
|
23
|
+
eye_data = RawInferenceData.from_random(duration, frequency)
|
|
24
24
|
|
|
25
25
|
request = CineonInferenceRequest(
|
|
26
26
|
device="computer", client=client_info, eye_data=eye_data
|
|
@@ -50,16 +50,17 @@ def test_parse_recalculate_request():
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
@typechecked
|
|
53
|
-
def
|
|
53
|
+
def test_inference_response_no_timestamps_fails():
|
|
54
54
|
response = {
|
|
55
55
|
"data": [
|
|
56
56
|
{
|
|
57
|
-
"prediction": "stress",
|
|
58
57
|
"score": 0.8,
|
|
58
|
+
"target": "stress",
|
|
59
59
|
}
|
|
60
60
|
]
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
with pytest.raises(ValidationError):
|
|
63
|
+
InferenceResponse.model_validate(response)
|
|
63
64
|
|
|
64
65
|
|
|
65
66
|
@typechecked
|
|
@@ -67,8 +68,23 @@ def test_inference_response_timestamps():
|
|
|
67
68
|
response = {
|
|
68
69
|
"data": [
|
|
69
70
|
{
|
|
70
|
-
"prediction": "stress",
|
|
71
71
|
"score": 0.8,
|
|
72
|
+
"target": "stress",
|
|
73
|
+
"start_timestamp": "2024-01-01T00:00:00",
|
|
74
|
+
"end_timestamp": "2024-01-01T00:00:10",
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
assert InferenceResponse.model_validate(response)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@typechecked
|
|
82
|
+
def test_inference_response_construct_target():
|
|
83
|
+
response = {
|
|
84
|
+
"data": [
|
|
85
|
+
{
|
|
86
|
+
"score": 0.8,
|
|
87
|
+
"target": Construct.stress,
|
|
72
88
|
"start_timestamp": "2024-01-01T00:00:00",
|
|
73
89
|
"end_timestamp": "2024-01-01T00:00:10",
|
|
74
90
|
}
|