ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/astroid/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/astroid/__pycache__/arguments.cpython-311.pyc

�

�܋f�2��t�ddlmZddlmZddlmZddlmZmZddl	m
Z
mZddlm
Z
mZGd�d��Zd	S)
�)�annotations)�nodes)�Instance)�CallContext�InferenceContext)�InferenceError�	NoDefault)�Uninferable�UninferableBasec�b�eZdZdZ		ddd�Zeddd���Zd	�Zdd�Zddd
�Z	ddd�Z
d�ZdS)�CallSitea�Class for understanding arguments passed into a call site.

    It needs a call context, which contains the arguments and the
    keyword arguments that were passed into a given call site.
    In order to infer what an argument represents, call :meth:`infer_argument`
    with the corresponding function node and the argument name.

    :param callcontext:
        An instance of :class:`astroid.context.CallContext`, that holds
        the arguments for the call site.
    :param argument_context_map:
        Additional contexts per node, passed in from :attr:`astroid.context.Context.extra_context`
    :param context:
        An instance of :class:`astroid.context.Context`.
    N�callcontextr�context�InferenceContext | Nonec�J�|�i}||_|j}|j}t��|_|�||���|_|�||���|_d�|jD��|_	d�|j�
��D��|_dS)N�rc�<�g|]}t|t���|��S���
isinstancer��.0�args  �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/astroid/arguments.py�
<listcomp>z%CallSite.__init__.<locals>.<listcomp>.s7��%
�%
�%
��j��o�6V�6V�%
��%
�%
�%
�c�D�i|]\}}t|t���||��Srr�r�key�values   r�
<dictcomp>z%CallSite.__init__.<locals>.<dictcomp>1s>��"
�"
�"
���U��e�_�5�5�"
���"
�"
�"
r)�argument_context_map�args�keywords�set�duplicated_keywords�_unpack_args�_unpacked_args�_unpack_keywords�_unpacked_kwargs�positional_arguments�items�keyword_arguments)�selfrr"rr#r$s      r�__init__zCallSite.__init__s��� �'�#%� �$8��!�����'��-0�U�U�� �"�/�/��g�/�F�F��� $� 5� 5�h�� 5� P� P���%
�%
��.�%
�%
�%
��!�"
�"
�"�3�9�9�;�;�"
�"
�"
����rc�p�|p
t��}t|j|j��}|||���S)zxGet a CallSite object from the given Call node.

        context will be used to force a single inference path.
        r)rrr#r$)�cls�	call_noderrs    r�	from_callzCallSite.from_call7s>���/�-�/�/��!�)�.�)�2D�E�E���s�;��0�0�0�0rc�V�t|j��t|j��kS)aoCheck if in the current CallSite were passed *invalid* arguments.

        This can mean multiple things. For instance, if an unpacking
        of an invalid object was passed, then this method will return True.
        Other cases can be when the arguments can't be inferred by astroid,
        for example, by passing objects which aren't known statically.
        )�lenr+r(�r.s r�has_invalid_argumentszCallSite.has_invalid_argumentsCs%���4�,�-�-��T�5H�1I�1I�I�Ir�return�boolc�V�t|j��t|j��kS)agCheck if in the current CallSite were passed *invalid* keyword arguments.

        For instance, unpacking a dictionary with integer keys is invalid
        (**{1:2}), because the keys must be strings, which will make this
        method to return True. Other cases where this might return True if
        objects which can't be inferred were passed.
        )r5r-r*r6s r�has_invalid_keywordszCallSite.has_invalid_keywordsMs%���4�)�*�*�c�$�2G�.H�.H�H�Hrc��i}|p
