TotalDepth.common.Rle (Run Length Encoding Data Compression)

Code for Run Length Encoding.

class TotalDepth.common.Rle.RLEItem(datum: Union[int, float])

Class that represents a single entry in a Run Length Encoding set. v - The datum value.

__init__(datum: Union[int, float])

Initialize self. See help(type(self)) for accurate signature.

__str__() → str

String representation.

__len__() → int

Total number of values.

add(v: Union[int, float]) → bool

Returns True if v has been absorbed in this entry. False means a new entry is required.

values() → Sequence[Union[int, float]]

Generates all values.

value(i) → Tuple[int, Union[int, float, None]]

Returns a particular value.

range() → range

Returns a range object that has (start, stop, step).

last()

Returns the last value.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.common.Rle.RLE(theFunc=None)

Class that represents Run Length Encoding.

theFunc - optional unary function to convert all values with.

__init__(theFunc=None)

Constructor, optionally takes a unary function to convert all values with.

__str__()

Return str(self).

__len__()

The number of RLEItem(s).

__getitem__(key)

Returns a RLEItem.

num_values()

Total number of record values.

add(v)

Adds a value to this RLE object.

values()

Generates all values entered.

value(i)

Indexing; this returns the i’th value added.

ranges()

Returns a list of range() objects.

first()

Returns the first value or None if no values added.

last()

Returns the last value or None if no values added.

largest_le(value: Union[int, float]) → Union[int, float]

Return the largest value less than or equal to the given value.

__weakref__

list of weak references to the object (if defined)

TotalDepth.common.Rle.create_rle(values: Iterable[T_co], fn: Callable = None) → TotalDepth.common.Rle.RLE

Create a RLE object from an iterable.