MCPcopy Create free account
hub / github.com/pyathena-dev/PyAthena / touch

Method touch

pyathena/filesystem/s3.py:978–989  ·  view source on GitHub ↗
(self, path: str, truncate: bool = True, **kwargs)

Source from the content-addressed store, hash-verified

976 self.dircache.pop("", None)
977
978 def touch(self, path: str, truncate: bool = True, **kwargs) -> dict[str, Any]:
979 bucket, key, version_id = self.parse_path(path)
980 if version_id:
981 raise ValueError("Cannot touch the file with the version specified.")
982 if not truncate and self.exists(path):
983 raise ValueError("Cannot touch the existing file without specifying truncate.")
984 if not key:
985 raise ValueError("Cannot touch the bucket.")
986
987 object_ = self._put_object(bucket=bucket, key=key, body=None, **kwargs)
988 self.invalidate_cache(path)
989 return object_.to_dict()
990
991 def cp_file(
992 self, path1: str, path2: str, recursive=False, maxdepth=None, on_error=None, **kwargs

Callers 10

commitMethod · 0.80
test_ls_dirsMethod · 0.80
test_findMethod · 0.80
test_find_maxdepthMethod · 0.80
test_find_withdirsMethod · 0.80
test_globMethod · 0.80
test_rm_fileMethod · 0.80
test_rmMethod · 0.80
test_rm_recursiveMethod · 0.80
test_touchMethod · 0.80

Calls 5

parse_pathMethod · 0.95
existsMethod · 0.95
_put_objectMethod · 0.95
invalidate_cacheMethod · 0.95
to_dictMethod · 0.45

Tested by 9

test_ls_dirsMethod · 0.64
test_findMethod · 0.64
test_find_maxdepthMethod · 0.64
test_find_withdirsMethod · 0.64
test_globMethod · 0.64
test_rm_fileMethod · 0.64
test_rmMethod · 0.64
test_rm_recursiveMethod · 0.64
test_touchMethod · 0.64