Skip to content

Commit

Permalink
Core: Add touch API
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Aug 23, 2024
1 parent 79c30b7 commit dedde96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tosfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""The core module of TOSFS."""
import logging
import os
from typing import List, Optional, Tuple, Union
from typing import Any, List, Optional, Tuple, Union

import tos
from fsspec import AbstractFileSystem
Expand Down Expand Up @@ -252,7 +252,7 @@ def rmdir(self, path: str) -> None:
except Exception as e:
raise TosfsError(f"Tosfs failed with unknown error: {e}") from e

def touch(self, path, truncate=True, **kwargs):
def touch(self, path: str, truncate: bool = True, **kwargs: Any) -> None:
"""Create a file at the given path.
Parameters
Expand Down
3 changes: 0 additions & 3 deletions tosfs/tests/test_tosfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,3 @@ def test_touch(tosfs: TosFileSystem, bucket: str, temporary_workspace: str) -> N
assert tosfs.info(f"{bucket}/{temporary_workspace}/{file_name}")["size"] > 0
tosfs.touch(f"{bucket}/{temporary_workspace}/{file_name}", truncate=True)
assert tosfs.info(f"{bucket}/{temporary_workspace}/{file_name}")["size"] == 0



0 comments on commit dedde96

Please sign in to comment.