euporie.core.convert.datum

Convert display data between formats.

Functions

get_app()

Get the current active (running) Application.

get_or_create_loop(name)

Get or create an event loop for a given subsystem name.

md5([data, usedforsecurity, string])

Returns a md5 hash object; optionally initialized with a string

run_coro_sync(coro[, loop])

Run a coroutine synchronously from a sync context.

Classes

Datum(data, *args, **kwargs)

Class for storing and converting display data.

Generic()

Abstract base class for generic types.

ReferenceType

Size(rows, columns)

TypeVar

Type variable.

WeakValueDictionary([other])

Mapping class that references values weakly.

WindowAlign(*values)

Alignment of the Window content.

finalize(obj, func, /, *args, **kwargs)

Class for finalization of weakrefable objects

pairwise(iterable, /)

Return an iterator of overlapping pairs taken from the input iterator.

ref

alias of ReferenceType

class euporie.core.convert.datum.Datum(data: T, *args: Any, **kwargs: Any)

Bases: Generic[T]

Class for storing and converting display data.

add_size(size: tuple[int, int] | Size) str

Store a size for a :py:class`Datum`.

cell_size() Any

Get cell width and aspect synchronously.

async cell_size_async() tuple[int, float]

Get the cell width and aspect ratio of the displayable data.

Returns:

A tuple of the data’s width in terminal columns and its aspect ratio, when

converted to a image.

convert(to: str, cols: int | None = None, rows: int | None = None, fg: str | None = None, bg: str | None = None, bbox: DiInt | None = None, **kwargs: Any) Any

Convert between formats.

async convert_async(to: str, cols: int | None = None, rows: int | None = None, fg: str | None = None, bg: str | None = None, bbox: DiInt | None = None, **kwargs: Any) Any

Perform conversion asynchronously, caching the result.

static get_hash(data: T) str

Calculate a hash of data.

classmethod get_size(key: str) tuple[Datum, Size] | None

Retrieve a Datum and it’s size by its key.

property hash: str

Return a hash of the Datum’s data.

pixel_size() Any

Get data dimensions synchronously.

async pixel_size_async() tuple[int | None, int | None]

Get the dimensions of displayable data in pixels.

Foreground and background color are set at this point if they are available, as data conversion outputs are cached and reused.

Returns:

A tuple of the data’s width in terminal columns and its aspect ratio, when

converted to a image.

property root: Datum

Retrieve the source datum of any conversion outputs.