Ë
    ”Gìj^&  ã                   óè   — d Z ddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlmZ dZd„ Zd	„ Z d
„ Z!d„ Z"d„ Z#d„ Z$d„ Z%d„ Z&d„ Z'd„ Z(dd„Z)y)aN  
Usage: humanfriendly [OPTIONS]

Human friendly input/output (text formatting) on the command
line based on the Python package with the same name.

Supported options:

  -c, --run-command

    Execute an external command (given as the positional arguments) and render
    a spinner and timer while the command is running. The exit status of the
    command is propagated.

  --format-table

    Read tabular data from standard input (each line is a row and each
    whitespace separated field is a column), format the data as a table and
    print the resulting table to standard output. See also the --delimiter
    option.

  -d, --delimiter=VALUE

    Change the delimiter used by --format-table to VALUE (a string). By default
    all whitespace is treated as a delimiter.

  -l, --format-length=LENGTH

    Convert a length count (given as the integer or float LENGTH) into a human
    readable string and print that string to standard output.

  -n, --format-number=VALUE

    Format a number (given as the integer or floating point number VALUE) with
    thousands separators and two decimal places (if needed) and print the
    formatted number to standard output.

  -s, --format-size=BYTES

    Convert a byte count (given as the integer BYTES) into a human readable
    string and print that string to standard output.

  -b, --binary

    Change the output of -s, --format-size to use binary multiples of bytes
    (base-2) instead of the default decimal multiples of bytes (base-10).

  -t, --format-timespan=SECONDS

    Convert a number of seconds (given as the floating point number SECONDS)
    into a human readable timespan and print that string to standard output.

  --parse-length=VALUE

    Parse a human readable length (given as the string VALUE) and print the
    number of metres to standard output.

  --parse-size=VALUE

    Parse a human readable data size (given as the string VALUE) and print the
    number of bytes to standard output.

  --demo

    Demonstrate changing the style and color of the terminal font using ANSI
    escape sequences.

  -h, --help

    Show this message and exit.
é    N)ÚTimerÚformat_lengthÚformat_numberÚformat_sizeÚformat_timespanÚparse_lengthÚ
parse_size)Úformat_pretty_tableÚformat_smart_table)
ÚANSI_COLOR_CODESÚANSI_TEXT_STYLESÚHIGHLIGHT_COLORÚ
ansi_stripÚ	ansi_wrapÚenable_ansi_supportÚfind_terminal_sizeÚoutputÚusageÚwarning)ÚSpinner)Údemonstrate_256_colorsÚdemonstrate_ansi_formattingÚmainÚprint_formatted_lengthÚprint_formatted_numberÚprint_formatted_sizeÚprint_formatted_tableÚprint_formatted_timespanÚprint_parsed_lengthÚprint_parsed_sizeÚrun_commandc                  óÒ  — t        «        	 t        j                  t        j                  dd dg d¢«      \  } }g }d}d}t        d„  D «       «      }| D �]Ž  \  }}|dv r|}Œ|d	k(  r*|j                  t        j                  t        |«      «       Œ=|d
k(  r*|j                  t        j                  t        |«      «       Œl|dv r*|j                  t        j                  t        «      «       Œš|dv r*|j                  t        j                  t        |«      «       ŒÈ|dv r*|j                  t        j                  t        |«      «       Œö|dv r,|j                  t        j                  t         ||«      «       �Œ&|dk(  rd}�Œ/|dv r+|j                  t        j                  t"        |«      «       �Œ^|dk(  r|j                  t$        «       �Œz|dv s�Œ€t'        t(        «        y |r)|j                  t        j                  t*        |«      «       |st'        t(        «       y|D ]	  }	 |	«        Œ y# t        $ r,}t        d|«       t        j                  d«       Y d}~�Œ(d}~ww xY w)z9Command line interface for the ``humanfriendly`` program.é   Nzcd:l:n:s:bt:h)zrun-commandzformat-tablez
delimiter=zformat-length=zformat-number=zformat-size=Úbinaryzformat-timespan=zparse-length=zparse-size=ÚdemoÚhelpz	Error: %sFc              3   ó*   K  — | ]  \  }}|d v –— Œ y­w))z-bz--binaryN© )Ú.0ÚoÚvs      úUC:\Users\Stabi\Downloads\virtual-tryon(1)\venv\Lib\site-packages\humanfriendly/cli.pyÚ	<genexpr>zmain.<locals>.<genexpr>Ž   s   è ø€ Ð=±W©T¨Q°�Ð(Ô(±Wùs   ‚)z-dz--delimiterz--parse-sizez--parse-length)z-cz--run-command)z-lz--format-length)z-nz--format-number)z-sz--format-sizez--format-tableT)z-tz--format-timespanz--demo)z-hz--help)r   ÚgetoptÚsysÚargvÚ	Exceptionr   ÚexitÚanyÚappendÚ	functoolsÚpartialr    r   r!   r   r   r   r   r   r   Ú__doc__r   )
ÚoptionsÚ	argumentsÚeÚactionsÚ	delimiterÚshould_format_tabler$   ÚoptionÚvaluer6   s
             r,   r   r      s  € äÔðÜ#Ÿ]™]¬3¯8©8°A°B¨<¸ò K
ó Ñˆ�ð €GØ€IØÐÜÑ=±WÓ=Ó=€FÜ ‰ˆ�ØÐ*Ñ*Ø‰IØ�~Ò%Ø�N‰Nœ9×,Ñ,Ô->ÀÓFÕGØÐ'Ò'Ø�N‰Nœ9×,Ñ,Ô-@À%ÓHÕIØÐ.Ñ.Ø�N‰Nœ9×,Ñ,¬[¸)ÓDÕEØÐ0Ñ0Ø�N‰Nœ9×,Ñ,Ô-CÀUÓKÕLØÐ0Ñ0Ø�N‰Nœ9×,Ñ,Ô-CÀUÓKÕLØÐ.Ñ.Ø�N‰Nœ9×,Ñ,Ô-AÀ5È&ÓQÖRØÐ'Ò'Ø"&ÒØÐ2Ñ2Ø�N‰Nœ9×,Ñ,Ô-EÀuÓMÖNØ�xÒØ�N‰NÔ6Ö7ØÐ'Ó'Ü”'ŒNÙð/ !ñ0 Ø�‰”y×(Ñ(Ô)>À	ÓJÔKÙÜŒgŒØÛˆÙ�	ñ øôI ò Ü�˜QÔÜ�‰��Šûðús   Œ-H1 È1	I&È:!I!É!I&c                 ó„  — t        «       }ddj                  t        t        j                  | «      «      z  }t        ||¬«      5 }t        j                  | «      }	 |j                  «        |j                  «        |j                  «       �nŒ2	 ddd«       t        j                  j                  «       y# 1 sw Y   Œ)xY w)zHRun an external command and show a spinner while the command is running.zWaiting for command: %sÚ )ÚlabelÚtimerN)r   ÚjoinÚmapÚpipesÚquoter   Ú
subprocessÚPopenÚstepÚsleepÚpollr/   r2   Ú
returncode)Úcommand_linerC   Úspinner_labelÚspinnerÚprocesss        r,   r!   r!   °   s“   € ä‹G€EØ-°·±¼¼U¿[¹[È,Ó9WÓ0XÑX€MÜ	�}¨EÕ	2°gÜ×"Ñ" <Ó0ˆØØ�L‰LŒNØ�M‰MŒOØ�|‰|‹~Ð)Øð	 ð ÷ 
3ô ‡H�HˆW×ÑÕ ÷ 
3Ð	2ús   ÁA	B6Â6B?c                 ó‚   — d| v rt        t        t        | «      «      «       yt        t        t        | «      «      «       y)zPrint a human readable length.Ú.N)r   r   ÚfloatÚint©r?   s    r,   r   r   ¾   s+   € à
ˆe�|ÜŒ}œU 5›\Ó*Õ+äŒ}œS ›ZÓ(Õ)ó    c                 ó>   — t        t        t        | «      «      «       y)z/Print large numbers in a human readable format.N)r   r   rT   rV   s    r,   r   r   Æ   s   € ä
Œ=œ˜u›Ó&Õ'rW   c                 óB   — t        t        t        | «      |¬«      «       y)zPrint a human readable size.)r$   N)r   r   rU   )r?   r$   s     r,   r   r   Ë   s   € ä
Œ;”s˜5“z¨&Ô1Õ2rW   c                 óº   — g }t         j                  D ]2  }|j                  «       }|j                  |j	                  | «      «       Œ4 t        t        |«      «       y)z8Read tabular data from standard input and print a table.N)r/   ÚstdinÚrstripr4   Úsplitr   r
   )r<   ÚdataÚlines      r,   r   r   Ð   sE   € à€DÜ—	”	ˆØ�{‰{‹}ˆØ�‰�D—J‘J˜yÓ)Õ*ð ô Ô˜tÓ$Õ%rW   c                 ó>   — t        t        t        | «      «      «       y)z Print a human readable timespan.N)r   r   rT   rV   s    r,   r   r   Ù   s   € ä
