{ "info": { "author": "Takuro Wada", "author_email": "taxpon@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Topic :: Software Development :: Code Generators" ], "description": "Google Appengine ndb Property Generator\n=======================================\n\n.. image:: https://travis-ci.org/taxpon/ndb_prop_gen.svg\n :target: https://travis-ci.org/taxpon/ndb_prop_gen\n\n.. image:: https://coveralls.io/repos/github/taxpon/ndb_prop_gen/badge.svg?branch=master\n :target: https://coveralls.io/github/taxpon/ndb_prop_gen?branch=master\n\nGoogle Appengine ndb Property Generator written in python. You can convert json data into your custom ndb property by this library.\n\n\nWhat is this?\n-------------\nSimple generator of `ndb Property Subclass `_. Using json to define the property of the class.\n\nSource json sample\n~~~~~~~~~~~~~~~~~~\n.. code-block:: javascript\n\n {\n \"name\": \"book\",\n \"class\": \"Book\",\n \"props\": [\n {\n \"name\": \"title\",\n \"type\": \"String\",\n \"default\": \"\"\n },\n {\n \"name\": \"author\",\n \"type\": \"String\",\n \"default\": \"\"\n },\n {\n \"name\": \"published\",\n \"type\": \"DateTime\",\n \"default\": null\n },\n {\n \"name\": \"price\",\n \"type\": \"Float\",\n \"default\": 10.0\n },\n {\n \"name\": \"read\",\n \"type\": \"Bool\",\n \"default\": false\n }\n ]\n }\n\n\nGenerated python sample\n~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: python\n\n # -*- coding: utf-8 -*-\n from google.appengine.ext import ndb\n\n __all__ = [\"Book\", \"BookModel\", \"BookProperty\", \"LocalBookProperty\"]\n\n\n class Book(object):\n def __init__(self, title=\"\", author=\"\", published=None, price=10.0, read=False):\n self._title = title\n self._author = author\n self._published = published\n self._price = price\n self._read = read\n\n @property\n def title(self):\n return self._title\n\n @property\n def author(self):\n return self._author\n\n @property\n def published(self):\n return self._published\n\n @property\n def price(self):\n return self._price\n\n @property\n def read(self):\n return self._read\n\n def _prepare_for_put(self):\n pass\n\n def _has_repeated(self):\n pass\n\n def _to_dict(self):\n pass\n\n\n class BookModel(ndb.Model):\n title = ndb.StringProperty(default=\"\")\n author = ndb.StringProperty(default=\"\")\n published = ndb.DateTimeProperty()\n price = ndb.FloatProperty(default=10.0)\n read = ndb.BooleanProperty(default=False)\n\n\n class BookProperty(ndb.StructuredProperty):\n def __init__(self, **kwds):\n super(BookProperty, self).__init__(BookModel, **kwds)\n\n def _validate(self, value):\n assert isinstance(value, Book)\n\n def _to_base_type(self, value):\n return BookModel(\n title=value.title,\n author=value.author,\n published=value.published,\n price=value.price,\n read=value.read,\n )\n\n def _from_base_type(self, value):\n return Book(\n title=value.title,\n author=value.author,\n published=value.published,\n price=value.price,\n read=value.read,\n )\n\n\n class LocalBookProperty(ndb.StructuredProperty):\n def __init__(self, **kwds):\n super(LocalBookProperty, self).__init__(BookModel, **kwds)\n\n def _validate(self, value):\n assert isinstance(value, Book)\n\n def _to_base_type(self, value):\n return BookModel(\n title=value.title,\n author=value.author,\n published=value.published,\n price=value.price,\n read=value.read,\n )\n\n def _from_base_type(self, value):\n return Book(\n title=value.title,\n author=value.author,\n published=value.published,\n price=value.price,\n read=value.read,\n )\n\n\nPlease see the `example `_ directory for more examples.\n\nUsage\n-----\n\n1. Install ndb_prop_gen via pip\n\n.. code-block:: bash\n\n pip install ndb_prop_gen\n\n\n2. Call generate method\n\n\n* via command line\n\n\n.. code-block:: bash\n\n ndb_prop_gen test.json\n\n\n\n* via python code\n\n\n.. code-block:: python\n\n import ndb_prop_gen as npg # noqa\n\n # filename is the json's filename\n npg.generate(filename)\n\n\n\nLICENSE\n-------\nMIT\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/taxpon/ndb_prop_gen", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "ndb_prop_gen", "package_url": "https://pypi.org/project/ndb_prop_gen/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ndb_prop_gen/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/taxpon/ndb_prop_gen" }, "release_url": "https://pypi.org/project/ndb_prop_gen/0.0.4/", "requires_dist": null, "requires_python": null, "summary": "Google Appengine ndb Property Generator written in python. You can convert json data into your custom ndb property by this library.", "version": "0.0.4" }, "last_serial": 1925293, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "30a049c41a491a6989f56375ac320f6c", "sha256": "d87afd47f74fa3551646a931504142c476044efafcb3228f68e1e5ea5ffc4e2c" }, "downloads": -1, "filename": "ndb_prop_gen-0.0.1.tar.gz", "has_sig": false, "md5_digest": "30a049c41a491a6989f56375ac320f6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4122, "upload_time": "2016-01-25T02:52:50", "url": "https://files.pythonhosted.org/packages/8d/e6/4602d4c0073c33ba729054b46391c55eddade120a8073a3f1fa6da947220/ndb_prop_gen-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "c710f6485c08d074398300f493df49b6", "sha256": "fef0362facd2376485cd0aa43f727cd030e62c54d217bdd8a9ce671e25b9c272" }, "downloads": -1, "filename": "ndb_prop_gen-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c710f6485c08d074398300f493df49b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4106, "upload_time": "2016-01-25T02:55:27", "url": "https://files.pythonhosted.org/packages/06/64/45c3eb0ec78cdab5ea38aac38d7364235332811b82c19eca851a73e469fa/ndb_prop_gen-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "fcd1337313ee6a4982d6dae1b0fb5414", "sha256": "78420d47a583726178eb26714c37eba5d4849d38a62a141fcd70b667595ce942" }, "downloads": -1, "filename": "ndb_prop_gen-0.0.3.tar.gz", "has_sig": false, "md5_digest": "fcd1337313ee6a4982d6dae1b0fb5414", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4144, "upload_time": "2016-01-25T04:15:54", "url": "https://files.pythonhosted.org/packages/03/7e/b04d3ddfe96f0e94f6215950d1b418911e4823b35ff7f4b858d4d8e37f22/ndb_prop_gen-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "2be8f14cc9ffac2970dcbdc12d45f8c9", "sha256": "a5657347bb296c059d977fe45df54bc3ebf3486b5a135b85255e02196407e68b" }, "downloads": -1, "filename": "ndb_prop_gen-0.0.4.tar.gz", "has_sig": false, "md5_digest": "2be8f14cc9ffac2970dcbdc12d45f8c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4163, "upload_time": "2016-01-27T11:09:47", "url": "https://files.pythonhosted.org/packages/bf/8a/fb05cc1feb7d9d7b6bbf46fe2c00f72b4f1e5980ea8df109b5e93f986170/ndb_prop_gen-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2be8f14cc9ffac2970dcbdc12d45f8c9", "sha256": "a5657347bb296c059d977fe45df54bc3ebf3486b5a135b85255e02196407e68b" }, "downloads": -1, "filename": "ndb_prop_gen-0.0.4.tar.gz", "has_sig": false, "md5_digest": "2be8f14cc9ffac2970dcbdc12d45f8c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4163, "upload_time": "2016-01-27T11:09:47", "url": "https://files.pythonhosted.org/packages/bf/8a/fb05cc1feb7d9d7b6bbf46fe2c00f72b4f1e5980ea8df109b5e93f986170/ndb_prop_gen-0.0.4.tar.gz" } ] }