{ "info": { "author": "Chris Vickery", "author_email": "chrisinajar@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "crispum\n=======\n\nCross-language declarative parsing pipeline.\n\nInstallation\n------------\n\n| Node: ``npm i crispum --save``\n| Python: ``pip install crispum``, or if you're clever\n ``pipenv install crispum``\n\nUsage\n-----\n\nCrispum is designed to take in static JSON schema objects and return\nback a parser function which will apply all of the transformations\nlisted in the schema object.\n\nHere is an example of a simple\n`obstruction `__ example.\n\n.. code:: json\n\n {\n \"type\": \"simple\",\n \"keys\": {\n \"indeed\": \"awesome\"\n }\n }\n\nThis schema would transform the following object...\n\n.. code:: json\n\n {\n \"awesome\": \"it works!\"\n }\n\ninto\n\n.. code:: json\n\n {\n \"indeed\": \"it works!\"\n }\n\nThe schema may also be an array of instructions, and can apply\ninstructions to to the whole object or to each element of an array.\n\n.. code:: json\n\n [{\n \"type\": \"pluck\",\n \"key\": \"indeed\"\n }, {\n \"type\": \"array\"\n }, {\n \"type\": \"conditional\",\n \"key\": \"foo\",\n \"default\": {\n \"type\": \"filter\"\n },\n \"options\": {\n \"bar\": {\n \"type\": \"pluck\",\n \"key\": \"nested\"\n },\n \"baz\": {\n \"type\": \"pluck\",\n \"key\": \"special\"\n }\n }\n }, {\n \"type\": \"dearray\"\n }, {\n \"type\": \"simple\",\n \"keys\": {\n \"result\": \"0\",\n \"extra\": \"1\"\n }\n }]\n\nThis results in a complex multistep schema, which when appled to data\nlike this...\n\n.. code:: json\n\n {\n \"extra\": \"oh hey\",\n \"indeed\": [{\n \"foo\": \"bar\",\n \"nested\": \"value\"\n }, {\n \"foo\": \"boozle\",\n \"nested\": \"lost in space\"\n }, {\n \"foo\": \"baz\",\n \"nested\": \"value\",\n \"special\": \"so bazzy\"\n }]\n }\n\nresults in...\n\n.. code:: json\n\n {\n \"result\": \"value\",\n \"extra\": \"so bazzy\"\n }\n\nAPI\n===\n\n``crispum(schema)`` -> ``function (data)``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nCreate a new crispum parser with the options passed. The returned parse\nmethod takes one parameter, which is input data, and returns the\ntransformed data.\n\nschema\n~~~~~~\n\n| *Required*\n| Type: ``object`` or ``array``\n\nThe schema may either be a single instruction or an array of them. Each\ninstruction must have a ``type``, and may optionally contain an\n``array`` field.\n\nWhen ``array`` is true, the current data will be reinterpreted as an\narray and each instruction will execute on the entries instead of the\nlist itself.\n\nAvailable types are...\n\narray\n^^^^^\n\nThe array instruction tells the crispum pipeline to run all subsequent\ninstructions as if they had ``array: true`` set. It also can take in an\noptional parameters, ``keys``\n\n``keys`` is a list of keys to copy from the data into each element of\nthe array before continuing on the pipeline\n\nconditional\n^^^^^^^^^^^\n\nThe conditional instruction looks at the value of a specified key and\nthen executes a different instruction based on the value found.\n\n- ``key``: They keyname to check the conditional against\n- ``default``: The default instruction if the value found is not in the\n options list\n- ``options``: An associative array of instruction options\n\ndearray\n^^^^^^^\n\nStops an array pipeline and goes back to interpreting the data as a\nwhole instead of each element.\n\nfilter\n^^^^^^\n\nThis instruction deletes the current data and does ont take any\nparameters. This is useful in combination with ``array`` and\n``conditional``\n\nsimple\n^^^^^^\n\nSimple onyl takes 1 other parameter, which is ``keys``. Keys should be a\nvalid `obstruction\nschema `__.\nThe result is the same as the output obstruction would generate, except\nextra keys not mentioned in the schema are not removed.\n\npluck\n^^^^^\n\nThe pluck instruction takes a given key and rebases the dataset onto it.\nIt takes in two parameters \\* ``key``: The keyname to grab and rebase\nthe current dataset onto \\* ``keys``: An array of extra keys to copy\nfrom the parent object into the plucked value\n\nLicense\n=======\n\nMIT\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/chrisinajar/crispum", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "crispum", "package_url": "https://pypi.org/project/crispum/", "platform": "", "project_url": "https://pypi.org/project/crispum/", "project_urls": { "Homepage": "https://github.com/chrisinajar/crispum" }, "release_url": "https://pypi.org/project/crispum/0.2.0/", "requires_dist": [ "dot-prop (>=0.2.0)", "obstruction (>=0.1.1)", "six (>=1.10)" ], "requires_python": "", "summary": "Declarative JSON data parsing pipeline", "version": "0.2.0" }, "last_serial": 2986309, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "c65ae178cb6bb64e7de7a8e1c67e6763", "sha256": "291efbfa26470b01e8b940b0f28ba19db48f3dfb9e111a77e3b11d0ce4f15498" }, "downloads": -1, "filename": "crispum-0.2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "c65ae178cb6bb64e7de7a8e1c67e6763", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7663, "upload_time": "2017-06-28T23:58:35", "url": "https://files.pythonhosted.org/packages/01/e7/b3a99229fbfe2d1a86df2fd965b8b19bb601169f74b9922c147f48fce926/crispum-0.2.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7dc3d8ca09e7cefa74f950a1c4e1ac46", "sha256": "37669caf71bb28de627d10c7495c3ee87fa8c27e9f7bc42736e5826e21d044d0" }, "downloads": -1, "filename": "crispum-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7dc3d8ca09e7cefa74f950a1c4e1ac46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7662, "upload_time": "2017-06-28T23:58:32", "url": "https://files.pythonhosted.org/packages/62/ad/cd321ae4f31ab6624fcebcf9ae74e2c627c6d6a2dea3d708f36f5f54f41d/crispum-0.2.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c65ae178cb6bb64e7de7a8e1c67e6763", "sha256": "291efbfa26470b01e8b940b0f28ba19db48f3dfb9e111a77e3b11d0ce4f15498" }, "downloads": -1, "filename": "crispum-0.2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "c65ae178cb6bb64e7de7a8e1c67e6763", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7663, "upload_time": "2017-06-28T23:58:35", "url": "https://files.pythonhosted.org/packages/01/e7/b3a99229fbfe2d1a86df2fd965b8b19bb601169f74b9922c147f48fce926/crispum-0.2.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7dc3d8ca09e7cefa74f950a1c4e1ac46", "sha256": "37669caf71bb28de627d10c7495c3ee87fa8c27e9f7bc42736e5826e21d044d0" }, "downloads": -1, "filename": "crispum-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7dc3d8ca09e7cefa74f950a1c4e1ac46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7662, "upload_time": "2017-06-28T23:58:32", "url": "https://files.pythonhosted.org/packages/62/ad/cd321ae4f31ab6624fcebcf9ae74e2c627c6d6a2dea3d708f36f5f54f41d/crispum-0.2.0-py3-none-any.whl" } ] }