Safely evaluate mathematical and logical expressions.
Project description
🐴 sheval
Safely evaluate mathematical and logical expressions. Most operations are supported.
Whitelisted data types
For security, only certain data types are allowed for constants and variables.
str
int
float
complex
list
tuple
set
dict
bool
bytes
NoneType
Example
from sheval import sheval
# Variables can be passed on.
variables = dict(
x = 2,
y = 3,
)
# And functions too!
functions = dict(
double = lambda x: x * 2,
)
sheval('double(x) > y', variables, functions)
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
sheval-1.1.0.post1.tar.gz
(14.7 kB
view hashes)
Built Distribution
Close
Hashes for sheval-1.1.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af3fdf52e0c52c5e7b8548e6e364b496c581c45434ba385e89876c664c975a75 |
|
MD5 | f9858fccb6b36db4260858db60aa664b |
|
BLAKE2b-256 | a94043d6c16c71a4581e4a7e0be8bbafcc97ec28c3f23f11b83de90034a1c7a8 |