+
    &a_%U              
       T   ^ RI Ht ^ RIt^ RIt ]  ]  ]
 R tR t]! ^.4      t]! ^.4      t]! ^.4      t]! ^
.4      tRw  ttttt^R^utttRw  tttt]R]R	]R
]R]R/t ! R R]4      t ! R R]4      t  ! R R]4      t! ! R R]4      t" ! R R]PF                  4      t$]%R8X  Ed<   ^ RI&t&]$! 4       t']&PP                  PS                  RPU                  ]'PV                  4      4       ]&PP                  PS                  RPU                  ]'PX                  4      4       ]&PP                  PS                  RPU                  ]'PZ                  4      4       ]&PP                  PS                  RPU                  ]'P\                  4      4       ]&PP                  PS                  RPU                  ]'P^                  4      4       ]&PP                  PS                  RPU                  ]'4      4       R# R#   ]]3 d     ! R R]4      t ELi ; i  ]]3 d    ]	t ELi ; i  ]]3 d    ]	3t
 ELi ; i)     )absolute_importNc                       ] tR t^tRtR# )
memoryview N)__name__
__module____qualname____firstlineno____static_attributes__r       3/usr/lib/python3/dist-packages/serial/serialutil.pyr   r      s    r   r   c              #     "   \        V \        4      '       d   V P                  4       p ^ p WV^,            pV^,          pV'       d   Vx  K#  R# 5i)z=Iterate over bytes, returning bytes instead of ints (python3)N)
isinstancer   tobytes)bias   &  r   	iterbytesr   (   sF     !Z  IIK	A
AJ	QGs   AAc                H   \        V \        4      '       d   V # \        V \        4      '       d   \        V 4      # \        V \        4      '       d   V P	                  4       # \        V \
        4      '       d   \        RP                  V 4      4      h\        \        V 4      4      # )z"convert a sequence to a bytes typez?unicode strings are not supported, please encode to bytes: {!r})r   bytes	bytearrayr   r   unicode	TypeErrorformat)seqs   &r   to_bytesr   8   sz    #u
	C	#	#Sz	C	$	${{}	C	!	!Y``adeff Ys^$$r   g      ?NoneEvenOddMarkSpacec                       ] tR t^\tRtRtR# )SerialExceptionz.Base class for serial port related exceptions.r   Nr   r   r	   r
   __doc__r   r   r   r   r#   r#   \   s    8r   r#   c                       ] tR t^`tRtRtR# )SerialTimeoutExceptionz Write timeouts give an exceptionr   Nr$   r   r   r   r'   r'   `   s    *r   r'   c                   6   a a ] tR t^dt oRtV 3R ltRtVtV ;t# )PortNotOpenErrorzPort is not openc                .   < \         \        V `  R 4       R# )z)Attempting to use a port that is not openN)superr)   __init__)self	__class__s   &r   r,   PortNotOpenError.__init__f   s    ./Z[r   r   )	r   r   r	   r
   r%   r,   r   __classdictcell____classcell__)r.   __classdict__s   @@r   r)   r)   d   s     \ \r   r)   c                      a  ] tR t^jt o Rt]! ]R4      '       d   ]P                  tM]P                  tR t	R t
R tR tRtV tR# )	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.
	monotonicc                    VRJ V n         V^ 8H  V n        Wn        Ve   V P                  4       V,           V n        R# RV n        R# )z(Initialize a timeout with given durationN)is_infiniteis_non_blockingdurationTIMEtarget_timer-   r9   s   &&r   r,   Timeout.__init__   sA    $, (A #yy{X5D#Dr   c                T    V P                   RJ;'       d    V P                  4       ^ 8*  # )z4Return a boolean, telling if the timeout has expiredN)r;   	time_leftr-   s   &r   expiredTimeout.expired   s'    t+EE0@A0EEr   c                0   V P                   '       d   ^ # V P                  '       d   R# V P                  V P                  4       ,
          pWP                  8  d3   V P                  4       V P                  ,           V n        V P                  # \        ^ V4      # )z:Return how many seconds are left until the timeout expiresN)r8   r7   r;   r:   r9   max)r-   deltas   & r   r?   Timeout.time_left   sm    $$tyy{2E}}$#'99;#> }}$1e}$r   c                J    Wn         V P                  4       V,           V n        R# )zJRestart a timeout, only supported if a timeout was already set up
