{ "info": { "author": "Kevin Wurster", "author_email": "wursterk@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Topic :: Text Processing :: Filters", "Topic :: Text Processing :: General", "Topic :: Utilities" ], "description": "====\npyin\n====\n\nIt's like sed, but Python!\n\n.. image:: https://travis-ci.org/geowurster/pyin.svg?branch=master\n :target: https://travis-ci.org/geowurster/pyin\n\n.. image:: https://coveralls.io/repos/geowurster/pyin/badge.svg?branch=master\n :target: https://coveralls.io/r/geowurster/pyin?branch=master\n\n\nWhy?\n====\n\nThere are plenty of Unix tools, like ``sed`` and ``awk`` for processing text\ndata from stdin or a file on disk, but the syntax can be unfriendly and\nsometimes its just easier to write a really simple script with a for loop\nand some if statements. This project seeks to drop you in the middle of that\nfor loop and let you write your own Python expressions to quickly get the job\ndone without actually writing a script, handle I/O, etc.\n\n\nCommand Line Interface\n======================\n\nThis project is intended to be used from the included utility ``pyin``, although\nthe underlying ``pyin.core.pmap()`` function could be used elsewhere with\nnon-string objects.\n\n.. code-block:: console\n\n Usage: pyin [OPTIONS] EXPRESSIONS...\n\n It's like sed, but Python!\n\n Map Python expressions across lines of text. If an expression evaluates as\n 'False' or 'None' then the current line is thrown away. If an expression\n evaluates as 'True' then the next expression is evaluated. If a list or\n dictionary is encountered it is JSON encoded. All other objects are cast\n to string.\n\n Newline characters are stripped from the end of each line before processing\n and are added on write unless disabled with '--no-newline'.\n\n This utility employs 'eval()' internally but uses a limited scope to help\n prevent accidental side effects, but there are plenty of ways to get around\n this so don't pass anything through pyin that you wouldn't pass through\n 'eval()'.\n\n Remove lines that do not contain a specific word:\n\n $ cat INFILE | pyin \"'word' in line\"\n\n Capitalize lines containing a specific word:\n\n $ cat INFILE | pyin \"line.upper() if 'word' in line else line\"\n\n Only print every other word from lines that contain a specific word:\n\n $ cat INFILE | pyin \\\n > \"'word' in line\" \\ # Get lines with 'word' in them\n > \"line.split()[::2])\" \\ # Grab every other word\n > \"' '.join(line)\" # Convert list from previous expr to str\n\n Process all input text as though it was a single line to replace carriage\n returns with the system newline character:\n\n $ cat INFILE | pyin --block \\\n > \"line.replace('\\r\\n', os.newline)\"\n\n For a more in-depth explanation about exactly what's going on under the\n hood, see the the docstring in 'pyin.core.pmap()':\n\n $ python -c \"help('pyin.core.pmap')\"\n\n Options:\n --version Show the version and exit.\n -i, --infile PATH Input text file. [default: stdin]\n -o, --outfile PATH Output text file. [default: stdout]\n --block Operate on all input text as though it was a single\n line.\n --no-newline Don't ensure each line ends with a newline character.\n --help Show this message and exit.\n\n\nInstalling\n==========\n\nVia pip:\n\n.. code-block:: console\n\n $ pip install pyin\n\nFrom master branch:\n\n.. code-block:: console\n\n $ git clone https://github.com/geowurster/pyin\n $ cd pyin && python setup.py install\n\n\nWhat about `py -x `_?\n============================================================\n\nMost of this project was written with very little knowledge of ``py`` and no\nknowledge of ``py -x``, which serves almost exactly the same purpose. The\nprimary difference between the two projects is that ``pyin`` requires I/O and\nhas some smarter filtering for expressions that evaluate as ``True`` or\n``False``.\n\n\nDeveloping\n==========\n\nInstall:\n\n.. code-block:: console\n\n $ git clone https://github.com/geowurster/pyin\n $ cd pyin\n $ virtualenv venv && source venv/bin/activate\n $ pip install -e .\\[dev\\]\n $ py.test tests --cov pyin --cov-report term-missing\n\n\nLicense\n=======\n\nSee ``LICENSE.txt``", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/geowurster/pyin", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "pyin", "package_url": "https://pypi.org/project/pyin/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyin/", "project_urls": { "Homepage": "https://github.com/geowurster/pyin" }, "release_url": "https://pypi.org/project/pyin/0.5.4/", "requires_dist": null, "requires_python": null, "summary": "It's like sed, but Python!", "version": "0.5.4" }, "last_serial": 1663035, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "114b9a8eda6fe86ca40a8398b1f077ff", "sha256": "17faf5a1d4e0099d692c8f1de6678831b6d6ecdec7f0c7b14189d42132f286e0" }, "downloads": -1, "filename": "pyin-0.1.0.tar.gz", "has_sig": false, "md5_digest": "114b9a8eda6fe86ca40a8398b1f077ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4341, "upload_time": "2015-02-01T19:08:49", "url": "https://files.pythonhosted.org/packages/68/0f/e083cc49fe7e2fda80291f006bf28631319f45aa896bc2c784fd12bb89e5/pyin-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "536c7e4fbf530509f6831093e0271ce3", "sha256": "a4544ebdb5051519219c03afedd4736f408f3921e8455f9897985b9a6ff4f85b" }, "downloads": -1, "filename": "pyin-0.2.0.tar.gz", "has_sig": false, "md5_digest": "536c7e4fbf530509f6831093e0271ce3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5030, "upload_time": "2015-02-03T03:29:01", "url": "https://files.pythonhosted.org/packages/ca/63/8640f8a25e9136bc3612722d997113bf5857085ea0da1b818724148370e2/pyin-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "71bd32843a459fe54f9ce50804cc6973", "sha256": "d49ae6d473196cc2046adbe0429be40838c806f196a192da3d5d70efadaf6f28" }, "downloads": -1, "filename": "pyin-0.2.1.tar.gz", "has_sig": false, "md5_digest": "71bd32843a459fe54f9ce50804cc6973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5433, "upload_time": "2015-02-04T03:33:48", "url": "https://files.pythonhosted.org/packages/dc/dd/5c518112cb2b71dc7df3c233786abb2d8b948d2d7930c946410757430213/pyin-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "e26c7fc263628a278411167df3f22e6e", "sha256": "b658acb505c9c305ca59ee2bc176aa6711b2c133235b99767b136d5dca09e96e" }, "downloads": -1, "filename": "pyin-0.2.2.tar.gz", "has_sig": false, "md5_digest": "e26c7fc263628a278411167df3f22e6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6847, "upload_time": "2015-02-05T18:05:27", "url": "https://files.pythonhosted.org/packages/c3/b2/67211a6d7ca6e42803a763fe90ab2cad17b626bc7f2dc2ff918f64240925/pyin-0.2.2.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "3142cc5573f534b566b08694da7dfc5d", "sha256": "c19cce84da37808881ec34da10a5631dd1de9966b58a56963cf8d3a590dc731e" }, "downloads": -1, "filename": "pyin-0.3.2.tar.gz", "has_sig": false, "md5_digest": "3142cc5573f534b566b08694da7dfc5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7231, "upload_time": "2015-02-06T02:48:04", "url": "https://files.pythonhosted.org/packages/58/e2/491b4e5ee7dddd1c7ef574e15732231677fd6c5161663b55adb7fbebc94a/pyin-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "0cf744adf38c33957e391ffb890f2df3", "sha256": "66cabf5b1b7b66e9f5630240f3603046fda4f7316fa8a31891a2919aa1129e79" }, "downloads": -1, "filename": "pyin-0.3.3.tar.gz", "has_sig": false, "md5_digest": "0cf744adf38c33957e391ffb890f2df3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6937, "upload_time": "2015-02-11T16:03:40", "url": "https://files.pythonhosted.org/packages/bc/ba/5f368b1a5e4dec22fa5f06c489b5ead30fa6752ece96f9bbfeb96b2cbe08/pyin-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "f818215a36d36912fce44529bf953fba", "sha256": "45d8f6554104a25fb367043513634874a4331567828e2427af0c4a929a0cd804" }, "downloads": -1, "filename": "pyin-0.3.4.tar.gz", "has_sig": false, "md5_digest": "f818215a36d36912fce44529bf953fba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7547, "upload_time": "2015-02-13T01:50:27", "url": "https://files.pythonhosted.org/packages/db/29/7240f9ab30f1fb50393fb0243239833368d34e4231ce0bea9b17018f5fb4/pyin-0.3.4.tar.gz" } ], "0.3.5": [ { "comment_text": "", "digests": { "md5": "8d6f04dca0c7c7d88fdcc8e467831e33", "sha256": "837fdf711a6202e2bd916f86fdb4883f416705d6b3a68a1afc3e7e1607649903" }, "downloads": -1, "filename": "pyin-0.3.5.tar.gz", "has_sig": false, "md5_digest": "8d6f04dca0c7c7d88fdcc8e467831e33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7550, "upload_time": "2015-02-13T17:50:44", "url": "https://files.pythonhosted.org/packages/0d/34/3f9b52bd93c2e1d1fcca514fe4fe90313aab299277bc64715a0354182f41/pyin-0.3.5.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "5a281986eca8c5c25ab5caece3e8b44d", "sha256": "5feed9dee9d01370ebec8d0255f1e0e0f397b8cdf03a3958e709cc60fe1262da" }, "downloads": -1, "filename": "pyin-0.4.tar.gz", "has_sig": false, "md5_digest": "5a281986eca8c5c25ab5caece3e8b44d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9238, "upload_time": "2015-03-07T20:47:24", "url": "https://files.pythonhosted.org/packages/0f/bf/e2ca1cd964a85e141637d60968c8e755510c9451616bbf7f7f52309c6f94/pyin-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "2ad3658aaee382ef9c4a009f07caacc0", "sha256": "17ce0b7bbeff3b52860570107917d0c9777ee81c928e2bcd90e74d3fcc7f09e0" }, "downloads": -1, "filename": "pyin-0.4.1.tar.gz", "has_sig": false, "md5_digest": "2ad3658aaee382ef9c4a009f07caacc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9054, "upload_time": "2015-03-08T00:38:04", "url": "https://files.pythonhosted.org/packages/18/7c/930c75985be1cddbfa3ac484a7052e571fd50a22be5bed96aa91bd0e4e19/pyin-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "6af36df1911199f61b23c1a55b52277b", "sha256": "4058e6bf0facc57b4ab5ba0e70e3cc2a614253220098dd07783d2ddd5796c0d7" }, "downloads": -1, "filename": "pyin-0.4.2.tar.gz", "has_sig": false, "md5_digest": "6af36df1911199f61b23c1a55b52277b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9457, "upload_time": "2015-03-08T01:24:43", "url": "https://files.pythonhosted.org/packages/4a/28/5f9dd7bbc461466936603d86d75490fdf4a81f092ec4dd1bc73c65036acb/pyin-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "04c77aad5b35514d5a715c7e3e5e06b9", "sha256": "0f9ac306ab93ccf0fb9c772429f2f3e2fddaa2abaaa1eb7cabfb0fc942e6701a" }, "downloads": -1, "filename": "pyin-0.4.3.tar.gz", "has_sig": false, "md5_digest": "04c77aad5b35514d5a715c7e3e5e06b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10687, "upload_time": "2015-03-09T01:31:40", "url": "https://files.pythonhosted.org/packages/cc/a9/e55d06dff59f217cd97f45d6e74e6749efd93aead8c644f087675ed24935/pyin-0.4.3.tar.gz" } ], "0.4.4": [ { "comment_text": "", "digests": { "md5": "671802e2bed884646c3036218179fde5", "sha256": "95d3ae8ed85e9a318e589246a1227ab822859b5fc1add3754ddfc1ba76c487f9" }, "downloads": -1, "filename": "pyin-0.4.4.tar.gz", "has_sig": false, "md5_digest": "671802e2bed884646c3036218179fde5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10780, "upload_time": "2015-04-30T04:14:20", "url": "https://files.pythonhosted.org/packages/d5/e8/a9cb0018d9a5fbfccf5a49dae5577d69c10816da116f67860f4a3a3464aa/pyin-0.4.4.tar.gz" } ], "0.4.5": [ { "comment_text": "", "digests": { "md5": "942c51c2476b28003e825b6e1f717eb8", "sha256": "41253293fefe14dcf25ede21d031a7ab35209d506784dc24cd71821f4e1582cc" }, "downloads": -1, "filename": "pyin-0.4.5.tar.gz", "has_sig": false, "md5_digest": "942c51c2476b28003e825b6e1f717eb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10750, "upload_time": "2015-04-30T16:46:23", "url": "https://files.pythonhosted.org/packages/cc/4c/c297419c8cd4866f7a3770a1cc5a480fa4101c2f1b4d7240320ebc789cbb/pyin-0.4.5.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "a5b4d0c79469887c1f3333d34ee51efa", "sha256": "5f04c711d53a7a8d65c442b4818027964366abffd1ded1d8b17264e557600720" }, "downloads": -1, "filename": "pyin-0.5.tar.gz", "has_sig": false, "md5_digest": "a5b4d0c79469887c1f3333d34ee51efa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7559, "upload_time": "2015-08-02T23:26:18", "url": "https://files.pythonhosted.org/packages/e9/32/21e118bb777366990b60795c03a7ca0170d9712025a94a4f57c39a33e5b0/pyin-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "1cf57ba3ddb72c6e5711115b80174dd7", "sha256": "cbb53b61b80db41fe842dc72fb171c44f511b0db59f14a601e611d95c0a1e1c5" }, "downloads": -1, "filename": "pyin-0.5.1.tar.gz", "has_sig": false, "md5_digest": "1cf57ba3ddb72c6e5711115b80174dd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7703, "upload_time": "2015-08-03T14:57:28", "url": "https://files.pythonhosted.org/packages/76/e4/c1fa7b9aeb535766a777c1b30ad09f2c00d0fd8c4a4008c38a1628ebd52c/pyin-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "3297764535a018e630f8b0e4603d4c2c", "sha256": "08a1d370a78d9387e534898ae598861f0cc974c2a570a7154516ceb4cb81cd59" }, "downloads": -1, "filename": "pyin-0.5.2.tar.gz", "has_sig": false, "md5_digest": "3297764535a018e630f8b0e4603d4c2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7635, "upload_time": "2015-08-04T03:13:29", "url": "https://files.pythonhosted.org/packages/8a/7e/f0b35f4538d8af74a330f2d7027e26796c24f3802c60b2ed8e166b8b8748/pyin-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "2998221003242905f9cbc5f1deb31399", "sha256": "e469eca614aae2afcc9c864269d3aec014efd0945b2bc611a8ef90ddf1f5cf3b" }, "downloads": -1, "filename": "pyin-0.5.3.tar.gz", "has_sig": false, "md5_digest": "2998221003242905f9cbc5f1deb31399", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8001, "upload_time": "2015-08-04T03:44:48", "url": "https://files.pythonhosted.org/packages/5f/23/66bfa5abd13c0604023b6b96aa97044940485fe43f82c4588de186463f3b/pyin-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "d1df0348f4c433aa3430400a73f2588e", "sha256": "7c5645e9cbe87d1bab1cebb4231d68b1cd7778199064fa20628c076addd9a6ee" }, "downloads": -1, "filename": "pyin-0.5.4.tar.gz", "has_sig": false, "md5_digest": "d1df0348f4c433aa3430400a73f2588e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8002, "upload_time": "2015-08-04T03:52:51", "url": "https://files.pythonhosted.org/packages/23/75/3b9a50e3cde03f46e0be430bffc1cff61e2082d161b63b980fb94ea3c6e9/pyin-0.5.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d1df0348f4c433aa3430400a73f2588e", "sha256": "7c5645e9cbe87d1bab1cebb4231d68b1cd7778199064fa20628c076addd9a6ee" }, "downloads": -1, "filename": "pyin-0.5.4.tar.gz", "has_sig": false, "md5_digest": "d1df0348f4c433aa3430400a73f2588e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8002, "upload_time": "2015-08-04T03:52:51", "url": "https://files.pythonhosted.org/packages/23/75/3b9a50e3cde03f46e0be430bffc1cff61e2082d161b63b980fb94ea3c6e9/pyin-0.5.4.tar.gz" } ] }