Safely evaluates simple python expressions
Project description
safeeval
Safely evaluate an expression from an untrusted party
Getting Started
Simply install via pip:
pip install safeeval
Prerequisites
No dependencies are required.
Example
Simple Comparision:
import safeeval
ast = safeeval.SafeEval.parse("x == y")
res = safeeval.SafeEval.evalAst(ast, {"x": 4, "y": 3)
print("res", res)
More examples can be found in tests directory.
Contributing
Write issues and provide patches via PRs on github.
Authors
- Tobias Steinrücken - Initial work - Mausbrand Informationsysteme GmbH
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE file for details
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file safeeval-0.0.4.tar.gz.
File metadata
- Download URL: safeeval-0.0.4.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
039779c58de958011e5ddd8ff625d0737696457685d9017f860cfb16070e3e05
|
|
| MD5 |
fe2850b232129a6590ec755c8d1066d6
|
|
| BLAKE2b-256 |
540780ea41bdf8f53398530b4a38f6ce248554db08d4d8cb7bd198aa0c8c2dd8
|
File details
Details for the file safeeval-0.0.4-py3-none-any.whl.
File metadata
- Download URL: safeeval-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
154baaffb080e163f70b1662dfe9c7959302cbc8566e75adc2912d07326b3031
|
|
| MD5 |
73b0ed23af2359917bdef65571e92947
|
|
| BLAKE2b-256 |
6d8319d289fee1b25edc4ef78c6a850f7e752a1f07870aa84a62f155de5eaa71
|