qubitclient 0.1.4__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.
- qubitclient/__init__.py +5 -0
- qubitclient/draw/__init__.py +0 -0
- qubitclient/draw/optpipulsepltplotter.py +75 -0
- qubitclient/draw/optpipulseplyplotter.py +114 -0
- qubitclient/draw/pltmanager.py +50 -0
- qubitclient/draw/pltplotter.py +20 -0
- qubitclient/draw/plymanager.py +57 -0
- qubitclient/draw/plyplotter.py +21 -0
- qubitclient/draw/powershiftpltplotter.py +108 -0
- qubitclient/draw/powershiftplyplotter.py +194 -0
- qubitclient/draw/rabicospltplotter.py +74 -0
- qubitclient/draw/rabicosplyplotter.py +90 -0
- qubitclient/draw/rabipltplotter.py +66 -0
- qubitclient/draw/rabiplyplotter.py +86 -0
- qubitclient/draw/s21peakpltplotter.py +67 -0
- qubitclient/draw/s21peakplyplotter.py +124 -0
- qubitclient/draw/s21vfluxpltplotter.py +84 -0
- qubitclient/draw/s21vfluxplyplotter.py +163 -0
- qubitclient/draw/singleshotpltplotter.py +149 -0
- qubitclient/draw/singleshotplyplotter.py +324 -0
- qubitclient/draw/spectrum2dpltplotter.py +107 -0
- qubitclient/draw/spectrum2dplyplotter.py +244 -0
- qubitclient/draw/spectrum2dscopepltplotter.py +72 -0
- qubitclient/draw/spectrum2dscopeplyplotter.py +195 -0
- qubitclient/draw/spectrumpltplotter.py +106 -0
- qubitclient/draw/spectrumplyplotter.py +133 -0
- qubitclient/draw/t1fitpltplotter.py +76 -0
- qubitclient/draw/t1fitplyplotter.py +109 -0
- qubitclient/draw/t2fitpltplotter.py +70 -0
- qubitclient/draw/t2fitplyplotter.py +111 -0
- qubitclient/nnscope/nnscope.py +51 -0
- qubitclient/nnscope/nnscope_api/curve/__init__.py +0 -0
- qubitclient/nnscope/nnscope_api/curve/curve_type.py +15 -0
- qubitclient/nnscope/task.py +170 -0
- qubitclient/nnscope/utils/data_convert.py +114 -0
- qubitclient/nnscope/utils/data_parser.py +41 -0
- qubitclient/nnscope/utils/request_tool.py +41 -0
- qubitclient/nnscope/utils/result_parser.py +55 -0
- qubitclient/scope/scope.py +50 -0
- qubitclient/scope/scope_api/__init__.py +8 -0
- qubitclient/scope/scope_api/api/__init__.py +1 -0
- qubitclient/scope/scope_api/api/defined_tasks/__init__.py +1 -0
- qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_demo_pk_get.py +155 -0
- qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_scope_pk_get.py +155 -0
- qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/powershift_api_v1_tasks_scope_powershift_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/rabi_api_v1_tasks_scope_rabi_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/rabicos_api_v1_tasks_scope_rabicospeak_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/s21peak_api_v1_tasks_scope_s21peak_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/s21vflux_api_v1_tasks_scope_s21vflux_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/singleshot_api_v1_tasks_scope_singleshot_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/spectrum2d_api_v1_tasks_scope_spectrum2d_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/spectrum_api_v1_tasks_scope_spectrum_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t1fit_post.py +218 -0
- qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t2fit_post.py +218 -0
- qubitclient/scope/scope_api/client.py +268 -0
- qubitclient/scope/scope_api/errors.py +16 -0
- qubitclient/scope/scope_api/models/__init__.py +31 -0
- qubitclient/scope/scope_api/models/body_optpipulse_api_v1_tasks_scope_optpipulse_post.py +83 -0
- qubitclient/scope/scope_api/models/body_powershift_api_v1_tasks_scope_powershift_post.py +83 -0
- qubitclient/scope/scope_api/models/body_rabi_api_v1_tasks_scope_rabi_post.py +83 -0
- qubitclient/scope/scope_api/models/body_rabicos_api_v1_tasks_scope_rabicospeak_post.py +83 -0
- qubitclient/scope/scope_api/models/body_s21_peak_api_v1_tasks_scope_s21_peak_post.py +83 -0
- qubitclient/scope/scope_api/models/body_s21_vflux_api_v1_tasks_scope_s21_vflux_post.py +83 -0
- qubitclient/scope/scope_api/models/body_singleshot_api_v1_tasks_scope_singleshot_post.py +83 -0
- qubitclient/scope/scope_api/models/body_spectrum_2d_api_v1_tasks_scope_spectrum_2d_post.py +83 -0
- qubitclient/scope/scope_api/models/body_spectrum_api_v1_tasks_scope_spectrum_post.py +83 -0
- qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t1_fit_post.py +83 -0
- qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t2_fit_post.py +83 -0
- qubitclient/scope/scope_api/models/http_validation_error.py +75 -0
- qubitclient/scope/scope_api/models/validation_error.py +88 -0
- qubitclient/scope/scope_api/types.py +54 -0
- qubitclient/scope/task.py +163 -0
- qubitclient/scope/utils/__init__.py +0 -0
- qubitclient/scope/utils/data_parser.py +20 -0
- qubitclient-0.1.4.dist-info/METADATA +173 -0
- qubitclient-0.1.4.dist-info/RECORD +81 -0
- qubitclient-0.1.4.dist-info/WHEEL +5 -0
- qubitclient-0.1.4.dist-info/licenses/LICENSE +674 -0
- qubitclient-0.1.4.dist-info/top_level.txt +1 -0
- qubitclient-0.1.4.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
pk: int,
|
|
14
|
+
) -> dict[str, Any]:
|
|
15
|
+
_kwargs: dict[str, Any] = {
|
|
16
|
+
"method": "get",
|
|
17
|
+
"url": f"/api/v1/tasks/scope/{pk}",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return _kwargs
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse_response(
|
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
25
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
26
|
+
if response.status_code == 200:
|
|
27
|
+
response_200 = response.json()
|
|
28
|
+
return response_200
|
|
29
|
+
|
|
30
|
+
if response.status_code == 422:
|
|
31
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
32
|
+
|
|
33
|
+
return response_422
|
|
34
|
+
|
|
35
|
+
if client.raise_on_unexpected_status:
|
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
37
|
+
else:
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _build_response(
|
|
42
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
43
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
44
|
+
return Response(
|
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
|
46
|
+
content=response.content,
|
|
47
|
+
headers=response.headers,
|
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def sync_detailed(
|
|
53
|
+
pk: int,
|
|
54
|
+
*,
|
|
55
|
+
client: Union[AuthenticatedClient, Client],
|
|
56
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
57
|
+
"""获取任务结果详情
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
pk (int): 任务结果 ID
|
|
61
|
+
|
|
62
|
+
Raises:
|
|
63
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
64
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Response[Union[Any, HTTPValidationError]]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
kwargs = _get_kwargs(
|
|
71
|
+
pk=pk,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = client.get_httpx_client().request(
|
|
75
|
+
**kwargs,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return _build_response(client=client, response=response)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync(
|
|
82
|
+
pk: int,
|
|
83
|
+
*,
|
|
84
|
+
client: Union[AuthenticatedClient, Client],
|
|
85
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
86
|
+
"""获取任务结果详情
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
pk (int): 任务结果 ID
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Union[Any, HTTPValidationError]
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
return sync_detailed(
|
|
100
|
+
pk=pk,
|
|
101
|
+
client=client,
|
|
102
|
+
).parsed
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async def asyncio_detailed(
|
|
106
|
+
pk: int,
|
|
107
|
+
*,
|
|
108
|
+
client: Union[AuthenticatedClient, Client],
|
|
109
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
110
|
+
"""获取任务结果详情
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
pk (int): 任务结果 ID
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
Response[Union[Any, HTTPValidationError]]
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
kwargs = _get_kwargs(
|
|
124
|
+
pk=pk,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
128
|
+
|
|
129
|
+
return _build_response(client=client, response=response)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio(
|
|
133
|
+
pk: int,
|
|
134
|
+
*,
|
|
135
|
+
client: Union[AuthenticatedClient, Client],
|
|
136
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
137
|
+
"""获取任务结果详情
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
pk (int): 任务结果 ID
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Union[Any, HTTPValidationError]
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
await asyncio_detailed(
|
|
152
|
+
pk=pk,
|
|
153
|
+
client=client,
|
|
154
|
+
)
|
|
155
|
+
).parsed
|
qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.body_optpipulse_api_v1_tasks_scope_optpipulse_post import BodyOptpipulseApiV1TasksScopeOptpipulsePost
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: BodyOptpipulseApiV1TasksScopeOptpipulsePost,
|
|
16
|
+
type_: Union[Unset, str] = "optpipulse",
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
params: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
params["type"] = type_
|
|
23
|
+
|
|
24
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
25
|
+
|
|
26
|
+
_kwargs: dict[str, Any] = {
|
|
27
|
+
"method": "post",
|
|
28
|
+
"url": "/api/v1/tasks/scope/optpipulse",
|
|
29
|
+
"params": params,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_kwargs["files"] = body.to_multipart()
|
|
33
|
+
|
|
34
|
+
_kwargs["headers"] = headers
|
|
35
|
+
return _kwargs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _parse_response(
|
|
39
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
40
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = response.json()
|
|
43
|
+
return response_200
|
|
44
|
+
|
|
45
|
+
if response.status_code == 422:
|
|
46
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_422
|
|
49
|
+
|
|
50
|
+
if client.raise_on_unexpected_status:
|
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
52
|
+
else:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _build_response(
|
|
57
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
58
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
59
|
+
return Response(
|
|
60
|
+
status_code=HTTPStatus(response.status_code),
|
|
61
|
+
content=response.content,
|
|
62
|
+
headers=response.headers,
|
|
63
|
+
parsed=_parse_response(client=client, response=response),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def sync_detailed(
|
|
68
|
+
*,
|
|
69
|
+
client: Union[AuthenticatedClient, Client],
|
|
70
|
+
body: BodyOptpipulseApiV1TasksScopeOptpipulsePost,
|
|
71
|
+
type_: Union[Unset, str] = "optpipulse",
|
|
72
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
73
|
+
r"""Optpipulse
|
|
74
|
+
|
|
75
|
+
Common peak detection for optimizing pi pulse
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
files: 上传的.npy文件列表
|
|
79
|
+
type: 任务类型,默认为\"optpipulse\"
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
dict: 包含检测结果的字典
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'optpipulse'.
|
|
86
|
+
body (BodyOptpipulseApiV1TasksScopeOptpipulsePost):
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
90
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Response[Union[Any, HTTPValidationError]]
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
kwargs = _get_kwargs(
|
|
97
|
+
body=body,
|
|
98
|
+
type_=type_,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = client.get_httpx_client().request(
|
|
102
|
+
**kwargs,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return _build_response(client=client, response=response)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def sync(
|
|
109
|
+
*,
|
|
110
|
+
client: Union[AuthenticatedClient, Client],
|
|
111
|
+
body: BodyOptpipulseApiV1TasksScopeOptpipulsePost,
|
|
112
|
+
type_: Union[Unset, str] = "optpipulse",
|
|
113
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
114
|
+
r"""Optpipulse
|
|
115
|
+
|
|
116
|
+
Common peak detection for optimizing pi pulse
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
files: 上传的.npy文件列表
|
|
120
|
+
type: 任务类型,默认为\"optpipulse\"
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
dict: 包含检测结果的字典
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'optpipulse'.
|
|
127
|
+
body (BodyOptpipulseApiV1TasksScopeOptpipulsePost):
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
131
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
Union[Any, HTTPValidationError]
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
return sync_detailed(
|
|
138
|
+
client=client,
|
|
139
|
+
body=body,
|
|
140
|
+
type_=type_,
|
|
141
|
+
).parsed
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio_detailed(
|
|
145
|
+
*,
|
|
146
|
+
client: Union[AuthenticatedClient, Client],
|
|
147
|
+
body: BodyOptpipulseApiV1TasksScopeOptpipulsePost,
|
|
148
|
+
type_: Union[Unset, str] = "optpipulse",
|
|
149
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
150
|
+
r"""Optpipulse
|
|
151
|
+
|
|
152
|
+
Common peak detection for optimizing pi pulse
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
files: 上传的.npy文件列表
|
|
156
|
+
type: 任务类型,默认为\"optpipulse\"
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
dict: 包含检测结果的字典
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'optpipulse'.
|
|
163
|
+
body (BodyOptpipulseApiV1TasksScopeOptpipulsePost):
|
|
164
|
+
|
|
165
|
+
Raises:
|
|
166
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
167
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
Response[Union[Any, HTTPValidationError]]
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
kwargs = _get_kwargs(
|
|
174
|
+
body=body,
|
|
175
|
+
type_=type_,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
179
|
+
|
|
180
|
+
return _build_response(client=client, response=response)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
async def asyncio(
|
|
184
|
+
*,
|
|
185
|
+
client: Union[AuthenticatedClient, Client],
|
|
186
|
+
body: BodyOptpipulseApiV1TasksScopeOptpipulsePost,
|
|
187
|
+
type_: Union[Unset, str] = "optpipulse",
|
|
188
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
189
|
+
r"""Optpipulse
|
|
190
|
+
|
|
191
|
+
Common peak detection for optimizing pi pulse
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
files: 上传的.npy文件列表
|
|
195
|
+
type: 任务类型,默认为\"optpipulse\"
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
dict: 包含检测结果的字典
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'optpipulse'.
|
|
202
|
+
body (BodyOptpipulseApiV1TasksScopeOptpipulsePost):
|
|
203
|
+
|
|
204
|
+
Raises:
|
|
205
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
206
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
Union[Any, HTTPValidationError]
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
await asyncio_detailed(
|
|
214
|
+
client=client,
|
|
215
|
+
body=body,
|
|
216
|
+
type_=type_,
|
|
217
|
+
)
|
|
218
|
+
).parsed
|
qubitclient/scope/scope_api/api/defined_tasks/powershift_api_v1_tasks_scope_powershift_post.py
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.body_powershift_api_v1_tasks_scope_powershift_post import BodyPowershiftApiV1TasksScopePowershiftPost
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: BodyPowershiftApiV1TasksScopePowershiftPost,
|
|
16
|
+
type_: Union[Unset, str] = "powershift",
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
params: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
params["type"] = type_
|
|
23
|
+
|
|
24
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
25
|
+
|
|
26
|
+
_kwargs: dict[str, Any] = {
|
|
27
|
+
"method": "post",
|
|
28
|
+
"url": "/api/v1/tasks/scope/powershift",
|
|
29
|
+
"params": params,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_kwargs["files"] = body.to_multipart()
|
|
33
|
+
|
|
34
|
+
_kwargs["headers"] = headers
|
|
35
|
+
return _kwargs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _parse_response(
|
|
39
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
40
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = response.json()
|
|
43
|
+
return response_200
|
|
44
|
+
|
|
45
|
+
if response.status_code == 422:
|
|
46
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_422
|
|
49
|
+
|
|
50
|
+
if client.raise_on_unexpected_status:
|
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
52
|
+
else:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _build_response(
|
|
57
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
58
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
59
|
+
return Response(
|
|
60
|
+
status_code=HTTPStatus(response.status_code),
|
|
61
|
+
content=response.content,
|
|
62
|
+
headers=response.headers,
|
|
63
|
+
parsed=_parse_response(client=client, response=response),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def sync_detailed(
|
|
68
|
+
*,
|
|
69
|
+
client: Union[AuthenticatedClient, Client],
|
|
70
|
+
body: BodyPowershiftApiV1TasksScopePowershiftPost,
|
|
71
|
+
type_: Union[Unset, str] = "powershift",
|
|
72
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
73
|
+
r"""Powershift
|
|
74
|
+
|
|
75
|
+
powershift
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
files: 上传的.npy文件列表
|
|
79
|
+
type: 任务类型,默认为\"powershift\"
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
dict: 包含检测结果的字典
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'powershift'.
|
|
86
|
+
body (BodyPowershiftApiV1TasksScopePowershiftPost):
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
90
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Response[Union[Any, HTTPValidationError]]
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
kwargs = _get_kwargs(
|
|
97
|
+
body=body,
|
|
98
|
+
type_=type_,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = client.get_httpx_client().request(
|
|
102
|
+
**kwargs,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return _build_response(client=client, response=response)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def sync(
|
|
109
|
+
*,
|
|
110
|
+
client: Union[AuthenticatedClient, Client],
|
|
111
|
+
body: BodyPowershiftApiV1TasksScopePowershiftPost,
|
|
112
|
+
type_: Union[Unset, str] = "powershift",
|
|
113
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
114
|
+
r"""Powershift
|
|
115
|
+
|
|
116
|
+
powershift
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
files: 上传的.npy文件列表
|
|
120
|
+
type: 任务类型,默认为\"powershift\"
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
dict: 包含检测结果的字典
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'powershift'.
|
|
127
|
+
body (BodyPowershiftApiV1TasksScopePowershiftPost):
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
131
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
Union[Any, HTTPValidationError]
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
return sync_detailed(
|
|
138
|
+
client=client,
|
|
139
|
+
body=body,
|
|
140
|
+
type_=type_,
|
|
141
|
+
).parsed
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio_detailed(
|
|
145
|
+
*,
|
|
146
|
+
client: Union[AuthenticatedClient, Client],
|
|
147
|
+
body: BodyPowershiftApiV1TasksScopePowershiftPost,
|
|
148
|
+
type_: Union[Unset, str] = "powershift",
|
|
149
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
150
|
+
r"""Powershift
|
|
151
|
+
|
|
152
|
+
powershift
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
files: 上传的.npy文件列表
|
|
156
|
+
type: 任务类型,默认为\"powershift\"
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
dict: 包含检测结果的字典
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'powershift'.
|
|
163
|
+
body (BodyPowershiftApiV1TasksScopePowershiftPost):
|
|
164
|
+
|
|
165
|
+
Raises:
|
|
166
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
167
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
Response[Union[Any, HTTPValidationError]]
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
kwargs = _get_kwargs(
|
|
174
|
+
body=body,
|
|
175
|
+
type_=type_,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
179
|
+
|
|
180
|
+
return _build_response(client=client, response=response)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
async def asyncio(
|
|
184
|
+
*,
|
|
185
|
+
client: Union[AuthenticatedClient, Client],
|
|
186
|
+
body: BodyPowershiftApiV1TasksScopePowershiftPost,
|
|
187
|
+
type_: Union[Unset, str] = "powershift",
|
|
188
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
189
|
+
r"""Powershift
|
|
190
|
+
|
|
191
|
+
powershift
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
files: 上传的.npy文件列表
|
|
195
|
+
type: 任务类型,默认为\"powershift\"
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
dict: 包含检测结果的字典
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
type_ (Union[Unset, str]): 任务类型 Default: 'powershift'.
|
|
202
|
+
body (BodyPowershiftApiV1TasksScopePowershiftPost):
|
|
203
|
+
|
|
204
|
+
Raises:
|
|
205
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
206
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
Union[Any, HTTPValidationError]
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
await asyncio_detailed(
|
|
214
|
+
client=client,
|
|
215
|
+
body=body,
|
|
216
|
+
type_=type_,
|
|
217
|
+
)
|
|
218
|
+
).parsed
|