§
    ¯õi,   ã                  óÒ   — U d dl mZ d dlZd dlZd dlZd dlmZmZ d dl	Z	ddl
mZ ddlmZmZ erej        dk    sJ ‚dZd	ed
<    G d„ d¦  «        Ze G d„ de¦  «        ¦   «         ZdS )é    )ÚannotationsN)ÚTYPE_CHECKINGÚFinalé   )ÚStream)ÚConflictDetectorÚfinalÚwin32i   Ú	FinalTypeÚDEFAULT_RECEIVE_SIZEc                  óR   — e Zd ZU ded<   dd„Zedd„¦   «         Zdd„Zdd	„Zdd
„Z	dS )Ú	_FdHolderÚintÚfdÚreturnÚNonec                óÆ   — d| _         t          |t          ¦  «        st          d¦  «        ‚|| _         t	          j        |¦  «        | _        t	          j        |d¦  «         d S )Néÿÿÿÿzfile descriptor must be an intF)r   Ú
isinstancer   Ú	TypeErrorÚosÚget_blockingÚ_original_is_blockingÚset_blocking©Úselfr   s     ú\/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/trio/_unix_pipes.pyÚ__init__z_FdHolder.__init__(   s]   € ð ˆŒÝ˜"�cÑ"Ô"ð 	>ÝÐ<Ñ=Ô=Ð=ØˆŒå%'¤_°RÑ%8Ô%8ˆÔ"Ý
Œ˜˜EÑ"Ô"Ð"Ð"Ð"ó    Úboolc                ó   — | j         dk    S ©Nr   )r   ©r   s    r   Úclosedz_FdHolder.closed3   s   € àŒw˜"Š}Ðr   c                ó�   — | j         rd S | j        }d| _        t          j        || j        ¦  «         t          j        |¦  «         d S r"   )r$   r   r   r   r   Úcloser   s     r   Ú
_raw_closez_FdHolder._raw_close7   sG   € ð Œ;ð 	ØˆFØŒWˆØˆŒÝ
Œ˜˜DÔ6Ñ7Ô7Ð7Ý
Œ�‰Œˆˆˆr   c                ó.   — |                       ¦   «          d S ©N)r'   r#   s    r   Ú__del__z_FdHolder.__del__F   s   € Ø�ŠÑÔÐÐÐr   c                óˆ   — | j         s:t          j                             | j        ¦  «         |                      ¦   «          d S d S r)   )r$   ÚtrioÚlowlevelÚnotify_closingr   r'   r#   s    r   r&   z_FdHolder.closeI   sD   € ØŒ{ð 	ÝŒM×(Ò(¨¬Ñ1Ô1Ð1Ø�OŠOÑÔÐÐÐð	ð 	r   N©r   r   r   r   )r   r    ©r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__annotations__r   Úpropertyr$   r'   r*   r&   © r   r   r   r      s‘   € € € € € € ð$ €G€G�Gð	#ð 	#ð 	#ð 	#ð ðð ð ñ „Xððð ð ð ðð ð ð ðð ð ð ð ð r   r   c                  óL   — e Zd ZdZdd„Zdd	„Zdd
„Zddd„Zdd„Zdd„Z	dd„Z
dS )ÚFdStreama  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.
    r   r   r   r   c                ó~   — t          |¦  «        | _        t          d¦  «        | _        t          d¦  «        | _        d S )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   zFdStream.__init__y   sA   € Ý# B™-œ-ˆŒÝ'7Ø8ñ(
ô (
ˆÔ$õ +;Ø;ñ+
ô +
ˆÔ'Ð'Ð'r   ÚdataÚbytesc              ƒ  óì  K  — | j         5  | j        j        rt          j        d¦  «        ‚t          j                             ¦   «         ƒ d {V —† t          |¦  «        }t          |¦  «        5 }d}||k     rÏ||d …         5 }	 |t          j
        | j        j        |¦  «        z  }nƒ# t          $ r2 t          j                             | j        j        ¦  «        ƒ d {V —† Y nHt          $ r<}|j        t          j        k    rt          j        d¦  «        d ‚t          j        |‚d }~ww xY wd d d ¦  «         n# 1 swxY w Y   ||k     °Ïd d d ¦  «         n# 1 swxY w Y   d d d ¦  «         d S # 1 swxY w Y   d S )Núfile was already closedr   )r;   r:   r$   r,   ÚClosedResourceErrorr-   Ú
