policyengine-api-simulation-client 0.20251216.73__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.
- policyengine_api_simulation_client/__init__.py +8 -0
- policyengine_api_simulation_client/api/__init__.py +1 -0
- policyengine_api_simulation_client/api/default/__init__.py +1 -0
- policyengine_api_simulation_client/api/default/alive_ping_alive_get.py +139 -0
- policyengine_api_simulation_client/api/default/ping_ping_post.py +174 -0
- policyengine_api_simulation_client/api/default/simulate_simulate_economy_comparison_post.py +166 -0
- policyengine_api_simulation_client/api/default/started_ping_started_get.py +129 -0
- policyengine_api_simulation_client/client.py +268 -0
- policyengine_api_simulation_client/errors.py +16 -0
- policyengine_api_simulation_client/models/__init__.py +117 -0
- policyengine_api_simulation_client/models/age_group_baseline_reform_values.py +91 -0
- policyengine_api_simulation_client/models/baseline_reform_values.py +69 -0
- policyengine_api_simulation_client/models/budgetary_impact.py +101 -0
- policyengine_api_simulation_client/models/cliff_impact.py +75 -0
- policyengine_api_simulation_client/models/cliff_impact_in_simulation.py +69 -0
- policyengine_api_simulation_client/models/decile_impact.py +77 -0
- policyengine_api_simulation_client/models/decile_impact_average.py +46 -0
- policyengine_api_simulation_client/models/decile_impact_relative.py +46 -0
- policyengine_api_simulation_client/models/economy_comparison.py +366 -0
- policyengine_api_simulation_client/models/economy_comparison_detailed_budget_type_0.py +59 -0
- policyengine_api_simulation_client/models/gender_baseline_reform_values.py +75 -0
- policyengine_api_simulation_client/models/health_status.py +83 -0
- policyengine_api_simulation_client/models/hours_response.py +93 -0
- policyengine_api_simulation_client/models/http_validation_error.py +79 -0
- policyengine_api_simulation_client/models/inequality_impact.py +83 -0
- policyengine_api_simulation_client/models/intra_decile_impact.py +77 -0
- policyengine_api_simulation_client/models/intra_decile_impact_all.py +46 -0
- policyengine_api_simulation_client/models/intra_decile_impact_deciles.py +53 -0
- policyengine_api_simulation_client/models/intra_wealth_decile_impact_with_values.py +77 -0
- policyengine_api_simulation_client/models/intra_wealth_decile_impact_with_values_all.py +46 -0
- policyengine_api_simulation_client/models/intra_wealth_decile_impact_with_values_deciles.py +53 -0
- policyengine_api_simulation_client/models/labor_supply_response.py +119 -0
- policyengine_api_simulation_client/models/labor_supply_response_decile.py +63 -0
- policyengine_api_simulation_client/models/labor_supply_response_decile_additional_property.py +65 -0
- policyengine_api_simulation_client/models/labor_supply_response_decile_additional_property_additional_property.py +46 -0
- policyengine_api_simulation_client/models/labor_supply_response_relative_lsr.py +46 -0
- policyengine_api_simulation_client/models/parameter_change_dict.py +53 -0
- policyengine_api_simulation_client/models/parametric_reform.py +80 -0
- policyengine_api_simulation_client/models/ping_request.py +61 -0
- policyengine_api_simulation_client/models/ping_response.py +61 -0
- policyengine_api_simulation_client/models/poverty_gender_breakdown.py +75 -0
- policyengine_api_simulation_client/models/poverty_impact.py +75 -0
- policyengine_api_simulation_client/models/poverty_racial_breakdown_with_values.py +67 -0
- policyengine_api_simulation_client/models/probe_status.py +91 -0
- policyengine_api_simulation_client/models/program_specific_impact.py +77 -0
- policyengine_api_simulation_client/models/racial_baseline_reform_values.py +91 -0
- policyengine_api_simulation_client/models/simulation_options.py +309 -0
- policyengine_api_simulation_client/models/simulation_options_country.py +9 -0
- policyengine_api_simulation_client/models/simulation_options_data_type_1.py +46 -0
- policyengine_api_simulation_client/models/simulation_options_scope.py +9 -0
- policyengine_api_simulation_client/models/system_status.py +91 -0
- policyengine_api_simulation_client/models/uk_constituency_breakdown_by_constituency.py +85 -0
- policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values.py +85 -0
- policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values_by_constituency.py +59 -0
- policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values_outcomes_by_region.py +67 -0
- policyengine_api_simulation_client/models/uk_constituency_breakdown_with_values_outcomes_by_region_additional_property.py +46 -0
- policyengine_api_simulation_client/models/uk_local_authority_breakdown_by_local_authority.py +85 -0
- policyengine_api_simulation_client/models/uk_local_authority_breakdown_with_values.py +71 -0
- policyengine_api_simulation_client/models/uk_local_authority_breakdown_with_values_by_local_authority.py +59 -0
- policyengine_api_simulation_client/models/validation_error.py +90 -0
- policyengine_api_simulation_client/models/wealth_decile_impact_with_values.py +77 -0
- policyengine_api_simulation_client/models/wealth_decile_impact_with_values_average.py +46 -0
- policyengine_api_simulation_client/models/wealth_decile_impact_with_values_relative.py +46 -0
- policyengine_api_simulation_client/py.typed +1 -0
- policyengine_api_simulation_client/types.py +54 -0
- policyengine_api_simulation_client-0.20251216.73.dist-info/METADATA +141 -0
- policyengine_api_simulation_client-0.20251216.73.dist-info/RECORD +68 -0
- policyengine_api_simulation_client-0.20251216.73.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import ssl
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from attrs import define, evolve, field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@define
|
|
9
|
+
class Client:
|
|
10
|
+
"""A class for keeping track of data related to the API
|
|
11
|
+
|
|
12
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
13
|
+
|
|
14
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
15
|
+
|
|
16
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
17
|
+
|
|
18
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
19
|
+
|
|
20
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
21
|
+
httpx.TimeoutException if this is exceeded.
|
|
22
|
+
|
|
23
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
24
|
+
but can be set to False for testing purposes.
|
|
25
|
+
|
|
26
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
27
|
+
|
|
28
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Attributes:
|
|
32
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
33
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
34
|
+
argument to the constructor.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
38
|
+
_base_url: str = field(alias="base_url")
|
|
39
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
40
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
41
|
+
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
|
42
|
+
_verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl")
|
|
43
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
44
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
45
|
+
_client: httpx.Client | None = field(default=None, init=False)
|
|
46
|
+
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
|
47
|
+
|
|
48
|
+
def with_headers(self, headers: dict[str, str]) -> "Client":
|
|
49
|
+
"""Get a new client matching this one with additional headers"""
|
|
50
|
+
if self._client is not None:
|
|
51
|
+
self._client.headers.update(headers)
|
|
52
|
+
if self._async_client is not None:
|
|
53
|
+
self._async_client.headers.update(headers)
|
|
54
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
55
|
+
|
|
56
|
+
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
|
57
|
+
"""Get a new client matching this one with additional cookies"""
|
|
58
|
+
if self._client is not None:
|
|
59
|
+
self._client.cookies.update(cookies)
|
|
60
|
+
if self._async_client is not None:
|
|
61
|
+
self._async_client.cookies.update(cookies)
|
|
62
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
63
|
+
|
|
64
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
|
65
|
+
"""Get a new client matching this one with a new timeout configuration"""
|
|
66
|
+
if self._client is not None:
|
|
67
|
+
self._client.timeout = timeout
|
|
68
|
+
if self._async_client is not None:
|
|
69
|
+
self._async_client.timeout = timeout
|
|
70
|
+
return evolve(self, timeout=timeout)
|
|
71
|
+
|
|
72
|
+
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
|
73
|
+
"""Manually set the underlying httpx.Client
|
|
74
|
+
|
|
75
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
76
|
+
"""
|
|
77
|
+
self._client = client
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
81
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
82
|
+
if self._client is None:
|
|
83
|
+
self._client = httpx.Client(
|
|
84
|
+
base_url=self._base_url,
|
|
85
|
+
cookies=self._cookies,
|
|
86
|
+
headers=self._headers,
|
|
87
|
+
timeout=self._timeout,
|
|
88
|
+
verify=self._verify_ssl,
|
|
89
|
+
follow_redirects=self._follow_redirects,
|
|
90
|
+
**self._httpx_args,
|
|
91
|
+
)
|
|
92
|
+
return self._client
|
|
93
|
+
|
|
94
|
+
def __enter__(self) -> "Client":
|
|
95
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
96
|
+
self.get_httpx_client().__enter__()
|
|
97
|
+
return self
|
|
98
|
+
|
|
99
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
100
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
101
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
102
|
+
|
|
103
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
|
104
|
+
"""Manually set the underlying httpx.AsyncClient
|
|
105
|
+
|
|
106
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
107
|
+
"""
|
|
108
|
+
self._async_client = async_client
|
|
109
|
+
return self
|
|
110
|
+
|
|
111
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
112
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
113
|
+
if self._async_client is None:
|
|
114
|
+
self._async_client = httpx.AsyncClient(
|
|
115
|
+
base_url=self._base_url,
|
|
116
|
+
cookies=self._cookies,
|
|
117
|
+
headers=self._headers,
|
|
118
|
+
timeout=self._timeout,
|
|
119
|
+
verify=self._verify_ssl,
|
|
120
|
+
follow_redirects=self._follow_redirects,
|
|
121
|
+
**self._httpx_args,
|
|
122
|
+
)
|
|
123
|
+
return self._async_client
|
|
124
|
+
|
|
125
|
+
async def __aenter__(self) -> "Client":
|
|
126
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
127
|
+
await self.get_async_httpx_client().__aenter__()
|
|
128
|
+
return self
|
|
129
|
+
|
|
130
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
131
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
132
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@define
|
|
136
|
+
class AuthenticatedClient:
|
|
137
|
+
"""A Client which has been authenticated for use on secured endpoints
|
|
138
|
+
|
|
139
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
140
|
+
|
|
141
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
142
|
+
|
|
143
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
144
|
+
|
|
145
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
146
|
+
|
|
147
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
148
|
+
httpx.TimeoutException if this is exceeded.
|
|
149
|
+
|
|
150
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
151
|
+
but can be set to False for testing purposes.
|
|
152
|
+
|
|
153
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
154
|
+
|
|
155
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Attributes:
|
|
159
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
160
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
161
|
+
argument to the constructor.
|
|
162
|
+
token: The token to use for authentication
|
|
163
|
+
prefix: The prefix to use for the Authorization header
|
|
164
|
+
auth_header_name: The name of the Authorization header
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
168
|
+
_base_url: str = field(alias="base_url")
|
|
169
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
170
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
171
|
+
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
|
172
|
+
_verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl")
|
|
173
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
174
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
175
|
+
_client: httpx.Client | None = field(default=None, init=False)
|
|
176
|
+
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
|
177
|
+
|
|
178
|
+
token: str
|
|
179
|
+
prefix: str = "Bearer"
|
|
180
|
+
auth_header_name: str = "Authorization"
|
|
181
|
+
|
|
182
|
+
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
|
183
|
+
"""Get a new client matching this one with additional headers"""
|
|
184
|
+
if self._client is not None:
|
|
185
|
+
self._client.headers.update(headers)
|
|
186
|
+
if self._async_client is not None:
|
|
187
|
+
self._async_client.headers.update(headers)
|
|
188
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
189
|
+
|
|
190
|
+
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
|
191
|
+
"""Get a new client matching this one with additional cookies"""
|
|
192
|
+
if self._client is not None:
|
|
193
|
+
self._client.cookies.update(cookies)
|
|
194
|
+
if self._async_client is not None:
|
|
195
|
+
self._async_client.cookies.update(cookies)
|
|
196
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
197
|
+
|
|
198
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
|
199
|
+
"""Get a new client matching this one with a new timeout configuration"""
|
|
200
|
+
if self._client is not None:
|
|
201
|
+
self._client.timeout = timeout
|
|
202
|
+
if self._async_client is not None:
|
|
203
|
+
self._async_client.timeout = timeout
|
|
204
|
+
return evolve(self, timeout=timeout)
|
|
205
|
+
|
|
206
|
+
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
|
207
|
+
"""Manually set the underlying httpx.Client
|
|
208
|
+
|
|
209
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
210
|
+
"""
|
|
211
|
+
self._client = client
|
|
212
|
+
return self
|
|
213
|
+
|
|
214
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
215
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
216
|
+
if self._client is None:
|
|
217
|
+
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
218
|
+
self._client = httpx.Client(
|
|
219
|
+
base_url=self._base_url,
|
|
220
|
+
cookies=self._cookies,
|
|
221
|
+
headers=self._headers,
|
|
222
|
+
timeout=self._timeout,
|
|
223
|
+
verify=self._verify_ssl,
|
|
224
|
+
follow_redirects=self._follow_redirects,
|
|
225
|
+
**self._httpx_args,
|
|
226
|
+
)
|
|
227
|
+
return self._client
|
|
228
|
+
|
|
229
|
+
def __enter__(self) -> "AuthenticatedClient":
|
|
230
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
231
|
+
self.get_httpx_client().__enter__()
|
|
232
|
+
return self
|
|
233
|
+
|
|
234
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
235
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
236
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
237
|
+
|
|
238
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
|
239
|
+
"""Manually set the underlying httpx.AsyncClient
|
|
240
|
+
|
|
241
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
242
|
+
"""
|
|
243
|
+
self._async_client = async_client
|
|
244
|
+
return self
|
|
245
|
+
|
|
246
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
247
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
248
|
+
if self._async_client is None:
|
|
249
|
+
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
250
|
+
self._async_client = httpx.AsyncClient(
|
|
251
|
+
base_url=self._base_url,
|
|
252
|
+
cookies=self._cookies,
|
|
253
|
+
headers=self._headers,
|
|
254
|
+
timeout=self._timeout,
|
|
255
|
+
verify=self._verify_ssl,
|
|
256
|
+
follow_redirects=self._follow_redirects,
|
|
257
|
+
**self._httpx_args,
|
|
258
|
+
)
|
|
259
|
+
return self._async_client
|
|
260
|
+
|
|
261
|
+
async def __aenter__(self) -> "AuthenticatedClient":
|
|
262
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
263
|
+
await self.get_async_httpx_client().__aenter__()
|
|
264
|
+
return self
|
|
265
|
+
|
|
266
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
267
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
268
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Contains shared errors types that can be raised from API functions"""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class UnexpectedStatus(Exception):
|
|
5
|
+
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
|
6
|
+
|
|
7
|
+
def __init__(self, status_code: int, content: bytes):
|
|
8
|
+
self.status_code = status_code
|
|
9
|
+
self.content = content
|
|
10
|
+
|
|
11
|
+
super().__init__(
|
|
12
|
+
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = ["UnexpectedStatus"]
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""Contains all the data models used in inputs/outputs"""
|
|
2
|
+
|
|
3
|
+
from .age_group_baseline_reform_values import AgeGroupBaselineReformValues
|
|
4
|
+
from .baseline_reform_values import BaselineReformValues
|
|
5
|
+
from .budgetary_impact import BudgetaryImpact
|
|
6
|
+
from .cliff_impact import CliffImpact
|
|
7
|
+
from .cliff_impact_in_simulation import CliffImpactInSimulation
|
|
8
|
+
from .decile_impact import DecileImpact
|
|
9
|
+
from .decile_impact_average import DecileImpactAverage
|
|
10
|
+
from .decile_impact_relative import DecileImpactRelative
|
|
11
|
+
from .economy_comparison import EconomyComparison
|
|
12
|
+
from .economy_comparison_detailed_budget_type_0 import EconomyComparisonDetailedBudgetType0
|
|
13
|
+
from .gender_baseline_reform_values import GenderBaselineReformValues
|
|
14
|
+
from .health_status import HealthStatus
|
|
15
|
+
from .hours_response import HoursResponse
|
|
16
|
+
from .http_validation_error import HTTPValidationError
|
|
17
|
+
from .inequality_impact import InequalityImpact
|
|
18
|
+
from .intra_decile_impact import IntraDecileImpact
|
|
19
|
+
from .intra_decile_impact_all import IntraDecileImpactAll
|
|
20
|
+
from .intra_decile_impact_deciles import IntraDecileImpactDeciles
|
|
21
|
+
from .intra_wealth_decile_impact_with_values import IntraWealthDecileImpactWithValues
|
|
22
|
+
from .intra_wealth_decile_impact_with_values_all import IntraWealthDecileImpactWithValuesAll
|
|
23
|
+
from .intra_wealth_decile_impact_with_values_deciles import IntraWealthDecileImpactWithValuesDeciles
|
|
24
|
+
from .labor_supply_response import LaborSupplyResponse
|
|
25
|
+
from .labor_supply_response_decile import LaborSupplyResponseDecile
|
|
26
|
+
from .labor_supply_response_decile_additional_property import LaborSupplyResponseDecileAdditionalProperty
|
|
27
|
+
from .labor_supply_response_decile_additional_property_additional_property import (
|
|
28
|
+
LaborSupplyResponseDecileAdditionalPropertyAdditionalProperty,
|
|
29
|
+
)
|
|
30
|
+
from .labor_supply_response_relative_lsr import LaborSupplyResponseRelativeLsr
|
|
31
|
+
from .parameter_change_dict import ParameterChangeDict
|
|
32
|
+
from .parametric_reform import ParametricReform
|
|
33
|
+
from .ping_request import PingRequest
|
|
34
|
+
from .ping_response import PingResponse
|
|
35
|
+
from .poverty_gender_breakdown import PovertyGenderBreakdown
|
|
36
|
+
from .poverty_impact import PovertyImpact
|
|
37
|
+
from .poverty_racial_breakdown_with_values import PovertyRacialBreakdownWithValues
|
|
38
|
+
from .probe_status import ProbeStatus
|
|
39
|
+
from .program_specific_impact import ProgramSpecificImpact
|
|
40
|
+
from .racial_baseline_reform_values import RacialBaselineReformValues
|
|
41
|
+
from .simulation_options import SimulationOptions
|
|
42
|
+
from .simulation_options_country import SimulationOptionsCountry
|
|
43
|
+
from .simulation_options_data_type_1 import SimulationOptionsDataType1
|
|
44
|
+
from .simulation_options_scope import SimulationOptionsScope
|
|
45
|
+
from .system_status import SystemStatus
|
|
46
|
+
from .uk_constituency_breakdown_by_constituency import UKConstituencyBreakdownByConstituency
|
|
47
|
+
from .uk_constituency_breakdown_with_values import UKConstituencyBreakdownWithValues
|
|
48
|
+
from .uk_constituency_breakdown_with_values_by_constituency import UKConstituencyBreakdownWithValuesByConstituency
|
|
49
|
+
from .uk_constituency_breakdown_with_values_outcomes_by_region import UKConstituencyBreakdownWithValuesOutcomesByRegion
|
|
50
|
+
from .uk_constituency_breakdown_with_values_outcomes_by_region_additional_property import (
|
|
51
|
+
UKConstituencyBreakdownWithValuesOutcomesByRegionAdditionalProperty,
|
|
52
|
+
)
|
|
53
|
+
from .uk_local_authority_breakdown_by_local_authority import UKLocalAuthorityBreakdownByLocalAuthority
|
|
54
|
+
from .uk_local_authority_breakdown_with_values import UKLocalAuthorityBreakdownWithValues
|
|
55
|
+
from .uk_local_authority_breakdown_with_values_by_local_authority import (
|
|
56
|
+
UKLocalAuthorityBreakdownWithValuesByLocalAuthority,
|
|
57
|
+
)
|
|
58
|
+
from .validation_error import ValidationError
|
|
59
|
+
from .wealth_decile_impact_with_values import WealthDecileImpactWithValues
|
|
60
|
+
from .wealth_decile_impact_with_values_average import WealthDecileImpactWithValuesAverage
|
|
61
|
+
from .wealth_decile_impact_with_values_relative import WealthDecileImpactWithValuesRelative
|
|
62
|
+
|
|
63
|
+
__all__ = (
|
|
64
|
+
"AgeGroupBaselineReformValues",
|
|
65
|
+
"BaselineReformValues",
|
|
66
|
+
"BudgetaryImpact",
|
|
67
|
+
"CliffImpact",
|
|
68
|
+
"CliffImpactInSimulation",
|
|
69
|
+
"DecileImpact",
|
|
70
|
+
"DecileImpactAverage",
|
|
71
|
+
"DecileImpactRelative",
|
|
72
|
+
"EconomyComparison",
|
|
73
|
+
"EconomyComparisonDetailedBudgetType0",
|
|
74
|
+
"GenderBaselineReformValues",
|
|
75
|
+
"HealthStatus",
|
|
76
|
+
"HoursResponse",
|
|
77
|
+
"HTTPValidationError",
|
|
78
|
+
"InequalityImpact",
|
|
79
|
+
"IntraDecileImpact",
|
|
80
|
+
"IntraDecileImpactAll",
|
|
81
|
+
"IntraDecileImpactDeciles",
|
|
82
|
+
"IntraWealthDecileImpactWithValues",
|
|
83
|
+
"IntraWealthDecileImpactWithValuesAll",
|
|
84
|
+
"IntraWealthDecileImpactWithValuesDeciles",
|
|
85
|
+
"LaborSupplyResponse",
|
|
86
|
+
"LaborSupplyResponseDecile",
|
|
87
|
+
"LaborSupplyResponseDecileAdditionalProperty",
|
|
88
|
+
"LaborSupplyResponseDecileAdditionalPropertyAdditionalProperty",
|
|
89
|
+
"LaborSupplyResponseRelativeLsr",
|
|
90
|
+
"ParameterChangeDict",
|
|
91
|
+
"ParametricReform",
|
|
92
|
+
"PingRequest",
|
|
93
|
+
"PingResponse",
|
|
94
|
+
"PovertyGenderBreakdown",
|
|
95
|
+
"PovertyImpact",
|
|
96
|
+
"PovertyRacialBreakdownWithValues",
|
|
97
|
+
"ProbeStatus",
|
|
98
|
+
"ProgramSpecificImpact",
|
|
99
|
+
"RacialBaselineReformValues",
|
|
100
|
+
"SimulationOptions",
|
|
101
|
+
"SimulationOptionsCountry",
|
|
102
|
+
"SimulationOptionsDataType1",
|
|
103
|
+
"SimulationOptionsScope",
|
|
104
|
+
"SystemStatus",
|
|
105
|
+
"UKConstituencyBreakdownByConstituency",
|
|
106
|
+
"UKConstituencyBreakdownWithValues",
|
|
107
|
+
"UKConstituencyBreakdownWithValuesByConstituency",
|
|
108
|
+
"UKConstituencyBreakdownWithValuesOutcomesByRegion",
|
|
109
|
+
"UKConstituencyBreakdownWithValuesOutcomesByRegionAdditionalProperty",
|
|
110
|
+
"UKLocalAuthorityBreakdownByLocalAuthority",
|
|
111
|
+
"UKLocalAuthorityBreakdownWithValues",
|
|
112
|
+
"UKLocalAuthorityBreakdownWithValuesByLocalAuthority",
|
|
113
|
+
"ValidationError",
|
|
114
|
+
"WealthDecileImpactWithValues",
|
|
115
|
+
"WealthDecileImpactWithValuesAverage",
|
|
116
|
+
"WealthDecileImpactWithValuesRelative",
|
|
117
|
+
)
|
|
@@ -0,0 +1,91 @@
|
|
|
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.baseline_reform_values import BaselineReformValues
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="AgeGroupBaselineReformValues")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class AgeGroupBaselineReformValues:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
child (BaselineReformValues):
|
|
21
|
+
adult (BaselineReformValues):
|
|
22
|
+
senior (BaselineReformValues):
|
|
23
|
+
all_ (BaselineReformValues):
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
child: BaselineReformValues
|
|
27
|
+
adult: BaselineReformValues
|
|
28
|
+
senior: BaselineReformValues
|
|
29
|
+
all_: BaselineReformValues
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
child = self.child.to_dict()
|
|
34
|
+
|
|
35
|
+
adult = self.adult.to_dict()
|
|
36
|
+
|
|
37
|
+
senior = self.senior.to_dict()
|
|
38
|
+
|
|
39
|
+
all_ = self.all_.to_dict()
|
|
40
|
+
|
|
41
|
+
field_dict: dict[str, Any] = {}
|
|
42
|
+
field_dict.update(self.additional_properties)
|
|
43
|
+
field_dict.update(
|
|
44
|
+
{
|
|
45
|
+
"child": child,
|
|
46
|
+
"adult": adult,
|
|
47
|
+
"senior": senior,
|
|
48
|
+
"all": all_,
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return field_dict
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
56
|
+
from ..models.baseline_reform_values import BaselineReformValues
|
|
57
|
+
|
|
58
|
+
d = dict(src_dict)
|
|
59
|
+
child = BaselineReformValues.from_dict(d.pop("child"))
|
|
60
|
+
|
|
61
|
+
adult = BaselineReformValues.from_dict(d.pop("adult"))
|
|
62
|
+
|
|
63
|
+
senior = BaselineReformValues.from_dict(d.pop("senior"))
|
|
64
|
+
|
|
65
|
+
all_ = BaselineReformValues.from_dict(d.pop("all"))
|
|
66
|
+
|
|
67
|
+
age_group_baseline_reform_values = cls(
|
|
68
|
+
child=child,
|
|
69
|
+
adult=adult,
|
|
70
|
+
senior=senior,
|
|
71
|
+
all_=all_,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
age_group_baseline_reform_values.additional_properties = d
|
|
75
|
+
return age_group_baseline_reform_values
|
|
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
|
|
@@ -0,0 +1,69 @@
|
|
|
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="BaselineReformValues")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class BaselineReformValues:
|
|
14
|
+
"""
|
|
15
|
+
Attributes:
|
|
16
|
+
baseline (float):
|
|
17
|
+
reform (float):
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
baseline: float
|
|
21
|
+
reform: float
|
|
22
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
baseline = self.baseline
|
|
26
|
+
|
|
27
|
+
reform = self.reform
|
|
28
|
+
|
|
29
|
+
field_dict: dict[str, Any] = {}
|
|
30
|
+
field_dict.update(self.additional_properties)
|
|
31
|
+
field_dict.update(
|
|
32
|
+
{
|
|
33
|
+
"baseline": baseline,
|
|
34
|
+
"reform": reform,
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return field_dict
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
42
|
+
d = dict(src_dict)
|
|
43
|
+
baseline = d.pop("baseline")
|
|
44
|
+
|
|
45
|
+
reform = d.pop("reform")
|
|
46
|
+
|
|
47
|
+
baseline_reform_values = cls(
|
|
48
|
+
baseline=baseline,
|
|
49
|
+
reform=reform,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
baseline_reform_values.additional_properties = d
|
|
53
|
+
return baseline_reform_values
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def additional_keys(self) -> list[str]:
|
|
57
|
+
return list(self.additional_properties.keys())
|
|
58
|
+
|
|
59
|
+
def __getitem__(self, key: str) -> Any:
|
|
60
|
+
return self.additional_properties[key]
|
|
61
|
+
|
|
62
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
63
|
+
self.additional_properties[key] = value
|
|
64
|
+
|
|
65
|
+
def __delitem__(self, key: str) -> None:
|
|
66
|
+
del self.additional_properties[key]
|
|
67
|
+
|
|
68
|
+
def __contains__(self, key: str) -> bool:
|
|
69
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,101 @@
|
|
|
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="BudgetaryImpact")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class BudgetaryImpact:
|
|
14
|
+
"""
|
|
15
|
+
Attributes:
|
|
16
|
+
budgetary_impact (float):
|
|
17
|
+
tax_revenue_impact (float):
|
|
18
|
+
state_tax_revenue_impact (float):
|
|
19
|
+
benefit_spending_impact (float):
|
|
20
|
+
households (float):
|
|
21
|
+
baseline_net_income (float):
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
budgetary_impact: float
|
|
25
|
+
tax_revenue_impact: float
|
|
26
|
+
state_tax_revenue_impact: float
|
|
27
|
+
benefit_spending_impact: float
|
|
28
|
+
households: float
|
|
29
|
+
baseline_net_income: float
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
budgetary_impact = self.budgetary_impact
|
|
34
|
+
|
|
35
|
+
tax_revenue_impact = self.tax_revenue_impact
|
|
36
|
+
|
|
37
|
+
state_tax_revenue_impact = self.state_tax_revenue_impact
|
|
38
|
+
|
|
39
|
+
benefit_spending_impact = self.benefit_spending_impact
|
|
40
|
+
|
|
41
|
+
households = self.households
|
|
42
|
+
|
|
43
|
+
baseline_net_income = self.baseline_net_income
|
|
44
|
+
|
|
45
|
+
field_dict: dict[str, Any] = {}
|
|
46
|
+
field_dict.update(self.additional_properties)
|
|
47
|
+
field_dict.update(
|
|
48
|
+
{
|
|
49
|
+
"budgetary_impact": budgetary_impact,
|
|
50
|
+
"tax_revenue_impact": tax_revenue_impact,
|
|
51
|
+
"state_tax_revenue_impact": state_tax_revenue_impact,
|
|
52
|
+
"benefit_spending_impact": benefit_spending_impact,
|
|
53
|
+
"households": households,
|
|
54
|
+
"baseline_net_income": baseline_net_income,
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
return field_dict
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
62
|
+
d = dict(src_dict)
|
|
63
|
+
budgetary_impact = d.pop("budgetary_impact")
|
|
64
|
+
|
|
65
|
+
tax_revenue_impact = d.pop("tax_revenue_impact")
|
|
66
|
+
|
|
67
|
+
state_tax_revenue_impact = d.pop("state_tax_revenue_impact")
|
|
68
|
+
|
|
69
|
+
benefit_spending_impact = d.pop("benefit_spending_impact")
|
|
70
|
+
|
|
71
|
+
households = d.pop("households")
|
|
72
|
+
|
|
73
|
+
baseline_net_income = d.pop("baseline_net_income")
|
|
74
|
+
|
|
75
|
+
budgetary_impact = cls(
|
|
76
|
+
budgetary_impact=budgetary_impact,
|
|
77
|
+
tax_revenue_impact=tax_revenue_impact,
|
|
78
|
+
state_tax_revenue_impact=state_tax_revenue_impact,
|
|
79
|
+
benefit_spending_impact=benefit_spending_impact,
|
|
80
|
+
households=households,
|
|
81
|
+
baseline_net_income=baseline_net_income,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
budgetary_impact.additional_properties = d
|
|
85
|
+
return budgetary_impact
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def additional_keys(self) -> list[str]:
|
|
89
|
+
return list(self.additional_properties.keys())
|
|
90
|
+
|
|
91
|
+
def __getitem__(self, key: str) -> Any:
|
|
92
|
+
return self.additional_properties[key]
|
|
93
|
+
|
|
94
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
95
|
+
self.additional_properties[key] = value
|
|
96
|
+
|
|
97
|
+
def __delitem__(self, key: str) -> None:
|
|
98
|
+
del self.additional_properties[key]
|
|
99
|
+
|
|
100
|
+
def __contains__(self, key: str) -> bool:
|
|
101
|
+
return key in self.additional_properties
|