https://github.com/viur-framework/safeeval
Safely evaluate simple expressions from untrusted sources
https://github.com/viur-framework/safeeval
Last synced: over 1 year ago
JSON representation
Safely evaluate simple expressions from untrusted sources
- Host: GitHub
- URL: https://github.com/viur-framework/safeeval
- Owner: viur-framework
- License: mit
- Created: 2020-06-16T11:25:51.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-01T09:39:12.000Z (almost 3 years ago)
- Last Synced: 2024-10-13T03:38:08.466Z (almost 2 years ago)
- Language: Python
- Size: 32.2 KB
- Stars: 3
- Watchers: 10
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/viur-framework/safeeval)
* **Stefan Kögl** - *Packaging, callable support, docstrings* - [Mausbrand Informationsysteme GmbH](https://github.com/viur-framework/safeeval)
See also the list of [contributors](https://github.com/viur-framework/safeeval/blob/master/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details