
    (ph                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKJr  SSKJrJrJrJrJrJrJr  SSKJrJrJr  SSKJr  SSKJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&  SS	K'J(r(J)r)J*r*  \RV                  SS
 S:  a  \RX                  r-Sr.\	R^                  " 5       S:X  a  Sr0SSK1r2SSK3J4r4  OSr0SSK2r2 SSK5r5SSK6r6SSK7r7Sq> " S S\?5      r@ " S S\R                  " SS5      5      rBg! \8 aG    Sr9SRu                  \	R^                  " 5       SRw                  \95      S9r<\
Rz                  " \<5        Sr. Nvf = f)zAModule containing :class:`Terminal`, the primary API entry point.    N   )COLOR_DISTANCE_ALGORITHMS)DEFAULT_ESCDELAY
_time_left_read_untilresolve_sequenceget_keyboard_codesget_leading_prefixesget_keyboard_sequences)TermcapSequenceSequenceTextWrapper)RGB_256TABLE)	COLORSCOMPOUNDABLESFormattingStringNullCallableStringParameterizingStringFormattingOtherStringsplit_compoundresolve_attributeresolve_capability)CAPABILITY_DATABASECAPABILITIES_ADDITIVESCAPABILITIES_RAW_MIXIN   )   r   TWindows)get_console_input_encodingF)setrawcbreakkbhitheightwidthzOne or more of the modules: 'termios', 'fcntl', and 'tty' are not found on your platform '{platform}'. The following methods of Terminal are dummy/no-op unless a deriving class overrides them: {tty_methods}.z, )platformtty_methodsc                      \ rS rSrSr0 SS_SS_SS_S	S
_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S#_S$S%S&S'S(S)S*S+S,S-S.S/S0S1S2S3.ErStS5 jrS6 rS7 rS8 r	S9 r
S: rS; r\S< 5       r\S= 5       r\S> 5       r\S? 5       r\S@ 5       r\SA 5       r\SB 5       r\SC 5       rSD rSE r\R4                  SuSF j5       rSvSG jrSvSH jrSvSI jr\R4                  SJ 5       r\R4                  SK 5       r SL r!SM r"\SN 5       r#\SO 5       r$\SP 5       r%\SQ 5       r&\SR 5       r'SS r(\ST 5       r)SU r*SV r+SW r,\SX 5       r-SwSY jr.\SZ 5       r/\S[ 5       r0\0Rb                  S\ 5       r0\S] 5       r2\2Rb                  S^ 5       r2\S_ 5       r3\S` 5       r4SxSa jr5SxSb jr6SxSc jr7SvSd jr8Se r9SvSf jr:SvSg jr;SvSh jr<Si r=SySj jr>SvSk jr?Sl r@Sm rASvSn jrB\R4                  So 5       rC\R4                  Sp 5       rD\R4                  Sq 5       rES4\F4Sr jrGSsrHg4)zTerminalK   aj  
An abstraction for color, style, positioning, and input in the terminal.

