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.
Files changed (50) hide show
  1. rapidata/api_client/__init__.py +2 -0
  2. rapidata/api_client/api/rapid_api.py +1370 -0
  3. rapidata/api_client/api/validation_api.py +15 -5
  4. rapidata/api_client/models/__init__.py +2 -0
  5. rapidata/api_client/models/add_validation_rapid_result.py +87 -0
  6. rapidata/api_client/models/attach_category_result.py +98 -0
  7. rapidata/api_client/models/bounding_box_result.py +106 -0
  8. rapidata/api_client/models/classification_metadata.py +0 -10
  9. rapidata/api_client/models/compare_result.py +98 -0
  10. rapidata/api_client/models/coordinate.py +108 -0
  11. rapidata/api_client/models/count_metadata.py +0 -10
  12. rapidata/api_client/models/create_demographic_rapid_model.py +93 -0
  13. rapidata/api_client/models/create_order_model_referee.py +22 -8
  14. rapidata/api_client/models/early_stopping_referee_model.py +98 -0
  15. rapidata/api_client/models/free_text_result.py +98 -0
  16. rapidata/api_client/models/image_dimension_metadata.py +0 -10
  17. rapidata/api_client/models/line.py +106 -0
  18. rapidata/api_client/models/line_point.py +98 -0
  19. rapidata/api_client/models/line_result.py +106 -0
  20. rapidata/api_client/models/locate_coordinate.py +98 -0
  21. rapidata/api_client/models/locate_result.py +106 -0
  22. rapidata/api_client/models/location_metadata.py +0 -10
  23. rapidata/api_client/models/named_entity_result.py +106 -0
  24. rapidata/api_client/models/order_query_get200_response.py +12 -12
  25. rapidata/api_client/models/original_filename_metadata.py +0 -10
  26. rapidata/api_client/models/polygon_result.py +106 -0
  27. rapidata/api_client/models/prompt_metadata.py +0 -10
  28. rapidata/api_client/models/query_model.py +112 -0
  29. rapidata/api_client/models/query_validation_rapids_result.py +98 -0
  30. rapidata/api_client/models/query_validation_rapids_result_asset.py +174 -0
  31. rapidata/api_client/models/query_validation_rapids_result_paged_result.py +105 -0
  32. rapidata/api_client/models/rapid_result_model.py +93 -0
  33. rapidata/api_client/models/rapid_result_model_result.py +252 -0
  34. rapidata/api_client/models/rapid_skipped_model.py +89 -0
  35. rapidata/api_client/models/shape.py +104 -0
  36. rapidata/api_client/models/skip_result.py +96 -0
  37. rapidata/api_client/models/text_metadata.py +0 -7
  38. rapidata/api_client/models/transcription_metadata.py +0 -7
  39. rapidata/api_client/models/transcription_result.py +106 -0
  40. rapidata/rapidata_client/dataset/rapidata_dataset.py +1 -2
  41. rapidata/rapidata_client/dataset/rapidata_validation_set.py +1 -2
  42. rapidata/rapidata_client/dataset/validation_rapid_parts.py +1 -2
  43. rapidata/rapidata_client/order/rapidata_order_builder.py +2 -3
  44. rapidata/rapidata_client/utils/utils.py +22 -0
  45. rapidata/service/openapi_service.py +6 -2
  46. {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/METADATA +2 -1
  47. {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/RECORD +49 -23
  48. rapidata/rapidata_client/types/__init__.py +0 -1
  49. {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/LICENSE +0 -0
  50. {rapidata-0.1.18.dist-info → rapidata-0.1.19.dist-info}/WHEEL +0 -0
@@ -20,6 +20,7 @@ from pydantic import Field, StrictBytes, StrictStr
20
20
  from typing import List, Optional, Tuple, Union
21
21
  from typing_extensions import Annotated
22
22
  from rapidata.api_client.models.add_validation_rapid_model import AddValidationRapidModel
23
+ from rapidata.api_client.models.add_validation_rapid_result import AddValidationRapidResult
23
24
  from rapidata.api_client.models.create_empty_validation_set_result import CreateEmptyValidationSetResult
24
25
  from rapidata.api_client.models.get_available_validation_sets_result import GetAvailableValidationSetsResult
25
26
  from rapidata.api_client.models.import_validation_set_from_file_result import ImportValidationSetFromFileResult
@@ -62,7 +63,7 @@ class ValidationApi:
62
63
  _content_type: Optional[StrictStr] = None,
63
64
  _headers: Optional[Dict[StrictStr, Any]] = None,
64
65
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
65
- ) -> None:
66
+ ) -> AddValidationRapidResult:
66
67
  """Adds a new validation rapid to the specified validation set.
67
68
 
68
69
 
@@ -102,7 +103,7 @@ class ValidationApi:
102
103
  )
103
104
 
104
105
  _response_types_map: Dict[str, Optional[str]] = {
105
- '200': None,
106
+ '200': "AddValidationRapidResult",
106
107
  }
107
108
  response_data = self.api_client.call_api(
108
109
  *_param,
@@ -132,7 +133,7 @@ class ValidationApi:
132
133
  _content_type: Optional[StrictStr] = None,
133
134
  _headers: Optional[Dict[StrictStr, Any]] = None,
134
135
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
135
- ) -> ApiResponse[None]:
136
+ ) -> ApiResponse[AddValidationRapidResult]:
136
137
  """Adds a new validation rapid to the specified validation set.
137
138
 
138
139
 
@@ -172,7 +173,7 @@ class ValidationApi:
172
173
  )
