ok
Direktori : /usr/lib64/python2.7/ |
Current File : //usr/lib64/python2.7/multifile.pyc |
� zfc @ se d Z d d l m 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.7/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 sU | | _ g | _ d | _ d | _ | rQ d | _ | j j � | _ g | _ n d S( Ni i ( t fpt stackt levelt lastt seekablet tellt startt posstack( t selfR R ( ( s! /usr/lib64/python2.7/multifile.pyt __init__+ s c C s* | j d k r | j S| j j � | j S( Ni ( R t lastposR R R ( R ( ( s! /usr/lib64/python2.7/multifile.pyR 5 s c C s� | j � } | re | d k r+ | | } qe | d k re | j d k rV | | j } qb t d � qe n d | k o| | k n s� | j d k r� | | j k r� t d � n | j j | | j � 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.7/multifile.pyR : s c C sX | j d k r d S| j j � } | se t | j � | _ | j d k | _ | j ra t d � n d S| j d k sz t � | j | � r� | S| j � } xk t t | j � � D]P \ } } | | j | � k r� d | _ Pq� | | j | � k r� d | _ Pq� q� W| S| j r,| j � t | � | _ n | d | _ | j d k rTt d � n d S( Ni t s"