Introduction
interval provides a dictionary-like class keyed by ranges of floating-point numbers.
Each value of the dictionary applies for any key value within the numeric range.
Later entries into the dictionary can partially or completely replace earlier values.
interval is a product of the PDS Ring-Moon Systems Node.
Note that this package is deprecated in favor of the portion module.
Eventually this package may be removed entirely.
Installation
The interval module is available via the rms-interval package on PyPI and can be installed with:
pip install rms-interval
Getting Started
The interval module provides the Interval class, which behaves like a dictionary
keyed by ranges of floating-point numbers. You can create an interval with a specific
range, or use the default range from negative infinity to positive infinity.
Basic operation is as follows:
from interval import Interval
# Create an interval from 0 to 100
interval = Interval(0, 100)
# Set values for different ranges
interval[(11, 30)] = 1.5
interval[(31, 60)] = 2.5
interval[(61, 90)] = 3.5
# Access values at specific points
print(interval[15]) # Prints: 1.5
print(interval[50]) # Prints: 2.5
print(interval[75]) # Prints: 3.5
# Get all values within a range
print(interval[(0, 100)]) # Prints: [None, 1.5, 2.5, 3.5]
# Overlay a new value that partially replaces existing ones
interval[(15, 45)] = 4.5
print(interval[20]) # Prints: 4.5 (replaces 1.5 in this range)
print(interval[50]) # Prints: 2.5 (unchanged)
The interval class handles overlapping ranges by giving precedence to later entries. When you query a range, you get all unique values that were set within that range, ordered by their insertion sequence.
Details of the class are available in the module documentation.
Contributing
Information on contributing to this package can be found in the Contributing Guide.
Links
Licensing
This code is licensed under the Apache License v2.0.
Metadata
Release files for rms-interval 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rms_interval-1.1.0.tar.gz | 23.1 kB | Without provenance | Details for rms_interval-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rms_interval-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for rms_interval-1.1.0-py3-none-any.whl |
Total release size: 33.2 kB
Release files / rms_interval-1.1.0.tar.gz
| Download URL | rms_interval-1.1.0.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba6885cb0a17d91b8ef73165a0b21fbb49f72939193f8e7643eb6e7f40d44c53
|
|
BLAKE2b-256 checksum How to use checksums |
565a8b58d98524c9277f2cae6344f98f3bfed59fcf1fd8d64e150bc21ac15b7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / rms_interval-1.1.0-py3-none-any.whl
| Download URL | rms_interval-1.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1088c15248ff874d1af6ba58324cfa3d31861ae3ec5008f33d5d2dfd0b3c1c66
|
|
BLAKE2b-256 checksum How to use checksums |
0e7f5955fc8fed027977ca2d912e68cfba925a239ca41b68c97b013f7b19436b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for rms-interval 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.