rapidata 0.1.18__py3-none-any.whl → 0.1.19__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.
- rapidata/api_client/__init__.py +2 -0
- rapidata/api_client/api/rapid_api.py +1370 -0
- rapidata/api_client/api/validation_api.py +15 -5
- rapidata/api_client/models/__init__.py +2 -0
- rapidata/api_client/models/add_validation_rapid_result.py +87 -0
- rapidata/api_client/models/attach_category_result.py +98 -0
- rapidata/api_client/models/bounding_box_result.py +106 -0
- rapidata/api_client/models/classification_metadata.py +0 -10
- rapidata/api_client/models/compare_result.py +98 -0
- rapidata/api_client/models/coordinate.py +108 -0
- rapidata/api_client/models/count_metadata.py +0 -10
- rapidata/api_client/models/create_demographic_rapid_model.py +93 -0
- rapidata/api_client/models/create_order_model_referee.py +22 -8
- rapidata/api_client/models/early_stopping_referee_model.py +98 -0
- rapidata/api_client/models/free_text_result.py +98 -0
- rapidata/api_client/models/image_dimension_metadata.py +0 -10
- rapidata/api_client/models/line.py +106 -0
- rapidata/api_client/models/line_point.py +98 -0
- rapidata/api_client/models/line_result.py +106 -0
- rapidata/api_client/models/locate_coordinate.py +98 -0
- rapidata/api_client/models/locate_result.py +106 -0
- rapidata/api_client/models/location_metadata.py +0 -10
- rapidata/api_client/models/named_entity_result.py +106 -0
- rapidata/api_client/models/order_query_get200_response.py +12 -12
- rapidata/api_client/models/original_filename_metadata.py +0 -10
- rapidata/api_client/models/polygon_result.py +106 -0
- rapidata/api_client/models/prompt_metadata.py +0 -10
- rapidata/api_client/models/query_model.py +112 -0
- rapidata/api_client/models/query_validation_rapids_result.py +98 -0
- rapidata/api_client/models/query_validation_rapids_result_asset.py +174 -0
- rapidata/api_client/models/query_validation_rapids_result_paged_result.py +105 -0
- rapidata/api_client/models/rapid_result_model.py +93 -0
- rapidata/api_client/models/rapid_result_model_result.py +252 -0
- rapidata/api_client/models/rapid_skipped_model.py +89 -0
- rapidata/api_client/models/shape.py +104 -0
- rapidata/api_client/models/skip_result.py +96 -0
- rapidata/api_client/models/text_metadata.py +0 -7
- rapidata/api_client/models/transcription_metadata.py +0 -7
- rapidata/api_client/models/transcription_result.py +106 -0
- rapidata/rapidata_client/dataset/rapidata_dataset.py +1 -2
- rapidata/rapidata_client/dataset/rapidata_validation_set.py +1 -2
- rapidata/rapidata_client/dataset/validation_rapid_parts.py +1 -2
- rapidata/rapidata_client/order/rapidata_order_builder.py +2 -3
- rapidata/rapidata_client/utils/utils.py +22 -0
- rapidata/service/openapi_service.py +6 -2
- {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/METADATA +2 -1
- {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/RECORD +49 -23
- rapidata/rapidata_client/types/__init__.py +0 -1
- {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/LICENSE +0 -0
- {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.classify_payload import ClassifyPayload
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class CreateDemographicRapidModel(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
The model for creating a demographic rapid.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
identifier: StrictStr = Field(description="The identifier of the demographic classification.")
|
|
31
|
+
payload: ClassifyPayload
|
|
32
|
+
__properties: ClassVar[List[str]] = ["identifier", "payload"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of CreateDemographicRapidModel from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of payload
|
|
74
|
+
if self.payload:
|
|
75
|
+
_dict['payload'] = self.payload.to_dict()
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of CreateDemographicRapidModel from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate({
|
|
88
|
+
"identifier": obj.get("identifier"),
|
|
89
|
+
"payload": ClassifyPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -17,12 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
|
+
from rapidata.api_client.models.early_stopping_referee_model import EarlyStoppingRefereeModel
|
|
20
21
|
from rapidata.api_client.models.naive_referee_model import NaiveRefereeModel
|
|
21
22
|
from pydantic import StrictStr, Field
|
|
22
23
|
from typing import Union, List, Set, Optional, Dict
|
|
23
24
|
from typing_extensions import Literal, Self
|
|
24
25
|
|
|
25
|
-
CREATEORDERMODELREFEREE_ONE_OF_SCHEMAS = ["NaiveRefereeModel"]
|
|
26
|
+
CREATEORDERMODELREFEREE_ONE_OF_SCHEMAS = ["EarlyStoppingRefereeModel", "NaiveRefereeModel"]
|
|
26
27
|
|
|
27
28
|
class CreateOrderModelReferee(BaseModel):
|
|
28
29
|
"""
|
|
@@ -30,8 +31,10 @@ class CreateOrderModelReferee(BaseModel):
|
|
|
30
31
|
"""
|
|
31
32
|
# data type: NaiveRefereeModel
|
|
32
33
|
oneof_schema_1_validator: Optional[NaiveRefereeModel] = None
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
# data type: EarlyStoppingRefereeModel
|
|
35
|
+
oneof_schema_2_validator: Optional[EarlyStoppingRefereeModel] = None
|
|
36
|
+
actual_instance: Optional[Union[EarlyStoppingRefereeModel, NaiveRefereeModel]] = None
|
|
37
|
+
one_of_schemas: Set[str] = { "EarlyStoppingRefereeModel", "NaiveRefereeModel" }
|
|
35
38
|
|
|
36
39
|
model_config = ConfigDict(
|
|
37
40
|
validate_assignment=True,
|
|
@@ -62,12 +65,17 @@ class CreateOrderModelReferee(BaseModel):
|
|
|
62
65
|
error_messages.append(f"Error! Input type `{type(v)}` is not `NaiveRefereeModel`")
|
|
63
66
|
else:
|
|
64
67
|
match += 1
|
|
68
|
+
# validate data type: EarlyStoppingRefereeModel
|
|
69
|
+
if not isinstance(v, EarlyStoppingRefereeModel):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `EarlyStoppingRefereeModel`")
|
|
71
|
+
else:
|
|
72
|
+
match += 1
|
|
65
73
|
if match > 1:
|
|
66
74
|
# more than 1 match
|
|
67
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelReferee with oneOf schemas: NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
75
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelReferee with oneOf schemas: EarlyStoppingRefereeModel, NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
68
76
|
elif match == 0:
|
|
69
77
|
# no match
|
|
70
|
-
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelReferee with oneOf schemas: NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
78
|
+
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelReferee with oneOf schemas: EarlyStoppingRefereeModel, NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
71
79
|
else:
|
|
72
80
|
return v
|
|
73
81
|
|
|
@@ -88,13 +96,19 @@ class CreateOrderModelReferee(BaseModel):
|
|
|
88
96
|
match += 1
|
|
89
97
|
except (ValidationError, ValueError) as e:
|
|
90
98
|
error_messages.append(str(e))
|
|
99
|
+
# deserialize data into EarlyStoppingRefereeModel
|
|
100
|
+
try:
|
|
101
|
+
instance.actual_instance = EarlyStoppingRefereeModel.from_json(json_str)
|
|
102
|
+
match += 1
|
|
103
|
+
except (ValidationError, ValueError) as e:
|
|
104
|
+
error_messages.append(str(e))
|
|
91
105
|
|
|
92
106
|
if match > 1:
|
|
93
107
|
# more than 1 match
|
|
94
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelReferee with oneOf schemas: NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
108
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelReferee with oneOf schemas: EarlyStoppingRefereeModel, NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
95
109
|
elif match == 0:
|
|
96
110
|
# no match
|
|
97
|
-
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelReferee with oneOf schemas: NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
111
|
+
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelReferee with oneOf schemas: EarlyStoppingRefereeModel, NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
98
112
|
else:
|
|
99
113
|
return instance
|
|
100
114
|
|
|
@@ -108,7 +122,7 @@ class CreateOrderModelReferee(BaseModel):
|
|
|
108
122
|
else:
|
|
109
123
|
return json.dumps(self.actual_instance)
|
|
110
124
|
|
|
111
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], NaiveRefereeModel]]:
|
|
125
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], EarlyStoppingRefereeModel, NaiveRefereeModel]]:
|
|
112
126
|
"""Returns the dict representation of the actual instance"""
|
|
113
127
|
if self.actual_instance is None:
|
|
114
128
|
return None
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class EarlyStoppingRefereeModel(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
The Early Stopping Referee can currently only be used for classification tasks and will stop once a certain threshold is reached or the maximum number of votes is collected.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for EarlyStoppingReferee", alias="_t")
|
|
30
|
+
max_votes: StrictInt = Field(description="The upper limit of votes that will be collected for each task.", alias="maxVotes")
|
|
31
|
+
threshold: Union[StrictFloat, StrictInt] = Field(description="The threshold that needs to be reached to stop collecting votes.")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "maxVotes", "threshold"]
|
|
33
|
+
|
|
34
|
+
@field_validator('t')
|
|
35
|
+
def t_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['EarlyStoppingReferee']):
|
|
38
|
+
raise ValueError("must be one of enum values ('EarlyStoppingReferee')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of EarlyStoppingRefereeModel from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of EarlyStoppingRefereeModel from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'EarlyStoppingReferee',
|
|
93
|
+
"maxVotes": obj.get("maxVotes"),
|
|
94
|
+
"threshold": obj.get("threshold")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class FreeTextResult(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
FreeTextResult
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for FreeTextResult", alias="_t")
|
|
30
|
+
answer: StrictStr
|
|
31
|
+
rapid_id: StrictStr = Field(alias="rapidId")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "answer", "rapidId"]
|
|
33
|
+
|
|
34
|
+
@field_validator('t')
|
|
35
|
+
def t_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['FreeTextResult']):
|
|
38
|
+
raise ValueError("must be one of enum values ('FreeTextResult')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of FreeTextResult from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of FreeTextResult from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'FreeTextResult',
|
|
93
|
+
"answer": obj.get("answer"),
|
|
94
|
+
"rapidId": obj.get("rapidId")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|
|
@@ -40,16 +40,6 @@ class ImageDimensionMetadata(BaseModel):
|
|
|
40
40
|
raise ValueError("must be one of enum values ('ImageDimensionMetadata')")
|
|
41
41
|
return value
|
|
42
42
|
|
|
43
|
-
@field_validator('visibilities')
|
|
44
|
-
def visibilities_validate_enum(cls, value):
|
|
45
|
-
"""Validates the enum"""
|
|
46
|
-
if value is None:
|
|
47
|
-
return value
|
|
48
|
-
|
|
49
|
-
if value not in set(['None', 'Users', 'Customers', 'Admins', 'All']):
|
|
50
|
-
raise ValueError("must be one of enum values ('None', 'Users', 'Customers', 'Admins', 'All')")
|
|
51
|
-
return value
|
|
52
|
-
|
|
53
43
|
model_config = ConfigDict(
|
|
54
44
|
populate_by_name=True,
|
|
55
45
|
validate_assignment=True,
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.line_point import LinePoint
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class Line(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Line
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
t: StrictStr = Field(description="Discriminator value for Line", alias="_t")
|
|
31
|
+
size: StrictInt
|
|
32
|
+
points: List[LinePoint]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["_t", "size", "points"]
|
|
34
|
+
|
|
35
|
+
@field_validator('t')
|
|
36
|
+
def t_validate_enum(cls, value):
|
|
37
|
+
"""Validates the enum"""
|
|
38
|
+
if value not in set(['Line']):
|
|
39
|
+
raise ValueError("must be one of enum values ('Line')")
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of Line from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of each item in points (list)
|
|
82
|
+
_items = []
|
|
83
|
+
if self.points:
|
|
84
|
+
for _item_points in self.points:
|
|
85
|
+
if _item_points:
|
|
86
|
+
_items.append(_item_points.to_dict())
|
|
87
|
+
_dict['points'] = _items
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of Line from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate({
|
|
100
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'Line',
|
|
101
|
+
"size": obj.get("size"),
|
|
102
|
+
"points": [LinePoint.from_dict(_item) for _item in obj["points"]] if obj.get("points") is not None else None
|
|
103
|
+
})
|
|
104
|
+
return _obj
|
|
105
|
+
|
|
106
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class LinePoint(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
LinePoint
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for LinePoint", alias="_t")
|
|
30
|
+
x: Union[StrictFloat, StrictInt]
|
|
31
|
+
y: Union[StrictFloat, StrictInt]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "x", "y"]
|
|
33
|
+
|
|
34
|
+
@field_validator('t')
|
|
35
|
+
def t_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['LinePoint']):
|
|
38
|
+
raise ValueError("must be one of enum values ('LinePoint')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of LinePoint from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of LinePoint from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'LinePoint',
|
|
93
|
+
"x": obj.get("x"),
|
|
94
|
+
"y": obj.get("y")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|