Project

General

Profile

Idea #21551

Updated by Brett Smith 9 months ago

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

 <pre><code class="python"> 
 class ArvadosFile(object): 
     def keep_uri(self) -> str: 
         return f'keep:{self.parent.keep_uri()}/{self.name}' f'keep:{self.parent.portable_data_hash()}.{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() 
 </code></pre> 

 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.

Back