Œ?œ5 ›<Ó(Õ)rW   c                 ó,   — t        t        | «      «       y)z=Parse a human readable length and print the number of metres.N)r   r   rV   s    r,   r   r   Þ   s   € ä
Œ<˜ÓÕrW   c                 ó,   — t        t        | «      «       y)z?Parse a human readable data size and print the number of bytes.N)r   r	   rV   s    r,   r    r    ã   s   € ä
Œ:�eÓÕrW   c                  ó  — t        dt        dd¬«      «       ddg} | j                  t        j                  «       «       t        | «      D ]R  }t        t        ¬«      }|dk7  rd||<   |j                  dd	«      j                  «       }t        d
t        |fi |¤Ž«       ŒT dD �]  \  }}dt        «       fdt        d¬«      fg}|dk7  r|j                  ddt        d¬«      f«       t        dt        d|z  d¬«      z  «       t        t        t        t        j                  «       «      D ���	cg c]R  }|g|D ��	cg c]>  \  }}	t        |dk7  rdndfi t        t        |	j                  «       «      ||fgz   «      ¤Ž‘Œ@ c}	}z   ‘ŒT c}	}}dg|D ��	cg c]  \  }}	|j                  «       ‘Œ c}	}z   ¬«      «       �Œ t        ddd«       t        ddd«       t        ddd«       t        dd d!«       y"c c}	}w c c}	}}w c c}	}w )#z-Demonstrate the use of ANSI escape sequences.z%szText styles:T©ÚboldÚnormalÚbright©ÚcolorÚ_rA   z - %s))ri   zForeground colors)Ú
backgroundzBackground colors)rg   rk   r   Úfaint)rl   z
%sú%s:ÚXXXXXXz      ÚColor)Úcolumn_namesé   zstandard colorsé   é   zhigh-intensity colorsé   éç   z
216 colorséè   éÿ   zgray scale colorsN)r   r   Úextendr   ÚkeysÚsortedÚdictr   ÚreplaceÚ
capitalizeÚinsertr   r   ÚlistÚitemsr   )
ÚstylesÚ
style_namer8   Ústyle_labelÚ
color_typeÚcolor_labelÚintensitiesÚ
color_namerB   Úkws
             r,   r   r   è   s  € ô ˆ4”˜>°Ô5Ô6Ø˜Ð!€FØ
‡M�MÔ"×'Ñ'Ó)Ô*Ü˜V–nˆ
Üœ_Ô-ˆØ˜Ò!Ø"&ˆG�JÑØ ×(Ñ(¨¨cÓ2×=Ñ=Ó?ˆÜˆwœ	 +Ñ9°Ñ9Õ:ð %ô$IÑˆ
�Kð ”t“vÐØ”t 4Ô(Ð)ð
ˆð ˜Ò%Ø×Ñ˜q 7¬D°tÔ,<Ð"=Ô>Üˆvœ	 %¨+Ñ"5¸DÔAÑAÔBÜÔ!ô !'Ô'7×'<Ñ'<Ó'>Ô ?õ#
ñ !@�*ð ˆLñ $/ô	ñ $/‘i�e˜Rô Ø *¨lÒ :‘HÀñäœ4 §¡£
Ó+°
¸JÐ/GÐ.HÑHÓIóð $/ò	ó ð
 !@ó#
