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.1.tar.gz
(2.4 kB
view hashes)
Built Distributions
Close
Hashes for mini_patch-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d008965c375a5fdc605cbf589fc0f1805fae3ddbf3c2e29ea4925cbd33c623b7 |
|
MD5 | ddf9f39463a3a2bc3311e3c9b7776a62 |
|
BLAKE2b-256 | ce2f75d696c222b19e8cb529461af6977a512623fef66386edba92cf25f5a6ca |
Close
Hashes for mini_patch-0.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc556ca27987414116c6f9dfab76341d319d3dc728d79f513ad9a3f2fbe28ab |
|
MD5 | b0c421e17a2978d7ba84fc58d816a609 |
|
BLAKE2b-256 | 1111a0c96eb1fbe0e35c61b417e96f18fd70e30a669cd05be6151845c5a70b9a |