当前位置: 首页>>代码示例>>Python>>正文


Python GirderClient.load_or_create_folder方法代码示例

本文整理汇总了Python中girder_client.GirderClient.load_or_create_folder方法的典型用法代码示例。如果您正苦于以下问题:Python GirderClient.load_or_create_folder方法的具体用法?Python GirderClient.load_or_create_folder怎么用?Python GirderClient.load_or_create_folder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在girder_client.GirderClient的用法示例。


在下文中一共展示了GirderClient.load_or_create_folder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: open

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import load_or_create_folder [as 别名]
            'name': 'Data',
            'description': 'Data Folder',
            'public': 'true'
        })
        c.post('folder', parameters={
            'parentType': 'collection',
            'parentId': collection['_id'],
            'name': 'Analyses',
            'description': 'Analysis folder',
            'public': 'true'
        })
    else:
        collection = collection_search['collection'][0]

    # Get the 'Analyses' folder for this collection.
    analysis_folder = c.load_or_create_folder('Analyses', collection['_id'], 'collection')
    folder_id = analysis_folder['_id']

    # Read this analysis into a Python dictionary and upload it to Girder.
    analysis = {}
    with open (fullpath, "r") as analysis_file:
        analysis_str = analysis_file.read()
    try:
      analysis['analysis'] = json.loads(analysis_str)
    except ValueError:
      print "Could not read valid JSON from %s" % analysis_filename
      continue
    item = c.createItem(folder_id, analysis_name, analysis_name)
    c.addMetadataToItem(item['_id'], analysis)
    print "%s successfully uploaded to %s" % (analysis_filename, collection_name)
开发者ID:Kitware,项目名称:flow,代码行数:32,代码来源:load-analyses.py


注:本文中的girder_client.GirderClient.load_or_create_folder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。