euporie.core.convert.datum

Convert display data between formats.

Functions

get_app()

Get the current active (running) Application.

get_loop()

Create or return the conversion IO loop.

md5([string, usedforsecurity])

Returns a md5 hash object; optionally initialized with a string

to_plain_text(value)

Turn any kind of formatted text back into plain text.

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

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, extend: bool = True) 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, extend: bool = True, bbox: DiInt | None = None) Any

Perform conversion asynchronously, caching the result.

static get_hash(data: Any) 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 re-used.

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.

to_bytes() bytes

Cast the data to bytes.

euporie.core.convert.datum.get_loop() AbstractEventLoop

Create or return the conversion IO loop.

The loop will be running on a separate thread.