Python implementation of the patiencediff algorithm
Project description
This package contains the implementation of the patiencediff algorithm, as first described by Bram Cohen.
Like Python’s difflib, this module provides both a convenience unified_diff function for the generation of unified diffs of text files as well as a SequenceMatcher that can be used on arbitrary lists.
Patiencediff provides a good balance of performance, nice output for humans, and implementation simplicity.
The code in this package was extracted from the Bazaar code base.
The package comes with two implementations:
A Python implementation (_patiencediff_py.py); this implementation only requires a Python interpreter and is the more readable version of the two
A C implementation implementation (_patiencediff_c.c); this implementation is faster, but requires a C compiler and is less readable
Usage
To invoke patiencediff from the command-line:
python -m patiencediff file_a file_b
Or from Python:
>>> import patiencediff >>> print ''.join(patiencediff.unified_diff( ... ['a\n', 'b\n', 'b\n', 'c\n'], ... ['a\n', 'c\n', 'b\n'])) --- +++ @@ -1,4 +1,3 @@ a +c b -b -c
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file patiencediff-0.2.4.tar.gz
.
File metadata
- Download URL: patiencediff-0.2.4.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36df31f7616a5892eac2c48b3bb556dfef1d5583412fef7b07eba130d1640ce6 |
|
MD5 | 9d73f4d1ade18541a9066be6f650e426 |
|
BLAKE2b-256 | ebf99ce82070fda841b38f8172b1d3f1b62ea0664307985b7a01a3e11951a288 |