Skip to content

Commit 8728170

Browse files
updates
1 parent 0c62e00 commit 8728170

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

adlfs/spec.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,22 +1278,20 @@ async def _rm_files(
12781278

12791279
sync_wrapper(_rm_files)
12801280

1281-
async def _rm_file(
1282-
self, path: typing.Union[str, typing.List[str]], delimiter: str = "/", **kwargs
1283-
):
1281+
async def _rm_file(self, path: str, **kwargs):
12841282
"""Delete a file.
12851283
12861284
Parameters
12871285
----------
12881286
path: str
12891287
File to delete.
12901288
"""
1291-
container_name, p, _ = self.split_path(path, delimiter=delimiter)
1289+
container_name, p, _ = self.split_path(path)
12921290
try:
1293-
if p != "":
1294-
await self._rm_files(container_name, [p.rstrip(delimiter)])
1295-
else:
1296-
await self._rmdir(container_name)
1291+
async with self.service_client.get_container_client(
1292+
container=container_name
1293+
) as cc:
1294+
await cc.delete_blob(p)
12971295
except ResourceNotFoundError:
12981296
pass
12991297
except FileNotFoundError:

adlfs/tests/test_spec.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,13 +2152,3 @@ def test_rm_file(storage):
21522152
fs.rm_file(path)
21532153
with pytest.raises(FileNotFoundError):
21542154
fs.ls(path)
2155-
2156-
2157-
def test_rm_file_nonempty_directory(storage):
2158-
fs = AzureBlobFileSystem(
2159-
account_name=storage.account_name,
2160-
connection_string=CONN_STR,
2161-
)
2162-
path = "data/root/a/"
2163-
fs.rm_file(path)
2164-
assert fs.ls("data/root/a/") == ["data/root/a/file.txt"]

0 commit comments

Comments
 (0)