generic package

Submodules

generic.interval_generic_builder module

A utility to provide a “builder” interface for intervals, interval sets etc. The actual class used to instantiate the interval* once completed is passed when instantiating the builder: so, this “interface” can offer a standard syntax yet result in the creation of intervals, interval sets and also other types of intervalsets (e.g. enriched with metrics and so on).

Note: contrary to the ‘utils’ generic tools, this one is able to create both intervals* and intervalsets* (depending on how initialized).

class generic.interval_generic_builder.IntervalGenericBuilder(interval_class=None, interval_set_class=None)[source]

Bases: object

A builder for some kind of intervals. An instance of this class supports a [] and () syntax for specifying the first peg, an action which creates another object that waits for a “completion” call with () or [] and eventually results in creation of an interval*.

generic.interval_generic_utils module

A class containing the “interface” for creation of intervals*, (not ‘sets’). Like for the IntervalSetGenericUtils, the actual class to instantiate is set per-instance, so this serves as a generic class template.

class generic.interval_generic_utils.IntervalGenericUtils(interval_class)[source]

Bases: object

An “interval utils” class. Instances of this, properly initialized with the name of the interval class to create, are able to produce several ‘standard’ intervals such as “all”, “open set” and so on.

all()[source]

Return the “whole of it” interval.

closed(value_begin, value_end)[source]

Create a closed interval with finite boundaries.

from_dict(input_dict)[source]

Using the information in the interval class, convert a dict (supposedly generate from an interval of this same type) back into an interval. This function takes care of injecting decoders to the lower-level (i.e. peg-level) from_dict function invocations.

high_slice(value_begin, included=False)[source]

Create an interval from a value up to +inf.

interval(value_begin, begin_included, value_end, end_included)[source]

Directly create an interval from the values and the open/closed specs.

low_slice(value_end, included=False)[source]

Create an interval from -inf to a certain value.

open(value_begin, value_end)[source]

Create an open interval with finite boundaries.

point(value)[source]

Create a zero-length degenerate [x, x] point-line ‘interval’.

generic.interval_set_generic_utils module

A class containing the “interface” for creation ex-novo of intervalsets*, with the key feature that the actual class to instantiate when creating these is set upon creation of the IntervalSetGenericUtils instance. In this way, a “utils” object can be spawned by IntervalSets or analogous classes and with a common set of methods an “utils” creates intervalsets of the appropriate type.

class generic.interval_set_generic_utils.IntervalSetGenericUtils(interval_set_class)[source]

Bases: object

An “interval set utils” class. Instances are able to use the provided ‘name of an interval set class’ and create standard out-of-the-box intervals.

all()[source]

Return the “whole of it” interval set.

closed(value_begin, value_end)[source]

Create a closed interval set with finite boundaries.

empty()[source]

Create the empty set.

from_dict(input_dict)[source]

Extract an instance of this interval set from a dict, using the provided serializability settings (including checking dict metadata match).

high_slice(value_begin, included=False)[source]

Create an interval set from a value up to +inf.

interval(value_begin, begin_included, value_end, end_included)[source]

Directly create an interval set from the values and the open/closed specs.

low_slice(value_end, included=False)[source]

Create an interval set from -inf to a certain value.

open(value_begin, value_end)[source]

Create an open interval set with finite boundaries.

point(value)[source]

Create a zero-length degenerate [x, x] point-line ‘interval set’.

Module contents