wandelbots-isaacsim-api 2.2.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.
Files changed (85) hide show
  1. wandelbots_isaacsim_api/__init__.py +50 -0
  2. wandelbots_isaacsim_api/api/__init__.py +25 -0
  3. wandelbots_isaacsim_api/api/collision_world_api.py +316 -0
  4. wandelbots_isaacsim_api/api/default_api.py +800 -0
  5. wandelbots_isaacsim_api/api/manipulators_motion_group_api.py +1619 -0
  6. wandelbots_isaacsim_api/api/periphery_camera_api.py +3434 -0
  7. wandelbots_isaacsim_api/api/prims_api.py +4963 -0
  8. wandelbots_isaacsim_api/api/stage_api.py +2351 -0
  9. wandelbots_isaacsim_api/api/teaching_api.py +1312 -0
  10. wandelbots_isaacsim_api/api/trajectory_api.py +1686 -0
  11. wandelbots_isaacsim_api/api/ui_api.py +562 -0
  12. wandelbots_isaacsim_api/api_client.py +800 -0
  13. wandelbots_isaacsim_api/api_response.py +21 -0
  14. wandelbots_isaacsim_api/collision/__init__.py +0 -0
  15. wandelbots_isaacsim_api/collision/utils.py +99 -0
  16. wandelbots_isaacsim_api/configuration.py +561 -0
  17. wandelbots_isaacsim_api/exceptions.py +216 -0
  18. wandelbots_isaacsim_api/models/__init__.py +135 -0
  19. wandelbots_isaacsim_api/models/auth0_credentials.py +100 -0
  20. wandelbots_isaacsim_api/models/body_apply_relative_pose.py +99 -0
  21. wandelbots_isaacsim_api/models/body_assign_default_poses.py +91 -0
  22. wandelbots_isaacsim_api/models/body_reset_to_default_poses.py +91 -0
  23. wandelbots_isaacsim_api/models/body_set_joint_state.py +93 -0
  24. wandelbots_isaacsim_api/models/body_set_prim_metadata.py +97 -0
  25. wandelbots_isaacsim_api/models/body_set_prim_visibility.py +103 -0
  26. wandelbots_isaacsim_api/models/body_set_semantic_label.py +93 -0
  27. wandelbots_isaacsim_api/models/body_update_colliders.py +93 -0
  28. wandelbots_isaacsim_api/models/body_update_pose.py +97 -0
  29. wandelbots_isaacsim_api/models/bounding_box2_d.py +98 -0
  30. wandelbots_isaacsim_api/models/bounding_box3_d.py +100 -0
  31. wandelbots_isaacsim_api/models/box.py +119 -0
  32. wandelbots_isaacsim_api/models/box_sweep_parameters.py +111 -0
  33. wandelbots_isaacsim_api/models/capsule.py +105 -0
  34. wandelbots_isaacsim_api/models/collider.py +101 -0
  35. wandelbots_isaacsim_api/models/convex_hull.py +103 -0
  36. wandelbots_isaacsim_api/models/create_ghost_object.py +102 -0
  37. wandelbots_isaacsim_api/models/custom_prim.py +100 -0
  38. wandelbots_isaacsim_api/models/custom_prim_data.py +93 -0
  39. wandelbots_isaacsim_api/models/cylinder.py +105 -0
  40. wandelbots_isaacsim_api/models/ghost_object.py +106 -0
  41. wandelbots_isaacsim_api/models/ghost_object_source.py +93 -0
  42. wandelbots_isaacsim_api/models/gizmo_prim.py +98 -0
  43. wandelbots_isaacsim_api/models/http_validation_error.py +108 -0
  44. wandelbots_isaacsim_api/models/instance_segmentation_data.py +97 -0
  45. wandelbots_isaacsim_api/models/instance_segmentation_info.py +91 -0
  46. wandelbots_isaacsim_api/models/motion_group_configuration.py +99 -0
  47. wandelbots_isaacsim_api/models/motion_stream_configuration.py +101 -0
  48. wandelbots_isaacsim_api/models/patch_trajectory_data.py +107 -0
  49. wandelbots_isaacsim_api/models/plane.py +101 -0
  50. wandelbots_isaacsim_api/models/point_cloud.py +95 -0
  51. wandelbots_isaacsim_api/models/pose.py +137 -0
  52. wandelbots_isaacsim_api/models/pose_position_inner.py +138 -0
  53. wandelbots_isaacsim_api/models/prim.py +165 -0
  54. wandelbots_isaacsim_api/models/prim_selection.py +91 -0
  55. wandelbots_isaacsim_api/models/quat_pose.py +92 -0
  56. wandelbots_isaacsim_api/models/relative_pose_mode.py +39 -0
  57. wandelbots_isaacsim_api/models/response_get_pose.py +134 -0
  58. wandelbots_isaacsim_api/models/response_get_relative_pose.py +134 -0
  59. wandelbots_isaacsim_api/models/response_list_default_poses_value.py +140 -0
  60. wandelbots_isaacsim_api/models/semantic_segmentation_data.py +97 -0
  61. wandelbots_isaacsim_api/models/semantic_segmentation_info.py +91 -0
  62. wandelbots_isaacsim_api/models/shape.py +194 -0
  63. wandelbots_isaacsim_api/models/simulation_state.py +101 -0
  64. wandelbots_isaacsim_api/models/sphere.py +103 -0
  65. wandelbots_isaacsim_api/models/sphere_sweep_parameters.py +107 -0
  66. wandelbots_isaacsim_api/models/stage_units.py +91 -0
  67. wandelbots_isaacsim_api/models/sweep_arguments.py +134 -0
  68. wandelbots_isaacsim_api/models/tcp_source.py +99 -0
  69. wandelbots_isaacsim_api/models/trajectory_data.py +101 -0
  70. wandelbots_isaacsim_api/models/trajectory_marker.py +97 -0
  71. wandelbots_isaacsim_api/models/trajectory_object.py +101 -0
  72. wandelbots_isaacsim_api/models/trajectory_options.py +94 -0
  73. wandelbots_isaacsim_api/models/usd_stage_model.py +91 -0
  74. wandelbots_isaacsim_api/models/validation_error.py +112 -0
  75. wandelbots_isaacsim_api/models/validation_error_loc_inner.py +138 -0
  76. wandelbots_isaacsim_api/models/ws_pose.py +92 -0
  77. wandelbots_isaacsim_api/py.typed +0 -0
  78. wandelbots_isaacsim_api/rest.py +212 -0
  79. wandelbots_isaacsim_api/trajectory/__init__.py +17 -0
  80. wandelbots_isaacsim_api/trajectory/trajectory_viewer.py +111 -0
  81. wandelbots_isaacsim_api/trajectory/utils.py +154 -0
  82. wandelbots_isaacsim_api-2.2.2.dist-info/LICENSE +201 -0
  83. wandelbots_isaacsim_api-2.2.2.dist-info/METADATA +60 -0
  84. wandelbots_isaacsim_api-2.2.2.dist-info/RECORD +85 -0
  85. wandelbots_isaacsim_api-2.2.2.dist-info/WHEEL +4 -0
@@ -0,0 +1,107 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Wandelbots Omniservice
5
+
6
+ A microservice-based framework for managing Omniverse functionalities
7
+
8
+ The version of the OpenAPI document: 2.2.2
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, StrictFloat, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from wandelbots_isaacsim_api.models.trajectory_options import TrajectoryOptions
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PatchTrajectoryData(BaseModel):
27
+ """
28
+ PatchTrajectoryData
29
+ """ # noqa: E501
30
+ poses: Optional[List[List[Union[StrictFloat, StrictInt]]]] = None
31
+ options: Optional[TrajectoryOptions] = None
32
+ __properties: ClassVar[List[str]] = ["poses", "options"]
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, exclude_none=True))
44
+
45
+ def to_json(self) -> str:
46
+ """
47
+ Returns the JSON representation of the model using alias
48
+
49
+ Do not use pydantic v2 .model_dump_json(by_alias=True, exclude_unset=True) here!
50
+ It is unable to resolve nested types generated by openapi-generator.
51
+ """
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of PatchTrajectoryData from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # override the default output from pydantic by calling `to_dict()` of options
78
+ if self.options:
79
+ _dict['options'] = self.options.to_dict()
80
+ # set to None if poses (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.poses is None and "poses" in self.model_fields_set:
83
+ _dict['poses'] = None
84
+
85
+ # set to None if options (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.options is None and "options" in self.model_fields_set:
88
+ _dict['options'] = 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 PatchTrajectoryData 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
+ "poses": obj.get("poses"),
103
+ "options": TrajectoryOptions.from_dict(obj["options"]) if obj.get("options") is not None else None
104
+ })
105
+ return _obj
106
+
107
+
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Wandelbots Omniservice
5
+
6
+ A microservice-based framework for managing Omniverse functionalities
7
+
8
+ The version of the OpenAPI document: 2.2.2
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, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class Plane(BaseModel):
26
+ """
27
+ Plane
28
+ """ # noqa: E501
29
+ shape_type: Optional[StrictStr] = 'plane'
30
+ __properties: ClassVar[List[str]] = ["shape_type"]
31
+
32
+ @field_validator('shape_type')
33
+ def shape_type_validate_enum(cls, value):
34
+ """Validates the enum"""
35
+ if value is None:
36
+ return value
37
+
38
+ if value not in set(['plane']):
39
+ raise ValueError("must be one of enum values ('plane')")
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, exclude_none=True))
52
+
53
+ def to_json(self) -> str:
54
+ """
55
+ Returns the JSON representation of the model using alias
56
+
57
+ Do not use pydantic v2 .model_dump_json(by_alias=True, exclude_unset=True) here!
58
+ It is unable to resolve nested types generated by openapi-generator.
59
+ """
60
+ return json.dumps(self.to_dict())
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of Plane from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ """
77
+ excluded_fields: Set[str] = set([
78
+ ])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of Plane from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "shape_type": obj.get("shape_type") if obj.get("shape_type") is not None else 'plane'
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Wandelbots Omniservice
5
+
6
+ A microservice-based framework for managing Omniverse functionalities
7
+
8
+ The version of the OpenAPI document: 2.2.2
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
21
+ from typing import Any, ClassVar, Dict, List, Union
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class PointCloud(BaseModel):
26
+ """
27
+ PointCloud
28
+ """ # noqa: E501
29
+ points: List[List[Union[StrictFloat, StrictInt]]] = Field(description="List of 3D points in world coordinates")
30
+ colors: List[List[Union[StrictFloat, StrictInt]]] = Field(description="List of RGB colors for each point")
31
+ normals: List[List[Union[StrictFloat, StrictInt]]] = Field(description="List of surface normals for each point")
32
+ __properties: ClassVar[List[str]] = ["points", "colors", "normals"]
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, exclude_none=True))
44
+
45
+ def to_json(self) -> str:
46
+ """
47
+ Returns the JSON representation of the model using alias
48
+
49
+ Do not use pydantic v2 .model_dump_json(by_alias=True, exclude_unset=True) here!
50
+ It is unable to resolve nested types generated by openapi-generator.
51
+ """
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of PointCloud from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of PointCloud from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "points": obj.get("points"),
90
+ "colors": obj.get("colors"),
91
+ "normals": obj.get("normals")
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,137 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Wandelbots Omniservice
5
+
6
+ A microservice-based framework for managing Omniverse functionalities
7
+
8
+ The version of the OpenAPI document: 2.2.2
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from wandelbots_isaacsim_api.models.pose_position_inner import PosePositionInner
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class Pose(BaseModel):
28
+ """
29
+ Defines a pose in 3D space. A pose is a combination of a position and an orientation. The position is applied before the orientation.
30
+ """ # noqa: E501
31
+ position: Optional[Annotated[List[PosePositionInner], Field(min_length=3, max_length=3)]] = None
32
+ orientation: Optional[Annotated[List[PosePositionInner], Field(min_length=3, max_length=3)]] = None
33
+ __properties: ClassVar[List[str]] = ["position", "orientation"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True, exclude_none=True))
45
+
46
+ def to_json(self) -> str:
47
+ """
48
+ Returns the JSON representation of the model using alias
49
+
50
+ Do not use pydantic v2 .model_dump_json(by_alias=True, exclude_unset=True) here!
51
+ It is unable to resolve nested types generated by openapi-generator.
52
+ """
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of Pose from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of each item in position (list)
79
+ _items = []
80
+ if self.position:
81
+ for _item in self.position:
82
+ # >>> Modified from https://github.com/OpenAPITools/openapi-generator/blob/v7.6.0/modules/openapi-generator/src/main/resources/python/model_generic.mustache
83
+ # to not drop empty elements in lists
84
+ if _item is not None:
85
+ _items.append(_item.to_dict())
86
+ # <<< End modification
87
+ _dict['position'] = _items
88
+ # override the default output from pydantic by calling `to_dict()` of each item in orientation (list)
89
+ _items = []
90
+ if self.orientation:
91
+ for _item in self.orientation:
92
+ # >>> Modified from https://github.com/OpenAPITools/openapi-generator/blob/v7.6.0/modules/openapi-generator/src/main/resources/python/model_generic.mustache
93
+ # to not drop empty elements in lists
94
+ if _item is not None:
95
+ _items.append(_item.to_dict())
96
+ # <<< End modification
97
+ _dict['orientation'] = _items
98
+ # set to None if position (nullable) is None
99
+ # and model_fields_set contains the field
100
+ if self.position is None and "position" in self.model_fields_set:
101
+ _dict['position'] = None
102
+
103
+ # set to None if orientation (nullable) is None
104
+ # and model_fields_set contains the field
105
+ if self.orientation is None and "orientation" in self.model_fields_set:
106
+ _dict['orientation'] = None
107
+
108
+ return _dict
109
+
110
+ @classmethod
111
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
112
+ """Create an instance of Pose from a dict"""
113
+ if obj is None:
114
+ return None
115
+
116
+ if not isinstance(obj, dict):
117
+ return cls.model_validate(obj)
118
+
119
+ _obj = cls.model_validate({
120
+ "position": [
121
+ # >>> Modified from https://github.com/OpenAPITools/openapi-generator/blob/v7.6.0/modules/openapi-generator/src/main/resources/python/model_generic.mustache
122
+ # to allow dicts in lists
123
+ PosePositionInner.from_dict(_item) if hasattr(PosePositionInner, 'from_dict') else _item
124
+ # <<< End modification
125
+ for _item in obj["position"]
126
+ ] if obj.get("position") is not None else None,
127
+ "orientation": [
128
+ # >>> Modified from https://github.com/OpenAPITools/openapi-generator/blob/v7.6.0/modules/openapi-generator/src/main/resources/python/model_generic.mustache
129
+ # to allow dicts in lists
130
+ PosePositionInner.from_dict(_item) if hasattr(PosePositionInner, 'from_dict') else _item
131
+ # <<< End modification
132
+ for _item in obj["orientation"]
133
+ ] if obj.get("orientation") is not None else None
134
+ })
135
+ return _obj
136
+
137
+
@@ -0,0 +1,138 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Wandelbots Omniservice
5
+
6
+ A microservice-based framework for managing Omniverse functionalities
7
+
8
+ The version of the OpenAPI document: 2.2.2
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
+ from inspect import getfullargspec
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
21
+ from typing import Optional, Union
22
+ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
23
+ from typing_extensions import Literal, Self
24
+ from pydantic import Field
25
+
26
+ POSEPOSITIONINNER_ANY_OF_SCHEMAS = ["float", "int"]
27
+
28
+ class PosePositionInner(BaseModel):
29
+ """
30
+ PosePositionInner
31
+ """
32
+
33
+ # data type: float
34
+ anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
35
+ # data type: int
36
+ anyof_schema_2_validator: Optional[StrictInt] = None
37
+ if TYPE_CHECKING:
38
+ actual_instance: Optional[Union[float, int]] = None
39
+ else:
40
+ actual_instance: Any = None
41
+ any_of_schemas: Set[str] = { "float", "int" }
42
+
43
+ model_config = {
44
+ "validate_assignment": True,
45
+ "protected_namespaces": (),
46
+ }
47
+
48
+ def __init__(self, *args, **kwargs) -> None:
49
+ if args:
50
+ if len(args) > 1:
51
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
52
+ if kwargs:
53
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
54
+ super().__init__(actual_instance=args[0])
55
+ else:
56
+ super().__init__(**kwargs)
57
+
58
+ @field_validator('actual_instance')
59
+ def actual_instance_must_validate_anyof(cls, v):
60
+ instance = PosePositionInner.model_construct()
61
+ error_messages = []
62
+ # validate data type: float
63
+ try:
64
+ instance.anyof_schema_1_validator = v
65
+ return v
66
+ except (ValidationError, ValueError) as e:
67
+ error_messages.append(str(e))
68
+ # validate data type: int
69
+ try:
70
+ instance.anyof_schema_2_validator = v
71
+ return v
72
+ except (ValidationError, ValueError) as e:
73
+ error_messages.append(str(e))
74
+ if error_messages:
75
+ # no match
76
+ raise ValueError("No match found when setting the actual_instance in PosePositionInner with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
77
+ else:
78
+ return v
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
82
+ return cls.from_json(json.dumps(obj))
83
+
84
+ @classmethod
85
+ def from_json(cls, json_str: str) -> Self:
86
+ """Returns the object represented by the json string"""
87
+ instance = cls.model_construct()
88
+ error_messages = []
89
+ # deserialize data into float
90
+ try:
91
+ # validation
92
+ instance.anyof_schema_1_validator = json.loads(json_str)
93
+ # assign value to actual_instance
94
+ instance.actual_instance = instance.anyof_schema_1_validator
95
+ return instance
96
+ except (ValidationError, ValueError) as e:
97
+ error_messages.append(str(e))
98
+ # deserialize data into int
99
+ try:
100
+ # validation
101
+ instance.anyof_schema_2_validator = json.loads(json_str)
102
+ # assign value to actual_instance
103
+ instance.actual_instance = instance.anyof_schema_2_validator
104
+ return instance
105
+ except (ValidationError, ValueError) as e:
106
+ error_messages.append(str(e))
107
+
108
+ if error_messages:
109
+ # no match
110
+ raise ValueError("No match found when deserializing the JSON string into PosePositionInner with anyOf schemas: float, int. Details: " + ", ".join(error_messages))
111
+ else:
112
+ return instance
113
+
114
+ def to_json(self) -> str:
115
+ """Returns the JSON representation of the actual instance"""
116
+ if self.actual_instance is None:
117
+ return "null"
118
+
119
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
120
+ return self.actual_instance.to_json()
121
+ else:
122
+ return json.dumps(self.actual_instance)
123
+
124
+ def to_dict(self) -> Optional[Union[Dict[str, Any], float, int]]:
125
+ """Returns the dict representation of the actual instance"""
126
+ if self.actual_instance is None:
127
+ return None
128
+
129
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
130
+ return self.actual_instance.to_dict()
131
+ else:
132
+ return self.actual_instance
133
+
134
+ def to_str(self) -> str:
135
+ """Returns the string representation of the actual instance"""
136
+ return pprint.pformat(self.model_dump())
137
+
138
+