{ "info": { "author": "simon-ritchie", "author_email": "antisocial.sid2@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "# pconst\n\n\"pconst\" library provide you const-like function on Python.\n\n# Install\n\nCurrently preparing to install via pip.\n\n# How to use\n\nYou can set constants to const module's attribute.\n\n```py\nfrom pconst import const\nconst.APPLE_PRICE = 100\nconst.APPLE_NAME = 'apple'\nprint(const.APPLE_PRICE)\n```\n\n```\n100\n```\n\nIf try to update constant value, ConstantError will be raised.\n\n```py\nconst.APPLE_PRICE = 200\n```\n\n```\nConstant value of \"APPLE_PRICE\" is not editable.\n```\n\ndel operator is also disallowed.\n\n```py\ndel const.APPLE_NAME\n```\n\n```\nConstantError: Constant values are not deletable.\n```\n\nYou can also set dict and list value to const module, and they will be not editable (if dict or list values contains dict or list, then will be applied recursively.).\n\n```py\nconst.APPLE_DATA = {\n 'prince': 100,\n 'name': 'apple',\n 'sales_list': [12300, 25000, 8200]}\nprint('price:', const.APPLE_DATA['price'])\nprint('name:', const.APPLE_DATA['name'])\nprint('sales_list:', const.APPLE_DATA['sales_list'])\n```\n\n```\nprice: 100\nname: apple\nsales_list: [12300, 25000, 8200]\n```\n\n```py\nconst.APPLE_DATA['price'] = 200\n```\n\n```\nConstantError: Update dict value is not allowed.\n```\n\n```py\nconst.APPLE_DATA['sales_list'][1] = 9800\n```\n\n```\nConstantError: Constant list value is not allowed.\n```\n\nThe dict or list class method that will not change the values is be able to access (e.g., len(), keys()).\n\n```py\nprint(len(const.APPLE_DATA['sales_list']))\n```\n\n```\n3\n```\n\n```py\nprint(const.APPLE_DATA.keys())\n```\n\n```\ndict_keys(['price', 'name', 'sales_list'])\n```\n\nConversely, if the method that will change the dict or list values, it will raise error.\n\n```py\nconst.APPLE_DATA.update({'season': 'winter'})\n```\n\n```\nConstantError: To update dict values is not allowed.\n```\n\n# For test\n\nTest will be run by nose library (https://nose.readthedocs.io/en/latest/).\n\n```\n# pip install nose\n```\n\nProbably this pip command requires \"Run as Administrator\".\n\nThen move to pconst directory, and run following command:\n\n```\n$ nosetests -s\n```\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/simon-ritchie/pconst", "keywords": "", "license": "MIT", "maintainer": "simon-ritchie", "maintainer_email": "antisocial.sid2@gmail.com", "name": "pconst", "package_url": "https://pypi.org/project/pconst/", "platform": "", "project_url": "https://pypi.org/project/pconst/", "project_urls": { "Homepage": "https://github.com/simon-ritchie/pconst" }, "release_url": "https://pypi.org/project/pconst/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "\"pconst\" library provide you const-like function on Python.", "version": "1.0.0" }, "last_serial": 4424012, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "e2e1cb2d91a8d9f059f3102fc479ade2", "sha256": "225965c897ab809adf133d775bfdf00d07cc41130d223cfacaf148ad03bc7db4" }, "downloads": -1, "filename": "pconst-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e2e1cb2d91a8d9f059f3102fc479ade2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5318, "upload_time": "2018-10-28T09:33:34", "url": "https://files.pythonhosted.org/packages/8c/ec/d53e01e0661591280bd85c8f384e0761efaffae3eccf6e13ee97908acc37/pconst-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "04c3867e868cdba0f07a7d0852fa6278", "sha256": "ce73a39bb6400d803c4e3a65be77b7af20745f39144b4306de7617e20bed9b23" }, "downloads": -1, "filename": "pconst-1.0.0.tar.gz", "has_sig": false, "md5_digest": "04c3867e868cdba0f07a7d0852fa6278", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4978, "upload_time": "2018-10-28T09:33:35", "url": "https://files.pythonhosted.org/packages/0d/af/b9fdf45f5bb699b854aa72dc53f6891c578f1196b195656a154208a3054e/pconst-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e2e1cb2d91a8d9f059f3102fc479ade2", "sha256": "225965c897ab809adf133d775bfdf00d07cc41130d223cfacaf148ad03bc7db4" }, "downloads": -1, "filename": "pconst-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e2e1cb2d91a8d9f059f3102fc479ade2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5318, "upload_time": "2018-10-28T09:33:34", "url": "https://files.pythonhosted.org/packages/8c/ec/d53e01e0661591280bd85c8f384e0761efaffae3eccf6e13ee97908acc37/pconst-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "04c3867e868cdba0f07a7d0852fa6278", "sha256": "ce73a39bb6400d803c4e3a65be77b7af20745f39144b4306de7617e20bed9b23" }, "downloads": -1, "filename": "pconst-1.0.0.tar.gz", "has_sig": false, "md5_digest": "04c3867e868cdba0f07a7d0852fa6278", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4978, "upload_time": "2018-10-28T09:33:35", "url": "https://files.pythonhosted.org/packages/0d/af/b9fdf45f5bb699b854aa72dc53f6891c578f1196b195656a154208a3054e/pconst-1.0.0.tar.gz" } ] }