Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/testfixtures/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/testfixtures/__pycache__/manuel.cpython-37.pyc

B

R�X��@s�ddlmZddlZddlZddlZddlmZddlmZe�	dej
�Ze�	d�Ze�	d�Z
Gdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZdS)�)�absolute_importN)�Manuel)�diffz^\.\.\s*topic::?\s*(.+)\bz(\n\Z|\n(?=\S))z\s+:class:\s*(read|write)-filec@seZdZdd�ZdS)�	FileBlockcCs||||_|_|_dS)N)�path�content�action)�selfrrr�r
�D/opt/alt/python37/lib/python3.7/site-packages/testfixtures/manuel.py�__init__szFileBlock.__init__N)�__name__�
__module__�__qualname__rr
r
r
rrsrc@seZdZdZdZdZdS)�
FileResultTN)r
rr�passed�expected�actualr
r
r
rrsrc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�Filesa6
    A `Manuel <http://packages.python.org/manuel/>`__ plugin that
    parses certain ReST sections to read and write files in the
    configured :class:`TempDirectory`.

    :param name: This is the name of the :class:`TempDirectory` to use
                 in the Manual global namespace (ie: `globs`).

    cCs(||_tj||jg|jg|jgd�dS)N)�parsersZ
evaluatersZ
formatters)�namerr�parse�evaluate�format)r	rr
r
rr's
zFiles.__init__cCs�x�|�tt�D]�}|j��}t�|d�}|s0qd}||��dkrL|d7}t�	d�
||d�����}|ddkr||d7}t|j
�d�||�d��|_|�|�qWdS)N��z::�
���)Zfind_regions�FILEBLOCK_START�
FILEBLOCK_END�source�
splitlines�CLASS�match�strip�textwrap�dedent�join�lstriprZstart_match�group�parsedZclaim_region)r	�document�region�lines�class_�indexr r
r
rr.s 

zFiles.parsecCs�t|jt�sdS|j}||j}t�}|_|jdkrt|�|jd��	t
jd�}||jkrtd|_
|j|_|j|_||_|jdkr�|�|j|jd�dS)N�read�asciirF�write)�
isinstancer*rrr�	evaluatedrr0r�replace�os�lineseprrrrr2)r	r,r+Zglobs�block�dir�resultrr
r
rrAs



zFiles.evaluatecCsPxJ|D]B}|j}t|t�sq|jst|j|jd|j|jfd|j	�|_
qWdS)NzFile "%s", line %i:zReading from "%s":)r4r3rrrrr�location�linenor�	formatted)r	r+r,r:r
r
rrQs

zFiles.formatN)r
rr�__doc__rrrrr
r
r
rrs
	r)�
__future__rr6�rer%�manuelr�testfixturesr�compile�	MULTILINErrr"�objectrrrr
r
r
r�<module>s