From 9f569d04c6fa6ed5de10712c9b27e89f5fee3c29 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 19 May 2015 20:35:56 +0000 Subject: [PATCH] =?UTF-8?q?added=20=E2=80=9C.close()=E2=80=9D=20method=20t?= =?UTF-8?q?o=20close=20input=20and=20output=20at=20the=20same=20time.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit accept header only if space present between number and “head” string. --- lib/damask/asciitable.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/damask/asciitable.py b/lib/damask/asciitable.py index 7cb75846b..4907bb8dd 100644 --- a/lib/damask/asciitable.py +++ b/lib/damask/asciitable.py @@ -43,6 +43,10 @@ class ASCIItable(): except: return 0.0 +# ------------------------------------------------------------------ + def close(self): + return self.input_close() and self.output_close() + # ------------------------------------------------------------------ def input_close(self): return self.__IO__['in'].close() @@ -93,7 +97,7 @@ class ASCIItable(): except: pass firstline = self.__IO__['in'].readline() - m = re.search('(\d+)\s*head', firstline.lower()) + m = re.search('(\d+)\s+head', firstline.lower()) if self.__IO__['labels']: # table features labels if m: # found header info self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))]