{ "info": { "author": "Allisson Azevedo", "author_email": "allisson@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries" ], "description": "Python Preparer\n===============\n\n|TravisCI Build Status| |Coverage Status| |Requirements Status|\n\n----\n\nSimple way to build a new dict based on fields declaration.\n\n\nHow to install\n--------------\n\n.. code:: shell\n\n pip install preparer\n\n\nHow to use\n----------\n\n.. code:: python\n\n from preparer import FieldsPreparer, SubPreparer, CollectionSubPreparer\n\n xfiles_game = {\n 'description': 'As an extension of one of the most long-running...',\n 'game_id': 1,\n 'genres': [\n {\n 'genre_category': 'Basic Genres',\n 'genre_category_id': 1,\n 'genre_id': 2,\n 'genre_name': 'Adventure'\n },\n {\n 'genre_category': 'Perspective',\n 'genre_category_id': 2,\n 'genre_id': 7,\n 'genre_name': '1st-person'\n },\n {\n 'genre_category': 'Narrative Theme/Topic',\n 'genre_category_id': 8,\n 'genre_id': 55,\n 'genre_name': 'Detective / Mystery'\n },\n {\n 'genre_category': 'Setting',\n 'genre_category_id': 10,\n 'genre_id': 8,\n 'genre_name': 'Sci-Fi / Futuristic'\n },\n {\n 'genre_category': 'Other Attributes',\n 'genre_category_id': 6,\n 'genre_id': 82,\n 'genre_name': 'Licensed Title'\n }\n ],\n 'moby_score': 3.8,\n 'moby_url': 'http://www.mobygames.com/game/x-files-game',\n 'num_votes': 53,\n 'official_url': None,\n 'platforms': [\n {\n 'first_release_date': '1998',\n 'platform_id': 3,\n 'platform_name': 'Windows'\n },\n {\n 'first_release_date': '1998-06',\n 'platform_id': 74,\n 'platform_name': 'Macintosh'\n },\n {\n 'first_release_date': '1999',\n 'platform_id': 6,\n 'platform_name': 'PlayStation'\n }\n ],\n 'sample_cover': {\n 'height': 927,\n 'image': 'http://www.mobygames.com/images/covers/l/3-the-x-files-game...',\n 'platforms': [\n 'Windows'\n ],\n 'thumbnail_image': 'http://www.mobygames.com/images/covers/s/3-the-x-files...',\n 'width': 800\n },\n 'sample_screenshots': [\n {\n 'caption': 'Mulder and Special Agent Willmore',\n 'height': 480,\n 'image': 'http://www.mobygames.com/images/shots/l/86087-the-x-files...',\n 'thumbnail_image': 'http://www.mobygames.com/images/shots/s/86087-the...',\n 'width': 640\n },\n {\n 'caption': 'Title screen (from intro)',\n 'height': 480,\n 'image': 'http://www.mobygames.com/images/shots/l/313897-the-x-files-game...',\n 'thumbnail_image': 'http://www.mobygames.com/images/shots/s/313897-the-x...',\n 'width': 640\n },\n {\n 'caption': 'Gillian Anderson (from intro)',\n 'height': 480,\n 'image': 'http://www.mobygames.com/images/shots/l/313919-the-x-files-game...',\n 'thumbnail_image': 'http://www.mobygames.com/images/shots/s/313919-the-x...',\n 'width': 640\n },\n {\n 'caption': 'David Duchovny (from intro)',\n 'height': 480,\n 'image': 'http://www.mobygames.com/images/shots/l/313908-the-x-files-game-windows...',\n 'thumbnail_image': 'http://www.mobygames.com/images/shots/s/313908-the-x-files...',\n 'width': 640\n }\n ],\n 'title': 'The X-Files Game'\n }\n\n preparer = FieldsPreparer(fields={\n 'id': 'game_id',\n 'title': 'title',\n 'description': 'description'\n })\n\n cover_preparer = FieldsPreparer(fields={\n 'image': 'image',\n 'thumbnail': 'thumbnail_image'\n })\n preparer_with_cover = FieldsPreparer(fields={\n 'id': 'game_id',\n 'title': 'title',\n 'description': 'description',\n 'cover': SubPreparer('sample_cover', cover_preparer)\n })\n\n screenshot_preparer = FieldsPreparer(fields={\n 'caption': 'caption',\n 'image': 'image',\n 'thumbnail': 'thumbnail_image'\n })\n preparer_with_cover_and_screenshots = FieldsPreparer(fields={\n 'id': 'game_id',\n 'title': 'title',\n 'description': 'description',\n 'cover': SubPreparer('sample_cover', cover_preparer),\n 'screenshots': CollectionSubPreparer('sample_screenshots', screenshot_preparer)\n })\n\n\n.. code:: python\n\n >>> import pprint\n >>> pp = pprint.PrettyPrinter(indent=4)\n >>> pp.pprint(preparer.prepare(xfiles_game))\n { 'description': 'As an extension of one of the most long-running...',\n 'id': 1,\n 'title': 'The X-Files Game'}\n >>> pp.pprint(preparer_with_cover.prepare(xfiles_game))\n { 'cover': { 'image': 'http://www.mobygames.com/images/covers/l/3-the-x-files-game...',\n 'thumbnail': 'http://www.mobygames.com/images/covers/s/3-the-x-files...'},\n 'description': 'As an extension of one of the most long-running...',\n 'id': 1,\n 'title': 'The X-Files Game'}\n >>> pp.pprint(preparer_with_cover_and_screenshots.prepare(xfiles_game))\n { 'cover': { 'image': 'http://www.mobygames.com/images/covers/l/3-the-x-files-game...',\n 'thumbnail': 'http://www.mobygames.com/images/covers/s/3-the-x-files...'},\n 'description': 'As an extension of one of the most long-running...',\n 'id': 1,\n 'screenshots': [ { 'caption': 'Mulder and Special Agent Willmore',\n 'image': 'http://www.mobygames.com/images/shots/l/86087-the-x-files...',\n 'thumbnail': 'http://www.mobygames.com/images/shots/s/86087-the...'},\n { 'caption': 'Title screen (from intro)',\n 'image': 'http://www.mobygames.com/images/shots/l/313897-the-x-files-game...',\n 'thumbnail': 'http://www.mobygames.com/images/shots/s/313897-the-x...'},\n { 'caption': 'Gillian Anderson (from intro)',\n 'image': 'http://www.mobygames.com/images/shots/l/313919-the-x-files-game...',\n 'thumbnail': 'http://www.mobygames.com/images/shots/s/313919-the-x...'},\n { 'caption': 'David Duchovny (from intro)',\n 'image': 'http://www.mobygames.com/images/shots/l/313908-the-x-files-game-windows...',\n 'thumbnail': 'http://www.mobygames.com/images/shots/s/313908-the-x-files...'}],\n 'title': 'The X-Files Game'}\n\nCheck `https://github.com/allisson/python-preparer/tree/master/examples `_ for more code examples.\n\n\nCredits\n-------\n\nThis is a fork of excellent https://github.com/toastdriven/restless/blob/master/restless/preparers.py\n\n\n.. |TravisCI Build Status| image:: https://travis-ci.org/allisson/python-preparer.svg?branch=master\n :target: https://travis-ci.org/allisson/python-preparer\n.. |Coverage Status| image:: https://codecov.io/gh/allisson/python-preparer/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/allisson/python-preparer\n.. |Requirements Status| image:: https://requires.io/github/allisson/python-preparer/requirements.svg?branch=master\n :target: https://requires.io/github/allisson/python-preparer/requirements/?branch=master\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/allisson/python-preparer", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "preparer", "package_url": "https://pypi.org/project/preparer/", "platform": "", "project_url": "https://pypi.org/project/preparer/", "project_urls": { "Homepage": "https://github.com/allisson/python-preparer" }, "release_url": "https://pypi.org/project/preparer/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Simple way to build a new dict based on fields declaration", "version": "0.1.0" }, "last_serial": 3442032, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b6049ca952da352e32185c6b718a5c46", "sha256": "267c986635fa2680c879d7b2d24a38734e9de78a834bf0753ce3461aef197de0" }, "downloads": -1, "filename": "preparer-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b6049ca952da352e32185c6b718a5c46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7407, "upload_time": "2017-12-25T14:22:18", "url": "https://files.pythonhosted.org/packages/50/da/6e2de926df761a81883dfdc301f5df37d40c73494b6c79403e818666bc59/preparer-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7e1df40e52f588fab081c456cb3f1e51", "sha256": "5202ab842a3e272625c17ad72d6d1541e2a9ddf77ab15b2dbc248a58e37d63e0" }, "downloads": -1, "filename": "preparer-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7e1df40e52f588fab081c456cb3f1e51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6458, "upload_time": "2017-12-25T14:22:19", "url": "https://files.pythonhosted.org/packages/1f/55/67e716793956976725aa9ea2459d78370aaaf8f8961fd1abba29bb5e754e/preparer-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b6049ca952da352e32185c6b718a5c46", "sha256": "267c986635fa2680c879d7b2d24a38734e9de78a834bf0753ce3461aef197de0" }, "downloads": -1, "filename": "preparer-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b6049ca952da352e32185c6b718a5c46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7407, "upload_time": "2017-12-25T14:22:18", "url": "https://files.pythonhosted.org/packages/50/da/6e2de926df761a81883dfdc301f5df37d40c73494b6c79403e818666bc59/preparer-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7e1df40e52f588fab081c456cb3f1e51", "sha256": "5202ab842a3e272625c17ad72d6d1541e2a9ddf77ab15b2dbc248a58e37d63e0" }, "downloads": -1, "filename": "preparer-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7e1df40e52f588fab081c456cb3f1e51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6458, "upload_time": "2017-12-25T14:22:19", "url": "https://files.pythonhosted.org/packages/1f/55/67e716793956976725aa9ea2459d78370aaaf8f8961fd1abba29bb5e754e/preparer-0.1.0.tar.gz" } ] }