enriched package

Submodules

enriched.datetime_interval_set module

Interval and interval set subclassed to work with datetime values.

This serves also as prototype for other extension to specific ‘real-like’ domains for subclassing and which methods should be overridden (and how).

Everything else is inherited from the superclasses in a way that takes care of ensuring operations (utils, builders, algebraic operations) will stay in the correct domain.

class enriched.datetime_interval_set.DatetimeInterval(begin, end)[source]

Bases: BaseInterval

Domain-specific interval subclass. Below are the methods that one should override when creating a subclass.

For these intervals, values are datetime.

static builder()[source]

Return a builder configured to make peg pairs into these types of intervals.

metric

alias of DatetimeMetric

serializing_class = 'DatetimeInterval'
serializing_version = 1
static utils()[source]

Return an “utils” object configured to create special cases of intervals as instance of this subclass.

static value_decoder(val)[source]

domain decoder: timestamp -> datetime.

static value_encoder(val)[source]

domain encoder: datetime => timestamp (floating-point number).

class enriched.datetime_interval_set.DatetimeIntervalSet(intervals)[source]

Bases: BaseIntervalSet

Domain-specific interval-set subclass. Below are the methods that one should override when creating a subclass.

For these interval sets, values are datetime.

static builder()[source]

Return a builder configured to make peg pairs into these types of interval sets.

interval_class

alias of DatetimeInterval

serializing_class = 'DatetimeIntervalSet'
serializing_version = 1
static utils()[source]

Return an “utils” object configured to create special cases of interval sets as instance of this subclass.

class enriched.datetime_interval_set.DatetimeMetric[source]

Bases: BaseDomainMetric

The metric on the datetime domain just needs to take care of the fact that differences are ‘timedelta’ objects.

static adder(val1, val2)[source]

standard addition.

static subtracter(val1, val2)[source]

standard subtraction.

zero = datetime.timedelta(0)

enriched.string_interval_set module

An example of interval/set kit that does not admit an underlying metric.

String form an ordered set, with e.g. “a” < “aa” < “aaa” < “aab” < “ab” < “b” and infinite new strings insertable inbetween, with no well-defined ‘distance’,

Useful mostly as a sanity check that a metric is not assumed anywhere.

Also, rather arbitrarily (for testing purposes), string-intervals are set to non-serializable.

Please refer to the Datetime case for relevant comments on the structure.

class enriched.string_interval_set.StringInterval(begin, end)[source]

Bases: BaseInterval

Intervals between strings.

static builder()[source]

The builder peg-pair -> string interval.

static utils()[source]

String-interval utils

class enriched.string_interval_set.StringIntervalSet(intervals)[source]

Bases: BaseIntervalSet

A string-interval-set.

static builder()[source]

String-interval-set builder.

interval_class

alias of StringInterval

static utils()[source]

Return an “utils” object configured to create special cases of interval sets as instance of this subclass.

Module contents