{ "info": { "author": "pseudosky", "author_email": "grepthesky@gmail.com", "bugtrack_url": null, "classifiers": [ "Topic :: Software Development :: Libraries", "Topic :: Text Editors :: Text Processing", "Topic :: Text Processing", "Topic :: Utilities" ], "description": "# MorPhit\n\nUsage\n------------\n\n```python\n >>> from morphit import Parser\n >>> Parser([], '[1,2,3]')\n [1, 2, 3]\n```\n\n`pip install morphit`\n\n`sudo -H pip install morphit`\n\n\nmorphit is a no nonsense parser that takes a template for data and converts\nwhatever you feed it into whatever you want it to be.\n\nDo you have \"My data is fucked\"?\nIf you find yourself saying any of the following, you may to be entitled to financial compensation.\n\n- WTF half of these are strings instead of **insert type here**\n- How do I even convert from **insert type A** to **insert type B**\n- I have so much bad data I'm going to have to manually fix\n- I have hundreds of if conditions to fix weird data\n- How the hell am I supposed to fix the type of all these nested objects\n- You're telling me this float is supposed to be a date?...\n- You're telling me that I cant put a datetime object anywhere?\n- I don't know how any of these strings became numbers but...\n\n\nFeatures\n------------\n\n- datetime serialization\n```python\n\t>>> from datetime import date\n >>> Parser(str, datetime(2018, 1, 31, 6, 17, 45, 547000))\n \"2018-01-31T06:17:45.547\"\n```\n- deep serialization of dicts\n- supports custom serializers using methods/lambda functions\n- templated parsers\n- nested templated parsers\n\nSupported Conversions\n------------\n\n- any -> list\n- any -> object\n- any -> tuple\n- any -> type\n- any -> str\n- dict -> str[json]\n- dict -> dict\n- dict -> list\n- dict -> tuple\n- datetime -> str\n- datetime -> str[json]\n- datetime -> int\n- datetime -> float\n- datetime.time -> str\n- datetime.date -> str\n- float -> str\n- float -> float\n- float -> list\n- float -> tuple\n- float -> type\n- float -> datetime\n- int -> str\n- int -> int\n- int -> list\n- int -> tuple\n- int -> datetime\n- int -> type\n- list -> str[json]\n- list -> list\n- list -> tuple\n- tuple -> str[json[list]]\n- tuple -> list\n- tuple -> tuple\n- none -> str\n- none -> bool\n- none -> list\n- none -> tuple\n- str -> bool\n- str -> datetime\n- str -> dict\n- str -> float\n- str -> int\n- str -> list\n- str -> tuple\n- str -> type\n- str[iso8601] -> datetime\n- str[iso8601] -> float\n- str[unicode] -> any string conversions\n- str[python] -> any string conversions\n\n**iso8601** a date string formatted to the iso8601 spec\n**json** a json encoded equivilent of the data\n**unicode** strings that get messed up with u' ex: \"[u'this',u'that']\"\n**python** strings that are weirdly single quoted ex: \"['photo', 2, 'pic', 'pics']\"\n\nInstallation\n------------\n\nTest:\n\n`python setup.py test`\n\nBuild: `python3 setup.py build`\n\nInstall: `python3 setup.py install`\n\n\nDevelopment\n------------\n```sh\nvirtualenv --python=python3 venv\nsource ./venv/bin/activate\npython setup.py easy_install\npip install -r requirements-dev.txt\n```\n\n```\npython3 setup.py sdist bdist_wheel\ntwine upload dist/*\n```\n\nRoadmap\n------------\n\n- Custom exceptions for bad casting (int/list/tuple -> dict)\n- Add strict parameter that enables enforcement of keys and list/tuple length\n- Add default parameter that remplaces None or non existing values with a specified default\n- Add fallback parameter that accepts a value or a lambda function to replace the value\n\nBUGS\n-----------\n\nShould output float\n```python\n>>> Parser({'asdf':[1.0]}, {'asdf':1000})\n{'asdf': [1000]}\n```\n\n\nContributing\n------------\n\nRead CONTRIBUTING\\_.\n\nMake a PR and I'll give it a look\n\nOdds are good / the goods are odd\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/PseudoSky/morphit", "keywords": "serialize data schema transform parse parser parsing", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "morphit", "package_url": "https://pypi.org/project/morphit/", "platform": "", "project_url": "https://pypi.org/project/morphit/", "project_urls": { "Homepage": "https://github.com/PseudoSky/morphit" }, "release_url": "https://pypi.org/project/morphit/1.0.2/", "requires_dist": [ "multipledispatch (>=0.4.9)", "iso8601 (>=0.1.12)" ], "requires_python": "", "summary": "makes shitty data more fit (a smarter serializer)", "version": "1.0.2" }, "last_serial": 4475153, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "387506c23c51fc499933df306cf92dc4", "sha256": "02d72df50045fba9eff32ff7eb5d6f8b73f880d92d04f14b386db02b1c6e689e" }, "downloads": -1, "filename": "morphit-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "387506c23c51fc499933df306cf92dc4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4569, "upload_time": "2018-09-28T08:31:34", "url": "https://files.pythonhosted.org/packages/a7/36/e0326826195a690f2dc5942592d7633475e8f32e11b869b60421d8ea09b9/morphit-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "46cdab4e9de445f99d1ff754760a3ebd", "sha256": "a658ba84338588bf117d6d234d1097b8e930b7dc2fd723f65673533b19e86541" }, "downloads": -1, "filename": "morphit-1.0.1.tar.gz", "has_sig": false, "md5_digest": "46cdab4e9de445f99d1ff754760a3ebd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4985, "upload_time": "2018-09-28T08:31:35", "url": "https://files.pythonhosted.org/packages/14/81/f2a5b413dc6864d0914a5c11d03ccfd266c6543020192d452cf55f64589e/morphit-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "dab315cd066a653ae510023ae9a488a7", "sha256": "2923096d6d41eec56163c6f88803d39ce8ae3f6a5310a1d4c1937e69ccdb638e" }, "downloads": -1, "filename": "morphit-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "dab315cd066a653ae510023ae9a488a7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4755, "upload_time": "2018-11-11T21:26:11", "url": "https://files.pythonhosted.org/packages/55/66/7caa19f8bd476c5392073b8ca5dec8d5df97ad26c054b639f029050017c5/morphit-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a0ed8f26f04d5d1fadce2053733a098", "sha256": "924b393d5da09a589123082a6e7433e7cee6d34fd5cef01cbbae1b7a2de858b7" }, "downloads": -1, "filename": "morphit-1.0.2.tar.gz", "has_sig": false, "md5_digest": "3a0ed8f26f04d5d1fadce2053733a098", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5168, "upload_time": "2018-11-11T21:26:12", "url": "https://files.pythonhosted.org/packages/c4/f7/4b1895239f84368393c85ba4a91c0b3e0a7b436dca4d930dd47b832df007/morphit-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dab315cd066a653ae510023ae9a488a7", "sha256": "2923096d6d41eec56163c6f88803d39ce8ae3f6a5310a1d4c1937e69ccdb638e" }, "downloads": -1, "filename": "morphit-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "dab315cd066a653ae510023ae9a488a7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4755, "upload_time": "2018-11-11T21:26:11", "url": "https://files.pythonhosted.org/packages/55/66/7caa19f8bd476c5392073b8ca5dec8d5df97ad26c054b639f029050017c5/morphit-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a0ed8f26f04d5d1fadce2053733a098", "sha256": "924b393d5da09a589123082a6e7433e7cee6d34fd5cef01cbbae1b7a2de858b7" }, "downloads": -1, "filename": "morphit-1.0.2.tar.gz", "has_sig": false, "md5_digest": "3a0ed8f26f04d5d1fadce2053733a098", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5168, "upload_time": "2018-11-11T21:26:12", "url": "https://files.pythonhosted.org/packages/c4/f7/4b1895239f84368393c85ba4a91c0b3e0a7b436dca4d930dd47b832df007/morphit-1.0.2.tar.gz" } ] }