Your IP : 18.226.180.253


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/multifile.pyo

�
zfc@sedZddlmZededd�[ddgZdefd��YZddd	��YZd
S(s�A readline()-style interface to the parts of a multipart message.

The MultiFile class makes each part of a multipart message "feel" like
an ordinary file, as long as you use fp.readline().  Allows recursive
use, for nested multipart messages.  Probably best used together
with module mimetools.

Suggested use:

real_fp = open(...)
fp = MultiFile(real_fp)

"read some lines from fp"
fp.push(separator)
while 1:
        "read lines from fp until it returns an empty string" (A)
        if not fp.next(): break
fp.pop()
"read remaining lines from fp until it returns an empty string"

The latter sequence may be used recursively at (A).
It is also allowed to use multiple push()...pop() sequences.

If seekable is given as 0, the class code will not do the bookkeeping
it normally attempts in order to make seeks relative to the beginning of the
current file part.  This may be useful when using MultiFile with a non-
seekable stream object.
i����(twarns9the multifile module has been deprecated since Python 2.5t
stacklevelit	MultiFiletErrorcBseZRS((t__name__t
__module__(((s!/usr/lib64/python2.7/multifile.pyR$scBs�eZdZdd�Zd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�ZRS(iicCsU||_g|_d|_d|_|rQd|_|jj�|_g|_ndS(Nii(tfptstacktleveltlasttseekablettelltstarttposstack(tselfRR
((s!/usr/lib64/python2.7/multifile.pyt__init__+s					cCs*|jdkr|jS|jj�|jS(Ni(RtlastposRRR(R((s!/usr/lib64/python2.7/multifile.pyR5scCs�|j�}|re|dkr+||}qe|dkre|jdkrV||j}qbtd�qend|ko||kns�|jdkr�||jkr�td�n|jj||j�d|_d|_dS(Niiiscan't use whence=2 yetsbad MultiFile.seek() call(RRRRRtseekRR	(Rtpostwhencethere((s!/usr/lib64/python2.7/multifile.pyR:s
	cCsC|jdkrdS|jj�}|set|j�|_|jdk|_|jratd�ndS|j|�rx|S|j�}xkt	t
|j��D]P\}}||j|�kr�d|_Pq�||j|�kr�d|_Pq�q�W|S|j
r|j�t|�|_n|d|_|jdkr?td�ndS(Nits"sudden EOF in MultiFile.readline()is)Missing endmarker in MultiFile.readline()(RRtreadlinetlenRR	Rtis_datatrstript	enumeratetreversedtsection_dividert
end_markerR
RR(Rtlinetmarkertitsep((s!/usr/lib64/python2.7/multifile.pyRKs4	"			
cCs4g}x'|j�}|sPn|j|�q	W|S(N(Rtappend(RtlistR((s!/usr/lib64/python2.7/multifile.pyt	readlinespscCsdj|j��S(NR(tjoinR$(R((s!/usr/lib64/python2.7/multifile.pytreadxscCscx|j�rqW|jdks+|jr/dSd|_d|_|jr_|jj�|_ndS(Nii(RRR	R
RRR(R((s!/usr/lib64/python2.7/multifile.pytnext{s			cCs`|jdkrtd�n|jj|�|jr\|jj|j�|jj�|_ndS(Nisbad MultiFile.push() call(	RRRR"R
R
RRR(RR!((s!/usr/lib64/python2.7/multifile.pytpush�s	cCs�|jgkrtd�n|jdkr6d|_n|j|j}td|jd�|_|jj�|jr�|j	j�|_|jdkr�||j|_q�ndS(Nsbad MultiFile.pop() callii(
RRRR	RRtmaxtpopR
R
(Rt
abslastpos((s!/usr/lib64/python2.7/multifile.pyR*�s
	cCs|d dkS(Nis--((RR((s!/usr/lib64/python2.7/multifile.pyR�scCsd|S(Ns--((Rtstr((s!/usr/lib64/python2.7/multifile.pyR�scCsd|dS(Ns--((RR,((s!/usr/lib64/python2.7/multifile.pyR�s(RRR
RRRRR$R&R'R(R*RRR(((s!/usr/lib64/python2.7/multifile.pyR's
		%			
				N((t__doc__twarningsRtDeprecationWarningt__all__t	ExceptionRR(((s!/usr/lib64/python2.7/multifile.pyt<module>s


?>