AlkantarClanX12
Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/testfixtures/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/testfixtures/__pycache__/sybil.cpython-311.pyc |
� �܋f � �� � d dl Z d dlZd dlZd dlmZmZmZ d dlmZ ej dej � � Z ej d� � Z ej d� � Z G d� de� � Z G d � d e� � ZdS )� N)�Region�Example�Document)�diffz^\.\.\s*topic::?\s*(.+)\bz(\n\Z|\n(?=\S))z\s+:class:\s*(read|write)-filec � � e Zd Zd� ZdS )� FileBlockc �2 � |||c| _ | _ | _ d S �N��path�content�action)�selfr r r s �c/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/testfixtures/sybil.py�__init__zFileBlock.__init__ s � �/3�W�f�,�� �4�<����� N)�__name__� __module__�__qualname__r � r r r r s( � � � � � �E� E� E� E� Er r c �6 � e Zd ZdZdefd�Zdefd�Zdefd�Z dS ) � FileParsera9 A `Sybil <http://sybil.readthedocs.io>`__ parser that parses certain ReST sections to read and write files in the configured :class:`~testfixtures.TempDirectory`. :param name: This is the name of the :class:`~testfixtures.TempDirectory` to use in the Sybil test namespace. �namec � � || _ d S r )r )r r s r r zFileParser.__init__ s � ��� � � r �documentc # � K � |� t t � � D �]*\ }}}|� � � }t � |d � � }|s�>d}|| � � � dk r|dz }t j d� ||d � � � � � � � � }|d dk r|dz }t |� d� � ||� d� � �� � }t |� � � |� � � || j � � V � ��,d S )N� � z::� ���r )�find_region_sources�FILEBLOCK_START� FILEBLOCK_END� splitlines�CLASS�match�strip�textwrap�dedent�join�lstripr �groupr �start�end�evaluate) r r �start_match� end_match�source�lines�class_�index�parseds r �__call__zFileParser.__call__ sX � � � �.6�.J�.J��]�/ � / � � �*�K��F� �%�%�'�'�E��[�[��q��*�*�F�� ���E��U�|�!�!�#�#�t�+�+��� ���_�T�Y�Y�u�U�V�V�}�%=�%=�>�>�E�E�G�G�F��b�z�T�!�!��$���� �&�&�q�)�)���|�|�A���� � �F� ��!�!�#�#�� � ����� � � � � � � �) � r �examplec � � |j }|j | j }|j dk r�|� |j d� � � t j d� � }||j k rAt |j |d|j |j fz d|� |j � � z � � S |j dk r#|� |j |j d� � d S d S )N�read�asciir zFile %r, line %i:zReading from "%s":�write)r6 � namespacer r r: r �replace�os�linesepr r �line� as_stringr<