multifile
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multifile.py
Module Docs

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.

 
Classes
       
exceptions.Exception(exceptions.BaseException)
Error
MultiFile

 
class Error(exceptions.Exception)
    
Method resolution order:
Error
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class MultiFile
     Methods defined here:
__init__(self, fp, seekable=1)
end_marker(self, str)
is_data(self, line)
next(self)
pop(self)
push(self, sep)
read(self)
readline(self)
readlines(self)
section_divider(self, str)
seek(self, pos, whence=0)
tell(self)

Data and other attributes defined here:
seekable = 0

 
Data
        __all__ = ['MultiFile', 'Error']