ð !˜	Ù0;ô%
Ù0;¡9 5¨"ˆE×ÑÕ°ò%
ñ 
ô	ö 		ð$Iô( ˜1˜aÐ!2Ô3Ü˜1˜bÐ"9Ô:Ü˜2˜s LÔ1Ü˜3 Ð%8Õ9ùóùô#
ùó%
s   Ä,G5Ä8AG/Å;G5ÆG<Ç/G5c                 ón  — d}|r|d|z  z  }t        dt        d|z  d¬«      z   «       dj                  d„ t        | |d	z   «      D «       «      }t	        «       \  }}|t        t        |«      «      k\  rt        |«       yt        t        |«      «      d	z   }t        ||z  «      }t        | |d	z   «      D �	cg c]'  }	t        t        |	«      j                  |«      |	¬
«      ‘Œ) }
}	t        dt        |
«      |«      D �	cg c]
  }	|
|	|	|z    ‘Œ }}	t        dj                  d„ |D «       «      «       yc c}	w c c}	w )z#Demonstrate 256 color mode support.z256 color modez (%s)Ú
rm   Trd   Ú c              3   óN   K  — | ]  }d t        t        |«      |¬«      z   –— Œ y­w)rA   rh   N)r   Ústr)r)   Úns     r,   r-   z)demonstrate_256_colors.<locals>.<genexpr>  s!   è ø€ ÐTÁO¸q˜#¤	¬#¨a«&¸Ô :Õ:ÁOùs   ‚#%r#   rh   r   c              3   ó>   K  — | ]  }d j                  |«      –— Œ y­w)r‹   N)rD   )r)   Úbs     r,   r-   z)demonstrate_256_colors.<locals>.<genexpr>#  s   è ø€ Ð4©V¨˜Ÿ™ Ÿ©Vùs   ‚N)
r   r   rD   Úranger   Úlenr   r�   rU   Úrjust)ÚiÚjÚgrouprB   Úsingle_lineÚlinesÚcolumnsÚwidthÚcolors_per_linerŽ   ÚcolorsÚblockss               r,   r   r     s  € ð €EÙØ�˜5‘Ñ ˆÜ
ˆ4”)˜E E™M°Ô5Ñ5Ô6ð —'‘'ÑTÄEÈ!ÈQÐQRÉUÄOÓTÓT€KÜ'Ó)�N€Eˆ7Ø”#”j Ó-Ó.Ò.Üˆ{Õô ”C˜“F“˜a‘ˆÜ˜g¨™oÓ.ˆÜCHÈÈAÐPQÉEÄ?ÓSÁ?¸a”)œC ›FŸL™L¨Ó/°qÖ9À?ˆÐSÜ9>¸qÄ#ÀfÃ+ÈÔ9_Ó`Ñ9_°A�&˜˜1˜Ñ.Ò/Ð9_ˆÐ`Üˆt�y‰yÑ4©VÓ4Ó4Õ5ùò TùÚ`s   Â4,D-Ã:D2)N)*r7   r5   r.   rF   rH   r/   Úhumanfriendlyr   r   r   r   r   r   r	   Úhumanfriendly.tablesr
   r   Úhumanfriendly.terminalr   r   r   r   r   r   r   r   r   r   Úhumanfriendly.terminal.spinnersr   Ú__all__r   r!   r   r   r   r   r   r   r    r   r   r(   rW   r,   Ú<module>r£      s†   ðñFóR Û Û Û Û 
÷÷ ñ ÷ I÷÷ ÷ õ 4ð€ò.òb!ò*ò(ò
3ò
&ò*ò
 ò
ò
$:ôN6rW   