@@ -61,20 +61,19 @@ def defineCharacteristics(self):
6161 class ParameterRasterCalculatorExpression (ParameterString ):
6262
6363 def evaluateForModeler (self , value , model ):
64- # print value
6564 for i in list (model .inputs .values ()):
6665 param = i .param
6766 if isinstance (param , ParameterRaster ):
68- new = "%s@" % os .path .basename (param .value )
69- old = "%s@" % param .name
67+ new = "{}@" . format ( os .path .basename (param .value ) )
68+ old = "{}@" . format ( param .name )
7069 value = value .replace (old , new )
7170
7271 for alg in list (model .algs .values ()):
7372 for out in alg .algorithm .outputs :
7473 if isinstance (out , OutputRaster ):
7574 if out .value :
76- new = "%s@" % os .path .basename (out .value )
77- old = "%s:%s@" % (alg .name , out .name )
75+ new = "{}@" . format ( os .path .basename (out .value ) )
76+ old = "{}:{}@" . format (alg .name , out .name )
7877 value = value .replace (old , new )
7978 return value
8079
@@ -106,7 +105,7 @@ def processAlgorithm(self, progress):
106105 for name , lyr in layersDict .items ():
107106 for n in xrange (lyr .bandCount ()):
108107 entry = QgsRasterCalculatorEntry ()
109- entry .ref = '%s@%i' % (name , n + 1 )
108+ entry .ref = '{:s}@{:d}' . format (name , n + 1 )
110109 entry .raster = lyr
111110 entry .bandNumber = n + 1
112111 entries .append (entry )
@@ -149,7 +148,7 @@ def processBeforeAddingToModeler(self, algorithm, model):
149148 expression = algorithm .params [self .EXPRESSION ]
150149 for i in list (model .inputs .values ()):
151150 param = i .param
152- if isinstance (param , ParameterRaster ) and "%s@" % param .name in expression :
151+ if isinstance (param , ParameterRaster ) and "{}@" . format ( param .name ) in expression :
153152 values .append (ValueFromInput (param .name ))
154153
155154 if algorithm .name :
@@ -160,7 +159,7 @@ def processBeforeAddingToModeler(self, algorithm, model):
160159 if alg .name not in dependent :
161160 for out in alg .algorithm .outputs :
162161 if (isinstance (out , OutputRaster )
163- and "%s:%s@" % (alg .name , out .name ) in expression ):
162+ and "{}:{}@" . format (alg .name , out .name ) in expression ):
164163 values .append (ValueFromOutput (alg .name , out .name ))
165164
166165 algorithm .params [self .LAYERS ] = values
0 commit comments