{ "info": { "author": "Markus Ressel", "author_email": "mail@markusressel.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# py-range-parse [![Contributors](https://img.shields.io/github/contributors/markusressel/py-range-parse.svg)](https://github.com/markusressel/py-range-parse/graphs/contributors) [![MIT License](https://img.shields.io/github/license/markusressel/py-range-parse.svg)](/LICENSE) ![Code Size](https://img.shields.io/github/languages/code-size/markusressel/py-range-parse.svg) ![https://badge.fury.io/py/py-range-parse](https://badge.fury.io/py/py-range-parse.svg) [![Build Status](https://travis-ci.org/markusressel/py-range-parse.svg?branch=master)](https://travis-ci.org/markusressel/py-range-parse)\n\n**py-range-parse** is a library to parse commonly used range \nnotations to python objects that act like sets.\n\n**py-range-parse is used by**\n* [container-app-conf](https://github.com/markusressel/container-app-conf)\n\nand hopefully many others :)\n\n# How to use\n\n```shell\npip install py-range-parse\n```\n\n```python\nfrom py_range_parse import parse_range\n\nrange = parse_range(\"[0..5]\")\n```\n\nor create on manually:\n\n```python\nfrom py_range_parse import Range\nrange = Range(0,5)\n```\n\n## Input formats\n\nWhen parsing a `Range` from a `str` any whitespace is ignored.\n\n### `int` ranges\n\nIf both the _start_ and _end_ value are of type `int`, the resulting `Range` will only consider integers as part of it. If you want to include `float` values as well, at least one of the values has to be a `float`.\n\n* `[-2 .. 5]`\n* `[10 .. 1]`\n\nIf the _end_ value is bigger than the _start_ value the resulting range will automatically be inverted. Therefore `range.start <= range.end` is **always** `True` in a `Range`.\n\n\n### `float` ranges\n\nA `float` `Range` includes every possible `float` value between the _start_ and _end_ value.\n\n* `[-2.2 .. 5.123]`\n* `[-2.0 .. 5]`\n\n### Infinity\n\nInfinity can also be specified using both `inf` as well as the unicode symbol `\u221e`. Since it is internally represented using `math.inf` it will behave like a `float`.\n\n* `]-inf .. inf[`\n* `]-\u221e .. \u221e[`\n\n### Exclude borders\n\nThe _start_ and _end_ values can be excluded from the `Range` independent of one another using the open bracket notation.\n\n* `]0 .. 5.5]`\n* `]0 .. inf[`\n\n## Operations\n\n### Contains\n\nYou can easily check if a value is within a given `Range` like this:\n\n```python\n> from py_range_parse import parse_range\n> range = parse_range(\"[0 .. 5]\")\n> print(4 in range)\nTrue\n```\n\n### Comparison\n\nYou can compare equality of two `Range` instances using the `==` operator.\nFor two ranges to be equal they have to have the same \n* `start` value\n* `end` value\n* start inclusion\n* end inclusion\n* type (`int` or `float`)\n\n```python\n> from py_range_parse import parse_range\n> range1 = parse_range(\"[0 .. 5]\")\n> range2 = parse_range(\"[0 .. 5]\")\n> range3 = parse_range(\"[0 .. 5.0]\")\n> print(range1 == range2)\nTrue\n> print(range1 == range3)\nFalse\n```\n\n# Contributing\n\nGitHub is for social coding: if you want to write code, I encourage contributions through pull requests from forks\nof this repository. Create GitHub tickets for bugs and new features and comment on the ones that you are interested in.\n\n\n# License\n```text\npy-range-parse\nCopyright (c) 2019 Markus Ressel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\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/markusressel/py-range-parse", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "py-range-parse", "package_url": "https://pypi.org/project/py-range-parse/", "platform": "", "project_url": "https://pypi.org/project/py-range-parse/", "project_urls": { "Homepage": "https://github.com/markusressel/py-range-parse" }, "release_url": "https://pypi.org/project/py-range-parse/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "Parses commonly used range notations to python objects", "version": "1.0.5" }, "last_serial": 5853143, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "5b6ca6bd686cf61e04da8ab8ee2d6000", "sha256": "c82860fbca5179cdfc20f8b46fd40a03a7a0fac4177a1da60c6dcef235586d15" }, "downloads": -1, "filename": "py_range_parse-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5b6ca6bd686cf61e04da8ab8ee2d6000", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5801, "upload_time": "2019-09-12T22:21:26", "url": "https://files.pythonhosted.org/packages/9e/47/3edd008a59bd1473dc525f371ad9e5c3447c1b6570ca8a62942c1559430e/py_range_parse-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6fce96d62b49291d580e0620b164f76", "sha256": "363ab28e6b7d11b086031d105e6c03048c246a728a381ea079cd1ea340de8326" }, "downloads": -1, "filename": "py_range_parse-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e6fce96d62b49291d580e0620b164f76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4892, "upload_time": "2019-09-12T22:21:28", "url": "https://files.pythonhosted.org/packages/4d/35/695193f2c575d359b068a94d560c56226032e67f3b49a96abecc931c4b80/py_range_parse-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "75e61ebb18baf8d0be901e6aaae20037", "sha256": "e17a8c98f4257c26f15602e087749b4d57bc5166bd5fc548cf5829227a39a5c7" }, "downloads": -1, "filename": "py_range_parse-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "75e61ebb18baf8d0be901e6aaae20037", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5785, "upload_time": "2019-09-12T22:32:13", "url": "https://files.pythonhosted.org/packages/59/ab/cfec1faafdba9df26a9f537223c36a8cd7596ec775e10f086f00c3d2d3df/py_range_parse-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c1a45b486b5e91fc7acb35eaa0724810", "sha256": "e03a0f5a14ec134789c7037ede8164ebc27a244017178c3834e0f592fb2872d8" }, "downloads": -1, "filename": "py_range_parse-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c1a45b486b5e91fc7acb35eaa0724810", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4887, "upload_time": "2019-09-12T22:32:15", "url": "https://files.pythonhosted.org/packages/55/66/b91b2f7eeb793ab277801ee9ab1e05f4a8e0b06ffab5d42561dc4d26fbeb/py_range_parse-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "26593af08e3271a8a6f925c20aaac098", "sha256": "574f9775fe67ae17e1607e214c729c29850383645d476f59f4c6536670212f2b" }, "downloads": -1, "filename": "py_range_parse-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "26593af08e3271a8a6f925c20aaac098", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5809, "upload_time": "2019-09-12T22:43:03", "url": "https://files.pythonhosted.org/packages/95/c2/145fcf2522f0a84fa1a9b75b62b8bfda8464a263765d6470ed206bdee419/py_range_parse-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "65837bf03b4a75639a2fd642deef2f05", "sha256": "5b3b4510fab986153475e1da7cd47c7ed2299adb5f8d62c5018f0595c2ffc455" }, "downloads": -1, "filename": "py_range_parse-1.0.2.tar.gz", "has_sig": false, "md5_digest": "65837bf03b4a75639a2fd642deef2f05", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4912, "upload_time": "2019-09-12T22:43:04", "url": "https://files.pythonhosted.org/packages/fd/17/8d33693d6cd3310927159cc7cc1f717f6c768067703dd81efbfb99347787/py_range_parse-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "b5fa330164ad0452728a7c5de0b93079", "sha256": "e24f47ad8725b239465c851a30118dbdc9283ba17db60ed6329fed0811cb47bd" }, "downloads": -1, "filename": "py_range_parse-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "b5fa330164ad0452728a7c5de0b93079", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5875, "upload_time": "2019-09-12T22:49:36", "url": "https://files.pythonhosted.org/packages/07/1f/bb35433f9ff50418f41447c26be483eea29e1ef49ee83f2ed62335e42579/py_range_parse-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "66cae752f902f0662e91ce1af6e602b9", "sha256": "503b3dc73522e69fed4930b175bbed3e641cc6280718a34f65e8c60303025820" }, "downloads": -1, "filename": "py_range_parse-1.0.3.tar.gz", "has_sig": false, "md5_digest": "66cae752f902f0662e91ce1af6e602b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4972, "upload_time": "2019-09-12T22:49:37", "url": "https://files.pythonhosted.org/packages/9e/58/3c455822c74a9370f26a24242a2ffc7a2da479af8b817a2c4429f4a13930/py_range_parse-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "44899d5fe9f5bb069228a93d3819ab6b", "sha256": "e5b62d0fbd4cf8ae0b45b865f26acfe137ec1eab6e4bd1e26cb267ebee13213a" }, "downloads": -1, "filename": "py_range_parse-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "44899d5fe9f5bb069228a93d3819ab6b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6303, "upload_time": "2019-09-12T23:21:27", "url": "https://files.pythonhosted.org/packages/d2/60/275c32d810156064d325794e62c43aa474a6aab8b61e228ae76d70737a68/py_range_parse-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2412faad6cec08860bcbc920c6d5eb8", "sha256": "833fdfa4107fec5da29f09ffab1d0dbcd56c225df666bd78bca6916d3680d2ba" }, "downloads": -1, "filename": "py_range_parse-1.0.4.tar.gz", "has_sig": false, "md5_digest": "e2412faad6cec08860bcbc920c6d5eb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5139, "upload_time": "2019-09-12T23:21:29", "url": "https://files.pythonhosted.org/packages/a1/9f/cbb306c0adf0f057ab51f4d38559815b8a5be47ad1a647d10b053e5af96f/py_range_parse-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "15c76b550738323b32836e8492bd8921", "sha256": "a9d6b66f8e10dd26f5ff9726daef5b70bb32368a00a4563bd65d062c73d7c979" }, "downloads": -1, "filename": "py_range_parse-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "15c76b550738323b32836e8492bd8921", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7438, "upload_time": "2019-09-18T23:52:51", "url": "https://files.pythonhosted.org/packages/cd/19/29064acd044d0694cff7cb0b73450f43595f642b41389f2248aa26d48b10/py_range_parse-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d33a463f433c6c40641ff58d2f683b9", "sha256": "15cf56ab4483814162f57f3b2bfd3ae68f6c4ea4cd7e710c881a5ce97f516c2c" }, "downloads": -1, "filename": "py_range_parse-1.0.5.tar.gz", "has_sig": false, "md5_digest": "9d33a463f433c6c40641ff58d2f683b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6137, "upload_time": "2019-09-18T23:52:52", "url": "https://files.pythonhosted.org/packages/28/60/f3ac14cf6c011b2fb331fd80163a6de900844737fb0a37876952a9635867/py_range_parse-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "15c76b550738323b32836e8492bd8921", "sha256": "a9d6b66f8e10dd26f5ff9726daef5b70bb32368a00a4563bd65d062c73d7c979" }, "downloads": -1, "filename": "py_range_parse-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "15c76b550738323b32836e8492bd8921", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7438, "upload_time": "2019-09-18T23:52:51", "url": "https://files.pythonhosted.org/packages/cd/19/29064acd044d0694cff7cb0b73450f43595f642b41389f2248aa26d48b10/py_range_parse-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d33a463f433c6c40641ff58d2f683b9", "sha256": "15cf56ab4483814162f57f3b2bfd3ae68f6c4ea4cd7e710c881a5ce97f516c2c" }, "downloads": -1, "filename": "py_range_parse-1.0.5.tar.gz", "has_sig": false, "md5_digest": "9d33a463f433c6c40641ff58d2f683b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6137, "upload_time": "2019-09-18T23:52:52", "url": "https://files.pythonhosted.org/packages/28/60/f3ac14cf6c011b2fb331fd80163a6de900844737fb0a37876952a9635867/py_range_parse-1.0.5.tar.gz" } ] }