{ "info": { "author": "Devhouse Spindle", "author_email": "opensource@wearespindle.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7" ], "description": "Swamper\n=======\n\n|Build Status|\n\nSwamper is here for you to simplify cleaning input data and building\npython objects from this data.\n\nStatus\n------\n\nCurrently actively used and watched.\n\nUsage\n-----\n\nRequirements\n~~~~~~~~~~~~\n\n- python 2.7\n- python 3.3\n- python 3.4\n- python 3.5\n\nInstallation\n~~~~~~~~~~~~\n\nInstallation can be done from github or PyPI.\n\nRunning\n~~~~~~~\n\n``models.py``\n\n.. code:: python\n\n\n # Pretend this is some model.\n class Company(object):\n # name = fields.Str(ascii_only=True)\n # github_address = fields.Str()\n\n def __init__(self, **kwargs):\n self.__dict__ = kwargs\n\n``validate.py``\n\n.. code:: python\n\n import unicodedata\n\n from swamper.base import BaseSwamper\n\n\n class CompanySwamper(BaseSwamper):\n fields = [\n 'name',\n 'github_address',\n ]\n\n def __init__(self, data):\n super(CompanySwamper, self).__init__(self.fields, data)\n\n def clean_name(self, name, is_blank):\n if is_blank or len(name.strip()) == 0:\n raise ValueError('Field \"name\" is required.')\n\n # Keep only ascii characters.\n return unicodedata.normalize('NFKD', name).encode('ascii', 'ignore')\n\n def clean_github_address(self, address, is_blank):\n if is_blank or len(address.strip()) == 0:\n raise ValueError('Field \"github_address\" cannot be empty.')\n\n return 'https://github.com/%s' % address\n\n``app.py``\n\n.. code:: python\n\n\n from .models import Company\n from .validate import CompanySwamper\n\n\n data = {\n 'name': u'Devhouse Spindl\\xe9',\n 'github_address': 'wearespindle',\n }\n swamper = CompanySwamper(data)\n assert swamper.is_clean()\n company = swamper.build_or_update(Company, ['name', 'github_address'])\n\n assert company.name == 'Devhouse Spindle'\n assert company.github_address == 'https://github.com/wearespindle'\n\nContributing\n------------\n\nSee the `CONTRIBUTING.md `__ file on how to contribute\nto this project.\n\nContributors\n------------\n\nSee the `CONTRIBUTORS.md `__ file for a list of\ncontributors to the project.\n\nRoadmap\n-------\n\nChangelog\n~~~~~~~~~\n\nThe changelog can be found in the `CHANGELOG.md `__ file.\n\nIn progress\n~~~~~~~~~~~\n\n- Nothing at the moment\n\nFuture\n~~~~~~\n\n- Nothing planned at the moment\n\nGet in touch with a developer\n-----------------------------\n\nIf you want to report an issue see the\n`CONTRIBUTING.md `__ file for more info.\n\nWe will be happy to answer your other questions at\nopensource@wearespindle.com\n\n.. |Build Status| image:: https://travis-ci.org/wearespindle/swamper.svg?branch=master\n :target: https://travis-ci.org/wearespindle/swamper", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wearespindle/swamper", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "swamper", "package_url": "https://pypi.org/project/swamper/", "platform": "", "project_url": "https://pypi.org/project/swamper/", "project_urls": { "Homepage": "https://github.com/wearespindle/swamper" }, "release_url": "https://pypi.org/project/swamper/0.1/", "requires_dist": null, "requires_python": "", "summary": "Swamper is a simple interface to clean input data and turn this data into objects.", "version": "0.1" }, "last_serial": 3129237, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "1511584980f6c3821462dcda0cbf1115", "sha256": "19f594936d10e53a2a9b81d533695a0816f93c026375b56e383baf225e43d481" }, "downloads": -1, "filename": "swamper-0.1.tar.gz", "has_sig": false, "md5_digest": "1511584980f6c3821462dcda0cbf1115", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5115, "upload_time": "2017-08-28T14:54:43", "url": "https://files.pythonhosted.org/packages/c9/15/6f386ad995faeed6b0e5d2bc03da0b44546d03f0f708992f7c469b08a7fd/swamper-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1511584980f6c3821462dcda0cbf1115", "sha256": "19f594936d10e53a2a9b81d533695a0816f93c026375b56e383baf225e43d481" }, "downloads": -1, "filename": "swamper-0.1.tar.gz", "has_sig": false, "md5_digest": "1511584980f6c3821462dcda0cbf1115", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5115, "upload_time": "2017-08-28T14:54:43", "url": "https://files.pythonhosted.org/packages/c9/15/6f386ad995faeed6b0e5d2bc03da0b44546d03f0f708992f7c469b08a7fd/swamper-0.1.tar.gz" } ] }