[ARVADOS] updated: 1.3.0-66-g3016fbd5f

Git user git at public.curoverse.com
Fri Dec 21 10:03:32 EST 2018


Summary of changes:
 sdk/python/arvados/collection.py     | 11 +++++++----
 sdk/python/tests/test_collections.py |  4 ++--
 2 files changed, 9 insertions(+), 6 deletions(-)

       via  3016fbd5fba0273350311d336f1f7c929f6fc20f (commit)
       via  8a80b0fa3d00151b573b2cb0c640163f21b717ae (commit)
      from  5139019ded0a1c79f50906f5cab9abcc04ecc95b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 3016fbd5fba0273350311d336f1f7c929f6fc20f
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Fri Dec 21 11:43:26 2018 -0300

    14539: Moves both escaping/unescaping methods to Collection's base class.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 52182202f..a24552909 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -562,6 +562,12 @@ class RichCollectionBase(CollectionBase):
     def stream_name(self):
         raise NotImplementedError()
 
+    def _unescape_manifest_path(self, path):
+        return re.sub('\\\\([0-3][0-7][0-7])', lambda m: chr(int(m.group(1), 8)), path)
+
+    def _escape_manifest_path(self, path):
+        return path.replace('\\', '\\134').replace(' ', '\\040')
+
     @synchronized
     def has_remote_blocks(self):
         """Recursively check for a +R segment locator signature."""
@@ -1711,12 +1717,6 @@ class Collection(RichCollectionBase):
     _block_re = re.compile(r'[0-9a-f]{32}\+(\d+)(\+\S+)*')
     _segment_re = re.compile(r'(\d+):(\d+):(\S+)')
 
-    def _unescape_manifest_path(self, path):
-        return re.sub('\\\\([0-3][0-7][0-7])', lambda m: chr(int(m.group(1), 8)), path)
-
-    def _escape_manifest_path(self, path):
-        return path.replace('\\', '\\134').replace(' ', '\\040')
-
     @synchronized
     def _import_manifest(self, manifest_text):
         """Import a manifest into a `Collection`.

commit 8a80b0fa3d00151b573b2cb0c640163f21b717ae
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Fri Dec 21 11:34:01 2018 -0300

    14539: Tidy up code. Update test.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index dcdf789ae..52182202f 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -601,7 +601,7 @@ class RichCollectionBase(CollectionBase):
         pathcomponents = path.split("/", 1)
         if pathcomponents[0]:
             # Escape '\' & ' ' chars on path names
-            pathcomponents[0] = pathcomponents[0].replace('\\', '\\134').replace(' ', '\\040')
+            pathcomponents[0] = self._escape_manifest_path(pathcomponents[0])
             item = self._items.get(pathcomponents[0])
             if len(pathcomponents) == 1:
                 if item is None:
@@ -1714,6 +1714,9 @@ class Collection(RichCollectionBase):
     def _unescape_manifest_path(self, path):
         return re.sub('\\\\([0-3][0-7][0-7])', lambda m: chr(int(m.group(1), 8)), path)
 
+    def _escape_manifest_path(self, path):
+        return path.replace('\\', '\\134').replace(' ', '\\040')
+
     @synchronized
     def _import_manifest(self, manifest_text):
         """Import a manifest into a `Collection`.
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index aa4938a47..bfc1d1970 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -966,9 +966,9 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
 
     def test_make_empty_dir_with_spaces(self):
         c = Collection()
-        c.mkdirs('./Empty Dir With Spaces')
+        c.mkdirs('./foo bar/baz waz')
         self.assertEqual(c.portable_manifest_text(),
-                         './Empty\\040Dir\\040With\\040Spaces d41d8cd98f00b204e9800998ecf8427e+0 0:0:\\056\n')
+                         './foo\\040bar/baz\\040waz d41d8cd98f00b204e9800998ecf8427e+0 0:0:\\056\n')
 
     def test_remove_in_subdir(self):
         c = Collection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count2.txt\n')

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list