Library for calculating prices and discounts depending on some conditions
Project description
dxf-parser
Ejemplo de uso
import pricelang
originalExpression = "all: 1200; unam: 500, +15%[f>=2023-12-1 & f<=2023-12-31], +200[n>=3&x>=2000]; general: 800, +50%[f=--2-14]"
# Parsing the expression string to PriceTree representation
tree = pricelang.parse(originalExpression)
tree.show()
print(tree)
# Interpreting an expression tree
conditions = {
"f": "2023-12-20",
"n": 5,
"x": 3000.40,
"user": "unam",
}
price = pricelang.test(tree, conditions)
print(price)
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
dxlparser-1.0.tar.gz
(19.6 kB
view details)
File details
Details for the file dxlparser-1.0.tar.gz
.
File metadata
- Download URL: dxlparser-1.0.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aa5e10aff0c6b9082a987b4e260820f225cf41ae28e4e3b94deee8081ea7512 |
|
MD5 | 8a977b4f19eba99f8e0c032c428b5535 |
|
BLAKE2b-256 | df4c3b675ea56ce69baab8f26b26a7c0276ad4c16303ed1a8f6dd2c8cbbf9f5f |