[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 91e0bbf22cf60173e31add4f61ce1e628325105d
Author: Arturo Filastò <hellais@xxxxxxxxx>
Date:   Wed Mar 14 23:26:56 2012 -0700

    Add a method for line by line asset parsing
    (I think I did a mess with git and may
    have made noise on tor-commits...)
---
 plugoo/assets.py |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/plugoo/assets.py b/plugoo/assets.py
index 6f566fe..5ed0399 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,13 @@ class Asset:
         #     clean me up please...
         line = self.fh.readline()
         if line:
-            return line.replace('\n','')
+<<<<<<< HEAD
+            parsed_line = self.parse_line(line)
+            if parsed_line:
+                return parsed_line
+=======
+            return self.parse_line(line)
+>>>>>>> 74f25ec... Add a line by line parser
         else:
             self.fh.seek(0)
             raise StopIteration



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