{ "info": { "author": "Sanhe Hu", "author_email": "husanhe@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": ".. image:: https://travis-ci.org/MacHu-GWU/constant2-project.svg?branch=master\n :target: https://travis-ci.org/MacHu-GWU/constant2-project?branch=master\n\n.. image:: https://codecov.io/gh/MacHu-GWU/constant2-project/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/MacHu-GWU/constant2-project\n\n.. image:: https://img.shields.io/pypi/v/constant2.svg\n :target: https://pypi.python.org/pypi/constant2\n\n.. image:: https://img.shields.io/pypi/l/constant2.svg\n :target: https://pypi.python.org/pypi/constant2\n\n.. image:: https://img.shields.io/pypi/pyversions/constant2.svg\n :target: https://pypi.python.org/pypi/constant2\n\n.. image:: https://img.shields.io/badge/Star_Me_on_GitHub!--None.svg?style=social\n :target: https://github.com/MacHu-GWU/constant2-project\n\n\nWelcome to ``constant2`` Documentation\n==============================================================================\n\nIf you have lots of constant2 value widely used across your development. A better way is to define ``Constantant Variable`` rather than using the raw value. This can improve the readability and accessibility.\n\n``constant2`` is a library provide extensive way of managing your constant2 variable.\n\n**Another powerful feature** is, ``constant2`` allows developer defines normalized entity relationship and is data in ``class`` style, which giving awesome accessibility to every single row, and every single column, free developer from memorizing things.\n\n\nQuick Links\n------------------------------------------------------------------------------\n\n- .. image:: https://img.shields.io/badge/Link-Document-red.svg\n :target: https://constant2.readthedocs.io/index.html\n\n- .. image:: https://img.shields.io/badge/Link-API_Reference_and_Source_Code-red.svg\n :target: https://constant2.readthedocs.io/py-modindex.html\n\n- .. image:: https://img.shields.io/badge/Link-Install-red.svg\n :target: `install`_\n\n- .. image:: https://img.shields.io/badge/Link-GitHub-blue.svg\n :target: https://github.com/MacHu-GWU/constant2-project\n\n- .. image:: https://img.shields.io/badge/Link-Submit_Issue_and_Feature_Request-blue.svg\n :target: https://github.com/MacHu-GWU/constant2-project/issues\n\n- .. image:: https://img.shields.io/badge/Link-Download-blue.svg\n :target: https://pypi.python.org/pypi/constant2#downloads\n\n\nUsage\n------------------------------------------------------------------------------\n\n**Version Changed 0.0.9: All nested class now has to inherit from** ``Constant`` **or its subclass**:\n\n.. code-block:: python\n\n # WRONG!\n class ItemType(Constant):\n class Weapon:\n id = 1\n\n # CORRECT\n class ItemType(Constant):\n class Weapon(Constant):\n id = 1\n\n # or\n class Item(Constant):\n pass\n\n class ItemType(Constant):\n class Weapon(Item):\n id = 1\n\nUsage:\n\n.. code-block:: python\n\n from constant2 import Constant\n\n class Food(Constant):\n\n class Fruit(Constant):\n id = 1\n name = \"fruit\"\n\n class Apple(Constant):\n id = 1\n name = \"apple\"\n\n class RedApple(Constant):\n id = 1\n name = \"red apple\"\n\n class GreenApple(Constant):\n id = 2\n name = \"green apple\"\n\n class Banana(Constant):\n id = 2\n name = \"banana\"\n\n class YellowBanana(Constant):\n id = 1\n name = \"yellow banana\"\n\n class GreenBanana(Constant):\n id = 2\n name = \"green banana\"\n\n class Meat(Constant):\n id = 2\n name = \"meat\"\n\n class Pork(Constant):\n id = 1\n name = \"pork\"\n\n class Beef(Constant):\n id = 2\n name = \"beef\"\n\n food = Food()\n\nYou can visit it's data or child class data in these way:\n\n.. code-block:: python\n\n # Use class\n >>> Fruit.Items() # .Items() return it's data\n [('id', 1), ('name', 'fruit')]\n\n >>> Fruit.Keys() # .Keys() return keys\n ['id', 'name']\n\n >>> Fruit.Values() # .Values() return values\n [1, 'fruit']\n\n >>> Fruit.ToDict() # return data in a dict\n {'id': 1, 'name': 'fruit'}\n\n # use instance\n >>> food.items() # .Items() return it's data\n [('id', 1), ('name', 'fruit')]\n\n >>> food.keys() # .keys() return keys\n ['id', 'name']\n\n >>> food.values() # .values() return values\n [1, 'fruit']\n\n >>> food.to_dict() # return data in a dict\n {'id': 1, 'name': 'fruit'}\n\n # iterate on all nested class\n >>> Fruit.Subclasses(sort_by='id')\n [class Apple, class Banana]\n\n # get first nested class that kls.id == 1\n # useful when you need reverse lookup\n >>> Fruit.GetFirst('id', 1)\n class Apple\n\n # get all child class that kls.id == 1\n >>> Fruit.GetAll('id', 1)\n [class Apple, ]\n\nAnd it provides built-in I/O methods allow you to dump these data in to a dictionary.\n\n.. code-block:: python\n\n >>> data = Food.dump()\n >>> data\n {\n \"Food\": {\n \"Fruit\": {\n \"Apple\": {\n \"GreenApple\": {\n \"__classname__\": \"GreenApple\",\n \"id\": 2,\n \"name\": \"green apple\"\n },\n \"RedApple\": {\n \"__classname__\": \"RedApple\",\n \"id\": 1,\n \"name\": \"red apple\"\n },\n \"__classname__\": \"Apple\",\n \"id\": 1,\n \"name\": \"apple\"\n },\n \"Banana\": {\n \"GreenBanana\": {\n \"__classname__\": \"GreenBanana\",\n \"id\": 2,\n \"name\": \"green banana\"\n },\n \"YellowBanana\": {\n \"__classname__\": \"YellowBanana\",\n \"id\": 1,\n \"name\": \"yellow banana\"\n },\n \"__classname__\": \"Banana\",\n \"id\": 2,\n \"name\": \"banana\"\n },\n \"__classname__\": \"Fruit\",\n \"id\": 1,\n \"name\": \"fruit\"\n },\n \"Meat\": {\n \"Beef\": {\n \"__classname__\": \"Beef\",\n \"id\": 2,\n \"name\": \"beef\"\n },\n \"Pork\": {\n \"__classname__\": \"Pork\",\n \"id\": 1,\n \"name\": \"pork\"\n },\n \"__classname__\": \"Meat\",\n \"id\": 2,\n \"name\": \"meat\"\n },\n \"__classname__\": \"Food\"\n }\n }\n\n >>> Food = Constant.load(data)\n\n\n.. _install:\n\nInstall\n------------------------------------------------------------------------------\n\n``constant2`` is released on PyPI, so all you need is:\n\n.. code-block:: console\n\n $ pip install constant2\n\nTo upgrade to latest version:\n\n.. code-block:: console\n\n $ pip install --upgrade constant2\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://pypi.python.org/pypi/constant2/0.0.13#downloads", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/MacHu-GWU/", "keywords": "", "license": "MIT", "maintainer": "Sanhe Hu", "maintainer_email": "husanhe@gmail.com", "name": "constant2", "package_url": "https://pypi.org/project/constant2/", "platform": "Windows", "project_url": "https://pypi.org/project/constant2/", "project_urls": { "Download": "https://pypi.python.org/pypi/constant2/0.0.13#downloads", "Homepage": "https://github.com/MacHu-GWU/" }, "release_url": "https://pypi.org/project/constant2/0.0.13/", "requires_dist": null, "requires_python": "", "summary": "provide extensive way of managing your constant variable.", "version": "0.0.13" }, "last_serial": 4617371, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4b3c1dfcdc96c1e9b4b30498227b7b2b", "sha256": "51c4263d248315957887e0d0cea4ec30ccd42703ddc4ce53d38475482a86f8d8" }, "downloads": -1, "filename": "constant2-0.0.1.zip", "has_sig": false, "md5_digest": "4b3c1dfcdc96c1e9b4b30498227b7b2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23423, "upload_time": "2017-05-19T17:30:50", "url": "https://files.pythonhosted.org/packages/e1/f7/da985b8647e979c0565cde78d27449ef0c68e8d2bfc5b6e8aea3c17631a2/constant2-0.0.1.zip" } ], "0.0.10": [ { "comment_text": "", "digests": { "md5": "6fff5459e4afe43ece2b32aec1aad55a", "sha256": "4a3f00e898b75b15bc3feb0283a6a8ea6f69310bc5bfd050b62f03cc63bbd746" }, "downloads": -1, "filename": "constant2-0.0.10-py2-none-any.whl", "has_sig": false, "md5_digest": "6fff5459e4afe43ece2b32aec1aad55a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 337091, "upload_time": "2018-09-07T00:46:06", "url": "https://files.pythonhosted.org/packages/df/8d/b8c544523c4a15d68ae0eb867c489e5da5c0cdbd3b6252d4dddcf1075041/constant2-0.0.10-py2-none-any.whl" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "15ab8064160e8b7d8fa44d42937bb3b2", "sha256": "759a154b9a499bbfb04c24edf7cb31a91a7943e16eafb5452a55f5c7174a4e51" }, "downloads": -1, "filename": "constant2-0.0.11-py2-none-any.whl", "has_sig": false, "md5_digest": "15ab8064160e8b7d8fa44d42937bb3b2", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 337058, "upload_time": "2018-09-07T00:48:48", "url": "https://files.pythonhosted.org/packages/6a/72/99c3c9b2efdcbe1f578066e5c42fe451b853c0c32c30205923e6faccc2d7/constant2-0.0.11-py2-none-any.whl" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "eee1e25ea1f965644a28e59ba5da2bcc", "sha256": "44d0a5f297d8fcde37a12ac4f8954f6e7139aa136f24494dde389d90b7f71f33" }, "downloads": -1, "filename": "constant2-0.0.12-py2-none-any.whl", "has_sig": false, "md5_digest": "eee1e25ea1f965644a28e59ba5da2bcc", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 337089, "upload_time": "2018-09-07T00:52:04", "url": "https://files.pythonhosted.org/packages/30/58/14733ae66df86cda05748e11b90ec9a04e93854c1255427c7b8866acdf5e/constant2-0.0.12-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "df8ad160d559ee08ebb7d2698e92c725", "sha256": "cf5796b1bb21f9695e8db16e344efef114a35e641683872c6478fcdb48673059" }, "downloads": -1, "filename": "constant2-0.0.12.tar.gz", "has_sig": false, "md5_digest": "df8ad160d559ee08ebb7d2698e92c725", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 91204, "upload_time": "2018-09-07T00:52:06", "url": "https://files.pythonhosted.org/packages/05/e8/7c094dae96d9f98808fe4b68c5c4a6d110ab2ee9732259c38b9883f944b9/constant2-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "6b6c98729ab952fb2da25837c8a450b1", "sha256": "42a5c7609ff1acd11b6fe606bc827cd7d3ce3618f49e241dbe0ec029ffae3688" }, "downloads": -1, "filename": "constant2-0.0.13-py2-none-any.whl", "has_sig": false, "md5_digest": "6b6c98729ab952fb2da25837c8a450b1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 341237, "upload_time": "2018-12-19T16:17:51", "url": "https://files.pythonhosted.org/packages/da/2a/ccb83e6f5d329372baa347cdd4b4421d0aa82a3d8d97aa2b078ca5ee019e/constant2-0.0.13-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dcb6e75ed20ef0ff4af2e499bb7decf4", "sha256": "bbeac1293a399572ee821745c24a63b291cc5db3dd473f89514d727ea18c0604" }, "downloads": -1, "filename": "constant2-0.0.13.tar.gz", "has_sig": false, "md5_digest": "dcb6e75ed20ef0ff4af2e499bb7decf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 92270, "upload_time": "2018-12-19T16:17:53", "url": "https://files.pythonhosted.org/packages/fb/89/f8a7b3d99103c679b3e61104c0fb11c3fee04c5cb2a7865ffe231185d5b3/constant2-0.0.13.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "5d54d10ec0b8ed2a83fba88826478795", "sha256": "3327bbef24aca72d4dc37945bfa488b2c5b406aade36ee41e0d609a6d18f402a" }, "downloads": -1, "filename": "constant2-0.0.2.zip", "has_sig": false, "md5_digest": "5d54d10ec0b8ed2a83fba88826478795", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36930, "upload_time": "2017-05-30T22:17:06", "url": "https://files.pythonhosted.org/packages/5c/7e/7ddd5ed3ebe9d20ec95bd759996c63fd1ec4b1e6fd5dc28fa9fac57f5d77/constant2-0.0.2.zip" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "21e15e7b78bd8f9dcc643e3491f599ae", "sha256": "217a15346fd85ed211ce3c48bd350f99f8b9e688b696c0ee0ea416a80009cc19" }, "downloads": -1, "filename": "constant2-0.0.3.zip", "has_sig": false, "md5_digest": "21e15e7b78bd8f9dcc643e3491f599ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37300, "upload_time": "2017-06-15T21:59:31", "url": "https://files.pythonhosted.org/packages/5c/82/56ef459e59f05e53e0f4fc0127befa86426cdec65cf993723f30bbb3bd8e/constant2-0.0.3.zip" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "77acd9d513c07e3196f7857fe9e460d6", "sha256": "6d0d2eb16ff9ddedd9ee16a33209c1b645b4314e48992c928512163affcfc2ab" }, "downloads": -1, "filename": "constant2-0.0.4.zip", "has_sig": false, "md5_digest": "77acd9d513c07e3196f7857fe9e460d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37506, "upload_time": "2017-06-26T21:12:59", "url": "https://files.pythonhosted.org/packages/19/7a/1929463de6c700c744c782e550e27715bd58542ae9880a0107dd8257bb39/constant2-0.0.4.zip" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "164694c6a33ae632c46cd8a809ea0eb9", "sha256": "157582d683d4d94f3559ec9c0c9e640fb13cc7b71bdfc5daa1d3eab84e6fe84e" }, "downloads": -1, "filename": "constant2-0.0.5.tar.gz", "has_sig": false, "md5_digest": "164694c6a33ae632c46cd8a809ea0eb9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 93771, "upload_time": "2017-07-14T21:25:53", "url": "https://files.pythonhosted.org/packages/a6/61/be391ad6eed50c4071ef6c724627930ceacf1d3e3674c31ed4a808df9c2a/constant2-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "d7e4cc72062e1ea3f3757d96635711eb", "sha256": "98a6f3a2f7993fdc5361ef38065b27572a1adea1b35d3868e3e14ca0bfea79f6" }, "downloads": -1, "filename": "constant2-0.0.6.tar.gz", "has_sig": false, "md5_digest": "d7e4cc72062e1ea3f3757d96635711eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 94156, "upload_time": "2017-07-17T15:48:10", "url": "https://files.pythonhosted.org/packages/05/ab/0ba00a800091a4143a43eb3b464bf0fb07566c030922d598ec05da87ac11/constant2-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "a7bafff23bb26da8a73350000ee3c746", "sha256": "e048211df5ee28a304480102727c4895449548fb6a1b08b2b95e9eb248a32173" }, "downloads": -1, "filename": "constant2-0.0.7-py2-none-any.whl", "has_sig": false, "md5_digest": "a7bafff23bb26da8a73350000ee3c746", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 343945, "upload_time": "2017-09-07T03:16:07", "url": "https://files.pythonhosted.org/packages/19/a4/7ad531bedca68cdbe2559db2574f8750388682f57aee684b230a234e55f9/constant2-0.0.7-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0df349610b8770d258ccb86a5fc2b312", "sha256": "a6677ad2467e77b84e4b7db087033cd83192e0cbd17862382d565f1fa67a8fa1" }, "downloads": -1, "filename": "constant2-0.0.7.tar.gz", "has_sig": false, "md5_digest": "0df349610b8770d258ccb86a5fc2b312", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 93925, "upload_time": "2017-09-07T03:16:09", "url": "https://files.pythonhosted.org/packages/cf/d0/fdca620b11e4f7563948a0479253d39f0ed3eafbf7bbc0a9a4415271b9c0/constant2-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "8f48be7c963dd2ad42d11bff046c501f", "sha256": "c45a433785e312c980b657372a8d41f6871e9ddcdecef75ae0f8290ef82f5e3a" }, "downloads": -1, "filename": "constant2-0.0.8-py2-none-any.whl", "has_sig": false, "md5_digest": "8f48be7c963dd2ad42d11bff046c501f", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 337297, "upload_time": "2017-09-28T08:21:39", "url": "https://files.pythonhosted.org/packages/27/43/563abab45348dcf2df503600c9ff22dae1a201e9fe954be4edef2a69e9a3/constant2-0.0.8-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a13bf99f9a22614ed39d2a585c017bb1", "sha256": "febdb9d2461191a4b74962e26eb7a2b12fe5b47af49ae56551b2fbc0acca66bd" }, "downloads": -1, "filename": "constant2-0.0.8.tar.gz", "has_sig": false, "md5_digest": "a13bf99f9a22614ed39d2a585c017bb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 92137, "upload_time": "2017-09-28T08:21:43", "url": "https://files.pythonhosted.org/packages/23/4e/5a4f7c76461fc1b718fbc60eecfbc04173bd21e545a57d7c57775aea2de7/constant2-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "1b0a03bb16b194cf4807b0ef52de4169", "sha256": "079799a101c8e8575c189aa7128aaf9c3a9c3144ae9fab6c861c2ab6defbc9e7" }, "downloads": -1, "filename": "constant2-0.0.9-py2-none-any.whl", "has_sig": false, "md5_digest": "1b0a03bb16b194cf4807b0ef52de4169", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 336149, "upload_time": "2018-02-05T21:12:14", "url": "https://files.pythonhosted.org/packages/0e/53/f4676cc14d4e6fccaf5ac475c4d4fb0e2525cd557dc054c2442cd2c03048/constant2-0.0.9-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4373b243126631f3b042111a28040954", "sha256": "502198ad96882af23ac5f294534435300129230ed6c444c91c21f992a8d0de74" }, "downloads": -1, "filename": "constant2-0.0.9.tar.gz", "has_sig": false, "md5_digest": "4373b243126631f3b042111a28040954", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 90264, "upload_time": "2018-02-05T21:12:15", "url": "https://files.pythonhosted.org/packages/78/0e/bf60dade311a709b3d812fdc5709d87c1dfe6f98e677122f8e186560a17d/constant2-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6b6c98729ab952fb2da25837c8a450b1", "sha256": "42a5c7609ff1acd11b6fe606bc827cd7d3ce3618f49e241dbe0ec029ffae3688" }, "downloads": -1, "filename": "constant2-0.0.13-py2-none-any.whl", "has_sig": false, "md5_digest": "6b6c98729ab952fb2da25837c8a450b1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 341237, "upload_time": "2018-12-19T16:17:51", "url": "https://files.pythonhosted.org/packages/da/2a/ccb83e6f5d329372baa347cdd4b4421d0aa82a3d8d97aa2b078ca5ee019e/constant2-0.0.13-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dcb6e75ed20ef0ff4af2e499bb7decf4", "sha256": "bbeac1293a399572ee821745c24a63b291cc5db3dd473f89514d727ea18c0604" }, "downloads": -1, "filename": "constant2-0.0.13.tar.gz", "has_sig": false, "md5_digest": "dcb6e75ed20ef0ff4af2e499bb7decf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 92270, "upload_time": "2018-12-19T16:17:53", "url": "https://files.pythonhosted.org/packages/fb/89/f8a7b3d99103c679b3e61104c0fb11c3fee04c5cb2a7865ffe231185d5b3/constant2-0.0.13.tar.gz" } ] }