thrustlab 0.1.0__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 (119) hide show
  1. thrustlab/__init__.py +23 -0
  2. thrustlab/_async_polling.py +47 -0
  3. thrustlab/_http.py +166 -0
  4. thrustlab/_models/__init__.py +211 -0
  5. thrustlab/_models/api_key.py +184 -0
  6. thrustlab/_models/api_key_create.py +74 -0
  7. thrustlab/_models/api_key_with_secret.py +192 -0
  8. thrustlab/_models/billing_portal_session_resource.py +74 -0
  9. thrustlab/_models/checkout_session_resource.py +94 -0
  10. thrustlab/_models/component_brand.py +80 -0
  11. thrustlab/_models/component_brands_response.py +108 -0
  12. thrustlab/_models/component_create_body.py +83 -0
  13. thrustlab/_models/component_create_body_spec_json.py +46 -0
  14. thrustlab/_models/component_list_response.py +108 -0
  15. thrustlab/_models/component_patch.py +111 -0
  16. thrustlab/_models/component_patch_spec_json_type_0.py +46 -0
  17. thrustlab/_models/component_resource.py +188 -0
  18. thrustlab/_models/component_resource_spec_json.py +46 -0
  19. thrustlab/_models/create_webhook_endpoint_v1_webhook_endpoints_post_response_create_webhook_endpoint_v1_webhook_endpoints_post.py +50 -0
  20. thrustlab/_models/credit_balance_resource.py +135 -0
  21. thrustlab/_models/credit_bucket_breakdown.py +92 -0
  22. thrustlab/_models/credit_bucket_breakdown_type.py +9 -0
  23. thrustlab/_models/credit_usage_event_resource.py +154 -0
  24. thrustlab/_models/credit_usage_event_resource_credit_type.py +9 -0
  25. thrustlab/_models/credit_usage_event_resource_type.py +16 -0
  26. thrustlab/_models/credit_usage_list_response.py +116 -0
  27. thrustlab/_models/credit_usage_related_resource.py +71 -0
  28. thrustlab/_models/credit_usage_related_resource_object.py +9 -0
  29. thrustlab/_models/fire_test_event_v1_webhook_endpoints_public_id_test_post_response_fire_test_event_v1_webhook_endpoints_public_id_test_post.py +48 -0
  30. thrustlab/_models/get_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_get_response_get_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_get.py +49 -0
  31. thrustlab/_models/get_event_v1_events_event_id_get_response_get_event_v1_events_event_id_get.py +46 -0
  32. thrustlab/_models/get_webhook_endpoint_v1_webhook_endpoints_public_id_get_response_get_webhook_endpoint_v1_webhook_endpoints_public_id_get.py +48 -0
  33. thrustlab/_models/http_validation_error.py +79 -0
  34. thrustlab/_models/list_deliveries_v1_webhook_endpoints_public_id_deliveries_get_response_list_deliveries_v1_webhook_endpoints_public_id_deliveries_get.py +49 -0
  35. thrustlab/_models/list_events_v1_events_get_response_list_events_v1_events_get.py +46 -0
  36. thrustlab/_models/list_response_api_key.py +116 -0
  37. thrustlab/_models/list_webhook_endpoints_v1_webhook_endpoints_get_response_list_webhook_endpoints_v1_webhook_endpoints_get.py +46 -0
  38. thrustlab/_models/patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch_response_patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch.py +49 -0
  39. thrustlab/_models/portal_session_in.py +42 -0
  40. thrustlab/_models/project_create_body.py +103 -0
  41. thrustlab/_models/project_list_response.py +108 -0
  42. thrustlab/_models/project_patch.py +113 -0
  43. thrustlab/_models/project_resource.py +127 -0
  44. thrustlab/_models/retry_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_retry_post_response_retry_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_retry_post.py +49 -0
  45. thrustlab/_models/rotate_webhook_secret_v1_webhook_endpoints_public_id_rotate_secret_post_response_rotate_webhook_secret_v1_webhook_endpoints_public_id_rotate_secret_post.py +49 -0
  46. thrustlab/_models/rotor_group_in.py +107 -0
  47. thrustlab/_models/rotor_group_resource.py +97 -0
  48. thrustlab/_models/simulation_cancel_body.py +24 -0
  49. thrustlab/_models/simulation_create_body.py +128 -0
  50. thrustlab/_models/simulation_inputs.py +66 -0
  51. thrustlab/_models/simulation_list_response.py +88 -0
  52. thrustlab/_models/simulation_patch.py +121 -0
  53. thrustlab/_models/simulation_patch_plot_config_json_type_0_item.py +46 -0
  54. thrustlab/_models/simulation_resource.py +283 -0
  55. thrustlab/_models/simulation_resource_error_type_0.py +46 -0
  56. thrustlab/_models/simulation_resource_plot_config_json_type_0_item.py +46 -0
  57. thrustlab/_models/simulation_resource_result_type_0.py +46 -0
  58. thrustlab/_models/starred_component_create_body.py +80 -0
  59. thrustlab/_models/starred_component_list_response.py +108 -0
  60. thrustlab/_models/starred_component_resource.py +106 -0
  61. thrustlab/_models/submission_create_body.py +121 -0
  62. thrustlab/_models/submission_create_body_data_json.py +46 -0
  63. thrustlab/_models/submission_list_response.py +108 -0
  64. thrustlab/_models/submission_patch.py +174 -0
  65. thrustlab/_models/submission_patch_data_json_type_0.py +46 -0
  66. thrustlab/_models/submission_resource.py +197 -0
  67. thrustlab/_models/submission_resource_data_json.py +46 -0
  68. thrustlab/_models/subscription_create.py +58 -0
  69. thrustlab/_models/subscription_resource.py +168 -0
  70. thrustlab/_models/subscription_resource_status.py +12 -0
  71. thrustlab/_models/subscription_resource_tier.py +12 -0
  72. thrustlab/_models/sweep_cancel_body.py +42 -0
  73. thrustlab/_models/sweep_config_in.py +172 -0
  74. thrustlab/_models/sweep_create_body.py +138 -0
  75. thrustlab/_models/sweep_inputs.py +66 -0
  76. thrustlab/_models/sweep_list_response.py +88 -0
  77. thrustlab/_models/sweep_param_range_in.py +136 -0
  78. thrustlab/_models/sweep_param_range_in_mode.py +9 -0
  79. thrustlab/_models/sweep_patch.py +121 -0
  80. thrustlab/_models/sweep_patch_plot_config_json_type_0_item.py +46 -0
  81. thrustlab/_models/sweep_point_list_response.py +88 -0
  82. thrustlab/_models/sweep_point_resource.py +103 -0
  83. thrustlab/_models/sweep_point_resource_inputs.py +46 -0
  84. thrustlab/_models/sweep_point_resource_rotors_type_0.py +46 -0
  85. thrustlab/_models/sweep_resource.py +327 -0
  86. thrustlab/_models/sweep_resource_error_type_0.py +46 -0
  87. thrustlab/_models/sweep_resource_plot_config_json_type_0_item.py +46 -0
  88. thrustlab/_models/sweep_resource_summary_type_0.py +46 -0
  89. thrustlab/_models/sweep_resource_sweep_config_type_0.py +46 -0
  90. thrustlab/_models/sweep_rotor_group_in.py +95 -0
  91. thrustlab/_models/types.py +55 -0
  92. thrustlab/_models/user_patch.py +73 -0
  93. thrustlab/_models/user_resource.py +170 -0
  94. thrustlab/_models/v1_health_v1_health_get_response_v1_health_v1_health_get.py +46 -0
  95. thrustlab/_models/validation_error.py +90 -0
  96. thrustlab/_models/webhook_endpoint_create.py +91 -0
  97. thrustlab/_models/webhook_endpoint_patch.py +144 -0
  98. thrustlab/_pagination.py +109 -0
  99. thrustlab/_version.py +3 -0
  100. thrustlab/client.py +100 -0
  101. thrustlab/exceptions.py +121 -0
  102. thrustlab/resources/__init__.py +1 -0
  103. thrustlab/resources/_base.py +12 -0
  104. thrustlab/resources/api_keys.py +43 -0
  105. thrustlab/resources/components.py +60 -0
  106. thrustlab/resources/credits.py +40 -0
  107. thrustlab/resources/projects.py +54 -0
  108. thrustlab/resources/simulations.py +74 -0
  109. thrustlab/resources/starred_components.py +57 -0
  110. thrustlab/resources/submissions.py +44 -0
  111. thrustlab/resources/subscriptions.py +42 -0
  112. thrustlab/resources/sweeps.py +96 -0
  113. thrustlab/resources/users.py +13 -0
  114. thrustlab/resources/webhook_endpoints.py +138 -0
  115. thrustlab/webhooks.py +121 -0
  116. thrustlab-0.1.0.dist-info/METADATA +190 -0
  117. thrustlab-0.1.0.dist-info/RECORD +119 -0
  118. thrustlab-0.1.0.dist-info/WHEEL +4 -0
  119. thrustlab-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,172 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+
