From aa201fd2fee16ce4ce25e82a9e5cedec5e6e8a83 Mon Sep 17 00:00:00 2001
From: Andreas Freise <adf@star.bham.ac.uk>
Date: Thu, 9 Jan 2014 00:21:49 +0000
Subject: [PATCH] adding a removeLine method to kat, to allow me to remove
 wrong code lines that were not parsed into an object but have been added as
 extra lines. This works for me, but we could do something more sophisticated
 if needed.

---
 pykat/finesse.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/pykat/finesse.py b/pykat/finesse.py
index 0e44643..c6bec39 100644
--- a/pykat/finesse.py
+++ b/pykat/finesse.py
@@ -605,7 +605,16 @@ class kat(object):
                 y = data[1:cols].squeeze()
             
             return [x, y, hdr]
-            
+
+    def removeLine(self, fragment) :
+        for key in self.__blocks:
+            objs = self.__blocks[key].contents
+            for obj in objs:
+                if isinstance(obj, str):
+                    if fragment in obj:
+                        print "  ** removing line '{0}'".format(obj)
+                        objs.remove(obj)
+                
     def generateKatScript(self) :
         """ Generates the kat file which can then be run """
         
-- 
GitLab