core.py 文件源码

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

项目:schemapi 作者: altair-viz 项目源码 文件源码
def format_description(content, width=70, indent=8, indent_first=False):
    """Format documentation description"""
    # TODO: document, test, and use
    lines = content.splitlines()

    def format_line(line):
        if line.startswith('-'):
            return textwrap.indent(textwrap.fill(line, width - indent - 2),
                                   (indent + 2) * ' ')[2:]
        else:
            return textwrap.indent(textwrap.fill(line, width - indent),
                                   indent * ' ')

    result = '\n'.join(format_line(line) for line in lines if line)
    if not indent_first:
        result = result.lstrip()
    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号