Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.support.werkzeug.contrib.iterio.IterI Class Reference
Inheritance diagram for MoinMoin.support.werkzeug.contrib.iterio.IterI:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.werkzeug.contrib.iterio.IterI:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __new__
def __init__
def close
def write
def writelines
def flush
def __iter__
def tell
def isatty
def seek
def truncate
def read
def readlines
def readline
def next

Public Attributes

 closed
 pos

Private Attributes

 _parent
 _buffer

Detailed Description

Convert an stream into an iterator.

Definition at line 123 of file iterio.py.


Constructor & Destructor Documentation

Definition at line 143 of file iterio.py.

00143 
00144     def __init__(self, parent):
00145         self._parent = parent
00146         self._buffer = []
00147         self.closed = False
00148         self.pos = 0


Member Function Documentation

Reimplemented in MoinMoin.support.werkzeug.contrib.iterio.IterO.

Definition at line 61 of file iterio.py.

00061 
00062     def __iter__(self):
00063         return self

Reimplemented from MoinMoin.support.werkzeug.contrib.iterio.IterIO.

Definition at line 126 of file iterio.py.

00126 
00127     def __new__(cls, func):
00128         if greenlet is None:
00129             raise RuntimeError('IterI requires greenlet support')
00130         stream = object.__new__(cls)
00131         stream.__init__(greenlet.getcurrent())
00132 
00133         def run():
00134             func(stream)
00135             stream.flush()
00136 
00137         g = greenlet(run, stream._parent)
00138         while 1:
00139             rv = g.switch()
00140             if not rv:
00141                 return
00142             yield rv[0]

Here is the call graph for this function:

Definition at line 149 of file iterio.py.

00149 
00150     def close(self):
00151         if not self.closed:
00152             self.closed = True

Here is the caller graph for this function:

Reimplemented from MoinMoin.support.werkzeug.contrib.iterio.IterIO.

Definition at line 162 of file iterio.py.

00162 
00163     def flush(self):
00164         if self.closed:
00165             raise ValueError('I/O operation on closed file')
00166         data = ''.join(self._buffer)
00167         self._buffer = []
00168         self._parent.switch((data,))
00169 

Here is the caller graph for this function:

Definition at line 69 of file iterio.py.

00069 
00070     def isatty(self):
00071         if self.closed:
00072             raise ValueError('I/O operation on closed file')
00073         return False

Definition at line 114 of file iterio.py.

00114 
00115     def next(self):
00116         if self.closed:
00117             raise StopIteration()
00118         line = self.readline()
00119         if not line:
00120             raise StopIteration()
00121         return line
00122 

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.contrib.iterio.IterIO.read (   self,
  n = -1 
) [inherited]

Reimplemented in MoinMoin.support.werkzeug.contrib.iterio.IterO.

Definition at line 94 of file iterio.py.

00094 
00095     def read(self, n=-1):
00096         if self.closed:
00097             raise ValueError('I/O operation on closed file')
00098         raise IOError(9, 'Bad file descriptor')

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.contrib.iterio.IterIO.readline (   self,
  length = None 
) [inherited]

Reimplemented in MoinMoin.support.werkzeug.contrib.iterio.IterO.

Definition at line 104 of file iterio.py.

00104 
00105     def readline(self, length=None):
00106         if self.closed:
00107             raise ValueError('I/O operation on closed file')
00108         raise IOError(9, 'Bad file descriptor')

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.contrib.iterio.IterIO.readlines (   self,
  sizehint = 0 
) [inherited]

Reimplemented in MoinMoin.support.werkzeug.contrib.iterio.IterO.

Definition at line 99 of file iterio.py.

00099 
00100     def readlines(self, sizehint=0):
00101         if self.closed:
00102             raise ValueError('I/O operation on closed file')
00103         raise IOError(9, 'Bad file descriptor')

def MoinMoin.support.werkzeug.contrib.iterio.IterIO.seek (   self,
  pos,
  mode = 0 
) [inherited]

Reimplemented in MoinMoin.support.werkzeug.contrib.iterio.IterO.

Definition at line 74 of file iterio.py.

00074 
00075     def seek(self, pos, mode=0):
00076         if self.closed:
00077             raise ValueError('I/O operation on closed file')
00078         raise IOError(9, 'Bad file descriptor')

Definition at line 64 of file iterio.py.

00064 
00065     def tell(self):
00066         if self.closed:
00067             raise ValueError('I/O operation on closed file')
00068         return self.pos

def MoinMoin.support.werkzeug.contrib.iterio.IterIO.truncate (   self,
  size = None 
) [inherited]

Definition at line 79 of file iterio.py.

00079 
00080     def truncate(self, size=None):
00081         if self.closed:
00082             raise ValueError('I/O operation on closed file')
00083         raise IOError(9, 'Bad file descriptor')

Reimplemented from MoinMoin.support.werkzeug.contrib.iterio.IterIO.

Definition at line 153 of file iterio.py.

00153 
00154     def write(self, s):
00155         if self.closed:
00156             raise ValueError('I/O operation on closed file')
00157         self.pos += len(s)
00158         self._buffer.append(s)

Here is the caller graph for this function:

Reimplemented from MoinMoin.support.werkzeug.contrib.iterio.IterIO.

Definition at line 159 of file iterio.py.

00159 
00160     def writelines(self, list):
00161         self.write(''.join(list))


Member Data Documentation

Definition at line 145 of file iterio.py.

Definition at line 144 of file iterio.py.

Definition at line 146 of file iterio.py.

Definition at line 147 of file iterio.py.


The documentation for this class was generated from the following file: