Skip to content
Permalink
Browse files

[processing] Apply 2to3 on changes

  • Loading branch information
arnaud-morvan authored and volaya committed Oct 5, 2016
1 parent effcb5e commit 4184934b9a8889d015f6a45021b27e88a60a754b
Showing with 106 additions and 107 deletions.
  1. +1 −1 python/plugins/processing/algs/gdal/GdalUtils.py
  2. +1 −1 python/plugins/processing/algs/gdal/gdal2tiles.py
  3. +1 −1 python/plugins/processing/algs/grass7/ext/i.py
  4. +1 −1 python/plugins/processing/algs/grass7/ext/v_net.py
  5. +1 −1 python/plugins/processing/algs/help/__init__.py
  6. +1 −1 python/plugins/processing/algs/lidar/lastools/lasquery.py
  7. +2 −1 python/plugins/processing/algs/otb/OTBAlgorithm.py
  8. +1 −0 python/plugins/processing/algs/otb/maintenance/parsing.py
  9. +1 −1 python/plugins/processing/algs/qgis/ConcaveHull.py
  10. +1 −0 python/plugins/processing/algs/qgis/Delaunay.py
  11. +1 −1 python/plugins/processing/algs/qgis/DeleteDuplicateGeometries.py
  12. +1 −0 python/plugins/processing/algs/qgis/Difference.py
  13. +1 −0 python/plugins/processing/algs/qgis/ExtractByLocation.py
  14. +1 −0 python/plugins/processing/algs/qgis/HubDistanceLines.py
  15. +1 −0 python/plugins/processing/algs/qgis/HubDistancePoints.py
  16. +1 −1 python/plugins/processing/algs/qgis/HypsometricCurves.py
  17. +1 −0 python/plugins/processing/algs/qgis/Intersection.py
  18. +1 −0 python/plugins/processing/algs/qgis/LinesIntersection.py
  19. +1 −1 python/plugins/processing/algs/qgis/MeanCoords.py
  20. +1 −0 python/plugins/processing/algs/qgis/NearestNeighbourAnalysis.py
  21. +1 −0 python/plugins/processing/algs/qgis/PointDistance.py
  22. +2 −1 python/plugins/processing/algs/qgis/PointsDisplacement.py
  23. +1 −1 python/plugins/processing/algs/qgis/PointsToPaths.py
  24. +1 −1 python/plugins/processing/algs/qgis/RandomExtract.py
  25. +1 −0 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
  26. +1 −0 python/plugins/processing/algs/qgis/RandomPointsLayer.py
  27. +1 −1 python/plugins/processing/algs/qgis/RandomSelection.py
  28. +1 −0 python/plugins/processing/algs/qgis/SelectByAttributeSum.py
  29. +1 −0 python/plugins/processing/algs/qgis/SelectByLocation.py
  30. +1 −0 python/plugins/processing/algs/qgis/SplitLinesWithLines.py
  31. +1 −0 python/plugins/processing/algs/qgis/SumLines.py
  32. +1 −0 python/plugins/processing/algs/qgis/Union.py
  33. +2 −1 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  34. +1 −1 python/plugins/processing/algs/qgis/ui/FieldsMappingPanel.py
  35. +1 −0 python/plugins/processing/algs/qgis/voronoi.py
  36. +2 −2 python/plugins/processing/core/GeoAlgorithm.py
  37. +1 −1 python/plugins/processing/core/ProcessingLog.py
  38. +1 −1 python/plugins/processing/core/outputs.py
  39. +11 −11 python/plugins/processing/core/parameters.py
  40. +2 −2 python/plugins/processing/gui/AlgorithmDialog.py
  41. +2 −2 python/plugins/processing/gui/BatchAlgorithmDialog.py
  42. +3 −3 python/plugins/processing/gui/BatchPanel.py
  43. +1 −1 python/plugins/processing/gui/LexerR.py
  44. +4 −3 python/plugins/processing/gui/NumberInputPanel.py
  45. +3 −3 python/plugins/processing/gui/ParametersPanel.py
  46. +1 −1 python/plugins/processing/gui/ProcessingToolbox.py
  47. +1 −1 python/plugins/processing/gui/ScriptEditorDialog.py
  48. +2 −1 python/plugins/processing/gui/StringInputPanel.py
  49. +9 −7 python/plugins/processing/gui/wrappers.py
  50. +9 −9 python/plugins/processing/modeler/ModelerAlgorithm.py
  51. +2 −2 python/plugins/processing/modeler/ModelerDialog.py
  52. +1 −23 python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py
  53. +5 −9 python/plugins/processing/modeler/ModelerParametersDialog.py
  54. +4 −4 python/plugins/processing/modeler/ModelerScene.py
  55. +2 −2 python/plugins/processing/preconfigured/PreconfiguredAlgorithm.py
  56. +1 −1 python/plugins/processing/script/ScriptSelector.py
  57. +1 −1 python/plugins/processing/tools/translation.py
