U
    9ßôgÐ  ã                   @   s`   d Z ddlmZmZ ddlmZmZ eeef Z	de	eee e
e	dœd	d
„Zeedœdd„ZdS )z4Provides a wrpper for the Rust based implementation.é    )ÚOptionalÚUnioné   )Úget_base_level_innerÚget_display_innerúutf-8NF)Ústr_or_bytesÚencodingÚbase_dirÚdebugÚreturnc                 C   s@   t | tƒr|  |¡}d}n| }d}t|||ƒ}|r<| |¡}|S )aa  Accepts string or bytes. In case of bytes, `encoding`
    is needed as the inner function expects a valid string (default:"utf-8").

    Set `base_dir` to 'L' or 'R' to override the calculated base_level.

    Set `debug` to True to return the calculated levels.

    Returns the display layout, either as unicode or `encoding` encoded
    string.

    TF)Ú
isinstanceÚbytesÚdecoder   Úencode)r   r	   r
   r   ÚtextZwas_decodedZdisplay© r   ú0/tmp/pip-unpacked-wheel-g4krq8h_/bidi/wrapper.pyÚget_display	   s    


r   )r   r   c                 C   s   t | ƒS )zxReturns the base unicode level of the 1st paragraph in `text`.

    Return value of 0 means LTR, while 1 means RTL.
    )r   )r   r   r   r   Úget_base_level)   s    r   )r   NF)Ú__doc__Útypingr   r   Zbidir   r   Ústrr   Z
StrOrBytesÚboolr   Úintr   r   r   r   r   Ú<module>   s      üû 