cleaned up CircularBuffer
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 12 Jan 2016 11:17:18 +0000 (12:17 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 12 Jan 2016 11:17:18 +0000 (12:17 +0100)
buffers.py

index ed45b61..96e065d 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
 # The software in this package is distributed under the GNU General
 # Public License version 2 (with a special exception described below).
 #
 # on this file might be covered by the GNU General Public License.
 
 """
-OutputBuffer: classes to buffer line-based output
+buffers.py: buffers of various shapes, sizes and functionalities
+
+Featuring::
+
+* CircularBuffer
+* LogBuffer (saves one of the 2 last items, one of the 4 last items, ..
+             of the 8 last, 16 last, ...
 
 .. codeauthor:: Christian Herdtweck, christian.herdtweck@intra2net.com
 """
 
-class OutputLineBuffer:
+class CircularBuffer:
     """ circular buffer for text lines; saves last N lines
     
     can output them afterwards in correct order
@@ -58,32 +62,3 @@ class OutputLineBuffer:
 
         for idx in range(0, self._buff_idx):
             output_func(self._buffer[idx])
-
-
-def main():
-    """ Main function, called when running file as script
-
-    currently raises a NotImplementedError
-    """
-    raise NotImplementedError
-
-    line_buffer = OutputLineBuffer(3)
-    for output_line in proc.stdout:
-        progress_reporter.inc_current_points()
-        line_buffer.add(output_line)
-
-    proc.stdout.close()
-    return_code = proc.wait()
-
-    if return_code != 0:
-        self.logger.warning('extraction returned {0}!'.format(return_code))
-        self.logger.warning('command was: {0}'.format(' '.join(cpio)))
-        self.logger.warning('last {0} output lines:'.format(
-            min(line_buffer.buffer_size, line_buffer.n_lines)))
-        line_buffer.output(self.logger.warning)
-
-# end: function main
-
-
-if __name__ == '__main__':
-    main()