Your IP : 18.219.87.235
�
��bg�n��n�dZddlZddlZddlZddlmZddlmZm Z ddl
mZddlm
ZddlmZdd lmZd
ZGd�de��ZGd
�de��Zd�ZGd�d��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd �d!e��ZGd"�d#e��Z Gd$�d%e!��Z"d&Z#Gd'�d(e��Z$Gd)�d*��Z%Gd+�d,e&��Z'Gd-�d.e��Z(Gd/�d0��Z)dS)1zPython code parser.�N)�StringIO)�chain� dropwhile��Path)�compile)�Tuple�)�log)�Parser�
Definition�Module�Package�Function�NestedFunction�Method�Class�NestedClass�AllErrorr�
ParseErrorc��eZdZdZd�ZdS)rz+An error parsing contents of a Python file.c��dS)NzCannot parse file.���selfs �b/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pydocstyle/parser.py�__str__zParseError.__str__!s��#�#�N)�__name__�
__module__�__qualname__�__doc__rrrrrrs)������5�5�$�$�$�$�$rrc��eZdZd�Zd�ZdS)�UnexpectedTokenErrorc�"�||_||_dS�N��token�
expected_kind)rr(r)s r�__init__zUnexpectedTokenError.__init__&s����
�*����rc�B�d�|j|j��S)Nz Unexpected token {}, expected {})�formatr(r)rs rrzUnexpectedTokenError.__str__*s$��1�8�8��J��*�
�
�
rN)rr r!r*rrrrr$r$%s2������+�+�+�
�
�
�
�
rr$c�l�td���d|�����S)Nz(.)([A-Z]+)z\1 \2)�re�sub�lower)�strings r�humanizer20s,��
�n���!�!�(�F�3�3�9�9�;�;�;rc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�Valuez.A generic object with a list of preset fields.c�`�t|j��t|��krStd�t|��t|j��|jj|j�����t
|���t|j|����dS)Nz)got {} arguments for {} fields for {}: {}) �len�_fields�
ValueErrorr,� __class__r�vars�update�zip)r�argss rr*zValue.__init__7s����t�|����D� � �)�)��;�B�B���I�I����%�%��N�+��L� ����
�
�T�
�
���#�d�l�D�1�1�2�2�2�2�2rc�:�tt|����Sr&)�hash�reprrs r�__hash__zValue.__hash__Cs���D��J�J���rc�F�|ot|��t|��kSr&)r:)r�others r�__eq__zValue.__eq__Fs���2��d���t�E�{�{�2�2rc�t��d��fd��jD����}�jj�d|�d�S)Nz, c3�`�K�|](}d�|t�|����V��)dS)z{}={!r}N)r,�getattr)�.0�fieldrs �r� <genexpr>z!Value.__repr__.<locals>.<genexpr>JsQ�����
�
��
���U�G�D�%�$8�$8�9�9�
�
�
�
�
�
r�(�))�joinr7r9r)r�kwargss` r�__repr__zValue.__repr__Is\������
�
�
�
���
�
�
�
�
���.�)�5�5�F�5�5�5�5rN)rr r!r"r*rArDrOrrrr4r44sV������8�8�
3�
3�
3� � � �3�3�3�6�6�6�6�6rr4c���eZdZdZdZed���Zed���Zed���Zed���Z ed���Z
dZd �Zed
���Z
ed���Zed���Zd
�ZdS)r
z@A Python source code definition (could be class, function, etc).)
�name�_source�start�end�
decorators� docstring�children�
callable_args�parent�skipped_error_codesc�D�tt|��j��Sr&)r2�typerrs r�<lambda>zDefinition.<lambda>as��8�D��J�J�,?�#@�#@�rc�@�|j���dS)N���)�_human�splitrs rr]zDefinition.<lambda>bs����!2�!2�!4�!4�R�!8�rc��|jjSr&)rY�modulers rr]zDefinition.<lambda>cs��4�;�#5�rc��|jjSr&)rc�
dunder_allrs rr]zDefinition.<lambda>ds��t�{�'=�rc�<�t|jdz
|j��S)Nr
)�slicerSrTrs rr]zDefinition.<lambda>es��5���a����#B�#B�rFc�(�t|gg|j�R�Sr&)rrWrs r�__iter__zDefinition.__iter__hs���d�V�,�d�m�,�,�,�,rc�\�t|jt��r|jjS|jS)z4Get the line number with which to report violations.)�
isinstancerV� DocstringrSrs r�error_linenozDefinition.error_linenoks+���d�n�i�0�0� (��>�'�'��z�rc�"�ddd�|jS)N�public�private)TF)� is_publicrs r�
_publicityzDefinition._publicityrs���y�1�1�$�.�A�Arc���|j|j}d�}t|t|����}d�tt|������S)z*Return the source code for the definition.c��|���dkp&|����d��S)N��#)�strip�
startswith)�lines r�is_empty_or_commentz.Definition.source.<locals>.is_empty_or_comment{s0���:�:�<�<�2�%�E������)@�)@��)E�)E�Erru)rR�_slicer�reversedrM�list)r�full_srcrz�filtered_srcs r�sourcezDefinition.sourcevs`���<���,�� F� F� F�!�!4�h�x�6H�6H�I�I���w�w�x��\� 2� 2�3�3�4�4�4rc�f�d|j�d|j�d|j�d�}|jr|d|j�d�z
}|S)Nzin � z `�`z (skipping rL)rrr`rQrZ)r�outs rrzDefinition.__str__�sQ��A�D�O�A�A�d�k�A�A�T�Y�A�A�A���#� =��<��!9�<�<�<�<�C��
rN)rr r!r"r7�propertyr`�kindrcrer{�is_classrirmrrr�rrrrr
r
Qs�������J�J��G��X�@�@�
A�
A�F��8�8�8�9�9�D�
�X�5�5�
6�
6�F���=�=�>�>�J�
�X�B�B�
C�
C�F��H�-�-�-�����X���B�B��X�B��5�5��X�5�����rr
c��eZdZdZdZed���Zed���Zed���Z ed���Z
d�Zd�Zd �Z
d
�ZdS)rzA Python source code module.)rQrRrSrTrUrVrWrY�_dunder_all�dunder_all_error�future_importsrZc�,�ttd�|S�N��def�class)rr��ss rr]zModule.<lambda>�s��8�e�#D�#D�Q�#G�rc��|Sr&rrs rr]zModule.<lambda>�s��4�rc��|jSr&)r�rs rr]zModule.<lambda>�s ��t�'7�rc��t|j��j}|���o|�|��S)zsReturn True iff the module is considered public.
This helps determine if it requires a docstring.
)rrQ�stem�_is_inside_private_package�_is_public_name�r�module_names rrqzModule.is_public�sE���4�9�o�o�*���2�2�4�4�4�
��9M�9M��:
�:
�
rc���t|j��j}d�tjD��}||jkr6||vr2|�|j��rdS|j}||jkr||v�2dS)z6Return True if the module is inside a private package.c�,�g|]}t|����Srr)rH�ps r�
<listcomp>z5Module._is_inside_private_package.<locals>.<listcomp>�s��-�-�-�q�4��7�7�-�-�-rTF)rrQrY�sys�path�_is_private_name)rr��syspaths rr�z!Module._is_inside_private_package�s����D�I���%��-�-�C�H�-�-�-���d�k�!�!�d�'�&9�&9��$�$�T�Y�/�/�
��t��;�D��d�k�!�!�d�'�&9�&9�
�urc��|�d��p)|�d��o|�d��S)zJDetermine whether a "module name" (i.e. module or package name) is public.�_�__)rx�endswithr�s rr�zModule._is_public_name�sD���)�)�#�.�.�.�
��"�"�4�(�(�G�[�-A�-A�$�-G�-G�
rc�.�|�|��S)zKDetermine whether a "module name" (i.e. module or package name) is private.)r�r�s rr�zModule._is_private_name�s���'�'��4�4�4�4rc��dS)Nzat module levelrrs rrzModule.__str__�s�� � rN)rr r!r"r7�staticmethod�_nestr�rcrerqr�r�r�rrrrrr�s�������&�&�
�G�
�L�G�G�H�H�E�
�X�'�'�
(�
(�F���7�7�8�8�J�
�
�
��X�
����
�
�
�5�5�5�!�!�!�!�!rrc��eZdZdZdS)rz"A package is a __init__.py module.N)rr r!r"rrrrr�s������,�,�,�,rrc��eZdZdZed���Zed���Zed���Zd�Z ed���Z
ed���ZdS) rzA Python source code function.c�,�ttd�|Sr�)rrr�s rr]zFunction.<lambda>�s��.�;�?�?��B�rc�b�|j�|j|jvS|j�d��S)z:Return True iff this function should be considered public.Nr�)rerQrxrs rrqzFunction.is_public�s4���?�&��9���/�/��y�+�+�C�0�0�0�0rc�>�td�|jD����S)z3Return True iff the method decorated with overload.c3�,K�|]}|jdkV��dS)�overloadN�rQ)rH� decorators rrJz'Function.is_overload.<locals>.<genexpr>�s:����
�
�-6�I�N�j�(�
�
�
�
�
�
r��anyrUrs r�is_overloadzFunction.is_overload�s4���
�
�:>�/�
�
�
�
�
�
rc�D��t�fd�|jD����S)zCReturn True if the method is decorated with any property decorator.c3�*�K�|]
}|j�vV��dSr&r�)rHr��property_decorator_namess �rrJz'Function.is_property.<locals>.<genexpr>�s?�����
�
��
�N�6�6�
�
�
�
�
�
rr�)rr�s `r�is_propertyzFunction.is_property�s=����
�
�
�
�!�_�
�
�
�
�
�
rc�L�|j�d��p
|jdkS)aReturn True if this function is a test function/method.
We exclude tests from the imperative mood check, because to phrase
their docstring in the imperative mood, they would have to start with
a highly redundant "Test that ...".
�test�runTest)rQrxrs r�is_testzFunction.is_test�s&���y�#�#�F�+�+�E�t�y�I�/E�Erc��|jS)zReturn the parameter names.)rXrs r�param_nameszFunction.param_names�s
���!�!rN)rr r!r"r�r�r�rqr�r�r�r�rrrrr�s�������(�(��L�B�B�
�
�E��1�1��X�1��
�
��X�
�
�
�
��F�F��X�F��"�"��X�"�"�"rrc��eZdZdZdZdS)rz%A Python source code nested function.FN)rr r!r"rqrrrrr�s������/�/��I�I�Irrc�j�eZdZdZed���Zed���Zed���Zed���ZdS)rzA Python source code method.c��|j�d��o'|j�d��o
|jtvS)z@Return True iff this method is a magic method (e.g., `__str__`).r�)rQrxr��VARIADIC_MAGIC_METHODSrs r�is_magiczMethod.is_magic�sD��
�I� � ��&�&�
8�� �"�"�4�(�(�
8�� �!7�7�
rc��|jdkS)z*Return True iff this method is `__init__`.r*r�rs r�is_initzMethod.is_inits���y�J�&�&rc��|jD]5}td|j�d����|j��rdS�6|j�d��p|jt
vp|j}|jjo|S)z8Return True iff this method should be considered public.�^z\.Fr�) rUr.rQ�matchrxr�r�rYrq)rr��name_is_publics rrqzMethod.is_publics����� � �I��$�t�y�$�$�$�%�%�+�+�I�N�;�;�
��u�u�
�� �$�$�S�)�)�)�
��y�2�2�
��}� �
�{�$�7��7rc�6�|jD]}|jdkrdS�dS)z%Return True iff the method is static.r�TF)rUrQ)rr�s r� is_staticzMethod.is_statics3���� � �I��~��/�/��t�t�0��urN) rr r!r"r�r�r�rqr�rrrrr�s�������&�&�
�
�
��X�
��'�'��X�'��8�8��X�8�����X���rrc�<�eZdZdZed���ZejZdZdS)rzA Python source code class.c�,�ttd�|Sr�)rrr�s rr]zClass.<lambda>'s��6�K�#H�#H��#K�rTN) rr r!r"r�r�rrqr�rrrrr$s4������%�%��L�K�K�L�L�E��"�I��H�H�Hrrc�(�eZdZdZed���ZdS)rz"A Python source code nested class.c�h�|j�d��o|jjo|jjS)z7Return True iff this class should be considered public.r�)rQrxrYr�rqrs rrqzNestedClass.is_public/s9��� �$�$�S�)�)�)�
&���$�
&���%�
rN)rr r!r"r�rqrrrrr,s3������,�,�
�
�
��X�
�
�
rrc�:�eZdZdZd���ZdS)� Decoratorz*A decorator for function, method or class.zname argumentsN)rr r!r"rar7rrrr�r�9s%������4�4��$�$�&�&�G�G�Grr�c��eZdZdZd�Zd�ZdS)rlz�Represent a docstring.
This is a string, but has additional start/end attributes representing
the start and end of the token.
c�8�t�||��Sr&)�str�__new__)�cls�vrSrTs rr�zDocstring.__new__Gs���{�{�3��"�"�"rc�"�||_||_dSr&)rSrT)rr�rSrTs rr*zDocstring.__init__Js����
�����rN)rr r!r"r�r*rrrrlrl?s<��������#�#�#�����rrl)r*�__call__r�c��eZdZdZd�ZdS)rz9Raised when there is a problem with __all__ when parsing.c�f�t�||tjd��z��dS)z2Initialize the error with a more specific message.a]
That means pydocstyle cannot decide which definitions are
public. Variable __all__ should be present at most once in
each file, in form
`__all__ = ('a_public_function', 'APublicClass', ...)`.
More info on __all__: http://stackoverflow.com/q/44834/. ')
N)� Exceptionr*�textwrap�dedent)r�messages rr*zAllError.__init__UsC��������o����
�
�
�
�
�
rN)rr r!r"r*rrrrrRs)������C�C�
�
�
�
�
rrc�N�eZdZejejejhZd�Zd�Z d�Z
d�ZdS)�TokenStreamc���tj|j��|_t t|jd���|_|jjd|_t|_ d|_
dS)NrT)�tk�generate_tokens�readline�
_generator�Token�next�currentrSryr�got_logical_newline)r�filelikes rr*zTokenStream.__init__nsU���,�X�->�?�?����d�4�?�D�9�9�:����L�&�q�)�� ����#'�� � � rc� �|j}|���}|�dnt|�|_|jr|jjdn|j|_|jtjtjfv}|j|j vp|j
o||_
|S)Nr)r��_next_from_generatorr�rSryr�r��NL�COMMENT�LOGICAL_NEWLINESr�)r�previousr��is_logical_blanks r�movezTokenStream.moveus����<���+�+�-�-��&��t�t�E�7�O���-1�\�H�D�L�&�q�)�)�t�y�� �#�=�R�U�B�J�,?�?���M�T�2�2�
?��(�=�-=�
� �
�rc�� t|jd��S#ttjf$r |j�dd���YdSwxYw)Nzerror generating tokensT)�exc_info)r�r��SyntaxErrorr��
TokenErrorr�warningrs rr�z TokenStream._next_from_generator�s^�� �����.�.�.���R�]�+� � � ��H���6���F�F�F��4�4� ���s��2A
�A
c#�XK� |j�
|jV�ndS|����(r&)r�r�rs rrizTokenStream.__iter__�s;���� ��|�'��l�"�"�"�"����I�I�K�K�K� rN)rr r!r��NEWLINE�INDENT�DEDENTr�r*r�r�rirrrr�r�fse�������
�B�I�r�y�9��(�(�(�����������rr�c��eZdZd�ZdS)� TokenKindc�L�d�tj|��S)Nztk.{})r,r��tok_namers rrOzTokenKind.__repr__�s���~�~�b�k�$�/�0�0�0rN)rr r!rOrrrrr�s#������1�1�1�1�1rrc�L��eZdZd���Z�fd�Zd�Z�xZS)r�zkind value start end sourcec�f��t��j|�t|j��|_dSr&)�superr*rr�)rr=r9s �rr*zToken.__init__�s,��������$����d�i�(�(�� � � rc�&�|j�d|j�d�S)Nz (rL)r��valuers rrz
Token.__str__�s���)�.�.���.�.�.�.r)rr r!rar7r*r�
__classcell__)r9s@rr�r��sX�������+�1�1�3�3�G�)�)�)�)�)�/�/�/�/�/�/�/rr�c��eZdZdZd�Zd�Zed���Zed���Zd�Z dd�Z
d �Zd
�Zdd�Z
d
�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�ZdS)rzA Python source code parser.c��t|_|���|_d�|j��} t ||d��n!#t
$r}t
��|�d}~wwxYwtt|����|_ ||_
d|_d|_t��|_g|_|���S)z>Parse the given file-like object and return its Module object.ru�execN)r� readlinesr�rMrr�rr�r�stream�filenamerer��setr��_accumulated_decorators�parse_module)rr�r�src�errors r�parsezParser.parse�s�������(�(�*�*����g�g�d�k�"�"�� *��C��6�*�*�*�*��� *� *� *��,�,�E�)����� *����!�(�3�-�-�0�0��� ��
���� $���!�e�e���')��$�� � �"�"�"s�A�
A1�A,�,A1c��|j|i|��S)zCall the parse method.)r)rr=rNs rr�zParser.__call__�s���t�z�4�*�6�*�*�*rc��|jjSr&)r
r�rs rr]zParser.<lambda>�s��D�K�$7�rc��|jjSr&)r
ryrs rr]zParser.<lambda>�s����!1�rc�p�|j���}|j|krt||����dS)z8Consume one token and verify it is of the expected kind.r'N)r
r�r�r$)rr��
next_tokens r�consumezParser.consume�s=���[�%�%�'�'�
��?�d�"�"�&�Z�t�L�L�L�L�#�"rNc���|j�[|jj|kr)|�|jj|kr|�|��dS|j���|j�YdSdS)z�Skip tokens in the stream until a certain token kind is reached.
If `value` is specified, tokens whose values are different will also
be skipped.
N)r�r�rrr
r�)rr�rs r�leapfrogzParser.leapfrog�sq���l�&��|� �D�(�(��
���!3�u�!<�!<����T�"�"�"����K������
�l�&�&�&�&�&rc�t�|j�d|j��|jjtjtjtjfvrx|j� ��|j�d|jj|jj
��|jjtjtjtjfv�x|jjtjkrVt|jj
|jj
d|jjd��}|j� ��|SdS)z.Parse a single docstring and return its value.zparsing docstring, token is %sz#parsing docstring, token is %r (%s)rN)r�debugr�r�r�r�r�r�r
r�r�STRINGrlrSrT)rrVs r�parse_docstringzParser.parse_docstring�s�������7���F�F�F��l��B�J��
�B�E�#B�B�B��K�������H�N�N�5���!���"�
�
�
��l��B�J��
�B�E�#B�B�B��<��� �)�)�!���"�D�L�$6�q�$9�4�<�;K�A�;N���I�
�K���������trc�N�g}g}d}|j���|j�d|jj|jj��|jjt
jkr|jjdvr�nn|jjt
jkre|jjdkrU|j� td�|��d�|������g}g}d}n�|jjt
jkr|jjdkrd}n�|jjt
jkr|jjd krnv|jjt
jks|jjt
j
krnA|s |� |jj��n|� |jj��|j���|j���|j� td�|��d�|������dS)
z�Parse decorators into self._accumulated_decorators.
Called after first @ is found.
Continue to do so until encountering the 'def' or 'class' start token.
FNz,parsing decorators, current token is %r (%s))�asyncr�r��@rurKTrL)r�rrr�rr��NAME�OPr�appendr�rMr�r�r
r�)rrQ� arguments�at_argumentss r�parse_decoratorszParser.parse_decorators�s����� ����l�&��H�N�N�>���!���"�
�
�
�
�|� �B�G�+�+���0B�G�1�1����"�b�e�+�+���0B�c�0I�0I��,�3�3��b�g�g�d�m�m�R�W�W�Y�-?�-?�@�@������� �$�����"�b�e�+�+���0B�c�0I�0I�#�����"�b�e�+�+���0B�c�0I�0I����"�b�j�0�0�D�L�4E���4N�4N��$�9��K�K��� 2�3�3�3�3��$�$�T�\�%7�8�8�8��K������I�l�&�N
�$�+�+��b�g�g�d�m�m�R�W�W�Y�%7�%7�8�8�
�
�
�
�
rFc#� K�|j��|j�d|jj|jj��|j�d|jj��|r&|jjdkr|����n||jjtj krQ|jjdkrA|jjr5|�
tj ��|����n|jjdvr5|�|�
|jj����V�n�|jjtjkr;|�
tj��|�|��Ed{V��ny|jjtjkr!|�
tj��dS|jjdkr|���n|j���|j��dSdS)z*Parse multiple definitions and yield them.Nz1parsing definition list, current token is %r (%s)zgot_newline: %s�__all__r#r��from)r�rrr�rr
r��parse_dunder_allr�r%rr)�parse_definitionr�r��parse_definitionsr��parse_from_import_statementr�)r�class_res rr/zParser.parse_definitionss������l�&��H�N�N�C���!���"�
�
�
�
�H�N�N�,�d�k�.M�N�N�N��
#�d�l�0�I�=�=��%�%�'�'�'�'���!�R�U�*�*��L�&�#�-�-��K�3�.����R�U�#�#�#��%�%�'�'�'�'���#�'7�7�7��+�+�F�L�L���9K�,L�,L�M�M�M�M�M�M���"�b�i�/�/����R�Y�'�'�'��1�1�&�9�9�9�9�9�9�9�9�9�9���"�b�i�/�/����R�Y�'�'�'�����#�v�-�-��0�0�2�2�2�2��� � �"�"�"�7�l�&�&�&�&�&rc�|�|jjdksJ�|�tj��|j�|j�d|_d|_dS|jjdkr d|_dS|�tj��d}|jjdvr!d}|�tj��d} |r|jjd vrn�|jjtj tj
fvrn�|jjtjtjfvrnC|jjtj
ks|jjd
kr||jjz
}n d|_dS|j�����|r|�tj��|s*d
|vr&d�|jj��|_dS|d
z
} t#|i��|_n2#t$$r%}d�||��|_Yd}~nd}~wwxYw|jj|jjvr�|jjtj
kry|jjtjkrd|_d|_dS|j���|jj|jjvr |jjtj
k�udSdSdSdS)z)Parse the __all__ definition in a module.r+Nz(Could not evaluate contents of __all__. �=Fz([TrKz)]�,z'Could not evaluate contents of __all__.z(Unexpected token kind in __all__: {!r}. rLzOCould not evaluate contents of __all__.The value was {}. The exception was:
{})r�rrr�r$rer�r%r�r�� ENDMARKERr�r�rr
r�r,�eval�
BaseExceptionr�)r�
is_surrounded�dunder_all_content�es rr-zParser.parse_dunder_all8s����|�!�Y�.�.�.�.����R�W�����?�&�$�*?�*K�"�D�O�$N�D�!��F��<���$�$�$N�D�!��F����R�U�����
��<���%�%� �M��L�L������ �� ��
���!3�t�!;�!;���|� �R�Z���$>�>�>���|� �R�U�B�J�$7�7�7����"�b�i�/�/�4�<�3E��3L�3L�"�d�l�&8�8�"�"�>��%����K������ �� ��L�L������� ��,>�!>�!>�:�A�A��L�%���
�!�
�F��c�!�� �"�#5�r�:�:�D�O�O��� � � �=�=C�V�&��>�>�
�!�!�!�!�!�!����� ����
�L��T�[�%A�A�A���!�R�\�1�1��|� �B�J�.�.�"&���>��%����K������
�L��T�[�%A�A�A���!�R�\�1�1�1�1�
B�A�1�1�
B�As�G�
H�'H�Hc�6�|j�d��|j}|���}|���}t|�td�����}|j�J|j���|j}t}|j �
d��rt}||j |j||g||d|j
|jd|��}|jD] }||_�
|j|_|j�d��|S)z=Parse a module (and its children) and return a Module object.zparsing module.T)reNz__init__.pyzfinished parsing module.)rrry�parse_skip_commentr r}r/rr�rr�rr�rer�rWrYr�) rrSrZrVrWrTr�rc�childs rrzParser.parse_module|s!������(�)�)�)�� ��"�5�5�7�7���(�(�*�*� ���.�.�v�$�.�G�G�H�H���|�#�#�T�\�#�#�#��i�����=�!�!�-�0�0� ��C����M��K��������O��!���
�
���_� "� "�E�!�E�L�L� $� 3�������1�2�2�2��
rc�$�|j}|�tj��|jj}|j�d|j|��|j �
��g}|jjtjkr�|jjdkr�d}d} |jjtjkrF|jjdkr|dz
}ns|jjdkr
|dz}|dkrnqnV|jjdkrd}nC|dkr=|jjtjkr#|s!|�
|jj��d}|j �
����|jjtjks|jjd kr"|�tjd �
��n|�tj��|jjtjtjfvr�|���}|�tj��|jjtjksJ�|���}|j} |j�d| ��g|_|j�d��t+|�|����}
|j�d
|��|jdz
}ngd}|���}|j} |j�d| ��g|_g}
|j}|�tj��|||j||| ||
|d|�
�
}|jD] }
||
_�
|j�d|j||j��|S)z=Parse a definition and return its value in a `class_` object.zparsing %s '%s'rKrFTr
rLr4�:�rz"current accumulated decorators: %szparsing nested definitions.z,finished parsing nested definitions for '%s'ruNz*finished parsing %s '%s'. Next token is %r)ryrr�r$r�rrrrr
r�r�r%r&rr�r�r<r�r rr}r/r�rWrY)rr1rSrQrX�parenthesis_level�in_default_argrZrVrUrWrT�
definitionr=s rr.zParser.parse_definition�sw��� �����R�W�����|�!������(�&�/�4�@�@�@���������
��<����%�%�$�,�*<��*C�*C� !��"�N�
#��<�$���-�-��|�)�S�0�0�)�Q�.�)�)���+�s�2�2�)�Q�.�)�,��1�1�!�2���+�s�2�2�).���%��*�*���)�R�W�4�4�*�5�"�(�(���);�<�<�<�%)�N��� � �"�"�"�#
#�$�<����%�%���);�s�)B�)B��M�M�"�%�s�M�+�+�+�+��L�L�������<����R�Z� 8�8�8�"&�"9�"9�";�";���M�M�"�)�$�$�$��<�$�� �1�1�1�1��,�,�.�.�I��5�J��H�N�N�?��L�L�L�+-�D�(��H�N�N�8�9�9�9��D�2�2�6�:�:�;�;�H��H�N�N�>��
�
�
��)�a�-�C�C�"$���,�,�.�.�I��5�J��H�N�N�?��L�L�L�+-�D�(��H��)�C��M�M�"�*�%�%�%��V���K���������
�
�
� �(� &� &�E�%�E�L�L�����8��O���L�
�
�
��rc�f�d}|jjtjtjtjfvr�|jjtjkrjd|jjvr;d�|jj�d��dd���}n!|jj� d��rd}|j
���|j�
d|jj|jj��|rn/|jjtjtjtjfv��|S)z*Parse a definition comment for noqa skips.ruznoqa: r
Nz# noqa�allz3parsing comments before docstring, token is %r (%s))r�r�r�r�r�r�rrMrarxr
r�rr)rrZs rr<zParser.parse_skip_comment�s�� ���l��B�J��
�B�E�#B�B�B��|� �B�J�.�.��t�|�1�1�1�*,�'�'���*�0�0��:�:�1�2�2�>�+�+�'�'��\�'�2�2�8�<�<�0�*/�'��K�������H�N�N�E���!���"�
�
�
�#�
��!�l��B�J��
�B�E�#B�B�B�$#�"rc���tjd�|�����}|r|jj|knd}|r|jj|knd}|r|s
J|���dS)z>Verify the current token is of type `kind` and equals `value`.z�
Unexpected token at line {self.line}:
In file: {self.filename}
Got kind {self.current.kind!r}
Got value {self.current.value}
rTN)r�r�r,r�r�r)rr�r�msg�
kind_valid�value_valids r�
check_currentzParser.check_currents����o�
�
�F��
�
�
�
�
��37�@�T�\�&�$�.�.�D�
�5:�D�d�l�(�E�1�1����.�k�.�.�3�.�.�)�.�.rc��|j�d��|���}|�|��dS)zeParse a 'from x import y' statement.
The purpose is to find __future__ statements.
zparsing from/import statement.N)rr�_parse_from_import_source�_parse_from_import_names�r�is_future_imports rr0z"Parser.parse_from_import_statementsF��
����7�8�8�8��9�9�;�;���%�%�&6�7�7�7�7�7rc���|jjdksJ|jj���|j���|jjdk}|j���|j��|jjt
jt
jt
jfvro|jjdkr_|j���|j�?|jjt
jt
jt
jfvr|jjdk�_|j�|jjdkrdS|� d���|jjdksJ|jj���|j���|S)zuParse the 'from x import' part in a 'from x import y' statement.
Return true iff `x` is __future__.
r,�
__future__N�importFr@)
r�rr
r�r�r��DOTr$r%rJrNs rrLz Parser._parse_from_import_sourcesQ��
�|�!�V�+�+�+�T�\�-?�+�+�+���������<�-��=����������L�$���!�b�f�b�g�r�u�%=�=�=���"�h�.�.��K������
�L�$���!�b�f�b�g�r�u�%=�=�=���"�h�.�.��<��4�<�#5��#A�#A��5������*�*�*��|�!�X�-�-�-�t�|�/A�-�-�-���������rc�b�|jjdkr-|�tj��tjf}ntjtjf}|jj|v�rF|jjtjkr|jjdk�s|jjtjkr|j �
���n|j�d|jj|jj��|rI|j�d|jj��|j
�|jj��|�tj��|j�d|jj|jj��|jjtjkrh|jjdkrX|�tj��|jjtjkr|�tj��|jjdkr|�tj��|j�d|jj|jj��|jj|vr2|jjtjk��|jjdk��dSdSdSdS)z4Parse the 'y' part in a 'from x import y' statement.rK�;z parsing import, token is %r (%s)zfound future import: %s�asr4N)r�rrr�r%r�r5r�r$r
r�rrr��add)rrO�expected_end_kindss rrMzParser._parse_from_import_names3sE���<���$�$��L�L������"$�%����"$�*�b�l�!;���l��'9�9�9��L����&�&�4�<�+=��+D�+D��|� �B�G�+�+��� � �"�"�"���H�N�N�2���!���"�
�
�
�
�
<�����8�$�,�:L�M�M�M��#�'�'���(:�;�;�;��L�L���!�!�!��H�N�N�2���!���"�
�
�
�
�|� �B�G�+�+���0B�d�0J�0J����R�W�%�%�%��<�$���/�/��L�L���)�)�)��|�!�S�(�(����R�U�#�#�#��H�N�N�2���!���"�
�
�
�5�l��'9�9�9��L����&�&�4�<�+=��+D�+D�+D�+D�:�9�+D�+D�:�9rr&)F)NN)rr r!r"rr�r�r�ryrrr r)r/r-rr.r<rJr0rLrMrrrrr�s?������&�&�#�#�#�$+�+�+��h�7�7�8�8�G��8�1�1�2�2�D�M�M�M��������$3
�3
�3
�j#�#�#�#�>B�B�B�H���@L�L�L�\#�#�#�./�/�/�/�$8�8�8� � � �,%�%�%�%�%rr)*r"r�r��tokenizer��ior� itertoolsrr�pathlibrr.r�typingr �utilsrr+r�rr$r2r4r
rrrrrrrr�r�rlr�rr��intrr�rrrr�<module>r`s�����
�
�
�
���������������&�&�&�&�&�&�&�&�������������������������
�� $�$�$�$�$��$�$�$�
�
�
�
�
�:�
�
�
�<�<�<�6�6�6�6�6�6�6�6�:4�4�4�4�4��4�4�4�n8!�8!�8!�8!�8!�Z�8!�8!�8!�v-�-�-�-�-�f�-�-�-�+"�+"�+"�+"�+"�z�+"�+"�+"�\�����X����&�&�&�&�&�X�&�&�&�R�����J����
�
�
�
�
�%�
�
�
�'�'�'�'�'��'�'�'�
�
�
�
�
��
�
�
� =��
�
�
�
�
�y�
�
�
�()�)�)�)�)�)�)�)�X1�1�1�1�1��1�1�1�
/�/�/�/�/�E�/�/�/�v�v�v�v�v�v�v�v�v�vr
?>