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
- Stefan Kögl - Packaging, callable support, docstrings - 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
safeeval-0.0.6.tar.gz
(6.3 kB
view details)
File details
Details for the file safeeval-0.0.6.tar.gz
.
File metadata
- Download URL: safeeval-0.0.6.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac02c4c85fcaf4f5ebbdd6b15a292f4bb09d07a5a8c9378050d07cacfb874466 |
|
MD5 | 5435f886fb258e31651537fc38f6ceaa |
|
BLAKE2b-256 | 86e8151f9f9a301ce3ff2296f810b799039240f04a5dc909d9fed77b5b21aa9b |