policyengine-api-simulation-client 0.20260112.78__py3-none-any.whl → 0.20260114.80__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 (64) hide show
  1. policyengine_api_simulation_client/__init__.py +1 -1
  2. policyengine_api_simulation_client/api/default/get_country_versions_versions_country_get.py +172 -0
  3. policyengine_api_simulation_client/api/default/get_job_status_jobs_job_id_get.py +204 -0
  4. policyengine_api_simulation_client/api/default/{started_ping_started_get.py → health_health_get.py} +27 -21
  5. policyengine_api_simulation_client/api/default/{alive_ping_alive_get.py → list_versions_versions_get.py} +27 -29
  6. policyengine_api_simulation_client/api/default/ping_ping_post.py +8 -8
  7. policyengine_api_simulation_client/api/default/{simulate_simulate_economy_comparison_post.py → submit_simulation_simulate_economy_comparison_post.py} +51 -27
  8. policyengine_api_simulation_client/models/__init__.py +17 -103
  9. policyengine_api_simulation_client/models/{baseline_reform_values.py → get_country_versions_versions_country_get_response_get_country_versions_versions_country_get.py} +6 -29
  10. policyengine_api_simulation_client/models/{labor_supply_response_relative_lsr.py → health_health_get_response_health_health_get.py} +5 -5
  11. policyengine_api_simulation_client/models/job_status_response.py +122 -0
  12. policyengine_api_simulation_client/models/{simulation_options_data_type_1.py → job_status_response_result_type_0.py} +5 -5
  13. policyengine_api_simulation_client/models/{program_specific_impact.py → job_submit_response.py} +41 -24
  14. policyengine_api_simulation_client/models/{parameter_change_dict.py → list_versions_versions_get_response_list_versions_versions_get.py} +6 -13
  15. policyengine_api_simulation_client/models/ping_request.py +2 -1
  16. policyengine_api_simulation_client/models/ping_response.py +2 -1
  17. policyengine_api_simulation_client/models/{probe_status.py → simulation_request.py} +24 -31
  18. {policyengine_api_simulation_client-0.20260112.78.dist-info → policyengine_api_simulation_client-0.20260114.80.dist-info}/METADATA +4 -4
  19. policyengine_api_simulation_client-0.20260114.80.dist-info/RECORD +28 -0
  20. policyengine_api_simulation_client/models/age_group_baseline_reform_values.py +0 -91
  21. policyengine_api_simulation_client/models/budgetary_impact.py +0 -101
  22. policyengine_api_simulation_client/models/cliff_impact.py +0 -75
  23. policyengine_api_simulation_client/models/cliff_impact_in_simulation.py +0 -69
  24. policyengine_api_simulation_client/models/decile_impact.py +0 -77
  25. policyengine_api_simulation_client/models/decile_impact_average.py +0 -46
  26. policyengine_api_simulation_client/models/decile_impact_relative.py +0 -46
  27. policyengine_api_simulation_client/models/economy_comparison.py +0 -366
  28. policyengine_api_simulation_client/models/economy_comparison_detailed_budget_type_0.py +0 -59
  29. policyengine_api_simulation_client/models/gender_baseline_reform_values.py +0 -75
  30. policyengine_api_simulation_client/models/health_status.py +0 -83
  31. policyengine_api_simulation_client/models/hours_response.py +0 -93
  32. policyengine_api_simulation_client/models/inequality_impact.py +0 -83
  33. policyengine_api_simulation_client/models/intra_decile_impact.py +0 -77
  34. policyengine_api_simulation_client/models/intra_decile_impact_all.py +0 -46
  35. policyengine_api_simulation_client/models/intra_decile_impact_deciles.py +0 -53
  36. policyengine_api_simulation_client/models/intra_wealth_decile_impact_with_values.py +0 -77
  37. policyengine_api_simulation_client/models/intra_wealth_decile_impact_with_values_all.py +0 -46
  38. policyengine_api_simulation_client/models/intra_wealth_decile_impact_with_values_deciles.py +0 -53
  39. policyengine_api_simulation_client/models/labor_supply_response.py +0 -119
  40. policyengine_api_simulation_client/models/labor_supply_response_decile.py +0 -63
  41. policyengine_api_simulation_client/models/labor_supply_response_decile_additional_property.py +0 -65
  42. policyengine_api_simulation_client/models/labor_supply_response_decile_additional_property_additional_property.py +0 -46
  43. policyengine_api_simulation_client/models/parametric_reform.py +0 -80
  44. policyengine_api_simulation_client/models/poverty_gender_breakdown.py +0 -75
  45. policyengine_api_simulation_client/models/poverty_impact.py +0 -75
  46. policyengine_api_simulation_client/models/poverty_racial_breakdown_with_values.py +0 -67
  47. policyengine_api_simulation_client/models/racial_baseline_reform_values.py +0 -91
  48. policyengine_api_simulation_client/models/simulation_options.py +0 -309
  49. policyengine_api_simulation_client/models/simulation_options_country.py +0 -9
  50. policyengine_api_simulation_client/models/simulation_options_scope.py +0 -9
  51. policyengine_api_simulation_client/models/system_status.py +0 -91
  52. policyengine_api_simulation_client/models/uk_constituency_breakdown_by_constituency.py +0 -85
  53. policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values.py +0 -85
  54. policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values_by_constituency.py +0 -59
  55. policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values_outcomes_by_region.py +0 -67
  56. policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values_outcomes_by_region_additional_property.py +0 -46
  57. policyengine_api_simulation_client/models/uk_local_authority_breakdown_by_local_authority.py +0 -85
  58. policyengine_api_simulation_client/models/uk_local_authority_breakdown_with_values.py +0 -71
  59. policyengine_api_simulation_client/models/uk_local_authority_breakdown_with_values_by_local_authority.py +0 -59
  60. policyengine_api_simulation_client/models/wealth_decile_impact_with_values.py +0 -77
  61. policyengine_api_simulation_client/models/wealth_decile_impact_with_values_average.py +0 -46
  62. policyengine_api_simulation_client/models/wealth_decile_impact_with_values_relative.py +0 -46
  63. policyengine_api_simulation_client-0.20260112.78.dist-info/RECORD +0 -68
  64. {policyengine_api_simulation_client-0.20260112.78.dist-info → policyengine_api_simulation_client-0.20260114.80.dist-info}/WHEEL +0 -0
