Skip to content

Commit 27273f3

Browse files
committed
linting, formattting, and type checking changes
1 parent 6d5f1eb commit 27273f3

14 files changed

Lines changed: 124 additions & 113 deletions

src/runloop_api_client/resources/devboxes/disk_snapshots.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, Dict, Optional
5+
from typing import Dict, Optional
66

77
import httpx
88

@@ -17,13 +17,13 @@
1717
async_to_streamed_response_wrapper,
1818
)
1919
from ...pagination import SyncDiskSnapshotsCursorIDPage, AsyncDiskSnapshotsCursorIDPage
20+
from ..._exceptions import RunloopError
21+
from ...lib.polling import PollingConfig, poll_until
2022
from ..._base_client import AsyncPaginator, make_request_options
2123
from ...types.devboxes import disk_snapshot_list_params, disk_snapshot_update_params
24+
from ...lib.polling_async import async_poll_until
2225
from ...types.devbox_snapshot_view import DevboxSnapshotView
2326
from ...types.devboxes.devbox_snapshot_async_status_view import DevboxSnapshotAsyncStatusView
24-
from ..._exceptions import RunloopError
25-
from ...lib.polling import PollingConfig, poll_until
26-
from ...lib.polling_async import async_poll_until
2727

2828
__all__ = ["DiskSnapshotsResource", "AsyncDiskSnapshotsResource"]
2929

@@ -247,7 +247,10 @@ def await_completed(
247247
id: str,
248248
*,
249249
polling_config: PollingConfig | None = None,
250-
**request_options: Any,
250+
extra_headers: Headers | None = None,
251+
extra_query: Query | None = None,
252+
extra_body: Body | None = None,
253+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
251254
) -> DevboxSnapshotAsyncStatusView:
252255
"""Wait for a disk snapshot operation to complete."""
253256