t��}|j|_|D�]b\}}|��T	t|�|�����}n%#t
$r
t||<Y�Dt$rY�OwxYwt|tj
��st||<�x|jD]�\}}	t|�|�����}n%#t
$r
t||<Y�@t$rY�KwxYwt|tj��st||<�tt|j
t��st||<��|j
|vr/t||j
<|j�|j
����|||j
<�ܐ�]|||<��d|S)Nr)rr"�
extra_context�next�inferrr
�
StopIterationrr�Dictr,�Constr �strr&�add)	r.r$r�values�namer �inferred�dict_key�
dict_values	         rr)zCallSite._unpack_keywordsWs������/�-�/�/�� $� 9���#�%	%�%	%�K�D�%��|��#�E�K�K��K�$@�$@�A�A�H�H��%����#.�F�4�L��H�$�����H�����"�(�E�J�7�7��#.�F�4�L��,4�N�8�8�(�H�j�!�#'����w��(G�(G�#H�#H����)�!�!�!�'2��t�� ��(�!�!�!� ��!����%�h���<�<�!�'2��t�� �%�h�n�c�:�:�!�'2��t�� ��~��/�/�1<��x�~�.��0�4�4�X�^�D�D�D� �-7�F�8�>�*�*�'8�* %��t����
s/�#A�A1�%	A1�0A1�&#C
�
C,� 	C,�+C,c�X�g}|p
t��}|j|_|D�]}t|tj��r�	t
|j�|�����}n5#t$r|�
t��Y�mt$rY�xwxYwt|t��r|�
t����t|d��s|�
t����|�|j����|�
|����	|S)Nr�elts)rr"r=rr�Starredr>r r?r�appendr
r@r�hasattr�extendrK)r.r#rrErrGs      rr'zCallSite._unpack_args�s4�����/�-�/�/�� $� 9����	#�	#�C��#�u�}�-�-�
#��#�C�I�O�O�G�O�$D�$D�E�E�H�H��%�����M�M�+�.�.�.��H�$�����H������h��8�8���M�M�+�.�.�.���x��0�0���M�M�+�.�.�.���
�
�h�m�,�,�,�,��
�
�c�"�"�"�"��
s�(A(�($B�	B�Bc	�	��||jvrtd||||����	|j|�|��S#t$rYnwxYwt|j��t|jj��kr,|jjs |jj	std||||����|jdt|jj���}|jt|jj��d�}|j�
|��d}d�|jjD����fd�|j���D��}t|��t|jj��krG|jjD]:}|j
|vr/|�|j
��}	|�|	���;|��ct!|dd��}
|dk�r
|jd	v�r|
�)|jd
kr|r|d�|���S|
�|j�d�
��}
t)|
t*j��r?|j���}||
���urt3|
f��S|jd
kr9t)|
t4��s|
���}
t3|
f��S|jdkrt3|
f��S|jd	vr|
r|dz}	|j|�|��S#t8$rYnwxYw|jj|kr�|���r td|j|j||||����t+j |jj!|jj"|j���}|�#d�|���D����t3|f��S|jj|kr�|�$��r td|j|j%||||����t+j&|jj!|jj"|j���}
|
�#|��t3|
f��S	|j�'|���|��S#tP$rYnwxYwtd||||����)aInfer a function argument value according to the call context.

        Arguments:
            funcnode: The function being called.
            name: The name of the argument whose value is being inferred.
            context: Inference context object
        z9The arguments passed to {func!r} have duplicate keywords.)�	call_site�funcrrzJToo many positional arguments passed to {func!r} that does not have *args.Nrc��h|]	}|j��
