Parses commonly used range notations to python objects
Project description
py-range-parse
py-range-parse is a library to parse commonly used range notations to python objects that act like sets.
py-range-parse is used by
and hopefully many others :)
How to use
pip install py-range-parse
from py_range_parse import parse_range
range = parse_range("[0..5]")
or create on manually:
from py_range_parse import Range
range = Range(0,5)
Input formats
[-2..5]
]-2..5]
[-2..5[
]-2..5[
[5..-2]
[5..-2]
Infinity
[-inf..inf]
Exclude borders
]0..5.5]
]0..inf[
Operations
Contains
> from py_range_parse import parse_range
> range = parse_range("[0, 5]")
> print(4 in range)
True
Contributing
GitHub is for social coding: if you want to write code, I encourage contributions through pull requests from forks of this repository. Create GitHub tickets for bugs and new features and comment on the ones that you are interested in.
License
py-range-parse
Copyright (c) 2019 Markus Ressel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_range_parse-1.0.4.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for py_range_parse-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5b62d0fbd4cf8ae0b45b865f26acfe137ec1eab6e4bd1e26cb267ebee13213a |
|
MD5 | 44899d5fe9f5bb069228a93d3819ab6b |
|
BLAKE2b-256 | d260275c32d810156064d325794e62c43aa474a6aab8b61e228ae76d70737a68 |