@@ -155,7 +155,7 @@ def getVectorDriverFromFileName(filename):
return 'ESRI Shapefile'

formats = QgsVectorFileWriter.supportedFiltersAndFormats()
for k, v in formats.items():
for k, v in list(formats.items()):
if ext in k:
return v
return 'ESRI Shapefile'
@@ -168,7 +168,7 @@ def getConsoleCommands(self):

parameters = {self.TITLE: '-t', self.COPYRIGHT: '-c',
self.GOOGLEKEY: '-g', self.BINGKEY: '-b'}
for arg, parameter in parameters.items():
for arg, parameter in list(parameters.items()):
if self.getParameterValue(arg):
arguments.append(parameter)
arguments.append(self.getParameterValue(arg))
@@ -174,7 +174,7 @@ def exportInputRasters(alg, rasterDic):
{ 'inputName1': 'outputName1', 'inputName2': 'outputName2'}
"""
# Get inputs and outputs
for inputName, outputName in rasterDic.items():
for inputName, outputName in list(rasterDic.items()):
inputRaster = alg.getParameterValue(inputName)
outputRaster = alg.getOutputFromName(outputName)
command = 'r.out.gdal -c -t -f --overwrite createopt="TFW=YES,COMPRESS=LZW" input={} output=\"{}\"'.format(
@@ -87,7 +87,7 @@ def variableOutput(alg, params, nocats=True):
"""

# Build the v.out.ogr commands
for outputName, typeList in params.items():
for outputName, typeList in list(params.items()):
if not isinstance(typeList, list):
continue

@@ -50,7 +50,7 @@ def replace(s):
return s.replace("{qgisdocs}", "https://docs.qgis.org/%s/%s/docs" % (version, locale))
else:
return None
h = {k: replace(v) for k, v in h.items()}
h = {k: replace(v) for k, v in list(h.items())}
return h


@@ -61,7 +61,7 @@ def processAlgorithm(self, progress):
layers = QgsMapLayerRegistry.instance().mapLayers()

# loop over layers
for name, layer in layers.items():
for name, layer in list(layers.items()):
layerType = layer.type()
if layerType == QgsMapLayer.VectorLayer:
shp_file_name = layer.source()
@@ -22,6 +22,7 @@
* *
***************************************************************************
"""
from builtins import next
from future import standard_library
standard_library.install_aliases()
from builtins import map
@@ -307,7 +308,7 @@ def processAlgorithm(self, progress):
OTBUtils.executeOtb(helperCommands, progress)

if self.roiRasters:
supportRaster = next(iter(self.roiRasters.values()))
supportRaster = next(iter(list(self.roiRasters.values())))
for roiInput, roiFile in list(self.roiVectors.items()):
helperCommands = [
"otbcli_VectorDataExtractROIApplication",
@@ -17,6 +17,7 @@
* *
***************************************************************************
"""
from builtins import next
from builtins import str
from builtins import range
__author__ = 'Julien Malik, Oscar Picas'
@@ -89,7 +89,7 @@ def processAlgorithm(self, progress):
counter = 50. / len(edges)
i = 0
ids = []
for id, max_len in edges.items():
for id, max_len in list(edges.items()):
if max_len > alpha * max_length:
ids.append(id)
progress.setPercentage(50 + i * counter)
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -64,7 +64,7 @@ def processAlgorithm(self, progress):

cleaned = dict(geoms)

