Project

General

Profile

Actions

Idea #21551

open

Python SDK methods to generate keep: URIs

Added by Brett Smith 7 months ago. Updated 7 months ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
SDKs
Target version:
Start date:
Due date:
Story points:
-

Description

These would be utility methods to make it easier to write Python that generates CWL inputs. Something like:

class ArvadosFile(object):
    def keep_uri(self) -> str:
        return f'{self.parent.keep_uri()}/{self.name}'

class Collection(RichCollectionBase):
    def keep_uri(self, path: Optional[str]=None) -> str:
        if path is None:
            parts = [f'keep:{self.portable_data_hash()}']
            parts.extend(self.stream_name().split('/'))
            if parts[-1] == '.':
                parts.pop()
            parts.append('')
            return '/'.join(parts)
        else:
            return self.find(path).keep_uri()

Basically given any file or collection object, it should be possible to get the corresponding keep: URI. This might need additional handling for corner cases but this is the gist.

Actions #1

Updated by Brett Smith 7 months ago

  • Description updated (diff)
Actions #2

Updated by Brett Smith 7 months ago

  • Description updated (diff)
Actions #3

Updated by Brett Smith 7 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF