ok

Mini Shell

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

�

�܋f����ddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
	ddlmZddlZdZn
#e$rdZYnwxYwGd�d	e��ZdS)
�)�StringION)�	Directive)�Bail�
Diagnostic�Plan�Result�Unknown�Version)�peekableTFc��eZdZdZdZejdezej��Zejdezej��Z	ejdej��Z
ejd��Zejdej��Zejd��Z
ejd	��Zejd
��ZdZd�Zd
�Zd�Zd�Zdd�Zd�Zdd�Zd�Zd�ZdS)�Parserz!A parser for TAP files and lines.a�
        \s*                    # Optional whitespace.
        (?P<number>\d*)        # Optional test number.
        \s*                    # Optional whitespace.
        (?P<description>[^#]*) # Optional description before #.
        \#?                    # Optional directive marker.
        \s*                    # Optional whitespace.
        (?P<directive>.*)      # Optional directive text.
    z^okz^not\ oka~
        ^1..(?P<expected>\d+) # Match the plan details.
        [^#]*                 # Consume any non-hash character to confirm only
                              # directives appear with the plan details.
        \#?                   # Optional directive marker.
        \s*                   # Optional whitespace.
        (?P<directive>.*)     # Optional directive text.
    z^#zq
        ^Bail\ out!
        \s*            # Optional whitespace.
        (?P<reason>.*) # Optional reason.
    z^TAP version (?P<version>\d+)$z^(?P<indent>\s+)-z
^\s+\.\.\.�
c�H�|�t|d����S)z�Parse a TAP file to an iterable of tap.line.Line objects.

        This is a generator method that will yield an object for each
        parsed line. The file given by `filename` is assumed to exist.
        �r)�parse�open)�self�filenames  �[/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/tap/parser.py�
parse_filezParser.parse_file<s ���z�z�$�x��-�-�.�.�.�c�@�|�tj��S)z�Parse a TAP stream from standard input.

        Note: this has the side effect of closing the standard input
        filehandle after parsing.
        )r�sys�stdin)rs r�parse_stdinzParser.parse_stdinDs���z�z�#�)�$�$�$rc�F�|�t|����S)z:Parse a string containing one or more lines of TAP output.)rr)r�texts  r�
parse_textzParser.parse_textLs���z�z�(�4�.�.�)�)�)rc#�K�|5	t|��}n#t$rYddd��dSwxYw|�|�����}t	j|g|��}|jdkrE|jdkr:tr$tt	j|g|����}ntd��|D],}|�|���|��V��-	ddd��dS#1swxYwYdS)awGenerate tap.line.Line objects, given a file-like object `fh`.

        `fh` may be any object that implements both the iterator and
        context management protocol (i.e. it can be used in both a
        "with" statement and a "for...in" statement.)

        Trailing whitespace and newline characters will be automatically
        stripped from the input lines.
        N�versionrz�
WARNING: Optional imports not found, TAP 13 output will be
    ignored. To parse yaml, see requirements in docs:
    https://tappy.readthedocs.io/en/latest/consumers.html#tap-version-13)�next�
