Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/serial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/serial/__pycache__/serialutil.cpython-310.pyc
o

&�a_%U�
@s�ddlmZddlZddlZzeWneefy%Gdd�de�ZYnwzeWn
eefy7e	ZYnwze
WneefyJe	fZ
Ynwdd�Zdd�Zed	g�Z
ed
g�Zedg�Zedg�Zd
\ZZZZZd\ZZZd\ZZZZededededediZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�dej#�Z$e%dkr�ddl&Z&e$�Z'e&j(�)d �*e'j+��e&j(�)d!�*e'j,��e&j(�)d"�*e'j-��e&j(�)d#�*e'j.��e&j(�)d$�*e'j/��e&j(�)d%�*e'��dSdS)&�)�absolute_importNc@seZdZdS)�
memoryviewN)�__name__�
__module__�__qualname__�rr�3/usr/lib/python3/dist-packages/serial/serialutil.pyrsrccsD�t|t�r
|��}d}	|||d�}|d7}|r|VndSq
)z=Iterate over bytes, returning bytes instead of ints (python3)rT�N)�
isinstancer�tobytes)�b�i�arrr�	iterbytes(s�
�rcCsVt|t�r|St|t�rt|�St|t�r|��St|t�r%td�|���tt|��S)z"convert a sequence to a bytes typez?unicode strings are not supported, please encode to bytes: {!r})r
�bytes�	bytearrayrr�unicode�	TypeError�format)�seqrrr�to_bytes8s



r���
�
)�N�E�O�M�S)r	g�?�)�����None�Even�Odd�Mark�Spacec@�eZdZdZdS)�SerialExceptionz.Base class for serial port related exceptions.N�rrr�__doc__rrrrr+\�r+c@r*)�SerialTimeoutExceptionz Write timeouts give an exceptionNr,rrrrr/`r.r/cs eZdZdZ�fdd�Z�ZS)�PortNotOpenErrorzPort is not opencstt|��d�dS)Nz)Attempting to use a port that is not open)�superr0�__init__��self��	__class__rrr2fszPortNotOpenError.__init__)rrrr-r2�
__classcell__rrr5rr0dsr0c@sHeZdZdZeed�rejZnejZdd�Zdd�Z	dd�Z
d	d
�ZdS)�Timeouta>    Abstraction for timeout operations. Using time.monotonic() if available
    or time.time() in all other cases.

    The class can also be initialized with 0 or None, in order to support
    non-blocking and fully blocking I/O operations. The attributes
    is_non_blocking and is_infinite are set accordingly.
    �	monotoniccCs>|du|_|dk|_||_|dur|��||_dSd|_dS)z(Initialize a timeout with given durationNr)�is_infinite�is_non_blocking�duration�TIME�target_time�r4r<rrrr2s


zTimeout.__init__cCs|jduo
|��dkS)z4Return a boolean, telling if the timeout has expiredNr)r>�	time_leftr3rrr�expired�szTimeout.expiredcCsL|jrdS|jr
dS|j|��}||jkr!|��|j|_|jStd|�S)z:Return how many seconds are left until the timeout expiresrN)r;r:r>r=r<�max)r4�deltarrrr@�s

zTimeout.time_leftcCs||_|��||_dS)zb        Restart a timeout, only supported if a timeout was already set up
        before.
        N)r<r=r>r?rrr�restart�szTimeout.restartN)rrrr-�hasattr�timer9r=r2rAr@rDrrrrr8js

r8c@seZdZdZdZeeeefZ	e
eee
efZeeefZddee
edddddddfdd�Zedd	��Zejd
d	��Zedd��Zejd
d��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zed d!��Zejd"d!��Zed#d$��Z e jd%d$��Z ed&d'��Z!e!jd(d'��Z!ed)d*��Z"e"jdwd+d*��Z"ed,d-��Z#e#jd.d-��Z#ed/d0��Z$e$jd1d0��Z$ed2d3��Z%e%jd4d3��Z%ed5d6��Z&e&jd7d6��Z&d8Z'd9d:�Z(d;d<�Z)d=d>�Z*d?d@�Z+dAdB�Z,dCdD�Z-dEdF�Z.dGdH�Z/dIdJ�Z0dxdLdM�Z1dNdO�Z2dPdQ�Z3dRdS�Z4dxdTdU�Z5dydWdX�Z6dydYdZ�Z7d[d\�Z8d]d^�Z9d_d`�Z:dadb�Z;dcdd�Z<ededf��Z=e=jdgdf��Z=edhdi��Z>e>jdjdi��Z>dkdl�Z?dmdn�Z@dodp�ZAdqdr�ZBeCdfdsdt�ZDdudv�ZEdS)z�
SerialBasezh    Serial port base class. Provides __init__ function and properties to
    get/set port settings.
    )�2�K�n����i,iXi�ii`	i��%iKi�i�i�i�ii �i�ii@Bi�i`�i��i�%&i��-i�g5i	=NrNFc
