[ARVADOS] updated: e753cd61976a6971bd71cb26279d15487c6da391

git at public.curoverse.com git at public.curoverse.com
Fri Oct 31 19:20:45 EDT 2014


Summary of changes:
 sdk/python/arvados/collection.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

       via  e753cd61976a6971bd71cb26279d15487c6da391 (commit)
       via  83acfa97bdd34983d284b199e0c67a411aa7580e (commit)
       via  017587d701e08b38d9468dce45e121a69ecd8135 (commit)
      from  f9328bf507490f48e57b196be1de55d946644dea (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 e753cd61976a6971bd71cb26279d15487c6da391
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Oct 31 19:20:33 2014 -0400

    3706: Prefer join() to many string concatenations.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index f7d210d..852e9d3 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -89,14 +89,17 @@ class CollectionBase(object):
         hints other than size hints) removed from the locators.
         """
         raw = self.manifest_text()
-        clean = ''
+        clean = []
         for line in raw.split("\n"):
             fields = line.split()
             if fields:
-                locators = [ (re.sub(r'\+[^\d][^\+]*', '', x) if re.match(util.keep_locator_pattern, x) else x)
-                             for x in fields[1:-1] ]
-                clean += fields[0] + ' ' + ' '.join(locators) + ' ' + fields[-1] + "\n"
-        return clean
+                clean_fields = [
+                    (re.sub(r'\+[^\d][^\+]*', '', x)
+                     if re.match(util.keep_locator_pattern, x)
+                     else x)
+                    for x in fields]
+                clean += [' '.join(clean_fields), "\n"]
+        return ''.join(clean)
 
 
 class CollectionReader(CollectionBase):

commit 83acfa97bdd34983d284b199e0c67a411aa7580e
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Oct 31 18:58:37 2014 -0400

    3706: Prefer "if x" to "if len(x) > 0".

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 9c536b7..f7d210d 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -63,7 +63,7 @@ def normalize_stream(s, stream):
         if current_span != None:
             stream_tokens.append("{0}:{1}:{2}".format(current_span[0], current_span[1] - current_span[0], fout))
 
-        if len(stream[f]) == 0:
+        if not stream[f]:
             stream_tokens.append("0:0:{0}".format(fout))
 
     return stream_tokens
@@ -92,7 +92,7 @@ class CollectionBase(object):
         clean = ''
         for line in raw.split("\n"):
             fields = line.split()
-            if len(fields) > 0:
+            if fields:
                 locators = [ (re.sub(r'\+[^\d][^\+]*', '', x) if re.match(util.keep_locator_pattern, x) else x)
                              for x in fields[1:-1] ]
                 clean += fields[0] + ' ' + ' '.join(locators) + ' ' + fields[-1] + "\n"
@@ -348,7 +348,7 @@ class CollectionWriter(CollectionBase):
         make_dirents = (util.listdir_recursive if (max_manifest_depth == 0)
                         else os.listdir)
         d = make_dirents(path)
-        if len(d) > 0:
+        if d:
             self._queue_dirents(stream_name, d)
         else:
             self._queued_trees.popleft()

commit 017587d701e08b38d9468dce45e121a69ecd8135
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Oct 31 18:56:16 2014 -0400

    3706: Two blank lines after class definition.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index a7cb382..9c536b7 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -98,6 +98,7 @@ class CollectionBase(object):
                 clean += fields[0] + ' ' + ' '.join(locators) + ' ' + fields[-1] + "\n"
         return clean
 
+
 class CollectionReader(CollectionBase):
     def __init__(self, manifest_locator_or_text, api_client=None,
                  keep_client=None, num_retries=0):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list