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.encode('utf-8'), b.encode('utf-8')) >>> patch '0!d:8,2;i:11,$4$dG9w;i:12,$8$IGFuZA==;r:19,1,$4$Zw==;i:21,$8$IGdvIGdv;' >>> len(patch) 70 `
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.3.tar.gz
(2.6 kB
view hashes)
Built Distributions
Close
Hashes for mini_patch-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79bee64a4a6f22701f5e379602a1e483b1bd4219cd64f947fa85db822d5e3aac |
|
MD5 | 3e4466d8cc1d779d7c214b533ace3185 |
|
BLAKE2b-256 | 273433b9fcb6f4dd027afaea95172f0169cfe4e0d7003aeac3d2eee8bc73ce2a |
Close
Hashes for mini_patch-0.0.3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8521b12f94fd7f164c636f445457fa9095da2376a56248485db5dc5542c7472f |
|
MD5 | 5baf86878fa8194a10caf4500238e832 |
|
BLAKE2b-256 | 8fa22247452d878457f0e045fb153fa95b112dd27c11a17b6ddffdd7b04a0867 |