Ksd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_||_||_||_||_||_||_|	|_||_||_|
|_||_||_d|
vrg|
�d�|_d|
vrq|
�d�|_|
rzt d�!|
���|dur�|�"�dSdS)z�        Initialize comm port object. If a "port" is given, then the port will be
        opened immediately. Otherwise a Serial port object in closed state
        is returned.
        FNT�writeTimeout�interCharTimeoutz"unexpected keyword arguments: {!r})#�is_open�portstr�name�_port�	_baudrate�	_bytesize�_parity�	_stopbits�_timeout�_write_timeout�_xonxoff�_rtscts�_dsrdtr�_inter_byte_timeout�_rs485_mode�
_rts_state�
_dtr_state�_break_state�
_exclusive�port�baudrate�bytesize�parity�stopbits�timeout�
write_timeout�xonxoff�rtscts�dsrdtr�inter_byte_timeout�	exclusive�pop�
ValueErrorr�open)r4rdrerfrgrhrirkrlrjrmrnro�kwargsrrrr2�sP�zSerialBase.__init__cC�|jS)z{        Get the current port setting. The value that was passed on init or using
        setPort() is passed back.
        )rTr3rrrrd��zSerialBase.portcCs^|durt|t�std�t|����|j}|r|��||_||_|j|_	|r-|�
�dSdS)z!        Change the port.
        Nz'"port" must be None or a string, not {})r
�
basestringrqr�typerQ�closerRrTrSrr)r4rd�was_openrrrrds�cCrt)z"Get the current baud rate setting.)rUr3rrrre�zSerialBase.baudratecCs\zt|�}Wntytd�|���w|dkr td�|���||_|jr,|��dSdS)z�        Change baud rate. It raises a ValueError if the port is open and the
        baud rate is not possible. If the port is closed, then the value is
        accepted and the exception is raised when the port is opened.
        zNot a valid baudrate: {!r}rN)�intrrqrrUrQ�_reconfigure_port)r4rerrrrres��cCrt)z"Get the current byte size setting.)rVr3rrrrf-rzzSerialBase.bytesizecC�4||jvrtd�|���||_|jr|��dSdS)zChange byte size.zNot a valid byte size: {!r}N)�	BYTESIZESrqrrVrQr|)r4rfrrrrf2�
