INNER CODE UNIT · Python

_no_emoji_help

antigenomics/vdjtools · python/vdjtools/cli/__init__.py:37

def _no_emoji_help() -> None:
    """Stop rich turning a column name into a pictograph in ``--help``.

    rich rewrites any ``:name:`` token matching its emoji table, and our column contract is built
    out of exactly that shape: ``vsig:mask:TRB:present`` renders as ``vsig<mask emoji>*`` -- an
    emoji, which the repo forbids, standing where a column name the reader is meant to copy should
    be. No rewording fixes it, because every faithful rendering of the name contains the token, and
    rich's backslash escape leaves the backslash in the output. The substitution happens in
    ``Text.from_markup``, which typer calls per help string, so the switch has to be there rather
    than on the console. ``test_cli_help.py`` pins the rendered text.
    """
    from rich.text import Text
    from typer import rich_utils

    class PlainText(Text):
        @classmethod
        def from_markup(cls, text, **kw):  # type: ignore[override]
            return Text.from_markup(text, **{**kw, "emoji": False})

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…