{ "info": { "author": "Jon Craton", "author_email": "jon@joncraton.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "pyastsim\n========\n\n[![Build Status](https://travis-ci.org/jncraton/pyastsim.svg?branch=master)](https://travis-ci.org/jncraton/pyastsim)\n[![PyPI version](https://badge.fury.io/py/pyastsim.svg)](https://badge.fury.io/py/pyastsim)\n\nCalculates the similarity between a batch of source files.\n\nInstallation\n------------\n\nThe program can be installed using pip:\n\n```\npip3 install pyastsim\n```\n\nUsage\n-----\n\n```\nusage: pyastsim [-h] [--threshold THRESHOLD] [--show-diff]\n [--function FUNCTION]\n files [files ...]\n\nCheck source files for similarity\n\npositional arguments:\n files List of files to compare\n\noptional arguments:\n -h, --help show this help message and exit\n --threshold THRESHOLD\n Similarity threshold. Values below this are not\n reported.\n --show-diff Show entire diff when reporting results.\n --function FUNCTION Specific function to compare (Python source only)\n```\n\nExamples\n--------\n\nShow check for similarity of a group of files using default settings:\n\n```\npyastsim *.py\n```\n\nSet a custom threshold to be more or less sensative (default threshold is 80% similarity):\n\n```\npyastsim --threshold 90 *.py\n```\n\nShow full diffs when reporting similar files:\n\n```\npyastsim --show-diff *.py\n```\n\nRemove all but one function from the AST before performing comparison:\n\n```\npyastsim --function my_func *.py\n```\n\nLanguage Support\n----------------\n\n- Python (using internal AST for comparison)\n- C/C++ (using GCC assembly output for comparison)\n\nDifference Calculation\n----------------------\n\nThe difference is calculated by first converting each supplied file to an abstract syntax tree (AST). The AST is then normalized to remove comments, docstrings, and standardize identifier names. We then convert the AST back to Python source code and calculate the Damerau\u2013Levenshtein distance between each pair of source files. We further normalize this number by dividing it by the mean of the number of unicode code points in the files being compared. This gives us a rough percentage similarity between our files. To summarize:\n\n1. Convert to AST\n2. Remove comments and docstrings\n3. Normalize identifiers\n4. Convert back to source\n5. Calculate Damerau\u2013Levenshtein distance\n6. Covert the edit distance to a percentage\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jncraton/pyastsim", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyastsim", "package_url": "https://pypi.org/project/pyastsim/", "platform": "", "project_url": "https://pypi.org/project/pyastsim/", "project_urls": { "Homepage": "https://github.com/jncraton/pyastsim" }, "release_url": "https://pypi.org/project/pyastsim/1.1.0/", "requires_dist": [ "astunparse", "editdistance" ], "requires_python": ">=3.6", "summary": "Detect similarities between Python source files", "version": "1.1.0" }, "last_serial": 5990594, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "c29426f805e9972193c0a2417a7ee00e", "sha256": "31e4db99bae018091be37fbc42dce6a9491c1ffc9de922cd9b07c82c5c04a156" }, "downloads": -1, "filename": "pyastsim-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c29426f805e9972193c0a2417a7ee00e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 2451, "upload_time": "2019-10-03T16:02:27", "url": "https://files.pythonhosted.org/packages/26/4d/375d9941b85c0090c06822f61d639a6581d51072e4adac6e96a0a24983bc/pyastsim-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f8c67151ed691393a1a9a5ce07f42a74", "sha256": "b783992e4dc4b12b1146fdd89ead54cef01a7186d0565502827214849c687ce9" }, "downloads": -1, "filename": "pyastsim-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f8c67151ed691393a1a9a5ce07f42a74", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 1983, "upload_time": "2019-10-03T16:02:29", "url": "https://files.pythonhosted.org/packages/df/6e/70e81c991d8bd3427953b98c7772a9b09922a0ad18f9cfe65b4a47ceb979/pyastsim-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "b3719072b76f4ab8eb6deed265b497f9", "sha256": "890926397fccec829f7571398c62f9aa1875c2dfca0840e4c32002fd3d6005e9" }, "downloads": -1, "filename": "pyastsim-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b3719072b76f4ab8eb6deed265b497f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 3768, "upload_time": "2019-10-03T16:09:40", "url": "https://files.pythonhosted.org/packages/fb/9a/ffea1dd82815c38ffc236e05cfb39bc5c98c3d284b41b0b2ac7b6e06c67c/pyastsim-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "578033372dd65817771117a41c6dfe96", "sha256": "bcce9db27b72069d74dfa09213b969e28a33987ae0111e199b3786ea9dc39258" }, "downloads": -1, "filename": "pyastsim-1.0.2.tar.gz", "has_sig": false, "md5_digest": "578033372dd65817771117a41c6dfe96", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3059, "upload_time": "2019-10-03T16:09:41", "url": "https://files.pythonhosted.org/packages/28/63/ade2ee9c4a5e5626f273dc456fecde2623c2544c9f7127554494bc7c704e/pyastsim-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "a64c5107452e2f3137ddd56f4790d118", "sha256": "3f592ae96b4744d4c022943477efd9ebf3d3411b110ccce17f760808e2987d6e" }, "downloads": -1, "filename": "pyastsim-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a64c5107452e2f3137ddd56f4790d118", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 3794, "upload_time": "2019-10-03T16:17:46", "url": "https://files.pythonhosted.org/packages/71/63/69d0b8903b4d4612e1c0287e11dc941cf36ead8e09f21772c52f415f5420/pyastsim-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ec304689851c2bc61bc6ca102238064", "sha256": "18dbe91ae8258516dddf36db1e979e1aad9993d76a7530bf954b279663468081" }, "downloads": -1, "filename": "pyastsim-1.0.3.tar.gz", "has_sig": false, "md5_digest": "8ec304689851c2bc61bc6ca102238064", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3066, "upload_time": "2019-10-03T16:17:47", "url": "https://files.pythonhosted.org/packages/5b/e8/ac5ec5942f235d80c0559052aa0a1f70f03db233f7e4bd536598069201c5/pyastsim-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "e988490da95b135c3e66257910bd2a4e", "sha256": "b1473048f8a9969faffa770710f741473f3d9ca5d670b40ce226d17aa77586e7" }, "downloads": -1, "filename": "pyastsim-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "e988490da95b135c3e66257910bd2a4e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 3876, "upload_time": "2019-10-03T18:36:15", "url": "https://files.pythonhosted.org/packages/4d/e1/c37883764d5ae131548c15d399de4329942110e14d1a6c5ecb19d19a27dd/pyastsim-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fda16e5ba4c09f560f496418908b7618", "sha256": "f9153f35cccd05a67c5209249ebb2cae20eb271ffdcb0642115c943c4d8ea262" }, "downloads": -1, "filename": "pyastsim-1.0.4.tar.gz", "has_sig": false, "md5_digest": "fda16e5ba4c09f560f496418908b7618", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3188, "upload_time": "2019-10-03T18:36:16", "url": "https://files.pythonhosted.org/packages/30/31/5d7a00d34798aecacbec49c0bf635dff0dc5ee0c4712ffdc8c8f7756c9ad/pyastsim-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "ec72964d92904163c1556198be6ecccb", "sha256": "a653e6f6da909ebd8782052eff045fc365d5e03103ed50d82178022a4cc7bb6c" }, "downloads": -1, "filename": "pyastsim-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "ec72964d92904163c1556198be6ecccb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 3878, "upload_time": "2019-10-03T18:38:30", "url": "https://files.pythonhosted.org/packages/9c/7f/fb0d3a07ce46c4f836a28019080136558277db8d47a6a85a99c5e1f6a54f/pyastsim-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f1046c50d33ecb58b9092e6a53059067", "sha256": "0b4db2a42677e7ff1e217dc60ca9322081ad05dedcda860b6bbab532c3b2f36e" }, "downloads": -1, "filename": "pyastsim-1.0.5.tar.gz", "has_sig": false, "md5_digest": "f1046c50d33ecb58b9092e6a53059067", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3180, "upload_time": "2019-10-03T18:38:31", "url": "https://files.pythonhosted.org/packages/ca/6d/3431f014062aa562219ece733164dab8f4b43884bee223cdd14c1ec6bf4a/pyastsim-1.0.5.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "52cfd2dd5624e733cfd58737ce27c42d", "sha256": "37788db4a0587214975a0e1193024658a9771d490c3907bf8d90508ad7d261d5" }, "downloads": -1, "filename": "pyastsim-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "52cfd2dd5624e733cfd58737ce27c42d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 4032, "upload_time": "2019-10-17T15:27:50", "url": "https://files.pythonhosted.org/packages/68/00/143073956148761f56eaa8680568f20696e00c1349ade54a0a4b9e2d167c/pyastsim-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fec5545ab8733bb76ffbbd39a66c747d", "sha256": "23c660031e4996dab088442d4dfb163671416f4b85aba05f912d38d2311cd645" }, "downloads": -1, "filename": "pyastsim-1.1.0.tar.gz", "has_sig": false, "md5_digest": "fec5545ab8733bb76ffbbd39a66c747d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3339, "upload_time": "2019-10-17T15:27:54", "url": "https://files.pythonhosted.org/packages/6c/62/affab3e70ba4ccd61e9151d904dd7112d572d7d8d3bfd9542ec0848bf82c/pyastsim-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "52cfd2dd5624e733cfd58737ce27c42d", "sha256": "37788db4a0587214975a0e1193024658a9771d490c3907bf8d90508ad7d261d5" }, "downloads": -1, "filename": "pyastsim-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "52cfd2dd5624e733cfd58737ce27c42d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 4032, "upload_time": "2019-10-17T15:27:50", "url": "https://files.pythonhosted.org/packages/68/00/143073956148761f56eaa8680568f20696e00c1349ade54a0a4b9e2d167c/pyastsim-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fec5545ab8733bb76ffbbd39a66c747d", "sha256": "23c660031e4996dab088442d4dfb163671416f4b85aba05f912d38d2311cd645" }, "downloads": -1, "filename": "pyastsim-1.1.0.tar.gz", "has_sig": false, "md5_digest": "fec5545ab8733bb76ffbbd39a66c747d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3339, "upload_time": "2019-10-17T15:27:54", "url": "https://files.pythonhosted.org/packages/6c/62/affab3e70ba4ccd61e9151d904dd7112d572d7d8d3bfd9542ec0848bf82c/pyastsim-1.1.0.tar.gz" } ] }