string_conditions
Evaluate string Python conditions while keeping control on functions and variables accessible.
Usage
Python
from string_conditions import evaluate_condition
evaluate_condition(
condition="(year not in (2020,2021) and 10 > month > 4) or type.lower() == 'sometype'",
context={
'type': "SomeType",
'year': 2023,
'month': 6,
}
)
CLI
python -m string_conditions "(year > 2020 and type not in ('std', 'premium')) or message.lower().startswith('hello')" -c '{"year":2021, "type":"new", "message":"Hello World"}'
Release files for string-conditions 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| string_conditions-0.0.1.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| string_conditions-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / string_conditions-0.0.1.tar.gz
| Download URL | string_conditions-0.0.1.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bffe3e4d4193227e653ec653410ce01f7d8fe8db4710bb62fa1c516cd67e8f51
|
|
BLAKE2b-256 checksum How to use checksums |
f65e301ce601e5e47faa76d725c83704349c8362c46789aadfdfcd918ee07745
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / string_conditions-0.0.1-py3-none-any.whl
| Download URL | string_conditions-0.0.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1807ee6bbd0c3442391b78764db21778af3a60d5e798fef42521470e4c3e1897
|
|
BLAKE2b-256 checksum How to use checksums |
a3b8745e5476606d8d095cf47b47035d529c3b518c3717e55910b4c380fced88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|