piece-table 0.0.3

Creator: railscoder56

Last updated:

Add to Cart

Description:

piecetable 0.0.3

About piece_table
Early implementation of the piece table data structure in Python.
A piece table is an efficient data structure to represent a series of edits to a text document. A more detailed discussion can be found here. Inspired by the JavaScript implementation.


Installation
To install the package, run the following:
pip install piece-table


Usage
Current usage is very basic, but will hopefully improve in the future.
Basic use is demonstrated below.
from piece_table import PieceTable

document = PieceTable("Initialize a document with some text.")

document.insert("Add some text to the start of the document. ", 0)

# Delete the inserted text
document.delete(0, 44)

text_sequence = document.get_text()
# text_sequence == "Initialize a document with some text."

sub_string = document[13:21]
# sub_string == "document"


Testing
To test the package, run the following:
python -m unittest discover -s tests

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.