relocated “croak” and “report” functionality to here. needs to be altered in all scripts that still use the ASCIItable class for those…

This commit is contained in:
Philip Eisenlohr 2015-09-22 21:00:18 +00:00
parent b528088653
commit 2aa1073949
1 changed files with 15 additions and 0 deletions

View File

@ -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):
# -----------------------------