Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
formatting.cpython-313.pyc132 linesDownload Raw Back to __pycache__
1�

2�j&����%SSKJr SSKJr SSKJr SSKJr SSK	J3r4 SSKJr Sr
S\S	'SS5jrSSjrSSSjjr"S
S5rSSjrg)�)�annotationsN)�contextmanager)�gettext�)�term_len)�6_split_opt�7int | None�FORCED_WIDTHc���0nUH>n[U5H,up4[URUS5[U55X'M. M@ [	S[UR
5555$)Nrc3�*# �UH	upUv� M g7f)N�)�.0�x�ys   �VD:\code\apps\devtools\python\user_packages\Python313\site-packages\click/formatting.py�	<genexpr>� measure_table.<locals>.<genexpr>s���6�5�t�q��5���)�	enumerate�max�getr�tuple�sorted�items)�rows�widths�row�idx�cols     r�
measure_tabler s\���F���!�#��H�C��f�j�j��a�0�(�3�-�@�F�K�'���6�v�f�l�l�n�5�6�6�6�c#�J# �UHnUSU[U5-8--v� M g7f)N)�)�len)r�	col_countrs   r�	iter_rowsr&s*������E�Y��S��1�2�2�2��s�!#c�^^
^�SSKJn UR5nU"UUUSS9nU(dURU5$/m/mSm
S	UU
U4SjjnUR	5HRnU(dU"5 Sm
MT
c)[U5n	UR
5nU	[U5-9m
TRU5 MT U"5 /n10THkum
p�URST
-5 U(a!U11RURU55 O U12RURU55 SSS5 Mm SRU135$!,(df   M�=f)14avA helper function that intelligently wraps text.  By default, it15assumes that it operates on a single paragraph of text but if the16`preserve_paragraphs` parameter is provided it will intelligently17handle paragraphs (defined by two empty lines).18 19If paragraphs are handled, a paragraph can be prefixed with an empty20line containing the ``\b`` character (``\x08``) to indicate that21no rewrapping should happen in that block.22 23:param text: the text that should be rewrapped.24:param width: the maximum width for the text.25:param initial_indent: the initial indent that should be placed on the26                       first line as a string.27:param subsequent_indent: the indent string that should be placed on28                          each consecutive line.29:param preserve_paragraphs: if this flag is set then the wrapping will30                            intelligently handle paragraphs.31r)�TextWrapperF)�initial_indent�subsequent_indent�replace_whitespaceNc	�>�T(dgTSR5S:Xa0TRT=(d SSSRTSS545 O,TRT=(d SSSRT545 TSS2	g)Nr�T�32rF� )�strip�append�join)�buf�indent�ps���r�33_flush_par�wrap_text.<locals>._flush_parHsg������q�6�<�<�>�T�!�
�H�H�f�k��4����3�q�r�7�);�<�=�
�H�H�f�k��5�#�(�(�3�-�8�9���Fr!r/z34 35��return�None)�	_textwrapr(�36expandtabs�fill�37splitlinesr�lstripr1�extra_indent�indent_onlyr2)�text�widthr)r*�preserve_paragraphsr(�wrapperr6�line�orig_len�rv�rawr3r4r5s            @@@r�	wrap_textrJs'���2'��?�?��D��
�%�+� �	�G���|�|�D�!�!�%'�A��C�
�F������!����L��F��~�#�D�>���{�{�}��!�H�T�N�2���J�J�t��"��L�	�B�����
�
!�
!�#��,�
/���	�	�'�-�-�d�3�4��	�	�'�,�,�t�,�-�	0�
/���;�;�r�?��
0�
/�s
�A	D<�<38E	c���\rSrSrSrSSSjjrSSjrSSjrSSjrSSSjjr	SS	jr39SS40jrSSjrSSSjjr
\SS
j5r\SSj5rSSjrSrg)�
HelpFormatter�ha�This class helps with formatting text-based help pages.  It's41usually just needed for very special internal cases, but it's also42exposed so that developers can write their own fancy outputs.43 44At present, it always writes into memory.45 46:param indent_increment: the additional increment for each level.47:param width: the width for the text.  This defaults to the terminal48              width clamped to a maximum of 78.49Nc���XlUcSnUc>SSKn[nUc1[[	UR5RU5S-50S5nX lSUl/Ul	g)N�Pr��2)51�indent_increment�shutilr52r�min�get_terminal_size�columnsrC�current_indent�buffer)�selfrRrC�	max_widthrSs     r�__init__�HelpFormatter.__init__tsd��!1�����I��=�� �E��}��C�� 8� 8� :� B� B�I�N�QR�R�TV�W���53�#$���!#��r!c�:�URRU5 g)z1Writes a unicode string into the internal buffer.N)rXr1)rY�strings  r�write�HelpFormatter.write�s�������6�"r!c�B�U=RUR-
slg)zIncreases the indentation.N�rWrR�rYs rr4�HelpFormatter.indent�������t�4�4�4�r!c�B�U=RUR-slg)zDecreases the indentation.Nrbrcs r�dedent�HelpFormatter.dedent�rer!c	���Uc[S5S3nUSUR3US3nURUR-54nU[U5S-:�a*S[U5-nUR	[UUUUS95 O`UR	U5 UR	S5 S[
UR[U55S--nUR	[X%XfS95 UR	S5 g)	z�Writes a usage line into the buffer.55 56:param prog: the program name.57:param args: whitespace separated list of arguments.58:param prefix: The prefix for the first line. Defaults to59    ``"Usage: "``.60NzUsage:r/�>�)r)r*r.�)�_rWrCrr_rJr)rY�prog�args�prefix�usage_prefix�61text_widthr4s       r�write_usage�HelpFormatter.write_usage�s����>��(��}�A�&�F� ��4�#6�#6�"7� 7�8���a�@���Z�Z�$�"5�"5�5�62��(�<�0�2�5�6��8�L�1�1�F��J�J����#/�&,�	�
�
�J�J�|�$��J�J�t���C�� 3� 3�X�f�5E�F��J�K�F��J�J���V��
�	
�63�64�4�r!c�L�URSSUR3US35 g)z!Writes a heading into the buffer.r#rjz:65N)r_rW)rY�headings  r�
write_heading�HelpFormatter.write_heading�s*���66�67�b��4�.�.�/�/�0��	��=�>r!c�J�UR(aURS5 gg)z#Writes a paragraph into the buffer.r.N)rXr_rcs r�write_paragraph�HelpFormatter.write_paragraph�s���;�;��J�J�t��r!c68��SUR-nUR[UURUUSS95 URS5 g)zQWrites re-indented text into the buffer.  This rewraps and69preserves paragraphs.70r/T)r)r*rDr.N)rWr_rJrC)rYrBr4s   r�71write_text�HelpFormatter.write_text�sI���t�*�*�*���72�73����74�75�%�"(�$(�
�	76�	
�77�78�4�r!c�<�[U5n[U5n[U5S:wa[S5e[	USU5U-n[U[U55GH@upgUR
SSUR3U35 U(dUR
S5 MC[U5XS-79::a!UR
SU[U5-80-5 O1UR
S5 UR
SXPR--5 [URU-81S-82S5n[XxS	S839n	U	R5n84U85(aLUR
U86SS35 U87SSH)nUR
SSXPR-3US35 M+ GM/UR
S5 GMC g)
a>Writes a definition list into the buffer.  This is how options88and commands are usually formatted.89 90:param rows: a list of two item tuples for the terms and values.91:param col_max: the maximum width of the first column.92:param col_spacing: the number of spaces between the first and93                    second column.94rPz(Expected two columns for definition listrr#rjr.r/�95T)rDrN)
�listr r$�	TypeErrorrTr&r_rWrrrCrJr>)rYr�col_max�col_spacingr�	first_col�first�secondrr�wrapped_text�linesrFs            r�write_dl�HelpFormatter.write_dl�sx���D�z���t�$���v�;�!���F�G�G���q�	�7�+�k�9�	�&�t�S��[�9�M�E��J�J�"�Q�t�2�2�3�3�4�U�G�<�=���96�97�4� �����)�"9�9��98�99�3�)�h�u�o�"=�>�?��100�101�4� ��102�103�3�)�.A�.A�"A�B�C��T�Z�Z�)�3�a�7��<�J�$�V�T�R�L� �+�+�-�E���104�105�e�A�h�Z�r�?�+�!�!�"�I�D��J�J�"�Q�y�3F�3F�'F�&G�$G�!H���b�Q�R�&��106�107�4� �+:r!c#��# �UR5 URU5 UR5 Sv� UR5 g!UR5 f=f7f)z�Helpful context manager that writes a paragraph, a heading,108and the indents.109 110:param name: the section name that is written as heading.111N)rzrwr4rg)rY�names  r�section�HelpFormatter.section�sD���	
�������4� ����
�	���K�K�M��D�K�K�M�s�2A�A112�A�113A�Ac#�# �UR5 Sv� UR5 g!UR5 f=f7f)z1A context manager that increases the indentation.N)r4rgrcs r�indentation�HelpFormatter.indentation
s*���	
���
�	���K�K�M��D�K�K�M�s�>�)�>�;�>c�8�SRUR5$)zReturns the buffer contents.r#)r2rXrcs r�getvalue�HelpFormatter.getvalues���w�w�t�{�{�#�#r!)rXrWrRrC)rPNN)rR�intrCr	rZr	r9r:)r^�strr9r:r8)r#N)rnr�ror�rpz114str | Noner9r:)rvr�r9r:)rBr�r9r:)�rP)rzcabc.Sequence[tuple[str, str]]r�r�r�r�r9r:)r�r�r9�cabc.Iterator[None])r9r�)r9r�)�__name__�115__module__�__qualname__�__firstlineno__�__doc__r[r_r4rgrsrwrzr}r�rr�r�r��__static_attributes__r
r!rrLrLhs���	�!"� � $�	$��$��$��	$�116117�$�&#�5�5�$�L?��118�&��	*!�,�*!��*!��	*!�119120�*!�X��������$r!rLc���/nSnUH5n[U5SnUS:XaSnUR[U5U45 M7 URSS9 SR	SU55U4$)	z�Given a list of option strings this joins them in the most appropriate121way and returns them in the form ``(formatted_string,122any_prefix_is_slash)`` where the second item in the tuple is a flag that123indicates if any of the option prefixes was a slash.124Fr�/Tc��US$)Nrr
)rs r�<lambda>�join_options.<locals>.<lambda>,s��!�A�$r!)�keyz, c3�*# �UH	oSv� M g7f)rNr
)rrs  rr�join_options.<locals>.<genexpr>-s���&�2�a�q�T�2�r)rr1r$�sortr2)�optionsrH�any_prefix_is_slash�optrps     r�join_optionsr�st��125�B������C���#���S�=�"&��126�	�	�3�v�;��$�%�
��G�G��G���9�9�&�2�&�&�(;�;�;r!)r�cabc.Iterable[tuple[str, str]]r9ztuple[int, ...])rr�r%r�r9zcabc.Iterator[tuple[str, ...]])�Nr#r#F)rBr�rCr�r)r�r*r�rD�boolr9r�)r�zcabc.Sequence[str]r9ztuple[str, bool])�127__future__r�collections.abc�abc�cabc�128contextlibrrrm�_compatr�parserrr129�__annotations__r r&rJrLr�r
r!r�<module>r�s���"��%� ��� ��j��7�3�130(�3�58�3�#�3���� %�F�131
�F��F��F��	F�132�F�	�
F�Rp$�p$�f<r!
codekingpro/portable-devtools · Team Ai