Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/formatted_text/__pycache__/html.cpython-39.pyc
Ðазад
a d�h � @ s� d dl mZ d dlm mZ d dlmZ d dlmZ ddl m Z mZ dgZG dd� d�Z G d d � d e�Zddd �dd�Ze� ZdS )� )�annotationsN)� Formatter)�Any� )� FormattedText�StyleAndTextTuples�HTMLc @ s^ e Zd ZdZddd�dd�Zdd�dd �Zd d�dd�Zd d d d�dd�Zd d d�dd�ZdS )r a HTML formatted text. Take something HTML-like, for use as a formatted string. :: # Turn something into red. HTML('<style fg="ansired" bg="#00ff44">...</style>') # Italic, bold, underline and strike. HTML('<i>...</i>') HTML('<b>...</b>') HTML('<u>...</u>') HTML('<s>...</s>') All HTML elements become available as a "class" in the style sheet. E.g. ``<username>...</username>`` can be styled, by setting a style for ``username``. �str�None)�value�returnc sr || _ t�d|� d��}g �g �g �g � dd�� ��fdd��ddd �� �����fd d���|� t��| _d S )Nz<html-root>z</html-root>r �r c sR g } �r| � dd��� � �r2| � d�d � � rH| � d� d � d�| �S )z$Build style string for current node.zclass:�,zfg:���zbg:� )�append�join)�parts)�bg_stack�fg_stack� name_stack� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/formatted_text/html.py�get_current_style* s z(HTML.__init__.<locals>.get_current_styler r )�noder c s� | j D ]�}|j|jkr*���� |jf� q|jdv}d }}|j�� D ],\}}|dkrZ|}|dkrf|}|dkrF|}qFd|v r�td��d|v r�td��|r���|j� |r���|� |r�� �|� �|� |rԈ� � |r�� � |r� � � qd S ) zProcess node recursively.)z #documentz html-root�style� �fg�bg�colorr z "fg" attribute contains a space.z "bg" attribute contains a space.N) Z childNodesZnodeTypeZ TEXT_NODEr �dataZnodeName� attributes�items� ValueError�pop)r �childZadd_to_name_stackr r �k�v�r r r r �process_node�resultr r r) 6 s: z#HTML.__init__.<locals>.process_node)r �minidomZparseStringr �formatted_text)�selfr Zdocumentr r( r �__init__! s ,z HTML.__init__r c C s d| j �d�S )NzHTML(�))r �r- r r r �__repr__f s z HTML.__repr__r c C s | j S �N)r, r0 r r r �__pt_formatted_text__i s zHTML.__pt_formatted_text__�object)�args�kwargsr c O s t t�| j||��S )zc Like `str.format`, but make sure that the arguments are properly escaped. )r � FORMATTER�vformatr )r- r5 r6 r r r �formatl s zHTML.formatc C s0 t |t�s|f}tdd� |D ��}t| j| �S )z+ HTML('<b>%s</b>') % value c s s | ]}t |�V qd S r2 )�html_escape)�.0�ir r r � <genexpr>z � zHTML.__mod__.<locals>.<genexpr>)� isinstance�tupler r )r- r r r r �__mod__s s zHTML.__mod__N) �__name__� __module__�__qualname__�__doc__r. r1 r3 r9 rA r r r r r s Ec @ s e Zd Zdddd�dd�ZdS )� HTMLFormatterr4 r )r �format_specr c C s t t||��S r2 )r: r9 )r- r rG r r r �format_field s zHTMLFormatter.format_fieldN)rB rC rD rH r r r r rF ~ s rF r4 r )�textr c C s4 t | t�s| � } | �dd��dd��dd��dd�S ) N�&z&�<z<�>z>�"z")r? r �replace)rI r r r r: � s ����r: )� __future__r Zxml.dom.minidom�domr+ �stringr �typingr �baser r �__all__r rF r: r7 r r r r �<module> s r
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка