Skip to main content

Segmented range represented as sorted interleaving intervals

Project description

k3rangeset

Action-CI 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.4.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.4-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: k3rangeset-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 fb10723dd30e35f4467b0834ecd22fcd5e3c0ecfc4a092bba2f8c9ff6d8ab11f
MD5 35ef2af113c0b352a19a588181ede88e
BLAKE2b-256 86d2857c651b2bc9e7e0d004044d611d297e16274ca80828dc235be76fb84004

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k3rangeset-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.8 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8ce6afef1d7541bc44b49a32aba3d6553531520acf4e44a1aa9bedb45959f17e
MD5 cc6a15fb4a1113d456d2b141e146ab30
BLAKE2b-256 7cd7801841fe2c5f55fdf663ebff4a7281a7b7986a3a00d0bdbbff385ad005ad

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