403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/jedi/inference/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/jedi/inference/__pycache__/docstrings.cpython-312.pyc
�

Še`&��x�dZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZgd�Zej"d	ej$�ej"d
ej$�gZej"d�Zdad�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Ze	�d��Ze	�ed���Z y)a�
Docstrings are another source of information for functions and classes.
:mod:`jedi.inference.dynamic_params` tries to find all executions of functions,
while the docstring parsing is much easier. There are three different types of
docstrings that |jedi| understands:

- `Sphinx <http://sphinx-doc.org/markup/desc.html#info-field-lists>`_
- `Epydoc <http://epydoc.sourceforge.net/manual-fields.html>`_
- `Numpydoc <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_

For example, the sphinx annotation ``:type foo: str`` clearly states that the
type of ``foo`` is ``str``.

As an addition to parameter searching, this module also provides return
annotations.
�N)�parse�ParserSyntaxError)�debug)�inference_state_method_cache)�iterator_to_value_set�ValueSet�	NO_VALUES)�LazyKnownValues)z\s*:type\s+%s:\s*([^\n]+)z\s*:param\s+(\w+)\s+%s:[^\n]*z\s*@type\s+%s:\s*([^\n]+)z\s*:rtype:\s*([^\n]+)z\s*@rtype:\s*([^\n]+)z:[^`]+:`([^`]+)`c�^�ttttf�rt�ddlm}|atS)Nr��NumpyDocString)�
isinstance�_numpy_doc_string_cache�ImportError�SyntaxError�numpydoc.docscraper
rs �;/usr/lib/python3/dist-packages/jedi/inference/docstrings.py�_get_numpy_doc_string_clsr/s'���)�K��+E�F�%�%�1�,��"�"�c��tj�5tjd�	t�|�jd}	ddd�D]J\}}}||k(s�
t
jd|�}|r|jd�}tt|��cSgS#t
$rgcYcddd�SwxYw#1swY�txYw)zASearch `docstr` (in numpydoc format) for type(-s) of `param_str`.�ignore�
ParametersNz"([^,]+(,[^,]+)*?)(,[ ]*optional)?$�)�warnings�catch_warnings�simplefilterr�_parsed_data�	Exception�re�match�group�list�_expand_typestr)�docstr�	param_str�params�p_name�p_type�p_descr�ms       r�_search_param_in_numpydocstrr+8s���	�	 �	 �	"�����h�'�	�1�.�0��8�E�E�l�S�F��$*�1������Y�����>��G�A�����������/�0�0�1��I���	��I���	��
��s(�B=�B#�#B:�.B=�9B:�:B=�=Cc#�K�tj�5tjd�	t�|�}	ddd�	j
d}||j
dz
}|D]\}}}|s|}t
|�Ed{����y#t$rYddd�ywxYw#1swY�exYw#t$rYywxYw7�9�w)zP
    Search `docstr` (in numpydoc format) for type(-s) of function returns.
    rN�Returns�Yields)rrrrrrr#)r$�doc�returns�r_name�r_type�r_descrs      r�_search_return_in_numpydocstrr4Ks�����
�	 �	 �	"�����h�'�	�-�+�-�f�5�C����"�"�9�-���3�#�#�H�-�-��$+�+�������F�"�6�*�*�*�	+���	����	��	��������	+�sn�C�B#�B�C�!B/�)C�B>�C�	B �B#�	C�B � B#�#B,�(C�/	B;�8C�:B;�;Cc#�~K�tjd|�r;|jd�D]&}|jd�dj����(ytjd|�r|jd�d��y|j	d�r�t|d��jd}|jd	k(r|t|jd
dg�D]^}|jdk(rd
|jvrd���%d���*|jdk(s�:d|jj�vrd���[d���`yy|��y�w)z@
    Attempts to interpret the possible types in `type_str`
    z\bor\b�or�ofrz\bof\b�{z3.7)�version�atomr�children�number�.�float�int�string�b�bytes�strN)r�search�split�strip�
