
    F\h8*                         S r Sr " S S5      r " S S\5      r " S S\5      r " S S	\\5      r " S
 S\5      r " S S\5      r " S S\5      rg)zAbstract Transport class.)BaseTransportReadTransportWriteTransport	TransportDatagramTransportSubprocessTransportc                   H    \ rS rSrSrSrSS jrSS jrS rS r	S	 r
S
 rSrg)r   	   zBase class for transports._extraNc                     Uc  0 nXl         g Nr
   )selfextras     )/usr/lib/python3.13/asyncio/transports.py__init__BaseTransport.__init__   s    =E    c                 8    U R                   R                  X5      $ )z#Get optional transport information.)r   get)r   namedefaults      r   get_extra_infoBaseTransport.get_extra_info   s    {{t--r   c                     [         e)z2Return True if the transport is closing or closed.NotImplementedErrorr   s    r   
is_closingBaseTransport.is_closing       !!r   c                     [         e)zClose the transport.

Buffered data will be flushed asynchronously.  No more data
will be received.  After all buffered data is flushed, the
protocol's connection_lost() method will (eventually) be
called with None as its argument.
r   r   s    r   closeBaseTransport.close   s
     "!r   c                     [         e)zSet a new protocol.r   )r   protocols     r   set_protocolBaseTransport.set_protocol%   r    r   c                     [         e)zReturn the current protocol.r   r   s    r   get_protocolBaseTransport.get_protocol)   r    r   r   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r   r"   r&   r)   __static_attributes__ r   r   r   r   	   s(    $I
.""""r   r   c                   .    \ rS rSrSrSrS rS rS rSr	g)r   .   z#Interface for read-only transports.r2   c                     [         e)z*Return True if the transport is receiving.r   r   s    r   
is_readingReadTransport.is_reading3   r    r   c                     [         e)z|Pause the receiving end.

No data will be passed to the protocol's data_received()
method until resume_reading() is called.
r   r   s    r   pause_readingReadTransport.pause_reading7   
     "!r   c                     [         e)zmResume the receiving end.

Data received will once again be passed to the protocol's
data_received() method.
r   r   s    r   resume_readingReadTransport.resume_reading?   r;   r   N)
r+   r,   r-   r.   r/   r0   r6   r9   r=   r1   r2   r   r   r   r   .   s    -I"""r   r   c                   P    \ rS rSrSrSrSS jrS rS rS r	S	 r
S
 rS rS rSrg)r   H   z$Interface for write-only transports.r2   Nc                     [         e)a.  Set the high- and low-water limits for write flow control.

These two values control when to call the protocol's
pause_writing() and resume_writing() methods.  If specified,
the low-water limit must be less than or equal to the
high-water limit.  Neither value can be negative.

The defaults are implementation-specific.  If only the
high-water limit is given, the low-water limit defaults to an
implementation-specific value less than or equal to the
high-water limit.  Setting high to zero forces low to zero as
well, and causes pause_writing() to be called whenever the
buffer becomes non-empty.  Setting low to zero causes
resume_writing() to be called only once the buffer is empty.
Use of zero for either limit is generally sub-optimal as it
reduces opportunities for doing I/O and computation
concurrently.
r   r   highlows      r   set_write_buffer_limits&WriteTransport.set_write_buffer_limitsM   s
    & "!r   c                     [         e)z,Return the current size of the write buffer.r   r   s    r   get_write_buffer_size$WriteTransport.get_write_buffer_sizeb   r    r   c                     [         e)zGet the high and low watermarks for write flow control.
Return a tuple (low, high) where low and high are
positive number of bytes.r   r   s    r   get_write_buffer_limits&WriteTransport.get_write_buffer_limitsf   s
     "!r   c                     [         e)zWrite some data bytes to the transport.

This does not block; it buffers the data and arranges for it
to be sent out asynchronously.
r   )r   datas     r   writeWriteTransport.writel   r;   r   c                 H    SR                  U5      nU R                  U5        g)zWrite a list (or any iterable) of data bytes to the transport.

The default implementation concatenates the arguments and
calls write() on the result.
r   N)joinrO   )r   list_of_datarN   s      r   
writelinesWriteTransport.writelinest   s     xx%

4r   c                     [         e)zClose the write end after flushing buffered data.

(This is like typing ^D into a UNIX program reading from stdin.)

Data may still be received.
r   r   s    r   	write_eofWriteTransport.write_eof}   
     "!r   c                     [         e)zAReturn True if this transport supports write_eof(), False if not.r   r   s    r   can_write_eofWriteTransport.can_write_eof   r    r   c                     [         ezClose the transport immediately.

