euporie.core.border

Define border styles.

Functions

NamedTuple(typename[, fields])

Typed version of namedtuple.

get_grid_char(key)

Return the character represented by a combination of LineStyles.

lru_cache([maxsize, typed])

Least-recently-used cache decorator.

total_ordering(cls)

Class decorator that fills in missing ordering methods

Classes

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

A description of a cell border: a LineStyle for each edge.

DirectionFlags([north, east, south, west])

Flag which indicate the connection of a grid node.

Enum(value[, names, module, qualname, type, ...])

Create a collection of name/value pairs.

FastDictCache(get_value[, size])

Fast, lightweight cache which keeps at most size items.

GridChar(north, east, south, west)

Repreentation of a grid node character.

GridPart(value[, names, module, qualname, ...])

Define the component characters of a grid.

GridStyle(line_style, mask)

A collection of characters which can be used to draw a grid.

LineStyle(name, rank[, parent, visible])

Define a line style which can be used to draw grids.

Mask(mask)

A mask which allows selection of a subset of a grid.

Masks()

A collection of default masks.

class euporie.core.border.DiLineStyle(top: LineStyle = LineStyle(None), right: LineStyle = LineStyle(None), bottom: LineStyle = LineStyle(None), left: LineStyle = LineStyle(None))

Bases: NamedTuple

A description of a cell border: a LineStyle for each edge.

bottom: LineStyle

Alias for field number 2

count(value, /)

Return number of occurrences of value.

classmethod from_value(value: LineStyle) DiLineStyle

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: LineStyle

Alias for field number 3

right: LineStyle

Alias for field number 1

top: LineStyle

Alias for field number 0

class euporie.core.border.DirectionFlags(north: bool = False, east: bool = False, south: bool = False, west: bool = False)

Bases: NamedTuple

Flag which indicate the connection of a grid node.

count(value, /)

Return number of occurrences of value.

east: bool

Alias for field number 1

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

Return first index of value.

Raises ValueError if the value is not present.

north: bool

Alias for field number 0

south: bool

Alias for field number 2

west: bool

Alias for field number 3

class euporie.core.border.GridChar(north: LineStyle, east: LineStyle, south: LineStyle, west: LineStyle)

Bases: NamedTuple

Repreentation of a grid node character.

The four compass points represent the line style joining from the given direction.

count(value, /)

Return number of occurrences of value.

east: LineStyle

Alias for field number 1

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

Return first index of value.

Raises ValueError if the value is not present.

north: LineStyle

Alias for field number 0

south: LineStyle

Alias for field number 2

west: LineStyle

Alias for field number 3

class euporie.core.border.GridPart(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Define the component characters of a grid.

Character naming works as follows:

╭┈┈┈┈┈┈┈┈LEFT ┊ ╭┈┈┈┈┈┈MID ┊ ┊ ╭┈┈┈┈SPLIT ┊ ┊ ┊ ╭┈┈RIGHT ∨ ∨ ∨ v

TOP┈> ┏ ━ ┳ ┓ MID┈> ┃ ┃ ┃

SPLIT┈> ┣ ━ ╋ ┫

BOTTOM┈> ┗ ━ ┻ ┛

BOTTOM_LEFT = 12
BOTTOM_MID = 13
BOTTOM_RIGHT = 15
BOTTOM_SPLIT = 14
MID_LEFT = 4
MID_MID = 5
MID_RIGHT = 7
MID_SPLIT = 6
SPLIT_LEFT = 8
SPLIT_MID = 9
SPLIT_RIGHT = 11
SPLIT_SPLIT = 10
TOP_LEFT = 0
TOP_MID = 1
TOP_RIGHT = 3
TOP_SPLIT = 2
class euporie.core.border.GridStyle(line_style: ~euporie.core.border.LineStyle = LineStyle(None), mask: ~euporie.core.border.Mask = <euporie.core.border.Mask object>)

Bases: object

A collection of characters which can be used to draw a grid.

property BOTTOM: _BorderLineChars

Allow dotted attribute access to the bottom grid row.

property HORIZONTAL: str

For compatibility with prompt_toolkit.widgets.base.Border.

property MID: _BorderLineChars

Allow dotted attribute access to the mid grid row.

property SPLIT: _BorderLineChars

Allow dotted attribute access to the split grid row.

property TOP: _BorderLineChars

Allow dotted attribute access to the top grid row.

property VERTICAL: str

For compatibility with prompt_toolkit.widgets.base.Border.

class euporie.core.border.LineStyle(name: str, rank: tuple[int, int], parent: euporie.core.border.LineStyle | None = None, visible: bool = True)

Bases: object

Define a line style which can be used to draw grids.

GridStyle`s can be created from a :class:`LineStyle by accessing an attribute with the name of a default mask from Masks.

class euporie.core.border.Mask(mask: dict[euporie.core.border.GridPart, euporie.core.border.DirectionFlags])

Bases: object

A mask which allows selection of a subset of a grid.

Masks can be combined to construct more complex masks.

class euporie.core.border.Masks

Bases: object

A collection of default masks.

bottom_edge = <euporie.core.border.Mask object>
center_edge = <euporie.core.border.Mask object>
corners = <euporie.core.border.Mask object>
grid = <euporie.core.border.Mask object>
inner = <euporie.core.border.Mask object>
left_edge = <euporie.core.border.Mask object>
middle_edge = <euporie.core.border.Mask object>
outer = <euporie.core.border.Mask object>
right_edge = <euporie.core.border.Mask object>
top_edge = <euporie.core.border.Mask object>
euporie.core.border.get_grid_char(key: GridChar) str

Return the character represented by a combination of LineStyles.