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.4.tar.gz
(37.2 kB
view hashes)
Built Distribution
Close
Hashes for rapidpro-expressions-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b80847ac8bf7c1e8a9cb1b7e34267aea330ad73cc8951d975b5c2dda1eba8ae |
|
MD5 | ca9b30c3307ff82187b46d5206c31454 |
|
BLAKE2b-256 | 702ccd43783c5335098cae991b613762d563cc3c66ed648c2153d619a4516c82 |
Close
Hashes for rapidpro_expressions-1.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f16ea6759554cf7341418d0801c94dee0e4357f27bf71d7be1be72b4ac7664b |
|
MD5 | 0746493df7837d76293c5304c6821450 |
|
BLAKE2b-256 | aac4666d12e5a5ec145b4c11d402b4cf50cc7f588bcbd33f31dc59553a4a5faf |