before.
N)r9   r:   r;   r<   s   &&r   restartTimeout.restart   s    
 !99;1r   )r9   r7   r8   r;   N)r   r   r	   r
   r%   hasattrtimer5   r:   r,   rA   r?   rH   r   r0   r2   s   @r   r4   r4   j   sI      t[!!
 ~~
 yy$F%2 2r   r4   c                     a  ] tR t^t o RtRFt]]]]	3t
]]]]]3t]]]3tRR]	]]RRRRRRR3R lt]R 4       t]P0                  R 4       t]R 4       t]P0                  R	 4       t]R
 4       t]P0                  R 4       t]R 4       t]P0                  R 4       t]R 4       t]P0                  R 4       t]R 4       t]P0                  R 4       t]R 4       t]P0                  R 4       t]R 4       t]P0                  R 4       t]R 4       t ] P0                  R 4       t ]R 4       t!]!P0                  R 4       t!]R 4       t"]"P0                  R 4       t"]R 4       t#]#P0                  RGR l4       t#]R 4       t$]$P0                  R 4       t$]R  4       t%]%P0                  R! 4       t%]R" 4       t&]&P0                  R# 4       t&]R$ 4       t']'P0                  R% 4       t'RHt(R& t)R' t*R( t+R) t,R* t-R+ t.R, t/R- t0R. t1RIR/ lt2R0 t3R1 t4R2 t5RIR3 lt6RJR4 lt7RJR5 lt8R6 t9R7 t:R8 t;R9 t<R: t=]R; 4       t>]>P0                  R< 4       t>]R= 4       t?]?P0                  R> 4       t?R? t@R@ tARA tBRB tC]DR3RC ltERD tFREtGV tHR# )K
