From 7f60479b8d80892100f05ca84a8004f4dbb05de1 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Mon, 19 Nov 2018 15:02:31 +0100 Subject: [PATCH] Update to python3 --- .../DDCMS/test/python/UnitsCheck.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/DetectorDescription/DDCMS/test/python/UnitsCheck.py b/DetectorDescription/DDCMS/test/python/UnitsCheck.py index 8f28424c751c8..1d64bff4c7b6d 100644 --- a/DetectorDescription/DDCMS/test/python/UnitsCheck.py +++ b/DetectorDescription/DDCMS/test/python/UnitsCheck.py @@ -6,12 +6,12 @@ def index(line,substr): return result def errorPrint(line,indices): - print(line) + print(line.replace('\t',' ')) ll = len(line) - errstr="_"*ll + errstr=" "*ll for i in indices: - errstr = errstr[:i] + '^' + errstr[i+1:] - print errstr + errstr = errstr[:i] + '^-----' + errstr[i+5:] + print(errstr) def findValuesWithUnits(line,ln): numList = re.findall(r"\d*?[\s,.]?\d*\*\w*", line) @@ -20,7 +20,8 @@ def findValuesWithUnits(line,ln): errindices.append(match.start()) l = len(numList) if l > 0: - print 'Line #',ln,'Units defined: ' + text = fileinput.filename()+': line# '+str(ln)+' units defined: ' + print(text) errorPrint(line,errindices) return l @@ -39,7 +40,12 @@ def findValuesWithoutUnits(line,ln): errindices.append(match.start()) l = len(numList) if l > 0: - print 'Line #', ln, 'WARNING: Numerical values without units: ' + if 'MaterialFraction' in line: + return l + if ' 0 or k > 0: - print ' ' def check(line): return 0;