Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2�j�&��@�SSKrSSKJrJrJrJrJrJr SSKJrJ	r	J3r4JrJrJ
r
Jr SSKJrJr SSKJr SSKJr SSKJr SS	KJr SS5KJr SSKJr SSKJrJ r  S
\!S\!4Sjr""SS\5r#S\\$\
\4S\\%S44Sjr&S\$S\	\!4Sjr'S\$S\	\!S\(4Sjr)g)�N)�cleandoc�getdoc�getfile�isclass�ismodule�	signature)�Any�6Collection�Iterable�Optional�Tuple�Type�Union�)�Group�RenderableType)�escape_control_codes)�ReprHighlighter)�JupyterMixin)�Panel)�Pretty)�Table)�Text�TextType�doc�returnc�0�URS5un nU$)z)Get the first paragraph from a docstring.z7 8)�	partition)r�	paragraph�_s   �SD:\code\apps\devtools\python\user_packages\Python313\site-packages\rich/_inspect.py�_first_paragraphr"s���m�m�F�+�O�I�q�!���c���\rSrSrSrSSSSSSSSSS.	S\S\\S	\S9\S\S\S
\S\S\S\SS4Sjjr	S\S\104SjrS\4Sjr
S\S\S\\114SjrS\\4SjrS\S\\4SjrSrg)�Inspect�a�A renderable to inspect any Python Object.12 13Args:14    obj (Any): An object to inspect.15    title (str, optional): Title to display over inspect result, or None use type. Defaults to None.16    help (bool, optional): Show full help text rather than just first paragraph. Defaults to False.17    methods (bool, optional): Enable inspection of callables. Defaults to False.18    docs (bool, optional): Also render doc strings. Defaults to True.19    private (bool, optional): Show private attributes (beginning with underscore). Defaults to False.20    dunder (bool, optional): Show attributes starting with double underscore. Defaults to False.21    sort (bool, optional): Sort attributes alphabetically, callables at the top, leading and trailing underscores ignored. Defaults to True.22    all (bool, optional): Show all attributes. Defaults to False.23    value (bool, optional): Pretty print value of object. Defaults to True.24NFT)	�title�help�methods�docs�private�dunder�sort�all�value�objr'r(r)r*r+r,r-r.r/rc	��[5UlXlU=(d URU5UlU	(aS=n=pgX0lX@lU=(d UUlU=(d UUlXpl	X�l25X�lg)NT)r�highlighterr0�_make_titler'r(r)r*r+r,r-r/)�selfr0r'r(r)r*r+r,r-r.r/s           r!�__init__�Inspect.__init__%sk��+�,������3�d�.�.�s�3��26��)-�-�G�-�g��	����L�D��	��(�&������	��27r#c���[U5(d [U5(d[U5(a[U5O[[	U55nURU5nU$)zMake a default title.)r�callabler�str�typer2)r4r0�	title_str�28title_texts    r!r3�Inspect._make_title@sN��������
�
��#���
��H��T�#�Y��	�29�%�%�i�0�30��r#c�l�[R"[UR56URSSS9$)Nzscope.border�rr)r'�border_style�padding)r�fitr�_renderr')r4s r!�__rich__�Inspect.__rich__Js.���y�y��4�<�<�>�"��*�*�'��	31�	32r#�namec��[[U55S-nSn[	U5n[
USS9nU(aURSU35 URU5nU=(d
 [USU5n[U[5(d$[USU5n[U[5(dUn[R"U5(aS	nO [R"U5(aS33nOSn[R"US3S
URSS534US4U5n	U	$![a SnGN[a gf=f![34[4a GN(f=f)zGet a signature for a callable.�:z(...)Nzinspect.callable��stylezlink file://�__qualname__�__name__�classz	async def�def� zinspect.r )r9r�35ValueError�	TypeErrorr�OSErrorr�stylizer2�getattr�36isinstance�inspectr�iscoroutinefunction�assemble�replace)37r4rFr0�38_signature�source_filename�
callable_name�signature_text�qualname�prefix�qual_signatures39          r!�_get_signature�Inspect._get_signatureRsU��	��Y�s�^�,�s�2�J�*.��	�%�c�l�O�40�T�);�<�
���!�!�L��0A�"B�C��)�)�*�5���=�7�3���=���(�C�(�(��s�J��5�H��h��,�,����?�?�3����F�
�
(�
(��
-�
-� �F��F�����x�q�\�X�f�n�n�S�#�&>�%?�@�A�
�)�*��41�����K�	!� �J��	��	����#�	��	�s(�D�D<�D9�-	D9�8D9�<E�Ec	#�^# �S[[[4S[[[44SjnS[S[[[44U4SjjnURm[T5n[
U5nUR(d)UVs/sHoURS5(aMUPM nnUR(d)UVs/sHoURS5(aMUPM nnU[
U5-42nUVs/sHoUU"U54PM nnUR(aURUS9 [R"S	S43S9nURSS
9 URn	URn44[!T5(aUR#ST5nUbUv� Sv� UR$(a.UR'T5nUb[)USS9n
U45"U
5n
U
v� Sv� UR*(aJ[-T5(d:[!T5(d*[/T5(d[1[3TSSSS9SS9v� Sv� UGHEunup�[(R4"UURS5(aSOS4S5nUb;UR75nUR9S5 U	"UU46"[;U555 Mx[!U5(a�UR<(dM�UR#X_5nUcU	"U[3X�S95 M�UR$(aWUR'U5nUbCUR?SU;aSOS5 U47"U5nUR9S5 UR?U5 U	"UU5 GM5U	"U[3X�S95 GMH UR@(aUv� gU(a[(RB"S US!35v� ggs snfs snfs snf7f)"zRender object.�itemrc�d�Uunup#[U5URS5R54$)Nr )r8�strip�lower)rd�key�_errorr/s    r!�48sort_items�#Inspect._render.<locals>.sort_items�s.��#'� �C��&��U�O�S�Y�Y�s�^�%9�%9�%;�<�<r#�	attr_namec�X>�S[TU54$![anUS4sSnA$SnAff=f)zGet attribute or any exception.N)rT�	Exception)rl�errorr0s  �r!�safe_getattr�%Inspect._render.<locals>.safe_getattr�s4���
%��g�c�9�5�6�6���
%��t�}�$��
%�s�
�49)�$�)�)�__r )rhr?F)rA�expand�right)�justify�Nzinspect.helprIT�50�<)�
indent_guides�51max_length�52max_stringzinspect.value.border)r@zinspect.attr.dunderzinspect.attr)z =zinspect.equalsz
inspect.error)r2�53rOzinspect.docz[b cyan]za[/][i] attribute(s) not shown.[/i] Run [b][magenta]inspect[/]([not b]inspect[/])[/b] for options.)"r
r9r	�boolr0�dir�lenr,�54startswithr+r-r�grid�55add_column�add_rowr2r8rar*�_get_formatted_docrr/rrrrrX�copyrS�reprr)�append�	row_count�from_markup)r4rjrp�keys�total_itemsrh�not_shown_count�items�items_tabler�r2r�_doc�doc_textror/�key_text�warning�_signature_textr*rr0s                     @r!rC�Inspect._render}s8����	=�U�3��8�_�	=��t�S�y�1A�	=�	%�C�	%�E�#�s�(�O�	%��h�h���3�x���$�i���{�{�#'�D�4�C�~�~�d�/C�C�4�D�D��|�|�#'�C�4�C�~�~�c�/B�C�4�D�C�%��D�	�1��59�:�T�c�|�C�(�)�T��:��9�9��J�J�:�J�&��j�j���>�����w��/��%�%���&�&���C�=�=��+�+�B��4�I��$������9�9��*�*�3�/�D�����N�;��&�x�0�������:�:�w�s�|�|�x��}�}���
�
���s�$�2�"�M�3��
��H�#(��C��%��}�}��-0�^�^�D�-A�-A�)�~��)��H�� �"�-�-�/������0����T�%�[�!9�:�������|�|��"&�"5�"5�c�"A��"�*��H�f�U�&L�M��y�y�#�6�6�u�=���+�+�2�2�4�4�<�4�S�Q�"-�d�"3�C��K�K�
�6�+�2�2�3�7��H�o�6���&��"H�I�A$)�B� � ���
��"�"��?�+�,Q�R��
���KE��C��:�s7�BO�N7�$N7�*O�N<�N<�$O�8O�J;O�object_c��[U5nUcg[U5R5nUR(d[	U5n[U5$)au56Extract the docstring of an object, process it and returns it.57The processing consists in cleaning up the docstring's indentation,58taking only its 1st paragraph if `self.help` is not True,59and escape its control codes.60 61Args:62    object_ (Any): the object to get the docstring from.63 64Returns:65    Optional[str]: the processed docstring, or None if no docstring was found.66N)rrrfr(r"r)r4r�r*s   r!r��Inspect._get_formatted_doc�sC���g����<����~�#�#�%���y�y�#�D�)�D�#�D�)�)r#)67r*r,r(r2r)r0r+r-r'r/)rL�68__module__rK�__firstlineno__�__doc__r	rrr}r5rr3rrDr9rarrrCr��__static_attributes__�r#r!r%r%s��
�&%)����������
����!�	�69���
�������������70��6�s��t��71�%�72�)�3�)�S�)�X�d�^�)�V[��.�1�[�z*�#�*�(�3�-�*r#r%r0.c�T�[US5(d[U5n[USS5$)zNReturns the MRO of an object's class, or of the object itself if it's a class.�__mro__r�)�hasattrr:rT)r0s r!�get_object_types_mror��s)���3�	�"�"��3�i���3�	�2�&�&r#c73�z�[U5Vs/sH n[USS5S[USS53PM" sn$s snf)z�74Returns the MRO of an object's class as full qualified names, or of the object itself if it's a class.75 76Examples:77    `object_types_mro_as_strings(JSONDecoder)` will return `['json.decoder.JSONDecoder', 'builtins.object']`78r�rv�.rK)r�rT)r0�type_s  r!�get_object_types_mro_as_stringsr��sM��*�#�.��.�E��5�,��+�79,�A�g�e�^�R�.P�-Q�R�.����s�'8�fully_qualified_types_namesc�6�[U5H80nX!;dM81 g g)z�82Returns `True` if the given object's class (or the object itself, if it's a class) has one of the83fully qualified names in its MRO.84TF)r�)r0r��	type_names   r!�is_object_one_of_typesr�s!��5�S�9�	��3��:�r#)*rVrrrrrr�typingr	r85rrr
rr�consolerr�controlrr2r�jupyterr�panelr�prettyr�tabler�textrrr9r"r%�objectr:r�r�r}r�r�r#r!�<module>r�s����K�K�J�J�J�*�)�(�!���� ��#��#��X*�l�X*�v'�e�F�D��I�$5�6�'�5��s��;K�'�86��87�J�s�O�88�89�	�90�.8��o�91�	�92r#
codekingpro/portable-devtools · Team Ai