base package

Submodules

base.base_domain_metric module

Metric specification for an interval/set.

class base.base_domain_metric.BaseDomainMetric[source]

Bases: object

Abstract class for creating ‘metric’ static classes, which prescribe how to deal with the concept of interval “length” and their summations.

static adder(val1, val2)[source]

How to add two ‘extensions’ to get another ‘extension’.

static subtracter(val1, val2)[source]

How to subtract two ends of an interval (peg values) to get its ‘extension’.

zero = Ellipsis

base.base_interval module

A single interval with a begin and and end, either open or closed at its ends.

class base.base_interval.BaseInterval(begin, end)[source]

Bases: object

A single uninterrupted interval over the domain field: [a,b] or (a,b) or (a,b] or [a,b) defined by two IntervalPeg objects. It can span to infinities.

Concrete classes must provide builder() and utils() in a standard way (see the real-interval case) and, if desired, define metric and serializability properties as well.

static builder()[source]

Create and return a “builder” for these intervals.

contains(value)[source]

Test whether a value belongs to the interval.

Infinities are allowed as ‘value’ argument, but never belong.

extension()[source]

If a metric is defined for this interval type, use it to compute this interval’s ‘extension’.

intervals()[source]

Return an ‘iterable’ over a single element, this interval. This is only to enable quick-syntax for those IntervalSet set-wise operations whereby the second operand is a puny Interval.

metric = None
pegs()[source]

Return the two ends, iterably.

serializing_class = None
serializing_version = None
to_dict()[source]

Return a json-encodable representation of this interval.

static utils()[source]

Create an “interval utils” object for these intervals.

value_decoder = None
value_encoder = None

base.base_interval_set module

Any set over the domain, defined by a finite number of intervals.

class base.base_interval_set.BaseIntervalSet(intervals)[source]

Bases: object

Any portion of the “continuous line” that is the domain (such as the reals + infinities), defined by an arbitrary (finite) number of intervals.

Any concrete implementation has to provide: a builder() and a utils() (in a pretty standard way, see e.g. the reference “real*” implementation), as well as to give the name of the class representing the individual intervals this set is made of. Moreover, serializing signature data can be provided (if so desired and if serializability is supported by the underlying interval implementation).

static builder()[source]

Create an interval set builder.

complement()[source]

Set complement of the interval set.

contains(value)[source]

Test whether a value belongs to the set.

Conventionally, infinities do not belong to any interval set.

difference(other)[source]

Difference of interval sets.

extension()[source]

If a metric is defined for this interval type, use it to compute this interval set’s (overall) ‘extension’.

intersect(other)[source]

Intersection of interval sets.

interval_class = None
intervals()[source]

Return an iterable over the intervals of this set.

serializing_class = None
serializing_version = None
superset_of(other)[source]

Test whether another interval(set) is contained in this.

to_dict()[source]

Return a json-encodable representation of this interval set.

union(other)[source]

Union of interval sets.

static utils()[source]

Create an “utils” object, offering standard intervalset* creation.

xor(other)[source]

XOR (“exclusive disjunction”) of interval sets.

Module contents