Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Quipu ======= Evaluate simple Python mathmatical and logical expressions http://en.wikipedia.org/wiki/Quipu An attempt to make a safe evaluator of a subset of Python expressions. This is mostly a proof-of-concept for getting feedback, it has not been thoroughly checked for safety, use at your own risk :) It uses the Python ast module to parse the expression, but all evaluation is done by walking the ast, it is not directly executed by the Python runtime. Nosetests are provided below including coverage of supported and unsupported operations. Known security considerations: The variables are expected to be simple primitive types. Providing functions with unsafe effects, or variables where the operator implementations can have unsafe effects is obviously unsafe. Some operations may also take a lot of time or memory and DOS the process. Usage:: import quipu result = quipu.evaluate('2 + 2') See the list of "supported_expressions" in ``test_asteval.py`` for an example of what operations are implemented.

Project Description

Evaluate simple Python mathmatical and logical expressions

http://en.wikipedia.org/wiki/Quipu

An attempt to make a safe evaluator of a subset of Python expressions.

This is mostly a proof-of-concept for getting feedback, it has not been thoroughly checked for safety, use at your own risk :)

It uses the Python ast module to parse the expression, but all evaluation is done by walking the ast, it is not directly executed by the Python runtime.

Nosetests are provided below including coverage of supported and unsupported operations.

Known security considerations:

The variables are expected to be simple primitive types. Providing functions with unsafe effects, or variables where the operator implementations can have unsafe effects is obviously unsafe.

Some operations may also take a lot of time or memory and DOS the process.

Usage:

import quipu
result = quipu.evaluate('2 + 2')

See the list of “supported_expressions” in test_asteval.py for an example of what operations are implemented.

Release History

Release History

This version
History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
quipu-0.1.tar.gz (2.5 kB) Copy SHA256 Checksum SHA256 Source Aug 9, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting