a
    &Rîh)  ã                   @   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	yR   dd	lmZ Y n0 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 r>t|||ƒ q>|S )Nr   ZTERMÚunknown)ZtermÚfdé   ZACS_)ÚLINESZCOLS)Ú_cursesÚcursesZ	setuptermÚ_osÚenvironÚgetÚ_sysÚ
__stdout__ÚfilenoÚinitscrÚ__dict__ÚitemsÚsetattr)r   r   ÚstdscrÚkeyÚvalue© r   ú7/opt/python-3.9.24/usr/lib/python3.9/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   Zretvalr   r   r   r   *   s    

r   é   )Úhas_keyc             	   O   s¢   ztt ƒ }tƒ  tƒ  | d¡ z
tƒ  W n   Y n0 | |g|¢R i |¤ŽW dtƒ v rr| d¡ tƒ  tƒ  tƒ  S n(dtƒ v rœ| d¡ tƒ  tƒ  tƒ  0 dS )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   N)	r   ZnoechoZcbreakZkeypadr   ÚlocalsZechoZnocbreakZendwin)ÚfuncÚargsÚkwdsr   r   r   r   Úwrapper?   s4    



ù    ü

r"   )Ú__doc__r   Úosr	   Úsysr   r   r   r   Ú	NameErrorr"   r   r   r   r   Ú<module>   s   
