[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Add a line by line parser



commit 74f25eccd2153bd63eff338fff19721dc1488b5c
Author: Arturo Filastò <hellais@xxxxxxxxx>
Date:   Wed Mar 14 23:20:43 2012 -0700

    Add a line by line parser
---
 plugoo/assets.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/plugoo/assets.py b/plugoo/assets.py
index 6f566fe..2d1e6d1 100644
--- a/plugoo/assets.py
+++ b/plugoo/assets.py
@@ -26,6 +26,13 @@ class Asset:
         self.fh.seek(0)
         return i + 1
 
+    def parse_line(self, line):
+        """
+        Override this method if you need line
+        by line parsing of an Asset.
+        """
+        return line.replace('\n','')
+
     def next_asset(self):
         """
         Return the next asset.
@@ -34,7 +41,7 @@ class Asset:
         #     clean me up please...
         line = self.fh.readline()
         if line:
-            return line.replace('\n','')
+            return self.parse_line(line)
         else:
             self.fh.seek(0)
             raise StopIteration



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits