Skip to main content

A package that finds range intersections

Project description

Intersectlib is a package I created to help with code that contains range intersections.

To install it run: pip install intersectlib

This package comes with the following features:

Find intersections between ranges: find_intersections()

Find a list with remainders after the intersection is removed: find_remainders()

Find both of the above: find_intersection_and_remainders()

Find and transform the intersection with a provided amount: transform_intersection()

Examples:

find_intersection((2, 10), (2, 5)) >> (2, 5)

find_remainders(range(2, 10), range(2, 5)) >> [(5, 10)]

find_remainders((2, 20), (8, 12)) >> [(2, 8), (12, 20)]

find_intersection_and_remainders((2, 10), (2, 5)) >> (2, 5), [(5, 10)]

transform_intersection((2, 10), (2, 5), 5) >> (2, 5) + 5 >> (7, 12)

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

intersectlib-1.2.1.tar.gz (3.3 MB view hashes)

Uploaded Source

Built Distribution

intersectlib-1.2.1-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page