CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-python-bidi

Python Bidi layout wrapping the Rust crate unicode-bidi

Overall
score

93%

Overview
Eval results
Files

task.mdevals/scenario-2/

Bidirectional Text Display Formatter

A utility that converts logical bidirectional text into its proper visual display order for user interfaces that display mixed left-to-right (LTR) and right-to-left (RTL) text.

Capabilities

Basic RTL Text Display

Converts right-to-left text from logical storage order to visual display order.

  • Given the Hebrew string "שלום", returns "םולש" @test
  • Given the mixed text "car is THE CAR", returns appropriate display order @test

Mixed Script Handling

Handles text containing both LTR and RTL scripts with numbers.

  • Given "1 2 3 ניסיון", returns "ןויסינ 3 2 1" @test

Encoding Support

Processes text in different character encodings.

  • Given UTF-8 encoded bytes containing "שלום", returns bytes with text in display order @test

Implementation

@generates

API

def format_for_display(text, encoding='utf-8'):
    """
    Converts bidirectional text to display order.

    Args:
        text: Input text as str or bytes
        encoding: Character encoding for bytes input (default: 'utf-8')

    Returns:
        Text in visual display order, same type as input (str or bytes)
    """
    pass

Dependencies { .dependencies }

python-bidi { .dependency }

Provides bidirectional text algorithm implementation for converting logical text order to visual display order.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-python-bidi

tile.json