a
    õ£Be   ã                   @  s~   d dl mZ d dlZd dlmZmZ d dlmZmZm	Z	 ddl
mZmZ ddlmZ ddlmZ d	gZdddddœdd	„ZdS )é    )ÚannotationsN)ÚTextIOÚcast)Úget_bell_environment_variableÚget_term_environment_variableÚis_conemu_ansié   )ÚDummyOutputÚOutput)Ú
ColorDepth)ÚPlainTextOutputÚcreate_outputFzTextIO | NoneÚboolr
   )ÚstdoutÚalways_prefer_ttyÚreturnc                 C  s   t ƒ }tƒ }t ¡ }| du rPtj} |rPtjtjfD ]}|dur2| ¡ r2|}  qPq2| du r^tƒ S ddl	m
} t| |ƒr|| j} qjtjdkrìddlm} ddlm} ddlm}	m}
 |
ƒ rÆtt|	| |d	�ƒS tƒ rÞtt|| |d	�ƒS || |d	�S n0dd
lm} |  ¡ �s
t| ƒS |j| |||d�S dS )aX  
    Return an :class:`~prompt_toolkit.output.Output` instance for the command
    line.

    :param stdout: The stdout object
    :param always_prefer_tty: When set, look for `sys.stderr` if `sys.stdout`
        is not a TTY. Useful if `sys.stdout` is redirected to a file, but we
        still want user input and output on the terminal.

        By default, this is `False`. If `sys.stdout` is not a terminal (maybe
        it's redirected to a file), then a `PlainTextOutput` will be returned.
        That way, tools like `print_formatted_text` will write plain text into
        that file.
    Nr   )ÚStdoutProxyÚwin32r   )ÚConEmuOutput)ÚWin32Output)ÚWindows10_OutputÚis_win_vt100_enabled)Údefault_color_depth)ÚVt100_Output)Útermr   Zenable_bell)r   r   r   Zfrom_envÚsysr   ÚstderrÚisattyr	   Zprompt_toolkit.patch_stdoutr   Ú
isinstanceZoriginal_stdoutÚplatformZconemur   r   r   Z	windows10r   r   r   r
   r   Zvt100r   r   Zfrom_pty)r   r   Zterm_from_envZbell_from_envZcolor_depth_from_envÚior   r   r   r   r   r   © r!   úa/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/prompt_toolkit/output/defaults.pyr      sL    


þÿ
ü)NF)Ú
__future__r   r   Útypingr   r   Zprompt_toolkit.utilsr   r   r   Úbaser	   r
   Zcolor_depthr   Ú
plain_textr   Ú__all__r   r!   r!   r!   r"   Ú<module>   s   ÿ ÿ