completer.py 文件源码

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

项目:ubc 作者: axiros 项目源码 文件源码
def _parse_func_code(lines):
    from inspect import cleandoc
    if len(lines) == 1:
        _ = lines[0].split(':', 1)
        return [_[0] + ':'], '', _[1]

    sig, doc = [], []
    while lines:
        l = lines.pop(0)
        sig.append(l)
        if l.rstrip().endswith(':'):
            break

    l = '\n'.join(lines).strip()
    for apo in "'''", '"""', "'", '"', '':
        if l.startswith(apo):
            break
    if not apo:
        # no docstring
        return sig, '', lines
    l = l.split(apo, 2)
    return sig, cleandoc(l[1]), l[2]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号