Welcome to intervalset API documentation!¶
There is not much to say here, I recommend to read the official (non-API) documentation here:
https://bitbucket.org/nagylzs/intervalset
You can also download the whole project repository from there.
Interval set abstract type
-
class
intervalset.
Interval
¶ Represent an immutable interval, with beginning and ending time.
To create a new interval:
Interval(0, 10)Especially useful with datetime instances:
begin = datetime.datetime(...) end = datetime.datetime(...) Interval(begin, end)Intervals with the same starting and ending at the same value are considered empty, and are represented with EMPTY_INTERVAL. The boolean value of EMPTY_INTERVAL is false. All other intervals evaluate to True. The EMPTY_INTERVAL is smaller than any other non-empty interval.
Operators:
“*” - intersection “+” - unification, but it can only be applied to overlapping or touching non-empty intervals. “in” - if an interval contains another interval completely.-
is_after_than
(other)¶ Tells if this interval is completely after the other. (Empty intervals are before everything.)
-
is_before_than
(other)¶ Tells if this interval is completely before the other. (Empty intervals are before everything.)
-
-
class
intervalset.
IntervalSet
(*items)¶ A set of datetime intervals. Immutable.
To create a new set:
IntervalSet( interval1, interval2, interval3... )Arguments should be Interval objects. The order is insignificant - they will automatically be unified and ordered by the constructor. Empty intervals will be simply ignored (and absent from the set). Sets can be iterated over. Operators on interval sets:
- union
& intersection
- difference
^ symmetric difference
“in” - containment for an element
“in” - containment for a set