o
    h	                     @  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   _/var/www/html/optinet_system/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    ,