Skip to content

Commit b91bf98

Browse files
authored
Merge pull request #42 from koyeb/fix-async-files-operations
Fix async files operations
2 parents 1f3618c + c79e80e commit b91bf98

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

examples/00_run_all_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ async def main():
198198
for example_file in example_files:
199199
example_name = example_file.name
200200
timeout = flow_timeouts.get(example_name, args.timeout)
201-
result = await run_example(example_file, timeout, suffix)
201+
result = await run_example(example_file, timeout)
202202
results.append(result)
203203

204204
# Break on error

examples/03_basic_commands_async.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import asyncio
55
import os
6+
import sys
67

78

89
import random

koyeb/sandbox/filesystem.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def write_files(self, files: List[Dict[str, str]]) -> None:
308308
path = file_info["path"]
309309
content = file_info["content"]
310310
encoding = file_info.get("encoding", "utf-8")
311-
self.write_file(path, content, encoding)
311+
SandboxFilesystem.write_file(self, path, content, encoding)
312312

313313
def exists(self, path: str) -> bool:
314314
"""Check if file/directory exists synchronously"""
@@ -352,7 +352,7 @@ def upload_file(
352352
with open(local_path, "rb") as f:
353353
content_bytes = f.read()
354354

355-
self.write_file(remote_path, content_bytes, encoding=encoding)
355+
SandboxFilesystem.write_file(self, remote_path, content_bytes, encoding=encoding)
356356

357357
def download_file(
358358
self, remote_path: str, local_path: str, encoding: str = "utf-8"
@@ -368,7 +368,7 @@ def download_file(
368368
Raises:
369369
SandboxFileNotFoundError: If remote file doesn't exist
370370
"""
371-
file_info = self.read_file(remote_path, encoding=encoding)
371+
file_info = SandboxFilesystem.read_file(self, remote_path, encoding=encoding)
372372

373373
if isinstance(file_info.content, bytes):
374374
content_bytes = file_info.content
@@ -388,7 +388,7 @@ def ls(self, path: str = ".") -> List[str]:
388388
Returns:
389389
List of file/directory names
390390
"""
391-
return self.list_dir(path)
391+
return SandboxFilesystem.list_dir(self, path)
392392

393393
def rm(self, path: str, recursive: bool = False) -> None:
394394
"""

0 commit comments

Comments
 (0)