conf.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:nlppln 作者: nlppln 项目源码 文件源码
def generate_cwl_documentation(_):
    cur_dir = os.path.abspath(os.path.dirname(__file__))

    # find all cwl files
    with WorkflowGenerator() as wf:
        cwl_files = [step.run for step in wf.steps_library.steps.values()]
    # sort alphabetically
    cwl_files.sort()

    tools_file = os.path.join(cur_dir, 'tools.rst')
    tool_template = '\n{}\n{}\n\n{}\n'
    with codecs.open(tools_file, 'wb', encoding='utf-8') as f:
        f.write('Tools\n=====\n')
        f.write('\n``nlppln`` contains the following tools:\n')
        for cwl in cwl_files:
            tool_name = os.path.basename(cwl)
            plusses = '+'*len(tool_name)
            with codecs.open(cwl) as c:
                try:
                    cwl_yaml = yaml.load(c, Loader=yaml.RoundTripLoader)
                    doc = cwl_yaml.get('doc', 'No documentation')
                    f.write(tool_template.format(tool_name, plusses, doc))
                except yaml.YAMLError:
                    pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号