a
    lc                     @   s,  d Z ddlZddlZddlZddlmZ daejdkr@dd Z	nej
dkrTd	d Z	nd
d Z	dd Zdd Zdd Zdadd Zdd ZejdkrejddZedreZeZnRej
dkrz(ddlZejjjZejge_dd ZW n ey   dd ZY n0 dd Zdd Zdd  Zd%d#d$ZdS )&z
Utilities for working with terminals.

Authors:

* Brian E. Granger
* Fernando Perez
* Alexander Belchenko (e-mail: bialix AT ukr.net)
    N)get_terminal_sizeTposixc                   C   s   t d d S )Nclearossystem r   r   R/var/www/html/django/DPS/env/lib/python3.9/site-packages/IPython/utils/terminal.py_term_clear   s    r
   win32c                   C   s   t d d S )Nclsr   r   r   r   r	   r
      s    c                   C   s   d S Nr   r   r   r   r	   r
       s    c                 C   s
   |  a dS )a  Control whether set_term_title is active or not.

    set_term_title() allows writing to the console titlebar.  In embedded
    widgets this can cause problems, so this call can be used to toggle it on
    or off as needed.

    The default state of the module is for the function to be disabled.

    Parameters
    ----------
    val : bool
        If True, set_term_title() actually writes to the terminal (using the
        appropriate platform-specific module).  If False, it is a no-op.
    N)ignore_termtitle)valr   r   r	   toggle_set_term_title%   s    r   c                  O   s   dS )zDummy no-op.Nr   )argskwr   r   r	   _set_term_title8   s    r   c                   C   s   d S r   r   r   r   r   r	   _restore_term_title=   s    r   Fc                 C   s(   t stjd da tjd|   dS )z3 Change virtual terminal title in xterm-workalikes z[22;0tTz]0;%sN_xterm_term_title_savedsysstdoutwritetitler   r   r	   _set_term_title_xtermD   s    r   c                   C   s   t sJ tjd da d S )Nz[23;0tFr   r   r   r   r	   _restore_term_title_xtermP   s    r   TERM Zxtermc                 C   s   t |  dS )z9Set terminal title using ctypes to access the Win32 APIs.N)SetConsoleTitleWr   r   r   r	   r   d   s    c              	   C   sH   z.t  }t d t d|  }W t | nt | 0 |rDdadS )z-Set terminal title using the 'title' command.zC:ztitle TN)r   getcwdchdirr   r   )r   currretr   r   r	   r   h   s    
c                 C   s   t rdS t|  dS )z@Set terminal title using the necessary platform-dependent calls.N)r   r   r   r   r   r	   set_term_titlex   s    r%   c                   C   s   t rdS t  dS )z:Restore, if possible, terminal title to the original stateN)r   r   r   r   r   r	   restore_term_title   s    r&   c                   C   s   t d dad S )Nz8This function is deprecated, use toggle_set_term_title()T)warningswarnr   r   r   r   r	   freeze_term_title   s    
r)   P      c                 C   s   t | |fS r   )_get_terminal_size)ZdefaultxZdefaultyr   r   r	   r      s    r   )r*   r+   )__doc__r   r   r'   shutilr   r,   r   namer
   platformr   r   r   r   r   r   environgetr   
startswithctypeswindllkernel32r    	c_wchar_pargtypesImportErrorr%   r&   r)   r   r   r   r	   <module>   sB   







