A number-type-agnostic calculator.
Project description
Agnostic Calculator
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.
Source Distribution
Built Distribution
File details
Details for the file agnostic-calculator-1.1.0.tar.gz
.
File metadata
- Download URL: agnostic-calculator-1.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b1d64a3f5460708756e041393935beab13bf0a239328a154820fd6555a984bd |
|
MD5 | 478a8be9ea269676d01ee88b5dd77751 |
|
BLAKE2b-256 | 01850e0a61326a3adeee96474eee234bb7bf45b652e257168e10684f229c3501 |
File details
Details for the file agnostic_calculator-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: agnostic_calculator-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e456f79277d5f70c2f2278160cd8d50b00f5d9c98284f1072df3bf11d6f7529c |
|
MD5 | 163ffc11061fd28f31ab3ef75eddaa60 |
|
BLAKE2b-256 | 991334dfe309a3b826b24011bbd8a1185343593ba47bc8a3f88850fad12eb45d |