{ "info": { "author": "Peter Facka", "author_email": "pfacka@binaryparadise.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "Boolexp\r\n=======\r\n\r\nBoolexp provides \"safe\" evaluation of boolean expressions for use\r\ncases where eval might be dangerous. Boolexp expressions are\r\ncontext-free and mimic Python sytax. Only basic math opearations\r\nand data structures are provided.\r\n\r\nInstalation\r\n-----------\r\n\r\nTo install Boolexp, change to the directory where setup.py is\r\nlocated and type:\r\n\r\npython setup.py install\r\n\r\nRequirements:\r\n\r\n\r\n- Python 2.7\r\n- pyparsing 1.5.0 or later\r\n\r\nExpression Syntax Overview\r\n--------------------------\r\n\r\nBasic math operators *\\*,/,+,-* have highest priority\r\n\r\n\r\n\r\n.. code-block:: python\r\n\r\n >>> from boolexp import Expression\r\n >>> Expression(\"4 + 4 / 2\").evaluate()\r\n >>> 6\r\n >>> Expression(\"( 4 + 4 ) / 2 \").evaluate()\r\n >>> 4\r\n\r\nComparsion operators *!=, ==, <, >, <=, >=, in* are next in\r\npriority. All comparsion operators have return type of *boolean*,\r\nwhich can be used as input for *boolean* operators *and, or, not*\r\nwith lowest priority.\r\n\r\n\r\n\r\n.. code-block:: python\r\n\r\n >>> from boolexp import Expression\r\n >>> Expression(2 == 1).evaluate()\r\n >>> False\r\n >>> Expression(\"2 * - 2 == - 4\").evaluate()\r\n >>> True\r\n >>> Expression(\"not 2 == 3\").evaluate()\r\n >>> True\r\n >>> Expression(\"3 <= 8 and 2 == 5\").evaluate()\r\n >>> False\r\n\r\nExpresions with with variables\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nThis all would not be much of a fun without posibility to use\r\nvariables. Allowed types for variables are\r\n*bool,int,float,str,list,dict*\r\n\r\n.. code-block:: python\r\n\r\n >>> from boolexp import Expression\r\n >>> Expression(\"1 in v\").evaluate(dict(v=[1,2])).evaluate()\r\n >>> True\r\n >>> Expression(\"one[1].part == 2\").evaluate(dict(one=[1, dict(part=2)], two=1)).evaluate()\r\n >>> True\r\n\r\nDiclaimer\r\n---------\r\n\r\nThis project is now in a state of proof of concept only, thus far\r\nfrom suitable for production enviroment.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/pfacka/boolexp", "keywords": "boolean expression BNF safe evaluation", "license": "MIT Licence (http://opensource.org/licenses/MIT)", "maintainer": "", "maintainer_email": "", "name": "boolexp", "package_url": "https://pypi.org/project/boolexp/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/boolexp/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/pfacka/boolexp" }, "release_url": "https://pypi.org/project/boolexp/0.1/", "requires_dist": null, "requires_python": null, "summary": "Safe boolean expression evaluator", "version": "0.1" }, "last_serial": 881112, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "999ee191454463ce864dc586431974a6", "sha256": "b5e9e0e057143d3d0e54c00be7ec243216ea4aae8b705699be44dda58cff2f07" }, "downloads": -1, "filename": "boolexp-0.1.tar.gz", "has_sig": false, "md5_digest": "999ee191454463ce864dc586431974a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3108, "upload_time": "2013-09-24T15:46:47", "url": "https://files.pythonhosted.org/packages/08/62/d2c0215982fe03ee35d0277e35af47c5f8aae1559038039a372c8f822eb8/boolexp-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "999ee191454463ce864dc586431974a6", "sha256": "b5e9e0e057143d3d0e54c00be7ec243216ea4aae8b705699be44dda58cff2f07" }, "downloads": -1, "filename": "boolexp-0.1.tar.gz", "has_sig": false, "md5_digest": "999ee191454463ce864dc586431974a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3108, "upload_time": "2013-09-24T15:46:47", "url": "https://files.pythonhosted.org/packages/08/62/d2c0215982fe03ee35d0277e35af47c5f8aae1559038039a372c8f822eb8/boolexp-0.1.tar.gz" } ] }