Skip to content

Commit a487061

Browse files
committed
fixed snapshot list, cleaned up getattr
1 parent bc21327 commit a487061

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/runloop_api_client/sdk/_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async def list(
217217
extra_body=extra_body,
218218
timeout=timeout,
219219
)
220-
return [AsyncDevbox(self._client, item.id) for item in getattr(page, "devboxes", [])]
220+
return [AsyncDevbox(self._client, item.id) for item in page.devboxes]
221221

222222

223223
class AsyncSnapshotClient:
@@ -250,7 +250,7 @@ async def list(
250250
extra_body=extra_body,
251251
timeout=timeout,
252252
)
253-
return [AsyncSnapshot(self._client, item.id) for item in getattr(page, "disk_snapshots", [])]
253+
return [AsyncSnapshot(self._client, item.id) for item in page.snapshots]
254254

255255
def from_id(self, snapshot_id: str) -> AsyncSnapshot:
256256
return AsyncSnapshot(self._client, snapshot_id)
@@ -329,7 +329,7 @@ async def list(
329329
extra_body=extra_body,
330330
timeout=timeout,
331331
)
332-
return [AsyncBlueprint(self._client, item.id) for item in getattr(page, "blueprints", [])]
332+
return [AsyncBlueprint(self._client, item.id) for item in page.blueprints]
333333

334334

335335
class AsyncStorageObjectClient:
@@ -378,7 +378,7 @@ async def list(
378378
extra_body=extra_body,
379379
timeout=timeout,
380380
)
381-
return [AsyncStorageObject(self._client, item.id, upload_url=None) for item in getattr(page, "objects", [])]
381+
return [AsyncStorageObject(self._client, item.id, upload_url=item.upload_url) for item in page.objects]
382382

383383
async def upload_from_file(
384384
self,

src/runloop_api_client/sdk/_sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def list(
224224
extra_body=extra_body,
225225
timeout=timeout,
226226
)
227-
return [Devbox(self._client, item.id) for item in getattr(page, "devboxes", [])]
227+
return [Devbox(self._client, item.id) for item in page.devboxes]
228228

229229

230230
class SnapshotClient:
@@ -257,7 +257,7 @@ def list(
257257
extra_body=extra_body,
258258
timeout=timeout,
259259
)
260-
return [Snapshot(self._client, item.id) for item in getattr(page, "disk_snapshots", [])]
260+
return [Snapshot(self._client, item.id) for item in page.snapshots]
261261

262262
def from_id(self, snapshot_id: str) -> Snapshot:
263263
return Snapshot(self._client, snapshot_id)
@@ -336,7 +336,7 @@ def list(
336336
extra_body=extra_body,
337337
timeout=timeout,
338338
)
339-
return [Blueprint(self._client, item.id) for item in getattr(page, "blueprints", [])]
339+
return [Blueprint(self._client, item.id) for item in page.blueprints]
340340

341341

342342
class StorageObjectClient:
@@ -385,7 +385,7 @@ def list(
385385
extra_body=extra_body,
386386
timeout=timeout,
387387
)
388-
return [StorageObject(self._client, item.id, upload_url=None) for item in getattr(page, "objects", [])]
388+
return [StorageObject(self._client, item.id, upload_url=item.upload_url) for item in page.objects]
389389

390390
def upload_from_file(
391391
self,

src/runloop_api_client/sdk/async_devbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ async def _stream_worker(
298298
stream = await stream_factory()
299299
async with stream:
300300
async for chunk in stream:
301-
text = getattr(chunk, "output", "")
301+
text = chunk.output
302302
for callback in callbacks:
303303
try:
304304
callback(text)

src/runloop_api_client/sdk/devbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def worker() -> None:
293293
for chunk in stream:
294294
if stop_event.is_set():
295295
break
296-
text = getattr(chunk, "output", "")
296+
text = chunk.output
297297
for callback in callbacks:
298298
try:
299299
callback(text)

0 commit comments

Comments
 (0)