startswithrr;�type�getattr�value�
string_prefix�lower)�type_str�t�node�leafs    rr#r#cs����

�y�y��H�%�����%�	+�A��'�'�$�-��"�(�(�*�*�	+�
���9�h�	'��n�n�T�"�1�%�%�	�	�	�S�	!��X�u�-�6�6�q�9���9�9�����
�
�a� 0�*�b�A�

$���9�9��(��d�j�j�(�%�
�#���Y�Y�(�*��d�0�0�6�6�8�8�%�
�#��

$�� ��s�DD=�.D=c	�
�tD�cgc]-}tj|tj|�z���/}}|D]2}|j	|�}|s�t|j
d��gcSt||�Scc}w)a�
    Search `docstr` for type(-s) of `param_str`.

    >>> _search_param_in_docstr(':type param: int', 'param')
    ['int']
    >>> _search_param_in_docstr('@type param: int', 'param')
    ['int']
    >>> _search_param_in_docstr(
    ...   ':type param: :class:`threading.Thread`', 'param')
    ['threading.Thread']
    >>> bool(_search_param_in_docstr('no document', 'param'))
    False
    >>> _search_param_in_docstr(':param int param: some description', 'param')
    ['int']

    r)�DOCSTRING_PARAM_PATTERNSr�compile�escaperD�_strip_rst_roler!r+)r$r%�p�patterns�patternr s      r�_search_param_in_docstrrY�s���&2�3���
�
�1�r�y�y��3�3�4�3�H�3��5�����v�&���#�E�K�K��N�3�4�4�5�
(��	�:�:��3s�2Bc�V�tj|�}|r|jd�S|S)a�
    Strip off the part looks like a ReST role in `type_str`.

    >>> _strip_rst_role(':class:`ClassName`')  # strip off :class:
    'ClassName'
    >>> _strip_rst_role(':py:obj:`module.Object`')  # works with domain
    'module.Object'
    >>> _strip_rst_role('ClassName')  # do nothing when not ReST role
    'ClassName'

    See also:
    http://sphinx-doc.org/domains.html#cross-referencing-python-objects

    r)�REST_ROLE_PATTERNr r!)rMr s  rrUrU�s*��
�#�#�H�-�E���{�{�1�~���rc��|�gStjd|�}djd�|D��}|�d|��}tjd|d��|j
j}	|j|d��}	|jd	}|jd
vrgSddl
m}|||j
|g�
�}tt!|j#�|��S#t$rgcYSwxYw#ttf$rgcYSwxYw)Nz((?:\w+\.)*\w+)\.�
c3�&K�|]	}d|�����y�w)zimport N�)�.0rVs  r�	<genexpr>z._infer_for_statement_string.<locals>.<genexpr>�s����A�!�'�!��
�A�s�zParse docstring code %s�BLUE��colorF)�error_recovery���)�namer:�	atom_exprr)�DocstringModule)�in_module_context�inference_state�module_node�
code_lines)r�findall�joinr�dbgrk�grammarrrr;�AttributeError�
IndexErrorrH�jedi.inference.docstring_utilsrir"�_execute_types_in_stmt�
as_context)	�module_contextr@�potential_imports�importsrq�module�stmtrir*s	         r�_infer_for_statement_stringr|�s��
�~��	��
�
�#7��@���i�i�A�/@�A�A�G��y��6�(�
#�F�	�I�I�'��v�>��,�,�4�4�G�����v�e��<������r�"���y�y�5�5��	�?��(�&�6�6���		�A��&�q�|�|�~�t�<�=�=��)���	���

