Skip to main content

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.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

quipu-0.1.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file quipu-0.1.tar.gz.

File metadata

  • Download URL: quipu-0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for quipu-0.1.tar.gz
Algorithm Hash digest
SHA256 90dadc84aa735ac42f3da497fb82c4a18f5801e04530722901ee462dbbade6ac
MD5 bf72ddb9aebde69ccb7567ea14407c97
BLAKE2b-256 23a3a38967a0582f898f524f36f2f4d3574d26c8dbf3ac93a3bc814bf19d1da0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page