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_
====================
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_
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.1.4.tar.gz
(29.6 kB
view hashes)
Built Distribution
Close
Hashes for rapidpro-expressions-1.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c19d53b79ee8959af766e5c9dbd857f05493683d45eaa52ebca6aba6b01fb828 |
|
MD5 | 5892b8c5635e648e87e5e4224c83b784 |
|
BLAKE2b-256 | a96a02212527f48310df547b78190073b17c77aefbcf1a9b60a79b32f03aa1ad |
Close
Hashes for rapidpro_expressions-1.1.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95c1d28b9c6e87c60284aaaab49f7c7e6fac9ff37f4a99c8601e011a57f0d36c |
|
MD5 | f0d26ef4b53f06e6086adec6703f76ef |
|
BLAKE2b-256 | d6fc5e5e5b02b35632f25a7c513c416674fa7322559318878e7b986b5e1338ba |