Skip to content

Commit 1a46ddb

Browse files
committed
[processing][API] rename runalg() and runandload() to improve
readability
1 parent e1a0110 commit 1a46ddb

File tree

11 files changed

+22
-22
lines changed

11 files changed

+22
-22
lines changed

python/plugins/processing/algs/grass7/Grass7Utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ def checkGrass7IsInstalled(ignorePreviousState=False):
384384
if Grass7Utils.isGrass7Installed:
385385
return
386386
try:
387-
from processing import runalg
388-
result = runalg(
387+
from processing import run
388+
result = run(
389389
'grass7:v.voronoi',
390390
points(),
391391
False,

python/plugins/processing/algs/qgis/ConcaveHull.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def processAlgorithm(self, feedback):
6868

6969
# Delaunay triangulation from input point layer
7070
feedback.setProgressText(self.tr('Creating Delaunay triangles...'))
71-
delone_triangles = processing.runalg("qgis:delaunaytriangulation", layer, None)['OUTPUT']
71+
delone_triangles = processing.run("qgis:delaunaytriangulation", layer, None)['OUTPUT']
7272
delaunay_layer = processing.getObject(delone_triangles)
7373

7474
# Get max edge length from Delaunay triangles
@@ -107,8 +107,8 @@ def processAlgorithm(self, feedback):
107107

108108
# Dissolve all Delaunay triangles
109109
feedback.setProgressText(self.tr('Dissolving Delaunay triangles...'))
110-
dissolved = processing.runalg("qgis:dissolve", delaunay_layer,
111-
True, None, None)['OUTPUT']
110+
dissolved = processing.run("qgis:dissolve", delaunay_layer,
111+
True, None, None)['OUTPUT']
112112
dissolved_layer = processing.getObject(dissolved)
113113

114114
# Save result

python/plugins/processing/core/GeoAlgorithm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def getAsCommand(self):
524524
console.
525525
"""
526526

527-
s = 'processing.runalg("' + self.commandLineName() + '",'
527+
s = 'processing.run("' + self.commandLineName() + '",'
528528
for param in self.parameters:
529529
s += param.getValueAsCommandLineParameter() + ','
530530
for out in self.outputs:

python/plugins/processing/core/ProcessingLog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def addToLog(msgtype, msg):
6969
with codecs.open(ProcessingLog.logFilename(), 'a',
7070
encoding='utf-8') as logfile:
7171
logfile.write(line)
72-
algname = msg[len('processing.runalg("'):]
72+
algname = msg[len('processing.run("'):]
7373
algname = algname[:algname.index('"')]
7474
if algname not in ProcessingLog.recentAlgs:
7575
ProcessingLog.recentAlgs.append(algname)

python/plugins/processing/core/parameters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def getValueAsCommandLineParameter(self):
160160
"""
161161
Returns the value of this parameter as it should have been
162162
entered in the console if calling an algorithm using the
163-
processing.runalg() method.
163+
processing.run() method.
164164
"""
165165
return str(self.value)
166166

python/plugins/processing/gui/HistoryDialog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def executeAlgorithm(self):
114114
if isinstance(item, TreeLogEntryItem):
115115
if item.isAlg:
116116
script = 'import processing\n'
117-
script += item.entry.text.replace('runalg(', 'runandload(')
117+
script += item.entry.text.replace('run(', 'runAndLoadResults(')
118118
exec(script)
119119

120120
def changeText(self):

python/plugins/processing/gui/TestTools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def parseParameters(command):
133133
def createTest(text):
134134
definition = {}
135135

136-
tokens = list(parseParameters(text[len('processing.runalg('):-1]))
136+
tokens = list(parseParameters(text[len('processing.run('):-1]))
137137
cmdname = tokens[0]
138138
alg = Processing.getAlgorithm(cmdname)
139139

python/plugins/processing/modeler/ModelerAlgorithm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _toString(v):
152152
params.append(safeName(self.outputs[out.name].description).lower())
153153
else:
154154
params.append(str(None))
155-
s.append("outputs_%s=processing.runalg('%s', %s)" % (self.name, self.consoleName, ",".join(params)))
155+
s.append("outputs_%s=processing.run('%s', %s)" % (self.name, self.consoleName, ",".join(params)))
156156
return s
157157

158158

python/plugins/processing/tests/testdata/scripts/selectbyattribute.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
import processing
77

8-
result = processing.runalg("qgis:selectbyattribute",
9-
INPUT_LAYER,
10-
"id2",
11-
0,
12-
"2")
8+
result = processing.run("qgis:selectbyattribute",
9+
INPUT_LAYER,
10+
"id2",
11+
0,
12+
"2")
1313

14-
processing.runalg("qgis:saveselectedfeatures",
15-
result["OUTPUT"],
16-
OUTPUT_LAYER)
14+
processing.run("qgis:saveselectedfeatures",
15+
result["OUTPUT"],
16+
OUTPUT_LAYER)

python/plugins/processing/tools/general.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def algorithmHelp(name):
9999
print('Algorithm "{}" not found.'.format(name))
100100

101101

102-
def runalg(algOrName, *args, **kwargs):
102+
def run(algOrName, *args, **kwargs):
103103
"""Executes given algorithm and returns its outputs as dictionary
104104
object.
105105
"""
@@ -108,7 +108,7 @@ def runalg(algOrName, *args, **kwargs):
108108
return alg.getOutputValuesAsDictionary()
109109

110110

111-
def runandload(name, *args, **kwargs):
111+
def runAndLoadResults(name, *args, **kwargs):
112112
"""Executes given algorithm and load its results into QGIS project
113113
when possible.
114114
"""

python/plugins/processing/tools/help.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def baseHelpForAlgorithm(alg, folder):
8989
f.write('Console usage\n')
9090
f.write('-------------\n')
9191
f.write('\n::\n\n')
92-
cmd = " processing.runalg('{}', ".format(alg.commandLineName())
92+
cmd = " processing.run('{}', ".format(alg.commandLineName())
9393
for p in alg.parameters:
9494
cmd += '{}, '.format(p.name.lower().strip())
9595

0 commit comments

Comments
 (0)