SerialBasez\Serial port base class. Provides __init__ function and properties to
get/set port settings.
%  NFc                   RV n         RV n        RV n        RV n        RV n        RV n        RV n        RV n        RV n        RV n	        RV n
        RV n        RV n        RV n        RV n        RV n        RV n        RV n        RV n        Wn        W n        W0n        W@n        WPn        W`n        Wn        Wpn        Wn        Wn        Wn        Wn        RV9   d   VP?                  R4      V n        RV9   d   VP?                  R4      V n        V'       d   \A        RPC                  V4      4      hVe   V PE                  4        R# R# )zInitialize 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)r-   rf   rg   rh   ri   rj   rk   rm   rn   rl   ro   rp   rq   kwargss   &&&&&&&&&&&&&,r   r,   SerialBase.__init__   s0   ( 	
"#' ! 	   *"4" V#!'N!;D'&,jj1C&DD#AHHPQQIIK r   c                    V P                   # )zcGet the current port setting. The value that was passed on init or using
setPort() is passed back.
)rV   r@   s   &r   rf   SerialBase.port   s     zzr   c                6   Ve:   \        V\        4      '       g$   \        RP                  \	        V4      4      4      hV P
                  pV'       d   V P                  4        Wn        Wn        V P                  V n	        V'       d   V P                  4        R# R# )zChange the port.
        Nz'"port" must be None or a string, not {})r   
basestringrs   r   typerS   closerT   rV   rU   rt   )r-   rf   was_opens   && r   rf   rx     sm    
 JtZ$@$@FMMdSWjYZZ<<JJL
LL	IIK r   c                    V P                   # )z"Get the current baud rate setting.)rW   r@   s   &r   rg   SerialBase.baudrate       ~~r   c                    \        V4      pV^ 8  d   \        RP                  V4      4      hW n        V P                  '       d   V P                  4        R# R#   \         d    \        RP                  T4      4      hi ; i)zChange 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.
zNot a valid baudrate: {!r}N)intrs   r   rW   rS   _reconfigure_portr   )r-   rg   r   s   && r   rg   r     sy    		)HA 1u !=!D!DX!NOON|||&&(   	L9@@JKK	Ls   A &B c                    V P                   # )z"Get the current byte size setting.)rX   r@   s   &r   rh   SerialBase.bytesize-  r   r   c                    WP                   9  d   \        RP                  V4      4      hWn        V P                  '       d   V P                  4        R# R# )zChange byte size.zNot a valid byte size: {!r}N)	BYTESIZESrs   r   rX   rS   r   )r-   rh   s   &&r   rh   r   2  sD     >>):AA(KLL!<<<""$ r   c                    V P                   # )z)Get the current exclusive access setting.)re   r@   s   &r   rq   SerialBase.exclusive;  s     r   c                Z    Wn         V P                  '       d   V P                  4        R# R# )z$Change the exclusive access setting.N)re   rS   r   )r-   rq   s   &&r   rq   r   @  s#     $<<<""$ r   c                    V P                   # )zGet the current parity setting.)rY   r@   s   &r   ri   SerialBase.parityG       ||r   c                    WP                   9  d   \        RP                  V4      4      hWn        V P                  '       d   V P                  4        R# R# )zChange parity setting.zNot a valid parity: {!r}N)PARITIESrs   r   rY   rS   r   )r-   ri   s   &&r   ri   r   L  sD     &7>>vFGG<<<""$ r   c                    V P                   # )z"Get the current stop bits setting.)rZ   r@   s   &r   rj   SerialBase.stopbitsU  r   r   c                    WP                   9  d   \        RP                  V4      4      hWn        V P                  '       d   V P                  4        R# R# )zChange stop bits size.zNot a valid stop bit size: {!r}N)STOPBITSrs   r   rZ   rS   r   )r-   rj   s   &&r   rj   r   Z  sD     ==(>EEhOPP!<<<""$ r   c                    V P                   # z Get the current timeout setting.)r[   r@   s   &r   rk   SerialBase.timeoutc       }}r   c                
   Ve,    V^,            T^ 8  d   \        RP                  T4      4      hWn        V P                  '       d   V P                  4        R# R#   \          d    \        RP                  T4      4      hi ; izChange timeout setting.NNot a valid timeout: {!r})r   rs   r   r[   rS   r   r-   rk   s   &&r   rk   r   h  s     N! { !<!C!CG!LMM<<<""$   N !<!C!CG!LMMNs   	A &Bc                    V P                   # r   )r\   r@   s   &r   rl   SerialBase.write_timeoutv  s     """r   c                
   Ve,   V^ 8  d   \        RP                  V4      4      h V^,            Wn        V P                  '       d   V P                  4        R# R#   \         d    \        RP                  T4      4      hi ; ir   )rs   r   r   r\   rS   r   r   s   &&r   rl   r   {  s     { !<!C!CG!LMMN! &<<<""$ 	  N !<!C!CG!LMMN   	A &Bc                    V P                   # )z0Get the current inter-character timeout setting.)r`   r@   s   &r   rp   SerialBase.inter_byte_timeout  s     '''r   c                
   Ve,   V^ 8  d   \        RP                  V4      4      h V^,            Wn        V P                  '       d   V P                  4        R# R#   \         d    \        RP                  T4      4      hi ; i)z"Change inter-byte timeout setting.Nr   )rs   r   r   r`   rS   r   )r-   
ic_timeouts   &&r   rp   r     s     !A~ !<!C!CJ!OPPQQ $. <<<""$ 	  Q !<!C!CJ!OPPQr   c                    V P                   # )z!Get the current XON/XOFF setting.)r]   r@   s   &r   rm   SerialBase.xonxoff  r   r   c                Z    Wn         V P                  '       d   V P                  4        R# R# )zChange XON/XOFF setting.N)r]   rS   r   )r-   rm   s   &&r   rm   r     s#      <<<""$ r   c                    V P                   # )z-Get the current RTS/CTS flow control setting.)r^   r@   s   &r   rn   SerialBase.rtscts  r   r   c                Z    Wn         V P                  '       d   V P                  4        R# R# )z$Change RTS/CTS flow control setting.N)r^   rS   r   )r-   rn   s   &&r   rn   r     s#     <<<""$ r   c                    V P                   # )z-Get the current DSR/DTR flow control setting.)r_   r@   s   &r   ro   SerialBase.dsrdtr  r   r   c                    Vf   V P                   V n        MWn        V P                  '       d   V P                  4        R# R# )z#Change DsrDtr flow control setting.N)r^   r_   rS   r   )r-   ro   s   &&r   ro   r     s5     ><<DL "L<<<""$ r   c                    V P                   # N)rb   r@   s   &r   rtsSerialBase.rts      r   c                Z    Wn         V P                  '       d   V P                  4        R # R # r   )rb   rS   _update_rts_stater-   values   &&r   r   r     !    <<<""$ r   c                    V P                   # r   )rc   r@   s   &r   dtrSerialBase.dtr  r   r   c                Z    Wn         V P                  '       d   V P                  4        R # R # r   )rc   rS   _update_dtr_stater   s   &&r   r   r     r   r   c                    V P                   # r   )rd   r@   s   &r   break_conditionSerialBase.break_condition  s       r   c                Z    Wn         V P                  '       d   V P                  4        R # R # r   )rd   rS   _update_break_stater   s   &&r   r   r     s"    !<<<$$& r   c                    V P                   # )zEnable RS485 mode and apply new settings, set to None to disable.
See serial.rs485.RS485Settings for more info about the value.
)ra   r@   s   &r   
rs485_modeSerialBase.rs485_mode  s     r   c                Z    Wn         V P                  '       d   V P                  4        R # R # r   )ra   rS   r   )r-   rs485_settingss   &&r   r   r     s"    )<<<""$ r   c                z    \        V P                   Uu. uF  q\        V RV,           4      3NK  	  up4      # u upi )zJGet current port settings as a dictionary. For use with
apply_settings().
_)dict_SAVED_SETTINGSgetattr)r-   keys   & r   get_settingsSerialBase.get_settings  s7    
 @T@TU@T74s34@TUVVUs   8c                    V P                    F=  pW!9   g   K  W,          \        V RV,           4      8w  g   K+  \        WW,          4       K?  	  R# )zApply 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)r-   dr   s   && r   apply_settingsSerialBase.apply_settings  s9     ''CxAFgdC#I&>>16* (r   c                d    RP                  V P                  P                  \        V 4      V R7      # )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}))rU   idp)r   r.   r   r   r@   s   &r   __repr__SerialBase.__repr__  s6    ; <B6//BtH <B <F	Fr   c                    R # Tr   r@   s   &r   readableSerialBase.readable      r   c                    R # r   r   r@   s   &r   writableSerialBase.writable  r   r   c                    R # )Fr   r@   s   &r   seekableSerialBase.seekable!  s    r   c                    V P                  \        V4      4      p\        V4      p W!R V% V#   \         dB   p^ R Ip\	        YP                  4      '       g   ThTP                  RT4      TR T%  R p?T# R p?ii ; i)Nr   )readlenr   arrayr   )r-   r   datanerrr   s   &&    r   readintoSerialBase.readinto$  sv    yyQ I	+bqE   	+a--	KKT*AbqE	+s   - A96A44A9c                f    V P                   e#   V P                  '       g   V P                  4        V # r   )rV   rS   rt   r@   s   &r   	__enter__SerialBase.__enter__3  s"    ::!$,,,IIKr   c                &    V P                  4        R # r   )r|   )r-   argsru   s   &*,r   __exit__SerialBase.__exit__8  s    

r   c                    V P                   '       g   \        4       hRV n        \        P                  ! V4       RV n        R# )zISend break condition. Timed, returns to idle state after given
duration.
TFN)rS   r)   r   rK   sleepr<   s   &&r   
send_breakSerialBase.send_break=  s2    
 |||"$$#

8$r   c                &    V P                  4        R # r   )reset_input_bufferr@   s   &r   
flushInputSerialBase.flushInputK  s    !r   c                &    V P                  4        R # r   )reset_output_bufferr@   s   &r   flushOutputSerialBase.flushOutputN  s      "r   c                    V P                   # r   )
in_waitingr@   s   &r   	inWaitingSerialBase.inWaitingQ  s    r   c                (    V P                  V4       R # r   )r   r<   s   &&r   	sendBreakSerialBase.sendBreakT  s    !r   c                    Wn         R # r   )r   r   s   &&r   setRTSSerialBase.setRTSW      r   c                    Wn         R # r   )r   r   s   &&r   setDTRSerialBase.setDTRZ  r	  r   c                    V P                   # r   )ctsr@   s   &r   getCTSSerialBase.getCTS]      xxr   c                    V P                   # r   )dsrr@   s   &r   getDSRSerialBase.getDSR`  r  r   c                    V P                   # r   )rir@   s   &r   getRISerialBase.getRIc      wwr   c                    V P                   # r   )cdr@   s   &r   getCDSerialBase.getCDf  r  r   c                    Wn         R # r   )rf   )r-   rf   s   &&r   setPortSerialBase.setPorti  s    	r   c                    V P                   # r   rl   r@   s   &r   rQ   SerialBase.writeTimeoutl  s    !!!r   c                    Wn         R # r   r#  r   s   &&r   rQ   r$  p  s    $r   c                    V P                   # r   rp   r@   s   &r   rR   SerialBase.interCharTimeoutt  s    &&&r   c                    Wn         R # r   r'  )r-   rR   s   &&r   rR   r(  x  s    "2r   c                "    V P                  4       # r   )r   r@   s   &r   getSettingsDictSerialBase.getSettingsDict|  s      ""r   c                (    V P                  V4       R # r   )r   )r-   r   s   &&r   applySettingsDictSerialBase.applySettingsDict  s    Ar   c                    V P                   # r   )rS   r@   s   &r   isOpenSerialBase.isOpen  s    ||r   c                8    V P                  V P                  4      # )zDRead all bytes currently available in the buffer of the OS.
        )r   r   r@   s   &r   read_allSerialBase.read_all  s     yy))r   c                &   \        V4      p\        4       p\        V P                  4      p V P	                  ^4      pV'       d*   WF,          pWC) R V8X  d   M0Ve   \        V4      V8  d   MMMVP                  4       '       g   K\   \        V4      # )zyRead until an expected sequence is found ('
' by default), the size
        is exceeded or until timeout occurs.
        N)r   r   r4   r[   r   rA   r   )r-   expectedsizelentermlinerk   cs   &&&    r   
read_untilSerialBase.read_until  s    
 h-{$--(		!A		?h.#D	T(9  T{r   c              /  P   "    V P                   ! V/ VB pV'       g   R# Vx  K#  5i)z[Read lines, implemented as generator. It will raise StopIteration on
timeout (empty read).
N)r<  )r-   r   ru   r:  s   &*, r   iread_untilSerialBase.iread_until  s(     
 ??D3F3DJs   &&)"rW   rd   rX   r_   rc   re   r`   rY   rV   ra   rb   r^   rZ   r[   r\   r]   rg   r   rh   ro   r   rq   rp   rS   rU   ri   rf   rT   r   rn   rj   rk   rl   rm   )2   K   n            i,  iX  i  i  i`	  i  rO   i K  i   i   i  i  i  i  i  i  i@B i  i` i i%& i- ig5 i 	= r   )
rg   rh   ri   rj   rm   ro   rn   rk   rl   rp   )g      ?)   )Ir   r   r	   r
   r%   	BAUDRATESFIVEBITSSIXBITS	SEVENBITS	EIGHTBITSr   PARITY_NONEPARITY_EVEN
PARITY_ODDPARITY_MARKPARITY_SPACEr   STOPBITS_ONESTOPBITS_ONE_POINT_FIVESTOPBITS_TWOr   r,   propertyrf   setterrg   rh   rq   ri   rj   rk   rl   rp   rm   rn   ro   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  r   rQ   rR   r+  r.  r1  r4  LFr<  r?  r   r0   rL   s   @r   rN   rN      s-    ,I 7Iy9I[*k<PH5|DH ##&#$(@T   
[[    __) )"   __% %   % %   ]]% %   __% %   ^^% % # # % % ( ( % %   ^^% %   ]]% %   ]]	% 	%   	ZZ% %
   	ZZ% %
 ! ! ' '     % %-OW+F


	%"#" " " % % ' ' 3 3#* #%4 ,	 	r   rN   __main__zport name:  {}
zbaud rates: {}
zbyte sizes: {}
zparities:   {}
zstop bits:  {}
z{}
)NEOMS)            )0
__future__r   iorK   r   	NameErrorAttributeErrorobjectr   strrz   r   r   XONXOFFCRrW  rM  rN  rO  rP  rQ  rR  rS  rT  rI  rJ  rK  rL  PARITY_NAMESIOErrorr#   r'   r)   r4   	RawIOBaserN   r   syssstdoutwriter   rU   rH  r   r   r   r   r   r   <module>rr     s2   ' 	  %  tn~rd^rd^ CZ ?[*k<78#q 3%|*6 ''9i '9g 9+_ +\ \82f 82vH HX zAJJ'..qvv67JJ'..q{{;<JJ'..q{{;<JJ'..qzz:;JJ'..qzz:;JJV]]1%& w 	>" V  	>" G
 	>" Js3   G* H H *HHHHH'&H'