Skip to content

Commit

Permalink
fixed typing syntax and watch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0div committed Dec 12, 2024
1 parent cf262ae commit 4ca2414
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from io import TextIOBase
from typing import AsyncIterator, List, Literal, Optional, overload
from typing import AsyncIterator, List, Literal, Optional, overload, Union
from e2b.sandbox.filesystem.filesystem import WriteData, WriteEntry

import e2b_connect as connect
Expand Down Expand Up @@ -173,11 +173,11 @@ async def write(

async def write(
self,
path_or_files: str | List[WriteEntry],
data_or_user: WriteData | Username = "user",
user_or_request_timeout: Optional[float | Username] = None,
path_or_files: Union[str, List[WriteEntry]],
data_or_user: Union[WriteData, Username] = "user",
user_or_request_timeout: Optional[Union[float, Username]] = None,
request_timeout_or_none: Optional[float] = None
) -> EntryInfo | List[EntryInfo]:
) -> Union[EntryInfo, List[EntryInfo]]:
"""
Writes content to a file on the path.
When writing to a file that doesn't exist, the file will get created.
Expand Down
10 changes: 5 additions & 5 deletions packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from io import TextIOBase
from typing import Iterator, List, Literal, Optional, overload
from typing import Iterator, List, Literal, Optional, overload, Union
from e2b.sandbox.filesystem.filesystem import WriteData, WriteEntry

import e2b_connect
Expand Down Expand Up @@ -173,11 +173,11 @@ def write(

def write(
self,
path_or_files: str | List[WriteEntry],
data_or_user: WriteData | Username = "user",
user_or_request_timeout: Optional[float | Username] = None,
path_or_files: Union[str, List[WriteEntry]],
data_or_user: Union[WriteData, Username] = "user",
user_or_request_timeout: Optional[Union[float, Username]] = None,
request_timeout_or_none: Optional[float] = None
) -> EntryInfo | List[EntryInfo]:
) -> Union[EntryInfo, List[EntryInfo]]:
path, write_files, user, request_timeout = None, [], "user", None
if isinstance(path_or_files, str):
if isinstance(data_or_user, list):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def test_watch_directory_changes(sandbox: Sandbox):
sandbox.files.write(f"{dirname}/{filename}", content)

events = handle.get_new_events()
assert len(events) == 3
assert events[0].type == FilesystemEventType.CREATE
assert len(events) >= 3
assert events[0].type == FilesystemEventType.WRITE
assert events[0].name == filename
assert events[1].type == FilesystemEventType.CHMOD
assert events[1].name == filename
Expand Down

0 comments on commit 4ca2414

Please sign in to comment.