@@ -26,7 +26,7 @@ def get_processor_info():
26
26
elif platform .system () == "Darwin" :
27
27
return subprocess .check_output (['/usr/sbin/sysctl' , "-n" , "machdep.cpu.brand_string" ]).strip ().decode ('utf-8' )
28
28
elif platform .system () == "Linux" :
29
- command = "cat /proc/cpuinfo | grep model\ name | uniq | cut -f2 -d:"
29
+ command = r "cat /proc/cpuinfo | grep model\ name | uniq | cut -f2 -d:"
30
30
return subprocess .check_output (command , shell = True ).strip ().decode ('utf-8' )
31
31
32
32
return ""
@@ -38,7 +38,7 @@ def get_processor_info():
38
38
def create_instr_test_objs (sourcefile , localfile , header ):
39
39
''' returns a list containing one initialized test object pr %Example within the instr file '''
40
40
tests = []
41
- ms = re .findall ("\%Example:([^\n ]*)Detector\:([^\n ]*)_I=([0-9.+-e]+)" , header )
41
+ ms = re .findall (r "\%Example:([^\n]*)Detector\:([^\n]*)_I=([0-9.+-e]+)" , header )
42
42
if len (ms ) > 0 :
43
43
testnb = 1
44
44
for m in ms :
@@ -122,16 +122,16 @@ def _monitorname_filename_match(dfolder, monname):
122
122
look_for_filename = False
123
123
lns = open (join (dfolder , "mccode.sim" )).read ().splitlines ()
124
124
for l in lns :
125
- if re .match (" component: %s$" % monname , l ):
125
+ if re .match (r " component: %s$" % monname , l ):
126
126
# flag this data section
127
127
look_for_filename = True
128
128
if look_for_filename :
129
- m = re .match ("\s*filename:\s+(.+)" , l )
129
+ m = re .match (r "\s*filename:\s+(.+)" , l )
130
130
if m :
131
131
filename = m .group (1 )
132
132
if os .path .isfile (join (dfolder ,filename )):
133
133
return filename
134
- if re .match ("end data" , l ):
134
+ if re .match (r "end data" , l ):
135
135
# the filename can for 0D monitors be monname.dat
136
136
zeroDfilename = join (dfolder , monname + ".dat" )
137
137
if os .path .isfile (zeroDfilename ):
@@ -155,7 +155,7 @@ def extract_testvals(datafolder, monitorname):
155
155
l = fp .readline ()
156
156
if not l :
157
157
break
158
- m = re .match ("# values: ([0-9+-e.]+) ([0-9+-e.]+) ([0-9]+)" , l )
158
+ m = re .match (r "# values: ([0-9+-e.]+) ([0-9+-e.]+) ([0-9]+)" , l )
159
159
if m :
160
160
I = float (m .group (1 ))
161
161
I_err = float (m .group (2 ))
@@ -325,7 +325,7 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, version=
325
325
else :
326
326
metalog = LineLogger ()
327
327
resfile = join (testdir ,test .instrname ,"run_stdout_%d.txt" % (test .testnb ))
328
- cmd = "grep %s_I= %s | head -1 | cut -f2- -d= | cut -f1 -d\ " % (test .detector , resfile )
328
+ cmd = r "grep %s_I= %s | head -1 | cut -f2- -d= | cut -f1 -d\ " % (test .detector , resfile )
329
329
utils .run_subtool_to_completion (cmd , stdout_cb = metalog .logline )
330
330
try :
331
331
test .testval = float (metalog .lst [0 ])
@@ -344,7 +344,7 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, version=
344
344
gpu_type = "none"
345
345
if (platform .system () == "Linux" ):
346
346
metalog = LineLogger ()
347
- utils .run_subtool_to_completion ("nvidia-smi -L | head -1 |cut -f2- -d: |cut -f1 -d\(" , stdout_cb = metalog .logline )
347
+ utils .run_subtool_to_completion (r "nvidia-smi -L | head -1 |cut -f2- -d: |cut -f1 -d\(" , stdout_cb = metalog .logline )
348
348
gpu_type = "," .join (metalog .lst )
349
349
if "failed because" in gpu_type :
350
350
gpu_type = "none"
@@ -496,7 +496,7 @@ def deactivate_config(bckfile):
496
496
497
497
def extract_config_mccode_version (configfile ):
498
498
for l in open (configfile ).read ().splitlines ():
499
- m = re .match ("\s*\" MCCODE_VERSION\" : (.+)," , l )
499
+ m = re .match (r "\s*\"MCCODE_VERSION\": (.+)," , l )
500
500
if m :
501
501
return m .group (1 ).strip ("\" " ), os .path .basename (os .path .dirname (configfile ))
502
502
@@ -511,9 +511,9 @@ def get_config_files(configfltr):
511
511
for (_ , _ , files ) in os .walk (lookin ):
512
512
print ("Looking" )
513
513
if configfltr is not None :
514
- return [join (lookin , f ) for f in files if re .search ("^%s/mccode_config.json$" % configfltr , f )]
514
+ return [join (lookin , f ) for f in files if re .search (r "^%s/mccode_config.json$" % configfltr , f )]
515
515
else :
516
- return [join (lookin , f ) for f in files if re .search ("^mccode_config.json$" , f )]
516
+ return [join (lookin , f ) for f in files if re .search (r "^mccode_config.json$" , f )]
517
517
518
518
# get test directory datetime string
519
519
datetime = utils .get_datetimestr ()
0 commit comments