{ "info": { "author": "Matias Bordese", "author_email": "mbordese@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "Unidiff\n=======\n\nSimple Python library to parse and interact with unified diff data.\n\n.. image:: https://travis-ci.org/matiasb/python-unidiff.svg?branch=master\n :target: https://travis-ci.org/matiasb/python-unidiff\n\nInstalling unidiff\n------------------\n\n::\n\n $ pip install unidiff\n\n\nQuick start\n-----------\n\n::\n\n >>> import urllib2\n >>> from unidiff import PatchSet\n >>> diff = urllib2.urlopen('https://github.com/matiasb/python-unidiff/pull/3.diff')\n >>> encoding = diff.headers.getparam('charset')\n >>> patch = PatchSet(diff, encoding=encoding)\n >>> patch\n , , ]>\n >>> patch[0]\n \n >>> patch[0].is_added_file\n True\n >>> patch[0].added\n 6\n >>> patch[1]\n \n >>> patch[1].added, patch[1].removed\n (20, 11)\n >>> len(patch[1])\n 6\n >>> patch[1][2]\n \n >>> patch[2]\n \n >>> print patch[2]\n --- a/unidiff/utils.py\n +++ b/unidiff/utils.py\n @@ -37,4 +37,3 @@\n # - deleted line\n # \\ No newline case (ignore)\n RE_HUNK_BODY_LINE = re.compile(r'^([- \\+\\\\])')\n\n\nLoad unified diff data by instantiating PatchSet with a file-like object as\nargument, or using PatchSet.from_filename class method to read diff from file.\n\nA PatchSet is a list of files updated by the given patch. For each PatchedFile\nyou can get stats (if it is a new, removed or modified file; the source/target\nlines; etc), besides having access to each hunk (also like a list) and its\nrespective info.\n\nAt any point you can get the string representation of the current object, and\nthat will return the unified diff data of it.\n\nAs a quick example of what can be done, check bin/unidiff file.\n\nAlso, once installed, unidiff provides a command-line program that displays\ninformation from diff data (a file, or stdin). For example:\n\n::\n\n $ git diff | unidiff\n Summary\n -------\n README.md: +6 additions, -0 deletions\n\n 1 modified file(s), 0 added file(s), 0 removed file(s)\n Total: 6 addition(s), 0 deletion(s)\n\n\nLoad a local diff file\n----------------------\n\nTo instantiate PatchSet from a local file, you can use:\n\n::\n\n >>> from unidiff import PatchSet\n >>> patch = PatchSet.from_filename('tests/samples/bzr.diff', encoding='utf-8')\n >>> patch\n , , ]>\n\nNotice the (optional) encoding parameter. If not specified, unicode input will be expected. Or alternatively:\n\n::\n\n >>> import codecs\n >>> from unidiff import PatchSet\n >>> with codecs.open('tests/samples/bzr.diff', 'r', encoding='utf-8') as diff:\n ... patch = PatchSet(diff)\n ...\n >>> patch\n , , ]>\n\nFinally, you can also instantiate PatchSet passing any iterable (and encoding, if needed):\n\n::\n\n >>> from unidiff import PatchSet\n >>> with open('tests/samples/bzr.diff', 'r') as diff:\n ... data = diff.readlines()\n ...\n >>> patch = PatchSet(data, encoding='utf-8')\n >>> patch\n , , ]>\n\n\nReferences\n----------\n\n* http://en.wikipedia.org/wiki/Diff_utility\n* http://www.artima.com/weblogs/viewpost.jsp?thread=164293\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/matiasb/python-unidiff", "keywords": "unified,diff,parse,metadata", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "unidiff", "package_url": "https://pypi.org/project/unidiff/", "platform": "", "project_url": "https://pypi.org/project/unidiff/", "project_urls": { "Homepage": "http://github.com/matiasb/python-unidiff" }, "release_url": "https://pypi.org/project/unidiff/0.5.5/", "requires_dist": null, "requires_python": "", "summary": "Unified diff parsing/metadata extraction library.", "version": "0.5.5" }, "last_serial": 4704085, "releases": { "0.5": [ { "comment_text": "", "digests": { "md5": "69a28b0a594bf8bf915aa2f4bbfc5b81", "sha256": "38617d9f79d68751fc0da9e96dc7dbaea67832464d0d2cc05328df37f46b6176" }, "downloads": -1, "filename": "unidiff-0.5.tar.gz", "has_sig": false, "md5_digest": "69a28b0a594bf8bf915aa2f4bbfc5b81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7522, "upload_time": "2014-12-14T23:15:48", "url": "https://files.pythonhosted.org/packages/83/7e/5001125db0c047440f9a844476c8fff9082f15e2343d6f597c792b43f109/unidiff-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "fe4ce1cb5d53a209e1f1a746f8ce5c62", "sha256": "c3d52b3656044c90af6cd01b3424d21d669e99899f1bdde82cc4bbd3fa5fda67" }, "downloads": -1, "filename": "unidiff-0.5.1.tar.gz", "has_sig": false, "md5_digest": "fe4ce1cb5d53a209e1f1a746f8ce5c62", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8187, "upload_time": "2015-01-18T20:49:54", "url": "https://files.pythonhosted.org/packages/44/d5/02a178f6363245397ce82cdad8ea04f5c448d5b7722644eeab3bde254825/unidiff-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "75e8fe08068d2eedae2dad8478f82de5", "sha256": "780e15bc92714e849a9644c17583c29ff87e5f0ae8f6cce20761a2c632e5cd76" }, "downloads": -1, "filename": "unidiff-0.5.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "75e8fe08068d2eedae2dad8478f82de5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15977, "upload_time": "2019-01-16T16:27:27", "url": "https://files.pythonhosted.org/packages/d8/cb/db7a92eb7cc6a0d6128022a5f7c34ac2a3a3407b4504061764a4bd64de36/unidiff-0.5.2-py2.py3-none-any.whl" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "c1acd83605e6dc642a06a11415142525", "sha256": "eb75499ce9ec2a0ebe48d5516f0c847bfc64716beaa520f3404ed2a7a18b2525" }, "downloads": -1, "filename": "unidiff-0.5.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c1acd83605e6dc642a06a11415142525", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 15098, "upload_time": "2017-04-10T22:26:11", "url": "https://files.pythonhosted.org/packages/da/e7/5e04cce3a6a074a0b02c8b016277c51fab67c33753c2bd67560591c1d369/unidiff-0.5.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31a61729e64ee409135a2ccec80c7104", "sha256": "79b4be3e5479dfc6d77747d23ec98200559ca6a842fad1f92c2a7eb56b99195b" }, "downloads": -1, "filename": "unidiff-0.5.3.tar.gz", "has_sig": false, "md5_digest": "31a61729e64ee409135a2ccec80c7104", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8954, "upload_time": "2017-04-10T22:26:08", "url": "https://files.pythonhosted.org/packages/0f/ea/626ad384e51031044c062ab9525269a7066c66c76778e76da1b913fbf112/unidiff-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "da767f08d23cae7c3fc1039d7f38e36f", "sha256": "3b89ec0ba47895174f89bb6be39500c4864776591aa97d9ad809614d927422e8" }, "downloads": -1, "filename": "unidiff-0.5.4-1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "da767f08d23cae7c3fc1039d7f38e36f", "packagetype": "bdist_wheel", "python_version": "any", "requires_python": null, "size": 9810, "upload_time": "2017-05-26T23:44:02", "url": "https://files.pythonhosted.org/packages/fe/4a/240e358b10f1151c1552eb0fae8f81549fbfa34e3c20ad2b739354976f7f/unidiff-0.5.4-1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c8099edf89d2e3bac16123766625a38b", "sha256": "a7baf71846a68c5305a7d6005dfb5eca8798f13861176355a285cbda3206824d" }, "downloads": -1, "filename": "unidiff-0.5.4.tar.gz", "has_sig": false, "md5_digest": "c8099edf89d2e3bac16123766625a38b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12175, "upload_time": "2017-05-26T23:44:17", "url": "https://files.pythonhosted.org/packages/9d/e1/adca0bc74f1cbc07a7d160d3f2e3b9e65367e5222b28330def9592a4330d/unidiff-0.5.4.tar.gz" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "6256f56f1f70f0e32483c12c9f623292", "sha256": "6e7ff4be1a9cd8d72197cd15ec735260b8b95d6f9d3e6fdc8a37301b12af0b27" }, "downloads": -1, "filename": "unidiff-0.5.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6256f56f1f70f0e32483c12c9f623292", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14807, "upload_time": "2018-01-03T21:16:41", "url": "https://files.pythonhosted.org/packages/68/52/c7278fc3c17d1aaade84597968d88f97f0f4ec7288ddedb6970a341c5170/unidiff-0.5.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "47f669d7273541fec45e4cc0fba8d8e9", "sha256": "9c9ab5fb96b6988b4cd5def6b275492442c04a570900d33aa6373105780025bc" }, "downloads": -1, "filename": "unidiff-0.5.5.tar.gz", "has_sig": false, "md5_digest": "47f669d7273541fec45e4cc0fba8d8e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12376, "upload_time": "2018-01-03T21:16:44", "url": "https://files.pythonhosted.org/packages/29/f0/f6a6fc44cb158e2132a139146c3f5d05b0e1bd6eeb720776a57a49c260fc/unidiff-0.5.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6256f56f1f70f0e32483c12c9f623292", "sha256": "6e7ff4be1a9cd8d72197cd15ec735260b8b95d6f9d3e6fdc8a37301b12af0b27" }, "downloads": -1, "filename": "unidiff-0.5.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6256f56f1f70f0e32483c12c9f623292", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14807, "upload_time": "2018-01-03T21:16:41", "url": "https://files.pythonhosted.org/packages/68/52/c7278fc3c17d1aaade84597968d88f97f0f4ec7288ddedb6970a341c5170/unidiff-0.5.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "47f669d7273541fec45e4cc0fba8d8e9", "sha256": "9c9ab5fb96b6988b4cd5def6b275492442c04a570900d33aa6373105780025bc" }, "downloads": -1, "filename": "unidiff-0.5.5.tar.gz", "has_sig": false, "md5_digest": "47f669d7273541fec45e4cc0fba8d8e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12376, "upload_time": "2018-01-03T21:16:44", "url": "https://files.pythonhosted.org/packages/29/f0/f6a6fc44cb158e2132a139146c3f5d05b0e1bd6eeb720776a57a49c260fc/unidiff-0.5.5.tar.gz" } ] }