File: //usr/lib/python3.9/site-packages/serial/__pycache__/rfc2217.cpython-39.opt-1.pyc
a
U
Y^� � @ sn d dl Z d dlZd dlZd dlZd dlZzd dlZW n eyR d dlmZ Y n0 zd dl Z W n eyz d dl
Z Y n0 d dlZd dlm
Z
mZmZmZmZmZ e je je je jd�ZdZdZdZdZdZd Zd
ZdZdZ d
Z!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5d Z6d!Z7d"Z8d#Z9d$Z:d%Z;d&Z<d'Z=d(Z>d)Z?d*Z@d+ZAd,ZBd-ZCd.ZDe-e9e.e:e/e;e0e<e1e=e2e>e3e?e4e@e5eAe6eBe7eCe8eDiZEdZFdZGdZHdZIdZJdZKdZLdZMdZNdZOd ZPd!ZQd"ZRd/ZSd0ZTd1ZUd2ZVd3ZWd4ZXd5ZYd6ZZd7Z[d8Z\d9Z]d:Z^d;Z_d<Z`d=Zad6Zbd7Zcd8Zdd9Zed:Zfd;Zgd<Zhd=ZidZjdZkdZlejmd=ejnd<ejod>ejpd;ejqd?iZresd@dA� er�t� D ��Zuejvd=ejwd>ejxd<iZyesdBdA� ey�t� D ��Zzd Z{d=Z|d<Z}dCZ~dDZdEZ�dFZ�G dGdH� dHe��Z�G dIdJ� dJe��Z�G dKdL� dLe
�Z�G dMdN� dNe��Z�e�dOk�rjd dl�Z�e�dPdQ�Z�e�j���dR��e��� e�j���dS� e���dT� e���� e�j���dU��e���d?��� e���� dS )V� N)�
SerialBase�SerialException�to_bytes� iterbytes�portNotOpenError�Timeout)�debug�info�warning�error� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �s ��� � � � ,� � � � � � � �
� � � e� f� g� h� i� j� k� l� m� n� o� p�
� � � � � � � �@ � � � � � � � � c c s | ]\}}||fV qd S �N� ��.0�k�vrH rH �2/usr/lib/python3.9/site-packages/serial/rfc2217.py� <genexpr>� � rN c c s | ]\}}||fV qd S rG rH rI rH rH rM rN � rO � REQUESTED�ACTIVE�INACTIVE�REALLY_INACTIVEc @ s* e Zd ZdZd dd�Zdd� Zdd� ZdS )
�TelnetOptionz@Manage a single telnet option, keeps track of DO/DONT WILL/WONT.Nc
C s@ || _ || _|| _|| _|| _|| _|| _|| _d| _| | _ dS )a; Initialize option.
:param connection: connection used to transmit answers
:param name: a readable name for debug outputs
:param send_yes: what to send when option is to be enabled.
:param send_no: what to send when option is to be disabled.
:param ack_yes: what to expect when remote agrees on option.
:param ack_no: what to expect when remote disagrees on option.
:param initial_state: options initialized with REQUESTED are tried to
be enabled on startup. use INACTIVE for all others.
FN)
�
connection�name�option�send_yes�send_no�ack_yes�ack_no�state�active�activation_callback)
�selfrU rV rW rX rY rZ r[ Z
initial_stater^ rH rH rM �__init__� s
zTelnetOption.__init__c C s dj | d�S )zString for debug outputsz{o.name}:{o.active}({o.state}))�o��format�r_ rH rH rM �__repr__ s zTelnetOption.__repr__c C s& || j kr�| jtu r4t| _d| _| jdur�| �� nt| jtu r@nh| jtu r|t| _| j�| j | j
� d| _| jdur�| �� n,| jtu r�| j�| j| j
� nt
d�| ���nx|| jk�r"| jtu r�t| _d| _nT| jtu r�t| _| j�| j| j
� d| _n*| jtu �rn| jtu �rnt
d�| ���dS )zo A DO/DONT/WILL/WONT was received for this option, update state and
answer when needed.
TNzoption in illegal state {!r}F)rZ r\ rP rQ r] r^ rR rU �telnet_send_optionrX rW rS rY �
ValueErrorrc r[ �r_ �commandrH rH rM �process_incoming
s<