Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/multifile.pyc
mò ‚=5Dc @ s? d Z d d g Z d e f d „ ƒ YZ d f 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. t MultiFilet Errorc B s t Z RS( N( t __name__t __module__( ( ( t /usr/lib/python2.4/multifile.pyR s c B s€ t 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( Ni i c C sW | | _ g | _ d | _ d | _ | o( d | _ | i i ƒ | _ g | _ n d S( Ni i ( t fpt selft stackt levelt lastt seekablet tellt startt posstack( R R R ( ( R t __init__' s c C s/ | i d j o | i Sn | i i ƒ | i S( Ni ( R R t lastposR R R ( R ( ( R R 1 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 t heret whencet posR R R R t seekR R ( R R R R ( ( R R 6 s ? c C ss | i d j o d Sn | i i ƒ } | pC t | i ƒ | _ | i d j | _ | i o t d ‚ n d Sn | i d j p t ‚ | i | ƒ o | Sn | 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"