Buffered data will be lost.  No more data will be received.
The protocol's connection_lost() method will (eventually) be
called with None as its argument.
r   r   s    r   abortWriteTransport.abort   rY   r   NN)r+   r,   r-   r.   r/   r0   rE   rH   rK   rO   rT   rW   r[   r_   r1   r2   r   r   r   r   H   s2    .I"*""""""r   r   c                       \ rS rSrSrSrSrg)r      a  Interface representing a bidirectional transport.

There may be several implementations, but typically, the user does
not implement new transports; rather, the platform provides some
useful transports that are implemented using the platform's best
practices.

The user never instantiates a transport directly; they call a
utility function, passing it a protocol factory and other
information necessary to create the transport and protocol.  (E.g.
EventLoop.create_connection() or EventLoop.create_server().)

The utility function will asynchronously create a transport and a
protocol and hook them up by calling the protocol's
connection_made() method, passing it the transport.

The implementation here raises NotImplemented for every method
except writelines(), which calls write() in a loop.
r2   N)r+   r,   r-   r.   r/   r0   r1   r2   r   r   r   r      s    ( Ir   r   c                   ,    \ rS rSrSrSrSS jrS rSrg)r      z(Interface for datagram (UDP) transports.r2   Nc                     [         e)a   Send data to the transport.

This does not block; it buffers the data and arranges for it
to be sent out asynchronously.
addr is target socket address.
If addr is None use target address pointed on transport creation.
If data is an empty bytes object a zero-length datagram will be
sent.
r   )r   rN   addrs      r   sendtoDatagramTransport.sendto   s
     "!r   c                     [         er^   r   r   s    r   r_   DatagramTransport.abort   rY   r   r   )	r+   r,   r-   r.   r/   r0   rh   r_   r1   r2   r   r   r   r      s    2I
""r   r   c                   <    \ rS rSrSrS rS rS rS rS r	S r
Srg	)
r      r2   c                     [         e)zGet subprocess id.r   r   s    r   get_pidSubprocessTransport.get_pid   r    r   c                     [         e)zmGet subprocess returncode.

See also
http://docs.python.org/3/library/subprocess#subprocess.Popen.returncode
r   r   s    r   get_returncode"SubprocessTransport.get_returncode   r;   r   c                     [         e)z&Get transport for pipe with number fd.r   )r   fds     r   get_pipe_transport&SubprocessTransport.get_pipe_transport   r    r   c                     [         e)zhSend signal to subprocess.

See also:
docs.python.org/3/library/subprocess#subprocess.Popen.send_signal
r   )r   signals     r   send_signalSubprocessTransport.send_signal   r;   r   c                     [         e)a  Stop the subprocess.

Alias for close() method.

On Posix OSs the method sends SIGTERM to the subprocess.
On Windows the Win32 API function TerminateProcess()
 is called to stop the subprocess.

See also:
http://docs.python.org/3/library/subprocess#subprocess.Popen.terminate
r   r   s    r   	terminateSubprocessTransport.terminate   s
     "!r   c                     [         e)zKill the subprocess.

On Posix OSs the function sends SIGKILL to the subprocess.
On Windows kill() is an alias for terminate().

See also:
http://docs.python.org/3/library/subprocess#subprocess.Popen.kill
r   r   s    r   killSubprocessTransport.kill   s
     "!r   N)r+   r,   r-   r.   r0   ro   rr   rv   rz   r}   r   r1   r2   r   r   r   r      s%    I"""""	"r   r   c                   `   ^  \ rS rSrSrSrSU 4S jjrS rS rS r	SS jr
SS	 jrS
 rSrU =r$ )_FlowControlMixin   aJ  All the logic for (write) flow control in a mix-in base class.

The subclass must implement get_write_buffer_size().  It must call
_maybe_pause_protocol() whenever the write buffer size increases,
and _maybe_resume_protocol() whenever it decreases.  It may also
override set_write_buffer_limits() (e.g. to specify different
defaults).

The subclass constructor must call super().__init__(extra).  This
will call set_write_buffer_limits().

The user may call set_write_buffer_limits() and
get_write_buffer_size(), and their protocol's pause_writing() and
resume_writing() may be called.
)_loop_protocol_paused_high_water
_low_waterc                 h   > [         TU ]  U5        Uc   eX l        SU l        U R	                  5         g )NF)superr   r   r   _set_write_buffer_limits)r   r   loop	__class__s      r   r   _FlowControlMixin.__init__  s5    
 %%%'r   c                 N   U R                  5       nXR                  ::  a  g U R                  (       d#  SU l         U R                  R	                  5         g g ! [
        [        4 a    e [         a4  nU R                  R                  SUU U R                  S.5         S nAg S nAff = f)NTzprotocol.pause_writing() failedmessage	exception	transportr%   )
rH   r   r   	_protocolpause_writing
SystemExitKeyboardInterruptBaseExceptionr   call_exception_handler)r   sizeexcs      r   _maybe_pause_protocol'_FlowControlMixin._maybe_pause_protocol  s    ))+###$$$(D!
,,. %  12   

11@!$!% $	3  s   A B$0*BB$c                 L   U R                   (       aB  U R                  5       U R                  ::  a#  SU l          U R                  R	                  5         g g g ! [
        [        4 a    e [         a4  nU R                  R                  SUU U R                  S.5         S nAg S nAff = f)NFz protocol.resume_writing() failedr   )
r   rH   r   r   resume_writingr   r   r   r   r   )r   r   s     r   _maybe_resume_protocol(_FlowControlMixin._maybe_resume_protocol)  s    !!**,?$)D!
--/ @ "
  12   

11A!$!% $	3  s   A B#/*BB#c                 2    U R                   U R                  4$ r   )r   r   r   s    r   rK   )_FlowControlMixin.get_write_buffer_limits9  s    !1!122r   c                     Uc  Uc  SnOSU-  nUc  US-  nXs=:  a  S:  d  O  [        SU< SU< S35      eXl        X l        g )Ni          zhigh (z) must be >= low (z) must be >= 0)
ValueErrorr   r   rB   s      r   r   *_FlowControlMixin._set_write_buffer_limits<  sb    <{ 3w;!)Ca 23'HJ J  r   c                 B    U R                  XS9  U R                  5         g )N)rC   rD   )r   r   rB   s      r   rE   )_FlowControlMixin.set_write_buffer_limitsL  s    %%4%9""$r   c                     [         er   r   r   s    r   rH   '_FlowControlMixin.get_write_buffer_sizeP  s    !!r   )r   r   r   r   ra   )r+   r,   r-   r.   r/   r0   r   r   r   rK   r   rE   rH   r1   __classcell__)r   s   @r   r   r      s8      KI($ 3 %" "r   r   N)	r/   __all__r   r   r   r   r   r   r   r2   r   r   <module>r      sj    "" ""J"M "4I"] I"X~ 0" "63"- 3"lT"	 T"r   