�cCrt)z)Get the current exclusive access setting.)rcr3rrrro;rzzSerialBase.exclusivecC�||_|jr|��dSdS)z$Change the exclusive access setting.N)rcrQr|)r4rorrrro@��cCrt)zGet the current parity setting.)rWr3rrrrgGrzzSerialBase.paritycCr})zChange parity setting.zNot a valid parity: {!r}N)�PARITIESrqrrWrQr|)r4rgrrrrgLrcCrt)z"Get the current stop bits setting.)rXr3rrrrhUrzzSerialBase.stopbitscCr})zChange stop bits size.zNot a valid stop bit size: {!r}N)�STOPBITSrqrrXrQr|)r4rhrrrrhZrcCrt�z Get the current timeout setting.)rYr3rrrricrzzSerialBase.timeoutcCsd|dur$z|dWntytd�|���w|dkr$td�|���||_|jr0|��dSdS)�Change timeout setting.Nr	�Not a valid timeout: {!r}r)rrqrrYrQr|�r4rirrrrihs��cCrtr�)rZr3rrrrjvrzzSerialBase.write_timeoutcC�d|dur$|dkrtd�|���z|dWnty#td�|���w||_|jr0|��dSdS)r�Nrr�r	)rqrrrZrQr|r�rrrrj{���cCrt)z0Get the current inter-character timeout setting.)r^r3rrrrn�rzzSerialBase.inter_byte_timeoutcCr�)z"Change inter-byte timeout setting.Nrr�r	)rqrrr^rQr|)r4�
ic_timeoutrrrrn�r�cCrt)z!Get the current XON/XOFF setting.)r[r3rrrrk�rzzSerialBase.xonxoffcCr�)zChange XON/XOFF setting.N)r[rQr|)r4rkrrrrk�r�cCrt)z-Get the current RTS/CTS flow control setting.)r\r3rrrrl�rzzSerialBase.rtsctscCr�)z$Change RTS/CTS flow control setting.N)r\rQr|)r4rlrrrrl�r�cCrt)z-Get the current DSR/DTR flow control setting.)r]r3rrrrm�rzzSerialBase.dsrdtrcCs.|dur	|j|_n||_|jr|��dSdS)z#Change DsrDtr flow control setting.N)r\r]rQr|)r4rmrrrrm�s
�cCrt�N)r`r3rrr�rts��zSerialBase.rtscC�||_|jr|��dSdSr�)r`rQ�_update_rts_state�r4�valuerrrr����cCrtr�)rar3rrr�dtr�r�zSerialBase.dtrcCr�r�)rarQ�_update_dtr_stater�rrrr��r�cCrtr�)rbr3rrr�break_condition�r�zSerialBase.break_conditioncCr�r�)rbrQ�_update_break_stater�rrrr��r�cCrt)z�        Enable RS485 mode and apply new settings, set to None to disable.
        See serial.rs485.RS485Settings for more info about the value.
        )r_r3rrr�
rs485_mode�ruzSerialBase.rs485_modecCr�r�)r_rQr|)r4�rs485_settingsrrrr��r�)
rerfrgrhrkrmrlrirjrncst�fdd��jD��S)zb        Get current port settings as a dictionary. For use with
        apply_settings().
        csg|]}|t�d|�f�qS)�_)�getattr)�.0�keyr3rr�
<listcomp>sz+SerialBase.get_settings.<locals>.<listcomp>)�dict�_SAVED_SETTINGSr3rr3r�get_settings�szSerialBase.get_settingscCs>|jD]}||vr||t|d|�krt||||�qdS)z�        Apply stored settings from a dictionary returned from
        get_settings(). It's allowed to delete keys from the dictionary. These
        values will simply left unchanged.
        r�N)r�r��setattr)r4�dr�rrr�apply_settingss

��zSerialBase.apply_settingscCsdj|jjt|�|d�S)zAString representation of the current port settings and its state.z�{name}<id=0x{id:x}, open={p.is_open}>(port={p.portstr!r}, baudrate={p.baudrate!r}, bytesize={p.bytesize!r}, parity={p.parity!r}, stopbits={p.stopbits!r}, timeout={p.timeout!r}, xonxoff={p.xonxoff!r}, rtscts={p.rtscts!r}, dsrdtr={p.dsrdtr!r}))rS�id�p)rr6rr�r3rrr�__repr__s�zSerialBase.__repr__cC�dS�NTrr3rrr�readable�zSerialBase.readablecCr�r�rr3rrr�writabler�zSerialBase.writablecCr�)NFrr3rrr�seekable!r�zSerialBase.seekablec
Cs||�t|��}t|�}z	||d|�<W|Sty=}zddl}t||j�s(|�|�d|�|d|�<WYd}~|Sd}~ww)Nrr)�read�lenr�arrayr
)r4r�data�n�errr�rrr�readinto$s���zSerialBase.readintocCs|jdur|js|��|Sr�)rTrQrrr3rrr�	__enter__3szSerialBase.__enter__cO�|��dSr�)rx)r4�argsrsrrr�__exit__8�zSerialBase.__exit__��?cCs&|jst��d|_t�|�d|_dS)za        Send break condition. Timed, returns to idle state after given
        duration.
        TFN)rQr0r�rF�sleepr?rrr�
