Skip to main content

Segmented range represented as sorted interleaving intervals

Project description

k3rangeset

Action-CI Build Status Documentation Status Package

segmented range which is represented in a list of sorted interleaving range.

k3rangeset is a component of pykit3 project: a python3 toolkit set.

Segmented range which is represented in a list of sorted interleaving range.

A range set can be thought as: [[1, 2], [5, 7]].

Install

pip install k3rangeset

Synopsis

import k3rangeset

a = k3rangeset.RangeSet([[1, 5], [10, 20]])
a.has(1)  # True
a.has(8)  # False
a.add([5, 7])  # [[1, 7], [10, 20]]

inp = [
    [0, 1, [['a', 'b', 'ab'],
            ['b', 'd', 'bd'],
            ]],
    [1, 2, [['a', 'c', 'ac'],
            ['c', 'd', 'cd'],
            ]],
]

r = k3rangeset.RangeDict(inp, dimension=2)
print(r.get(0.5, 'a'))  # 'ab'
print(r.get(1.5, 'a'))  # 'ac'

Author

Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Copyright and License

The MIT License (MIT)

Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com

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

k3rangeset-0.1.2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k3rangeset-0.1.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file k3rangeset-0.1.2.tar.gz.

File metadata

  • Download URL: k3rangeset-0.1.2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3rangeset-0.1.2.tar.gz
Algorithm Hash digest
SHA256 004fb5d74ebc247e3c1fd7b67c998c331fbbaceef87cca00c2bbc5aeb721f7f9
MD5 04ead80b869babf573bf2795bf8d1e6e
BLAKE2b-256 9ebaeaf84a7ece82daa662daae7e5d6b84e0c1b7ffc93780c2a07dddd9c77323

See more details on using hashes here.

File details

Details for the file k3rangeset-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: k3rangeset-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3rangeset-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3426c4af560bc59deecc341fe489070df4523138ef5b8c33e92511c41e9e0587
MD5 1da855c9a6d94d66cb067f5aa7fcdd6f
BLAKE2b-256 bedaca0406c3f39559b1a80ca94900c485ee13a09d2eceab0a7a85a54f0fa8e4

See more details on using hashes here.

Supported by

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