Skip to content

Commit

Permalink
Remove useless rstrip slash after _strip_protocol (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua authored Oct 30, 2024
1 parent b019820 commit b4fb038
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tosfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def ls(
{'name': 'mybucket/file2', 'size': 456, 'type': 'file'}]
"""
path = self._strip_protocol(path).rstrip("/")
path = self._strip_protocol(path)
if path in ["", "/"]:
files = self._ls_buckets()
return files if detail else sorted([o["name"] for o in files])
Expand Down Expand Up @@ -435,7 +435,7 @@ def ls_iterate(
"is not version aware."
)

path = self._strip_protocol(path).rstrip("/")
path = self._strip_protocol(path)
bucket, key, _ = self._split_path(path)
prefix = key.lstrip("/") + "/" if key else ""
continuation_token = ""
Expand Down Expand Up @@ -626,7 +626,7 @@ def rmdir(self, path: str) -> None:
"""
logger.warning("Call rmdir api: path %s", path)
path = self._strip_protocol(path).rstrip("/") + "/"
path = self._strip_protocol(path) + "/"
bucket, key, _ = self._split_path(path)
if not key:
raise TosfsError("Cannot remove a bucket using rmdir api.")
Expand Down Expand Up @@ -706,7 +706,7 @@ def mkdir(self, path: str, create_parents: bool = True, **kwargs: Any) -> None:
may be permissions, etc.
"""
path = self._strip_protocol(path).rstrip("/") + "/"
path = self._strip_protocol(path) + "/"
bucket, key, _ = self._split_path(path)
if not key:
raise TosfsError(f"Cannot create a bucket {bucket} using mkdir api.")
Expand Down Expand Up @@ -746,7 +746,7 @@ def makedirs(self, path: str, exist_ok: bool = False) -> None:
If False, will error if the target already exists
"""
path = self._strip_protocol(path).rstrip("/") + "/"
path = self._strip_protocol(path) + "/"
path_exist = self.exists(path)
if exist_ok and path_exist:
return
Expand Down Expand Up @@ -823,7 +823,7 @@ def isdir(self, path: str) -> bool:
>>> fs.isdir("tos://mybucket/mydir/")
"""
path = self._strip_protocol(path).rstrip("/") + "/"
path = self._strip_protocol(path) + "/"
bucket, key, _ = self._split_path(path)
if not key:
return False
Expand Down

0 comments on commit b4fb038

Please sign in to comment.