Python diff wrapper
Project description
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:
...
# if you want to produce a combined (merge) diff:
moreorless.combined.combined_diff(
[astr, bstr], [cstr]
) -> str:
...
License
moreorless is copyright Tim Hatch, and licensed under
the MIT license. I am providing code in this repository to you under an open
source license. This is my personal repository; the license you receive to
my code is from me and not from my employer. See the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moreorless-0.5.0.tar.gz.
File metadata
- Download URL: moreorless-0.5.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
560a04f85006fccd74feaa4b6213a446392ff7b5ec0194a5464b6c30f182fa33
|
|
| MD5 |
2ea1fab53d8dc13b97dd16b8d9a4160e
|
|
| BLAKE2b-256 |
8d852e4999ac4a21ab3c5f31e2a48e0989a80be3afc512a7983e3253615983d4
|
File details
Details for the file moreorless-0.5.0-py3-none-any.whl.
File metadata
- Download URL: moreorless-0.5.0-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66228870cd2f14bad5c3c3780aa71e29d3b2d9b5a01c03bfbf105efd4f668ecf
|
|
| MD5 |
b449b3f28f3999fa5ffac4ddda1728b8
|
|
| BLAKE2b-256 |
fa2e9ea80ca55b73530b7639c6f146a58f636ddfe5a852ad467a44fe3e80d809
|