for i, g in geoms.items():
for i, g in list(geoms.items()):
for j in list(cleaned.keys()):
if i == j or i not in cleaned:
continue
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Michael Minn'
__date__ = 'May 2010'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Michael Minn'
__date__ = 'May 2010'
@@ -197,7 +197,7 @@ def calculateHypsometry(self, fid, fName, progress, data, pX, pY,
else:
multiplier = pX * pY

for k, v in out.items():
for k, v in list(out.items()):
out[k] = v * multiplier

prev = None
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -124,7 +124,7 @@ def processAlgorithm(self, progress):

current = 0
total = 100.0 / len(means)
for (clazz, values) in means.items():
for (clazz, values) in list(means.items()):
outFeat = QgsFeature()
cx = values[0] / values[2]
cy = values[1] / values[2]
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next
from builtins import str

__author__ = 'Victor Olaya'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next
from builtins import str
from builtins import range

@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'July 2013'
@@ -86,7 +87,7 @@ def processAlgorithm(self, progress):
fullPerimeter = 2 * math.pi

request = QgsFeatureRequest()
for (geom, fids) in duplicates.items():
for (geom, fids) in list(duplicates.items()):
count = len(fids)
if count == 1:
f = next(layer.getFeatures(request.setFilterFid(fids[0])))
@@ -106,7 +106,7 @@ def processAlgorithm(self, progress):

current = 0
total = 100.0 / len(points)
for group, vertices in points.items():
for group, vertices in list(points.items()):
vertices.sort()
f = QgsFeature()
f.initAttributes(len(fields))
@@ -81,7 +81,7 @@ def processAlgorithm(self, progress):
"different value and try again."))
value = int(round(value / 100.0000, 4) * featureCount)

selran = random.sample(range(featureCount), value)
selran = random.sample(list(range(featureCount)), value)

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.fields().toList(), layer.wkbType(), layer.crs())
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'April 2014'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'April 2014'
@@ -89,7 +89,7 @@ def processAlgorithm(self, progress):
"different value and try again."))
value = int(round(value / 100.0, 4) * featureCount)

selran = random.sample(range(featureCount), value)
selran = random.sample(list(range(featureCount)), value)

layer.selectByIds(selran)
self.setOutputValue(self.OUTPUT, filename)
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'April 2015'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -17,6 +17,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Bernhard Ströbl'
__date__ = 'November 2014'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -109,7 +110,7 @@ def processAlgorithm(self, progress):
current = 0
total = 100.0 / len(c.polygons)

for (site, edges) in c.polygons.items():
for (site, edges) in list(c.polygons.items()):
request = QgsFeatureRequest().setFilterFid(ptDict[ids[site]])
inFeat = next(layer.getFeatures(request))
lines = self.clip_voronoi(edges, c, width, height, extent, extraX, extraY)
@@ -248,7 +248,7 @@ def createEditor(self, parent, option, index):
fieldType = FieldsMappingModel.columns[column]['type']
if fieldType == QVariant.Type:
editor = QComboBox(parent)
for key, text in FieldsMappingModel.fieldTypes.items():
for key, text in list(FieldsMappingModel.fieldTypes.items()):
editor.addItem(text, key)

elif fieldType == QgsExpression:
@@ -17,6 +17,7 @@
***************************************************************************
"""
from __future__ import print_function
from builtins import next
from past.builtins import cmp
from builtins import str
from builtins import range
@@ -329,7 +329,7 @@ def evaluateParameterValues(self):
for param in self.parameters:
try:
param.evaluate(self)
except ValueError, e:
except ValueError as e:
traceback.print_exc()
raise GeoAlgorithmExecutionException(str(e))

@@ -340,7 +340,7 @@ def resolveOutputs(self):
try:
for out in self.outputs:
out.resolveValue(self)
except ValueError, e:
except ValueError as e:
raise GeoAlgorithmExecutionException(str(e))

def setOutputCRS(self):
@@ -135,7 +135,7 @@ def clearLog():
def saveLog(fileName):
entries = ProcessingLog.getLogEntries()
with codecs.open(fileName, 'w', encoding='utf-8') as f:
for k, v in entries.items():
for k, v in list(entries.items()):
for entry in v:
f.write('%s|%s|%s\n' % (k, entry.date, entry.text))

@@ -398,7 +398,7 @@ def getOutputFromString(s):
try:
if "|" in s:
tokens = s.split("|")
params = [t if unicode(t) != "None" else None for t in tokens[1:]]
params = [t if str(t) != "None" else None for t in tokens[1:]]
clazz = getattr(sys.modules[__name__], tokens[0])
return clazz(*params)
else:

0 comments on commit 4184934

Please sign in to comment.
You can’t perform that action at this time.