diff --git a/framework/CodeInterfaces/AccelerateCFD/AccelerateCFD.py b/framework/CodeInterfaces/AccelerateCFD/AccelerateCFD.py index 4a428ffdbf..df7fb07cf9 100644 --- a/framework/CodeInterfaces/AccelerateCFD/AccelerateCFD.py +++ b/framework/CodeInterfaces/AccelerateCFD/AccelerateCFD.py @@ -109,7 +109,7 @@ def initialize(self, runInfo, oriInputFiles): self.romName = xmlFind('./rom/romName') self.romType = xmlFind('./rom/romType') # read data from FOM - datai = pd.read_csv(self.fomDataFolder,skiprows=3,header=None,sep='\s+').iloc[:,[0,1,2]].replace('[()]','',regex=True).astype(float) + datai = pd.read_csv(self.fomDataFolder,skiprows=3,header=None,sep=r'\s+').iloc[:,[0,1,2]].replace('[()]','',regex=True).astype(float) datai = datai.rename(columns={0:'t',1:'ux',2:'uy'}) dataList = [datai] self.dataFom = pd.concat(dataList,keys=['fom']) @@ -322,7 +322,7 @@ def finalizeCodeOutput(self, command, output, workingDir): # process post-processing file for rom ppRomFile = os.path.join(workingDir,"rom",self.romType +"_"+ self.romName,"postProcessing","probe","0","Urom") if os.path.exists(ppRomFile): - datai = pd.read_csv(ppRomFile,skiprows=3,header=None,sep='\s+').iloc[:,[0,1,2]].replace('[()]','',regex=True).astype(float) + datai = pd.read_csv(ppRomFile,skiprows=3,header=None,sep=r'\s+').iloc[:,[0,1,2]].replace('[()]','',regex=True).astype(float) datai = datai.rename(columns={0:'t',1:'ux',2:'uy'}) dataList = [datai] romData = pd.concat(dataList,keys=['rom']) diff --git a/framework/CodeInterfaces/Dymola/DymolaInterface.py b/framework/CodeInterfaces/Dymola/DymolaInterface.py index 5bfeca7e66..89bfcce107 100644 --- a/framework/CodeInterfaces/Dymola/DymolaInterface.py +++ b/framework/CodeInterfaces/Dymola/DymolaInterface.py @@ -262,8 +262,8 @@ def createNewInput(self, currentInputFiles, oriInputFiles, samplerType, **Kwargs patterns = [# Dymola 1- or 2-line parameter specification (r'(^\s*%s\s+)%s(\s+%s\s+%s\s+%s\s+%s\s*#\s*%s\s*$)' % (i, f, f, f, u, u, '%s')), - (r'(^\s*)' + i + '(\s*#\s*%s)'), - (r'(^\s*)' + f + '(\s*#\s*%s)'), + (r'(^\s*)' + i + r'(\s*#\s*%s)'), + (r'(^\s*)' + f + r'(\s*#\s*%s)'), # From Dymola: # column 1: Type of initial value # = -2: special case: for continuing simulation diff --git a/framework/CodeInterfaces/MELCOR/MELCORdata.py b/framework/CodeInterfaces/MELCOR/MELCORdata.py index 3fc0dadb89..3892bd2ede 100644 --- a/framework/CodeInterfaces/MELCOR/MELCORdata.py +++ b/framework/CodeInterfaces/MELCOR/MELCORdata.py @@ -68,10 +68,10 @@ def returnControlFunctions(self, timeBlock): @ Out, functionValuesForEachTime, dict, {"time":{"functionName":"functionValue"}} """ functionValuesForEachTime = {'time': []} - timeOneRegex_name = re.compile("^\s*CONTROL\s+FUNCTION\s+(?P[^\(]*)\s+(\(.*\))?\s*IS\s+.+\s+TYPE.*$") - timeOneRegex_value = re.compile("^\s*VALUE\s+=\s+(?P[^\s]*)") - startRegex = re.compile("\s*CONTROL\s*FUNCTION\s*NUMBER\s*CURRENT\s*VALUE") - regex = re.compile("^\s*(?P( ?([0-9a-zA-Z-]+))*)\s+([0-9]+)\s*(?P((([0-9.-]+)E(\+|-)[0-9][0-9])|((T|F))))\s*.*$") + timeOneRegex_name = re.compile(r"^\s*CONTROL\s+FUNCTION\s+(?P[^\(]*)\s+(\(.*\))?\s*IS\s+.+\s+TYPE.*$") + timeOneRegex_value = re.compile(r"^\s*VALUE\s+=\s+(?P[^\s]*)") + startRegex = re.compile(r"\s*CONTROL\s*FUNCTION\s*NUMBER\s*CURRENT\s*VALUE") + regex = re.compile(r"^\s*(?P( ?([0-9a-zA-Z-]+))*)\s+([0-9]+)\s*(?P((([0-9.-]+)E(\+|-)[0-9][0-9])|((T|F))))\s*.*$") for time,listOfLines in timeBlock.items(): functionValuesForEachTime['time'].append(float(time)) start = -1 diff --git a/framework/CodeInterfaces/MooseBasedApp/BISONMESHSCRIPTparser.py b/framework/CodeInterfaces/MooseBasedApp/BISONMESHSCRIPTparser.py index f3de2c1ed0..1aa2d99336 100644 --- a/framework/CodeInterfaces/MooseBasedApp/BISONMESHSCRIPTparser.py +++ b/framework/CodeInterfaces/MooseBasedApp/BISONMESHSCRIPTparser.py @@ -84,7 +84,7 @@ def __init__(self,inputFile): # Append string of non-varying parts of input file to file storage and reset the collection string if len(between_str) > 0: self.fileOrderStorage.append(between_str); between_str = '' - dictname, varname, varvalue = re.split("\['|'] = |'] =|']= ", line) + dictname, varname, varvalue = re.split(r"\['|'] = |'] =|']= ", line) if dictname in self.AllVarDict.keys(): self.AllVarDict[dictname][varname] = varvalue.strip() else: @@ -119,7 +119,7 @@ def __init__(self,inputFile): # Append string of non-varying parts of input file to file storage and reset the collection string if len(between_str) > 0: self.fileOrderStorage.append(between_str); between_str = '' - dictname, varname, varvalue = re.split("\['|'] = |'] =|']= ", line) + dictname, varname, varvalue = re.split(r"\['|'] = |'] =|']= ", line) if dictname in self.AllVarDict.keys(): self.AllVarDict[dictname][varname] = varvalue.strip() else: diff --git a/framework/CodeInterfaces/OpenModelica/OpenModelicaInterface.py b/framework/CodeInterfaces/OpenModelica/OpenModelicaInterface.py index bdd0b24de3..2ed27d3a0b 100644 --- a/framework/CodeInterfaces/OpenModelica/OpenModelicaInterface.py +++ b/framework/CodeInterfaces/OpenModelica/OpenModelicaInterface.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -""" +r""" Created on May 22, 2015 @author: bobk diff --git a/framework/CodeInterfaces/PHISICS/PhisicsInterface.py b/framework/CodeInterfaces/PHISICS/PhisicsInterface.py index 1f8d4a3056..d317943f5e 100644 --- a/framework/CodeInterfaces/PHISICS/PhisicsInterface.py +++ b/framework/CodeInterfaces/PHISICS/PhisicsInterface.py @@ -267,7 +267,7 @@ def generateCommand(self, inputFiles, executable, clargs=None, fargs=None, preEx )]].getFilename() + ' -dep ' + inputFiles[mapDict['Depletion_input'.lower( )]].getFilename() + ' -o ' + self.instantOutput commandToRun = commandToRun.replace("\n", " ") - commandToRun = re.sub("\s\s+", " ", commandToRun) + commandToRun = re.sub(r"\s\s+", " ", commandToRun) outputfile = 'out~' + inputFiles[mapDict['inp'.lower()]].getBase() returnCommand = [('parallel', commandToRun)], outputfile return returnCommand diff --git a/framework/CodeInterfaces/PHISICS/PhisicsRelapInterface.py b/framework/CodeInterfaces/PHISICS/PhisicsRelapInterface.py index 70f2cbbebe..aeec91df4f 100644 --- a/framework/CodeInterfaces/PHISICS/PhisicsRelapInterface.py +++ b/framework/CodeInterfaces/PHISICS/PhisicsRelapInterface.py @@ -134,7 +134,7 @@ def generateCommand(self, inputFiles, executable, clargs=None, fargs=None, preEx self.outputExt = '.o' commandToRun = executable + ' -i ' +inputFiles[mapDict['relapInp'.lower()]].getFilename() + ' -o ' + self.outFileName + self.outputExt commandToRun = commandToRun.replace("\n"," ") - commandToRun = re.sub("\s\s+", " ",commandToRun) + commandToRun = re.sub(r"\s\s+", " ",commandToRun) returnCommand = [('parallel',commandToRun)], outputfile return returnCommand diff --git a/framework/CodeInterfaces/RELAP5/RELAPparser.py b/framework/CodeInterfaces/RELAP5/RELAPparser.py index 5dfd88463c..9a6eb9e412 100644 --- a/framework/CodeInterfaces/RELAP5/RELAPparser.py +++ b/framework/CodeInterfaces/RELAP5/RELAPparser.py @@ -367,7 +367,7 @@ def retrieveCardValues(self, listOfCards): for lineNum, line in enumerate(self.deckLines[deck]): if all(foundAllCards[deck].values()): break - if not re.match('^\s*\n',line): + if not re.match(r'^\s*\n',line): readCard = line.split()[0].strip() if readCard in deckCards[deck].keys(): foundWord = False diff --git a/framework/CodeInterfaces/RELAP5/Relap5Interface.py b/framework/CodeInterfaces/RELAP5/Relap5Interface.py index fd197501f3..9639e7f73d 100644 --- a/framework/CodeInterfaces/RELAP5/Relap5Interface.py +++ b/framework/CodeInterfaces/RELAP5/Relap5Interface.py @@ -142,7 +142,7 @@ def generateCommand(self,inputFiles,executable,clargs=None,fargs=None, preExec=N addflags = '' commandToRun = executable + ' -i ' + inputFiles[index].getFilename() + ' -o ' + outputfile + '.o ' + addflags commandToRun = commandToRun.replace("\n"," ") - commandToRun = re.sub("\s\s+" , " ", commandToRun ) + commandToRun = re.sub(r"\s\s+" , " ", commandToRun ) returnCommand = [('parallel',commandToRun)], outputfile return returnCommand diff --git a/framework/CodeInterfaces/SCALE/tritonAndOrigenData.py b/framework/CodeInterfaces/SCALE/tritonAndOrigenData.py index d726a48ada..b5e3293f57 100644 --- a/framework/CodeInterfaces/SCALE/tritonAndOrigenData.py +++ b/framework/CodeInterfaces/SCALE/tritonAndOrigenData.py @@ -207,7 +207,7 @@ def retrieveConcentrationTables(self): if uom not in totals: totals[uom] = [] indexConcTable+=4 - timeUom = re.split('(\d+)', self.lines[indexConcTable].split()[0])[-1].strip() + timeUom = re.split(r'(\d+)', self.lines[indexConcTable].split()[0])[-1].strip() timeGrid = [float(elm.replace(timeUom.strip(),"")) for elm in self.lines[indexConcTable].split()] if outputDict is None: diff --git a/framework/InputTemplates/TemplateBaseClass.py b/framework/InputTemplates/TemplateBaseClass.py index 4617e5246d..104426a0c8 100644 --- a/framework/InputTemplates/TemplateBaseClass.py +++ b/framework/InputTemplates/TemplateBaseClass.py @@ -185,7 +185,7 @@ def _updateCommaSeperatedList(self, node, new, position=None, before=None, after # OTHER UTILITIES # ################################ def _getRavenLocation(self, which='framework'): - """ + r""" Returns the (string) path to RAVEN NOTE this is problematic in mingw windows, since using abspath includes e.g. C:\msys64\home\etc. @ In, framework, bool, optional, if True then give location of "raven/framework" else "raven/" diff --git a/framework/Optimizers/GeneticAlgorithm.py b/framework/Optimizers/GeneticAlgorithm.py index 47ddf82ece..cdc3818a88 100644 --- a/framework/Optimizers/GeneticAlgorithm.py +++ b/framework/Optimizers/GeneticAlgorithm.py @@ -725,7 +725,7 @@ def _ahdp(self,a,b,p): return max(self._GDp(a,b,p),self._GDp(b,a,p)) def _GDp(self,a,b,p): - """ + r""" Modified Generational Distance Indicator @ In, a, np.array, old population A @ In, b, np.array, new population B @@ -739,7 +739,7 @@ def _GDp(self,a,b,p): return (1/n * s)**(1/p) def _popDist(self,ai,b,q=2): - """ + r""" Minimum Minkowski distance from a_i to B (nearest point in B) @ In, ai, 1d array, the ith chromosome in the generation A @ In, b, np.array, population B @@ -761,7 +761,7 @@ def _ahd(self,a,b): return max(self._GD(a,b),self._GD(b,a)) def _GD(self,a,b): - """ + r""" Generational Distance Indicator @ In, a, np.array, old population A @ In, b, np.array, new population B diff --git a/framework/Optimizers/SimulatedAnnealing.py b/framework/Optimizers/SimulatedAnnealing.py index df751feeb7..c61a1d87dd 100644 --- a/framework/Optimizers/SimulatedAnnealing.py +++ b/framework/Optimizers/SimulatedAnnealing.py @@ -626,7 +626,7 @@ def _coolingSchedule(self, iter, T0): self.raiseAnError(NotImplementedError,'cooling schedule type not implemented.') def _nextNeighbour(self, rlz,fraction=1): - """ + r""" Perturbs the state to find the next random neighbour based on the cooling schedule @ In, rlz, dict, current realization @ In, fraction, float, optional, the current iteration divided by the iteration limit i.e., $\frac{iter}{Limit}$ diff --git a/framework/Optimizers/fitness/fitness.py b/framework/Optimizers/fitness/fitness.py index ac501051eb..53a27ff1c6 100644 --- a/framework/Optimizers/fitness/fitness.py +++ b/framework/Optimizers/fitness/fitness.py @@ -28,7 +28,7 @@ # @profile def invLinear(rlz,**kwargs): - """ + r""" Inverse linear fitness method requires that the fitness value is inversely proportional to the objective function This method is designed such that: For minimization Problems: @@ -76,7 +76,7 @@ def invLinear(rlz,**kwargs): return fitness def feasibleFirst(rlz,**kwargs): - """ + r""" Efficient Parameter-less Feasible First Penalty Fitness method This method is designed such that: For minimization Problems: diff --git a/framework/SupervisedLearning/ARMA.py b/framework/SupervisedLearning/ARMA.py index f06e76753b..1503c2abde 100644 --- a/framework/SupervisedLearning/ARMA.py +++ b/framework/SupervisedLearning/ARMA.py @@ -230,7 +230,7 @@ class cls. specs.addSub(InputData.parameterInputFactory("nyquistScalar", contentType=InputTypes.IntegerType, default=1)) ### ARMA zero filter zeroFilt = InputData.parameterInputFactory('ZeroFilter', contentType=InputTypes.StringType, - descr="""turns on \emph{zero filtering} + descr=r"""turns on \emph{zero filtering} for the listed targets. Zero filtering is a very specific algorithm, and should not be used without understanding its application. When zero filtering is enabled, the ARMA will remove all the values from the training data equal to zero for the target, then train on the remaining data (including Fourier detrending diff --git a/framework/contrib/pyDOE/doe_factorial.py b/framework/contrib/pyDOE/doe_factorial.py index e328d34d42..b2cb12bfb1 100755 --- a/framework/contrib/pyDOE/doe_factorial.py +++ b/framework/contrib/pyDOE/doe_factorial.py @@ -190,7 +190,7 @@ def fracfact(gen): """ # Recognize letters and combinations #### fixed for python 3.7 by alfoa - A = [item for item in re.split('\-|\s|\+', gen) if item] # remove empty strings + A = [item for item in re.split(r'\-|\s|\+', gen) if item] # remove empty strings C = [len(item) for item in A]