[arvados] updated: 2.6.0-162-gcc6460e97

git repository hosting git at public.arvados.org
Thu May 11 15:58:09 UTC 2023


Summary of changes:
 doc/sdk/python/cookbook.html.textile.liquid | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

       via  cc6460e973cf14c900f1e3244a7b81a5e1c9e791 (commit)
      from  ab9fdb73256fb57a48aad2161fa022146031f7ca (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 cc6460e973cf14c900f1e3244a7b81a5e1c9e791
Author: Brett Smith <brett.smith at curii.com>
Date:   Thu May 11 11:53:41 2023 -0400

    Refine PySDK collection walk recipe
    
    Use PurePosixPath to clarify that we're strictly doing path manipulation.
    (It will also behave better on Windows, although I'm not sure if the SDK
    itself is Windows-ready yet.)
    
    Keep Path objects in the queue to reduce local state.
    
    No issue #
    
    Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith at curii.com>

diff --git a/doc/sdk/python/cookbook.html.textile.liquid b/doc/sdk/python/cookbook.html.textile.liquid
index f2d087625..c9e1f05f1 100644
--- a/doc/sdk/python/cookbook.html.textile.liquid
+++ b/doc/sdk/python/cookbook.html.textile.liquid
@@ -471,17 +471,16 @@ import collections
 import pathlib
 root_collection = arvados.collection.Collection(...)
 # Start work from the base stream.
-stream_queue = collections.deque(['.'])
+stream_queue = collections.deque([pathlib.PurePosixPath('.')])
 while stream_queue:
-    stream_name = stream_queue.popleft()
-    collection = root_collection.find(stream_name)
+    stream_path = stream_queue.popleft()
+    collection = root_collection.find(str(stream_path))
     for item_name in collection:
         try:
             my_file = collection.open(item_name)
         except IsADirectoryError:
             # item_name refers to a stream. Queue it to walk later.
-            stream_path = pathlib.Path(stream_name, item_name)
-            stream_queue.append(stream_path.as_posix())
+            stream_queue.append(stream_path / item_name)
             continue
         with my_file:
             ...  # Work with my_file as desired

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list