{ "info": { "author": "Sky Zhang", "author_email": "zyx474029625@126.com", "bugtrack_url": null, "classifiers": [], "description": "paraparser --- parameters parser\n================================\n\nParameters is design for large program with massive parameters. It\nsupports integer, float, bool, string and enumerate(enum) types. Array\nis supported for bool, integer and float. For enum type, customized\nvalue can be set as well. Data type is protected. And load/dump of\nparameters/config is available.\n\nGet instance\n------------\n\nYou can get an emptry instance, or load from dict/filename/filehandler\n\n.. code:: python\n\n params = paraparser.Parameters()\n params = paraparser.Parameters(paramters_dict)\n params = paraparser.Parameters(parameter_json)\n\nLoad config/parameters\n----------------------\n\nAfter the parameter instance is generated, you can load from a dict/file\nas well.\n\n.. code:: python\n\n params.LOAD_CONFIG(config_file)\n params.LOAD_PARAMETERS(parameters_file)\n\nYou can check parameters.json.sample & config.json.sample for details of\nparameters/config.\n\nupdate/remove key\n-----------------\n\nKey can be updated/removed, val can be set/reset\n\n.. code:: python\n\n >>> params.UPDATE_KEY('test_key', 'int', default=0)\n >>> params\n {\"test_key\": 0}\n >>> params.test_key = 1\n >>> params\n {\"test_key\": 1}\n >>> params.test_key\n 1\n >>> params.REMOVE_KEY('test_key')\n >>> params.RESET_KEY('test_key')\n >>> params\n {\"test_key\": 0}\n\nSpecial Types\n-------------\n\nArray\n~~~~~\n\nAn integer/float/bool array could be initiate with\n\n.. code:: python\n\n >>> params.UPDATE_KEY('test_key', 'int', isArray=True, length=10, default=0)\n >>> params\n {\"test_key\": \"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\"}\n >>> params.UPDATE_KEY('test_key', 'float', isArray=True, length=6, default=0)\n >>> params\n {\"test_key\": \"[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]\"}\n\nEnumerate\n~~~~~~~~~\n\nWe highly improved enum type\n\n.. code:: python\n\n >>> params.UPDATE_KEY('test_key', 'enum', enumItems=['x1', 'x2', 'x3'], default='x1')\n >>> params\n {\n \"test_key\": \"x1\"\n }\n >>> params.test_key \n key test_key: x1\n enums: ['x1', 'x2', 'x3']\n\nYou can customize enuemrate enumerate values with enumVals, which is\nreally useful when cooperating with old programs.\n\n.. code:: python\n\n >>> params.UPDATE_KEY('test_key', 'enum', enumItems=['x1', 'x2', 'x3'], enumVals=['-1', '2', '5'], default='x1')\n >>> params\n {\n \"test_key\": \"x1\"\n }\n >>> print(params.DUMP_OUTPUT())\n test_key = -1\n\nType Protection\n---------------\n\nType is protected within paraparser, e.g.\n\n.. code:: python\n\n >>> params.UPDATE_KEY('test_key', 'enum', enumItems=['x1', 'x2', 'x3'], enumVals=['-1', '2', '5'], default='x1')\n >>> params\n {\n \"test_key\": \"x1\"\n }\n >>> params.test_key = 'x22'\n AssertionError: Parameters Errror: key \"test_key\" is a enum, items: ['x1', 'x2', 'x3']\n\nAnd the same for other types.\n\nOutput\n------\n\nA beautiful output is available with the instance or use the print\nfunction\n\n.. code:: python\n\n >>> print(params)\n {\n \"string\": \"STRINGSING\",\n \"int\": 1,\n \"float\": 1.1,\n \"enum\": \"1\",\n \"floatArray\": [ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0 ],\n \"runType\": \"geometry_converge\",\n \"ialgo\": \"method1\"\n }\n\nYou could also dump the config with DUMP\\_CONFIG(), or dump the\nparameters with DUMP\\_PARAMETERS() to standard output or to a\nfile/handler\n\n.. code:: python\n\n >>> params.DUMP_CONFIG()\n {'test_key': {'key': 'test_key', 'type': 'float', 'enumItems': None, 'enumVals': None, 'isArray': True, 'length': 6, 'default': 0.0, 'comments': '', 'reference': ''}}\n >>> params.DUMP_PARAMETERS()\n {'__keys_config': {'test_key': {'key': 'test_key', 'type': 'float', 'enumItems': None, 'enumVals': None, 'isArray': True, 'length': 6, 'default': 0.0, 'comments': '', 'reference': ''}}, '__keys_values': {'test_key': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}}\n >>> params.DUMP_CONFIG('config.json')\n >>> params.DUMP_PARAMETERS('parameters.json')\n\nHave Fun!\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sky-y-zhang/paraparser.git", "keywords": "pip,parameters,parser", "license": "MIT Licence", "maintainer": "", "maintainer_email": "", "name": "paraparser", "package_url": "https://pypi.org/project/paraparser/", "platform": "any", "project_url": "https://pypi.org/project/paraparser/", "project_urls": { "Homepage": "https://github.com/sky-y-zhang/paraparser.git" }, "release_url": "https://pypi.org/project/paraparser/1.0.0/", "requires_dist": [ "six" ], "requires_python": "", "summary": "parameters process", "version": "1.0.0" }, "last_serial": 4558508, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "0bea6e47570f3f38b250fc29ca824175", "sha256": "26ba71fba85819b4b64eb9aeb4b3c6277e1ab04d7eba7e51691fd80ed5574f33" }, "downloads": -1, "filename": "paraparser-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0bea6e47570f3f38b250fc29ca824175", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9251, "upload_time": "2018-12-04T07:11:35", "url": "https://files.pythonhosted.org/packages/e7/63/9c9b86a482c5637aecbb46c46ce093a1e226b1f96246446bd6e4e90bb61b/paraparser-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a1eb8e7a8a1f888c831a372ff548509f", "sha256": "312150a84c0b84fdfe1e6e549c43ac08b1bf6154e70b038db1891289997175a1" }, "downloads": -1, "filename": "paraparser-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a1eb8e7a8a1f888c831a372ff548509f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8109, "upload_time": "2018-12-04T07:11:38", "url": "https://files.pythonhosted.org/packages/c0/5f/ac1af25214d18100380e9df48c95596180bece36ee6c70dc6b4074f715de/paraparser-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0bea6e47570f3f38b250fc29ca824175", "sha256": "26ba71fba85819b4b64eb9aeb4b3c6277e1ab04d7eba7e51691fd80ed5574f33" }, "downloads": -1, "filename": "paraparser-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0bea6e47570f3f38b250fc29ca824175", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9251, "upload_time": "2018-12-04T07:11:35", "url": "https://files.pythonhosted.org/packages/e7/63/9c9b86a482c5637aecbb46c46ce093a1e226b1f96246446bd6e4e90bb61b/paraparser-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a1eb8e7a8a1f888c831a372ff548509f", "sha256": "312150a84c0b84fdfe1e6e549c43ac08b1bf6154e70b038db1891289997175a1" }, "downloads": -1, "filename": "paraparser-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a1eb8e7a8a1f888c831a372ff548509f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8109, "upload_time": "2018-12-04T07:11:38", "url": "https://files.pythonhosted.org/packages/c0/5f/ac1af25214d18100380e9df48c95596180bece36ee6c70dc6b4074f715de/paraparser-1.0.0.tar.gz" } ] }