Skip to main content

Parses commonly used range notations to python objects

Project description

py-range-parse Contributors MIT License Code Size https://badge.fury.io/py/py-range-parse Build Status

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.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

py_range_parse-1.0.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file py_range_parse-1.0.3.tar.gz.

File metadata

  • Download URL: py_range_parse-1.0.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.7

File hashes

Hashes for py_range_parse-1.0.3.tar.gz
Algorithm Hash digest
SHA256 503b3dc73522e69fed4930b175bbed3e641cc6280718a34f65e8c60303025820
MD5 66cae752f902f0662e91ce1af6e602b9
BLAKE2b-256 9e583c455822c74a9370f26a24242a2ffc7a2da479af8b817a2c4429f4a13930

See more details on using hashes here.

File details

Details for the file py_range_parse-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: py_range_parse-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.7

File hashes

Hashes for py_range_parse-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e24f47ad8725b239465c851a30118dbdc9283ba17db60ed6329fed0811cb47bd
MD5 b5fa330164ad0452728a7c5de0b93079
BLAKE2b-256 071fbb35433f9ff50418f41447c26be483eea29e1ef49ee83f2ed62335e42579

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page