StopIteration�
parse_line�rstrip�	itertools�chain�categoryr �ENABLE_VERSION_13r�print)r�fh�
first_line�first_parsed�fh_new�lines      rrzParser.parsePs������	=�	=�
�!�"�X�X�
�
�� �
�
�
��		=�	=�	=�	=�	=�	=�	=�	=�
�����?�?�:�+<�+<�+>�+>�?�?�L��_�j�\�2�6�6�F��$�	�1�1�l�6J�b�6P�6P�$��%�i�o�z�l�B�&G�&G�H�H�F�F��L�����
=�
=���o�o�d�k�k�m�m�V�<�<�<�<�<�<�
=�%	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=�	=�	=s-�C=��C=�
0�C=�0�B?C=�=D�DNc�|�|j�|��}|r|�d||��S|j�|��}|r|�d||��S|j�|��rt|��S|j�|��}|r|�|��S|j�|��}|r"t|�
d����S|j�|��}|r|�|��St��S)z3Parse a line into whatever TAP category it belongs.TF�reason)�ok�match�
_parse_result�not_ok�
diagnosticr�plan�_parse_plan�bailr�groupr �_parse_versionr	)rrr*r2s    rr#zParser.parse_lineos/����
�
�d�#�#���	7��%�%�d�E�2�6�6�6���!�!�$�'�'���	8��%�%�e�U�B�7�7�7��?� � ��&�&�	$��d�#�#�#��	����%�%���	+��#�#�E�*�*�*��	����%�%���	/�����H�-�-�.�.�.���"�"�4�(�(���	.��&�&�u�-�-�-��y�y�rc���t|�d����}t|�d����}|jr|jst��St
||��S)zParse a matching plan line.�expected�	directive)�intr9rr�skipr	r)rr2�expected_testsr=s    rr7zParser._parse_plan�sc���U�[�[��4�4�5�5���e�k�k�+�6�6�7�7�	��>�	�)�.�	��9�9���N�I�.�.�.rc
���d}	|�HtrAt|t��r,|j�|�����}n#t$rYnwxYw|�kt||�d��|�d���	��t|�d�������S|�d��}|�||��}t||�d��|�d���	��t|�d����|���S)z4Parse a matching result line into a result instance.N�number�descriptionr=)rBrCr=�indent)rBrCr=�raw_yaml_block)r(�
isinstancer�yaml_block_startr2�peekr"rr9�stripr�_extract_yaml_block)rr1r2r*�
peek_matchrD�concat_yamls       rr3zParser._parse_result�sL���
�	��~�"3�~�
�2�x�8P�8P�~�!�2�8�8������C�C�
����	�	�	��D�	���������{�{�8�,�,�!�K�K�
�6�6�<�<�>�>�#�E�K�K��$<�$<�=�=�	���
��!�!�(�+�+���.�.�v�r�:�:�����;�;�x�(�(����M�2�2�8�8�:�:�����K� 8� 8�9�9�&�
�
�
�	
s�A
A�
A�Ac�l�g}tjd�|����}	t|��|�|�����r�t|���|dd��}|�|�d����|j	�|�����rt|��n'|�|�������n#t$rYnwxYwd�|��S)z,Extract a raw yaml block from a file handlerz^{}���
)�re�compile�formatr!r2rH�replace�appendr$�yaml_block_endr"�join)rrDr*�raw_yaml�indent_match�	yaml_lines      rrJzParser._extract_yaml_block�s�����z�&�-�-��"7�"7�8�8��
	���H�H�H��$�$�R�W�W�Y�Y�/�/�
� ��H�H�,�,�V�R��;�;�	����	� 0� 0�� 6� 6�7�7�7��&�,�,�R�W�W�Y�Y�7�7����H�H�H��
�$�$�R�W�W�Y�Y�/�/�
����	�	�	��D�	�����y�y��"�"�"s�C%D�
D�Dc��t|�d����}||jkrtd���t	|��S)Nr z?It is an error to explicitly specify any version lower than 13.)r>r9�TAP_MINIMUM_DECLARED_VERSION�
ValueErrorr
)rr2r s   rr:zParser._parse_version�sN���e�k�k�)�,�,�-�-���T�6�6�6��Q���
��w���r)N)�__name__�
__module__�__qualname__�__doc__�result_baserQrR�VERBOSEr1r4r6r5r8r rGrVr\rrrrr#r7r3rJr:�rrr
r
sw������+�+��K�
���F�[�(�"�*�	5�	5�B�
�R�Z��k�1�2�:�
>�
>�F��2�:�	�	�
�
�
�D����E�"�"�J��2�:�	�
	�
�
��D��b�j�:�;�;�G�!�r�z�"6�7�7���R�Z�
�.�.�N�#%� �/�/�/�%�%�%�*�*�*�=�=�=�>����6	/�	/�	/�
�
�
�
�2#�#�#�" � � � � rr
)�iorr%rQr�
tap.directiver�tap.linerrrrr	r
�more_itertoolsr�yamlr(�ImportError�objectr
rdrr�<module>rls������������	�	�	�	�
�
�
�
�#�#�#�#�#�#�E�E�E�E�E�E�E�E�E�E�E�E�E�E�E�E��'�'�'�'�'�'��K�K�K�����������������s �s �s �s �s �V�s �s �s �s �s s�7�A�A

Zerion Mini Shell 1.0