跳转到主要内容

Python diff包装器

项目描述

moreorless

This is a thin wrapper around difflib.unified_diff that Does The Right Thing for "No newline at eof". The args are also simplified compared to difflib

moreorless.unified_diff(
    astr: str,
    bstr: str,
    filename: str,
    n: int = 3,
) -> str:
    ...

# raises moreorless.patch.PatchException
moreorless.patch.apply_single_file(
    contents: str,
    patch: str,
    allow_offsets: bool = True,
) -> str:
    ...

# uses click to write to stdout with colors
moreorless.click.echo_color_unified_diff(
    astr: str,
    bstr: str,
    filename: str,
    n: int = 3
) -> None:
    ...

# if you want to use unified_diff yourself first (e.g. in another process)
moreorless.click.echo_color_precomputed_diff(
    diff: str,
) -> None:
    ...

许可协议

moreorless版权所有Tim Hatch,并按照MIT许可协议授权。我在此仓库中向您提供开源许可的代码。这是我的个人仓库;您从我那里获得的代码许可来自我,而不是我的雇主。有关详情,请参阅LICENSE文件。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

moreorless-0.4.0.tar.gz (10.1 kB 查看哈希值)

上传时间:

构建分布

moreorless-0.4.0-py2.py3-none-any.whl (9.3 kB 查看哈希值)

上传时间: Python 2 Python 3

支持者