{ "info": { "author": "Abhinav Tushar", "author_email": "abhinav.tushar.vs@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "eep\n===\n\n.. image:: https://badge.fury.io/py/eep.png\n :target: https://badge.fury.io/py/eep\n\nEmacs style, point based search-replace for python.\n\nIt works by moving a ``point`` and a ``mark`` around in the text,\nsomewhat similar to how emacs handles its ``buffers``. This becomes\nintuitive and easier for *some* text processing tasks which require\nusage of *after* and *before* in text.\n\nAn example problem is\n`here `__. Using\n``eep``, the equivalent python code is\n\n.. code:: python\n\n import eep\n\n text = \"\"\"

Q: Why

\\n

Because

\\n\n

You need to do

\\n\\n\n

Q: How

\\n\n

Do this

\\n\n

And that

\"\"\"\n\n es = eep.Searcher(text)\n\n print(\"Before : \\n\" + str(es) + \"\\n\\n\")\n\n while es.search_forward(\"

\"):\n es.search_forward(\"

\")\n es.swap_markers()\n es.insert(\"

\\n\")\n\n if es.search_forward(\"

\"):\n es.search_backward(\"

\")\n es.swap_markers()\n es.insert(\"\\n
\")\n\n es.goto(\"end\")\n es.search_backward(\"

\")\n es.search_forward(\"

\")\n es.insert(\"\\n\")\n\n es.goto(\"start\")\n while es.search_forward(\"

\"):\n es.replace(\"

\")\n\n es.goto(\"start\")\n while es.search_forward(\"

Q: \"):\n es.replace(\"

\")\n\n print(\"After : \\n\" + str(es))\n\n.. code:: shell\n\n Before : \n

Q: Why

\n

Because

\n

You need to do

\n\n

Q: How

\n

Do this

\n

And that

\n\n\n After : \n

Why

\n
\n

Because

\n

You need to do

\n
\n\n

How

\n
\n

Do this

\n

And that

\n
\n\nUsage\n-----\n\n- Install using ``pip install eep``\n- Instantiate a searcher\n\n.. code:: python\n\n import eep\n\n es = eep.Searcher(\"this is a sample text. this is a sentence.\")\n\n- A searcher has two markers for defining regions. A ``point`` moves\n around while searching, replacing, inserting etc. It is the *current*\n position where operations are done.\n- ``mark`` moves after successful forward or backward searches to mark\n matching region with the ``point``.\n\n.. code:: python\n\n # Search forward for first match from current point\n # Return true if match found\n # Set mark in beginning and point at end\n es.search_forward(\"th\")\n\n # Search backward for first match from current point\n # Return true if match found\n # Set point in beginning and mark at end\n es.search_backward(\"th\")\n\n # Replace marked region\n es.replace(\"dodo\")\n\n # Insert at current point\n es.insert(\"dodo\")\n\n # Move the point\n es.jump(-3)\n es.goto(34) # also accepts \"start\" and \"end\" strings\n\n # Exchange markers\n es.swap_markers()", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lepisma/eep", "keywords": "eep string search replace", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "eep", "package_url": "https://pypi.org/project/eep/", "platform": "", "project_url": "https://pypi.org/project/eep/", "project_urls": { "Homepage": "https://github.com/lepisma/eep" }, "release_url": "https://pypi.org/project/eep/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "Emacs style, point based string search-replace library for python", "version": "0.1.3" }, "last_serial": 2653564, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "2f7b066c74614a3d6b125c32830d7ace", "sha256": "7f3414c22d4eba91d8b3e0fa591277252a814b490150b66823e4d74da5c9addd" }, "downloads": -1, "filename": "eep-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2f7b066c74614a3d6b125c32830d7ace", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8108, "upload_time": "2016-05-27T21:48:14", "url": "https://files.pythonhosted.org/packages/0c/a5/5bf0fc6393a17d3c8b4ac79dc09884a30d50ea1bbd941696d4467a150c2e/eep-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "34d6735d1d73ca10142dc27d64e8768f", "sha256": "42f8c266ab391b9e18e05e910362efc2f1abcbfdda8eb8e5eb5da1bcfe9e282d" }, "downloads": -1, "filename": "eep-0.1.1.tar.gz", "has_sig": false, "md5_digest": "34d6735d1d73ca10142dc27d64e8768f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4265, "upload_time": "2016-05-27T21:55:09", "url": "https://files.pythonhosted.org/packages/c3/b0/5d0196e5633804a7b830c109d5b524ed162a38d5177c2ff3a0312c2d93f8/eep-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "157a279678faf54e3436f9ddc044317c", "sha256": "bef1fdf2b309a9c2974bed2c513dcc463425a3b50a6dd92091c097ab42f13fe3" }, "downloads": -1, "filename": "eep-0.1.2.tar.gz", "has_sig": false, "md5_digest": "157a279678faf54e3436f9ddc044317c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4207, "upload_time": "2017-02-19T22:00:24", "url": "https://files.pythonhosted.org/packages/80/ef/1f56db21f9db85a373a03fc5477ee7fccac434e1d3f9e73362aa4bf1bba7/eep-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "b4518776fc5789267c98342a64389a9a", "sha256": "6e0e2adcb8a0f3704c0caecedfe80c7762a54160cb5bdd68129f733a3be17d8d" }, "downloads": -1, "filename": "eep-0.1.3.tar.gz", "has_sig": false, "md5_digest": "b4518776fc5789267c98342a64389a9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4246, "upload_time": "2017-02-19T22:14:39", "url": "https://files.pythonhosted.org/packages/17/0a/b7c98699ce28e0d1385fea413e6c2f3d4ca6ff71ab179e6d581e1201f07e/eep-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b4518776fc5789267c98342a64389a9a", "sha256": "6e0e2adcb8a0f3704c0caecedfe80c7762a54160cb5bdd68129f733a3be17d8d" }, "downloads": -1, "filename": "eep-0.1.3.tar.gz", "has_sig": false, "md5_digest": "b4518776fc5789267c98342a64389a9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4246, "upload_time": "2017-02-19T22:14:39", "url": "https://files.pythonhosted.org/packages/17/0a/b7c98699ce28e0d1385fea413e6c2f3d4ca6ff71ab179e6d581e1201f07e/eep-0.1.3.tar.gz" } ] }