checkpointÚlenÚ
memoryviewr   Úwriter   ÚBlockingIOErrorÚwait_writableÚOSErrorÚerrnoÚEBADFÚBrokenResourceError)r   r=   ÚlengthÚviewÚsentÚ	remainingÚes          r   Úsend_allzFdStream.send_all‚   s˜  è è € ØÔ)ð 	Fð 	Fð ŒÔ%ð JÝÔ.Ð/HÑIÔIÐIÝ”-×*Ò*Ñ,Ô,Ð,Ð,Ð,Ð,Ð,Ð,Ð,Ý˜‘Y”YˆFå˜DÑ!Ô!ð F TØ�Ø˜V’m�mØ˜d˜e˜eœð F¨	ð
FØ ¥B¤H¨T¬_Ô-?ÀÑ$KÔ$KÑK˜D˜DøÝ.ð Rð Rð RÝ"&¤-×"=Ò"=¸d¼oÔ>PÑ"QÔ"QÐQÐQÐQÐQÐQÐQÐQÐQÐQÝ&ð Fð Fð FØ œw­%¬+Ò5Ð5Ý&*Ô&>Ø$=ñ'"ô '"à'+ð!,õ '+Ô&>ÀAÐ EøøøøðFøøøðFð Fð Fñ Fô Fð Fð Fð Fð Fð Fð Føøøð Fð Fð Fð Fð ˜V’m�mðFð Fð Fñ Fô Fð Fð Fð Fð Fð Fð Føøøð Fð Fð Fð Fð	Fð 	Fð 	Fñ 	Fô 	Fð 	Fð 	Fð 	Fð 	Fð 	Fð 	Fð 	Føøøð 	Fð 	Fð 	Fð 	Fð 	Fð 	FsŠ   ŠA#E)Á-EÂ D4Â"B%Â$D4Â%9D%	ÃD4Ã 	D%	Ã)7D 	Ä D%	Ä%D4Ä(EÄ4D8Ä8EÄ;D8Ä<	EÅE)ÅE	ÅE)ÅE	ÅE)Å)E-Å0E-c              ƒ  óè   K  — | j         5  | j        j        rt          j        d¦  «        ‚t          j                             | j        j        ¦  «        ƒ d {V —† d d d ¦  «         d S # 1 swxY w Y   d S )Nr@   )r;   r:   r$   r,   rA   r-   rG   r   r#   s    r   Úwait_send_all_might_not_blockz&FdStream.wait_send_all_might_not_block›   sÔ   è è € ØÔ)ð 	Bð 	BØŒÔ%ð JÝÔ.Ð/HÑIÔIÐIÝ”-×-Ò-¨d¬oÔ.@ÑAÔAÐAÐAÐAÐAÐAÐAÐAð	Bð 	Bð 	Bñ 	Bô 	Bð 	Bð 	Bð 	Bð 	Bð 	Bð 	Bð 	Bøøøð 	Bð 	Bð 	Bð 	Bð 	Bð 	Bs   ŠAA'Á'A+Á.A+NÚ	max_bytesú
int | Nonec              ƒ  óf  K  — | j         5  |€t          }n9t          |t          ¦  «        st	          d¦  «        ‚|dk     rt          d¦  «        ‚t          j                             ¦   «         ƒ d {V —† 	 	 t          j
        | j        j        |¦  «        }n„# t          $ r2 t          j                             | j        j        ¦  «        ƒ d {V —† Y nHt          $ r<}|j        t           j        k    rt          j        d¦  «        d ‚t          j        |‚d }~ww xY wŒ¥|cd d d ¦  «         S # 1 swxY w Y   d S )Nzmax_bytes must be integer >= 1r   Tr@   )r<   r   r   r   r   Ú
ValueErrorr,   r-   rB   r   Úreadr:   r   rF   Úwait_readablerH   rI   rJ   rA   rK   )r   rT   r=   Úexcs       r   Úreceive_somezFdStream.receive_some¡   s³  è è € ØÔ,ð 	ð 	ØÐ Ý0�	�	å! )­SÑ1Ô1ð FÝ#Ð$DÑEÔEÐEØ˜q’=�=Ý$Ð%EÑFÔFÐFå”-×*Ò*Ñ,Ô,Ð,Ð,Ð,Ð,Ð,Ð,Ð,ððÝœ7 4¤?Ô#5°yÑAÔA�Dð øõ 'ð Jð Jð JÝœ-×5Ò5°d´oÔ6HÑIÔIÐIÐIÐIÐIÐIÐIÐIÐIÐIÝð @ð @ð @Ø”y¥E¤KÒ/Ð/Ý"Ô6Ø5ñô à#ð$õ #Ô6¸CÐ?øøøøð@øøøðð ð3	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð 	ð 	sB   ŠA)D&Á4BÂD&Â9DÃD&Ã	DÃ7DÄDÄD&Ä&D*Ä-D*c                ó8   — | j                              ¦   «          d S r)   )r:   r&   r#   s    r   r&   zFdStream.close½   s   € ØŒ×ÒÑÔÐÐÐr   c              ƒ  óz   K  — |                       ¦   «          t          j                             ¦   «         ƒ d {V —† d S r)   )r&   r,   r-   rB   r#   s    r   ÚaclosezFdStream.acloseÀ   s?   è è € Ø�
Š
‰ŒˆÝŒm×&Ò&Ñ(Ô(Ð(Ð(Ð(Ð(Ð(Ð(Ð(Ð(Ð(r   c                ó   — | j         j        S r)   )r:   r   r#   s    r   ÚfilenozFdStream.filenoÄ   s   € ØŒÔ!Ð!r   r/   )r=   r>   r   r   r0   r)   )rT   rU   r   r>   )r   r   )r1   r2   r3   Ú__doc__r   rQ   rS   r[   r&   r^   r`   r6   r   r   r8   r8   O   s¸   € € € € € ð&ð &ðP
ð 
ð 
ð 
ðFð Fð Fð Fð2Bð Bð Bð Bðð ð ð ð ð8 ð  ð  ð  ð)ð )ð )ð )ð"ð "ð "ð "ð "ð "r   r8   )Ú
__future__r   rI   r   ÚsysÚtypingr   r   r   r,   Ú_abcr   Ú_utilr   r	   Úplatformr   r4   r   r8   r6   r   r   ú<module>rh      s  ðØ "Ð "Ð "Ð "Ð "Ð "Ð "à €€€Ø 	€	€	€	Ø 
€
€
€
Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4à €€€à Ð Ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *àÐ 3˜CœL¨GÒ3Ð3Ð3Ð3ð #(Ð Ð 'Ð 'Ð 'Ñ 'ð8ð 8ð 8ð 8ð 8ñ 8ô 8ð 8ðv ðu"ð u"ð u"ð u"ð u"ˆvñ u"ô u"ñ „ðu"ð u"ð u"r   