Skip to content

Commit 06c263f

Browse files
committed
rename rm to rmdir for consistency with python standard library naming
1 parent fcfb1e9 commit 06c263f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

zarr/storage.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ def contains_group(store, prefix=None):
108108
return group_attrs_key(prefix) in store
109109

110110

111-
def rm(store, prefix=None):
111+
def rmdir(store, prefix=None):
112112
"""TODO"""
113113
prefix = normalize_prefix(prefix)
114-
if hasattr(store, 'rm'):
115-
store.rm(prefix)
114+
if hasattr(store, 'rmdir'):
115+
store.rmdir(prefix)
116116
else:
117117
for key in set(store.keys()):
118118
if key.startswith(prefix):
@@ -214,7 +214,7 @@ def init_array(store, shape, chunks, dtype=None, compression='default',
214214
# guard conditions
215215
if overwrite:
216216
# attempt to delete any pre-existing items in store
217-
rm(store, prefix)
217+
rmdir(store, prefix)
218218
elif contains_array(store, prefix):
219219
raise ValueError('store contains an array')
220220
elif contains_group(store, prefix):
@@ -264,7 +264,7 @@ def init_group(store, overwrite=False, prefix=None):
264264
# guard conditions
265265
if overwrite:
266266
# attempt to delete any pre-existing items in store
267-
rm(store, prefix)
267+
rmdir(store, prefix)
268268
elif contains_array(store, prefix):
269269
raise ValueError('store contains an array')
270270
elif contains_group(store, prefix):
@@ -322,7 +322,7 @@ class DirectoryStore(MutableMapping):
322322
['a', 'foo']
323323
>>> store.listdir('a/b')
324324
['c']
325-
>>> store.rm('a')
325+
>>> store.rmdir('a')
326326
>>> sorted(store.keys())
327327
['foo']
328328
>>> import os
@@ -419,7 +419,7 @@ def listdir(self, prefix):
419419
path = os.path.join(self.path, normalize_prefix(prefix))
420420
return sorted(os.listdir(path))
421421

422-
def rm(self, prefix):
422+
def rmdir(self, prefix):
423423
path = os.path.join(self.path, normalize_prefix(prefix))
424424
if os.path.isdir(path):
425425
shutil.rmtree(path)
@@ -504,7 +504,7 @@ def listdir(self, prefix):
504504
prefix = normalize_prefix(prefix)
505505
return _listdir_from_keys(self, prefix)
506506

507-
def rm(self, prefix):
507+
def rmdir(self, prefix):
508508
raise NotImplementedError
509509

510510
def getsize(self, prefix):

0 commit comments

Comments
 (0)