@@ -1,309 +0,0 @@
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
- from attrs import field as _attrs_field
8
-
9
- from ..models.simulation_options_country import SimulationOptionsCountry
10
- from ..models.simulation_options_scope import SimulationOptionsScope
11
- from ..types import UNSET, Unset
12
-
13
- if TYPE_CHECKING:
14
- from ..models.parametric_reform import ParametricReform
15
- from ..models.simulation_options_data_type_1 import SimulationOptionsDataType1
16
-
17
-
18
- T = TypeVar("T", bound="SimulationOptions")
19
-
20
-
21
- @_attrs_define
22
- class SimulationOptions:
23
- """
24
- Attributes:
25
- country (SimulationOptionsCountry): The country to simulate.
26
- scope (SimulationOptionsScope): The scope of the simulation.
27
- data (Any | None | SimulationOptionsDataType1 | str | Unset): The data to simulate.
28
- time_period (int | Unset): The time period to simulate. Default: 2025.
29
- reform (Any | None | ParametricReform | Unset): The reform to simulate.
30
- baseline (Any | None | ParametricReform | Unset): The baseline to simulate.
31
- region (None | str | Unset): The region to simulate within the country.
32
- subsample (int | None | Unset): How many, if a subsample, households to randomly simulate.
33
- title (None | str | Unset): The title of the analysis (for charts). If not provided, a default title will be
34
- generated. Default: '[Analysis title]'.
35
- include_cliffs (bool | None | Unset): Whether to include tax-benefit cliffs in the simulation analyses. If True,
36
- cliffs will be included. Default: False.
37
- model_version (None | str | Unset): The version of the country model used in the simulation. If not provided,
38
- the current package version will be used. If provided, this package will throw an error if the package version
39
- does not match. Use this as an extra safety check.
40
- data_version (None | str | Unset): The version of the data used in the simulation. If not provided, the current
41
- data version will be used. If provided, this package will throw an error if the data version does not match. Use
42
- this as an extra safety check.
43
- """
44
-
45
- country: SimulationOptionsCountry
46
- scope: SimulationOptionsScope
47
- data: Any | None | SimulationOptionsDataType1 | str | Unset = UNSET
48
- time_period: int | Unset = 2025
49
- reform: Any | None | ParametricReform | Unset = UNSET
50
- baseline: Any | None | ParametricReform | Unset = UNSET
51
- region: None | str | Unset = UNSET
52
- subsample: int | None | Unset = UNSET
53
- title: None | str | Unset = "[Analysis title]"
54
- include_cliffs: bool | None | Unset = False
55
- model_version: None | str | Unset = UNSET
56
- data_version: None | str | Unset = UNSET
57
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
58
-
59
- def to_dict(self) -> dict[str, Any]:
60
- from ..models.parametric_reform import ParametricReform
61
- from ..models.simulation_options_data_type_1 import SimulationOptionsDataType1
62
-
63
- country = self.country.value
64
-
65
- scope = self.scope.value
66
-
67
- data: Any | dict[str, Any] | None | str | Unset
68
- if isinstance(self.data, Unset):
69
- data = UNSET
70
- elif isinstance(self.data, SimulationOptionsDataType1):
71
- data = self.data.to_dict()
72
- else:
73
- data = self.data
74
-
75
- time_period = self.time_period
76
-
77
- reform: Any | dict[str, Any] | None | Unset
78
- if isinstance(self.reform, Unset):
79
- reform = UNSET
80
- elif isinstance(self.reform, ParametricReform):
81
- reform = self.reform.to_dict()
82
- else:
83
- reform = self.reform
84
-
85
- baseline: Any | dict[str, Any] | None | Unset
86
- if isinstance(self.baseline, Unset):
87
- baseline = UNSET
88
- elif isinstance(self.baseline, ParametricReform):
89
- baseline = self.baseline.to_dict()
90
- else:
91
- baseline = self.baseline
92
-
93
- region: None | str | Unset
94
- if isinstance(self.region, Unset):
95
- region = UNSET
96
- else:
97
- region = self.region
98
-
99
- subsample: int | None | Unset
100
- if isinstance(self.subsample, Unset):
101
- subsample = UNSET
102
- else:
103
- subsample = self.subsample
104
-
105
- title: None | str | Unset
106
- if isinstance(self.title, Unset):
107
- title = UNSET
108
- else:
109
- title = self.title
110
-
111
- include_cliffs: bool | None | Unset
112
- if isinstance(self.include_cliffs, Unset):
113
- include_cliffs = UNSET
114
- else:
115
- include_cliffs = self.include_cliffs
116
-
117
- model_version: None | str | Unset
118
- if isinstance(self.model_version, Unset):
119
- model_version = UNSET
120
- else:
121
- model_version = self.model_version
122
-
123
- data_version: None | str | Unset
124
- if isinstance(self.data_version, Unset):
125
- data_version = UNSET
126
- else:
127
- data_version = self.data_version
128
-
129
- field_dict: dict[str, Any] = {}
130
- field_dict.update(self.additional_properties)
131
- field_dict.update(
132
- {
133
- "country": country,
134
- "scope": scope,
135
- }
136
- )
137
- if data is not UNSET:
138
- field_dict["data"] = data
139
- if time_period is not UNSET:
140
- field_dict["time_period"] = time_period
141
- if reform is not UNSET:
142
- field_dict["reform"] = reform
143
- if baseline is not UNSET:
144
- field_dict["baseline"] = baseline
145
- if region is not UNSET:
146
- field_dict["region"] = region
147
- if subsample is not UNSET:
148
- field_dict["subsample"] = subsample
149
- if title is not UNSET:
150
- field_dict["title"] = title
151
- if include_cliffs is not UNSET:
152
- field_dict["include_cliffs"] = include_cliffs
153
- if model_version is not UNSET:
154
- field_dict["model_version"] = model_version
155
- if data_version is not UNSET:
156
- field_dict["data_version"] = data_version
157
-
158
- return field_dict
159
-
160
- @classmethod
161
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
162
- from ..models.parametric_reform import ParametricReform
163
- from ..models.simulation_options_data_type_1 import SimulationOptionsDataType1
164
-
165
- d = dict(src_dict)
166
- country = SimulationOptionsCountry(d.pop("country"))
167
-
168
- scope = SimulationOptionsScope(d.pop("scope"))
169
-
170
- def _parse_data(data: object) -> Any | None | SimulationOptionsDataType1 | str | Unset:
171
- if data is None:
172
- return data
173
- if isinstance(data, Unset):
174
- return data
175
- try:
176
- if not isinstance(data, dict):
177
- raise TypeError()
178
- data_type_1 = SimulationOptionsDataType1.from_dict(data)
179
-
180
- return data_type_1
181
- except (TypeError, ValueError, AttributeError, KeyError):
182
- pass
183
- return cast(Any | None | SimulationOptionsDataType1 | str | Unset, data)
184
-
185
- data = _parse_data(d.pop("data", UNSET))
186
-
187
- time_period = d.pop("time_period", UNSET)
188
-
189
- def _parse_reform(data: object) -> Any | None | ParametricReform | Unset:
190
- if data is None:
191
- return data
192
- if isinstance(data, Unset):
193
- return data
194
- try:
195
- if not isinstance(data, dict):
196
- raise TypeError()
197
- reform_type_0 = ParametricReform.from_dict(data)
198
-
199
- return reform_type_0
200
- except (TypeError, ValueError, AttributeError, KeyError):
201
- pass
202
- return cast(Any | None | ParametricReform | Unset, data)
203
-
204
- reform = _parse_reform(d.pop("reform", UNSET))
205
-
206
- def _parse_baseline(data: object) -> Any | None | ParametricReform | Unset:
207
- if data is None:
208
- return data
209
- if isinstance(data, Unset):
210
- return data
211
- try:
212
- if not isinstance(data, dict):
213
- raise TypeError()
214
- baseline_type_0 = ParametricReform.from_dict(data)
215
-
216
- return baseline_type_0
217
- except (TypeError, ValueError, AttributeError, KeyError):
218
- pass
219
- return cast(Any | None | ParametricReform | Unset, data)
220
-
221
- baseline = _parse_baseline(d.pop("baseline", UNSET))
222
-
223
- def _parse_region(data: object) -> None | str | Unset:
224
- if data is None:
225
- return data
226
- if isinstance(data, Unset):
227
- return data
228
- return cast(None | str | Unset, data)
229
-
230
- region = _parse_region(d.pop("region", UNSET))
231
-
232
- def _parse_subsample(data: object) -> int | None | Unset:
233
- if data is None:
234
- return data
235
- if isinstance(data, Unset):
236
- return data
237
- return cast(int | None | Unset, data)
238
-
239
- subsample = _parse_subsample(d.pop("subsample", UNSET))
240
-
241
- def _parse_title(data: object) -> None | str | Unset:
242
- if data is None:
243
- return data
244
- if isinstance(data, Unset):
245
- return data
246
- return cast(None | str | Unset, data)
247
-
248
- title = _parse_title(d.pop("title", UNSET))
249
-
250
- def _parse_include_cliffs(data: object) -> bool | None | Unset:
251
- if data is None:
252
- return data
253
- if isinstance(data, Unset):
254
- return data
255
- return cast(bool | None | Unset, data)
256
-
257
- include_cliffs = _parse_include_cliffs(d.pop("include_cliffs", UNSET))
258
-
259
- def _parse_model_version(data: object) -> None | str | Unset:
260
- if data is None:
261
- return data
262
- if isinstance(data, Unset):
263
- return data
264
- return cast(None | str | Unset, data)
265
-
266
- model_version = _parse_model_version(d.pop("model_version", UNSET))
267
-
268
- def _parse_data_version(data: object) -> None | str | Unset:
269
- if data is None:
270
- return data
271
- if isinstance(data, Unset):
272
- return data
273
- return cast(None | str | Unset, data)
274
-
275
- data_version = _parse_data_version(d.pop("data_version", UNSET))
276
-
277
- simulation_options = cls(
278
- country=country,
279
- scope=scope,
280
- data=data,
281
- time_period=time_period,
282
- reform=reform,
283
- baseline=baseline,
284
- region=region,
285
- subsample=subsample,
286
- title=title,
287
- include_cliffs=include_cliffs,
288
- model_version=model_version,
289
- data_version=data_version,
290
- )
291
-
292
- simulation_options.additional_properties = d
293
- return simulation_options
294
-
295
- @property
296
- def additional_keys(self) -> list[str]:
297
- return list(self.additional_properties.keys())
298
-
299
- def __getitem__(self, key: str) -> Any:
300
- return self.additional_properties[key]
301
-
302
- def __setitem__(self, key: str, value: Any) -> None:
303
- self.additional_properties[key] = value
304
-
305
- def __delitem__(self, key: str) -> None:
306
- del self.additional_properties[key]
307
-
308
- def __contains__(self, key: str) -> bool:
309
- return key in self.additional_properties
@@ -1,9 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class SimulationOptionsCountry(str, Enum):
5
- UK = "uk"
6
- US = "us"
7
-
8
- def __str__(self) -> str:
9
- return str(self.value)
@@ -1,9 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class SimulationOptionsScope(str, Enum):
5
- HOUSEHOLD = "household"
6
- MACRO = "macro"
7
-
8
- def __str__(self) -> str:
9
- return str(self.value)
@@ -1,91 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from collections.abc import Mapping
4
- from typing import TYPE_CHECKING, Any, TypeVar
5
-
6
- from attrs import define as _attrs_define
7
- from attrs import field as _attrs_field
8
-
9
- if TYPE_CHECKING:
10
- from ..models.probe_status import ProbeStatus
11
-
12
-
13
- T = TypeVar("T", bound="SystemStatus")
14
-
15
-
16
- @_attrs_define
17
- class SystemStatus:
18
- """
19
- Attributes:
20
- name (str):
21
- healthy (bool):
22
- detail (list[ProbeStatus]):
23
- """
24
-
25
- name: str
26
- healthy: bool
27
- detail: list[ProbeStatus]
28
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
-
30
- def to_dict(self) -> dict[str, Any]:
31
- name = self.name
32
-
33
- healthy = self.healthy
34
-
35
- detail = []
36
- for detail_item_data in self.detail:
37
- detail_item = detail_item_data.to_dict()
38
- detail.append(detail_item)
39
-
40
- field_dict: dict[str, Any] = {}
41
- field_dict.update(self.additional_properties)
42
- field_dict.update(
43
- {
44
- "name": name,
45
- "healthy": healthy,
46
- "detail": detail,
47
- }
48
- )
49
-
50
- return field_dict
51
-
52
- @classmethod
53
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
54
- from ..models.probe_status import ProbeStatus
55
-
56
- d = dict(src_dict)
57
- name = d.pop("name")
58
-
59
- healthy = d.pop("healthy")
60
-
61
- detail = []
62
- _detail = d.pop("detail")
63
- for detail_item_data in _detail:
64
- detail_item = ProbeStatus.from_dict(detail_item_data)
65
-
66
- detail.append(detail_item)
67
-
68
- system_status = cls(
69
- name=name,
70
- healthy=healthy,
71
- detail=detail,
72
- )
73
-
74
- system_status.additional_properties = d
75
- return system_status
76
-
77
- @property
78
- def additional_keys(self) -> list[str]:
79
- return list(self.additional_properties.keys())
80
-
81
- def __getitem__(self, key: str) -> Any:
82
- return self.additional_properties[key]
83
-
84
- def __setitem__(self, key: str, value: Any) -> None:
85
- self.additional_properties[key] = value
86
-
87
- def __delitem__(self, key: str) -> None:
88
- del self.additional_properties[key]
89
-
90
- def __contains__(self, key: str) -> bool:
91
- return key in self.additional_properties
@@ -1,85 +0,0 @@
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="UKConstituencyBreakdownByConstituency")
10
-
11
-
12
- @_attrs_define
13
- class UKConstituencyBreakdownByConstituency:
14
- """
15
- Attributes:
16
- average_household_income_change (float):
17
- relative_household_income_change (float):
18
- x (int):
19
- y (int):
20
- """
21
-
22
- average_household_income_change: float
23
- relative_household_income_change: float
24
- x: int
25
- y: int
26
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
-
28
- def to_dict(self) -> dict[str, Any]:
29
- average_household_income_change = self.average_household_income_change
30
-
31
- relative_household_income_change = self.relative_household_income_change
32
-
33
- x = self.x
34
-
35
- y = self.y
36
-
37
- field_dict: dict[str, Any] = {}
38
- field_dict.update(self.additional_properties)
39
- field_dict.update(
40
- {
41
- "average_household_income_change": average_household_income_change,
42
- "relative_household_income_change": relative_household_income_change,
43
- "x": x,
44
- "y": y,
45
- }
46
- )
47
-
48
- return field_dict
49
-
50
- @classmethod
51
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
52
- d = dict(src_dict)
53
- average_household_income_change = d.pop("average_household_income_change")
54
-
55
- relative_household_income_change = d.pop("relative_household_income_change")
56
-
57
- x = d.pop("x")
58
-
59
- y = d.pop("y")
60
-
61
- uk_constituency_breakdown_by_constituency = cls(
62
- average_household_income_change=average_household_income_change,
63
- relative_household_income_change=relative_household_income_change,
64
- x=x,
65
- y=y,
66
- )
67
-
68
- uk_constituency_breakdown_by_constituency.additional_properties = d
69
- return uk_constituency_breakdown_by_constituency
70
-
71
- @property
72
- def additional_keys(self) -> list[str]:
73
- return list(self.additional_properties.keys())
74
-
75
- def __getitem__(self, key: str) -> Any:
76
- return self.additional_properties[key]
77
-
78
- def __setitem__(self, key: str, value: Any) -> None:
79
- self.additional_properties[key] = value
80
-
81
- def __delitem__(self, key: str) -> None:
82
- del self.additional_properties[key]
83
-
84
- def __contains__(self, key: str) -> bool:
85
- return key in self.additional_properties
@@ -1,85 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from collections.abc import Mapping
4
- from typing import TYPE_CHECKING, Any, TypeVar
5
-
6
- from attrs import define as _attrs_define
7
- from attrs import field as _attrs_field
8
-
9
- if TYPE_CHECKING:
10
- from ..models.uk_constituency_breakdown_with_values_by_constituency import (
11
- UKConstituencyBreakdownWithValuesByConstituency,
12
- )
13
- from ..models.uk_constituency_breakdown_with_values_outcomes_by_region import (
14
- UKConstituencyBreakdownWithValuesOutcomesByRegion,
15
- )
16
-
17
-
18
- T = TypeVar("T", bound="UKConstituencyBreakdownWithValues")
19
-
20
-
21
- @_attrs_define
22
- class UKConstituencyBreakdownWithValues:
23
- """
24
- Attributes:
25
- by_constituency (UKConstituencyBreakdownWithValuesByConstituency):
26
- outcomes_by_region (UKConstituencyBreakdownWithValuesOutcomesByRegion):
27
- """
28
-
29
- by_constituency: UKConstituencyBreakdownWithValuesByConstituency
30
- outcomes_by_region: UKConstituencyBreakdownWithValuesOutcomesByRegion
31
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
32
-
33
- def to_dict(self) -> dict[str, Any]:
34
- by_constituency = self.by_constituency.to_dict()
35
-
36
- outcomes_by_region = self.outcomes_by_region.to_dict()
37
-
38
- field_dict: dict[str, Any] = {}
39
- field_dict.update(self.additional_properties)
40
- field_dict.update(
41
- {
42
- "by_constituency": by_constituency,
43
- "outcomes_by_region": outcomes_by_region,
44
- }
45
- )
46
-
47
- return field_dict
48
-
49
- @classmethod
50
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
- from ..models.uk_constituency_breakdown_with_values_by_constituency import (
52
- UKConstituencyBreakdownWithValuesByConstituency,
53
- )
54
- from ..models.uk_constituency_breakdown_with_values_outcomes_by_region import (
55
- UKConstituencyBreakdownWithValuesOutcomesByRegion,
56
- )
57
-
58
- d = dict(src_dict)
59
- by_constituency = UKConstituencyBreakdownWithValuesByConstituency.from_dict(d.pop("by_constituency"))
60
-
61
- outcomes_by_region = UKConstituencyBreakdownWithValuesOutcomesByRegion.from_dict(d.pop("outcomes_by_region"))
62
-
63
- uk_constituency_breakdown_with_values = cls(
64
- by_constituency=by_constituency,
65
- outcomes_by_region=outcomes_by_region,
66
- )
67
-
68
- uk_constituency_breakdown_with_values.additional_properties = d
69
- return uk_constituency_breakdown_with_values
70
-
71
- @property
72
- def additional_keys(self) -> list[str]:
73
- return list(self.additional_properties.keys())
74
-
75
- def __getitem__(self, key: str) -> Any:
76
- return self.additional_properties[key]
77
-
78
- def __setitem__(self, key: str, value: Any) -> None:
79
- self.additional_properties[key] = value
80
-
81
- def __delitem__(self, key: str) -> None:
82
- del self.additional_properties[key]
83
-
84
- def __contains__(self, key: str) -> bool:
85
- return key in self.additional_properties
@@ -1,59 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from collections.abc import Mapping
4
- from typing import TYPE_CHECKING, Any, TypeVar
5
-
6
- from attrs import define as _attrs_define
7
- from attrs import field as _attrs_field
8
-
9
- if TYPE_CHECKING:
10
- from ..models.uk_constituency_breakdown_by_constituency import UKConstituencyBreakdownByConstituency
11
-
12
-
13
- T = TypeVar("T", bound="UKConstituencyBreakdownWithValuesByConstituency")
14
-
15
-
16
- @_attrs_define
17
- class UKConstituencyBreakdownWithValuesByConstituency:
18
- """ """
19
-
20
- additional_properties: dict[str, UKConstituencyBreakdownByConstituency] = _attrs_field(init=False, factory=dict)
21
-
22
- def to_dict(self) -> dict[str, Any]:
23
- field_dict: dict[str, Any] = {}
24
- for prop_name, prop in self.additional_properties.items():
25
- field_dict[prop_name] = prop.to_dict()
26
-
27
- return field_dict
28
-
29
- @classmethod
30
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
31
- from ..models.uk_constituency_breakdown_by_constituency import UKConstituencyBreakdownByConstituency
32
-
33
- d = dict(src_dict)
34
- uk_constituency_breakdown_with_values_by_constituency = cls()
35
-
36
- additional_properties = {}
37
- for prop_name, prop_dict in d.items():
38
- additional_property = UKConstituencyBreakdownByConstituency.from_dict(prop_dict)
39
-
40
- additional_properties[prop_name] = additional_property
41
-
42
- uk_constituency_breakdown_with_values_by_constituency.additional_properties = additional_properties
43
- return uk_constituency_breakdown_with_values_by_constituency
44
-
45
- @property
46
- def additional_keys(self) -> list[str]:
47
- return list(self.additional_properties.keys())
48
-
49
- def __getitem__(self, key: str) -> UKConstituencyBreakdownByConstituency:
50
- return self.additional_properties[key]
51
-
52
- def __setitem__(self, key: str, value: UKConstituencyBreakdownByConstituency) -> None:
53
- self.additional_properties[key] = value
54
-
55
- def __delitem__(self, key: str) -> None:
56
- del self.additional_properties[key]
57
-
58
- def __contains__(self, key: str) -> bool:
59
- return key in self.additional_properties