File: //usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/__pycache__/emoji.cpython-310.pyc
o
��h? � @ s d dl Z d dlmZmZmZmZ ddlmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ er:dd lmZmZmZ ed
ZG dd� de�ZG d
d� de�Zedkr�d dl Z d dlmZ d dlmZ edd�Zedd� ee
�� �D �dd�Ze�e� ee j �dkr�e�!e j d � dS dS dS )� N)�
TYPE_CHECKING�Optional�Union�Literal� )�JupyterMixin)�Segment)�Style)�EMOJI��_emoji_replace)�Console�ConsoleOptions�RenderResult)�emoji�textc @ s e Zd ZdZdS )�NoEmojizNo emoji by that name.N)�__name__�
__module__�__qualname__�__doc__� r r �A/usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/emoji.pyr s r c @ s� e Zd Zg d�Zddd�Z ddedeeef d ee d
dfdd�Z
ed
ed
efdd��Zd
efdd�Z
d
efdd�Z
ddd�ZdS )�Emoji)�name�style�_char�variantu ︎u ️)r r �noneNr r r �returnc C sf || _ || _|| _zt| | _W n ty td|����w |dur1| j| j�|d�7 _dS dS )z�A single emoji character.
Args:
name (str): Name of emoji.
style (Union[str, Style], optional): Optional style. Defaults to None.
Raises:
NoEmoji: If the emoji doesn't exist.
zNo emoji called N� ) r r r r
r �KeyErrorr �VARIANTS�get)�selfr r r r r r �__init__ s ��zEmoji.__init__r c C s t |�S )z�Replace emoji markup with corresponding unicode characters.
Args:
text (str): A string with emojis codes, e.g. "Hello :smiley:!"
Returns:
str: A string with emoji codes replaces with actual emoji.
r )�clsr r r r �replace4 s
z
Emoji.replacec C s d| j �d�S )Nz<emoji �>)r �r$ r r r �__repr__@ s zEmoji.__repr__c C s | j S �N)r r) r r r �__str__C s z
Emoji.__str__�consoler
�optionsr r c c s � t | j|�| j��V d S r+ )r r � get_styler )r$ r- r. r r r �__rich_console__F s �zEmoji.__rich_console__)r N)r- r
r. r r r )r r r � __slots__r"