euporie.core.convert.core
Contain main format conversion function.
Functions
|
Typed version of namedtuple. |
|
Convert between formats. |
|
Find the shortest conversion path between two formats. |
|
Attempt to guess the format of a path. |
|
Create or return the conversion IO loop. |
|
Attempt to determine the mime-type of a path. |
|
Least-recently-used cache decorator. |
|
Add a converter to the centralized format conversion system. |
|
Accept both booleans and Filters as input and turn it into a Filter. |
Classes
|
Hold a conversion function and its weight. |
|
A |
|
Fast, lightweight cache which keeps at most size items. |
|
|
|
Very simple cache that discards the oldest item when the cache size is exceeded. |
|
- class euporie.core.convert.core.Converter(func: Callable, filter_: Filter, weight: int = 1)
Bases:
NamedTuple
Hold a conversion function and its weight.
- count(value, /)
Return number of occurrences of value.
- func: Callable
Alias for field number 0
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- euporie.core.convert.core.convert(data: Any, from_: str, to: str, cols: int | None = None, rows: int | None = None, fg: str | None = None, bg: str | None = None, path: Path | None = None) Any | None
Convert between formats.
- euporie.core.convert.core.find_route(from_: str, to: str) list | None
Find the shortest conversion path between two formats.
- euporie.core.convert.core.get_format(path: Path | str, default: str = '') str
Attempt to guess the format of a path.
- euporie.core.convert.core.get_loop() asyncio.events.AbstractEventLoop
Create or return the conversion IO loop.
The loop will be running on a separate thread.