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.5.tar.gz
(37.4 kB
view hashes)
Built Distribution
Close
Hashes for rapidpro-expressions-1.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7870d1bef6f9cb1cc2ed6d29601b947ea202ecb76abd864f8bf602c83c7bafdd |
|
MD5 | 0d6c774423f16d913ec38a00d60dbfab |
|
BLAKE2b-256 | 8393f09d2ceb9033c32e8962d8a1672a6be28134714982358ac8578b8e95ae25 |
Close
Hashes for rapidpro_expressions-1.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4750aeb1e7501604414db1f6a409d4761ebaa5188215435626dfbaa42dd1cb9 |
|
MD5 | 41a299383099686ac73184948b090f1d |
|
BLAKE2b-256 | f5ee2c528449c643d96d5ded9f51fe2658fcc355dabe7b6c68c1877422737394 |