Ë ïãAÖØ@‹ãóè—dZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z ddlmZmZddlmZmZmZmZmZmZmZmZmZmZddlmZdZd„Zd „Z d „Z!d „Z"d „Z#d „Z$d„Z%d„Z&d„Z'd„Z(dd„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« tjtjdddgd¢«\}}g}d}d}td„D««}|D�]Ž\}}|dvr|}Œ|d k(r*|jtjt|««Œ=|d k(r*|jtjt|««Œl|d vr*|jtjt««Œš|d vr*|jtjt|««ŒÈ|d vr*|jtjt|««Œö|dvr,|jtjt ||««�Œ&|dk(rd}�Œ/|dvr+|jtjt"|««�Œ^|dk(r|jt$«�Œz|dvs�Œ€t't(«y|r)|jtjt*|««|st't(«y|D] } | «Œ y#t$r,}t d|«tj d«Yd}~�Œ(d}~wwxYw)z9Command line interface for the ``humanfriendly`` program.éNz cd:l:n:s:bt:h) z run-commandz format-tablez delimiter=zformat-length=zformat-number=z format-size=Úbinaryzformat-timespan=z parse-length=z parse-size=ÚdemoÚhelpz Error: %sFc3ó*K—|] \}}|dv–—Œ y­w))z-bz--binaryN©)Ú.0ÚoÚvs ú6/usr/lib/python3.12/site-packages/humanfriendly/cli.pyÚ zmain..Ž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 rr!rrrrrrÚ__doc__r) ÚoptionsÚ argumentsÚeÚactionsÚ delimiterÚshould_format_tabler$ÚoptionÚvaluer6s r,rrs€äÔðÜ#Ÿ]™]¬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«}ddjttj|««z}t ||¬«5}t j|«} |j«|j«|j«�nŒ2 ddd«tjj«y#1swYŒ)xYw)zHRun an external command and show a spinner while the command is running.zWaiting 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Â6B?có‚—d|vrttt|«««yttt|«««y)zPrint a human readable length.Ú.N)rrÚfloatÚint©r?s r,rr¾s+€à ˆe�|ÜŒ}œU 5›\Ó*Õ+äŒ}œS ›ZÓ(Õ)ócó>—ttt|«««y)z/Print large numbers in a human readable format.N)rrrTrVs r,rrÆs€ä Œ=œ˜u›Ó &Õ'rWcóB—ttt|«|¬««y)zPrint a human readable size.)r$N)rrrU)r?r$s r,rrËs€ä Œ;”s˜5“z¨&Ô 1Õ2rWcóº—g}tjD]2}|j«}|j|j |««Œ4t t |««y)z8Read tabular data from standard input and print a table.N)r/ÚstdinÚrstripr4Úsplitrr )r<ÚdataÚlines r,rrÐsE€à €DÜ— ” ˆØ�{‰{‹}ˆØ � ‰ �D—J‘J˜yÓ)Õ*ðô Ô ˜tÓ $Õ%rWcó>—ttt|«««y)z Print a human readable timespan.N)rrrTrVs r,rrÙs€ä Œ?œ5 ›<Ó (Õ)rWcó,—tt|««y)z=Parse a human readable length and print the number of metres.N)rrrVs r,rrÞs€ä Œ<˜Ó ÕrWcó,—tt|««y)z?Parse a human readable data size and print the number of bytes.N)rr rVs r,r r ãs€ä Œ:�eÓ ÕrWcó—tdtdd¬««ddg}|jtj««t |«D]R}t t¬«}|dk7rd||<|jdd «j«}td t|fi|¤Ž«ŒTd D�]\}}dt «fdt d¬ «fg}|d k7r|jddt d¬«f«tdtd|zd¬«z«ttt tj««D��� cgc]R}|g|D�� cgc]>\}} t|d k7rdndfit t| j««||fgz«¤Ž‘Œ@c} }z‘ŒTc} }}dg|D�� cgc]\}} |j«‘Œc} }z¬««�Œtddd«tddd«tddd«tdd d!«y"cc} }wcc} }}wcc} }w)#z-Demonstrate the use of ANSI escape sequences.z%sz Text styles:T©ÚboldÚnormalÚbright©ÚcolorÚ_rAz - %s))rizForeground colors)Ú backgroundzBackground colors)rgrkrÚfaint)rlz %sú%s:ÚXXXXXXz ÚColor)Ú column_namesézstandard colorséézhigh-intensity colorsééçz 216 colorséèéÿzgray scale colorsN)rrÚextendr ÚkeysÚsortedÚdictrÚreplaceÚ capitalizeÚinsertr r ÚlistÚitemsr) ÚstylesÚ style_namer8Ú style_labelÚ color_typeÚ color_labelÚ intensitiesÚ color_namerBÚkws r,rrè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Ä8AG/Å;G5ÆG<Ç/G5cón—d}|r|d|zz }tdtd|zd¬«z«djd„t||d z«D««}t «\}}|t t |««k\r t|«y t t|««d z}t||z «}t||d z«D� cgc]'} tt| «j|«| ¬ «‘Œ)} } td t | «|«D� cgc] } | | | |z‘Œ } } tdjd „| D«««y cc} wcc} w)z#Demonstrate 256 color mode support.z256 color modez (%s)Ú rmTrdÚc3óNK—|]}dtt|«|¬«z–—Œy­w)rArhN)rÚstr)r)Úns r,r-z)demonstrate_256_colors..s!èø€ÐTÁO¸q˜#¤ ¬#¨a«&¸Ô :Õ:ÁOùs‚#%r#rhrc3ó>K—|]}dj|«–—Œy­w)r‹N)rD)r)Úbs r,r-z)demonstrate_256_colors..#sèø€Ð4©V¨˜Ÿ™ Ÿ©Vùs‚N) rrrDÚrangerÚlenrr�rUÚrjust) ÚiÚjÚgrouprBÚ single_lineÚlinesÚcolumnsÚwidthÚcolors_per_linerŽÚcolorsÚblockss r,rrs€ð €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)*r7r5r.rFrHr/Ú humanfriendlyrrrrrrr Úhumanfriendly.tablesr r Úhumanfriendly.terminalr r rrrrrrrrÚhumanfriendly.terminal.spinnersrÚ__all__rr!rrrrrrr rrr(rWr,Úr£s†ðñFóRÛ Û ÛÛ ÷÷ñ÷I÷ ÷ ÷ õ4ð €ò.òb !ò*ò(ò 3ò &ò*ò  ò ò $:ôN6rW