173
174
 
174
175
  _response_types_map: Dict[str, Optional[str]] = {
175
- '200': None,
176
+ '200': "AddValidationRapidResult",
176
177
  }
177
178
  response_data = self.api_client.call_api(
178
179
  *_param,
@@ -242,7 +243,7 @@ class ValidationApi:
242
243
  )
243
244
 
244
245
  _response_types_map: Dict[str, Optional[str]] = {
245
- '200': None,
246
+ '200': "AddValidationRapidResult",
246
247
  }
247
248
  response_data = self.api_client.call_api(
248
249
  *_param,
@@ -287,6 +288,15 @@ class ValidationApi:
287
288
  # process the body parameter
288
289
 
289
290
 
291
+ # set the HTTP header `Accept`
292
+ if 'Accept' not in _header_params:
293
+ _header_params['Accept'] = self.api_client.select_header_accept(
294
+ [
295
+ 'text/plain',
296
+ 'application/json',
297
+ 'text/json'
298
+ ]
299
+ )
290
300
 
291
301
  # set the HTTP header `Content-Type`
292
302
  if _content_type:
@@ -17,6 +17,7 @@
17
17
  from rapidata.api_client.models.add_validation_rapid_model import AddValidationRapidModel
18
18
  from rapidata.api_client.models.add_validation_rapid_model_payload import AddValidationRapidModelPayload
19
19
  from rapidata.api_client.models.add_validation_rapid_model_truth import AddValidationRapidModelTruth
20
+ from rapidata.api_client.models.add_validation_rapid_result import AddValidationRapidResult
20
21
  from rapidata.api_client.models.admin_order_model import AdminOrderModel
21
22
  from rapidata.api_client.models.admin_order_model_paged_result import AdminOrderModelPagedResult
22
23
  from rapidata.api_client.models.age_group import AgeGroup
@@ -79,6 +80,7 @@ from rapidata.api_client.models.datapoint_model_asset import DatapointModelAsset
79
80
  from rapidata.api_client.models.dataset_evaluation_step_model import DatasetEvaluationStepModel
80
81
  from rapidata.api_client.models.demographic_rapid_selection_config import DemographicRapidSelectionConfig
81
82
  from rapidata.api_client.models.demographic_selection import DemographicSelection
83
+ from rapidata.api_client.models.early_stopping_referee_model import EarlyStoppingRefereeModel
82
84
  from rapidata.api_client.models.empty_validation_truth import EmptyValidationTruth
83
85
  from rapidata.api_client.models.error_type import ErrorType
84
86
  from rapidata.api_client.models.feature_flag import FeatureFlag
@@ -0,0 +1,87 @@
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 typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class AddValidationRapidResult(BaseModel):
26
+ """
27
+ AddValidationRapidResult
28
+ """ # noqa: E501
29
+ rapid_id: StrictStr = Field(alias="rapidId")
30
+ __properties: ClassVar[List[str]] = ["rapidId"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of AddValidationRapidResult from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of AddValidationRapidResult from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "rapidId": obj.get("rapidId")
84
+ })
85
+ return _obj
86
+
87
+
@@ -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 AttachCategoryResult(BaseModel):
26
+ """
27
+ AttachCategoryResult
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for AttachCategoryResult", alias="_t")
30
+ category: StrictStr
31
+ rapid_id: StrictStr = Field(alias="rapidId")
32
+ __properties: ClassVar[List[str]] = ["_t", "category", "rapidId"]
33
+
34
+ @field_validator('t')
35
+ def t_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['AttachCategoryResult']):
38
+ raise ValueError("must be one of enum values ('AttachCategoryResult')")
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 AttachCategoryResult 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 AttachCategoryResult 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 'AttachCategoryResult',
93
+ "category": obj.get("category"),
94
+ "rapidId": obj.get("rapidId")
95
+ })
96
+ return _obj
97
+
98
+
@@ -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, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from rapidata.api_client.models.box_shape import BoxShape
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class BoundingBoxResult(BaseModel):
27
+ """
28
+ BoundingBoxResult
29
+ """ # noqa: E501
30
+ t: StrictStr = Field(description="Discriminator value for BoundingBoxResult", alias="_t")
31
+ bounding_boxes: List[BoxShape] = Field(alias="boundingBoxes")
32
+ rapid_id: StrictStr = Field(alias="rapidId")
33
+ __properties: ClassVar[List[str]] = ["_t", "boundingBoxes", "rapidId"]
34
+
35
+ @field_validator('t')
36
+ def t_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value not in set(['BoundingBoxResult']):
39
+ raise ValueError("must be one of enum values ('BoundingBoxResult')")
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 BoundingBoxResult 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 bounding_boxes (list)
82
+ _items = []
83
+ if self.bounding_boxes:
84
+ for _item_bounding_boxes in self.bounding_boxes:
85
+ if _item_bounding_boxes:
86
+ _items.append(_item_bounding_boxes.to_dict())
87
+ _dict['boundingBoxes'] = _items
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of BoundingBoxResult 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 'BoundingBoxResult',
101
+ "boundingBoxes": [BoxShape.from_dict(_item) for _item in obj["boundingBoxes"]] if obj.get("boundingBoxes") is not None else None,
102
+ "rapidId": obj.get("rapidId")
103
+ })
104
+ return _obj
105
+
106
+
@@ -39,16 +39,6 @@ class ClassificationMetadata(BaseModel):
39
39
  raise ValueError("must be one of enum values ('ClassificationMetadata')")
40
40
  return value
41
41
 
42
- @field_validator('visibilities')
43
- def visibilities_validate_enum(cls, value):
44
- """Validates the enum"""
45
- if value is None:
46
- return value
47
-
48
- if value not in set(['None', 'Users', 'Customers', 'Admins', 'All']):
49
- raise ValueError("must be one of enum values ('None', 'Users', 'Customers', 'Admins', 'All')")
50
- return value
51
-
52
42
  model_config = ConfigDict(
53
43
  populate_by_name=True,
54
44
  validate_assignment=True,
@@ -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 CompareResult(BaseModel):
26
+ """
27
+ CompareResult
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for CompareResult", alias="_t")
30
+ winner_id: StrictStr = Field(alias="winnerId")
31
+ rapid_id: StrictStr = Field(alias="rapidId")
32
+ __properties: ClassVar[List[str]] = ["_t", "winnerId", "rapidId"]
33
+
34
+ @field_validator('t')
35
+ def t_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['CompareResult']):
38
+ raise ValueError("must be one of enum values ('CompareResult')")
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 CompareResult 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 CompareResult 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 'CompareResult',
93
+ "winnerId": obj.get("winnerId"),
94
+ "rapidId": obj.get("rapidId")
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,108 @@
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, Optional, Union
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class Coordinate(BaseModel):
26
+ """
27
+ Coordinate
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for Coordinate", alias="_t")
30
+ x: Optional[Union[StrictFloat, StrictInt]]
31
+ y: Optional[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(['Coordinate']):
38
+ raise ValueError("must be one of enum values ('Coordinate')")
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 Coordinate 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
+ # set to None if x (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.x is None and "x" in self.model_fields_set:
83
+ _dict['x'] = None
84
+
85
+ # set to None if y (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.y is None and "y" in self.model_fields_set:
88
+ _dict['y'] = None
89
+
90
+ return _dict
91
+
92
+ @classmethod
93
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94
+ """Create an instance of Coordinate from a dict"""
95
+ if obj is None:
96
+ return None
97
+
98
+ if not isinstance(obj, dict):
99
+ return cls.model_validate(obj)
100
+
101
+ _obj = cls.model_validate({
102
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'Coordinate',
103
+ "x": obj.get("x"),
104
+ "y": obj.get("y")
105
+ })
106
+ return _obj
107
+
108
+
@@ -39,16 +39,6 @@ class CountMetadata(BaseModel):
39
39
  raise ValueError("must be one of enum values ('CountMetadata')")
40
40
  return value
41
41
 
42
- @field_validator('visibilities')
43
- def visibilities_validate_enum(cls, value):
44
- """Validates the enum"""
45
- if value is None:
46
- return value
47
-
48
- if value not in set(['None', 'Users', 'Customers', 'Admins', 'All']):
49
- raise ValueError("must be one of enum values ('None', 'Users', 'Customers', 'Admins', 'All')")
50
- return value
51
-
52
42
  model_config = ConfigDict(
53
43
  populate_by_name=True,
54
44
  validate_assignment=True,