o
    žD®fÄ	  ã                   @  sb   d dl mZ d dlZd dlZd dlmZmZ ddlmZm	Z	m
Z
 ddgZdddd„Zddd„ZdS )é    )ÚannotationsN)ÚContextManagerÚTextIOé   )Ú
DummyInputÚInputÚ	PipeInputÚcreate_inputÚcreate_pipe_inputFÚstdinúTextIO | NoneÚalways_prefer_ttyÚboolÚreturnr   c                 C  s®   t jdkrddlm} | du rt jdu rtƒ S || pt jƒS ddlm} | du r@t j} |r@t jt jt j	fD ]
}| 
¡ r?|}  nq5z	|  ¡  W || ƒS  tjyV   tƒ  Y S w )a§  
    Create the appropriate `Input` object for the current os/environment.

    :param always_prefer_tty: When set, if `sys.stdin` is connected to a Unix
        `pipe`, check whether `sys.stdout` or `sys.stderr` are connected to a
        pseudo terminal. If so, open the tty for reading instead of reading for
        `sys.stdin`. (We can open `stdout` or `stderr` for reading, this is how
        a `$PAGER` works.)
    Úwin32r   )Ú
Win32InputN)Ú
Vt100Input)ÚsysÚplatformr   r   r   r   Úvt100r   ÚstdoutÚstderrÚisattyÚfilenoÚioÚUnsupportedOperation)r   r   r   r   Úobj© r   úV/home/ubuntu/webapp/venv/lib/python3.10/site-packages/prompt_toolkit/input/defaults.pyr	      s(   

þ
ý
ÿúContextManager[PipeInput]c                  C  s2   t jdkrddlm}  |  ¡ S ddlm} | ¡ S )aA  
    Create an input pipe.
    This is mostly useful for unit testing.

    Usage::

        with create_pipe_input() as input:
            input.send_text('inputdata')

    Breaking change: In prompt_toolkit 3.0.28 and earlier, this was returning
    the `PipeInput` directly, rather than through a context manager.
    r   r   )ÚWin32PipeInput)ÚPosixPipeInput)r   r   Ú
win32_piper    ÚcreateÚ
posix_piper!   )r    r!   r   r   r   r
   ;   s
   
)NF)r   r   r   r   r   r   )r   r   )Ú
__future__r   r   r   Útypingr   r   Úbaser   r   r   Ú__all__r	   r
   r   r   r   r   Ú<module>   s    þ,