File: //usr/lib/python3/dist-packages/twisted/conch/insults/__pycache__/helper.cpython-38.pyc
U
W[<8 � @ s d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl m
Z
mZmZ ddl
mZmZ ddlmZ dd lmZmZ dd
lmZ dZdZed
�\ ZZZZZZZ Z!Z"G dd� dej#�Z$e$Z%eedddd�ddd� eej&�G dd� dej'��Z(G dd� de)�Z*G dd� de(�Z+dddgZ,dS )z<
Partial in-memory terminal emulator
@author: Jp Calderone
� )�print_functionN)�implementer)�Version)�defer�protocol�reactor)�log�_textattributes)� iterbytes)�
deprecated�deprecatedModuleAttribute)�insults� �( � c @ sR e Zd ZdZdZejddddeedfdd�Z e
edddd ��d
d� �Zdd
� Z
dS )�_FormattingStatez�
Represents the formatting state/attributes of a single character.
Character set, intensity, underlinedness, blinkitude, video
reversal, as well as foreground and background colors made up a
character's attributes.
��charset�bold� underline�blink�reverseVideo�
foreground�
background�_subtractingFc C s4 || _ || _|| _|| _|| _|| _|| _|| _d S �Nr ) �selfr r r r r r r r � r �>/usr/lib/python3/dist-packages/twisted/conch/insults/helper.py�__init__, s z_FormattingState.__init__�Twisted�
� r c K s |� � \}}| �||�S )a>
Add a character attribute to a copy of this formatting state.
@param **kw: An optional attribute name and value can be provided with
a keyword argument.
@return: A formatting state instance with the new attribute.
@see: L{DefaultFormattingState._withAttribute}.
)�popitemZ_withAttribute)r �kw�k�vr r r �wantOne9 s z_FormattingState.wantOnec C s� g }| j r|�d� | jr&|�tj� | jr8|�tj� | jrJ|�tj� | j r\|�tj
� | jtkrv|�t
| j � | jtkr�|�t| j � |r�dd�tt|�� d S dS )Nr z[�;�m� )r �appendr r
�BOLDr � UNDERLINEr �BLINKr �
REVERSE_VIDEOr �WHITE�
FOREGROUNDr �BLACK�
BACKGROUND�join�map�str)r Zattrsr r r �toVT102I s$
z_FormattingState.toVT102N)�__name__�
__module__�__qualname__�__doc__ZcompareAttributesr
�G0r0 r2 r r r r'