8
+ from thrustlab._models.types import UNSET, Unset
9
+
10
+ if TYPE_CHECKING:
11
+ from thrustlab._models.sweep_param_range_in import SweepParamRangeIn
12
+
13
+
14
+ T = TypeVar("T", bound="SweepConfigIn")
15
+
16
+
17
+ @_attrs_define
18
+ class SweepConfigIn:
19
+ """
20
+ Attributes:
21
+ rotor_sweep_mask (list[bool]):
22
+ airspeed (None | SweepParamRangeIn | Unset):
23
+ battery_charge (None | SweepParamRangeIn | Unset):
24
+ density (None | SweepParamRangeIn | Unset):
25
+ throttle (None | SweepParamRangeIn | Unset):
26
+ """
27
+
28
+ rotor_sweep_mask: list[bool]
29
+ airspeed: None | SweepParamRangeIn | Unset = UNSET
30
+ battery_charge: None | SweepParamRangeIn | Unset = UNSET
31
+ density: None | SweepParamRangeIn | Unset = UNSET
32
+ throttle: None | SweepParamRangeIn | Unset = UNSET
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ from thrustlab._models.sweep_param_range_in import SweepParamRangeIn
36
+
37
+ rotor_sweep_mask = self.rotor_sweep_mask
38
+
39
+ airspeed: dict[str, Any] | None | Unset
40
+ if isinstance(self.airspeed, Unset):
41
+ airspeed = UNSET
42
+ elif isinstance(self.airspeed, SweepParamRangeIn):
43
+ airspeed = self.airspeed.to_dict()
44
+ else:
45
+ airspeed = self.airspeed
46
+
47
+ battery_charge: dict[str, Any] | None | Unset
48
+ if isinstance(self.battery_charge, Unset):
49
+ battery_charge = UNSET
50
+ elif isinstance(self.battery_charge, SweepParamRangeIn):
51
+ battery_charge = self.battery_charge.to_dict()
52
+ else:
53
+ battery_charge = self.battery_charge
54
+
55
+ density: dict[str, Any] | None | Unset
56
+ if isinstance(self.density, Unset):
57
+ density = UNSET
58
+ elif isinstance(self.density, SweepParamRangeIn):
59
+ density = self.density.to_dict()
60
+ else:
61
+ density = self.density
62
+
63
+ throttle: dict[str, Any] | None | Unset
64
+ if isinstance(self.throttle, Unset):
65
+ throttle = UNSET
66
+ elif isinstance(self.throttle, SweepParamRangeIn):
67
+ throttle = self.throttle.to_dict()
68
+ else:
69
+ throttle = self.throttle
70
+
71
+ field_dict: dict[str, Any] = {}
72
+
73
+ field_dict.update(
74
+ {
75
+ "rotor_sweep_mask": rotor_sweep_mask,
76
+ }
77
+ )
78
+ if airspeed is not UNSET:
79
+ field_dict["airspeed"] = airspeed
80
+ if battery_charge is not UNSET:
81
+ field_dict["battery_charge"] = battery_charge
82
+ if density is not UNSET:
83
+ field_dict["density"] = density
84
+ if throttle is not UNSET:
85
+ field_dict["throttle"] = throttle
86
+
87
+ return field_dict
88
+
89
+ @classmethod
90
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
91
+ from thrustlab._models.sweep_param_range_in import SweepParamRangeIn
92
+
93
+ d = dict(src_dict)
94
+ rotor_sweep_mask = cast(list[bool], d.pop("rotor_sweep_mask"))
95
+
96
+ def _parse_airspeed(data: object) -> None | SweepParamRangeIn | Unset:
97
+ if data is None:
98
+ return data
99
+ if isinstance(data, Unset):
100
+ return data
101
+ try:
102
+ if not isinstance(data, dict):
103
+ raise TypeError()
104
+ airspeed_type_0 = SweepParamRangeIn.from_dict(data)
105
+
106
+ return airspeed_type_0
107
+ except (TypeError, ValueError, AttributeError, KeyError):
108
+ pass
109
+ return cast(None | SweepParamRangeIn | Unset, data)
110
+
111
+ airspeed = _parse_airspeed(d.pop("airspeed", UNSET))
112
+
113
+ def _parse_battery_charge(data: object) -> None | SweepParamRangeIn | Unset:
114
+ if data is None:
115
+ return data
116
+ if isinstance(data, Unset):
117
+ return data
118
+ try:
119
+ if not isinstance(data, dict):
120
+ raise TypeError()
121
+ battery_charge_type_0 = SweepParamRangeIn.from_dict(data)
122
+
123
+ return battery_charge_type_0
124
+ except (TypeError, ValueError, AttributeError, KeyError):
125
+ pass
126
+ return cast(None | SweepParamRangeIn | Unset, data)
127
+
128
+ battery_charge = _parse_battery_charge(d.pop("battery_charge", UNSET))
129
+
130
+ def _parse_density(data: object) -> None | SweepParamRangeIn | Unset:
131
+ if data is None:
132
+ return data
133
+ if isinstance(data, Unset):
134
+ return data
135
+ try:
136
+ if not isinstance(data, dict):
137
+ raise TypeError()
138
+ density_type_0 = SweepParamRangeIn.from_dict(data)
139
+
140
+ return density_type_0
141
+ except (TypeError, ValueError, AttributeError, KeyError):
142
+ pass
143
+ return cast(None | SweepParamRangeIn | Unset, data)
144
+
145
+ density = _parse_density(d.pop("density", UNSET))
146
+
147
+ def _parse_throttle(data: object) -> None | SweepParamRangeIn | Unset:
148
+ if data is None:
149
+ return data
150
+ if isinstance(data, Unset):
151
+ return data
152
+ try:
153
+ if not isinstance(data, dict):
154
+ raise TypeError()
155
+ throttle_type_0 = SweepParamRangeIn.from_dict(data)
156
+
157
+ return throttle_type_0
158
+ except (TypeError, ValueError, AttributeError, KeyError):
159
+ pass
160
+ return cast(None | SweepParamRangeIn | Unset, data)
161
+
162
+ throttle = _parse_throttle(d.pop("throttle", UNSET))
163
+
164
+ sweep_config_in = cls(
165
+ rotor_sweep_mask=rotor_sweep_mask,
166
+ airspeed=airspeed,
167
+ battery_charge=battery_charge,
168
+ density=density,
169
+ throttle=throttle,
170
+ )
171
+
172
+ return sweep_config_in
@@ -0,0 +1,138 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+
8
+ from thrustlab._models.types import UNSET, Unset
9
+
10
+ if TYPE_CHECKING:
11
+ from thrustlab._models.sweep_config_in import SweepConfigIn
12
+ from thrustlab._models.sweep_rotor_group_in import SweepRotorGroupIn
13
+
14
+
15
+ T = TypeVar("T", bound="SweepCreateBody")
16
+
17
+
18
+ @_attrs_define
19
+ class SweepCreateBody:
20
+ """
21
+ Attributes:
22
+ airspeed_m_s (float):
23
+ battery_component_id (str):
24
+ density_kg_m3 (float):
25
+ project_id (str):
26
+ rotor_groups (list[SweepRotorGroupIn]):
27
+ sweep (SweepConfigIn):
28
+ battery_charge_pct (float | Unset): Default: 100.0.
29
+ name (None | str | Unset):
30
+ solver (str | Unset): Default: 'bem'.
31
+ """
32
+
33
+ airspeed_m_s: float
34
+ battery_component_id: str
35
+ density_kg_m3: float
36
+ project_id: str
37
+ rotor_groups: list[SweepRotorGroupIn]
38
+ sweep: SweepConfigIn
39
+ battery_charge_pct: float | Unset = 100.0
40
+ name: None | str | Unset = UNSET
41
+ solver: str | Unset = "bem"
42
+
43
+ def to_dict(self) -> dict[str, Any]:
44
+ airspeed_m_s = self.airspeed_m_s
45
+
46
+ battery_component_id = self.battery_component_id
47
+
48
+ density_kg_m3 = self.density_kg_m3
49
+
50
+ project_id = self.project_id
51
+
52
+ rotor_groups = []
53
+ for rotor_groups_item_data in self.rotor_groups:
54
+ rotor_groups_item = rotor_groups_item_data.to_dict()
55
+ rotor_groups.append(rotor_groups_item)
56
+
57
+ sweep = self.sweep.to_dict()
58
+
59
+ battery_charge_pct = self.battery_charge_pct
60
+
61
+ name: None | str | Unset
62
+ if isinstance(self.name, Unset):
63
+ name = UNSET
64
+ else:
65
+ name = self.name
66
+
67
+ solver = self.solver
68
+
69
+ field_dict: dict[str, Any] = {}
70
+
71
+ field_dict.update(
72
+ {
73
+ "airspeed_m_s": airspeed_m_s,
74
+ "battery_component_id": battery_component_id,
75
+ "density_kg_m3": density_kg_m3,
76
+ "project_id": project_id,
77
+ "rotor_groups": rotor_groups,
78
+ "sweep": sweep,
79
+ }
80
+ )
81
+ if battery_charge_pct is not UNSET:
82
+ field_dict["battery_charge_pct"] = battery_charge_pct
83
+ if name is not UNSET:
84
+ field_dict["name"] = name
85
+ if solver is not UNSET:
86
+ field_dict["solver"] = solver
87
+
88
+ return field_dict
89
+
90
+ @classmethod
91
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
92
+ from thrustlab._models.sweep_config_in import SweepConfigIn
93
+ from thrustlab._models.sweep_rotor_group_in import SweepRotorGroupIn
94
+
95
+ d = dict(src_dict)
96
+ airspeed_m_s = d.pop("airspeed_m_s")
97
+
98
+ battery_component_id = d.pop("battery_component_id")
99
+
100
+ density_kg_m3 = d.pop("density_kg_m3")
101
+
102
+ project_id = d.pop("project_id")
103
+
104
+ rotor_groups = []
105
+ _rotor_groups = d.pop("rotor_groups")
106
+ for rotor_groups_item_data in _rotor_groups:
107
+ rotor_groups_item = SweepRotorGroupIn.from_dict(rotor_groups_item_data)
108
+
109
+ rotor_groups.append(rotor_groups_item)
110
+
111
+ sweep = SweepConfigIn.from_dict(d.pop("sweep"))
112
+
113
+ battery_charge_pct = d.pop("battery_charge_pct", UNSET)
114
+
115
+ def _parse_name(data: object) -> None | str | Unset:
116
+ if data is None:
117
+ return data
118
+ if isinstance(data, Unset):
119
+ return data
120
+ return cast(None | str | Unset, data)
121
+
122
+ name = _parse_name(d.pop("name", UNSET))
123
+
124
+ solver = d.pop("solver", UNSET)
125
+
126
+ sweep_create_body = cls(
127
+ airspeed_m_s=airspeed_m_s,
128
+ battery_component_id=battery_component_id,
129
+ density_kg_m3=density_kg_m3,
130
+ project_id=project_id,
131
+ rotor_groups=rotor_groups,
132
+ sweep=sweep,
133
+ battery_charge_pct=battery_charge_pct,
134
+ name=name,
135
+ solver=solver,
136
+ )
137
+
138
+ return sweep_create_body
@@ -0,0 +1,66 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+
8
+ T = TypeVar("T", bound="SweepInputs")
9
+
10
+
11
+ @_attrs_define
12
+ class SweepInputs:
13
+ """
14
+ Attributes:
15
+ airspeed_m_s (float):
16
+ battery_charge_pct (float):
17
+ density_kg_m3 (float):
18
+ solver (str):
19
+ """
20
+
21
+ airspeed_m_s: float
22
+ battery_charge_pct: float
23
+ density_kg_m3: float
24
+ solver: str
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ airspeed_m_s = self.airspeed_m_s
28
+
29
+ battery_charge_pct = self.battery_charge_pct
30
+
31
+ density_kg_m3 = self.density_kg_m3
32
+
33
+ solver = self.solver
34
+
35
+ field_dict: dict[str, Any] = {}
36
+
37
+ field_dict.update(
38
+ {
39
+ "airspeed_m_s": airspeed_m_s,
40
+ "battery_charge_pct": battery_charge_pct,
41
+ "density_kg_m3": density_kg_m3,
42
+ "solver": solver,
43
+ }
44
+ )
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
50
+ d = dict(src_dict)
51
+ airspeed_m_s = d.pop("airspeed_m_s")
52
+
53
+ battery_charge_pct = d.pop("battery_charge_pct")
54
+
55
+ density_kg_m3 = d.pop("density_kg_m3")
56
+
57
+ solver = d.pop("solver")
58
+
59
+ sweep_inputs = cls(
60
+ airspeed_m_s=airspeed_m_s,
61
+ battery_charge_pct=battery_charge_pct,
62
+ density_kg_m3=density_kg_m3,
63
+ solver=solver,
64
+ )
65
+
66
+ return sweep_inputs
@@ -0,0 +1,88 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+
8
+ if TYPE_CHECKING:
9
+ from thrustlab._models.sweep_resource import SweepResource
10
+
11
+
12
+ T = TypeVar("T", bound="SweepListResponse")
13
+
14
+
15
+ @_attrs_define
16
+ class SweepListResponse:
17
+ """
18
+ Attributes:
19
+ data (list[SweepResource]):
20
+ has_more (bool):
21
+ next_cursor (None | str):
22
+ object_ (Literal['list']):
23
+ """
24
+
25
+ data: list[SweepResource]
26
+ has_more: bool
27
+ next_cursor: None | str
28
+ object_: Literal["list"]
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ data = []
32
+ for data_item_data in self.data:
33
+ data_item = data_item_data.to_dict()
34
+ data.append(data_item)
35
+
36
+ has_more = self.has_more
37
+
38
+ next_cursor: None | str
39
+ next_cursor = self.next_cursor
40
+
41
+ object_ = self.object_
42
+
43
+ field_dict: dict[str, Any] = {}
44
+
45
+ field_dict.update(
46
+ {
47
+ "data": data,
48
+ "has_more": has_more,
49
+ "next_cursor": next_cursor,
50
+ "object": object_,
51
+ }
52
+ )
53
+
54
+ return field_dict
55
+
56
+ @classmethod
57
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
58
+ from thrustlab._models.sweep_resource import SweepResource
59
+
60
+ d = dict(src_dict)
61
+ data = []
62
+ _data = d.pop("data")
63
+ for data_item_data in _data:
64
+ data_item = SweepResource.from_dict(data_item_data)
65
+
66
+ data.append(data_item)
67
+
68
+ has_more = d.pop("has_more")
69
+
70
+ def _parse_next_cursor(data: object) -> None | str:
71
+ if data is None:
72
+ return data
73
+ return cast(None | str, data)
74
+
75
+ next_cursor = _parse_next_cursor(d.pop("next_cursor"))
76
+
77
+ object_ = cast(Literal["list"], d.pop("object"))
78
+ if object_ != "list":
79
+ raise ValueError(f"object must match const 'list', got '{object_}'")
80
+
81
+ sweep_list_response = cls(
82
+ data=data,
83
+ has_more=has_more,
84
+ next_cursor=next_cursor,
85
+ object_=object_,
86
+ )
87
+
88
+ return sweep_list_response
@@ -0,0 +1,136 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+
8
+ from thrustlab._models.sweep_param_range_in_mode import SweepParamRangeInMode
9
+ from thrustlab._models.types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="SweepParamRangeIn")
12
+
13
+
14
+ @_attrs_define
15
+ class SweepParamRangeIn:
16
+ """
17
+ Attributes:
18
+ mode (SweepParamRangeInMode):
19
+ start (float | None | Unset):
20
+ steps (int | None | Unset):
21
+ stop (float | None | Unset):
22
+ values (list[float] | None | Unset):
23
+ """
24
+
25
+ mode: SweepParamRangeInMode
26
+ start: float | None | Unset = UNSET
27
+ steps: int | None | Unset = UNSET
28
+ stop: float | None | Unset = UNSET
29
+ values: list[float] | None | Unset = UNSET
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+ mode = self.mode.value
33
+
34
+ start: float | None | Unset
35
+ if isinstance(self.start, Unset):
36
+ start = UNSET
37
+ else:
38
+ start = self.start
39
+
40
+ steps: int | None | Unset
41
+ if isinstance(self.steps, Unset):
42
+ steps = UNSET
43
+ else:
44
+ steps = self.steps
45
+
46
+ stop: float | None | Unset
47
+ if isinstance(self.stop, Unset):
48
+ stop = UNSET
49
+ else:
50
+ stop = self.stop
51
+
52
+ values: list[float] | None | Unset
53
+ if isinstance(self.values, Unset):
54
+ values = UNSET
55
+ elif isinstance(self.values, list):
56
+ values = self.values
57
+
58
+ else:
59
+ values = self.values
60
+
61
+ field_dict: dict[str, Any] = {}
62
+
63
+ field_dict.update(
64
+ {
65
+ "mode": mode,
66
+ }
67
+ )
68
+ if start is not UNSET:
69
+ field_dict["start"] = start
70
+ if steps is not UNSET:
71
+ field_dict["steps"] = steps
72
+ if stop is not UNSET:
73
+ field_dict["stop"] = stop
74
+ if values is not UNSET:
75
+ field_dict["values"] = values
76
+
77
+ return field_dict
78
+
79
+ @classmethod
80
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
81
+ d = dict(src_dict)
82
+ mode = SweepParamRangeInMode(d.pop("mode"))
83
+
84
+ def _parse_start(data: object) -> float | None | Unset:
85
+ if data is None:
86
+ return data
87
+ if isinstance(data, Unset):
88
+ return data
89
+ return cast(float | None | Unset, data)
90
+
91
+ start = _parse_start(d.pop("start", UNSET))
92
+
93
+ def _parse_steps(data: object) -> int | None | Unset:
94
+ if data is None:
95
+ return data
96
+ if isinstance(data, Unset):
97
+ return data
98
+ return cast(int | None | Unset, data)
99
+
100
+ steps = _parse_steps(d.pop("steps", UNSET))
101
+
102
+ def _parse_stop(data: object) -> float | None | Unset:
103
+ if data is None:
104
+ return data
105
+ if isinstance(data, Unset):
106
+ return data
107
+ return cast(float | None | Unset, data)
108
+
109
+ stop = _parse_stop(d.pop("stop", UNSET))
110
+
111
+ def _parse_values(data: object) -> list[float] | None | Unset:
112
+ if data is None:
113
+ return data
114
+ if isinstance(data, Unset):
115
+ return data
116
+ try:
117
+ if not isinstance(data, list):
118
+ raise TypeError()
119
+ values_type_0 = cast(list[float], data)
120
+
121
+ return values_type_0
122
+ except (TypeError, ValueError, AttributeError, KeyError):
123
+ pass
124
+ return cast(list[float] | None | Unset, data)
125
+
126
+ values = _parse_values(d.pop("values", UNSET))
127
+
128
+ sweep_param_range_in = cls(
129
+ mode=mode,
130
+ start=start,
131
+ steps=steps,
132
+ stop=stop,
133
+ values=values,
134
+ )
135
+
136
+ return sweep_param_range_in
@@ -0,0 +1,9 @@
1
+ from enum import Enum
2
+
3
+
4
+ class SweepParamRangeInMode(str, Enum):
5
+ CUSTOM = "custom"
6
+ RANGE = "range"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)