@@ -118,11 +118,11 @@ class Store(BaseStore):
118
118
119
119
"""
120
120
121
- def listdir (self , path : str = "" ) -> List [str ]:
121
+ def listdir (self , path : Path = None ) -> List [str ]:
122
122
path = normalize_storage_path (path )
123
123
return _listdir_from_keys (self , path )
124
124
125
- def rmdir (self , path : str = "" ) -> None :
125
+ def rmdir (self , path : Path = None ) -> None :
126
126
if not self .is_erasable ():
127
127
raise NotImplementedError (
128
128
f'{ type (self )} is not erasable, cannot call "rmdir"'
@@ -150,15 +150,7 @@ def _rename_from_keys(store: BaseStore, src_path: str, dst_path: str) -> None:
150
150
store [new_key ] = store .pop (key )
151
151
152
152
153
- def _rmdir_from_keys (store : Union [BaseStore , MutableMapping ], path : Optional [str ] = None ) -> None :
154
- # assume path already normalized
155
- prefix = _path_to_prefix (path )
156
- for key in list (store .keys ()):
157
- if key .startswith (prefix ):
158
- del store [key ]
159
-
160
-
161
- def _listdir_from_keys (store : BaseStore , path : Optional [str ] = None ) -> List [str ]:
153
+ def _listdir_from_keys (store : BaseStore , path : Optional [Path ] = None ) -> List [str ]:
162
154
# assume path already normalized
163
155
prefix = _path_to_prefix (path )
164
156
children = set ()
@@ -168,3 +160,11 @@ def _listdir_from_keys(store: BaseStore, path: Optional[str] = None) -> List[str
168
160
child = suffix .split ('/' )[0 ]
169
161
children .add (child )
170
162
return sorted (children )
163
+
164
+
165
+ def _rmdir_from_keys (store : Union [BaseStore , MutableMapping ], path : Optional [Path ] = None ) -> None :
166
+ # assume path already normalized
167
+ prefix = _path_to_prefix (path )
168
+ for key in list (store .keys ()):
169
+ if key .startswith (prefix ):
170
+ del store [key ]
0 commit comments