Your IP : 18.118.33.130


Current Path : /opt/alt/python35/lib64/python3.5/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/__pycache__/text_file.cpython-35.opt-2.pyc



���]�0�@s;ddlZddlZddlZGdd�d�ZdS)�Nc@s�eZdZddddddddddddd	d
iZdddd
�Zdd�Zdd�Zddd�Zddd�Zddd�Z	dd�Z
dd�Zdd�ZdS)�TextFile�strip_comments��skip_blanks�	lstrip_wsr�	rstrip_ws�
join_lines�
collapse_join�errors�strictNcKs�|dkr$|dkr$td��xQ|jj�D]@}||kr]t||||�q4t|||j|�q4Wx3|j�D]%}||jkr�td|��q�W|dkr�|j|�n||_||_d|_g|_	dS)Nz7you must supply either or both of 'filename' and 'file'zinvalid TextFile option '%s'r)
�RuntimeError�default_options�keys�setattr�KeyError�open�filename�file�current_line�linebuf)�selfrr�options�opt�r�./opt/alt/python35/lib64/python3.5/text_file.py�__init__Ns			zTextFile.__init__cCs7||_tj|jdd|j�|_d|_dS)N�rr
r)r�iorr
rr)rrrrrros	!z
TextFile.opencCs2|j}d|_d|_d|_|j�dS)N)rrr�close)rrrrrrvs
				zTextFile.closecCs�g}|dkr|j}|j|jd�t|ttf�r^|jdt|��n|jd|�|jt|��dj|�S)Nz, z
lines %d-%d: z	line %d: �)r�appendr�
isinstance�list�tuple�str�join)r�msg�lineZoutmsgrrr�	gen_errors	zTextFile.gen_errorcCs td|j||���dS)Nzerror: )�
ValueErrorr()rr&r'rrr�error�szTextFile.errorcCs(tjjd|j||�d�dS)Nz	warning: �
)�sys�stderr�writer()rr&r'rrr�warn�sz
TextFile.warncCs�|jr$|jd}|jd=|Sd}xu|jj�}|dkrNd}|jr�|r�|jd�}|d
kr{nz|dks�||ddkr�|ddkr�dp�d}|d|�|}|j�dkr�q-n|jdd�}|jr�|r�|dkr!|jd�|S|j	r6|j
�}||}t|jt
�rm|jdd|jd<q�|j|jdg|_nI|dkr�dSt|jt
�r�|jdd|_n|jd|_|jr�|jr�|j�}n-|jr|j
�}n|jr |j�}|dks8|dkrD|jrDq-|jr�|ddkrp|dd�}q-|dd�d
kr�|dd�d}q-|SWdS)Nrr�#r�\r+z\#z2continuation line immediately precedes end-of-file�z\
���r3r3r3r3r3���r4)rr�readliner�find�strip�replacerr/r	�lstripr!rr"rr�rstripr)rr'Zbuildup_line�posZeolrrrr5�sf	


 	
	
		!	zTextFile.readlinecCs:g}x-|j�}|dkr%|S|j|�q	WdS)N)r5r )r�linesr'rrr�	readlinesszTextFile.readlinescCs|jj|�dS)N)rr )rr'rrr�
unreadlineszTextFile.unreadline)
�__name__�
__module__�__qualname__r
rrrr(r*r/r5r=r>rrrrr
s ;!	
x
r)r,�osrrrrrr�<module>s$

?>