Skip to main content

MultInterval

Represent large intervals of numeric/datetime data in Python with a small memory footprint.

When to Use

  • Your data is a long contiguous stretches (in fixed steps) of data that is separated by few missing gaps.
  • Each data point can be compared to another, and divisble by the step factor (supports datetime/timedelta combinations)

How to Use

import multinterval as mi

# at instantiation, only a step is necessary
i = mi.MultInterval(step=5)
print(list(i))  # outputs []

# the set is fully instantiated only when there is at least one member
i.include(3)
print(list(i))  # outputs [3]


# include other compatible values, Intervals, MultIntervals
i.include(8, 13, 23) # include multiple numbers
i.include(mi.Interval(53, 68, step=5)) # include full intervals
i.include(
	mi.MultInterval(
		step=5,
		ranges=[mi.Interval(103, 113, step=5), mi.Interval(158, 193, step=5)],
	)
)
print(list(i))  # outputs [3, 8, 13, 23, 53, 58, 63, 103, 108, 158, 163, 168, 173, 178, 183, 188]


# exclude any compatible values
i.exclude(23)
i.exclude(mi.Interval(13, 108, step=5))
i.exclude(
	mi.MultInterval(
		step=5,
		ranges=[mi.Interval(53, 178, step=5)],
	)
)
print(list(i))  # outputs [3, 8, 178, 183, 188]


# the following will cause errors

# including values not in the same number line will cause an error
# i.include(7)

# including intervals on a different step
# i.include(mi.Interval(3, 9, step=3))

# including intervals that do not coincide on the same step
# i.include(mi.Interval(4, 10, step=5))

Implementation Details

  • Complete intervals are represented with a tuple of inclusive start and exclusive end.
  • Longer intervals with gaps are represented by a list of the complete intervals.

Metadata

Release files for multinterval 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multinterval 0.1.0
File Size Uploaded Provenance Actions
multinterval-0.1.0.tar.gz 5.4 kB Without provenance Details for multinterval-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for multinterval 0.1.0
File Interpreter ABI Platform Actions
multinterval-0.1.0-py3-none-any.whl Python 3 none any Details for multinterval-0.1.0-py3-none-any.whl

Total release size: 11.3 kB

Release files / multinterval-0.1.0.tar.gz

Download URL multinterval-0.1.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
87fa41bcf52d663f0964f648b57f241318379757bca5948e162ddb03dd6b85be
BLAKE2b-256 checksum
How to use checksums
52b964fd6afc273c7ab9f4f02e7bb55ec1acfb9ce808e58fd6f238a38a454286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / multinterval-0.1.0-py3-none-any.whl

Download URL multinterval-0.1.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a133336899bbff0a03e33d87491063542d6cc1dabed9fbbb7c4a14847ddab090
BLAKE2b-256 checksum
How to use checksums
638b39dfa531d14c0e39f5a0abb0f21b0e839e211201bad02dd0952901cfc390
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Security for multinterval 0.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page