@@ -119,7 +119,7 @@ def rm(store, prefix=None):
119
119
del store [key ]
120
120
121
121
122
- def _ls_from_keys (store , prefix = None ):
122
+ def _listdir_from_keys (store , prefix = None ):
123
123
children = set ()
124
124
for key in store .keys ():
125
125
if key .startswith (prefix ) and len (key ) > len (prefix ):
@@ -129,13 +129,13 @@ def _ls_from_keys(store, prefix=None):
129
129
return sorted (children )
130
130
131
131
132
- def ls (store , prefix = None ):
132
+ def listdir (store , prefix = None ):
133
133
"""TODO"""
134
134
prefix = normalize_prefix (prefix )
135
- if hasattr (store , 'ls ' ):
136
- return store .ls (prefix )
135
+ if hasattr (store , 'listdir ' ):
136
+ return store .listdir (prefix )
137
137
else :
138
- return _ls_from_keys (store , prefix )
138
+ return _listdir_from_keys (store , prefix )
139
139
140
140
141
141
def init_array (store , shape , chunks , dtype = None , compression = 'default' ,
@@ -318,9 +318,9 @@ class DirectoryStore(MutableMapping):
318
318
b'xxx'
319
319
>>> sorted(store.keys())
320
320
['foo', 'a/b/c']
321
- >>> store.ls ()
321
+ >>> store.listdir ()
322
322
['a', 'foo']
323
- >>> store.ls ('a/b')
323
+ >>> store.listdir ('a/b')
324
324
['c']
325
325
>>> store.rm('a')
326
326
>>> sorted(store.keys())
@@ -415,7 +415,7 @@ def __iter__(self):
415
415
def __len__ (self ):
416
416
return sum (1 for _ in self .keys ())
417
417
418
- def ls (self , prefix ):
418
+ def listdir (self , prefix ):
419
419
path = os .path .join (self .path , normalize_prefix (prefix ))
420
420
return sorted (os .listdir (path ))
421
421
@@ -425,7 +425,7 @@ def rm(self, prefix):
425
425
shutil .rmtree (path )
426
426
427
427
def getsize (self , prefix ):
428
- children = self .ls (prefix )
428
+ children = self .listdir (prefix )
429
429
size = 0
430
430
for child in children :
431
431
path = os .path .join (self .path , child )
@@ -500,16 +500,16 @@ def __contains__(self, key):
500
500
else :
501
501
return True
502
502
503
- def ls (self , prefix ):
503
+ def listdir (self , prefix ):
504
504
prefix = normalize_prefix (prefix )
505
- return _ls_from_keys (self , prefix )
505
+ return _listdir_from_keys (self , prefix )
506
506
507
507
def rm (self , prefix ):
508
508
raise NotImplementedError
509
509
510
510
def getsize (self , prefix ):
511
511
prefix = normalize_prefix (prefix )
512
- children = self .ls (prefix )
512
+ children = self .listdir (prefix )
513
513
size = 0
514
514
with zipfile .ZipFile (self .path ) as zf :
515
515
for child in children :
0 commit comments