Sr)rFrs  r�	<setcomp>z*CallSite.infer_argument.<locals>.<setcomp>�s��C�C�C�3�c�h�C�C�Crc�$��i|]\}}|�v�	||��
Srr)rrr �
kwonlyargss   �rr!z+CallSite.infer_argument.<locals>.<dictcomp>�s4���
�
�
���U��*�$�$�
��$�$�$r�	boundnode>�method�classmethodrXrT)�futurerY�z�Inference failed to find values for all keyword arguments to {func!r}: {unpacked_kwargs!r} doesn't correspond to {keyword_arguments!r}.)r-�unpacked_kwargsrQrRrr)�lineno�
col_offset�parentc�@�g|]\}}tj|��|f��Sr)r�
const_factoryrs   rrz+CallSite.infer_argument.<locals>.<listcomp>s,��T�T�T�z�s�E�%�%�c�*�*�E�2�T�T�Trz�Inference failed to find values for all positional arguments to {func!r}: {unpacked_args!r} doesn't correspond to {positional_arguments!r}.)r+�
unpacked_argsrQrRrrz-No value found for argument {arg} to {func!r}))r&rr-r?�KeyErrorr5r+r#�vararg�posonlyargs�find_argnamerVr,rF�poprM�getattr�typer_�framerr�ClassDef�scope�	metaclass�iterr�instantiate_class�
IndexError�kwargr;r*rAr]r^�postinitr7r(�Tuple�
default_valuer	)r.�funcnoderFr�
positionalrd�argindex�kwargs�func_argrrW�method_scoperqr#rVs              @r�infer_argumentzCallSite.infer_argument�sh����4�+�+�+� �K��������
�	��)�$�/�5�5�g�>�>�>���	�	�	��D�	�����t�(�)�)�C��
�0B�,C�,C�C�C��=�'�	
��
�0I�	
�$�&�#�!��#������.�/H��X�]�5G�1H�1H�/H�I�
��*�3�x�}�/A�+B�+B�+D�+D�E���=�-�-�d�3�3�A�6��C�C�(�-�*B�C�C�C�
�
�
�
�
�"�4�:�:�<�<�
�
�
���z�?�?�S���!3�4�4�4�4�$�M�.�
+�
+���=�F�*�*� �*�*�X�]�3�3�C��%�%�c�*�*�*�������d�;�;�I��1�}�}���2K�!K�!K��$���(�)B�)B�z�)B�%�a�=�.�.�w�.�?�?�?��$� (�� 5� 5�T� 5� B� B�I��i���8�8�2�
$,�?�#8�#8�#:�#:�L�#�y�':�':�'<�'<�<�<�#�Y�L�1�1�1��=�H�,�,�%�i��:�:�B�$-�$?�$?�$A�$A�	����-�-�-��=�M�1�1����-�-�-��}� 9�9�9�i�9��A�
��
��0��:�@�@��I�I�I���
�
�
���
�����=��$�&�&��(�(�*�*�
�$�-�'+�&<�$(�$9�"�!��#�
�
�
�
��J��}�+�#�=�3��}����E�

�N�N�T�T�V�\�\�^�^�T�T�T�
�
�
����>�>�!��=��4�'�'��)�)�+�+�
�$�>�*.�)B�"&�"5�"�!��#�
�
�
�
��;��}�+�#�=�3��}����D�

�M�M�&�!�!�!����=�=� �	��=�.�.�t�4�4�:�:�7�C�C�C���	�	�	��D�	�����;�����
�
�
�	
s5�A�
A
�A
�9L�
L&�%L&�8,R%�%
R2�1R2)NN)rrrr)N)rr)r8r9)�__name__�
__module__�__qualname__�__doc__r/rYr3r7r;r)r'r{rrrr
r
s���������&"�+/�	
�
�
�
�
�0�	1�	1�	1�	1��[�	1�J�J�J�I�I�I�I�*�*�*�*�*�X�����2Y
�Y
�Y
�Y
�Y
rr
N)�
__future__r�astroidr�
astroid.basesr�astroid.contextrr�astroid.exceptionsrr	�astroid.utilr
rr
rrr�<module>r�s���
#�"�"�"�"�"�������"�"�"�"�"�"�9�9�9�9�9�9�9�9�8�8�8�8�8�8�8�8�5�5�5�5�5�5�5�5�g
�g
�g
�g
�g
�g
�g
�g
�g
�g
r

Zerion Mini Shell 1.0