Ñò
§ÚêLc @ se d Z d d k l Z e d e d d ƒ[ d d g Z d e f d „ ƒ YZ d d d „ ƒ YZ d
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ÿÿÿÿ( t warns9 the multifile module has been deprecated since Python 2.5t
stackleveli t MultiFilet Errorc B s e Z RS( ( t __name__t
__module__( ( ( s! /usr/lib64/python2.6/multifile.pyR $ s c B s€ e Z d Z d d „ Z d „ Z d d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
d
„ Z d „ Z d „ Z
d
„ Z RS( i i c C sW | | _ g | _ d | _ d | _ | o( d | _ | i i ƒ | _ g | _ n d S( Ni i ( t fpt stackt levelt lastt seekablet tellt startt posstack( t selfR R
( ( s! /usr/lib64/python2.6/multifile.pyt __init__+ s c C s, | i d j o | i S| i i ƒ | i S( Ni ( R t lastposR R R ( R ( ( s! /usr/lib64/python2.6/multifile.pyR 5 s c C sæ | i ƒ } | oZ | d j o | | } qm | d j o. | i d j o | | i } qi t d ‚ qm n d | j o
| j n p | i d j o | | i j o
t d ‚ n | i i | | i ƒ d | _ d | _ d S( Ni i i s can't use whence=2 yets bad MultiFile.seek() call( R R R R R t seekR R ( R t post whencet here( ( s! /usr/lib64/python2.6/multifile.pyR : s
c C sj | i d j o d S| i i ƒ } | p@ t | i ƒ | _ | i d j | _ | i o
t d ‚ n d S| i d j p t ‚ | i | ƒ o | S| i ƒ } xo t
t | i ƒ ƒ D]T \ } } | | i | ƒ j o d | _ Pq¹ | | i
| ƒ j o d | _ Pq¹ q¹ W| S| i o | i ƒ t | ƒ | _ n | d | _ | i d j o
t d ‚ n d S( Ni t s" sudden EOF in MultiFile.readline()i s) Missing endmarker in MultiFile.readline()( R R t readlinet lenR R R t AssertionErrort is_datat rstript enumeratet reversedt section_dividert
end_markerR
R R ( R t linet markert it sep( ( s! /usr/lib64/python2.6/multifile.pyR K s8
c C s5 g } x( | i ƒ } | p Pn | i | ƒ q | S( N( R t append( R t listR ( ( s! /usr/lib64/python2.6/multifile.pyt readlinesp s c C s d i | i ƒ ƒ S( NR ( t joinR% ( R ( ( s! /usr/lib64/python2.6/multifile.pyt readx s c C sj x | i ƒ o q W| i d j p
| i o d Sd | _ d | _ | i o | i i ƒ | _ n d S( Ni i ( R R R R
R R R ( R ( ( s! /usr/lib64/python2.6/multifile.pyt next{ s
c C sd | i d j o
t d ‚ n | i i | ƒ | i o) | i i | i ƒ | i i ƒ | _ n d S( Ni s bad MultiFile.push() call( R R R R# R
R
R R R ( R R" ( ( s! /usr/lib64/python2.6/multifile.pyt push… s
c C s¸ | i g j o
t d ‚ n | i d j o
d | _ n | i | i } t d | i d ƒ | _ | i i ƒ | i o: | i i ƒ | _ | i d j o | | i | _ q´ n d S( Ns bad MultiFile.pop() calli i (
R R R R R R t maxt popR
R
( R t
abslastpos( ( s! /usr/lib64/python2.6/multifile.pyR+ s
c C s | d d j S( Ni s --( ( R R ( ( s! /usr/lib64/python2.6/multifile.pyR › s c C s d | S( Ns --( ( R t str( ( s! /usr/lib64/python2.6/multifile.pyR ž s c C s d | d S( Ns --( ( R R- ( ( s! /usr/lib64/python2.6/multifile.pyR ¡ s ( R R R
R R R R R% R' R( R) R+ R R R ( ( ( s! /usr/lib64/python2.6/multifile.pyR ' s
%
N( ( t __doc__t warningsR t DeprecationWarningt __all__t ExceptionR R ( ( ( s! /usr/lib64/python2.6/multifile.pyt