+
    j,iV                        ^ RI Ht ^ RIt]P                  R8w  g   Q h^ RIt^ RIHt ^ RIHtH	t	H
t
Ht ^RIHt ^RIHt ^RIHt R	.t ! R
 R4      t ! R R	]]4      tR# )    )annotationsNwin32)contextmanager)ContextManagerIteratorTextIOcastDummyContext)	PipeInput)
Vt100InputPosixPipeInputc                  J    ] tR t^tRtR R ltR R ltR R ltR R	 ltR
t	R# )_PipezCWrapper around os.pipe, that ensures we don't double close any end.c                   V ^8  d   QhRR/#    returnNone )formats   "A/usr/lib/python3/dist-packages/prompt_toolkit/input/posix_pipe.py__annotate___Pipe.__annotate__   s     # #$ #    c                	f    \         P                  ! 4       w  V n        V n        R V n        R V n        R# )FN)ospiperead_fdwrite_fd_read_closed_write_closedselfs   &r   __init___Pipe.__init__   s&    &(ggi#dm!"r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     ! !D !r   c                |    V P                   '       d   R# \        P                  ! V P                  4       RV n         R# )z!Close read-end if not yet closed.NT)r!   r   closer   r#   s   &r   
close_read_Pipe.close_read   s)    
 r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   $   s     " "T "r   c                |    V P                   '       d   R# \        P                  ! V P                  4       RV n         R# )z"Close write-end if not yet closed.NT)r"   r   r)   r    r#   s   &r   close_write_Pipe.close_write$   s)    
!r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   ,   s      t r   c                F    V P                  4        V P                  4        R# )zClose both read and write ends.N)r*   r.   r#   s   &r   r)   _Pipe.close,   s    r   )r!   r"   r   r    N)
__name__
__module____qualname____firstlineno____doc__r%   r*   r.   r)   __static_attributes__r   r   r   r   r      s    I#
!" r   r   c                     a  ] tR t^2tRt^ tRR V 3R lllt]]RR R ll4       4       t	R R lt
R R	 ltR
 R ltR R ltR R ltR R ltRtV ;t# )r   z
Input that is send through a pipe.
This is useful if we want to send the input programmatically into the
application. Mostly useful for unit testing.

Usage::

    with PosixPipeInput.create() as input:
        input.send_text('inputdata')
c               $    V ^8  d   QhRRRRRR/# )r   _piper   _textstrr   r   r   )r   s   "r   r   PosixPipeInput.__annotate__@   s!     & &e &C & &r   c                	  <a  VS n          ! V 3R  lR4      p\        SS `	  \        \        V! 4       4      4       S P                  V4       S P                  ;P                  ^,          un        S P                  P                  S n        R# )c                  :   < ] tR t^DtRtR R ltR V 3R lltRtR# )&PosixPipeInput.__init__.<locals>.Stdinutf-8c                   V ^8  d   QhRR/# )r   r   boolr   )r   s   "r   r   3PosixPipeInput.__init__.<locals>.Stdin.__annotate__G   s       r   c                	    R # )Tr   )stdins   &r   isatty-PosixPipeInput.__init__.<locals>.Stdin.isattyG   s    r   c                   V ^8  d   QhRR/# )r   r   intr   )r   s   "r   r   rE   J   s     ) ) )r   c                	0   < SP                   P                  # N)r   r   )rG   r$   s   &r   fileno-PosixPipeInput.__init__.<locals>.Stdin.filenoJ   s    yy(((r   r   N)r3   r4   r5   r6   encodingrH   rN   r8   r#   s   r   StdinrA   D   s    H) )r   rQ   N)r   superr%   r	   r   	send_text	__class___id)r$   r;   r<   rQ   rT   s   f&& r   r%   PosixPipeInput.__init__@   s`    		) 	) 	feg./u 	a>>%%r   c                    V ^8  d   QhRRRR/# )r   textr=   r   zIterator[PosixPipeInput]r   )r   s   "r   r   r>   V   s      # '? r   c              #  	   "   \        4       p \        W!R 7      x  VP                  4        R#   TP                  4        i ; i5i))r;   r<   N)r   r   r)   )clsrX   r   s   && r   createPosixPipeInput.createT   s0      w	 t88JJLDJJLs   A. AA  Ac                    V ^8  d   QhRRRR/# )r   databytesr   r   r   )r   s   "r   r   r>   ]   s     + +u + +r   c                	\    \         P                  ! V P                  P                  V4       R # rM   )r   writer   r    r$   r^   s   &&r   
send_bytesPosixPipeInput.send_bytes]   s    
##T*r   c                    V ^8  d   QhRRRR/# )r   r^   r=   r   r   r   )r   s   "r   r   r>   `   s     ; ;c ;d ;r   c                z    \         P                  ! V P                  P                  VP	                  R4      4       R# )zSend text to the input.rB   N)r   ra   r   r    encoderb   s   &&r   rS   PosixPipeInput.send_text`   s#    
##T[[%9:r   c                   V ^8  d   QhRR/# r   r   zContextManager[None]r   )r   s   "r   r   r>   d   s      . r   c                	    \        4       # rM   r
   r#   s   &r   raw_modePosixPipeInput.raw_moded   
    ~r   c                   V ^8  d   QhRR/# rj   r   )r   s   "r   r   r>   g   s      1 r   c                	    \        4       # rM   r
   r#   s   &r   cooked_modePosixPipeInput.cooked_modeg   rn   r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r>   j   s        t  r   c                :    V P                   P                  4        R# )zClose pipe fds.N)r   r.   r#   s   &r   r)   PosixPipeInput.closej   s     			r   c                   V ^8  d   QhRR/# )r   r   r=   r   )r   s   "r   r   r>   r   s     ( ( (r   c                     RV P                    2# )z0
This needs to be unique for every `PipeInput`.
zpipe-input-)rU   r#   s   &r   typeahead_hashPosixPipeInput.typeahead_hashr   s     TXXJ''r   )rU   r   ) )r3   r4   r5   r6   r7   rU   r%   classmethodr   r[   rc   rS   rl   rq   r)   rx   r8   __classcell__)rT   s   @r   r   r   2   sX    	 C& &(   +; ( (r   )
__future__r   sysplatformr   
contextlibr   typingr   r   r   r	   utilsr   baser   vt100r   __all__r   r   r   r   r   <module>r      sX    " 

||w  	 % 9 9     
 <D(Z D(r   