@@ -1885,24 +1885,6 @@ def __delitem__(self, key):
1885
1885
self ._invalidate_value (key )
1886
1886
1887
1887
1888
- # utility functions for object stores
1889
-
1890
-
1891
- def _strip_prefix_from_path (path , prefix ):
1892
- # normalized things will not have any leading or trailing slashes
1893
- path_norm = normalize_storage_path (path )
1894
- prefix_norm = normalize_storage_path (prefix )
1895
- if path_norm .startswith (prefix_norm ):
1896
- return path_norm [(len (prefix_norm )+ 1 ):]
1897
- else :
1898
- return path
1899
-
1900
-
1901
- def _append_path_to_prefix (path , prefix ):
1902
- return '/' .join ([normalize_storage_path (prefix ),
1903
- normalize_storage_path (path )])
1904
-
1905
-
1906
1888
class ABSStore (MutableMapping ):
1907
1889
"""Storage class using Azure Blob Storage (ABS).
1908
1890
@@ -1951,6 +1933,10 @@ def __enter__(self):
1951
1933
def __exit__ (self , * args ):
1952
1934
pass
1953
1935
1936
+ def _append_path_to_prefix (path , prefix ):
1937
+ return '/' .join ([normalize_storage_path (prefix ),
1938
+ normalize_storage_path (path )])
1939
+
1954
1940
def full_path (self , path = None ):
1955
1941
return _append_path_to_prefix (path , self .prefix )
1956
1942
@@ -2000,6 +1986,15 @@ def list_abs_subdirectories(self, prefix):
2000
1986
"""Return list of all "subdirectories" from an abs prefix."""
2001
1987
return list (set ([blob .name .rsplit ('/' , 1 )[0 ] for blob in self .client .list_blobs (self .container_name ) if '/' in blob .name ]))
2002
1988
1989
+ def _strip_prefix_from_path (path , prefix ):
1990
+ # normalized things will not have any leading or trailing slashes
1991
+ path_norm = normalize_storage_path (path )
1992
+ prefix_norm = normalize_storage_path (prefix )
1993
+ if path_norm .startswith (prefix_norm ):
1994
+ return path_norm [(len (prefix_norm )+ 1 ):]
1995
+ else :
1996
+ return path
1997
+
2003
1998
def list_abs_directory (self , prefix , strip_prefix = True ):
2004
1999
"""Return a list of all blobs and subdirectories from an abs prefix."""
2005
2000
items = set ()
0 commit comments