Skip to content

Commit 86b6ad9

Browse files
committed
Remove unnecessary arguments for await_running, await_completed, create_and_await_running
1 parent cb6712d commit 86b6ad9

4 files changed

Lines changed: 8 additions & 52 deletions

File tree

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,8 @@ def await_running(
360360
self,
361361
id: str,
362362
*,
363+
# Use polling_config to configure the "long" polling behavior.
363364
polling_config: PollingConfig | None = None,
364-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
365-
# The extra values given here take precedence over values defined on the client or passed to this method.
366-
extra_headers: Headers | None = None,
367-
extra_query: Query | None = None,
368-
extra_body: Body | None = None,
369-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
370365
) -> DevboxView:
371366
"""Wait for a devbox to be in running state.
372367
@@ -392,9 +387,6 @@ def wait_for_devbox_status() -> DevboxView:
392387
return self._post(
393388
f"/v1/devboxes/{id}/wait_for_status",
394389
body={"statuses": ["running", "failure"]},
395-
options=make_request_options(
396-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
397-
),
398390
cast_to=DevboxView,
399391
)
400392

@@ -495,10 +487,6 @@ def create_and_await_running(
495487
return self.await_running(
496488
devbox.id,
497489
polling_config=polling_config,
498-
extra_headers=extra_headers,
499-
extra_query=extra_query,
500-
extra_body=extra_body,
501-
timeout=timeout,
502490
)
503491

504492
def list(
@@ -1662,23 +1650,14 @@ async def create_and_await_running(
16621650
return await self.await_running(
16631651
devbox.id,
16641652
polling_config=polling_config,
1665-
extra_headers=extra_headers,
1666-
extra_query=extra_query,
1667-
extra_body=extra_body,
1668-
timeout=timeout,
16691653
)
16701654

16711655
async def await_running(
16721656
self,
16731657
id: str,
16741658
*,
1659+
# Use polling_config to configure the "long" polling behavior.
16751660
polling_config: PollingConfig | None = None,
1676-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1677-
# The extra values given here take precedence over values defined on the client or passed to this method.
1678-
extra_headers: Headers | None = None,
1679-
extra_query: Query | None = None,
1680-
extra_body: Body | None = None,
1681-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
16821661
) -> DevboxView:
16831662
"""Wait for a devbox to be in running state.
16841663
@@ -1705,9 +1684,6 @@ async def wait_for_devbox_status() -> DevboxView:
17051684
return await self._post(
17061685
f"/v1/devboxes/{id}/wait_for_status",
17071686
body={"statuses": ["running", "failure"]},
1708-
options=make_request_options(
1709-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1710-
),
17111687
cast_to=DevboxView,
17121688
)
17131689
except APIStatusError as error:

src/runloop_api_client/resources/devboxes/executions.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,8 @@ def await_completed(
9797
execution_id: str,
9898
devbox_id: str,
9999
*,
100-
config: PollingConfig | None = None,
101-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
102-
# The extra values given here take precedence over values defined on the client or passed to this method.
103-
extra_headers: Headers | None = None,
104-
extra_query: Query | None = None,
105-
extra_body: Body | None = None,
106-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
100+
# Use polling_config to configure the "long" polling behavior.
101+
polling_config: PollingConfig | None = None,
107102
) -> DevboxAsyncExecutionDetailView:
108103
"""Wait for an execution to complete.
109104
@@ -128,9 +123,6 @@ def wait_for_execution_status() -> DevboxAsyncExecutionDetailView:
128123
return self._post(
129124
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status",
130125
body={"statuses": ["completed"]},
131-
options=make_request_options(
132-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
133-
),
134126
cast_to=DevboxAsyncExecutionDetailView,
135127
)
136128

@@ -152,7 +144,7 @@ def handle_timeout_error(error: Exception) -> DevboxAsyncExecutionDetailView:
152144
def is_done(execution: DevboxAsyncExecutionDetailView) -> bool:
153145
return execution.status == "completed"
154146

155-
return poll_until(wait_for_execution_status, is_done, config, handle_timeout_error)
147+
return poll_until(wait_for_execution_status, is_done, polling_config, handle_timeout_error)
156148

157149
def execute_async(
158150
self,
@@ -390,13 +382,8 @@ async def await_completed(
390382
execution_id: str,
391383
*,
392384
devbox_id: str,
385+
# Use polling_config to configure the "long" polling behavior.
393386
polling_config: PollingConfig | None = None,
394-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
395-
# The extra values given here take precedence over values defined on the client or passed to this method.
396-
extra_headers: Headers | None = None,
397-
extra_query: Query | None = None,
398-
extra_body: Body | None = None,
399-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
400387
) -> DevboxAsyncExecutionDetailView:
401388
"""Wait for an execution to complete.
402389
@@ -421,9 +408,6 @@ async def wait_for_execution_status() -> DevboxAsyncExecutionDetailView:
421408
return await self._post(
422409
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status",
423410
body={"statuses": ["completed"]},
424-
options=make_request_options(
425-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
426-
),
427411
cast_to=DevboxAsyncExecutionDetailView,
428412
)
429413
except APIStatusError as error:

src/runloop_api_client/resources/scenarios/scenarios.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,6 @@ def start_run_and_await_env_ready(
471471
self._client.devboxes.await_running(
472472
run.devbox_id,
473473
polling_config=polling_config,
474-
extra_headers=extra_headers,
475-
extra_query=extra_query,
476-
extra_body=extra_body,
477-
timeout=timeout,
478474
)
479475

480476
return run

tests/api_resources/devboxes/test_executions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def test_method_await_completed_with_config(self, client: Runloop) -> None:
338338
with patch.object(client.devboxes.executions, "_post") as mock_post:
339339
mock_post.return_value = mock_execution_completed
340340

341-
result = client.devboxes.executions.await_completed("execution_id", "devbox_id", config=config)
341+
result = client.devboxes.executions.await_completed("execution_id", "devbox_id", polling_config=config)
342342

343343
assert result.execution_id == "execution_id"
344344
assert result.status == "completed"
@@ -361,7 +361,7 @@ def test_method_await_completed_polling_timeout(self, client: Runloop) -> None:
361361
mock_post.return_value = mock_execution_running
362362

363363
with pytest.raises(PollingTimeout):
364-
client.devboxes.executions.await_completed("execution_id", "devbox_id", config=config)
364+
client.devboxes.executions.await_completed("execution_id", "devbox_id", polling_config=config)
365365

366366
@parametrize
367367
def test_method_await_completed_various_statuses(self, client: Runloop) -> None:

0 commit comments

Comments
 (0)