handaxeweb.py 文件源码

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

项目:tailbiter 作者: darius 项目源码 文件源码
def expand(chunks, name, version):
    "Return the named chunk with any chunk-references recursively expanded."
    template, latest = '', -1
    for v in range(version+1):
        t = chunks.get(name + ' v%d+' % v, '')
        if t:
            latest = v
            template += t
    for v in range(version, latest, -1):
        t = chunks.get(name + ' v%d' % v, '')
        if t:
            template += t
            break
    if not template:
        template = chunks[name]
    return chunk_ref_pattern.sub(
        lambda mo: indent(mo.group(1), expand(chunks, mo.group(2), version)),
        template)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号