Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A number-type-agnostic calculator.

Project description

Agnostic Calculator

Travis PyPI version

A Python3 library that parses strings representing mathematical expressions. The Calculator takes a converter by which means you can specify numerical types other than regular base 10 numbers. There is one converter available: roman.

How to install

Using pip:

pip install agnostic-calculator

Manually:

git clone git@github.com:carawarner/calculator.git
cd calculator/calculator
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

How to run tests

This libary uses pytest, a powerful but lightweight testing tool for Python.

cd calculator
pytest

How to use

WARNING: Don't use agnostic-calculator in production. The calculator library calls Python's eval() on user input. It's not safe.

from calculator.calculator import Calculator
import calculator.converters.roman as converter

calculator = Calculator(converter)
result = calculator.evaluate(expression)

Project details


Download files

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

Files for agnostic-calculator, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size agnostic_calculator-1.1.0-py3-none-any.whl (5.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size agnostic-calculator-1.1.0.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page