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.1.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.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: k3rangeset-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e8b11ce1d2594e670f1323bd02d02efe023edc99a427af1897e074468206518a
MD5 a1a60a58d916e54b7701c1da3c66c79e
BLAKE2b-256 ca7a14785000544a24d4641680f59439a54b3398d1e930f733bd03d54a9489bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k3rangeset-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ac13a7043519a9630e3fd496426fff2888b5d6b0b2da708f55c1a7860002513
MD5 72d26fffdd34661a7d477345d5fe99cf
BLAKE2b-256 97be617d3c9267d8d59daebdb00c034b764dbdc45fe573613cf2148ec0247cee

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