1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
Tokenizers, parsers and expression calculators in Python
This module is a part of the Pip.Services polyglot microservices toolkit. It provides syntax and lexical analyzers and expression calculator optimized for repeated calculations.
The module contains the following packages:
- Calculator - Expression calculator
- CSV - CSV tokenizer
- IO - input/output utility classes to support lexical analysis
- Mustache - Mustache templating engine
- Tokenizers - lexical analyzers to break incoming character streams into tokens
- Variants - dynamic objects that can hold any values and operators for them
Use
Install the Python package as
pip install pip-services3-expressions
The example below shows how to use expression calculator to dynamically calculate user-defined expressions.
from pip_services4_expressions.variants.Variant import Variant
from pip_services4_expressions.calculator.variables.Variable import Variable
from pip_services4_expressions.calculator.ExpressionCalculator import ExpressionCalculator
from pip_services4_expressions.calculator.variables.VariableCollection import VariableCollection
# ...
clalculator = ExpressionCalculator()
clalculator.expression = "A + b / (3 - Max(-123, 1)*2)"
vars = VariableCollection()
vars.add(Variable("A", Variant(1)))
vars.add(Variable("B", Variant(3)))
result = clalculator.evaluate_with_variables(vars)
print('The result of the expression is ' + result.as_string)
# ...
This is an example to process mustache templates.
mustache = MustacheTemplate()
mustache.template = "Hello, {{{NAME}}}{{#ESCLAMATION}}!{{/ESCLAMATION}}{{#unless ESCLAMATION}}.{{/unless}}"
result = mustache.evaluate_with_variables({ 'NAME': 'Mike', 'ESCLAMATION': True })
print("The result of template evaluation is '" + result + "'")
Develop
For development you shall install the following prerequisites:
- Python 3.7+
- Visual Studio Code or another IDE of your choice
- Docker
Install dependencies:
pip install -r requirements.txt
Run automated tests:
python test.py
Generate API documentation:
./docgen.ps1
Before committing changes run dockerized build and test as:
./build.ps1
./test.ps1
./clear.ps1
Contacts
The module is created and maintained by:
- Sergey Seroukhov
- Danil Prisiazhnyi
Metadata
Release files for pip-services4-expressions 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pip_services4_expressions-0.0.3.tar.gz | 52.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pip_services4_expressions-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 127.6 kB
Release files / pip_services4_expressions-0.0.3.tar.gz
| Download URL | pip_services4_expressions-0.0.3.tar.gz |
|---|---|
| Size | 52.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc7bc5015cbb773eefba1a991a03cd8cb5e26f3cdba8a9f4dfd9cd08c970b19b
|
|
BLAKE2b-256 checksum How to use checksums |
76be1b50c188cefbb3c8a5864a1a8af05c3987dc773193eb9e481f63a144e9be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / pip_services4_expressions-0.0.3-py3-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | pip_services4_expressions-0.0.3-py3-none-any.whl |
|---|---|
| Size | 74.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2f96b6475de00dd600040e8cf2e31ad28c0ae33bb3ab4036bb7aba39a470128
|
|
BLAKE2b-256 checksum How to use checksums |
2851e1b2593051a4a762186e53e05d30ba4689d054de514b117b5820a540e556
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for pip-services4-expressions 0.0.3
Upload timing
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.