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, ASCII-encoded 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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size mini_patch-1.0.0-py2-none-any.whl (4.0 kB) | File type Wheel | Python version py2 | Upload date | Hashes View |
Filename, size mini_patch-1.0.0-py3-none-any.whl (3.0 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size mini_patch-1.0.0.tar.gz (2.6 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for mini_patch-1.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99b3cfe6e8db42b25495ac73b00268f00e8376dacada35f9e0f1b4a4d68945be |
|
MD5 | a0629db0bb5afdfb89cb4fed67c26ee5 |
|
BLAKE2-256 | d4f2a6fe1566fcdbbee9cecdd7d2efe838517e50be111048da40d2d92b3c520d |
Close
Hashes for mini_patch-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a07adbe00621867fbee7f8cf01e2a0adbfafce3641c751064537c011882edee |
|
MD5 | 1f1f4760e7bc714c609032a660bc439f |
|
BLAKE2-256 | fe91b0fbefeec4a3763d6a549aa644c51aaccc91dba9f5c1cfcff9fde1fda862 |