�J�'���	��s$�)C�=C,�C)�(C)�,D�?Dc�b���j|�}tj�fd�|D��S)z�
    Executing all types or general elements that we find in a statement. This
    doesn't include tuple, list and dict literals, because the stuff they
    contain is executed. (Used as type information).
    c3�J�K�|]}t�j|����y�w�N)�_execute_array_valuesrk)r`�drws  �rraz)_execute_types_in_stmt.<locals>.<genexpr>�s&������
�	�n�<�<�a�@��s� #)�
infer_noder�	from_sets)rwr{�definitionss`  rruru�s5���!�+�+�D�1�K��������rc�`��ddlm}m}m}t	||�r�|j
dvrzg}|j
�D]H}tj�fd�|j�D��}|jt|���J|j
dk(r|n|}|�|�hS|j�S)z�
    Tuples indicate that there's not just one return value, but the listed
    ones.  `(str, int)` means that it returns a tuple with both types.
    r)�SequenceLiteralValue�	FakeTuple�FakeList)�tupler"c3�6�K�|]}t�|����y�wr)r�)r`�typrks  �rraz(_execute_array_values.<locals>.<genexpr>�s �����)��&�o�s�;�)�s�r�)
�jedi.inference.value.iterabler�r�r�r�
array_type�
py__iter__rr��infer�appendr
�execute_annotation)	rk�arrayr�r�r��values�
lazy_value�objects�clss	`        rr�r��s����
X�W��%�-�.�5�3C�3C�GX�3X����*�*�,�	4�J��(�(�)�%�+�+�-�)��G�
�M�M�/�'�2�3�	4�!�+�+�w�6�i�H���O�V�,�-�-��'�'�)�)rc�h�����fd�}|j���j�}|jdk(rtS||j	��}|j�r6|j
�dk(r#|||jj	��z}tjd|d��|S)Nc�h��t�fd�t|�jj�D��S)Nc3�D�K�|]}t�|�D]}|����y�wr)r|)r`r%rVrws   �rraz7infer_param.<locals>.infer_docstring.<locals>.<genexpr>�s5�����
��0���K�
��
�
�
�
�s� )rrYrgrJ)�	docstringrw�params ��r�infer_docstringz$infer_param.<locals>.infer_docstring�s.����
�4�Y��
�
�@P�@P�Q�
�
�	
r�lambdef�__init__z#Found param types for docstring: %srbrc)
�get_root_context�get_parent_functionrHr	�	py__doc__�is_bound_method�
py__name__�
class_contextrrp)�function_valuer�r��func�typesrws `   @r�infer_paramr��s����
�$�4�4�6�N��$�$�&�D��y�y�I�����N�4�4�6�7�E��%�%�'��)�)�+�z�9�
���!=�!=�!G�!G�!I�J�J��	�I�I�3�U�&�I��Lrc#�K�d�}||j��D]$}t|j�|�Ed{����&y7��w)Nc3�K�tD]2}|j|�}|s�t|jd�����4t	|�Ed{���y7��w)Nr)�DOCSTRING_RETURN_PATTERNSrDrUr!r4)�coderVr s   r�search_return_in_docstrz3infer_return_types.<locals>.search_return_in_docstrsH����*�	6�A��H�H�T�N�E��%�e�k�k�!�n�5�5�	6�
1��6�6�6�s�A�,A�A�
A)r�r|r�)r�r�rMs   r�infer_return_typesr�sI����7�,�N�,D�,D�,F�G�\��.�~�/N�/N�/P�RZ�[�[�[�\�[�s�:A�A�A)!�__doc__rr�parsorr�jedir�jedi.inference.cacher�jedi.inference.base_valuerrr	�jedi.inference.lazy_valuer
rRrS�Mr�r[rrr+r4r#rYrUr|rur�r�r�r_rr�<module>r�s����"
��*��=���5����B�J�J�'����.��B�J�J�'����.���
�B�J�J�2�3����#��&+�0�B;�8�,">�J
�*�(��� ��*���
\�� �
\r

Youez - 2016 - github.com/yon3zu
LinuXploit