{ "info": { "author": "Simon Repp", "author_email": "simon@fdpl.io", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "# enotype\n\n**A cross-language type library**\n\n```python\nfrom enotype import color\n\ncolor('#fff') # returns \"#fff\"\ncolor('#xyz') # raises ValueError(\"A color is required, for instance '#B6D918', '#fff' or '#01b'.\")\n```\n\n```python\nfrom enotype.es import color # with localized error messages\n\ncolor('#xyz') # raises ValueError(\"Se requiere un color, por ejemplo '#B6D918', '#fff' o '#01b'.\")\n```\n\n## Installation\n\n```\npip install enotype\n```\n\n## Features\n\n- Validation and conversion of `string` representations into language-native types.\n- Implemented as a collection of minimalist functions, so called *loaders*.\n- Zero-cost localization (currently `de`, `en`, `es`) through statically generated code.\n- Generically usable in a multitude of contexts through a plain and simple design.\n- Standard type library for the [eno notation language](https://eno-lang.org).\n\n## Documentation\n\n### boolean\n\n```python\nimport boolean from enotype\n\nboolean('true') # returns True\n```\n\n`'true'` returns `True`. \n`'false'` returns `False`. \n`'yes'` returns `True`. \n`'no'` returns `False`. \n`'nope'` raises an exception.\n### color\n\n```python\nimport color from enotype\n\ncolor('#abcdef') # returns '#abcdef'\n```\n\n`'#abcdef'` returns `'#abcdef'`. \n`'#ABCDEF'` returns `'#ABCDEF'`. \n`'#012345'` returns `'#012345'`. \n`'#678'` returns `'#678'`. \n`'#89a'` returns `'#89a'`. \n`'#ab'` raises an exception. \n`'#abcd'` raises an exception. \n`'#abcde'` raises an exception. \n`'#bcdefg'` raises an exception. \n`'blue'` raises an exception.\n### comma_separated\n\n```python\nimport comma_separated from enotype\n\ncomma_separated('one,two,three') # returns ['one', 'two', 'three']\n```\n\n`'one,two,three'` returns `['one', 'two', 'three']`. \n`' one,two,three '` returns `['one', 'two', 'three']`. \n`'one , two , three'` returns `['one', 'two', 'three']`. \n`' one , two , three '` returns `['one', 'two', 'three']`. \n`',,'` returns `['', '', '']`. \n`'one two three'` returns `['one two three']`. \n`'one;two;three'` returns `['one;two;three']`. \n`' '` returns `['']`.\n### date\n\n```python\nimport date from enotype\n\ndate('1992-02-02') # returns python_date(1992, 2, 2)\n```\n\n`'1992-02-02'` returns `python_date(1992, 2, 2)`. \n`'1990'` raises an exception. \n`'1991-01'` raises an exception. \n`'1993-03-03T1920+01:00'` raises an exception. \n`'1994-04-04T1920:30+01:00'` raises an exception. \n`'1995-05-05T1920:30.45+01:00'` raises an exception. \n`'1996-06-06T0815:30-05:00'` raises an exception. \n`'1997-07-07T1315:30Z'` raises an exception. \n`'2002 12 14'` raises an exception. \n`'2002-12-14 20:15'` raises an exception. \n`'January'` raises an exception. \n`'13:00'` raises an exception.\n### datetime\n\n```python\nimport datetime from enotype\n\ndatetime('1990') # returns python_datetime.strptime('1990-01-01T00:00:00.000+0000', '%Y-%m-%dT%H:%M:%S.%f%z')\n```\n\n`'1990'` returns `python_datetime.strptime('1990-01-01T00:00:00.000+0000', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'1991-01'` returns `python_datetime.strptime('1991-01-01T00:00:00.000+0000', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'1992-02-02'` returns `python_datetime.strptime('1992-02-02T00:00:00.000+0000', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'1993-03-03T19:20+01:00'` returns `python_datetime.strptime('1993-03-03T18:20:00.000+0000', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'1994-04-04T19:20:30+01:00'` returns `python_datetime.strptime('1994-04-04T18:20:30.000+0000', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'1995-05-05T19:20:30.45+01:00'` returns `python_datetime.strptime('1995-05-05T18:20:30.450+0000', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'1996-06-06T08:15:30-05:00'` returns `python_datetime.strptime('1996-06-06T08:15:30.000-0500', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'1997-07-07T13:15:30Z'` returns `python_datetime.strptime('1997-07-07T13:15:30.000+0000', '%Y-%m-%dT%H:%M:%S.%f%z')`. \n`'2002 12 14'` raises an exception. \n`'2002-12-14 20:15'` raises an exception. \n`'January'` raises an exception. \n`'13:00'` raises an exception.\n### email\n\n```python\nimport email from enotype\n\nemail('john.doe@eno-lang.org') # returns 'john.doe@eno-lang.org'\n```\n\n`'john.doe@eno-lang.org'` returns `'john.doe@eno-lang.org'`. \n`'john.doe@eno-lang'` raises an exception. \n`'@eno-lang.org'` raises an exception. \n`'john.doe@.org'` raises an exception.\n### float\n\n```python\nimport float from enotype\n\nfloat('42') # returns 42.0\n```\n\n`'42'` returns `42.0`. \n`'-42'` returns `-42.0`. \n`'42.0'` returns `42.0`. \n`'42,0'` raises an exception. \n`'4 2.0'` raises an exception. \n`'fortytwo'` raises an exception.\n### integer\n\n```python\nimport integer from enotype\n\ninteger('42') # returns 42\n```\n\n`'42'` returns `42`. \n`'-42'` returns `-42`. \n`'42.0'` raises an exception. \n`'42,0'` raises an exception. \n`'4 2'` raises an exception. \n`'fortytwo'` raises an exception.\n### ipv4\n\n```python\nimport ipv4 from enotype\n\nipv4('0.0.0.0') # returns '0.0.0.0'\n```\n\n`'0.0.0.0'` returns `'0.0.0.0'`. \n`'255.255.255.255'` returns `'255.255.255.255'`. \n`'192.168.0.1'` returns `'192.168.0.1'`. \n`'10.10.10.10'` returns `'10.10.10.10'`. \n`'255.255.255.256'` raises an exception. \n`'localhost'` raises an exception. \n`'4.staging.production.lan'` raises an exception.\n### json\n\n```python\nimport json from enotype\n\njson('{ \"valid\": true }') # returns { 'valid': True }\n```\n\n`'{ \"valid\": true }'` returns `{ 'valid': True }`. \n`'42'` returns `42`. \n`'[\"valid\", true]'` returns `['valid', True]`. \n`'invalid'` raises an exception. \n`'{ invalid: true }'` raises an exception. \n`'{ \"invalid\": true, }'` raises an exception.\n### lat_lng\n\n```python\nimport lat_lng from enotype\n\nlat_lng('48.205870, 16.413690') # returns { 'lat': 48.205870, 'lng': 16.413690 }\n```\n\n`'48.205870, 16.413690'` returns `{ 'lat': 48.205870, 'lng': 16.413690 }`. \n`'41.25, -120.9762'` returns `{ 'lat': 41.25, 'lng': -120.9762 }`. \n`'-31.96, 115.84'` returns `{ 'lat': -31.96, 'lng': 115.84 }`. \n`'90, 0'` returns `{ 'lat': 90, 'lng': 0 }`. \n`' 0 , 0 '` returns `{ 'lat': 0, 'lng': 0 }`. \n`'-0,-0'` returns `{ 'lat': -0, 'lng': -0 }`. \n`'1000,10'` raises an exception. \n`'10,1000'` raises an exception. \n`'48.205870,'` raises an exception. \n`', 16.413690'` raises an exception. \n`'48,205870, 16,413690'` raises an exception.\n### slug\n\n```python\nimport slug from enotype\n\nslug('eno-lang-article') # returns 'eno-lang-article'\n```\n\n`'eno-lang-article'` returns `'eno-lang-article'`. \n`'eno_lang_article'` returns `'eno_lang_article'`. \n`'eno-lang-article!'` raises an exception. \n`'%eno-lang-article'` raises an exception. \n`'eno lang article'` raises an exception. \n`'en\u00f6-l\u00e4ng-\u00e4rticle'` raises an exception. \n`'\u00e9n\u00f3-l\u00e1ng-\u00e1rt\u00edcl\u00e9'` raises an exception.\n### url\n\n```python\nimport url from enotype\n\nurl('http://www.valid.com') # returns 'http://www.valid.com'\n```\n\n`'http://www.valid.com'` returns `'http://www.valid.com'`. \n`'https://valid.com'` returns `'https://valid.com'`. \n`'https://www.valid.com'` returns `'https://www.valid.com'`. \n`'invalid'` raises an exception. \n`'www.invalid'` raises an exception. \n`'www.invalid.com'` raises an exception. \n`'htp://www.invalid.com'` raises an exception. \n`'http:/invalid.com'` raises an exception. \n`'https//invalid.com'` raises an exception. \n`'https://invalid'` raises an exception.\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://eno-lang.org/enotype/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "enotype", "package_url": "https://pypi.org/project/enotype/", "platform": "", "project_url": "https://pypi.org/project/enotype/", "project_urls": { "Homepage": "https://eno-lang.org/enotype/" }, "release_url": "https://pypi.org/project/enotype/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "A cross-language type library", "version": "0.3.0" }, "last_serial": 4972001, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5fa21207576203a3d14e795ac566cbcb", "sha256": "fd0964ffda7fd4a7fd18e786a6cb8e93431676daf32550b12a77d5b3b4307731" }, "downloads": -1, "filename": "enotype-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5fa21207576203a3d14e795ac566cbcb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6878, "upload_time": "2019-02-21T15:27:28", "url": "https://files.pythonhosted.org/packages/09/78/d11f1e47d155ff6573fdb14eb8f7c299fda8c89f8da83c63c3971e6a01e9/enotype-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e72b8912677ccea368dd17a62ebd62e4", "sha256": "d6f405870490986e5c60781a82d82f6c65266a10cb704cc78a6bb81c5bc0f8e8" }, "downloads": -1, "filename": "enotype-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e72b8912677ccea368dd17a62ebd62e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4015, "upload_time": "2019-02-21T15:27:30", "url": "https://files.pythonhosted.org/packages/48/39/a32850b1c0bf629053d699a88d06fff8f19f8bb4cf9524f614573703c7c2/enotype-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "6b4b1eabf082aa2772ca57de0997396b", "sha256": "4d055a4a3688e0e0408eda1018336c3cbce9d2d63de29d644f69d08d1aca3886" }, "downloads": -1, "filename": "enotype-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6b4b1eabf082aa2772ca57de0997396b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8511, "upload_time": "2019-03-20T11:37:16", "url": "https://files.pythonhosted.org/packages/62/9f/3e9a448c2c4611823fc709eb7e2ba445e4d45d8bd663cb79fc454a883063/enotype-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31665511014b21e11664b5fc16b9d4f7", "sha256": "114bc492c989d2c4d156debd6c1219e523343c0e8b065ea5015acc8b8f6fa370" }, "downloads": -1, "filename": "enotype-0.2.0.tar.gz", "has_sig": false, "md5_digest": "31665511014b21e11664b5fc16b9d4f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6132, "upload_time": "2019-03-20T11:37:17", "url": "https://files.pythonhosted.org/packages/f6/e4/c492064fffab6f99ca576e84cd58bfd93d1c3cd314b0a8ac05a5337b3642/enotype-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "498669cf10f73e9cc95c5a02e2eb6f08", "sha256": "fc383cfff975d271fe39827502bc3874612d12cca3869dc2e99b61e1783b9970" }, "downloads": -1, "filename": "enotype-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "498669cf10f73e9cc95c5a02e2eb6f08", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8871, "upload_time": "2019-03-22T09:10:13", "url": "https://files.pythonhosted.org/packages/4b/3a/388c5e2aff9454e3b66247aa8258c85d2cf691e069b01bcc88c1ad617f84/enotype-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "21044b932c2413a6e0f0e5673aa9a8aa", "sha256": "89c92ac0fae0a52aab4ff90a2fe4018fab4d72200bb145f772b83760ffd0bb4d" }, "downloads": -1, "filename": "enotype-0.3.0.tar.gz", "has_sig": false, "md5_digest": "21044b932c2413a6e0f0e5673aa9a8aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6364, "upload_time": "2019-03-22T09:10:15", "url": "https://files.pythonhosted.org/packages/1c/22/c80a7cc4e9563725bf210838327026e1356e87c22b07da57f336b27495d6/enotype-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "498669cf10f73e9cc95c5a02e2eb6f08", "sha256": "fc383cfff975d271fe39827502bc3874612d12cca3869dc2e99b61e1783b9970" }, "downloads": -1, "filename": "enotype-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "498669cf10f73e9cc95c5a02e2eb6f08", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8871, "upload_time": "2019-03-22T09:10:13", "url": "https://files.pythonhosted.org/packages/4b/3a/388c5e2aff9454e3b66247aa8258c85d2cf691e069b01bcc88c1ad617f84/enotype-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "21044b932c2413a6e0f0e5673aa9a8aa", "sha256": "89c92ac0fae0a52aab4ff90a2fe4018fab4d72200bb145f772b83760ffd0bb4d" }, "downloads": -1, "filename": "enotype-0.3.0.tar.gz", "has_sig": false, "md5_digest": "21044b932c2413a6e0f0e5673aa9a8aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6364, "upload_time": "2019-03-22T09:10:15", "url": "https://files.pythonhosted.org/packages/1c/22/c80a7cc4e9563725bf210838327026e1356e87c22b07da57f336b27495d6/enotype-0.3.0.tar.gz" } ] }