
    ^Og                         S r SSKrSSKrSSKr SSKJr  SSKJ	r	  SSK
Jr  \	" SS9  S rS	 rS
 rS rS rS rS rg! \ a	    SSKJr   N6f = f)zUtilities for Halo library.
    N)get_terminal_size)initcoloredT)	autoresetc                  <    [         R                  " 5       n U S:w  a  gg)zCheck whether operating system supports main symbols or not.

Returns
-------
boolean
    Whether operating system supports main symbols or not
WindowsTF)platformsystem)os_archs    P/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/halo/_utils.pyis_supportedr      s     ooG)    c                       SSK Jn    U " 5       R                  R                  nUS:X  a  gUS:X  a  gg! [         a     gf = f! [
         a     gf = f)zWGet the environment in which halo is running

Returns
-------
str
    Environment name
r   )get_ipythonterminalZMQInteractiveShelljupyterTerminalInteractiveShellipython)IPythonr   ImportError	__class____name__	NameError)r   shells     r   get_environmentr   #   sd    '''00))00    s$   3 !A A 
A A 
AAc                     [        XS/S9$ )zColor the frame with given color and returns.

Parameters
----------
frame : str
    Frame to be colored
color : str
    Color to be applied

Returns
-------
str
    Colored frame
bold)attrsr   )framecolors     r   colored_framer#   >   s     5x00r   c                     [        U [        R                  5      (       d  [        U [        R                  5      (       a  gg)zCheck if given parameter is a string or not

Parameters
----------
text : *
    Parameter to be checked for text type

Returns
-------
bool
    Whether parameter is a string or not
TF)
isinstancesix	text_typestring_typestexts    r   is_text_typer+   P   s-     $&&*T3;K;K*L*Lr   c                 b     [         R                  " U S5      $ ! [        [        4 a    U s $ f = f)zDecode the text from utf-8 format

Parameters
----------
text : str
    String to be decoded

Returns
-------
str
    Decoded string
utf-8)codecsdecode	TypeError
ValueErrorr)   s    r   decode_utf_8_textr2   c   s1    }}T7++z" s    ..c                 d     [         R                  " U SS5      $ ! [        [        4 a    U s $ f = f)zEncodes the text to utf-8 format

Parameters
----------
text : str
    String to be encoded

Returns
-------
str
    Encoded string
r-   ignore)r.   encoder0   r1   r)   s    r   encode_utf_8_textr6   v   s3    }}T7H55z" s    //c                  P    [        5       n U R                  S:X  a  gU R                  $ )zbDetermine the amount of available columns in the terminal

Returns
-------
int
    Terminal width
r   P   )r   columns)terminal_sizes    r   get_terminal_columnsr;      s+     &'M !$$$r   )__doc__r.   r
   r&   shutilr   r   "backports.shutil_get_terminal_sizecoloramar   	termcolorr   r   r   r#   r+   r2   r6   r;    r   r   <module>rB      sf      
E(   t "61$&&&%A  EDEs   > AA