scalebox-sdk 0.1.25__py3-none-any.whl → 1.0.2__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.
- scalebox/__init__.py +2 -2
- scalebox/api/__init__.py +3 -1
- scalebox/api/client/api/sandboxes/get_sandboxes.py +1 -1
- scalebox/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
- scalebox/api/client/models/connect_sandbox.py +59 -0
- scalebox/api/client/models/error.py +2 -2
- scalebox/api/client/models/listed_sandbox.py +24 -3
- scalebox/api/client/models/new_sandbox.py +10 -0
- scalebox/api/client/models/sandbox.py +13 -0
- scalebox/api/client/models/sandbox_detail.py +24 -0
- scalebox/cli.py +125 -125
- scalebox/client/aclient.py +57 -57
- scalebox/client/client.py +102 -102
- scalebox/code_interpreter/__init__.py +12 -12
- scalebox/code_interpreter/charts.py +230 -230
- scalebox/code_interpreter/code_interpreter_async.py +3 -1
- scalebox/code_interpreter/code_interpreter_sync.py +3 -1
- scalebox/code_interpreter/constants.py +3 -3
- scalebox/code_interpreter/exceptions.py +13 -13
- scalebox/code_interpreter/models.py +485 -485
- scalebox/connection_config.py +36 -1
- scalebox/csx_connect/__init__.py +1 -1
- scalebox/csx_connect/client.py +485 -485
- scalebox/csx_desktop/main.py +651 -651
- scalebox/exceptions.py +83 -83
- scalebox/generated/api.py +61 -61
- scalebox/generated/api_pb2.py +203 -203
- scalebox/generated/api_pb2.pyi +956 -956
- scalebox/generated/api_pb2_connect.py +1407 -1407
- scalebox/generated/rpc.py +50 -50
- scalebox/sandbox/main.py +146 -139
- scalebox/sandbox/sandbox_api.py +105 -91
- scalebox/sandbox/signature.py +40 -40
- scalebox/sandbox/utils.py +34 -34
- scalebox/sandbox_async/main.py +226 -44
- scalebox/sandbox_async/sandbox_api.py +124 -3
- scalebox/sandbox_sync/main.py +205 -130
- scalebox/sandbox_sync/sandbox_api.py +119 -3
- scalebox/test/CODE_INTERPRETER_TESTS_READY.md +323 -323
- scalebox/test/README.md +329 -329
- scalebox/test/bedrock_openai_adapter.py +73 -0
- scalebox/test/code_interpreter_test.py +34 -34
- scalebox/test/code_interpreter_test_sync.py +34 -34
- scalebox/test/run_stress_code_interpreter_sync.py +178 -0
- scalebox/test/simple_upload_example.py +131 -0
- scalebox/test/stabitiy_test.py +323 -0
- scalebox/test/test_browser_use.py +27 -0
- scalebox/test/test_browser_use_scalebox.py +62 -0
- scalebox/test/test_code_interpreter_execcode.py +289 -211
- scalebox/test/test_code_interpreter_sync_comprehensive.py +116 -69
- scalebox/test/test_connect_pause_async.py +300 -0
- scalebox/test/test_connect_pause_sync.py +300 -0
- scalebox/test/test_csx_desktop_examples.py +3 -3
- scalebox/test/test_desktop_sandbox_sf.py +112 -0
- scalebox/test/test_download_url.py +41 -0
- scalebox/test/test_existing_sandbox.py +1037 -0
- scalebox/test/test_sandbox_async_comprehensive.py +5 -3
- scalebox/test/test_sandbox_object_storage_example.py +151 -0
- scalebox/test/test_sandbox_object_storage_example_async.py +159 -0
- scalebox/test/test_sandbox_sync_comprehensive.py +1 -1
- scalebox/test/test_sf.py +141 -0
- scalebox/test/test_watch_dir_async.py +58 -0
- scalebox/test/testacreate.py +1 -1
- scalebox/test/testagetinfo.py +1 -3
- scalebox/test/testcomputeuse.py +243 -243
- scalebox/test/testsandbox_api.py +5 -5
- scalebox/test/testsandbox_async.py +17 -47
- scalebox/test/testsandbox_sync.py +19 -15
- scalebox/test/upload_100mb_example.py +377 -0
- scalebox/utils/httpcoreclient.py +297 -297
- scalebox/utils/httpxclient.py +403 -403
- scalebox/version.py +2 -2
- {scalebox_sdk-0.1.25.dist-info → scalebox_sdk-1.0.2.dist-info}/METADATA +1 -1
- {scalebox_sdk-0.1.25.dist-info → scalebox_sdk-1.0.2.dist-info}/RECORD +78 -60
- {scalebox_sdk-0.1.25.dist-info → scalebox_sdk-1.0.2.dist-info}/WHEEL +1 -1
- {scalebox_sdk-0.1.25.dist-info → scalebox_sdk-1.0.2.dist-info}/entry_points.txt +0 -0
- {scalebox_sdk-0.1.25.dist-info → scalebox_sdk-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {scalebox_sdk-0.1.25.dist-info → scalebox_sdk-1.0.2.dist-info}/top_level.txt +0 -0
|
@@ -1,230 +1,230 @@
|
|
|
1
|
-
import enum
|
|
2
|
-
from typing import Any, List, Optional, Tuple, Union
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class ChartType(str, enum.Enum):
|
|
6
|
-
"""
|
|
7
|
-
Chart types
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
LINE = "line"
|
|
11
|
-
SCATTER = "scatter"
|
|
12
|
-
BAR = "bar"
|
|
13
|
-
PIE = "pie"
|
|
14
|
-
BOX_AND_WHISKER = "box_and_whisker"
|
|
15
|
-
SUPERCHART = "superchart"
|
|
16
|
-
UNKNOWN = "unknown"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class ScaleType(str, enum.Enum):
|
|
20
|
-
"""
|
|
21
|
-
Ax scale types
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
LINEAR = "linear"
|
|
25
|
-
DATETIME = "datetime"
|
|
26
|
-
CATEGORICAL = "categorical"
|
|
27
|
-
LOG = "log"
|
|
28
|
-
SYMLOG = "symlog"
|
|
29
|
-
LOGIT = "logit"
|
|
30
|
-
FUNCTION = "function"
|
|
31
|
-
FUNCTIONLOG = "functionlog"
|
|
32
|
-
ASINH = "asinh"
|
|
33
|
-
UNKNOWN = "unknown"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class Chart:
|
|
37
|
-
"""
|
|
38
|
-
Extracted data from a chart. It's useful for building an interactive charts or custom visualizations.
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
type: ChartType
|
|
42
|
-
title: str
|
|
43
|
-
|
|
44
|
-
elements: List[Any]
|
|
45
|
-
|
|
46
|
-
def __init__(self, **kwargs) -> None:
|
|
47
|
-
self._raw_data = kwargs
|
|
48
|
-
self.type = ChartType(kwargs["type"] or ChartType.UNKNOWN)
|
|
49
|
-
self.title = kwargs["title"]
|
|
50
|
-
self.elements = kwargs["elements"]
|
|
51
|
-
|
|
52
|
-
def to_dict(self) -> dict:
|
|
53
|
-
return self._raw_data
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class Chart2D(Chart):
|
|
57
|
-
x_label: Optional[str]
|
|
58
|
-
y_label: Optional[str]
|
|
59
|
-
x_unit: Optional[str]
|
|
60
|
-
y_unit: Optional[str]
|
|
61
|
-
|
|
62
|
-
def __init__(self, **kwargs) -> None:
|
|
63
|
-
super().__init__(**kwargs)
|
|
64
|
-
self.x_label = kwargs["x_label"]
|
|
65
|
-
self.y_label = kwargs["y_label"]
|
|
66
|
-
self.x_unit = kwargs["x_unit"]
|
|
67
|
-
self.y_unit = kwargs["y_unit"]
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class PointData:
|
|
71
|
-
label: str
|
|
72
|
-
points: List[Tuple[Union[str, float], Union[str, float]]]
|
|
73
|
-
|
|
74
|
-
def __init__(self, **kwargs) -> None:
|
|
75
|
-
self.label = kwargs["label"]
|
|
76
|
-
self.points = [(x, y) for x, y in kwargs["points"]]
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class PointChart(Chart2D):
|
|
80
|
-
x_ticks: List[Union[str, float]]
|
|
81
|
-
x_tick_labels: List[str]
|
|
82
|
-
x_scale: ScaleType
|
|
83
|
-
|
|
84
|
-
y_ticks: List[Union[str, float]]
|
|
85
|
-
y_tick_labels: List[str]
|
|
86
|
-
y_scale: ScaleType
|
|
87
|
-
|
|
88
|
-
elements: List[PointData]
|
|
89
|
-
|
|
90
|
-
def __init__(self, **kwargs) -> None:
|
|
91
|
-
super().__init__(**kwargs)
|
|
92
|
-
self.x_label = kwargs["x_label"]
|
|
93
|
-
|
|
94
|
-
try:
|
|
95
|
-
self.x_scale = ScaleType(kwargs.get("x_scale"))
|
|
96
|
-
except ValueError:
|
|
97
|
-
self.x_scale = ScaleType.UNKNOWN
|
|
98
|
-
|
|
99
|
-
self.x_ticks = kwargs["x_ticks"]
|
|
100
|
-
self.x_tick_labels = kwargs["x_tick_labels"]
|
|
101
|
-
|
|
102
|
-
self.y_label = kwargs["y_label"]
|
|
103
|
-
|
|
104
|
-
try:
|
|
105
|
-
self.y_scale = ScaleType(kwargs.get("y_scale"))
|
|
106
|
-
except ValueError:
|
|
107
|
-
self.y_scale = ScaleType.UNKNOWN
|
|
108
|
-
|
|
109
|
-
self.y_ticks = kwargs["y_ticks"]
|
|
110
|
-
self.y_tick_labels = kwargs["y_tick_labels"]
|
|
111
|
-
|
|
112
|
-
self.elements = [PointData(**d) for d in kwargs["elements"]]
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
class LineChart(PointChart):
|
|
116
|
-
type = ChartType.LINE
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
class ScatterChart(PointChart):
|
|
120
|
-
type = ChartType.SCATTER
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
class BarData:
|
|
124
|
-
label: str
|
|
125
|
-
group: str
|
|
126
|
-
value: str
|
|
127
|
-
|
|
128
|
-
def __init__(self, **kwargs) -> None:
|
|
129
|
-
self.label = kwargs["label"]
|
|
130
|
-
self.value = kwargs["value"]
|
|
131
|
-
self.group = kwargs["group"]
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class BarChart(Chart2D):
|
|
135
|
-
type = ChartType.BAR
|
|
136
|
-
|
|
137
|
-
elements: List[BarData]
|
|
138
|
-
|
|
139
|
-
def __init__(self, **kwargs) -> None:
|
|
140
|
-
super().__init__(**kwargs)
|
|
141
|
-
self.elements = [BarData(**d) for d in kwargs["elements"]]
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
class PieData:
|
|
145
|
-
label: str
|
|
146
|
-
angle: float
|
|
147
|
-
radius: float
|
|
148
|
-
|
|
149
|
-
def __init__(self, **kwargs) -> None:
|
|
150
|
-
self.label = kwargs["label"]
|
|
151
|
-
self.angle = kwargs["angle"]
|
|
152
|
-
self.radius = kwargs["radius"]
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
class PieChart(Chart):
|
|
156
|
-
type = ChartType.PIE
|
|
157
|
-
|
|
158
|
-
elements: List[PieData]
|
|
159
|
-
|
|
160
|
-
def __init__(self, **kwargs) -> None:
|
|
161
|
-
super().__init__(**kwargs)
|
|
162
|
-
self.elements = [PieData(**d) for d in kwargs["elements"]]
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
class BoxAndWhiskerData:
|
|
166
|
-
label: str
|
|
167
|
-
min: float
|
|
168
|
-
first_quartile: float
|
|
169
|
-
median: float
|
|
170
|
-
third_quartile: float
|
|
171
|
-
max: float
|
|
172
|
-
outliers: List[float]
|
|
173
|
-
|
|
174
|
-
def __init__(self, **kwargs) -> None:
|
|
175
|
-
self.label = kwargs["label"]
|
|
176
|
-
self.min = kwargs["min"]
|
|
177
|
-
self.first_quartile = kwargs["first_quartile"]
|
|
178
|
-
self.median = kwargs["median"]
|
|
179
|
-
self.third_quartile = kwargs["third_quartile"]
|
|
180
|
-
self.max = kwargs["max"]
|
|
181
|
-
self.outliers = kwargs.get("outliers") or []
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
class BoxAndWhiskerChart(Chart2D):
|
|
185
|
-
type = ChartType.BOX_AND_WHISKER
|
|
186
|
-
|
|
187
|
-
elements: List[BoxAndWhiskerData]
|
|
188
|
-
|
|
189
|
-
def __init__(self, **kwargs) -> None:
|
|
190
|
-
super().__init__(**kwargs)
|
|
191
|
-
self.elements = [BoxAndWhiskerData(**d) for d in kwargs["elements"]]
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
class SuperChart(Chart):
|
|
195
|
-
type = ChartType.SUPERCHART
|
|
196
|
-
|
|
197
|
-
elements: List[
|
|
198
|
-
Union[LineChart, ScatterChart, BarChart, PieChart, BoxAndWhiskerChart]
|
|
199
|
-
]
|
|
200
|
-
|
|
201
|
-
def __init__(self, **kwargs) -> None:
|
|
202
|
-
super().__init__(**kwargs)
|
|
203
|
-
self.elements = [_deserialize_chart(g) for g in kwargs["elements"]]
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
ChartTypes = Union[
|
|
207
|
-
LineChart, ScatterChart, BarChart, PieChart, BoxAndWhiskerChart, SuperChart
|
|
208
|
-
]
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def _deserialize_chart(data: Optional[dict]) -> Optional[ChartTypes]:
|
|
212
|
-
if not data:
|
|
213
|
-
return None
|
|
214
|
-
|
|
215
|
-
if data["type"] == ChartType.LINE:
|
|
216
|
-
chart = LineChart(**data)
|
|
217
|
-
elif data["type"] == ChartType.SCATTER:
|
|
218
|
-
chart = ScatterChart(**data)
|
|
219
|
-
elif data["type"] == ChartType.BAR:
|
|
220
|
-
chart = BarChart(**data)
|
|
221
|
-
elif data["type"] == ChartType.PIE:
|
|
222
|
-
chart = PieChart(**data)
|
|
223
|
-
elif data["type"] == ChartType.BOX_AND_WHISKER:
|
|
224
|
-
chart = BoxAndWhiskerChart(**data)
|
|
225
|
-
elif data["type"] == ChartType.SUPERCHART:
|
|
226
|
-
chart = SuperChart(**data)
|
|
227
|
-
else:
|
|
228
|
-
chart = Chart(**data)
|
|
229
|
-
|
|
230
|
-
return chart
|
|
1
|
+
import enum
|
|
2
|
+
from typing import Any, List, Optional, Tuple, Union
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ChartType(str, enum.Enum):
|
|
6
|
+
"""
|
|
7
|
+
Chart types
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
LINE = "line"
|
|
11
|
+
SCATTER = "scatter"
|
|
12
|
+
BAR = "bar"
|
|
13
|
+
PIE = "pie"
|
|
14
|
+
BOX_AND_WHISKER = "box_and_whisker"
|
|
15
|
+
SUPERCHART = "superchart"
|
|
16
|
+
UNKNOWN = "unknown"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ScaleType(str, enum.Enum):
|
|
20
|
+
"""
|
|
21
|
+
Ax scale types
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
LINEAR = "linear"
|
|
25
|
+
DATETIME = "datetime"
|
|
26
|
+
CATEGORICAL = "categorical"
|
|
27
|
+
LOG = "log"
|
|
28
|
+
SYMLOG = "symlog"
|
|
29
|
+
LOGIT = "logit"
|
|
30
|
+
FUNCTION = "function"
|
|
31
|
+
FUNCTIONLOG = "functionlog"
|
|
32
|
+
ASINH = "asinh"
|
|
33
|
+
UNKNOWN = "unknown"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Chart:
|
|
37
|
+
"""
|
|
38
|
+
Extracted data from a chart. It's useful for building an interactive charts or custom visualizations.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
type: ChartType
|
|
42
|
+
title: str
|
|
43
|
+
|
|
44
|
+
elements: List[Any]
|
|
45
|
+
|
|
46
|
+
def __init__(self, **kwargs) -> None:
|
|
47
|
+
self._raw_data = kwargs
|
|
48
|
+
self.type = ChartType(kwargs["type"] or ChartType.UNKNOWN)
|
|
49
|
+
self.title = kwargs["title"]
|
|
50
|
+
self.elements = kwargs["elements"]
|
|
51
|
+
|
|
52
|
+
def to_dict(self) -> dict:
|
|
53
|
+
return self._raw_data
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Chart2D(Chart):
|
|
57
|
+
x_label: Optional[str]
|
|
58
|
+
y_label: Optional[str]
|
|
59
|
+
x_unit: Optional[str]
|
|
60
|
+
y_unit: Optional[str]
|
|
61
|
+
|
|
62
|
+
def __init__(self, **kwargs) -> None:
|
|
63
|
+
super().__init__(**kwargs)
|
|
64
|
+
self.x_label = kwargs["x_label"]
|
|
65
|
+
self.y_label = kwargs["y_label"]
|
|
66
|
+
self.x_unit = kwargs["x_unit"]
|
|
67
|
+
self.y_unit = kwargs["y_unit"]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class PointData:
|
|
71
|
+
label: str
|
|
72
|
+
points: List[Tuple[Union[str, float], Union[str, float]]]
|
|
73
|
+
|
|
74
|
+
def __init__(self, **kwargs) -> None:
|
|
75
|
+
self.label = kwargs["label"]
|
|
76
|
+
self.points = [(x, y) for x, y in kwargs["points"]]
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class PointChart(Chart2D):
|
|
80
|
+
x_ticks: List[Union[str, float]]
|
|
81
|
+
x_tick_labels: List[str]
|
|
82
|
+
x_scale: ScaleType
|
|
83
|
+
|
|
84
|
+
y_ticks: List[Union[str, float]]
|
|
85
|
+
y_tick_labels: List[str]
|
|
86
|
+
y_scale: ScaleType
|
|
87
|
+
|
|
88
|
+
elements: List[PointData]
|
|
89
|
+
|
|
90
|
+
def __init__(self, **kwargs) -> None:
|
|
91
|
+
super().__init__(**kwargs)
|
|
92
|
+
self.x_label = kwargs["x_label"]
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
self.x_scale = ScaleType(kwargs.get("x_scale"))
|
|
96
|
+
except ValueError:
|
|
97
|
+
self.x_scale = ScaleType.UNKNOWN
|
|
98
|
+
|
|
99
|
+
self.x_ticks = kwargs["x_ticks"]
|
|
100
|
+
self.x_tick_labels = kwargs["x_tick_labels"]
|
|
101
|
+
|
|
102
|
+
self.y_label = kwargs["y_label"]
|
|
103
|
+
|
|
104
|
+
try:
|
|
105
|
+
self.y_scale = ScaleType(kwargs.get("y_scale"))
|
|
106
|
+
except ValueError:
|
|
107
|
+
self.y_scale = ScaleType.UNKNOWN
|
|
108
|
+
|
|
109
|
+
self.y_ticks = kwargs["y_ticks"]
|
|
110
|
+
self.y_tick_labels = kwargs["y_tick_labels"]
|
|
111
|
+
|
|
112
|
+
self.elements = [PointData(**d) for d in kwargs["elements"]]
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class LineChart(PointChart):
|
|
116
|
+
type = ChartType.LINE
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class ScatterChart(PointChart):
|
|
120
|
+
type = ChartType.SCATTER
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class BarData:
|
|
124
|
+
label: str
|
|
125
|
+
group: str
|
|
126
|
+
value: str
|
|
127
|
+
|
|
128
|
+
def __init__(self, **kwargs) -> None:
|
|
129
|
+
self.label = kwargs["label"]
|
|
130
|
+
self.value = kwargs["value"]
|
|
131
|
+
self.group = kwargs["group"]
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class BarChart(Chart2D):
|
|
135
|
+
type = ChartType.BAR
|
|
136
|
+
|
|
137
|
+
elements: List[BarData]
|
|
138
|
+
|
|
139
|
+
def __init__(self, **kwargs) -> None:
|
|
140
|
+
super().__init__(**kwargs)
|
|
141
|
+
self.elements = [BarData(**d) for d in kwargs["elements"]]
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class PieData:
|
|
145
|
+
label: str
|
|
146
|
+
angle: float
|
|
147
|
+
radius: float
|
|
148
|
+
|
|
149
|
+
def __init__(self, **kwargs) -> None:
|
|
150
|
+
self.label = kwargs["label"]
|
|
151
|
+
self.angle = kwargs["angle"]
|
|
152
|
+
self.radius = kwargs["radius"]
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class PieChart(Chart):
|
|
156
|
+
type = ChartType.PIE
|
|
157
|
+
|
|
158
|
+
elements: List[PieData]
|
|
159
|
+
|
|
160
|
+
def __init__(self, **kwargs) -> None:
|
|
161
|
+
super().__init__(**kwargs)
|
|
162
|
+
self.elements = [PieData(**d) for d in kwargs["elements"]]
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class BoxAndWhiskerData:
|
|
166
|
+
label: str
|
|
167
|
+
min: float
|
|
168
|
+
first_quartile: float
|
|
169
|
+
median: float
|
|
170
|
+
third_quartile: float
|
|
171
|
+
max: float
|
|
172
|
+
outliers: List[float]
|
|
173
|
+
|
|
174
|
+
def __init__(self, **kwargs) -> None:
|
|
175
|
+
self.label = kwargs["label"]
|
|
176
|
+
self.min = kwargs["min"]
|
|
177
|
+
self.first_quartile = kwargs["first_quartile"]
|
|
178
|
+
self.median = kwargs["median"]
|
|
179
|
+
self.third_quartile = kwargs["third_quartile"]
|
|
180
|
+
self.max = kwargs["max"]
|
|
181
|
+
self.outliers = kwargs.get("outliers") or []
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class BoxAndWhiskerChart(Chart2D):
|
|
185
|
+
type = ChartType.BOX_AND_WHISKER
|
|
186
|
+
|
|
187
|
+
elements: List[BoxAndWhiskerData]
|
|
188
|
+
|
|
189
|
+
def __init__(self, **kwargs) -> None:
|
|
190
|
+
super().__init__(**kwargs)
|
|
191
|
+
self.elements = [BoxAndWhiskerData(**d) for d in kwargs["elements"]]
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class SuperChart(Chart):
|
|
195
|
+
type = ChartType.SUPERCHART
|
|
196
|
+
|
|
197
|
+
elements: List[
|
|
198
|
+
Union[LineChart, ScatterChart, BarChart, PieChart, BoxAndWhiskerChart]
|
|
199
|
+
]
|
|
200
|
+
|
|
201
|
+
def __init__(self, **kwargs) -> None:
|
|
202
|
+
super().__init__(**kwargs)
|
|
203
|
+
self.elements = [_deserialize_chart(g) for g in kwargs["elements"]]
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
ChartTypes = Union[
|
|
207
|
+
LineChart, ScatterChart, BarChart, PieChart, BoxAndWhiskerChart, SuperChart
|
|
208
|
+
]
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def _deserialize_chart(data: Optional[dict]) -> Optional[ChartTypes]:
|
|
212
|
+
if not data:
|
|
213
|
+
return None
|
|
214
|
+
|
|
215
|
+
if data["type"] == ChartType.LINE:
|
|
216
|
+
chart = LineChart(**data)
|
|
217
|
+
elif data["type"] == ChartType.SCATTER:
|
|
218
|
+
chart = ScatterChart(**data)
|
|
219
|
+
elif data["type"] == ChartType.BAR:
|
|
220
|
+
chart = BarChart(**data)
|
|
221
|
+
elif data["type"] == ChartType.PIE:
|
|
222
|
+
chart = PieChart(**data)
|
|
223
|
+
elif data["type"] == ChartType.BOX_AND_WHISKER:
|
|
224
|
+
chart = BoxAndWhiskerChart(**data)
|
|
225
|
+
elif data["type"] == ChartType.SUPERCHART:
|
|
226
|
+
chart = SuperChart(**data)
|
|
227
|
+
else:
|
|
228
|
+
chart = Chart(**data)
|
|
229
|
+
|
|
230
|
+
return chart
|
|
@@ -365,6 +365,8 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
365
365
|
# headers = {
|
|
366
366
|
# "Authorization": "Bearer root",
|
|
367
367
|
# }
|
|
368
|
-
await client.destroy_context(
|
|
368
|
+
await client.destroy_context(
|
|
369
|
+
destroy_context_request, extra_headers=self.connection_config.headers
|
|
370
|
+
)
|
|
369
371
|
except Exception as e:
|
|
370
372
|
logger.warning(f"Failed to destroy context {context.id}: {e}")
|
|
@@ -312,7 +312,9 @@ class Sandbox(BaseSandbox):
|
|
|
312
312
|
# headers = {
|
|
313
313
|
# "Authorization": "Bearer root",
|
|
314
314
|
# }
|
|
315
|
-
client.destroy_context(
|
|
315
|
+
client.destroy_context(
|
|
316
|
+
destroy_context_request, extra_headers=self.connection_config.headers
|
|
317
|
+
)
|
|
316
318
|
|
|
317
319
|
except Exception as e:
|
|
318
320
|
logger.warning(f"Failed to destroy context {context.id}: {e}")
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
DEFAULT_TEMPLATE = "code-interpreter"
|
|
2
|
-
JUPYTER_PORT = 32000
|
|
3
|
-
DEFAULT_TIMEOUT = 300
|
|
1
|
+
DEFAULT_TEMPLATE = "code-interpreter"
|
|
2
|
+
JUPYTER_PORT = 32000
|
|
3
|
+
DEFAULT_TIMEOUT = 300
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
from ..exceptions import TimeoutException
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def format_request_timeout_error() -> Exception:
|
|
5
|
-
return TimeoutException(
|
|
6
|
-
f"Request timed out — the 'request_timeout' option can be used to increase this timeout",
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def format_execution_timeout_error() -> Exception:
|
|
11
|
-
return TimeoutException(
|
|
12
|
-
f"Execution timed out — the 'timeout' option can be used to increase this timeout",
|
|
13
|
-
)
|
|
1
|
+
from ..exceptions import TimeoutException
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def format_request_timeout_error() -> Exception:
|
|
5
|
+
return TimeoutException(
|
|
6
|
+
f"Request timed out — the 'request_timeout' option can be used to increase this timeout",
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def format_execution_timeout_error() -> Exception:
|
|
11
|
+
return TimeoutException(
|
|
12
|
+
f"Execution timed out — the 'timeout' option can be used to increase this timeout",
|
|
13
|
+
)
|