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.
- thrustlab/__init__.py +23 -0
- thrustlab/_async_polling.py +47 -0
- thrustlab/_http.py +166 -0
- thrustlab/_models/__init__.py +211 -0
- thrustlab/_models/api_key.py +184 -0
- thrustlab/_models/api_key_create.py +74 -0
- thrustlab/_models/api_key_with_secret.py +192 -0
- thrustlab/_models/billing_portal_session_resource.py +74 -0
- thrustlab/_models/checkout_session_resource.py +94 -0
- thrustlab/_models/component_brand.py +80 -0
- thrustlab/_models/component_brands_response.py +108 -0
- thrustlab/_models/component_create_body.py +83 -0
- thrustlab/_models/component_create_body_spec_json.py +46 -0
- thrustlab/_models/component_list_response.py +108 -0
- thrustlab/_models/component_patch.py +111 -0
- thrustlab/_models/component_patch_spec_json_type_0.py +46 -0
- thrustlab/_models/component_resource.py +188 -0
- thrustlab/_models/component_resource_spec_json.py +46 -0
- thrustlab/_models/create_webhook_endpoint_v1_webhook_endpoints_post_response_create_webhook_endpoint_v1_webhook_endpoints_post.py +50 -0
- thrustlab/_models/credit_balance_resource.py +135 -0
- thrustlab/_models/credit_bucket_breakdown.py +92 -0
- thrustlab/_models/credit_bucket_breakdown_type.py +9 -0
- thrustlab/_models/credit_usage_event_resource.py +154 -0
- thrustlab/_models/credit_usage_event_resource_credit_type.py +9 -0
- thrustlab/_models/credit_usage_event_resource_type.py +16 -0
- thrustlab/_models/credit_usage_list_response.py +116 -0
- thrustlab/_models/credit_usage_related_resource.py +71 -0
- thrustlab/_models/credit_usage_related_resource_object.py +9 -0
- 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
- 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
- thrustlab/_models/get_event_v1_events_event_id_get_response_get_event_v1_events_event_id_get.py +46 -0
- thrustlab/_models/get_webhook_endpoint_v1_webhook_endpoints_public_id_get_response_get_webhook_endpoint_v1_webhook_endpoints_public_id_get.py +48 -0
- thrustlab/_models/http_validation_error.py +79 -0
- thrustlab/_models/list_deliveries_v1_webhook_endpoints_public_id_deliveries_get_response_list_deliveries_v1_webhook_endpoints_public_id_deliveries_get.py +49 -0
- thrustlab/_models/list_events_v1_events_get_response_list_events_v1_events_get.py +46 -0
- thrustlab/_models/list_response_api_key.py +116 -0
- thrustlab/_models/list_webhook_endpoints_v1_webhook_endpoints_get_response_list_webhook_endpoints_v1_webhook_endpoints_get.py +46 -0
- thrustlab/_models/patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch_response_patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch.py +49 -0
- thrustlab/_models/portal_session_in.py +42 -0
- thrustlab/_models/project_create_body.py +103 -0
- thrustlab/_models/project_list_response.py +108 -0
- thrustlab/_models/project_patch.py +113 -0
- thrustlab/_models/project_resource.py +127 -0
- 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
- 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
- thrustlab/_models/rotor_group_in.py +107 -0
- thrustlab/_models/rotor_group_resource.py +97 -0
- thrustlab/_models/simulation_cancel_body.py +24 -0
- thrustlab/_models/simulation_create_body.py +128 -0
- thrustlab/_models/simulation_inputs.py +66 -0
- thrustlab/_models/simulation_list_response.py +88 -0
- thrustlab/_models/simulation_patch.py +121 -0
- thrustlab/_models/simulation_patch_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/simulation_resource.py +283 -0
- thrustlab/_models/simulation_resource_error_type_0.py +46 -0
- thrustlab/_models/simulation_resource_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/simulation_resource_result_type_0.py +46 -0
- thrustlab/_models/starred_component_create_body.py +80 -0
- thrustlab/_models/starred_component_list_response.py +108 -0
- thrustlab/_models/starred_component_resource.py +106 -0
- thrustlab/_models/submission_create_body.py +121 -0
- thrustlab/_models/submission_create_body_data_json.py +46 -0
- thrustlab/_models/submission_list_response.py +108 -0
- thrustlab/_models/submission_patch.py +174 -0
- thrustlab/_models/submission_patch_data_json_type_0.py +46 -0
- thrustlab/_models/submission_resource.py +197 -0
- thrustlab/_models/submission_resource_data_json.py +46 -0
- thrustlab/_models/subscription_create.py +58 -0
- thrustlab/_models/subscription_resource.py +168 -0
- thrustlab/_models/subscription_resource_status.py +12 -0
- thrustlab/_models/subscription_resource_tier.py +12 -0
- thrustlab/_models/sweep_cancel_body.py +42 -0
- thrustlab/_models/sweep_config_in.py +172 -0
- thrustlab/_models/sweep_create_body.py +138 -0
- thrustlab/_models/sweep_inputs.py +66 -0
- thrustlab/_models/sweep_list_response.py +88 -0
- thrustlab/_models/sweep_param_range_in.py +136 -0
- thrustlab/_models/sweep_param_range_in_mode.py +9 -0
- thrustlab/_models/sweep_patch.py +121 -0
- thrustlab/_models/sweep_patch_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/sweep_point_list_response.py +88 -0
- thrustlab/_models/sweep_point_resource.py +103 -0
- thrustlab/_models/sweep_point_resource_inputs.py +46 -0
- thrustlab/_models/sweep_point_resource_rotors_type_0.py +46 -0
- thrustlab/_models/sweep_resource.py +327 -0
- thrustlab/_models/sweep_resource_error_type_0.py +46 -0
- thrustlab/_models/sweep_resource_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/sweep_resource_summary_type_0.py +46 -0
- thrustlab/_models/sweep_resource_sweep_config_type_0.py +46 -0
- thrustlab/_models/sweep_rotor_group_in.py +95 -0
- thrustlab/_models/types.py +55 -0
- thrustlab/_models/user_patch.py +73 -0
- thrustlab/_models/user_resource.py +170 -0
- thrustlab/_models/v1_health_v1_health_get_response_v1_health_v1_health_get.py +46 -0
- thrustlab/_models/validation_error.py +90 -0
- thrustlab/_models/webhook_endpoint_create.py +91 -0
- thrustlab/_models/webhook_endpoint_patch.py +144 -0
- thrustlab/_pagination.py +109 -0
- thrustlab/_version.py +3 -0
- thrustlab/client.py +100 -0
- thrustlab/exceptions.py +121 -0
- thrustlab/resources/__init__.py +1 -0
- thrustlab/resources/_base.py +12 -0
- thrustlab/resources/api_keys.py +43 -0
- thrustlab/resources/components.py +60 -0
- thrustlab/resources/credits.py +40 -0
- thrustlab/resources/projects.py +54 -0
- thrustlab/resources/simulations.py +74 -0
- thrustlab/resources/starred_components.py +57 -0
- thrustlab/resources/submissions.py +44 -0
- thrustlab/resources/subscriptions.py +42 -0
- thrustlab/resources/sweeps.py +96 -0
- thrustlab/resources/users.py +13 -0
- thrustlab/resources/webhook_endpoints.py +138 -0
- thrustlab/webhooks.py +121 -0
- thrustlab-0.1.0.dist-info/METADATA +190 -0
- thrustlab-0.1.0.dist-info/RECORD +119 -0
- thrustlab-0.1.0.dist-info/WHEEL +4 -0
- thrustlab-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,128 @@
|
|
|
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.rotor_group_in import RotorGroupIn
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="SimulationCreateBody")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class SimulationCreateBody:
|
|
19
|
+
"""
|
|
20
|
+
Attributes:
|
|
21
|
+
airspeed_m_s (float):
|
|
22
|
+
battery_component_id (str):
|
|
23
|
+
density_kg_m3 (float):
|
|
24
|
+
project_id (str):
|
|
25
|
+
rotor_groups (list[RotorGroupIn]):
|
|
26
|
+
battery_charge_pct (float | Unset): Default: 100.0.
|
|
27
|
+
name (None | str | Unset):
|
|
28
|
+
solver (str | Unset): Default: 'bem'.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
airspeed_m_s: float
|
|
32
|
+
battery_component_id: str
|
|
33
|
+
density_kg_m3: float
|
|
34
|
+
project_id: str
|
|
35
|
+
rotor_groups: list[RotorGroupIn]
|
|
36
|
+
battery_charge_pct: float | Unset = 100.0
|
|
37
|
+
name: None | str | Unset = UNSET
|
|
38
|
+
solver: str | Unset = "bem"
|
|
39
|
+
|
|
40
|
+
def to_dict(self) -> dict[str, Any]:
|
|
41
|
+
airspeed_m_s = self.airspeed_m_s
|
|
42
|
+
|
|
43
|
+
battery_component_id = self.battery_component_id
|
|
44
|
+
|
|
45
|
+
density_kg_m3 = self.density_kg_m3
|
|
46
|
+
|
|
47
|
+
project_id = self.project_id
|
|
48
|
+
|
|
49
|
+
rotor_groups = []
|
|
50
|
+
for rotor_groups_item_data in self.rotor_groups:
|
|
51
|
+
rotor_groups_item = rotor_groups_item_data.to_dict()
|
|
52
|
+
rotor_groups.append(rotor_groups_item)
|
|
53
|
+
|
|
54
|
+
battery_charge_pct = self.battery_charge_pct
|
|
55
|
+
|
|
56
|
+
name: None | str | Unset
|
|
57
|
+
if isinstance(self.name, Unset):
|
|
58
|
+
name = UNSET
|
|
59
|
+
else:
|
|
60
|
+
name = self.name
|
|
61
|
+
|
|
62
|
+
solver = self.solver
|
|
63
|
+
|
|
64
|
+
field_dict: dict[str, Any] = {}
|
|
65
|
+
|
|
66
|
+
field_dict.update(
|
|
67
|
+
{
|
|
68
|
+
"airspeed_m_s": airspeed_m_s,
|
|
69
|
+
"battery_component_id": battery_component_id,
|
|
70
|
+
"density_kg_m3": density_kg_m3,
|
|
71
|
+
"project_id": project_id,
|
|
72
|
+
"rotor_groups": rotor_groups,
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
if battery_charge_pct is not UNSET:
|
|
76
|
+
field_dict["battery_charge_pct"] = battery_charge_pct
|
|
77
|
+
if name is not UNSET:
|
|
78
|
+
field_dict["name"] = name
|
|
79
|
+
if solver is not UNSET:
|
|
80
|
+
field_dict["solver"] = solver
|
|
81
|
+
|
|
82
|
+
return field_dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
86
|
+
from thrustlab._models.rotor_group_in import RotorGroupIn
|
|
87
|
+
|
|
88
|
+
d = dict(src_dict)
|
|
89
|
+
airspeed_m_s = d.pop("airspeed_m_s")
|
|
90
|
+
|
|
91
|
+
battery_component_id = d.pop("battery_component_id")
|
|
92
|
+
|
|
93
|
+
density_kg_m3 = d.pop("density_kg_m3")
|
|
94
|
+
|
|
95
|
+
project_id = d.pop("project_id")
|
|
96
|
+
|
|
97
|
+
rotor_groups = []
|
|
98
|
+
_rotor_groups = d.pop("rotor_groups")
|
|
99
|
+
for rotor_groups_item_data in _rotor_groups:
|
|
100
|
+
rotor_groups_item = RotorGroupIn.from_dict(rotor_groups_item_data)
|
|
101
|
+
|
|
102
|
+
rotor_groups.append(rotor_groups_item)
|
|
103
|
+
|
|
104
|
+
battery_charge_pct = d.pop("battery_charge_pct", UNSET)
|
|
105
|
+
|
|
106
|
+
def _parse_name(data: object) -> None | str | Unset:
|
|
107
|
+
if data is None:
|
|
108
|
+
return data
|
|
109
|
+
if isinstance(data, Unset):
|
|
110
|
+
return data
|
|
111
|
+
return cast(None | str | Unset, data)
|
|
112
|
+
|
|
113
|
+
name = _parse_name(d.pop("name", UNSET))
|
|
114
|
+
|
|
115
|
+
solver = d.pop("solver", UNSET)
|
|
116
|
+
|
|
117
|
+
simulation_create_body = cls(
|
|
118
|
+
airspeed_m_s=airspeed_m_s,
|
|
119
|
+
battery_component_id=battery_component_id,
|
|
120
|
+
density_kg_m3=density_kg_m3,
|
|
121
|
+
project_id=project_id,
|
|
122
|
+
rotor_groups=rotor_groups,
|
|
123
|
+
battery_charge_pct=battery_charge_pct,
|
|
124
|
+
name=name,
|
|
125
|
+
solver=solver,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return simulation_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="SimulationInputs")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class SimulationInputs:
|
|
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
|
+
simulation_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 simulation_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.simulation_resource import SimulationResource
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="SimulationListResponse")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class SimulationListResponse:
|
|
17
|
+
"""
|
|
18
|
+
Attributes:
|
|
19
|
+
data (list[SimulationResource]):
|
|
20
|
+
has_more (bool):
|
|
21
|
+
next_cursor (None | str):
|
|
22
|
+
object_ (Literal['list']):
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
data: list[SimulationResource]
|
|
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.simulation_resource import SimulationResource
|
|
59
|
+
|
|
60
|
+
d = dict(src_dict)
|
|
61
|
+
data = []
|
|
62
|
+
_data = d.pop("data")
|
|
63
|
+
for data_item_data in _data:
|
|
64
|
+
data_item = SimulationResource.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
|
+
simulation_list_response = cls(
|
|
82
|
+
data=data,
|
|
83
|
+
has_more=has_more,
|
|
84
|
+
next_cursor=next_cursor,
|
|
85
|
+
object_=object_,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
return simulation_list_response
|
|
@@ -0,0 +1,121 @@
|
|
|
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.simulation_patch_plot_config_json_type_0_item import SimulationPatchPlotConfigJsonType0Item
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="SimulationPatch")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class SimulationPatch:
|
|
19
|
+
"""
|
|
20
|
+
Attributes:
|
|
21
|
+
is_starred (bool | None | Unset):
|
|
22
|
+
name (None | str | Unset):
|
|
23
|
+
plot_config_json (list[SimulationPatchPlotConfigJsonType0Item] | None | Unset):
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
is_starred: bool | None | Unset = UNSET
|
|
27
|
+
name: None | str | Unset = UNSET
|
|
28
|
+
plot_config_json: list[SimulationPatchPlotConfigJsonType0Item] | None | Unset = UNSET
|
|
29
|
+
|
|
30
|
+
def to_dict(self) -> dict[str, Any]:
|
|
31
|
+
is_starred: bool | None | Unset
|
|
32
|
+
if isinstance(self.is_starred, Unset):
|
|
33
|
+
is_starred = UNSET
|
|
34
|
+
else:
|
|
35
|
+
is_starred = self.is_starred
|
|
36
|
+
|
|
37
|
+
name: None | str | Unset
|
|
38
|
+
if isinstance(self.name, Unset):
|
|
39
|
+
name = UNSET
|
|
40
|
+
else:
|
|
41
|
+
name = self.name
|
|
42
|
+
|
|
43
|
+
plot_config_json: list[dict[str, Any]] | None | Unset
|
|
44
|
+
if isinstance(self.plot_config_json, Unset):
|
|
45
|
+
plot_config_json = UNSET
|
|
46
|
+
elif isinstance(self.plot_config_json, list):
|
|
47
|
+
plot_config_json = []
|
|
48
|
+
for plot_config_json_type_0_item_data in self.plot_config_json:
|
|
49
|
+
plot_config_json_type_0_item = plot_config_json_type_0_item_data.to_dict()
|
|
50
|
+
plot_config_json.append(plot_config_json_type_0_item)
|
|
51
|
+
|
|
52
|
+
else:
|
|
53
|
+
plot_config_json = self.plot_config_json
|
|
54
|
+
|
|
55
|
+
field_dict: dict[str, Any] = {}
|
|
56
|
+
|
|
57
|
+
field_dict.update({})
|
|
58
|
+
if is_starred is not UNSET:
|
|
59
|
+
field_dict["is_starred"] = is_starred
|
|
60
|
+
if name is not UNSET:
|
|
61
|
+
field_dict["name"] = name
|
|
62
|
+
if plot_config_json is not UNSET:
|
|
63
|
+
field_dict["plot_config_json"] = plot_config_json
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
69
|
+
from thrustlab._models.simulation_patch_plot_config_json_type_0_item import SimulationPatchPlotConfigJsonType0Item
|
|
70
|
+
|
|
71
|
+
d = dict(src_dict)
|
|
72
|
+
|
|
73
|
+
def _parse_is_starred(data: object) -> bool | None | Unset:
|
|
74
|
+
if data is None:
|
|
75
|
+
return data
|
|
76
|
+
if isinstance(data, Unset):
|
|
77
|
+
return data
|
|
78
|
+
return cast(bool | None | Unset, data)
|
|
79
|
+
|
|
80
|
+
is_starred = _parse_is_starred(d.pop("is_starred", UNSET))
|
|
81
|
+
|
|
82
|
+
def _parse_name(data: object) -> None | str | Unset:
|
|
83
|
+
if data is None:
|
|
84
|
+
return data
|
|
85
|
+
if isinstance(data, Unset):
|
|
86
|
+
return data
|
|
87
|
+
return cast(None | str | Unset, data)
|
|
88
|
+
|
|
89
|
+
name = _parse_name(d.pop("name", UNSET))
|
|
90
|
+
|
|
91
|
+
def _parse_plot_config_json(data: object) -> list[SimulationPatchPlotConfigJsonType0Item] | None | Unset:
|
|
92
|
+
if data is None:
|
|
93
|
+
return data
|
|
94
|
+
if isinstance(data, Unset):
|
|
95
|
+
return data
|
|
96
|
+
try:
|
|
97
|
+
if not isinstance(data, list):
|
|
98
|
+
raise TypeError()
|
|
99
|
+
plot_config_json_type_0 = []
|
|
100
|
+
_plot_config_json_type_0 = data
|
|
101
|
+
for plot_config_json_type_0_item_data in _plot_config_json_type_0:
|
|
102
|
+
plot_config_json_type_0_item = SimulationPatchPlotConfigJsonType0Item.from_dict(
|
|
103
|
+
plot_config_json_type_0_item_data
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
plot_config_json_type_0.append(plot_config_json_type_0_item)
|
|
107
|
+
|
|
108
|
+
return plot_config_json_type_0
|
|
109
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
110
|
+
pass
|
|
111
|
+
return cast(list[SimulationPatchPlotConfigJsonType0Item] | None | Unset, data)
|
|
112
|
+
|
|
113
|
+
plot_config_json = _parse_plot_config_json(d.pop("plot_config_json", UNSET))
|
|
114
|
+
|
|
115
|
+
simulation_patch = cls(
|
|
116
|
+
is_starred=is_starred,
|
|
117
|
+
name=name,
|
|
118
|
+
plot_config_json=plot_config_json,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return simulation_patch
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="SimulationPatchPlotConfigJsonType0Item")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class SimulationPatchPlotConfigJsonType0Item:
|
|
14
|
+
""" """
|
|
15
|
+
|
|
16
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
17
|
+
|
|
18
|
+
def to_dict(self) -> dict[str, Any]:
|
|
19
|
+
field_dict: dict[str, Any] = {}
|
|
20
|
+
field_dict.update(self.additional_properties)
|
|
21
|
+
|
|
22
|
+
return field_dict
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
26
|
+
d = dict(src_dict)
|
|
27
|
+
simulation_patch_plot_config_json_type_0_item = cls()
|
|
28
|
+
|
|
29
|
+
simulation_patch_plot_config_json_type_0_item.additional_properties = d
|
|
30
|
+
return simulation_patch_plot_config_json_type_0_item
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def additional_keys(self) -> list[str]:
|
|
34
|
+
return list(self.additional_properties.keys())
|
|
35
|
+
|
|
36
|
+
def __getitem__(self, key: str) -> Any:
|
|
37
|
+
return self.additional_properties[key]
|
|
38
|
+
|
|
39
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
40
|
+
self.additional_properties[key] = value
|
|
41
|
+
|
|
42
|
+
def __delitem__(self, key: str) -> None:
|
|
43
|
+
del self.additional_properties[key]
|
|
44
|
+
|
|
45
|
+
def __contains__(self, key: str) -> bool:
|
|
46
|
+
return key in self.additional_properties
|