Python implementation of the RapidPro expression and templating system
Project description
RapidPro Expressions
====================
Python implementation of the RapidPro expression and templating system
Usage
-----
```python
context = new EvaluationContext()
context.put_variable("name", "bob jones")
evaluator = Evaluator()
output, errors = evaluator.evaluate_template("Hi @(PROPER(name))", context, False)
assert output == "Hi Bob Jones"
assert len(errors) == 0
```
Development
-----------
If you make changes to the grammar file _Excellent.g4_ you need to generate new lexer and parser python modules
1. Ensure you have the ANTLR command line tools installed.
2. Run _gen_parser.sh_. You can delete the generated visitor module.
====================
Python implementation of the RapidPro expression and templating system
Usage
-----
```python
context = new EvaluationContext()
context.put_variable("name", "bob jones")
evaluator = Evaluator()
output, errors = evaluator.evaluate_template("Hi @(PROPER(name))", context, False)
assert output == "Hi Bob Jones"
assert len(errors) == 0
```
Development
-----------
If you make changes to the grammar file _Excellent.g4_ you need to generate new lexer and parser python modules
1. Ensure you have the ANTLR command line tools installed.
2. Run _gen_parser.sh_. You can delete the generated visitor module.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rapidpro-expressions-1.0.3.tar.gz
(71.3 kB
view hashes)
Built Distribution
Close
Hashes for rapidpro-expressions-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2439fcfb48f651615c3807c96c11ae43aae280289942233db683941d9eaf96a |
|
MD5 | 21ebec72110f6f30e9bbeb07118c915c |
|
BLAKE2b-256 | 61ce8ed874d6596e42fdeb431692ed72d1dc972d17bd81f32a56933fd175c00c |
Close
Hashes for rapidpro_expressions-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af69c020acc6b6ef02f96204ad68cbaae232053ac7f33e41cb037118ab3f6afb |
|
MD5 | 50f3eac526c8f584793f1eab1d5927b9 |
|
BLAKE2b-256 | 1964ea5b69064c555c2efee2fe64232e8d3d81dd75eef4929e99c19d8647e7bd |