This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Emacs style, point based search-replace for python.

It works by moving a point and a mark around in the text, somewhat similar to how emacs handles its buffers. This becomes intuitive and easier for some text processing tasks which require usage of after and before in text.

An example problem is here. Using eep, the equivalent python code is

import eep

text = """<p class='q'>Q: Why</p>\n<p class='a'>Because</p>\n
<p class='a'>You need to do</p>\n\n
<p class='q'>Q: How</p>\n
<p class='a'>Do this</p>\n
<p class='a'>And that</p>"""

es = eep.Searcher(text)

print("Before : \n" + str(es) + "\n\n")

while es.search_forward("<p class='q'>"):
    es.search_forward("<p class='a'>")
    es.swap_markers()
    es.insert("<div class='a'>\n")

    if es.search_forward("<p class='q'>"):
        es.search_backward("</p>")
        es.swap_markers()
        es.insert("\n</div>")

es.goto("end")
es.search_backward("<p class='a'>")
es.search_forward("</p>")
es.insert("\n</div>")

es.goto("start")
while es.search_forward("<p class='a'>"):
    es.replace("<p>")

es.goto("start")
while es.search_forward("<p class='q'>Q: "):
    es.replace("<p class='q'>")

print("After : \n" + str(es))
Before :
<p class='q'>Q: Why</p>
<p class='a'>Because</p>
<p class='a'>You need to do</p>

<p class='q'>Q: How</p>
<p class='a'>Do this</p>
<p class='a'>And that</p>


After :
<p class='q'>Why</p>
<div class='a'>
<p>Because</p>
<p>You need to do</p>
</div>

<p class='q'>How</p>
<div class='a'>
<p>Do this</p>
<p>And that</p>
</div>

Usage

  • Install using pip install eep
  • Instantiate a searcher
import eep

es = eep.Searcher("this is a sample text. this is a sentence.")
  • A searcher has two markers for defining regions. A point moves around while searching, replacing, inserting etc. It is the current position where operations are done.
  • mark moves after successful forward or backward searches to mark matching region with the point.
# Search forward for first match from current point
# Return true if match found
# Set mark in beginning and point at end
es.search_forward("th")

# Search backward for first match from current point
# Return true if match found
# Set point in beginning and mark at end
es.search_backward("th")

# Replace marked region
es.replace("dodo")

# Insert at current point
es.insert("dodo")

# Move the point
es.jump(-3)
es.goto(34) # also accepts "start" and "end" strings

# Exchange markers
es.swap_markers()
Release History

Release History

0.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
eep-0.1.1.tar.gz (4.3 kB) Copy SHA256 Checksum SHA256 Source May 27, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting