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

[tor-commits] [ooni-probe/master] Add a method for line by line asset parsing



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

    Add a method for line by line asset parsing
---
 plugoo/assets.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/plugoo/assets.py b/plugoo/assets.py
index 6f566fe..eded997 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,9 @@ class Asset:
         #     clean me up please...
         line = self.fh.readline()
         if line:
-            return line.replace('\n','')
+            parsed_line = self.parse_line(line)
+            if parsed_line:
+                return parsed_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