{ "info": { "author": "PetarPeychev", "author_email": "petarpeychev98@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: Public Domain", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# pyboolean\nParse infix boolean expressions to postfix (RPN), evaluate and generate truth tables.\n\nCompatibilities\n------------\n\n* *Python 3.x*\n* *Any Operating System*\n\nInstallation\n------------\n\npyboolean is published on **PyPi**, so you only need to run the following command:\n\n $ pip install pyboolean\n\nUsage\n------------\n\nCreating a new boolean expression:\n\n```python\nfrom pyboolean import BoolExpr\n\nbool_expr = BoolExpr('1 or 0')\n```\n\nPrinting the formatted version of the expression:\n\n```python\nprint(bool_expr)\n# Output: \"1 + 0\"\n```\nEvaluating our boolean expression:\n\n```python\nprint(bool_expr.eval())\n# Output: \"1\"\n```\n\nA boolean expression can also include variables:\n\n```python\nbool_expr = BoolExpr('1 . m + ( 0 + ! n ) . m')\n```\n\nIn order to evaluate an expression with variables, the eval() function can take arguments to replace them:\n\n```python\nprint(bool_expr.eval(1, 0))\n# Output: \"1\"\n```\n\nFor expressions with variables, one can generate a truth table like so:\n\n```python\nprint(bool_expr.truthtable())\n# Output:\n#\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n#\u2551 m n \u2503 O \u2551\n#\u2551\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2551\n#\u2551 0 0 \u2503 0 \u2551\n#\u2551\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2542\u2500\u2500\u2500\u2551\n#\u2551 0 1 \u2503 0 \u2551\n#\u2551\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2542\u2500\u2500\u2500\u2551\n#\u2551 1 0 \u2503 1 \u2551\n#\u2551\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2542\u2500\u2500\u2500\u2551\n#\u2551 1 1 \u2503 1 \u2551\n#\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\n```\n\nOr if you need to manipulate the raw truth table data, generate a dictionary:\n\n```python\nprint(bool_expr.truthdict())\n# Output: \"{('0', '0'): '0', ('0', '1'): '0', ('1', '0'): '1', ('1', '1'): '1'}\"\n```\n\nFinally, a note on formatting. When creating an expression, all spaces are ignored and many different versions of the operator symbols are accepted, so one can be very 'creative' with the input and not need to worry:\n\n```python\nbool_expr = BoolExpr('p+1and \u00acm.(1\u2227p ) \u2228notxand~0')\nprint(bool_expr)\n# Output: \"p + 1 . ! m . ( 1 . p ) + ! x . ! 0\"\n```\n\nFull list of accepted operator symbols:\n\n**AND:**\n\nand . & \u2227\n\n**OR:**\n\nor + | \u2228\n\n**NOT:**\n\nnot ! ~ \u00ac\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/PetarPeychev/pyboolean", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyboolean", "package_url": "https://pypi.org/project/pyboolean/", "platform": "", "project_url": "https://pypi.org/project/pyboolean/", "project_urls": { "Homepage": "https://github.com/PetarPeychev/pyboolean" }, "release_url": "https://pypi.org/project/pyboolean/0.1.post4/", "requires_dist": null, "requires_python": "", "summary": "Parse infix boolean expressions to RPN, evaluate and generate truth tables.", "version": "0.1.post4" }, "last_serial": 4448468, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "798ef091ebf18b4ac9f41f014929fa51", "sha256": "154a492b7d6b5277dbafb4ca202056cc7c0d870ee1858917fe91e3fda0592162" }, "downloads": -1, "filename": "pyboolean-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "798ef091ebf18b4ac9f41f014929fa51", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3701, "upload_time": "2018-11-03T20:11:47", "url": "https://files.pythonhosted.org/packages/d5/9b/4b8045b64d5348b05999f188dcde531260b33e42a7229d1f383280053ea7/pyboolean-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e32b890eb42b4141d16211f33936b11a", "sha256": "769cb71f69cf411ac3ed5e2296f648e191079aed6adff98f1cb01741cd0cd5dd" }, "downloads": -1, "filename": "pyboolean-0.1.tar.gz", "has_sig": false, "md5_digest": "e32b890eb42b4141d16211f33936b11a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2275, "upload_time": "2018-11-03T20:11:48", "url": "https://files.pythonhosted.org/packages/c4/18/81c4247ea32103b1523c4b05b45256f007f48517e18df1e027e9694091a7/pyboolean-0.1.tar.gz" } ], "0.1.post1": [ { "comment_text": "", "digests": { "md5": "017eb852df2bf6ce688cf8299249c99e", "sha256": "da85f0304024a00614bbb358a8b94a7ef0ea5ba35f3071099486c4de06cb3ff5" }, "downloads": -1, "filename": "pyboolean-0.1.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "017eb852df2bf6ce688cf8299249c99e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5237, "upload_time": "2018-11-03T20:26:57", "url": "https://files.pythonhosted.org/packages/9b/21/5bb795cc4bfcb4b7394c88d500e0ed4f0826222a78b87ac390f82a9c3d23/pyboolean-0.1.post1-py3-none-any.whl" } ], "0.1.post2": [ { "comment_text": "", "digests": { "md5": "de74c36f04acb464c437329b7ef5c3af", "sha256": "2dce98139971d182394a68cea9e535d3d085831de58ff47fdb3d34ecf6e95ad3" }, "downloads": -1, "filename": "pyboolean-0.1.post2-py3-none-any.whl", "has_sig": false, "md5_digest": "de74c36f04acb464c437329b7ef5c3af", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5986, "upload_time": "2018-11-03T20:29:31", "url": "https://files.pythonhosted.org/packages/10/87/e9d14f204440c64df36ac63e6483d2a78f28657a8e6c300a48ab39628383/pyboolean-0.1.post2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6536df2ffe835d84ecb4c2bd49699ba7", "sha256": "4c521927aeeb078e8f9f600dfc8ce48a30440a5ec88e6100d5bc0a7b5019c35d" }, "downloads": -1, "filename": "pyboolean-0.1.post2.tar.gz", "has_sig": false, "md5_digest": "6536df2ffe835d84ecb4c2bd49699ba7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2955, "upload_time": "2018-11-03T20:29:32", "url": "https://files.pythonhosted.org/packages/38/77/e811387f1fef188d0283c4429970f5a2fb3a33e24fd707a5ac25c94e8fe7/pyboolean-0.1.post2.tar.gz" } ], "0.1.post3": [ { "comment_text": "", "digests": { "md5": "e7e6eb986b7867ae75296304d1d15844", "sha256": "19a1abad2331fb3fc40871f8a3bc78411edb4dd50eba8c92cd9673a0c48a45ba" }, "downloads": -1, "filename": "pyboolean-0.1.post3-py3-none-any.whl", "has_sig": false, "md5_digest": "e7e6eb986b7867ae75296304d1d15844", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4585, "upload_time": "2018-11-03T21:27:03", "url": "https://files.pythonhosted.org/packages/c8/dc/b96f7359dead2316352f977efe370b698b2367899ee8c91ffa1e12639b05/pyboolean-0.1.post3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0a7af7c7627d97d56d7120168076a783", "sha256": "f82c8ec5e8afe46968b32a4f6a4aade41a5fcc006016247d9f182d6f79689348" }, "downloads": -1, "filename": "pyboolean-0.1.post3.tar.gz", "has_sig": false, "md5_digest": "0a7af7c7627d97d56d7120168076a783", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3191, "upload_time": "2018-11-03T21:27:04", "url": "https://files.pythonhosted.org/packages/a7/66/ee5830a188b6b88330336a5660470f1b3c1bcf19b092f6e13e4bc9adfb6e/pyboolean-0.1.post3.tar.gz" } ], "0.1.post4": [ { "comment_text": "", "digests": { "md5": "20bd3b8c9510d3e1c7be66025b2545c5", "sha256": "23b0f9c7ab510ae3f3126df934f575f8dd3df4aacab8dc0d425ddd33ba23a469" }, "downloads": -1, "filename": "pyboolean-0.1.post4-py3-none-any.whl", "has_sig": false, "md5_digest": "20bd3b8c9510d3e1c7be66025b2545c5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5334, "upload_time": "2018-11-03T22:47:55", "url": "https://files.pythonhosted.org/packages/55/98/4d807bcbb929d58a532f6d4b7ab686207948a82f7341af03d8472dcdbf23/pyboolean-0.1.post4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0e91e33d10926bf7a499e2472fb04175", "sha256": "9479ee144e91d10a7a3ea7043c390caae15a81b3ceb2bd006c684750f20e2ef7" }, "downloads": -1, "filename": "pyboolean-0.1.post4.tar.gz", "has_sig": false, "md5_digest": "0e91e33d10926bf7a499e2472fb04175", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4117, "upload_time": "2018-11-03T22:47:57", "url": "https://files.pythonhosted.org/packages/eb/19/65d7b1d97cd9a89e839345f1ff80d4abb99b268905a831027f3a0f54cee9/pyboolean-0.1.post4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "20bd3b8c9510d3e1c7be66025b2545c5", "sha256": "23b0f9c7ab510ae3f3126df934f575f8dd3df4aacab8dc0d425ddd33ba23a469" }, "downloads": -1, "filename": "pyboolean-0.1.post4-py3-none-any.whl", "has_sig": false, "md5_digest": "20bd3b8c9510d3e1c7be66025b2545c5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5334, "upload_time": "2018-11-03T22:47:55", "url": "https://files.pythonhosted.org/packages/55/98/4d807bcbb929d58a532f6d4b7ab686207948a82f7341af03d8472dcdbf23/pyboolean-0.1.post4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0e91e33d10926bf7a499e2472fb04175", "sha256": "9479ee144e91d10a7a3ea7043c390caae15a81b3ceb2bd006c684750f20e2ef7" }, "downloads": -1, "filename": "pyboolean-0.1.post4.tar.gz", "has_sig": false, "md5_digest": "0e91e33d10926bf7a499e2472fb04175", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4117, "upload_time": "2018-11-03T22:47:57", "url": "https://files.pythonhosted.org/packages/eb/19/65d7b1d97cd9a89e839345f1ff80d4abb99b268905a831027f3a0f54cee9/pyboolean-0.1.post4.tar.gz" } ] }