Evaluate infix math expresion in python with ease.
Project description
InfixParser
InfixParser is a Python binding for MathParser (https://github.com/KJ002/MathParser/). This module allows for a simple and quick evaluation of strings. It allows you to evaluate a string with security, you define the external variables!
Examples
Basic Eval
result: float = InfixParser.evaluate("1+1") # returns 2.0
Basic Eval (With Evaluator Class)
evaluator = InfixParser.Evaluator()
result: float = evaluator.eval("1+1") # returns 2.0
External Variable Eval
evaluator = InfixParser.Evaluator()
x: int = 20
evaluator.append_variable("x", x)
result: float = evaluator.eval("1+x") # returns 21.0
Updating External Variable Eval
evaluator = InfixParser.Evaluator()
x: int = 20
evaluator.append_variable("x", x)
result1: float = evaluator.eval("1+x") # returns 21.0
x: int = 10
evaluator.append_variable("x", x)
result2: float = evaluator.eval("1+x") # returns 11.0
Functions Eval
"""
It is important to note that function do not have to
have to be called with in an instantiated class
and can just be called with InfixParser.evaluate()
"""
evaluator = InfixParser.Evaluator()
result: float = evaluator.eval("sin(1.5707963267948966)") # returns 1.0
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
InfixParser-3.1.4.tar.gz
(7.4 kB
view hashes)
Built Distributions
Close
Hashes for InfixParser-3.1.4-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1c7d28eb8884f957664e6b1cacb5f8fed2f031cadc6e7a1255b02a3070c37ce |
|
MD5 | 22df68e48b8d1b253e3782a05dc2968e |
|
BLAKE2b-256 | fa0d4333a90d3a300cc1c4a60cc6c00e2f357d1bf9be71446e19a353d71852b8 |
Close
Hashes for InfixParser-3.1.4-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02dd20997877aaeb4dc207af6e15e80814fd947fa7bcf82c90e7b96b8069c443 |
|
MD5 | 6d6d18019fe2d2b89758fb376f717299 |
|
BLAKE2b-256 | 155f945fa58ba952b286e2353edf3da1a79fc4692ac5d69589cca32480c25b75 |
Close
Hashes for InfixParser-3.1.4-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a51e7010cc7da74eb0d325de688031cd386b0f044109028c2547b42ac86ea92 |
|
MD5 | e078443b2314da2695b900a14f5b241e |
|
BLAKE2b-256 | 7f871af676df448fc51576a915562181f355a62f3eee36f9635d4da7be06f479 |
Close
Hashes for InfixParser-3.1.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e67d872f6f715096f4895a887b490b9bb85c9fc2950e295aadc6d70b9751cd2 |
|
MD5 | 7f7b74af1fb3ec3eaa602f839c293f45 |
|
BLAKE2b-256 | b5ad7d6e177fe6e499e3df606a06afc0bfbed335eb616e95935846ca428c75e8 |
Close
Hashes for InfixParser-3.1.4-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07a5c94d29d66f50dcf576fdc364eafa12a62d7ebf5c5b24690ed2a791fcca2a |
|
MD5 | ff009dfb79266f944ec35b602662d84c |
|
BLAKE2b-256 | 454f18ce0d987d379380ac01b6492e02beafc47f354d17da650e07fdf45a50fe |
Close
Hashes for InfixParser-3.1.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24bcdba94d9bab970d6330c29aff5d8d67bc32c2ced7a337b11cbebc0ec9939f |
|
MD5 | 0db5be31bfd928be3762cd732b3ac580 |
|
BLAKE2b-256 | c3953e344e41c2d7178bb339a23c10d4ad7639c355c3f98f0a786e16dad03102 |
Close
Hashes for InfixParser-3.1.4-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81b8c0697a5c28fa339fe55d6e24841eb482555f482ae028ef4a13aa3d1ce010 |
|
MD5 | c3b1f366c58d58cc2a5e5ea014a0fd99 |
|
BLAKE2b-256 | f809d8fadbca84d04eef3b9795128099ae207b085616cfbb5a0462856cf60ff5 |
Close
Hashes for InfixParser-3.1.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b69b8e55168df17c9c8408bd481dd8e5e0f6165cb374f979a4c4008b4caa419f |
|
MD5 | 850ec3b6dc2e880ee764e9ebcbe5e4a3 |
|
BLAKE2b-256 | 4deff3d6de9b2b2e1c15b14411c868506203fc18ff0962647f3faff5311d5d1b |
Close
Hashes for InfixParser-3.1.4-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9301bf60425e41596bc6e33fa7d51a090759616e856b67dcc4c2f78048990a79 |
|
MD5 | d86cbc6ab95fbdd02673d4a156efe50b |
|
BLAKE2b-256 | 2213f5b42af82048a0bb1939aa7fde03b590d662d27b3680e9cee74927a0f1b7 |
Close
Hashes for InfixParser-3.1.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b2a3a2e2da9b340e285d6566cac923a4edb58f4b4598b0761411be3c1fe75d0 |
|
MD5 | 533757415b83d54e2f8969548ba91c4e |
|
BLAKE2b-256 | 72a74e04aab7c18be3969930e2f7fdc863f23262dce4a619d00f8885cfc3b825 |
Close
Hashes for InfixParser-3.1.4-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad9a1a84c92e2b266cb69039bf274956526bec70069b60ba0283a8c529a2854e |
|
MD5 | 78ef4df083269a5a3980ccfd1e7220bb |
|
BLAKE2b-256 | 16e3874f6ce477ff8cdc0ecaa93eadcce7826cee5820aaa8705e143619558693 |
Close
Hashes for InfixParser-3.1.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 534e6d6cad1c83be7c01040f4f6ca6e521190d29098fc39a9e0849b8cec5a050 |
|
MD5 | 0ed28ce28e276063d4792cb26bc1d4e5 |
|
BLAKE2b-256 | f6a34d9f93f1b1f172d064348ec4863c36bc2ef9260463110f7e32161ff8b31f |
Close
Hashes for InfixParser-3.1.4-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f16bf29790db1d74ad847992be063e8c3203c611543da3efe0f69f5b9e3b5dfb |
|
MD5 | 15c15011cd585f913615bd23160c7b05 |
|
BLAKE2b-256 | af093da8466aa6ed7cd66f7b96fa8591c57c4fa1146c3c9ee5649e07487ccb97 |
Close
Hashes for InfixParser-3.1.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0d4c4763cbd747c1dd4a2b2628e9ede128dea78c0d9b138b043af0b6dca4581 |
|
MD5 | 78b22131d20ddc7cc734ed6205177e82 |
|
BLAKE2b-256 | 02902269903099773e87f562f10fce1e7a5cff1f3a8bf828a8eaf73a5238eebb |
Close
Hashes for InfixParser-3.1.4-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c348941fe13c73d111dabfd72d46191ee4998161af11759be1d063400152191 |
|
MD5 | 4a5942da5a2c9006d4d87847d908b2aa |
|
BLAKE2b-256 | 01fd6d99576a785572681466522a8b38c3acfe81a6f07ca8fbbf10c771fd67bd |
Close
Hashes for InfixParser-3.1.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4da3a203301f1f0e04b62ab9b436714f9896343d3fc4ae62dc92b981ba9a3238 |
|
MD5 | 3c4d80bf107ab1bff44fd31967b1e5b4 |
|
BLAKE2b-256 | d6742bbc486068768bbfc539854c67dc7c6a35be1deb03ab395d62b8e324d7c0 |
Close
Hashes for InfixParser-3.1.4-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d44794391c576bd239daf8636af09876c48c4d2cf2c165baa443958faa6c26f |
|
MD5 | f102627852c5c7103e2e8c0fbbcab944 |
|
BLAKE2b-256 | 6f78da313f3de10628fbf6c4e74db8bb15f8fb5c85818f58d4b8080dd8d36882 |
Close
Hashes for InfixParser-3.1.4-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 609e5f6bb9d234d85bcdf9d0ac86b6224bf55a39c6f7796d81b0aae5637c6053 |
|
MD5 | 10ae17468ca49f172f6c9e33d9190794 |
|
BLAKE2b-256 | c8c6c80c2ad9925bb1cdbff352c8e574c9a198084d6cbf2031b107b4721344cd |
Close
Hashes for InfixParser-3.1.4-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 620b2462a639a4f27e4aae0654a43c9d4cd22bad79ead4e4a56249e8551ffd4f |
|
MD5 | 4d0c38f3513e72ff849543eb6beacf26 |
|
BLAKE2b-256 | f76bd0e2686b5b90833aa248833029238c4a5423e44cc29de1ac0fdd48708176 |