send_break=s


zSerialBase.send_breakcCr�r�)�reset_input_bufferr3rrr�
flushInputKr�zSerialBase.flushInputcCr�r�)�reset_output_bufferr3rrr�flushOutputNr�zSerialBase.flushOutputcCrtr�)�
in_waitingr3rrr�	inWaitingQ�zSerialBase.inWaitingcC�|�|�dSr�)r�r?rrr�	sendBreakT�zSerialBase.sendBreakr	cC�
||_dSr�)r�r�rrr�setRTSW�
zSerialBase.setRTScCr�r�)r�r�rrr�setDTRZr�zSerialBase.setDTRcCrtr�)�ctsr3rrr�getCTS]r�zSerialBase.getCTScCrtr�)�dsrr3rrr�getDSR`r�zSerialBase.getDSRcCrtr�)�rir3rrr�getRIcr�zSerialBase.getRIcCrtr�)�cdr3rrr�getCDfr�zSerialBase.getCDcCr�r�)rd)r4rdrrr�setPortir�zSerialBase.setPortcCrtr��rjr3rrrrOlr�zSerialBase.writeTimeoutcCr�r�r�r�rrrrOp�
cCrtr��rnr3rrrrPtr�zSerialBase.interCharTimeoutcCr�r�r�)r4rPrrrrPxr�cCs|��Sr�)r�r3rrr�getSettingsDict|szSerialBase.getSettingsDictcCr�r�)r�)r4r�rrr�applySettingsDictr�zSerialBase.applySettingsDictcCrtr�)rQr3rrr�isOpen�r�zSerialBase.isOpencCs|�|j�S)zL        Read all bytes currently available in the buffer of the OS.
        )r�r�r3rrr�read_all�szSerialBase.read_allcCs�t|�}t�}t|j�}	|�d�}|r6||7}||d�|kr&	t|�S|dur5t|�|kr5	t|�Sn	t|�S|��rD	t|�Sq
)z�        Read until an expected sequence is found ('
' by default), the size
        is exceeded or until timeout occurs.
        Tr	N)r�rr8rYr�rAr)r4�expected�size�lenterm�lineri�crrr�
read_until�s(

�����zSerialBase.read_untilcos$�	|j|i|��}|sdS|Vq)zs        Read lines, implemented as generator. It will raise StopIteration on
        timeout (empty read).
        TN)r�)r4r�rsr�rrr�iread_until�s��zSerialBase.iread_untilr�)r�)r	)Frrrr-�	BAUDRATES�FIVEBITS�SIXBITS�	SEVENBITS�	EIGHTBITSr~�PARITY_NONE�PARITY_EVEN�
PARITY_ODD�PARITY_MARK�PARITY_SPACEr��STOPBITS_ONE�STOPBITS_ONE_POINT_FIVE�STOPBITS_TWOr�r2�propertyrd�setterrerfrorgrhrirjrnrkrlrmr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rOrPr�r�r�r��LFr�r�rrrrrG�s�

�J






































rG�__main__zport name:  {}
zbaud rates: {}
zbyte sizes: {}
zparities:   {}
zstop bits:  {}
z{}
)0�
__future__r�iorFr�	NameError�AttributeError�objectr�strrvrr�XON�XOFF�CRr�r�r�r�r�r�r�r�r�r�r�r�r��PARITY_NAMES�IOErrorr+r/r0r8�	RawIOBaserGr�sys�s�stdout�writerrSr�r~r�r�rrrr�<module>sh	��
�




�	;�

Spamworldpro Mini