{ "info": { "author": "Jerome Lecomte", "author_email": "jlecomte1972@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: Text Editors :: Text Processing", "Topic :: Utilities" ], "description": "Python Mass Editor\n==================\n\nImplements a python mass editor class to process multiple files using Python\ncode. The modification(s) is (are) shown on stdout as a diff output. One\ncan then modify the target file(s) in place with the -w/--write option.\n\n.. WARNING::\n\n This tool is usefull as far as it goes but it does rely on the python \n ``eval()`` function and does not check the code being executed. \n It is a major security risk and one should not use this tool\n in a production environment.\n\n See `Ned Batchelder's article`_ for a thorough discussion of the dangers \n linked to ``eval()`` and ways to circumvent them. Note that None of the \n counter-measure suggested in the article are implemented at this time.\n\n\nUsage\n-----\n\nYou probably will need to know the basics of the `Python re module`_ (regular \nexpressions).\n\n::\n\n usage: massedit.py [-h] [-v] [-w] [-V] [-e EXPRESSIONS] [-s STARTDIR]\n [-m MAXDEPTH] [-o output]\n pattern [pattern ...]\n\n Python mass editor\n \n positional arguments:\n pattern file patterns to process.\n\n optional arguments:\n -h, --help show this help message and exit\n -v, --version show program's version number and exit\n -w, --write modify target file(s) in place. Shows diff otherwise.\n -V, --verbose increases log verbosity (can be specified multiple\n times)\n -e EXPRESSIONS, --expression EXPRESSIONS\n Python expressions to be applied on all files. Use the\n line variable to reference the current line.\n -s START_DIR, --start START_DIR\n Starting directory in which to look for the files. If\n there is one pattern only and it includes a directory,\n the start dir will be that directory and the max depth\n level will be set to 1.\n -m MAX_DEPTH, --max-depth-level MAX_DEPTH\n Maximum depth when walking subdirectories.\n -o output, --output output\n redirect output to a file\n \n example: massedit.py -e \"re.sub('failIf', 'assertFalse', line)\" *.py\n \n \nIf massedit is installed as a package (from pypi for instance), one can \ninteract with it as a command line tool :\n\n::\n\n python -m massedit -e \"re.sub('assertEquals', 'assertEqual', line)\" test.py\n\n\nOr as a library (command line option above to be passed as kewyord arguments):\n\n::\n\n >>> import massedit\n >>> filenames = ['massedit.py']\n >>> massedit.edit_files(filenames, [\"re.sub('Jerome', 'J.', line)\"])\n \n\nLastly, there is a convenient ``massedit.bat`` wrapper for Windows included in\nthe distribution.\n\n\nInstallation\n------------\n\nDownload ``massedit.py`` from ``http://github.com/elmotec/massedit`` or :\n\n::\n \n pip install massedit\n\n\nPlans\n-----\n\n- Add support for 3rd party tool (e.g. `autopep8`_) to process the files.\n- Add support for a file of expressions as an argument to allow multiple \n modification at once.\n- Find a satisfactory way (ie. easy to use) to handle multiline regex as the \n current version works on a line by line basis.\n- Add magic variables ``lineno`` and ``filename`` in addition to ``line``.\n\n\nRationale\n---------\n\n- I have a hard time practicing more than a few dialects of regular \n expressions. \n- I need something portable to Windows without being bothered by eol. \n- I believe Python is the ideal tool to build something more powerful than \n simple regex based substitutions.\n\n\nBackground\n----------\n\nI have been using runsed and checksed (from Unix Power Tools) for years and\ndid not find a good substitute under Windows until I came across Graham \nFawcett python recipe 437932_ on ActiveState. It inspired me to write the \nPython Mass Editor.\n\nThe core was fleshed up a little, and here we are. If you find it useful and\nenhance it please, do not forget to submit patches. Thanks!\n\nIf you are more interested in awk-like tool, you probably will find pyp_ a\nbetter alternative. This is certainly a more mature tool.\n\n\nLicense\n-------\n\nLicensed under the term of `MIT License`_. See attached file LICENSE.txt.\n\n\nChanges\n-------\n\n0.61 (2012-07-06)\n Added massedit.edit_files function to ease usage as library instead of as\n a command line tool (suggested by Maxim Veksler).\n\n0.60 (2012-07-04)\n Treats arguments as patterns rather than files to ease processing of \n multiple files in multiple subdirectories. Added -s (start directory)\n and -m (max depth) options. \n\n0.52 (2012-06-05)\n Upgraded for python 3. Still compatible with python 2.7.\n\n0.51 (2012-05)\n Initial release (Beta).\n\n\n.. _437932: http://code.activestate.com/recipes/437932-pyline-a-grep-like-sed-like-command-line-tool/\n.. _Python re module: http://docs.python.org/library/re.html\n.. _Pyp: http://code.google.com/p/pyp/\n.. _MIT License: http://en.wikipedia.org/wiki/MIT_License\n.. _autopep8: http://pypi.python.org/pypi/autopep8\n.. _Ned Batchelder's article: http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/elmotec/massedit", "keywords": "sed editor stream python edit", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "Python-Mass-Editor", "package_url": "https://pypi.org/project/Python-Mass-Editor/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Python-Mass-Editor/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/elmotec/massedit" }, "release_url": "https://pypi.org/project/Python-Mass-Editor/0.62/", "requires_dist": null, "requires_python": null, "summary": "Edit multiple files using Python text processing modules", "version": "0.62" }, "last_serial": 785447, "releases": { "0.51": [ { "comment_text": "", "digests": { "md5": "59503a932474c292764049650fa368fd", "sha256": "f00988a0e515419760afcbd47d8b427f654b56c8e92d33188bba61acc3eabe38" }, "downloads": -1, "filename": "Python Mass Editor-0.51.zip", "has_sig": false, "md5_digest": "59503a932474c292764049650fa368fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5714, "upload_time": "2012-05-12T02:12:00", "url": "https://files.pythonhosted.org/packages/30/7c/238007e8774ea0daaec863ee269e63a205ab17fc3ffb7aef16e4e06fde5c/Python%20Mass%20Editor-0.51.zip" } ], "0.52": [ { "comment_text": "", "digests": { "md5": "264d47457d72c8be78cf41be5535d4c2", "sha256": "2b3963efebdd41da1528b43833f35fa665d4d516e62dcababefa3a58ab1c11da" }, "downloads": -1, "filename": "Python Mass Editor-0.52.zip", "has_sig": false, "md5_digest": "264d47457d72c8be78cf41be5535d4c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7439, "upload_time": "2012-06-06T04:39:01", "url": "https://files.pythonhosted.org/packages/e4/82/637419e3e1020ba6f6ece51a394f1374f244b3426fc5497506e02b454f91/Python%20Mass%20Editor-0.52.zip" } ], "0.60": [ { "comment_text": "", "digests": { "md5": "961fa25c120f2ca36b3216811de36258", "sha256": "e44ca28605b10285ce46496b94346df4baca284bf577de00702942fa4856254d" }, "downloads": -1, "filename": "Python Mass Editor-0.60.zip", "has_sig": false, "md5_digest": "961fa25c120f2ca36b3216811de36258", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9291, "upload_time": "2012-07-04T17:29:14", "url": "https://files.pythonhosted.org/packages/ba/72/350b518ec3706a1fcf269f87f20788c581280672707549228d37dce99169/Python%20Mass%20Editor-0.60.zip" } ], "0.61": [ { "comment_text": "", "digests": { "md5": "e0877d29b325766d97e9794a70a5f743", "sha256": "15a4c1fcf7561067eedb0a043853b7890cd71b300d4b3d9d8cb325728286cf3a" }, "downloads": -1, "filename": "Python Mass Editor-0.61.zip", "has_sig": false, "md5_digest": "e0877d29b325766d97e9794a70a5f743", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9947, "upload_time": "2012-07-07T04:43:40", "url": "https://files.pythonhosted.org/packages/5c/15/776e7dd7024328bf638fafb3cac70b8ec415de45a68951c77487d33ed202/Python%20Mass%20Editor-0.61.zip" } ], "0.62": [ { "comment_text": "", "digests": { "md5": "a8a6bbc54f465c1709a258714c4f1d03", "sha256": "24274633e760485e6762298dabf4f5cf29edb10c66da0b558b24aa174c0115a8" }, "downloads": -1, "filename": "Python Mass Editor-0.62.zip", "has_sig": false, "md5_digest": "a8a6bbc54f465c1709a258714c4f1d03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9974, "upload_time": "2013-04-12T02:36:35", "url": "https://files.pythonhosted.org/packages/e7/a6/ab04be0802998ff430c386f9afff471f8ee5f98506bd26ab976319b2e3c6/Python%20Mass%20Editor-0.62.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a8a6bbc54f465c1709a258714c4f1d03", "sha256": "24274633e760485e6762298dabf4f5cf29edb10c66da0b558b24aa174c0115a8" }, "downloads": -1, "filename": "Python Mass Editor-0.62.zip", "has_sig": false, "md5_digest": "a8a6bbc54f465c1709a258714c4f1d03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9974, "upload_time": "2013-04-12T02:36:35", "url": "https://files.pythonhosted.org/packages/e7/a6/ab04be0802998ff430c386f9afff471f8ee5f98506bd26ab976319b2e3c6/Python%20Mass%20Editor-0.62.zip" } ] }