From 2aa1073949784e341448a90bc9a75d326b115741 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 22 Sep 2015 21:00:18 +0000 Subject: [PATCH] =?UTF-8?q?relocated=20=E2=80=9Ccroak=E2=80=9D=20and=20?= =?UTF-8?q?=E2=80=9Creport=E2=80=9D=20functionality=20to=20here.=20needs?= =?UTF-8?q?=20to=20be=20altered=20in=20all=20scripts=20that=20still=20use?= =?UTF-8?q?=20the=20ASCIItable=20class=20for=20those=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/damask/util.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/damask/util.py b/lib/damask/util.py index f465a6d5b..a6bbdf932 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -5,6 +5,21 @@ import sys,time,random,threading import numpy as np from optparse import OptionParser, Option +# ----------------------------- +def croak(self, + what, + newline = True): +# ----------------------------- + sys.stderr.write(('\n'.join(map(str,what)) if not hasattr(what, "strip") + and hasattr(what, "__getitem__") + or hasattr(what, "__iter__") else str(what)) + +('\n' if newline else '')) + +# ----------------------------- +def report(who,what): +# ----------------------------- + croak( ('\033[1m'+str(who)+'\033[0m' if who else '') + (': '+what if what else '') ) + # ----------------------------- def emph(what): # -----------------------------