
    <i              
       v   S r SSKrSSKrSrSr\R                  R                  R                  " \6 r	\R                  R                  R                  " \ V s/ s H  n SU -   PM
     sn 6 r
\R                  R                  R                  SSSS	S
5      r\" \" S5       Vs/ s H  n\" \	5      U   \" SU-   5      4PM     sn5      r\" \" S5       Vs/ s H  n\" \
5      U   \" SU-   5      4PM     sn5      r\R$                  S\R&                  S\R(                  S0rSr\S-  rS rS rgs  sn f s  snf s  snf )a  
Utilities for working with the terminal.

**Module Overview:**

::

  encoding - provides the ANSI escape sequence for a terminal attribute
  format - wrap text with ANSI for the given colors or attributes

.. data:: Color (enum)
.. data:: BgColor (enum)

  Foreground or background terminal colors.

  =========== ===========
  Color       Description
  =========== ===========
  **BLACK**   black color
  **BLUE**    blue color
  **CYAN**    cyan color
  **GREEN**   green color
  **MAGENTA** magenta color
  **RED**     red color
  **WHITE**   white color
  **YELLOW**  yellow color
  =========== ===========

.. data:: Attr (enum)

  Terminal text attributes.

  .. versionchanged:: 1.5.0
     Added the LINES attribute.

  =================== ===========
  Attr                Description
  =================== ===========
  **BOLD**            heavy typeface
  **HIGHLIGHT**       inverted foreground and background
  **UNDERLINE**       underlined text
  **READLINE_ESCAPE** wrap encodings in `RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE sequences <https://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt>`_
  **LINES**           formats lines individually
  =================== ===========
    N)BLACKREDGREENYELLOWBLUEMAGENTACYANWHITEFBG_BOLD	UNDERLINE	HIGHLIGHTREADLINE_ESCAPELINES      (   147z[%sm0c                  n   / nU  H  nUS:X  a  Sn[         R                  R                  R                  U5      n[        R                  US5      n[        R                  X#5      n[        R                  X#5      nU(       d  M}  UR                  U5        M     U(       a  [        SR                  U5      -  $ g)aY  
Provides the ANSI escape sequence for these terminal color or attributes.

.. versionadded:: 1.5.0

:param list attr: :data:`~stem.util.terminal.Color`,
  :data:`~stem.util.terminal.BgColor`, or :data:`~stem.util.terminal.Attr` to
  provide an ecoding for

:returns: **str** of the ANSI escape sequence, **None** no attributes are
  recognized
HILIGHTr   N;)stemutil	str_tools_to_camel_caseFG_ENCODINGgetBG_ENCODINGATTR_ENCODINGappendCSIjoin)attrsterm_encodingsattrterm_encodings       H/home/james-whalen/.local/lib/python3.13/site-packages/stem/util/term.pyencodingr+   I   s     .d yd99--d3DOOD$/MOOD8M!%%d:M}M*  .)))     c           	      ~   [         R                  R                  R                  U 5      n [        (       a  U $ [
        R                  U;   af  [        U5      nUR                  [
        R                  5        U R                  S5       Vs/ s H  n[        U/UQ76 PM     nnSR                  U5      $ [        U ;   a?  SR                  U R                  [        5       Vs/ s H  n[        U/UQ76 PM     sn5      $ [        U6 [        peU(       a%  [
        R                  U;   a
  SU-  nSU-  nXP-   U-   $ U $ s  snf s  snf )aq  
Simple terminal text formatting using `ANSI escape sequences
<https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes>`_.
The following are some toolkits providing similar capabilities:

* `django.utils.termcolors <https://github.com/django/django/blob/master/django/utils/termcolors.py>`_
* `termcolor <https://pypi.org/project/termcolor/>`_
* `colorama <https://pypi.org/project/colorama/>`_

.. versionchanged:: 1.6.0
   Normalized return value to be unicode to better support python 2/3
   compatibility.

:param str msg: string to be formatted
:param str attr: text attributes, this can be :data:`~stem.util.term.Color`,
  :data:`~stem.util.term.BgColor`, or :data:`~stem.util.term.Attr` enums
  and are case insensitive (so strings like 'red' are fine)

:returns: **unicode** wrapped with ANSI escape encodings, starting with the given
  attributes and ending with a reset

 z%s)r   r   r   _to_unicodeDISABLE_COLOR_SUPPORTAttrr   listremovesplitformatr%   RESETr+   r   )msgr(   linelinescompprefixsuffixs          r*   r6   r6   l   s   . 			'',#J	ZZ4:DKK

-0YYt_=_TVD 4 _E=99U
 c\77CIIe4DE4DDF4'$'4DEFFT?E&t#f$ff$f<&  J% > Fs   D5D:)__doc__stem.util.enumr   stem.util.str_toolsTERM_COLORSr1   r   enumEnumColorBgColorr2   dictranger3   strr   r!   r   r   r   r"   r$   r7   r+   r6   )coloris   00r*   <module>rK      s3  ,\  U
  		[)
))..

;G;%;G
Hyy~~6;=NPWX 58D8aT%[^Sa[18DEU1XFXT']1%s26{3XFGCdnncJc	 *F1_  H EFs   D, D1 D6