ó
    ¸®i,   ã                  óÒ   • % S SK Jr  S SKrS SKrS SKrS SKJrJr  S SK	r	SSK
Jr  SSKJrJr  \(       a  \R                  S:w  d   eSrS	\S
'    " S S5      r\ " S S\5      5       rg)é    )ÚannotationsN)ÚTYPE_CHECKINGÚFinalé   )ÚStream)ÚConflictDetectorÚfinalÚwin32i   Ú	FinalTypeÚDEFAULT_RECEIVE_SIZEc                  ó\   • \ rS rSr% S\S'   SS jr\SS j5       rSS jrSS jr	SS jr
S	rg
)Ú	_FdHolderé   ÚintÚfdc                óÂ   • SU l         [        U[        5      (       d  [        S5      eXl         [        R
                  " U5      U l        [        R                  " US5        g )Néÿÿÿÿzfile descriptor must be an intF)r   Ú
isinstancer   Ú	TypeErrorÚosÚget_blockingÚ_original_is_blockingÚset_blocking©Úselfr   s     Ú=C:\des-py\RoboSAPF\venv\Lib\site-packages\trio/_unix_pipes.pyÚ__init__Ú_FdHolder.__init__(   sH   € ð ˆŒÜ˜"œc×"Ñ"ÜÐ<Ó=Ð=ØŒä%'§_¢_°RÓ%8ˆÔ"Ü
�Š˜˜EÕ"ó    c                ó    • U R                   S:H  $ ©Nr   )r   ©r   s    r   ÚclosedÚ_FdHolder.closed3   s   € à�w‰w˜"‰}Ðr   c                óº   • U R                   (       a  g U R                  nSU l        [        R                  " XR                  5        [        R
                  " U5        g r!   )r#   r   r   r   r   Úcloser   s     r   Ú
_raw_closeÚ_FdHolder._raw_close7   s;   € ð �;�;ØØ�W‰WˆØˆŒÜ
�Š˜×6Ñ6Ô7Ü
�Š��r   c                ó$   • U R                  5         g ©N)r'   r"   s    r   Ú__del__Ú_FdHolder.__del__F   s   € Ø�‰Õr   c                óš   • U R                   (       d:  [        R                  R                  U R                  5        U R                  5         g g r*   )r#   ÚtrioÚlowlevelÚnotify_closingr   r'   r"   s    r   r&   Ú_FdHolder.closeI   s.   € Ø�{�{Ü�M‰M×(Ñ(¨¯©Ô1Ø�O‰OÕð r   )r   r   N©r   r   ÚreturnÚNone)r3   Úbool©r3   r4   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__r   Úpropertyr#   r'   r+   r&   Ú__static_attributes__© r   r   r   r      s1   ‡ ð$ 	ƒGô	#ð óó ðôô÷r   r   c                  ób   • \ rS rSrSrSS jrSS jrSS jrSSS jjrSS jr	SS	 jr
SS
 jrSrg)ÚFdStreaméO   aš  Represents a stream given the file descriptor to a pipe, TTY, etc.

*fd* must refer to a file that is open for reading and/or writing and
supports non-blocking I/O (pipes and TTYs will work, on-disk files probably
not).  The returned stream takes ownership of the fd, so closing the stream
will close the fd too.  As with `os.fdopen`, you should not directly use
an fd after you have wrapped it in a stream using this function.

To be used as a Trio stream, an open file must be placed in non-blocking
mode.  Unfortunately, this impacts all I/O that goes through the
underlying open file, including I/O that uses a different
file descriptor than the one that was passed to Trio. If other threads
or processes are using file descriptors that are related through `os.dup`
or inheritance across `os.fork` to the one that Trio is using, they are
unlikely to be prepared to have non-blocking I/O semantics suddenly
thrust upon them.  For example, you can use
``FdStream(os.dup(sys.stdin.fileno()))`` to obtain a stream for reading
from standard input, but it is only safe to do so with heavy caveats: your
stdin must not be shared by any other processes, and you must not make any
calls to synchronous methods of `sys.stdin` until the stream returned by
`FdStream` is closed. See `issue #174
<https://github.com/python-trio/trio/issues/174>`__ for a discussion of the
challenges involved in relaxing this restriction.

.. warning:: one specific consequence of non-blocking mode
  applying to the entire open file description is that when
  your program is run with multiple standard streams connected to
  a TTY (as in a terminal emulator), all of the streams become
  non-blocking when you construct an `FdStream` for any of them.
  For example, if you construct an `FdStream` for standard input,
  you might observe Python loggers begin to fail with
  `BlockingIOError`.

Args:
  fd (int): The fd to be wrapped.

Returns:
  A new `FdStream` object.
c                ód   • [        U5      U l        [        S5      U l        [        S5      U l        g )Nz*another task is using this stream for sendz-another task is using this stream for receive)r   Ú
_fd_holderr   Ú_send_conflict_detectorÚ_receive_conflict_detectorr   s     r   r   ÚFdStream.__init__y   s/   € Ü# B›-ˆŒÜ'7Ø8ó(
ˆÔ$ô +;Ø;ó+
ˆÕ'r   c              ƒ  ó^  #   • U R                      U R                  R                  (       a  [        R                  " S5      e[        R
                  R                  5       I S h  v•N   [        U5      n[        U5       nSnXB:  aC  X4S   n U[        R                  " U R                  R                  U5      -  nS S S 5        XB:  a  MC  S S S 5        S S S 5        g  Nv! [         a?    [        R
                  R                  U R                  R                  5      I S h  v•N     Nj[         aK  nUR                  [        R                   :X  a  [        R                  " S5      S e[        R"                  UeS nAff = f! , (       d  f       NÇ= f! , (       d  f       NÉ= f! , (       d  f       g = f7f)Núfile was already closedr   )rD   rC   r#   r.   ÚClosedResourceErrorr/   Ú
checkpointÚlenÚ
memoryviewr   Úwriter   ÚBlockingIOErrorÚwait_writableÚOSErrorÚerrnoÚEBADFÚBrokenResourceError)r   ÚdataÚlengthÚviewÚsentÚ	remainingÚes          r   Úsend_allÚFdStream.send_all‚   s?  é € Ø×)Ó)ð �‰×%×%Ü×.Ò.Ð/HÓIÐIÜ—-‘-×*Ñ*Ó,×,Ð,Ü˜“YˆFä˜DÔ! TØ�Ø“mØ˜e™¨	ð
FØ ¤B§H¢H¨T¯_©_×-?Ñ-?ÀÓ$KÑK˜D÷ %ð •m÷ "÷ *Ð)ñ
 -øô  /ó RÜ"&§-¡-×"=Ñ"=¸d¿o¹o×>PÑ>PÓ"Q×QÓQÜ&ó FØ Ÿw™w¬%¯+©+Ó5Ü&*×&>Ò&>Ø$=ó'"à'+ð!,ô '+×&>Ñ&>ÀAÐ EûðFú÷ %�ú÷ "Õ!ú÷ *Õ)üs—   ‚F-�AFÁ"CÁ#FÁ=FÂ	E:Â.CÂ9FÃFÃ	F-ÃFÃA E7	ÄDÄE7	Ä!E:Ä#	E7	Ä,AE2	Å2E7	Å7E:Å:
FÆFÆ
F	ÆFÆ
F*Æ&F-c              ƒ  ó4  #   • U R                      U R                  R                  (       a  [        R                  " S5      e[        R
                  R                  U R                  R                  5      I S h  v•N   S S S 5        g  N! , (       d  f       g = f7f)NrH   )rD   rC   r#   r.   rI   r/   rO   r   r"   s    r   Úwait_send_all_might_not_blockÚ&FdStream.wait_send_all_might_not_block›   se   é € Ø×)Ó)Ø�‰×%×%Ü×.Ò.Ð/HÓIÐIÜ—-‘-×-Ñ-¨d¯o©o×.@Ñ.@ÓA×AÐA÷ *Ð)ñ B÷ *Õ)üs/   ‚B�A(BÁ7BÁ8BÁ<	BÂBÂ
BÂBNc              ƒ  óÀ  #   • U R                      Uc  [        nO1[        U[        5      (       d  [	        S5      eUS:  a  [        S5      e[        R                  R                  5       I S h  v•N     [        R                  " U R                  R                  U5      n UsS S S 5        $  N=! [         a?    [        R                  R                  U R                  R                  5      I S h  v•N     OW[         aK  nUR                   [         R"                  :X  a  [        R$                  " S5      S e[        R&                  UeS nAff = fMÛ  ! , (       d  f       g = f7f)Nzmax_bytes must be integer >= 1r   rH   )rE   r   r   r   r   Ú
ValueErrorr.   r/   rJ   r   ÚreadrC   r   rN   Úwait_readablerP   rQ   rR   rI   rS   )r   Ú	max_bytesrT   Úexcs       r   Úreceive_someÚFdStream.receive_some¡   s  é € Ø×,Ó,ØÑ Ü0‘	ä! )¬S×1Ñ1Ü#Ð$DÓEÐEØ˜q“=Ü$Ð%EÓFÐFä—-‘-×*Ñ*Ó,×,Ð,ØðÜŸ7š7 4§?¡?×#5Ñ#5°yÓA�Dð à÷3 -Ñ,ñ -øô 'ó JÜŸ-™-×5Ñ5°d·o±o×6HÑ6HÓI×IÓIÜó @Ø—y‘y¤E§K¡KÓ/Ü"×6Ò6Ø5óà#ð$ô #×6Ñ6¸CÐ?ûð@úñ ÷ -Õ,üsm   ‚E�AEÁ,B*Á-EÁ3+B,ÂEÂ 
EÂ*EÂ,A EÃ,C/Ã-EÃ2EÃ4	EÃ=AEÅEÅEÅ
EÅEc                ó8   • U R                   R                  5         g r*   )rC   r&   r"   s    r   r&   ÚFdStream.close½   s   € Ø�‰×ÑÕr   c              ƒ  ó|   #   • U R                  5         [        R                  R                  5       I S h  v•N   g  N7fr*   )r&   r.   r/   rJ   r"   s    r   ÚacloseÚFdStream.acloseÀ   s$   é € Ø�
‰
ŒÜ�m‰m×&Ñ&Ó(×(Ó(ùs   ‚2<´:µ<c                ó.   • U R                   R                  $ r*   )rC   r   r"   s    r   ÚfilenoÚFdStream.filenoÄ   s   € Ø�‰×!Ñ!Ð!r   )rC   rE   rD   r2   )rT   Úbytesr3   r4   r6   r*   )rc   z
int | Noner3   ro   )r3   r   )r7   r8   r9   r:   Ú__doc__r   rZ   r]   re   r&   rj   rm   r=   r>   r   r   r@   r@   O   s-   † ñ&ôP
ôFô2Böô8 ô)÷"r   r@   )Ú
__future__r   rQ   r   ÚsysÚtypingr   r   r   r.   Ú_abcr   Ú_utilr   r	   Úplatformr   r;   r   r@   r>   r   r   Ú<module>rw      sg   ðÞ "ã Û 	Û 
ß 4ã å ß *æ˜CŸL™L¨GÓ3Ð 3Ð3ð #(Ð �iÓ '÷8ñ 8ðv ôu"ˆvó u"ó ñu"r   