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

Uploaded Python 3

File details

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

File metadata

  • Download URL: k3rangeset-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 f976f90d0b7547f95851ab64d5c61355f22ec00886d80775befcab850b643131
MD5 9c65498a237a1d238f8e09858deb51e9
BLAKE2b-256 a69019324ca9a990f7ecc52a14118e1e4fc33f27a9055471b8c36802bea09e57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k3rangeset-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b3a468cc9b76874cd46237d1fc8152491b7cbe371f87c22a8ff6507666aa334f
MD5 2b40363a7fe88f37656486dcc64f6de1
BLAKE2b-256 a5a1d4bb59cd398918fdb1da0e9779e9ce2fc66a23804f20ce4a624c8c319edd

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