This keeps the endless calls to ``tigetstr()`` and ``tparm()`` out of your code, acts
intelligently when somebody pipes your output to a non-terminal, and abstracts over the
complexity of unbuffered keyboard input. It uses the terminfo database to remain portable across
terminal types.
savescrestorerc	clear_eolel	clear_bolel1	clear_eosedenter_fullscreensmcupexit_fullscreenrmcupmovecupmove_yxmove_xhpamove_yvpahide_cursorcivisnormal_cursorcnormreset_colorsopnormalsgr0reverserevitalicsitmritmsshmrshmsmsormsossubmrsubmssupmrsupmsmulrmulu6u7u8u9)	no_italicshadow	no_shadowstandoutno_standout	subscriptno_subscriptsuperscriptno_superscript	underlineno_underlinecursor_reportcursor_requestterminal_answerbackterminal_enquireNc                    SU< SU< SU< 3/U l         SU l        SU l        X l        SU l        SU l        SU l        U R                  5         [        (       a<  U R
                  b/  U=(       d     [        R                  " U R
                  5      U l        O7U=(       d)    [        R                  R                  SS5      =(       d    SU l        SU l        Uc-  U R                   (       a  U R                   R#                  S	5        OU(       d  U R                   (       a  SU l        U R$                  (       a   [        R&                  " U R                  U R
                  5        [(        b  U R                  [(        :X  a  U R                  qO.[*        R,                  " S
U R                  < S[(        < S35         U R3                  5         U R5                  5         U R7                  5         g! [        R.                   ae  nSR1                  U R                  U5      n[*        R,                  " U5        U R                   R#                  U5        SU l        SU l         SnANSnAff = f)a  
Initialize the terminal.

:arg str kind: A terminal string as taken by :func:`curses.setupterm`.
    Defaults to the value of the ``TERM`` environment variable.

    .. note:: Terminals within a single process must share a common
        ``kind``. See :obj:`_CUR_TERM`.

:arg file stream: A file-like object representing the Terminal output.
    Defaults to the original value of :obj:`sys.__stdout__`, like
    :func:`curses.initscr` does.

    If ``stream`` is not a tty, empty Unicode strings are returned for
    all capability values, so things like piping your program output to
    a pipe or file does not emit terminal sequences.

:arg bool force_styling: Whether to force the emission of capabilities
    even if :obj:`sys.__stdout__` does not seem to be connected to a
    terminal. If you want to force styling to not happen, use
    ``force_styling=None``.

    This comes in handy if users are trying to pipe your output through
    something like ``less -r`` or build systems which support decoding
    of terminal sequences.
zparameters: kind=z	, stream=z, force_styling=NTFTERMdumbzforce_styling is NonezA terminal of kind "zj" has been requested; due to an internal python curses bug, terminal capabilities for a terminal of kind "zA" will continue to be returned for the remainder of this process.z$Failed to setupterm(kind={0!r}): {1})errors_normal_line_buffered_stream_keyboard_fd_init_descriptor	_is_a_tty_Terminal__init__streams
IS_WINDOWScursesget_term_kindosenvironget_does_stylingis_a_ttyappenddoes_styling	setupterm	_CUR_TERMwarningswarnerrorformat#_Terminal__init__color_capabilities_Terminal__init__capabilities_Terminal__init__keycodes)selfkindstreamforce_stylingerrmsgs         C/var/www/html/venv/lib/python3.13/site-packages/blessed/terminal.py__init__Terminal.__init__|   s   < fm5 6 #  $:$//;G1F1F!GDJI!?I6DJ" T]]KK67dmm!%D5  T-B-BC $

i(? $

I MM
 !JJ		45 	'')!!#1 << +<CCDJJPSTc"""3'!
%*""+s   4+G& &I:AIIc                 x   S nU R                   c  [        R                  U l         [        U R                   S5      (       d  U R                  R                  S5        O[        U R                   R                  5      (       d  U R                  R                  S5        Ob U R                   R                  5       n[        R                  " U5      U l
        U R                  (       d  U R                  R                  S5        U R                   [        R                  [        R                  4;   a   [        R                  R                  5       U l        U R                  (       d#  U R                  R                  S5        S U l        Oc[        R                  " U R                  5      (       d"  U R                  R                  S5        S U l        OU R                  R                  S	5        Xl        Uc%   [        R                  R                  5       U l        g g ! [         a)  nU R                  R                  SU-  5         S nAGNFS nAff = f! [         [        4 a(  nU R                  R                  SU-  5         S nANS nAff = f! [         a(  nU R                  R                  S
U-  5         S nAg S nAff = f)Nfilenozstream has no fileno methodzstream.fileno is not callablezstream not a TTYz5Unable to determine output stream file descriptor: %szOutput stream is not a TTYzInput stream is not a TTYz4Unable to determine input stream file descriptor: %sz%Output stream is not a default streamz2Unable to determine __stdout__ file descriptor: %s)ro   sys
__stdout__hasattrrl   r}   callabler   rx   isattyrr   
ValueError
__stderr__	__stdin__rp   r|   AttributeErrorrq   )r   	stream_fdr   s      r   __init__streamsTerminal.__init__streams   s    	 <<>>DLt||X..KK<=$,,--..KK>?	; LL//1	 "$9!5~~KK&&'9: <<CNNCNN;;-$'MM$8$8$:!
 }}KK&&'CD(,D%4#4#455KK&&'BC(,D%KKFG !*_(+(=(=(?% 9  b ""#Z]`#`aab #J/ a""#Y\_#_``a$  _""#WZ]#]^^_sH   H -#I 1#J 
I	 II	JI??J
J9J44J9c                    SU l         U R                  (       d  SU l        g [        (       d#  [        R
                  R                  S5      S;   a  SU l        g [        S[        R                  " S5      =(       d    S5      U l        g )Ncie2000r   	COLORTERM)	truecolor24bit   colors)
_color_distance_algorithmr~   number_of_colorsrt   rx   ry   rz   maxru   tigetnumr   s    r   __init__color_capabilities#Terminal.__init__color_capabilities  sZ    )2&  $%D!Z2::>>+6:PP$+D!$'6??8+D+J$KD!    c                 ^    [        [        U 5      5      [        -   H  n[        X5        M     g N)setdirr   delattr)r   cached_color_caps     r   __clear_color_capabilities#Terminal.__clear_color_capabilities
  s"     #CI 7D+ !8r   c                    [         R                  " 5       U l        [        R                  " 5        H!  u  nu  p#[        XU5      U R                  U'   M#     [        R                  " 5        H  u  nu  p$U R                  (       a9  [        X5      nU(       a'  [
        R                  " XU40 UD6U R                  U'   MR  [        R                  " U5      nU(       d  Mq  [        XU5      U R                  U'   M     [        R                  " SR                  S U R                  R	                  5        5       5      5      U l        [        R                  " SR                  S U R                  R	                  5        5       5      S-   5      U l        [        R                  " SR                  S U R                  R	                  5        5       5      S-   5      U l        g )N|c              3   >   #    U  H  u  pUR                   v   M     g 7fr   )pattern.0namecaps      r   	<genexpr>0Terminal.__init__capabilities.<locals>.<genexpr>'  s     D2CYTS[[2C   c              3   >   #    U  H  u  pUR                   v   M     g 7fr   )named_patternr   s      r   r   r   +  s      6
/@)$C/@r   z|(?P<MISMATCH>.)c              3   \   #    U  H"  u  pS R                  UR                  5      v   M$     g7f)z({0})N)r   r   r   s      r   r   r   .  s&      5
9JIDGNN3;;''9Js   *,z|(.))collectionsOrderedDictcapsr   itemsr   r   r~   getattrbuildr   rz   recompilejoincaps_compiled_caps_compiled_any_caps_unnamed_any)r   r   	attributer   kwdsr   s         r   __init__capabilitiesTerminal.__init__capabilities  sy     ++-	 +A*F*F*H&D&9%dY?DIIdO +I (;'@'@'B#D#9  d.&-mm9'604'6DIIdO -006Gw")$"C		$ (C  ZZHHD$))//2CDDF
 #%**SXX 6
/3yy/@6
 .
. #  "$CHH 5
9=9J5
 -
- "r   c                    [        5       U l        U R                  R                  5        H  u  p[        XU5        M     [	        U 5      U l        [        U R
                  5      U l        [        R                  " 5       U l
        U R                  b  [        (       a5  [        5       =(       d    [        R                  " 5       =(       d    SU l        O#[        R                  " 5       =(       d    SU l         ["        R$                  " U R                   5      " 5       U l        g g ! [(         a`  n[*        R,                  " SR/                  U5      5        SU l        ["        R$                  " U R                   5      " 5       U l         S nAg S nAff = f)NzUTF-8z3LookupError: {0}, defaulting to UTF-8 for keyboard.)r	   	_keycodesr   setattrr   _keymapr
   _keymap_prefixesr   deque_keyboard_bufrp   rt   r   localegetpreferredencoding	_encodingcodecsgetincrementaldecoder_keyboard_decoderLookupErrorr   r   r   )r   key_codekey_namer   s       r   __init__keycodesTerminal.__init__keycodes2  s0    ,- #'.."6"6"8HDH- #9 .d3 !5T\\ B )..0( z!;!= "@224"@8?  "(!<!<!>!I'X)/)E)Ednn)U)W& )  XSZZ[^_`!()/)E)Ednn)U)W&&	Xs   4*D   
F
*AFF
c                 j    U R                   (       d
  [        5       $ [        X5      n[        XU5        U$ )a  
Return a terminal capability as Unicode string.

For example, ``term.bold`` is a unicode string that may be prepended
to text to set the video attribute for bold, which should also be
terminated with the pairing :attr:`normal`. This capability
returns a callable, so you can use ``term.bold("hi")`` which
results in the joining of ``(term.bold, "hi", term.normal)``.

Compound formatters may also be used. For example::

    >>> term.bold_blink_red_on_green("merry x-mas!")

For a parameterized capability such as ``move`` (or ``cup``), pass the
parameters as positional arguments::

    >>> term.move(line, column)

See the manual page `terminfo(5)
<https://invisible-island.net/ncurses/man/terminfo.5.html>`_ for a
complete list of capabilities and their arguments.
)r{   r   r   r   )r   attrvals      r   __getattr__Terminal.__getattr__V  s1    . !!%''  +C 
r   c                     U R                   $ )zT
Read-only property: Terminal kind determined on class initialization.

:rtype: str
)rw   r   s    r   r   Terminal.kindx  s     zzr   c                     U R                   $ )zS
Read-only property: Whether this class instance may emit sequences.

:rtype: bool
)r{   r   s    r   r~   Terminal.does_styling  s     !!!r   c                     U R                   $ )zK
Read-only property: Whether :attr:`~.stream` is a terminal.

:rtype: bool
)rr   r   s    r   r|   Terminal.is_a_tty  s     ~~r   c                 6    U R                  5       R                  $ )zO
Read-only property: Height of the terminal (in number of lines).

:rtype: int
)_height_and_widthws_rowr   s    r   r#   Terminal.height       %%'...r   c                 6    U R                  5       R                  $ )zP
Read-only property: Width of the terminal (in number of columns).

:rtype: int
)r   ws_colr   s    r   r$   Terminal.width  r   r   c                 6    U R                  5       R                  $ )zE
Read-only property: Height ofthe terminal (in pixels).

:rtype: int
)r   	ws_ypixelr   s    r   pixel_heightTerminal.pixel_height       %%'111r   c                 6    U R                  5       R                  $ )zA
Read-only property: Width of terminal (in pixels).

:rtype: int
)r   	ws_xpixelr   s    r   pixel_widthTerminal.pixel_width  r   r   c                     [         (       a_  [        R                  " U [        R                  [
        R                  5      n[        [        R                  " [
        R                  U5      6 $ [        SSSSS9$ )a[  
Return named tuple describing size of the terminal by ``fd``.

If the given platform does not have modules :mod:`termios`,
:mod:`fcntl`, or :mod:`tty`, window size of 80 columns by 25
rows is always returned.

:arg int fd: file descriptor queries for its window size.
:raises IOError: the file descriptor ``fd`` is not a terminal.
:rtype: WINSZ
:returns: named tuple describing size of the terminal

WINSZ is a :class:`collections.namedtuple` instance, whose structure
directly maps to the return value of the :const:`termios.TIOCGWINSZ`
ioctl return value. The return parameters are:

    - ``ws_row``: width of terminal by its number of character cells.
    - ``ws_col``: height of terminal by its number of character cells.
    - ``ws_xpixel``: width of terminal by pixels (not accurate).
    - ``ws_ypixel``: height of terminal by pixels (not accurate).
   P   r   r   r   r   r   )
HAS_TTYfcntlioctltermios
TIOCGWINSZWINSZ_BUFstructunpack_FMT)fddatas     r   _winsizeTerminal._winsize  sP    . 7;;r7#5#5uzzBD&--

D9::BrQ!DDr   c           	      H   U R                   [        R                  4 H  n Ub  U R                  U5      s  $ M     [        [        [        R                  " SS5      5      [        [        R                  " SS5      5      SSS9$ ! [        [
        [        [        4 a     M  f = f)a  
Return a tuple of (terminal height, terminal width).

If :attr:`stream` or :obj:`sys.__stdout__` is not a tty or does not
support :func:`fcntl.ioctl` of :const:`termios.TIOCGWINSZ`, a window
size of 80 columns by 25 rows is returned for any values not
represented by environment variables ``LINES`` and ``COLUMNS``, which
is the default text mode of IBM PC compatibles.

:rtype: WINSZ
:returns: Named tuple specifying the terminal size

WINSZ is a :class:`collections.namedtuple` instance, whose structure
directly maps to the return value of the :const:`termios.TIOCGWINSZ`
ioctl return value. The return parameters are:

    - ``ws_row``: height of terminal by its number of cell rows.
    - ``ws_col``: width of terminal by its number of cell columns.
    - ``ws_xpixel``: width of terminal by pixels (not accurate).
    - ``ws_ypixel``: height of terminal by pixels (not accurate).

    .. note:: the peculiar (height, width, width, height) order, which
       matches the return order of TIOCGWINSZ!
NLINES25COLUMNS80r  )rq   r   r   r  IOErrorOSErrorr   	TypeErrorr  intrx   getenv)r   r  s     r   r   Terminal._height_and_width  s    2 ((#..9B>==,, " : C		'4 89		)T :;##% 	% Wj)< s   BB! B!c                    Sn U R                   (       a   U R                  5       nUR                  5         U R                  R	                  U5        U R                  R                  5         [        U UUS9u  pVU(       a&  USUR                  5        XeR                  5       S -   nU R                  U5        Ub  UR                  SSS5        U$ ! Ub  UR                  SSS5        f f = f)a=  
Sends a query string to the terminal and waits for a response.

:arg str query_str: Query string written to output
:arg str response_re: Regular expression matching query response
:arg float timeout: Return after time elapsed in seconds
:return: re.match object for response_re or None if not found
:rtype: re.Match
N)termr   timeout)rn   r!   	__enter__r   writeflushr   startendungetch__exit__)r   	query_strresponse_rer"  ctxmatchr  s          r   _query_responseTerminal._query_response  s      	/""kkm KKi(KK &4.9.57KE
 NU[[]+d99;<.@@ LL T4. T4. s   B1C C&c              #     #    U R                   R                  U R                  5        Ub.  Ub+  U R                   R                  U R                  X!5      5        O[Ub+  U R                   R                  U R	                  U5      5        O-Ub*  U R                   R                  U R                  U5      5         U R                   R                  5         Sv   U R                   R                  U R                  5        U R                   R                  5         g! U R                   R                  U R                  5        U R                   R                  5         f = f7f)a  
Context manager for temporarily moving the cursor.

:arg int x: horizontal position, from left, *0*, to right edge of screen, *self.width - 1*.
:arg int y: vertical position, from top, *0*, to bottom of screen, *self.height - 1*.
:return: a context manager.
:rtype: Iterator

Move the cursor to a certain position on entry, do any kind of I/O, and upon exit
let you print stuff there, then return the cursor to its original position:


.. code-block:: python

    term = Terminal()
    with term.location(y=0, x=0):
        for row_num in range(term.height-1):
            print('Row #{row_num}')
    print(term.clear_eol + 'Back to original location.')

Specify ``x`` to move to a certain column, ``y`` to move to a certain
row, both, or neither. If you specify neither, only the saving and
restoration of cursor position will happen. This can be useful if you
simply want to restore your place after doing some manual cursor
movement.

Calls cannot be nested: only one should be entered at a time.

.. note:: The argument order *(x, y)* differs from the return value order *(y, x)*
    of :meth:`get_location`, or argument order *(y, x)* of :meth:`move`. This is
    for API Compaibility with the blessings library, sorry for the trouble!
N)r   r$  r*   r8   r;   r=   r%  r,   r   xys      r   locationTerminal.location%  s     L 	$))$=Q]KKdiio.]KKdkk!n-]KKdkk!n-	 KK KKdll+KK KKdll+KKs    B2E5D A EAEEc                 :   [        X R                  S   R                  5      =(       d    SnU R                  U R                  =(       d    SU R                  S   R
                  U5      nU(       a,  S UR                  5        5       u  pESU;   a
  US-  nUS-  nXE4$ g)a  
Return tuple (row, column) of cursor position.

:arg float timeout: Return after time elapsed in seconds with value ``(-1, -1)`` indicating
    that the remote end did not respond.
:rtype: tuple
:returns: cursor position as tuple in form of ``(y, x)``.  When a timeout is specified,
    always ensure the return value is checked for ``(-1, -1)``.

The location of the cursor is determined by emitting the ``u7`` terminal capability, or
VT100 `Query Cursor Position
<https://www2.ccs.neu.edu/research/gpc/VonaUtils/vona/terminal/vtansi.htm#status>`_
when such capability is undefined, which elicits a response from a reply string described by
capability ``u6``, or again VT100's definition of ``\x1b[%i%d;%dR`` when undefined.

The ``(y, x)`` return value matches the parameter order of the :meth:`move_yx` capability.
The following sequence should cause the cursor to not move at all::

    >>> term = Terminal()
    >>> term.move_yx(*term.get_location()))

And the following should assert True with a terminal:

    >>> term = Terminal()
    >>> given_y, given_x = 10, 20
    >>> with term.location(y=given_y, x=given_x):
    ...     result_y, result_x = term.get_location()
    ...
    >>> assert given_x == result_x, (given_x, result_x)
    >>> assert given_y == result_y, (given_y, result_y)
re   z
[%i%d;%dRz[6nc              3   8   #    U  H  n[        U5      v   M     g 7fr   r  r   r   s     r   r   (Terminal.get_location.<locals>.<genexpr>  s     ;NSCNs   z%ir   )r   r   )r   r   r   r.  rW   re_compiledgroups)r   r"  response_strr-  rowcols         r   get_locationTerminal.get_locationZ  s    b tYY%?%I%IJ^N^$$GG!z499_#=#I#I7
 ;ELLN;HC $qq8O
 r   c                     U R                  S[        R                  " S5      U5      nU(       a   [        S UR	                  5        5       5      $ S$ )a  
Return tuple (r, g, b) of foreground color.

:arg float timeout: Return after time elapsed in seconds with value ``(-1, -1, -1)``
    indicating that the remote end did not respond.
:rtype: tuple
:returns: foreground color as tuple in form of ``(r, g, b)``.  When a timeout is specified,
    always ensure the return value is checked for ``(-1, -1, -1)``.

The foreground color is determined by emitting an `OSC 10 color query
<https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands>`_.
z]10;?z6]10;rgb:([0-9a-fA-F]+)/([0-9a-fA-F]+)/([0-9a-fA-F]+)c              3   :   #    U  H  n[        US 5      v   M     g7f   Nr8  r9  s     r   r   'Terminal.get_fgcolor.<locals>.<genexpr>       <^cSb\\^   r   r   r   r.  r   r   tupler<  r   r"  r-  s      r   get_fgcolorTerminal.get_fgcolor  I     $$JJVW
 AFu<U\\^<<W<Wr   c                     U R                  S[        R                  " S5      U5      nU(       a   [        S UR	                  5        5       5      $ S$ )a  
Return tuple (r, g, b) of background color.

:arg float timeout: Return after time elapsed in seconds with value ``(-1, -1, -1)``
    indicating that the remote end did not respond.
:rtype: tuple
:returns: background color as tuple in form of ``(r, g, b)``.  When a timeout is specified,
    always ensure the return value is checked for ``(-1, -1, -1)``.

The background color is determined by emitting an `OSC 11 color query
<https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands>`_.
z]11;?z6]11;rgb:([0-9a-fA-F]+)/([0-9a-fA-F]+)/([0-9a-fA-F]+)c              3   :   #    U  H  n[        US 5      v   M     g7frD  r8  r9  s     r   r   'Terminal.get_bgcolor.<locals>.<genexpr>  rG  rH  rI  rJ  rL  s      r   get_bgcolorTerminal.get_bgcolor  rO  r   c              #     #    U R                   R                  U R                  5        U R                   R                  5          Sv   U R                   R                  U R                  5        U R                   R                  5         g! U R                   R                  U R                  5        U R                   R                  5         f = f7f)a  
Context manager that switches to secondary screen, restoring on exit.

Under the hood, this switches between the primary screen buffer and
the secondary one. The primary one is saved on entry and restored on
exit.  Likewise, the secondary contents are also stable and are
faithfully restored on the next entry::

    with term.fullscreen():
        main()

.. note:: There is only one primary and one secondary screen buffer.
   :meth:`fullscreen` calls cannot be nested, only one should be
   entered at a time.
N)r   r$  r4   r%  r6   r   s    r   
fullscreenTerminal.fullscreen  s     " 	$//0	 KKd223KK KKd223KK    A CB A CACCc              #     #    U R                   R                  U R                  5        U R                   R                  5          Sv   U R                   R                  U R                  5        U R                   R                  5         g! U R                   R                  U R                  5        U R                   R                  5         f = f7f)z
Context manager that hides the cursor, setting visibility on exit.

    with term.hidden_cursor():
        main()

.. note:: :meth:`hidden_cursor` calls cannot be nested: only one
    should be entered at a time.
N)r   r$  r?   r%  rA   r   s    r   hidden_cursorTerminal.hidden_cursor  s      	$**+	 KKd001KK KKd001KKrX  c                 $    U R                  X!5      $ )an  
A callable string that moves the cursor to the given ``(x, y)`` screen coordinates.

:arg int x: horizontal position, from left, *0*, to right edge of screen, *self.width - 1*.
:arg int y: vertical position, from top, *0*, to bottom of screen, *self.height - 1*.
:rtype: ParameterizingString
:returns: Callable string that moves the cursor to the given coordinates
r8   r1  s      r   move_xyTerminal.move_xy  s     yyr   c                 $    U R                  X5      $ )an  
A callable string that moves the cursor to the given ``(y, x)`` screen coordinates.

:arg int y: vertical position, from top, *0*, to bottom of screen, *self.height - 1*.
:arg int x: horizontal position, from left, *0*, to right edge of screen, *self.width - 1*.
:rtype: ParameterizingString
:returns: Callable string that moves the cursor to the given coordinates
r]  )r   r3  r2  s      r   r:   Terminal.move_yx
  s     yyr   c                 T    [        U R                  [        U R                  5      5      $ )zBMove cursor 1 cells to the left, or callable string for n>1 cells.)r   cub1r   cubr   s    r   	move_leftTerminal.move_left       %TYY0DTXX0NOOr   c                 T    [        U R                  [        U R                  5      5      $ )zKMove cursor 1 or more cells to the right, or callable string for n>1 cells.)r   cuf1r   cufr   s    r   
move_rightTerminal.move_right  rg  r   c                 T    [        U R                  [        U R                  5      5      $ )zFMove cursor 1 or more cells upwards, or callable string for n>1 cells.)r   cuu1r   cuur   s    r   move_upTerminal.move_up  rg  r   c                 T    [        U R                  [        U R                  5      5      $ )zHMove cursor 1 or more cells downwards, or callable string for n>1 cells.)r   cud1r   cudr   s    r   	move_downTerminal.move_down$  rg  r   c                 z    U R                   (       a!  [        U R                  U R                  S5      $ [	        5       $ )a  
A callable string that sets the foreground color.

:rtype: ParameterizingString

The capability is unparameterized until called and passed a number, at which point it
returns another string which represents a specific color change. This second string can
further be called to color a piece of text and set everything back to normal afterward.

This should not be used directly, but rather a specific color by name or
:meth:`~.Terminal.color_rgb` value.
color)r~   r   _foreground_colorrE   r   r   s    r   rx  Terminal.color)  s/     '(>(>WUU!##r   c                     U R                   S:X  a'  SR                  XU5      n[        X@R                  5      $ U R	                  XU5      n[        U R                  U5      U R                  5      $ )a  
Provides callable formatting string to set foreground color to the specified RGB color.

:arg int red: RGB value of Red.
:arg int green: RGB value of Green.
:arg int blue: RGB value of Blue.
:rtype: FormattingString
:returns: Callable string that sets the foreground color

If the terminal does not support RGB color, the nearest supported
color will be determined using :py:attr:`color_distance_algorithm`.
r   z[38;2;{0};{1};{2}m)r   r   r   rE   rgb_downconvertry  r   redgreenbluefmt_attr	color_idxs         r   	color_rgbTerminal.color_rgb<  sc       G+077DIH#Hkk:: ((T:	 6 6y A4;;OOr   c                 z    U R                   (       a!  [        U R                  U R                  S5      $ [	        5       $ )zU
A callable capability that sets the background color.

:rtype: ParameterizingString
on_color)r~   r   _background_colorrE   r   r   s    r   r  Terminal.on_colorR  s/     '(>(>ZXX!##r   c                     U R                   S:X  a'  SR                  XU5      n[        X@R                  5      $ U R	                  XU5      n[        U R                  U5      U R                  5      $ )a  
Provides callable formatting string to set background color to the specified RGB color.

:arg int red: RGB value of Red.
:arg int green: RGB value of Green.
:arg int blue: RGB value of Blue.
:rtype: FormattingString
:returns: Callable string that sets the foreground color

If the terminal does not support RGB color, the nearest supported
color will be determined using :py:attr:`color_distance_algorithm`.
r   z[48;2;{0};{1};{2}m)r   r   r   rE   r|  r  r}  s         r   on_color_rgbTerminal.on_color_rgb^  sa       G+077DIH#Hkk::((T:	 6 6y A4;;OOr   c                 p    [        U5      n[        S U 5       5      (       a  [        X5      $ [        5       $ )a  
Provides callable formatting string to set color and other text formatting options.

:arg str value: Sugary, ordinary, or compound formatted terminal capability,
    such as "red_on_white", "normal", "red", or "bold_on_black".
:rtype: :class:`FormattingString` or :class:`NullCallableString`
:returns: Callable string that sets color and other text formatting options

Calling ``term.formatter('bold_on_red')`` is equivalent to ``term.bold_on_red``, but a
string that is not a valid text formatter will return a :class:`NullCallableString`.
This is intended to allow validation of text formatters without the possibility of
inadvertently returning another terminal capability.
c              3   R   #    U  H  o[         ;   =(       d	    U[        ;   v   M     g 7fr   )r   r   )r   fmts     r   r   %Terminal.formatter.<locals>.<genexpr>  s     M*3v5!55*s   %')r   allr   r   )r   value
formatterss      r   	formatterTerminal.formatterr  s3     $E*
M*MMM4''!##r   c                     [         U R                     nSnSn[        [        5       H-  u  pxU" XX#45      n	Ub  X:  a  U	nUnXpR                  :  d  M,    U$    U$ )a  
Translate an RGB color to a color code of the terminal's color depth.

:arg int red: RGB value of Red (0-255).
:arg int green: RGB value of Green (0-255).
:arg int blue: RGB value of Blue (0-255).
:rtype: int
:returns: Color code of downconverted RGB color
   N)r   color_distance_algorithm	enumerater   r   )
r   r~  r  r  fn_distancer  shortest_distance	cmp_depthcmp_rgbcmp_distances
             r   r|  Terminal.rgb_downconvert  ss      00M0MN	 "+L"9I&we0BCL (L,L$0!%	111 #: r   c                 v    U R                   (       a  U R                   $ [        U S5      U l         U R                   $ )a   
A capability that resets all video attributes.

:rtype: str

``normal`` is an alias for ``sgr0`` or ``exit_attribute_mode``. Any
styling attributes previously applied, such as foreground or
background colors, reverse video, or bold are reset to defaults.
rE   )rm   r   r   s    r   rE   Terminal.normal  s-     <<<<)$9||r   c                 *   [        U5      S:  d   [        U5      U45       eU(       aE  [        [        U5      5      S:  d   [        [        U5      5      U45       eSR                  U5      nOSnU R                  (       d  U$ SR                  XAU5      $ )a4  
Display ``text`` that when touched or clicked, navigates to ``url``.

Optional ``url_id`` may be specified, so that non-adjacent cells can reference a single
target, all cells painted with the same "id" will highlight on hover, rather than any
individual one, as described in "Hovering and underlining the id parameter" of gist
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda.

:param str url: Hyperlink URL.
:param str text: Clickable text.
:param str url_id: Optional 'id'.
:rtype: str
:returns: String of ``text`` as a hyperlink to ``url``.
i     zid={0} z]8;{0};{1}\{2}]8;;\)lenstrr   r~   )r   urltexturl_idparamss        r   linkTerminal.link  s     3x$/S3/s6{#c)ECF,<f+EE)__V,FF  K!!'T!:	<r   c                     U R                   $ )z
Read-only property: stream the terminal outputs to.

This is a convenience attribute. It is used internally for implied
writes performed by context managers :meth:`~.hidden_cursor`,
:meth:`~.fullscreen`, :meth:`~.location`, and :meth:`~.keypad`.
)ro   r   s    r   r   Terminal.stream  s     ||r   c                     U R                   $ )a  
Number of colors supported by terminal.

Common return values are 0, 8, 16, 256, or 1 << 24.

This may be used to test whether the terminal supports colors, and at what depth, if that's
a concern.

If this property is assigned a value of 88, the value 16 will be saved. This is due to the
the rarity of 88 color support and the inconsistency of behavior between implementations.

Assigning this property to a value other than 0, 4, 8, 16, 88, 256, or 1 << 24 will raise an
:py:exc:`AssertionError`.
)_number_of_colorsr   s    r   r   Terminal.number_of_colors  s      %%%r   c                 R    US;   d   eUS:X  a  SOUU l         U R                  5         g )N)r         rE  X      r   r  rE  )r  #_Terminal__clear_color_capabilitiesr   r  s     r   r   r    s/    7777 (-{'')r   c                     U R                   $ )z
Color distance algorithm used by :meth:`rgb_downconvert`.

The slowest, but most accurate, 'cie2000', is default. Other available options are 'rgb',
'rgb-weighted', 'cie76', and 'cie94'.
)r   r   s    r   r  !Terminal.color_distance_algorithm  s     ---r   c                 H    U[         ;   d   eXl        U R                  5         g r   )r   r   r  r  s     r   r  r    s#    1111).&'')r   c                 @    U R                   =(       d    U R                  $ )a  
Convenience capability to support :attr:`~.on_color`.

Prefers returning sequence for capability ``setaf``, "Set foreground color to #1, using ANSI
escape". If the given terminal does not support such sequence, fallback to returning
attribute ``setf``, "Set foreground color #1".
)setafsetfr   s    r   ry  Terminal._foreground_color       zz&TYY&r   c                 @    U R                   =(       d    U R                  $ )a  
Convenience capability to support :attr:`~.on_color`.

Prefers returning sequence for capability ``setab``, "Set background color to #1, using ANSI
escape". If the given terminal does not support such sequence, fallback to returning
attribute ``setb``, "Set background color #1".
)setabsetbr   s    r   r  Terminal._background_color  r  r   c                 T    Uc  U R                   n[        X5      R                  X#5      $ )aX  
Left-align ``text``, which may contain terminal sequences.

:arg str text: String to be aligned
:arg int width: Total width to fill with aligned text. If
    unspecified, the whole width of the terminal is filled.
:arg str fillchar: String for padding the right of ``text``
:rtype: str
:returns: String of ``text``, left-aligned by ``width``.
)r$   r   ljustr   r  r$   fillchars       r   r  Terminal.ljust  s(     =JJE#))%::r   c                 T    Uc  U R                   n[        X5      R                  X#5      $ )aW  
Right-align ``text``, which may contain terminal sequences.

:arg str text: String to be aligned
:arg int width: Total width to fill with aligned text. If
    unspecified, the whole width of the terminal is used.
:arg str fillchar: String for padding the left of ``text``
:rtype: str
:returns: String of ``text``, right-aligned by ``width``.
)r$   r   rjustr  s       r   r  Terminal.rjust)  s(     =JJE#))%::r   c                 T    Uc  U R                   n[        X5      R                  X#5      $ )aU  
Center ``text``, which may contain terminal sequences.

:arg str text: String to be centered
:arg int width: Total width in which to center text. If
    unspecified, the whole width of the terminal is used.
:arg str fillchar: String for padding the left and right of ``text``
:rtype: str
:returns: String of ``text``, centered by ``width``
)r$   r   centerr  s       r   r  Terminal.center8  s(     =JJE#**5;;r   c                 T    Uc  U R                   n[        X5      R                  U5      $ )a:  
Truncate ``text`` to maximum ``width`` printable characters, retaining terminal sequences.

:arg str text: Text to truncate
:arg int width: The maximum width to truncate it to
:rtype: str
:returns: ``text`` truncated to at most ``width`` printable characters

>>> term.truncate(u'xyz\x1b[0;3m', 2)
u'xy\x1b[0;3m'
)r$   r   truncate)r   r  r$   s      r   r  Terminal.truncateG  s(     =JJE#,,U33r   c                 4    [        X5      R                  5       $ )u4  
Return printable length of a string containing sequences.

:arg str text: String to measure. May contain terminal sequences.
:rtype: int
:returns: The number of terminal character cells the string will occupy
    when printed

Wide characters that consume 2 character cells are supported:

>>> term = Terminal()
>>> term.length(term.clear + term.red(u'コンニチハ'))
10

.. note:: Sequences such as 'clear', which is considered as a
    "movement sequence" because it would move the cursor to
    (y, x)(0, 0), are evaluated as a printable length of
    *0*.
)r   lengthr   r  s     r   r  Terminal.lengthW  s    ( #**,,r   c                 6    [        X5      R                  U5      $ )z
Return ``text`` without sequences and leading or trailing whitespace.

:rtype: str
:returns: Text with leading and trailing whitespace removed

>>> term.strip(u' \x1b[0;3m xyz ')
u'xyz'
)r   stripr   r  charss      r   r  Terminal.stripm  s     #))%00r   c                 6    [        X5      R                  U5      $ )z
Return ``text`` without terminal sequences or trailing whitespace.

:rtype: str
:returns: Text with terminal sequences and trailing whitespace removed

>>> term.rstrip(u' \x1b[0;3m xyz ')
u'  xyz'
)r   rstripr  s      r   r  Terminal.rstripy       #**511r   c                 6    [        X5      R                  U5      $ )z
Return ``text`` without terminal sequences or leading whitespace.

:rtype: str
:returns: Text with terminal sequences and leading whitespace removed

>>> term.lstrip(u' \x1b[0;3m xyz ')
u'xyz '
)r   lstripr  s      r   r  Terminal.lstrip  r  r   c                 4    [        X5      R                  5       $ )a  
Return ``text`` stripped of only its terminal sequences.

:rtype: str
:returns: Text with terminal sequences removed

>>> term.strip_seqs(u'\x1b[0;3mxyz')
u'xyz'
>>> term.strip_seqs(term.cuf(5) + term.red(u'test'))
u'     test'

.. note:: Non-destructive sequences that adjust horizontal distance
    (such as ``\b`` or ``term.cuf(5)``) are replaced by destructive
    space or erasing.
)r   
strip_seqsr  s     r   r  Terminal.strip_seqs  s      #..00r   c                    U R                   n/ n[        [        R                  " X15      5       H[  u  pVUR	                  UR                  5       5        U(       d  M-  XR:X  d  M4  XR                  5       S nU(       a  US==   U-  ss'     U$    U$ )a9  
Return ``text`` split by individual character elements and sequences.

:arg str text: String containing sequences
:arg int maxsplit: When maxsplit is nonzero, at most maxsplit splits
    occur, and the remainder of the string is returned as the final element
    of the list (same meaning is argument for :func:`re.split`).
:rtype: list[str]
:returns: List of sequences and individual characters

>>> term.split_seqs(term.underline(u'xyz'))
['\x1b[4m', 'x', 'y', 'z', '\x1b(B', '\x1b[m']

>>> term.split_seqs(term.underline(u'xyz'), 1)
['\x1b[4m', r'xyz\x1b(B\x1b[m']
Nr   )r   r  r   finditerr}   groupr'  )r   r  maxsplitr   resultidxr-  	remainings           r   
split_seqsTerminal.split_seqs  sz    " ((#BKK$>?JCMM%++-(xCO .	2J)+J @ r   c                     Uc  U R                   OUn[        SX S.UD6n/ nUR                  5        HC  nUR                  UR	                  5       (       a  [        UR                  U5      5      OS5        ME     U$ )a9  
Text-wrap a string, returning a list of wrapped lines.

:arg str text: Unlike :func:`textwrap.wrap`, ``text`` may contain
    terminal sequences, such as colors, bold, or underline. By
    default, tabs in ``text`` are expanded by
    :func:`string.expandtabs`.
:arg int width: Unlike :func:`textwrap.wrap`, ``width`` will
    default to the width of the attached terminal.
:arg \**kwargs: See :py:class:`textwrap.TextWrapper`
:rtype: list
:returns: List of wrapped lines

See :class:`textwrap.TextWrapper` for keyword arguments that can
customize wrapping behaviour.
)r$   r!  r   )r$   r   
splitlinesextendr  iterwrap)r   r  r$   kwargswrapperlineslines          r   r  Terminal.wrap  sh    " $m

%GEGGOO%DLLTZZ\\gll401vN & r   c                     U R                   c   e[        R                  " U R                   S5      nU R                  R	                  USS9$ )a	  
Read, decode, and return the next byte from the keyboard stream.

:rtype: unicode
:returns: a single unicode character, or ``u''`` if a multi-byte
    sequence has not yet been fully received.

This method name and behavior mimics curses ``getch(void)``, and
it supports :meth:`inkey`, reading only one byte from
the keyboard string at a time. This method should always return
without blocking if called after :meth:`kbhit` has returned True.

Implementors of alternate input stream methods should override
this method.
r   F)final)rp   rx   readr   decode)r   bytes     r   getchTerminal.getch  sH        ,,,wwt((!,%%,,T,??r   c                 :    U R                   R                  U5        g)z~
Buffer input data to be discovered by next call to :meth:`~.inkey`.

:arg str text: String to be buffered as keyboard input.
N)r   
extendleftr  s     r   r(  Terminal.ungetch  s     	%%d+r   c                 x   [         R                   " 5       nS/nU R                  b  U R                  /O/ n[        (       a   [        R                  " U/ / U5      u  n  n U R                  c  S$ XC:H  $ ! [         a/    Ub)  U[         R                   " 5       U-
  -  nUS:  a   Mn  / n MI   Of = f[        (       a  M{  N])a  
Return whether a keypress has been detected on the keyboard.

This method is used by :meth:`inkey` to determine if a byte may
be read using :meth:`getch` without blocking.  The standard
implementation simply uses the :func:`select.select` call on stdin.

:arg float timeout: When ``timeout`` is 0, this call is
    non-blocking, otherwise blocking indefinitely until keypress
    is detected when None (default). When ``timeout`` is a
    positive number, returns after ``timeout`` seconds have
    elapsed (float).
:rtype: bool
:returns: True if a keypress is awaiting to be read on the keyboard
    attached to this terminal.  When input is not a terminal, False is
    always returned.
Nr   F)timerp   r  selectInterruptedError)r   r"  stimeready_rcheck_r_s         r   r"   Terminal.kbhit  s    $ 		()-):):)F4$$%Bg &gr2w GA0 ))1uIw7II3 $  &tyy{U22G{  G ' gs   A2 2.B+#B+*B+c              #     #    [         (       a  U R                  b  [        R                  " U R                  5      nU R                  n[
        R                  " U R                  [        R                  5         SU l        Sv   [        R                  " U R                  [        R                  U5        X l        gSv   g! [        R                  " U R                  [        R                  U5        X l        f = f7f)a  
Allow each keystroke to be read immediately after it is pressed.

This is a context manager for :func:`tty.setcbreak`.

This context manager activates 'rare' mode, the opposite of 'cooked'
mode: On entry, :func:`tty.setcbreak` mode is activated disabling
line-buffering of keyboard input and turning off automatic echo of
input as output.

.. note:: You must explicitly print any user input you would like
    displayed.  If you provide any kind of editing, you must handle
    backspace and other line-editing control functions in this mode
    as well!

**Normally**, characters received from the keyboard cannot be read
by Python until the *Return* key is pressed. Also known as *cooked* or
*canonical input* mode, it allows the tty driver to provide
line-editing before shuttling the input to your program and is the
(implicit) default terminal mode set by most unix shells before
executing programs.

Technically, this context manager sets the :mod:`termios` attributes
of the terminal attached to :obj:`sys.__stdin__`.

.. note:: :func:`tty.setcbreak` sets ``VMIN = 1`` and ``VTIME = 0``,
    see http://www.unixwiz.net/techtips/termios-vmin-vtime.html
NF)
r  rp   r
  	tcgetattrrn   tty	setcbreakTCSANOW	tcsetattr	TCSAFLUSHr   	save_modesave_line_buffereds      r   r!   Terminal.cbreak(  s     < 7t((4))$*;*;<I!%!4!4MM$++W__=9&+# !!$"3"3")"3"3"+- '9# !!$"3"3")"3"3"+- '9#   A4C97B> <C9>8C66C9c              #     #    [         (       a  U R                  b  [        R                  " U R                  5      nU R                  n[
        R                  " U R                  [        R                  5         SU l        Sv   [        R                  " U R                  [        R                  U5        X l        gSv   g! [        R                  " U R                  [        R                  U5        X l        f = f7f)a  
A context manager for :func:`tty.setraw`.

Although both :meth:`cbreak` and :meth:`raw` modes allow each keystroke
to be read immediately after it is pressed, Raw mode disables
processing of input and output.

In cbreak mode, special input characters such as ``^C`` or ``^S`` are
interpreted by the terminal driver and excluded from the stdin stream.
In raw mode these values are received by the :meth:`inkey` method.

Because output processing is not done, the newline ``'\n'`` is not
enough, you must also print carriage return to ensure that the cursor
is returned to the first column::

    with term.raw():
        print("printing in raw mode", end="\r\n")
NF)
r  rp   r
  r  rn   r  r    r  r  r  r  s      r   rawTerminal.rawX  s     ( 7t((4))$*;*;<I!%!4!4JJt(('//:9&+# !!$"3"3")"3"3"+- '9# !!$"3"3")"3"3"+- '9#r  c              #     #     U R                   R                  U R                  5        U R                   R                  5         Sv   U R                   R                  U R                  5        U R                   R                  5         g! U R                   R                  U R                  5        U R                   R                  5         f = f7f)aA  
Context manager that enables directional keypad input.

On entrying, this puts the terminal into "keyboard_transmit" mode by
emitting the keypad_xmit (smkx) capability. On exit, it emits
keypad_local (rmkx).

On an IBM-PC keyboard with numeric keypad of terminal-type *xterm*,
with numlock off, the lower-left diagonal key transmits sequence
``\\x1b[F``, translated to :class:`~.Terminal` attribute
``KEY_END``.

However, upon entering :meth:`keypad`, ``\\x1b[OF`` is transmitted,
translating to ``KEY_LL`` (lower-left key), allowing you to determine
diagonal direction keys.
N)r   r$  smkxr%  rmkxr   s    r   keypadTerminal.keypad}  s     $	 KKdii(KKKKdii(KK KKdii(KKs   CAB A CACCc                 |   [         R                   " 5       nSnU R                  (       a/  X@R                  R                  5       -  nU R                  (       a  M/  U R                  SS9(       a(  X@R	                  5       -  nU R                  SS9(       a  M(  [        X@R                  U R                  5      nU(       du  U R                  [        X15      S9(       aX  X@R	                  5       -  n[        X@R                  U R                  5      nU(       d  U R                  [        X15      S9(       a  MX  UR                  U R                  :X  a  [         R                   " 5       nUR                  U R                  :X  a  X@R                  ;   a  U R                  [        Xb5      S9(       az  X@R	                  5       -  n[        X@R                  U R                  5      nUR                  U R                  :X  a.  X@R                  ;   a  U R                  [        Xb5      S9(       a  Mz  U R                  U[        U5      S 5        U$ )a  
Read and return the next keyboard event within given timeout.

Generally, this should be used inside the :meth:`raw` context manager.

:arg float timeout: Number of seconds to wait for a keystroke before
    returning.  When ``None`` (default), this method may block
    indefinitely.
:arg float esc_delay: Time in seconds to block after Escape key
   is received to await another key sequence beginning with
   escape such as *KEY_LEFT*, sequence ``'\x1b[D'``], before returning a
   :class:`~.Keystroke` instance for ``KEY_ESCAPE``.

   Users may override the default value of ``esc_delay`` in seconds,
   using environment value of ``ESCDELAY`` as milliseconds, see
   `ncurses(3)`_ section labeled *ESCDELAY* for details.  Setting
   the value as an argument to this function will override any
   such preference.
:rtype: :class:`~.Keystroke`.
:returns: :class:`~.Keystroke`, which may be empty (``u''``) if
   ``timeout`` is specified and keystroke is not received.

.. note:: When used without the context manager :meth:`cbreak`, or
    :meth:`raw`, :obj:`sys.__stdin__` remains line-buffered, and this
    function will block until the return key is pressed!

.. note:: On Windows, a 10 ms sleep is added to the key press detection loop to reduce CPU
    load. Due to the behavior of :py:func:`time.sleep` on Windows, this will actually
    result in a 15.6 ms delay when using the default `time resolution
    <https://docs.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod>`_.
    Decreasing the time resolution will reduce this to 10 ms, while increasing it, which
    is rarely done, will have a perceptable impact on the behavior.

_`ncurses(3)`: https://www.man7.org/linux/man-pages/man3/ncurses.3x.html
r  r   )r"  N)r  r   popr"   r  r   r   r   r   code
KEY_ESCAPEr   r(  r  )r   r"  	esc_delayr  ucsksesctimes          r   inkeyTerminal.inkey  s   H 		   %%))++C     jjj#::<C jjj## c<<@
 Ju,FG::<C!#||T^^DB Ju,FGG 77doo%iikG77doo-///::j&D:Ezz|#%c<<H	 77doo-///::j&D:EE
 	SR]#	r   )r   r   r   r{   r   rq   rr   r   r   rp   r   r   r   rw   rn   rm   r  ro   r   r   rl   r   )NNF)NNr   r  )N )r   )I__name__
__module____qualname____firstlineno____doc___sugarr   rs   r   r  r   r   r   propertyr   r~   r|   r#   r$   r   r  staticmethodr  r   r.  
contextlibcontextmanagerr4  r@  rM  rS  rV  rZ  r^  r:   re  rk  rp  ru  rx  r  r  r  r  r|  rE   r  r   r   setterr  ry  r  r  r  r  r  r  r  r  r  r  r  r  r  r(  r"   r!   r  r  r   r)  __static_attributes__r  r   r   r(   r(   K   s@   !!4! 	T! 	U	!
 	T! 	G! 	7! 	! 	5! 	%! 	%! 	w! 	! 	! 	&!  	5!!" 	&#!$ !# A!FFQ f0_dL,"H"XH D   " "   / / / / 2 2 2 2 E E8#%J*X 2  2 hIVX*X*    0    $	 P P P P P P P P $ $$P, 	$ 	$P($*8  <4   & &" * * . . $$* %*
 ' ' ' ';";<4 -,
1
2
21$82@(,2Jh - -^ " "H    2 !,< Mr   r(   c                   F    \ rS rSrSrSrS\R                  " \5      -  rSr	g)r  i  a  
Structure represents return value of :const:`termios.TIOCGWINSZ`.

.. py:attribute:: ws_row

    rows, in characters

.. py:attribute:: ws_col

    columns, in characters

.. py:attribute:: ws_xpixel

    horizontal size, pixels

.. py:attribute:: ws_ypixel

    vertical size, pixels
hhhh r  N)
r,  r-  r.  r/  r0  r  r  calcsizer  r7  r  r   r   r  r    s!    ( DFOOD))Dr   r  r  )Cr0  rx   r   r   r  r   r   r  r  r%   r   r4  r   rx  r   keyboardr   r   r   r   r	   r
   r   	sequencesr   r   r   
colorspacer   r  r   r   r   r   r   r   r   r   r   _capabilitiesr   r   r   version_infor   r  r  systemrt   jinxedru   jinxed.win32r   r  r
  r  ImportError_TTY_METHODSr   r   _MSG_NOSUPPORTr   r   objectr(   
namedtupler  r  r   r   <module>rI     sM   H 	 	 
          -/ / / > = $- - - _ ^
 BQ& || ??	!J7J 	Yv Yx,*K""7 -6 7 *W-  
GE VX__. $		, 7  9 	 	n%
s   C; ;A
EE