Skip to content

Commit 1395b6e

Browse files
committed
Make optional
1 parent b0a2e7d commit 1395b6e

5 files changed

Lines changed: 42 additions & 42 deletions

File tree

packages/python-sdk/e2b/connection_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ApiParams(TypedDict):
2222
request_timeout: Optional[float]
2323
"""Timeout for the request in **seconds**, defaults to 60 seconds."""
2424

25-
headers: Dict[str, str]
25+
headers: Optional[Dict[str, str]]
2626
"""Additional headers to send with the request."""
2727

2828
api_key: Optional[str]
@@ -113,7 +113,7 @@ def get_request_timeout(self, request_timeout: Optional[float] = None):
113113

114114
def get_api_params(
115115
self,
116-
**opts: Unpack[ApiParams],
116+
**opts: Optional[Unpack[ApiParams]],
117117
) -> dict:
118118
"""
119119
Get the parameters for the API call.

packages/python-sdk/e2b/sandbox_async/main.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ async def create(
167167
envs: Optional[Dict[str, str]] = None,
168168
secure: Optional[bool] = None,
169169
allow_internet_access: Optional[bool] = True,
170-
**opts: Unpack[ApiParams],
170+
**opts: Optional[Unpack[ApiParams]],
171171
):
172172
"""
173173
Create a new sandbox.
@@ -233,7 +233,7 @@ async def create(
233233
async def connect(
234234
cls,
235235
sandbox_id: str,
236-
**opts: Unpack[ApiParams],
236+
**opts: Optional[Unpack[ApiParams]],
237237
):
238238
"""
239239
Connect to an existing sandbox.
@@ -281,7 +281,7 @@ async def __aexit__(self, exc_type, exc_value, traceback):
281281
@overload
282282
async def kill(
283283
self,
284-
**opts: Unpack[ApiParams],
284+
**opts: Optional[Unpack[ApiParams]],
285285
) -> bool:
286286
"""
287287
Kill the sandbox.
@@ -294,7 +294,7 @@ async def kill(
294294
@staticmethod
295295
async def kill(
296296
sandbox_id: str,
297-
**opts: Unpack[ApiParams],
297+
**opts: Optional[Unpack[ApiParams]],
298298
) -> bool:
299299
"""
300300
Kill the sandbox specified by sandbox ID.
@@ -308,7 +308,7 @@ async def kill(
308308
@class_method_variant("_cls_kill")
309309
async def kill(
310310
self,
311-
**opts: Unpack[ApiParams],
311+
**opts: Optional[Unpack[ApiParams]],
312312
) -> bool:
313313
"""
314314
Kill the sandbox specified by sandbox ID.
@@ -324,7 +324,7 @@ async def kill(
324324
async def set_timeout(
325325
self,
326326
timeout: int,
327-
**opts: Unpack[ApiParams],
327+
**opts: Optional[Unpack[ApiParams]],
328328
) -> None:
329329
"""
330330
Set the timeout of the sandbox.
@@ -342,7 +342,7 @@ async def set_timeout(
342342
async def set_timeout(
343343
sandbox_id: str,
344344
timeout: int,
345-
**opts: Unpack[ApiParams],
345+
**opts: Optional[Unpack[ApiParams]],
346346
) -> None:
347347
"""
348348
Set the timeout of the specified sandbox.
@@ -360,7 +360,7 @@ async def set_timeout(
360360
async def set_timeout( # type: ignore
361361
self,
362362
timeout: int,
363-
**opts: Unpack[ApiParams],
363+
**opts: Optional[Unpack[ApiParams]],
364364
) -> None:
365365
"""
366366
Set the timeout of the specified sandbox.
@@ -380,7 +380,7 @@ async def set_timeout( # type: ignore
380380
@overload
381381
async def get_info(
382382
self,
383-
**opts: Unpack[ApiParams],
383+
**opts: Optional[Unpack[ApiParams]],
384384
) -> SandboxInfo:
385385
"""
386386
Get sandbox information like sandbox ID, template, metadata, started at/end at date.
@@ -393,7 +393,7 @@ async def get_info(
393393
@staticmethod
394394
async def get_info(
395395
sandbox_id: str,
396-
**opts: Unpack[ApiParams],
396+
**opts: Optional[Unpack[ApiParams]],
397397
) -> SandboxInfo:
398398
"""
399399
Get sandbox information like sandbox ID, template, metadata, started at/end at date.
@@ -406,7 +406,7 @@ async def get_info(
406406
@class_method_variant("_cls_get_info")
407407
async def get_info( # type: ignore
408408
self,
409-
**opts: Unpack[ApiParams],
409+
**opts: Optional[Unpack[ApiParams]],
410410
) -> SandboxInfo:
411411
"""
412412
Get sandbox information like sandbox ID, template, metadata, started at/end at date.
@@ -424,7 +424,7 @@ async def get_metrics( # type: ignore
424424
self,
425425
start: Optional[datetime.datetime] = None,
426426
end: Optional[datetime.datetime] = None,
427-
**opts: Unpack[ApiParams],
427+
**opts: Optional[Unpack[ApiParams]],
428428
) -> List[SandboxMetrics]:
429429
"""
430430
Get the metrics of the current sandbox.
@@ -442,7 +442,7 @@ async def get_metrics(
442442
sandbox_id: str,
443443
start: Optional[datetime.datetime] = None,
444444
end: Optional[datetime.datetime] = None,
445-
**opts: Unpack[ApiParams],
445+
**opts: Optional[Unpack[ApiParams]],
446446
) -> List[SandboxMetrics]:
447447
"""
448448
Get the metrics of the sandbox specified by sandbox ID.
@@ -460,7 +460,7 @@ async def get_metrics( # type: ignore
460460
self,
461461
start: Optional[datetime.datetime] = None,
462462
end: Optional[datetime.datetime] = None,
463-
**opts: Unpack[ApiParams],
463+
**opts: Optional[Unpack[ApiParams]],
464464
) -> List[SandboxMetrics]:
465465
"""
466466
Get the metrics of the current sandbox.

packages/python-sdk/e2b/sandbox_async/sandbox_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SandboxApi(SandboxApiBase):
3636
async def list(
3737
cls,
3838
query: Optional[SandboxQuery] = None,
39-
**opts: Unpack[ApiParams],
39+
**opts: Optional[Unpack[ApiParams]],
4040
) -> List[ListedSandbox]:
4141
"""
4242
List all running sandboxes.
@@ -93,7 +93,7 @@ async def list(
9393
async def _cls_get_info(
9494
cls,
9595
sandbox_id: str,
96-
**opts: Unpack[ApiParams],
96+
**opts: Optional[Unpack[ApiParams]],
9797
) -> SandboxInfo:
9898
"""
9999
Get the sandbox info.
@@ -136,7 +136,7 @@ async def _cls_get_info(
136136
async def _cls_kill(
137137
cls,
138138
sandbox_id: str,
139-
**opts: Unpack[ApiParams],
139+
**opts: Optional[Unpack[ApiParams]],
140140
) -> bool:
141141
config = ConnectionConfig(**opts)
142142

@@ -166,7 +166,7 @@ async def _cls_set_timeout(
166166
cls,
167167
sandbox_id: str,
168168
timeout: int,
169-
**opts: Unpack[ApiParams],
169+
**opts: Optional[Unpack[ApiParams]],
170170
) -> None:
171171
config = ConnectionConfig(**opts)
172172

@@ -196,7 +196,7 @@ async def _create_sandbox(
196196
env_vars: Optional[Dict[str, str]] = None,
197197
secure: Optional[bool] = None,
198198
allow_internet_access: Optional[bool] = True,
199-
**opts: Unpack[ApiParams],
199+
**opts: Optional[Unpack[ApiParams]],
200200
) -> SandboxCreateResponse:
201201
config = ConnectionConfig(**opts)
202202

@@ -242,7 +242,7 @@ async def _cls_get_metrics(
242242
sandbox_id: str,
243243
start: Optional[datetime.datetime] = None,
244244
end: Optional[datetime.datetime] = None,
245-
**opts: Unpack[ApiParams],
245+
**opts: Optional[Unpack[ApiParams]],
246246
) -> List[SandboxMetrics]:
247247
"""
248248
Get the metrics of the sandbox specified by sandbox ID.

packages/python-sdk/e2b/sandbox_sync/main.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
secure: Optional[bool] = None,
9292
allow_internet_access: Optional[bool] = True,
9393
_sandbox_id: Optional[str] = None,
94-
**opts: Unpack[ApiParams],
94+
**opts: Optional[Unpack[ApiParams]],
9595
):
9696
"""
9797
Create a new sandbox.
@@ -241,7 +241,7 @@ def is_running(self, request_timeout: Optional[float] = None) -> bool:
241241
def connect(
242242
cls,
243243
sandbox_id: str,
244-
**opts: Unpack[ApiParams],
244+
**opts: Optional[Unpack[ApiParams]],
245245
):
246246
"""
247247
Connect to an existing sandbox.
@@ -273,7 +273,7 @@ def __exit__(self, exc_type, exc_value, traceback):
273273
@overload
274274
def kill(
275275
self,
276-
**opts: Unpack[ApiParams],
276+
**opts: Optional[Unpack[ApiParams]],
277277
) -> bool:
278278
"""
279279
Kill the sandbox.
@@ -286,7 +286,7 @@ def kill(
286286
@staticmethod
287287
def kill(
288288
sandbox_id: str,
289-
**opts: Unpack[ApiParams],
289+
**opts: Optional[Unpack[ApiParams]],
290290
) -> bool:
291291
"""
292292
Kill the sandbox specified by sandbox ID.
@@ -300,7 +300,7 @@ def kill(
300300
@class_method_variant("_cls_kill")
301301
def kill(
302302
self,
303-
**opts: Unpack[ApiParams],
303+
**opts: Optional[Unpack[ApiParams]],
304304
) -> bool:
305305
"""
306306
Kill the sandbox specified by sandbox ID.
@@ -316,7 +316,7 @@ def kill(
316316
def set_timeout(
317317
self,
318318
timeout: int,
319-
**opts: Unpack[ApiParams],
319+
**opts: Optional[Unpack[ApiParams]],
320320
) -> None:
321321
"""
322322
Set the timeout of the sandbox.
@@ -334,7 +334,7 @@ def set_timeout(
334334
def set_timeout(
335335
sandbox_id: str,
336336
timeout: int,
337-
**opts: Unpack[ApiParams],
337+
**opts: Optional[Unpack[ApiParams]],
338338
) -> None:
339339
"""
340340
Set the timeout of the sandbox specified by sandbox ID.
@@ -352,7 +352,7 @@ def set_timeout(
352352
def set_timeout( # type: ignore
353353
self,
354354
timeout: int,
355-
**opts: Unpack[ApiParams],
355+
**opts: Optional[Unpack[ApiParams]],
356356
) -> None:
357357
"""
358358
Set the timeout of the sandbox.
@@ -374,7 +374,7 @@ def set_timeout( # type: ignore
374374
@overload
375375
def get_info(
376376
self,
377-
**opts: Unpack[ApiParams],
377+
**opts: Optional[Unpack[ApiParams]],
378378
) -> SandboxInfo:
379379
"""
380380
Get sandbox information like sandbox ID, template, metadata, started at/end at date.
@@ -387,7 +387,7 @@ def get_info(
387387
@staticmethod
388388
def get_info(
389389
sandbox_id: str,
390-
**opts: Unpack[ApiParams],
390+
**opts: Optional[Unpack[ApiParams]],
391391
) -> SandboxInfo:
392392
"""
393393
Get sandbox information like sandbox ID, template, metadata, started at/end at date.
@@ -401,7 +401,7 @@ def get_info(
401401
@class_method_variant("_cls_get_info")
402402
def get_info( # type: ignore
403403
self,
404-
**opts: Unpack[ApiParams],
404+
**opts: Optional[Unpack[ApiParams]],
405405
) -> SandboxInfo:
406406
"""
407407
Get sandbox information like sandbox ID, template, metadata, started at/end at date.
@@ -418,7 +418,7 @@ def get_metrics( # type: ignore
418418
self,
419419
start: Optional[datetime.datetime] = None,
420420
end: Optional[datetime.datetime] = None,
421-
**opts: Unpack[ApiParams],
421+
**opts: Optional[Unpack[ApiParams]],
422422
) -> List[SandboxMetrics]:
423423
"""
424424
Get the metrics of the current sandbox.
@@ -436,7 +436,7 @@ def get_metrics(
436436
sandbox_id: str,
437437
start: Optional[datetime.datetime] = None,
438438
end: Optional[datetime.datetime] = None,
439-
**opts: Unpack[ApiParams],
439+
**opts: Optional[Unpack[ApiParams]],
440440
) -> List[SandboxMetrics]:
441441
"""
442442
Get the metrics of the sandbox specified by sandbox ID.
@@ -454,7 +454,7 @@ def get_metrics(
454454
self,
455455
start: Optional[datetime.datetime] = None,
456456
end: Optional[datetime.datetime] = None,
457-
**opts: Unpack[ApiParams],
457+
**opts: Optional[Unpack[ApiParams]],
458458
) -> List[SandboxMetrics]:
459459
"""
460460
Get the metrics of the sandbox specified by sandbox ID.

packages/python-sdk/e2b/sandbox_sync/sandbox_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SandboxApi(SandboxApiBase):
3636
def list(
3737
cls,
3838
query: Optional[SandboxQuery] = None,
39-
**opts: Unpack[ApiParams],
39+
**opts: Optional[Unpack[ApiParams]],
4040
) -> List[ListedSandbox]:
4141
"""
4242
List all running sandboxes.
@@ -90,7 +90,7 @@ def list(
9090
def _cls_get_info(
9191
cls,
9292
sandbox_id: str,
93-
**opts: Unpack[ApiParams],
93+
**opts: Optional[Unpack[ApiParams]],
9494
) -> SandboxInfo:
9595
"""
9696
Get the sandbox info.
@@ -133,7 +133,7 @@ def _cls_get_info(
133133
def _cls_kill(
134134
cls,
135135
sandbox_id: str,
136-
**opts: Unpack[ApiParams],
136+
**opts: Optional[Unpack[ApiParams]],
137137
) -> bool:
138138
config = ConnectionConfig(**opts)
139139

@@ -163,7 +163,7 @@ def _cls_set_timeout(
163163
cls,
164164
sandbox_id: str,
165165
timeout: int,
166-
**opts: Unpack[ApiParams],
166+
**opts: Optional[Unpack[ApiParams]],
167167
) -> None:
168168
config = ConnectionConfig(**opts)
169169

@@ -193,7 +193,7 @@ def _create_sandbox(
193193
env_vars: Optional[Dict[str, str]] = None,
194194
secure: Optional[bool] = None,
195195
allow_internet_access: Optional[bool] = True,
196-
**opts: Unpack[ApiParams],
196+
**opts: Optional[Unpack[ApiParams]],
197197
) -> SandboxCreateResponse:
198198
config = ConnectionConfig(**opts)
199199

@@ -236,7 +236,7 @@ def _cls_get_metrics(
236236
sandbox_id: str,
237237
start: Optional[datetime.datetime] = None,
238238
end: Optional[datetime.datetime] = None,
239-
**opts: Unpack[ApiParams],
239+
**opts: Optional[Unpack[ApiParams]],
240240
) -> List[SandboxMetrics]:
241241
config = ConnectionConfig(**opts)
242242

0 commit comments

Comments
 (0)