o
    éT•j)  ã                   @   s`   d Z ddlT ddlZddlZdd„ Zdd„ Zze W n e	y)   dd	lmZ Y nw d
d„ Z
dS )zØcurses

The main package for curses support for Python.  Normally used by importing
the package, and perhaps a particular module inside it.

   import curses
   from curses import textpad
   curses.initscr()
   ...

é    )Ú*Nc                  C   sp   dd l } dd l}ttj dd¡tj ¡ d� |  	¡ }| j
 ¡ D ]\}}|dd… dks/|dv r5t|||ƒ q|S )Nr   ÚTERMÚunknown)ÚtermÚfdé   ÚACS_)ÚLINESÚCOLS)Ú_cursesÚcursesÚ	setuptermÚ_osÚenvironÚgetÚ_sysÚ
__stdout__ÚfilenoÚinitscrÚ__dict__ÚitemsÚsetattr)r   r   ÚstdscrÚkeyÚvalue© r   ú&/usr/lib/python3.10/curses/__init__.pyr      s   ÿ€r   c                  C   s@   dd l } dd l}|  ¡ }t| dƒr| j|_t| dƒr| j|_|S )Nr   ÚCOLORSÚCOLOR_PAIRS)r   r   Ústart_colorÚhasattrr   r   )r   r   Úretvalr   r   r   r   *   s   

r   é   )Úhas_keyc             	   O   sœ   z8t ƒ }tƒ  tƒ  | d¡ ztƒ  W n   Y | |g|¢R i |¤ŽW dtƒ v r8| d¡ tƒ  tƒ  tƒ  S S dtƒ v rM| d¡ tƒ  tƒ  tƒ  w w )a  Wrapper function that initializes curses and calls another function,
    restoring normal keyboard/screen behavior on error.
    The callable object 'func' is then passed the main window 'stdscr'
    as its first argument, followed by any other arguments passed to
    wrapper().
    r"   r   r   )	r   ÚnoechoÚcbreakÚkeypadr   ÚlocalsÚechoÚnocbreakÚendwin)ÚfuncÚargsÚkwdsr   r   r   r   Úwrapper?   s*   



ü
ür.   )Ú__doc__r   Úosr   Úsysr   r   r   r#   Ú	NameErrorr.   r   r   r   r   Ú<module>   s    
ÿ