euporie.core.data_structures

Contain commonly used data structures.

Functions

NamedTuple(typename[, fields])

Typed version of namedtuple.

lru_cache([maxsize, typed])

Least-recently-used cache decorator.

Classes

DiBool([top, right, bottom, left])

A tuple of four bools with directions.

DiInt([top, right, bottom, left])

A tuple of four integers with directions.

DiStr([top, right, bottom, left])

A tuple of four strings with directions.

WeightedDiInt(top, right, bottom, left)

A tuple of four weighted integers.

WeightedInt(weight, value)

Ainterger with an associated weight.

class euporie.core.data_structures.DiBool(top: bool = False, right: bool = False, bottom: bool = False, left: bool = False)

Bases: NamedTuple

A tuple of four bools with directions.

bottom: bool

Alias for field number 2

count(value, /)

Return number of occurrences of value.

classmethod from_value(value: bool) euporie.core.data_structures.DiBool

Construct an instance from a single value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

left: bool

Alias for field number 3

right: bool

Alias for field number 1

top: bool

Alias for field number 0

class euporie.core.data_structures.DiInt(top: int = 0, right: int = 0, bottom: int = 0, left: int = 0)

Bases: NamedTuple

A tuple of four integers with directions.

bottom: int

Alias for field number 2

count(value, /)

Return number of occurrences of value.

classmethod from_value(value: int) euporie.core.data_structures.DiInt

Construct an instance from a single value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

left: int

Alias for field number 3

right: int

Alias for field number 1

top: int

Alias for field number 0

class euporie.core.data_structures.DiStr(top: str = '', right: str = '', bottom: str = '', left: str = '')

Bases: NamedTuple

A tuple of four strings with directions.

bottom: str

Alias for field number 2

count(value, /)

Return number of occurrences of value.

classmethod from_value(value: str) euporie.core.data_structures.DiStr

Construct an instance from a single value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

left: str

Alias for field number 3

right: str

Alias for field number 1

top: str

Alias for field number 0

class euporie.core.data_structures.WeightedDiInt(top: WeightedInt, right: WeightedInt, bottom: WeightedInt, left: WeightedInt)

Bases: NamedTuple

A tuple of four weighted integers.

bottom: euporie.core.data_structures.WeightedInt

Alias for field number 2

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

left: euporie.core.data_structures.WeightedInt

Alias for field number 3

right: euporie.core.data_structures.WeightedInt

Alias for field number 1

top: euporie.core.data_structures.WeightedInt

Alias for field number 0

property unweighted: euporie.core.data_structures.DiInt

Get the padding without weights.

class euporie.core.data_structures.WeightedInt(weight: int, value: int)

Bases: NamedTuple

Ainterger with an associated weight.

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

value: int

Alias for field number 1

weight: int

Alias for field number 0