@@ -257,7 +260,13 @@ def await_completed(
257260
def is_terminal(result: DevboxSnapshotAsyncStatusView) -> bool:
258261
return result.status in {"complete", "error"}
259262

260-
status = poll_until(lambda: self.query_status(id, **request_options), is_terminal, polling_config)
263+
status = poll_until(
264+
lambda: self.query_status(
265+
id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
266+
),
267+
is_terminal,
268+
polling_config,
269+
)
261270

262271
if status.status == "error":
263272
message = status.error_message or "Unknown error"
@@ -485,7 +494,10 @@ async def await_completed(
485494
id: str,
486495
*,
487496
polling_config: PollingConfig | None = None,
488-
**request_options: Any,
497+
extra_headers: Headers | None = None,
498+
extra_query: Query | None = None,
499+
extra_body: Body | None = None,
500+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
489501
) -> DevboxSnapshotAsyncStatusView:
490502
"""Wait asynchronously for a disk snapshot operation to complete."""
491503

@@ -496,7 +508,9 @@ def is_terminal(result: DevboxSnapshotAsyncStatusView) -> bool:
496508
return result.status in {"complete", "error"}
497509

498510
status = await async_poll_until(
499-
lambda: self.query_status(id, **request_options),
511+
lambda: self.query_status(
512+
id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
513+
),
500514
is_terminal,
501515
polling_config,
502516
)

src/runloop_api_client/sdk/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
from __future__ import annotations
22

33
from ._sync import RunloopSDK, DevboxClient, SnapshotClient, BlueprintClient, StorageObjectClient
4-
from ._async import AsyncRunloopSDK, AsyncDevboxClient, AsyncSnapshotClient, AsyncBlueprintClient, AsyncStorageObjectClient
4+
from ._async import (
5+
AsyncRunloopSDK,
6+
AsyncDevboxClient,
7+
AsyncSnapshotClient,
8+
AsyncBlueprintClient,
9+
AsyncStorageObjectClient,
10+
)
511
from .devbox import Devbox
612
from .snapshot import Snapshot
713
from .blueprint import Blueprint

src/runloop_api_client/sdk/_async.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
from __future__ import annotations
22

3+
from typing import Any, Dict, Literal, Mapping, Iterable, Optional
34
from pathlib import Path
4-
from typing import Any, Dict, Iterable, Literal, Mapping, Optional
55

66
import httpx
77

8+
from .._types import NOT_GIVEN, Body, Omit, Query, Headers, Timeout, NotGiven, SequenceNotStr, omit, not_given
89
from .._client import AsyncRunloop
9-
from .._types import Body, Headers, NotGiven, NOT_GIVEN, Omit, Query, SequenceNotStr, Timeout, not_given, omit
10+
from ._helpers import ContentType, detect_content_type
1011
from ..lib.polling import PollingConfig
11-
from ..types.shared_params.code_mount_parameters import CodeMountParameters
12-
from ..types.shared_params.launch_parameters import LaunchParameters
1312
from .async_devbox import AsyncDevbox
1413
from .async_snapshot import AsyncSnapshot
1514
from .async_blueprint import AsyncBlueprint
1615
from .async_storage_object import AsyncStorageObject
17-
from ._helpers import ContentType, detect_content_type
16+
from ..types.shared_params.launch_parameters import LaunchParameters
17+
from ..types.shared_params.code_mount_parameters import CodeMountParameters
1818

1919

2020
class AsyncDevboxClient:
@@ -433,7 +433,6 @@ def __init__(
433433
default_headers: Mapping[str, str] | None = None,
434434
default_query: Mapping[str, object] | None = None,
435435
http_client: httpx.AsyncClient | None = None,
436-
_strict_response_validation: bool = False,
437436
) -> None:
438437
if max_retries is None:
439438
self.api = AsyncRunloop(
@@ -443,7 +442,6 @@ def __init__(
443442
default_headers=default_headers,
444443
default_query=default_query,
445444
http_client=http_client,
446-
_strict_response_validation=_strict_response_validation,
447445
)
448446
else:
449447
self.api = AsyncRunloop(
@@ -454,7 +452,6 @@ def __init__(
454452
default_headers=default_headers,
455453
default_query=default_query,
456454
http_client=http_client,
457-
_strict_response_validation=_strict_response_validation,
458455
)
459456

460457
self.devbox = AsyncDevboxClient(self.api)

src/runloop_api_client/sdk/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import io
44
import os
5+
from typing import IO, Dict, Union, Literal, Callable, cast
56
from pathlib import Path
6-
from typing import IO, Callable, Dict, Literal, Union, cast
77

88
from .._types import FileTypes
99
from .._utils import file_from_path

src/runloop_api_client/sdk/_sync.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
from __future__ import annotations
22

3+
from typing import Any, Dict, Literal, Mapping, Iterable, Optional
34
from pathlib import Path
4-
from typing import Any, Dict, Iterable, Literal, Mapping, Optional
55

66
import httpx
77

8-
from .._client import Runloop
9-
from .._types import Body, Headers, NotGiven, NOT_GIVEN, Omit, Query, SequenceNotStr, Timeout, not_given, omit
10-
from ..lib.polling import PollingConfig
11-
from ..types.shared_params.code_mount_parameters import CodeMountParameters
12-
from ..types.shared_params.launch_parameters import LaunchParameters
138
from .devbox import Devbox
9+
from .._types import NOT_GIVEN, Body, Omit, Query, Headers, Timeout, NotGiven, SequenceNotStr, omit, not_given
10+
from .._client import Runloop
11+
from ._helpers import ContentType, detect_content_type
1412
from .snapshot import Snapshot
1513
from .blueprint import Blueprint
14+
from ..lib.polling import PollingConfig
1615
from .storage_object import StorageObject
17-
from ._helpers import ContentType, detect_content_type
16+
from ..types.shared_params.launch_parameters import LaunchParameters
17+
from ..types.shared_params.code_mount_parameters import CodeMountParameters
1818

1919

2020
class DevboxClient:
@@ -434,7 +434,6 @@ def __init__(
434434
default_headers: Mapping[str, str] | None = None,
435435
default_query: Mapping[str, object] | None = None,
436436
http_client: httpx.Client | None = None,
437-
_strict_response_validation: bool = False,
438437
) -> None:
439438
if max_retries is None:
440439
self.api = Runloop(
@@ -444,7 +443,6 @@ def __init__(
444443
default_headers=default_headers,
445444
default_query=default_query,
446445
http_client=http_client,
447-
_strict_response_validation=_strict_response_validation,
448446
)
449447
else:
450448
self.api = Runloop(
@@ -455,7 +453,6 @@ def __init__(
455453
default_headers=default_headers,
456454
default_query=default_query,
457455
http_client=http_client,
458-
_strict_response_validation=_strict_response_validation,
459456
)
460457

461458
self.devbox = DevboxClient(self.api)

src/runloop_api_client/sdk/async_blueprint.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
from __future__ import annotations
22

3-
from typing import Any, Dict, Iterable, Optional
4-
3+
from typing import Dict, Iterable, Optional
54
from typing_extensions import override
65

6+
from ..types import BlueprintView
7+
from ._async import AsyncDevboxClient
8+
from .._types import NOT_GIVEN, Body, Query, Headers, Timeout, NotGiven, not_given
79
from .._client import AsyncRunloop
810
from ..lib.polling import PollingConfig
9-
from .._types import Body, Headers, NotGiven, NOT_GIVEN, Query, Timeout, not_given
10-
from ..types.shared_params.code_mount_parameters import CodeMountParameters
11-
from ..types.shared_params.launch_parameters import LaunchParameters
1211
from .async_devbox import AsyncDevbox
1312
from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView
13+
from ..types.shared_params.launch_parameters import LaunchParameters
14+
from ..types.shared_params.code_mount_parameters import CodeMountParameters
1415

1516

1617
class AsyncBlueprint:
@@ -41,7 +42,7 @@ async def get_info(
4142
extra_query: Query | None = None,
4243
extra_body: Body | None = None,
4344
timeout: float | Timeout | None | NotGiven = not_given,
44-
) -> Any:
45+
) -> BlueprintView:
4546
return await self._client.blueprints.retrieve(
4647
self._id,
4748
extra_headers=extra_headers,
@@ -73,7 +74,7 @@ async def delete(
7374
extra_query: Query | None = None,
7475
extra_body: Body | None = None,
7576
timeout: float | Timeout | None | NotGiven = not_given,
76-
) -> Any:
77+
) -> object:
7778
return await self._client.blueprints.delete(
7879
self._id,
7980
extra_headers=extra_headers,
@@ -101,8 +102,6 @@ async def create_devbox(
101102
timeout: float | Timeout | None | NotGiven = not_given,
102103
idempotency_key: str | None = None,
103104
) -> AsyncDevbox:
104-
from ._async import AsyncDevboxClient
105-
106105
devbox_client = AsyncDevboxClient(self._client)
107106
return await devbox_client.create_from_blueprint_id(
108107
self._id,

src/runloop_api_client/sdk/async_devbox.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22

33
import asyncio
44
import logging
5-
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Optional, Sequence, cast
6-
5+
from typing import TYPE_CHECKING, Any, Callable, Optional, Sequence, Awaitable, cast
76
from typing_extensions import override
87

9-
from .._types import Body, Headers, NotGiven, Omit, Query, Timeout, not_given, omit
8+
from ..types import (
9+
DevboxView,
10+
DevboxTunnelView,
11+
DevboxExecutionDetailView,
12+
DevboxCreateSSHKeyResponse,
13+
)
14+
from .._types import Body, Omit, Query, Headers, Timeout, NotGiven, omit, not_given
1015
from .._client import AsyncRunloop
1116
from ._helpers import LogCallback, UploadInput, normalize_upload_input
1217
from .._streaming import AsyncStream
1318
from ..lib.polling import PollingConfig
1419
from .async_execution import AsyncExecution, _AsyncStreamingGroup
1520
from .async_execution_result import AsyncExecutionResult
16-
from ..types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
1721
from ..types.devboxes.execution_update_chunk import ExecutionUpdateChunk
18-
22+
from ..types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
1923

2024
StreamFactory = Callable[[], Awaitable[AsyncStream[ExecutionUpdateChunk]]]
2125

@@ -57,7 +61,7 @@ async def get_info(
5761
extra_query: Query | None = None,
5862
extra_body: Body | None = None,
5963
timeout: float | Timeout | None | NotGiven = not_given,
60-
) -> Any:
64+
) -> DevboxView:
6165
return await self._client.devboxes.retrieve(
6266
self._id,
6367
extra_headers=extra_headers,
@@ -66,10 +70,10 @@ async def get_info(
6670
timeout=timeout,
6771
)
6872

69-
async def await_running(self, *, polling_config: PollingConfig | None = None) -> Any:
73+
async def await_running(self, *, polling_config: PollingConfig | None = None) -> DevboxView:
7074
return await self._client.devboxes.await_running(self._id, polling_config=polling_config)
7175

72-
async def await_suspended(self, *, polling_config: PollingConfig | None = None) -> Any:
76+
async def await_suspended(self, *, polling_config: PollingConfig | None = None) -> DevboxView:
7377
return await self._client.devboxes.await_suspended(self._id, polling_config=polling_config)
7478

7579
async def shutdown(
@@ -80,7 +84,7 @@ async def shutdown(
8084
extra_body: Body | None = None,
8185
timeout: float | Timeout | None | NotGiven = not_given,
8286
idempotency_key: str | None = None,
83-
) -> Any:
87+
) -> DevboxView:
8488
return await self._client.devboxes.shutdown(
8589
self._id,
8690
extra_headers=extra_headers,
@@ -99,7 +103,7 @@ async def suspend(
99103
extra_body: Body | None = None,
100104
timeout: float | Timeout | None | NotGiven = not_given,
101105
idempotency_key: str | None = None,
102-
) -> Any:
106+
) -> DevboxView:
103107
await self._client.devboxes.suspend(
104108
self._id,
105109
extra_headers=extra_headers,
@@ -122,7 +126,7 @@ async def resume(
122126
extra_body: Body | None = None,
123127
timeout: float | Timeout | None | NotGiven = not_given,
124128
idempotency_key: str | None = None,
125-
) -> Any:
129+
) -> DevboxView:
126130
await self._client.devboxes.resume(
127131
self._id,
128132
extra_headers=extra_headers,
@@ -144,7 +148,7 @@ async def keep_alive(
144148
extra_body: Body | None = None,
145149
timeout: float | Timeout | None | NotGiven = not_given,
146150
idempotency_key: str | None = None,
147-
) -> Any:
151+
) -> object:
148152
return await self._client.devboxes.keep_alive(
149153
self._id,
150154
extra_headers=extra_headers,
@@ -185,7 +189,6 @@ async def snapshot_disk(
185189
extra_query=extra_query,
186190
extra_body=extra_body,
187191
timeout=timeout,
188-
idempotency_key=idempotency_key,
189192
)
190193
return snapshot
191194

@@ -461,7 +464,7 @@ async def write(
461464
extra_body: Body | None = None,
462465
timeout: float | Timeout | None | NotGiven = not_given,
463466
idempotency_key: str | None = None,
464-
) -> Any:
467+
) -> DevboxExecutionDetailView:
465468
if isinstance(contents, bytes):
466469
contents_str = contents.decode("utf-8")
467470
else:
@@ -509,7 +512,7 @@ async def upload(
509512
extra_body: Body | None = None,
510513
timeout: float | Timeout | None | NotGiven = not_given,
511514
idempotency_key: str | None = None,
512-
) -> Any:
515+
) -> object:
513516
file_param = normalize_upload_input(file)
514517
return await self._devbox._client.devboxes.upload_file(
515518
self._devbox.id,
@@ -535,7 +538,7 @@ async def create_ssh_key(
535538
extra_body: Body | None = None,
536539
timeout: float | Timeout | None | NotGiven = not_given,
537540
idempotency_key: str | None = None,
538-
) -> Any:
541+
) -> DevboxCreateSSHKeyResponse:
539542
return await self._devbox._client.devboxes.create_ssh_key(
540543
self._devbox.id,
541544
extra_headers=extra_headers,
@@ -554,7 +557,7 @@ async def create_tunnel(
554557
extra_body: Body | None = None,
555558
timeout: float | Timeout | None | NotGiven = not_given,
556559
idempotency_key: str | None = None,
557-
) -> Any:
560+
) -> DevboxTunnelView:
558561
return await self._devbox._client.devboxes.create_tunnel(
559562
self._devbox.id,
560563
port=port,
@@ -574,7 +577,7 @@ async def remove_tunnel(
574577
extra_body: Body | None = None,
575578
timeout: float | Timeout | None | NotGiven = not_given,
576579
idempotency_key: str | None = None,
577-
) -> Any:
580+
) -> object:
578581
return await self._devbox._client.devboxes.remove_tunnel(
579582
self._devbox.id,
580583
port=port,

0 commit comments

Comments
 (0)