Tiny diffs using difflib's SequenceMatcher
Project description
Do you have textual or binary data that you need to patch?
>>> a = 'you say yes, i say no'
>>> b = 'you say stop, and i say go go go'
But you want a smaller patchfile than what difflib's unified_diff()
creates?
>>> diff = '\n'.join(difflib.unified_diff(a, b))
>>> len(diff)
137
mini_patch
also uses difflib's SequenceMatcher
machinery, but it creates
tiny patches:
>>> patch = mini_patch.make_mini_patch(a, b)
>>> print patch
'0!d:8,2;i:11,$3$top;i:12,$4$ and;r:19,1,$1$g;i:21,$6$ go go;'
>>> len(patch)
60
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
mini_patch-0.0.2.tar.gz
(2.4 kB
view hashes)
Built Distributions
Close
Hashes for mini_patch-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dac4611905499e764e0b5e081998284ffb7d1d0e12471597d1fca91b3b0f887 |
|
MD5 | 427a4035c324d8f71c3688b1e94e9f94 |
|
BLAKE2b-256 | d64deb023f761453f306e0219dbfede553ad937a23010f0e797e38e7f919d4d5 |
Close
Hashes for mini_patch-0.0.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7111acab42bef2f8d23a3d924e3ccba265b61b90feb9192b4baa60d5ba4748aa |
|
MD5 | 8904dfe139259225706e33d406dff947 |
|
BLAKE2b-256 | 5fba7d7fb1da28f1186fc95247436e50fdc51a009f3136e73b20ea47718ff85d |