{ "info": { "author": "Alex Chan", "author_email": "alex@alexwlchan.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "filecmp2\n========\n\nIf you say \"two files are the same\", you could mean at least three different things:\n\n* *The files have the same os.stat() signature.*\n (This is the shallow copy done by ``filecmp.cmp()``.)\n\n* *The files have the same contents. They're byte-for-byte identical.*\n\n* *They're the same files on disk (modulo hard links).*\n\nYou can compare files with `filecmp `_\nor `os `_, but it's not always obvious what\nsort of comparison you're doing.\n\nSince `explicit is better than implicit `_,\nfilecmp2 provides three functions so you can be clear about what you mean by \"same\":\n\n.. code-block:: python\n\n def cmp_path_contents(path1, path2):\n \"\"\"\n Returns True if the files at paths ``path1`` and ``path2``\n have the same contents.\n \"\"\"\n\n\n def cmp_stat(path1, path2):\n \"\"\"\n Returns True if the os.stat() signature of ``path1`` and ``path2``\n are the same.\n \"\"\"\n\n\n def cmp_same_file(path1, path2):\n \"\"\"\n Returns True if ``path1`` and ``path2`` point to the same file on disk.\n \"\"\"\n\nIf you have two file-like objects, you can also compare their contents with\n``cmp_contents``:\n\n.. code-block:: pycon\n\n >>> import filecmp2\n >>> import io\n\n >>> b1 = io.BytesIO(b\"hello world\")\n >>> b2 = io.BytesIO(b\"hello world\")\n >>> filecmp2.cmp_contents(b1, b2)\n True\n\n >>> b1 = io.BytesIO(b\"hello world\")\n >>> b2 = io.BytesIO(b\"the cheese shop\")\n >>> filecmp2.cmp_contents(b1, b2)\n False\n\nThis is useful if you're dealing with streams that you don't want to write to disk.\n\nI wrote this after discovering that I was using ``filecmp.cmp()`` wrong, and doing\na shallow copy instead of checking the contents of the files. I don't find the\ncurrent API very clear, and reading the Python bug tracker suggests I'm not the only\nperson who's made this mistake. Although the docs explain the distinction, it's\nlost on somebody who's casually reading the code or reviewing without the docs.\n\nInstallation\n************\n\nInstall from PyPI (``pip install filecmp2``), or copy the single file directly\ninto your codebase.\n\nLicense\n*******\n\nMIT.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/alexwlchan/filecmp2", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "filecmp2", "package_url": "https://pypi.org/project/filecmp2/", "platform": "", "project_url": "https://pypi.org/project/filecmp2/", "project_urls": { "Homepage": "https://github.com/alexwlchan/filecmp2" }, "release_url": "https://pypi.org/project/filecmp2/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Are these two files the same? Explicit file comparisons.", "version": "1.0.0" }, "last_serial": 5935366, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "cf71e26f04d1c10341ed6c3d6f46a736", "sha256": "343fb7cbed3429dcd681e763fae54f6ae51ba8c8ed51d5bf07b6e0ade22d2855" }, "downloads": -1, "filename": "filecmp2-1.0.0-reupload.tar.gz", "has_sig": false, "md5_digest": "cf71e26f04d1c10341ed6c3d6f46a736", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2158, "upload_time": "2019-10-06T17:11:58", "url": "https://files.pythonhosted.org/packages/e1/4f/769e92d8f7ab6f357e34cb9c6df76070ae699129c39dbe615243762285fa/filecmp2-1.0.0-reupload.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cf71e26f04d1c10341ed6c3d6f46a736", "sha256": "343fb7cbed3429dcd681e763fae54f6ae51ba8c8ed51d5bf07b6e0ade22d2855" }, "downloads": -1, "filename": "filecmp2-1.0.0-reupload.tar.gz", "has_sig": false, "md5_digest": "cf71e26f04d1c10341ed6c3d6f46a736", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2158, "upload_time": "2019-10-06T17:11:58", "url": "https://files.pythonhosted.org/packages/e1/4f/769e92d8f7ab6f357e34cb9c6df76070ae699129c39dbe615243762285fa/filecmp2-1.0.0-reupload.tar.gz" } ] }