qubitclient 0.0.0.1__tar.gz → 0.0.1__tar.gz
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.
Potentially problematic release.
This version of qubitclient might be problematic. Click here for more details.
- qubitclient-0.0.1/PKG-INFO +106 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/README.md +20 -9
- qubitclient-0.0.1/pyproject.toml +16 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/qubitclient/QubitSeg.py +3 -3
- qubitclient-0.0.1/qubitclient/__init__.py +3 -0
- qubitclient-0.0.1/qubitclient/curve/curve_type.py +15 -0
- qubitclient-0.0.1/qubitclient/scope/scope.py +51 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/__init__.py +8 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/__init__.py +1 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/__init__.py +1 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_demo_pk_get.py +155 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/get_task_result_api_v1_tasks_scope_pk_get.py +155 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/optpipulse_api_v1_tasks_scope_optpipulse_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/rabi_api_v1_tasks_scope_rabi_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/rabicos_api_v1_tasks_scope_rabicospeak_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/s21peak_api_v1_tasks_scope_s21peak_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/s21vflux_api_v1_tasks_scope_s21vflux_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/singleshot_api_v1_tasks_scope_singleshot_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/spectrum_api_v1_tasks_scope_spectrum_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t1fit_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/api/defined_tasks/t1fit_api_v1_tasks_scope_t2fit_post.py +218 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/client.py +268 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/errors.py +16 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/__init__.py +27 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_optpipulse_api_v1_tasks_scope_optpipulse_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_rabi_api_v1_tasks_scope_rabi_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_rabicos_api_v1_tasks_scope_rabicospeak_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_s21_peak_api_v1_tasks_scope_s21_peak_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_s21_vflux_api_v1_tasks_scope_s21_vflux_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_singleshot_api_v1_tasks_scope_singleshot_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_spectrum_api_v1_tasks_scope_spectrum_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t1_fit_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/body_t1_fit_api_v1_tasks_scope_t2_fit_post.py +83 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/http_validation_error.py +75 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/models/validation_error.py +88 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/py.typed +1 -0
- qubitclient-0.0.1/qubitclient/scope/scope_api/types.py +54 -0
- qubitclient-0.0.1/qubitclient/scope/task.py +140 -0
- qubitclient-0.0.1/qubitclient/scope/utils/__init__.py +0 -0
- qubitclient-0.0.1/qubitclient/scope/utils/data_parser.py +20 -0
- qubitclient-0.0.1/qubitclient/utils/data_convert.py +112 -0
- qubitclient-0.0.1/qubitclient/utils/data_parser.py +41 -0
- qubitclient-0.0.1/qubitclient/utils/request_tool.py +41 -0
- qubitclient-0.0.1/qubitclient/utils/result_parser.py +55 -0
- qubitclient-0.0.1/qubitclient.egg-info/PKG-INFO +106 -0
- qubitclient-0.0.1/qubitclient.egg-info/SOURCES.txt +53 -0
- qubitclient-0.0.1/tests/test_scope.py +66 -0
- qubitclient-0.0.1/tests/test_scope_api.py +50 -0
- qubitclient-0.0.0.1/PKG-INFO +0 -35
- qubitclient-0.0.0.1/qubitclient/__init__.py +0 -1
- qubitclient-0.0.0.1/qubitclient.egg-info/PKG-INFO +0 -35
- qubitclient-0.0.0.1/qubitclient.egg-info/SOURCES.txt +0 -12
- qubitclient-0.0.0.1/qubitclient.egg-info/requires.txt +0 -1
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/LICENSE +0 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/MANIFEST.in +0 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/qubitclient.egg-info/dependency_links.txt +0 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/qubitclient.egg-info/top_level.txt +0 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/qubitclient.egg-info/zip-safe +0 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/setup.cfg +0 -0
- {qubitclient-0.0.0.1 → qubitclient-0.0.1}/setup.py +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qubitclient
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: qubit analysis client
|
|
5
|
+
Home-page: https://github.com/yaqiangsun/QubitClient
|
|
6
|
+
Author: Yaqiang Sun
|
|
7
|
+
Author-email: Yaqiang Sun <sunyaking@163.com>
|
|
8
|
+
License: GPL-3.0
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: home-page
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
Dynamic: requires-python
|
|
16
|
+
|
|
17
|
+
# QubitClient
|
|
18
|
+
|
|
19
|
+
#### 介绍
|
|
20
|
+
**qubit-client**
|
|
21
|
+
QubitClient 是用于使用Qubit服务的示例。
|
|
22
|
+
|
|
23
|
+
# 更新日志
|
|
24
|
+
|
|
25
|
+
近期更新:
|
|
26
|
+
|
|
27
|
+
- **增加scope功能包**: 增加多种任务功能(20251022).
|
|
28
|
+
- **增加曲线类型**: 增加cosin类型曲线拟合(20250606).
|
|
29
|
+
- **构建基础项目:** 基础功能与结构构建.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# 使用
|
|
33
|
+
|
|
34
|
+
### scope功能包
|
|
35
|
+
#### 运行示例代码
|
|
36
|
+
```python
|
|
37
|
+
python demo/scope_demo.py
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 曲线分割功能
|
|
41
|
+
#### 使用说明
|
|
42
|
+
1.拷贝config.py.example文件为config.py,并修改配置参数。
|
|
43
|
+
```
|
|
44
|
+
cp config.py.example config.py
|
|
45
|
+
```
|
|
46
|
+
2.运行
|
|
47
|
+
单次请求多个文件:
|
|
48
|
+
```bash
|
|
49
|
+
python client_demo.py
|
|
50
|
+
```
|
|
51
|
+
批量多次请求
|
|
52
|
+
```bash
|
|
53
|
+
python script/test.py
|
|
54
|
+
```
|
|
55
|
+
#### 定义实例
|
|
56
|
+
```
|
|
57
|
+
client = QubitSegClient(url=url, api_key=api_key,curve_type=CurveType.POLY)
|
|
58
|
+
```
|
|
59
|
+
curve_type: CurveType.COSINE(cosin拟合) or CurveType.POLY(多项式拟合)
|
|
60
|
+
|
|
61
|
+
#### 请求输入
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
response = client.request(file_list=dict_list)
|
|
65
|
+
```
|
|
66
|
+
dict_list格式为:
|
|
67
|
+
```json
|
|
68
|
+
[
|
|
69
|
+
{
|
|
70
|
+
"bias":np.ndarray shape(A),
|
|
71
|
+
"frequency":np.ndarray shape(B),
|
|
72
|
+
"iq_avg":np.ndarray shape(B,A),
|
|
73
|
+
},
|
|
74
|
+
...
|
|
75
|
+
]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
#### 返回值
|
|
80
|
+
返回请求为response
|
|
81
|
+
```python
|
|
82
|
+
res = response.json()
|
|
83
|
+
```
|
|
84
|
+
res格式为:
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"state":'success',
|
|
88
|
+
"result":result
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
其中result格式:
|
|
92
|
+
```json
|
|
93
|
+
[
|
|
94
|
+
{
|
|
95
|
+
"params_list":List[List[float]],//每条线段的多项式参数列表
|
|
96
|
+
"linepoints_list":List[List[[row_index,col_index]]],//每条线段的点坐标列表
|
|
97
|
+
"confidence_list":List[float],//每条线段的置信度
|
|
98
|
+
},//每一个npz文件的结果
|
|
99
|
+
{
|
|
100
|
+
...
|
|
101
|
+
},
|
|
102
|
+
...
|
|
103
|
+
]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
|
|
@@ -8,20 +8,39 @@ QubitClient 是用于使用Qubit服务的示例。
|
|
|
8
8
|
|
|
9
9
|
近期更新:
|
|
10
10
|
|
|
11
|
+
- **增加scope功能包**: 增加多种任务功能(20251022).
|
|
11
12
|
- **增加曲线类型**: 增加cosin类型曲线拟合(20250606).
|
|
12
13
|
- **构建基础项目:** 基础功能与结构构建.
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
# 使用
|
|
17
|
+
|
|
18
|
+
### scope功能包
|
|
19
|
+
#### 运行示例代码
|
|
20
|
+
```python
|
|
21
|
+
python demo/scope_demo.py
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 曲线分割功能
|
|
16
25
|
#### 使用说明
|
|
17
26
|
1.拷贝config.py.example文件为config.py,并修改配置参数。
|
|
18
27
|
```
|
|
19
28
|
cp config.py.example config.py
|
|
20
29
|
```
|
|
21
30
|
2.运行
|
|
22
|
-
|
|
31
|
+
单次请求多个文件:
|
|
32
|
+
```bash
|
|
23
33
|
python client_demo.py
|
|
24
34
|
```
|
|
35
|
+
批量多次请求
|
|
36
|
+
```bash
|
|
37
|
+
python script/test.py
|
|
38
|
+
```
|
|
39
|
+
#### 定义实例
|
|
40
|
+
```
|
|
41
|
+
client = QubitSegClient(url=url, api_key=api_key,curve_type=CurveType.POLY)
|
|
42
|
+
```
|
|
43
|
+
curve_type: CurveType.COSINE(cosin拟合) or CurveType.POLY(多项式拟合)
|
|
25
44
|
|
|
26
45
|
#### 请求输入
|
|
27
46
|
|
|
@@ -68,12 +87,4 @@ res格式为:
|
|
|
68
87
|
]
|
|
69
88
|
```
|
|
70
89
|
|
|
71
|
-
### 坐标映射
|
|
72
|
-
```python
|
|
73
|
-
points = result[0]["linepoints_list"][0]
|
|
74
|
-
reflection_points = client.convert_axis(points, bias,frequency)
|
|
75
|
-
```
|
|
76
|
-
`points`格式:`List[[row_index,col_index],...]`,表示单条线段的点坐标.<br>
|
|
77
|
-
`bias`格式:`np.ndarray shape(A)`,与上述bias相同.<br>
|
|
78
|
-
`frequency`格式:`np.ndarray shape(B)`,与上述frequency相同.<br>
|
|
79
90
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "qubitclient"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "qubit analysis client"
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "Yaqiang Sun", email = "sunyaking@163.com" },
|
|
7
|
+
]
|
|
8
|
+
license = {text = "GPL-3.0"}
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10, <3.13"
|
|
11
|
+
dependencies = []
|
|
12
|
+
|
|
13
|
+
[tool.setuptools.packages.find]
|
|
14
|
+
where = ["."]
|
|
15
|
+
include = ["qubitclient*"] # match qubitscope and qubitscope.*
|
|
16
|
+
exclude = ["tests", "tests.*", "tmp", "tmp.*"]
|
|
@@ -23,13 +23,13 @@ class QubitSegClient(object):
|
|
|
23
23
|
def __init__(self, url, api_key,curve_type:CurveType=None):
|
|
24
24
|
self.url = url
|
|
25
25
|
self.api_key = api_key
|
|
26
|
-
self.
|
|
26
|
+
self.curve_type = curve_type
|
|
27
27
|
def request(self, file_list:list[str|dict[str,np.ndarray]]):
|
|
28
28
|
if len(file_list)>0:
|
|
29
29
|
if type(file_list[0]) == str:
|
|
30
|
-
response = file_request(file_path_list=file_list,url=self.url,api_key=self.api_key,curve_type=self.
|
|
30
|
+
response = file_request(file_path_list=file_list,url=self.url,api_key=self.api_key,curve_type=self.curve_type)
|
|
31
31
|
elif type(file_list[0]) == dict:# 多个content字典
|
|
32
|
-
response = file_request_with_dict(dict_list=file_list,url=self.url,api_key=self.api_key,curve_type=self.
|
|
32
|
+
response = file_request_with_dict(dict_list=file_list,url=self.url,api_key=self.api_key,curve_type=self.curve_type)
|
|
33
33
|
else:
|
|
34
34
|
raise ValueError("file_list must be a list of str or dict")
|
|
35
35
|
else:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (c) 2025 yaqiang.sun.
|
|
3
|
+
# This source code is licensed under the license found in the LICENSE file
|
|
4
|
+
# in the root directory of this source tree.
|
|
5
|
+
#########################################################################
|
|
6
|
+
# Author: yaqiangsun
|
|
7
|
+
# Created Time: 2025/06/06 16:52:53
|
|
8
|
+
########################################################################
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
from enum import Enum
|
|
12
|
+
|
|
13
|
+
class CurveType(str, Enum):
|
|
14
|
+
COSINE = "cosin"
|
|
15
|
+
POLY = "poly"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (c) 2025 yaqiang.sun.
|
|
3
|
+
# This source code is licensed under the license found in the LICENSE file
|
|
4
|
+
# in the root directory of this source tree.
|
|
5
|
+
#########################################################################
|
|
6
|
+
# Author: yaqiangsun
|
|
7
|
+
# Created Time: 2025/10/20 18:13:37
|
|
8
|
+
########################################################################
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
# import cv2
|
|
13
|
+
import numpy as np
|
|
14
|
+
import sys
|
|
15
|
+
# 获取当前文件的绝对路径,向上两层就是项目根目录
|
|
16
|
+
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
17
|
+
if project_root not in sys.path:
|
|
18
|
+
sys.path.insert(0, project_root)
|
|
19
|
+
#
|
|
20
|
+
# `scope_api_client`: this package is generated by `openapi-python-client`
|
|
21
|
+
from .scope_api import Client
|
|
22
|
+
from .task import run_task
|
|
23
|
+
import logging
|
|
24
|
+
import numpy as np
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
logging.basicConfig(level=logging.INFO)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class QubitScopeClient(object):
|
|
32
|
+
def __init__(self, url, api_key):
|
|
33
|
+
self.url = url
|
|
34
|
+
self.api_key = api_key
|
|
35
|
+
self.client = Client(base_url=url)
|
|
36
|
+
|
|
37
|
+
def request(self, file_list:list[str|dict[str,np.ndarray]],task_type:str="s21peak"):
|
|
38
|
+
if len(file_list)>0:
|
|
39
|
+
response = run_task(self.client,file_list,task_type)
|
|
40
|
+
else:
|
|
41
|
+
raise ValueError("file_list must not be empty")
|
|
42
|
+
return response
|
|
43
|
+
def get_result(self,response):
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
logging.info("Result: %s", response.parsed)
|
|
46
|
+
result = response.parsed
|
|
47
|
+
return result
|
|
48
|
+
else:
|
|
49
|
+
logging.error("Error: %s %s", response.status_code, response.parsed)
|
|
50
|
+
return []
|
|
51
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -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/demo/{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
|
|
@@ -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
|