Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] Apply 2to3 on changes
  • Loading branch information
arnaud-morvan authored and volaya committed Oct 5, 2016
1 parent effcb5e commit 4184934
Show file tree
Hide file tree
Showing 57 changed files with 106 additions and 107 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/GdalUtils.py
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/gdal2tiles.py
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/grass7/ext/i.py
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/grass7/ext/v_net.py
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/help/__init__.py
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/lidar/lastools/lasquery.py
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/otb/OTBAlgorithm.py
Expand Up @@ -22,6 +22,7 @@
* *
***************************************************************************
"""
from builtins import next
from future import standard_library
standard_library.install_aliases()
from builtins import map
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/otb/maintenance/parsing.py
Expand Up @@ -17,6 +17,7 @@
* *
***************************************************************************
"""
from builtins import next
from builtins import str
from builtins import range
__author__ = 'Julien Malik, Oscar Picas'
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/ConcaveHull.py
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/Delaunay.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/Difference.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/ExtractByLocation.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/HubDistanceLines.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Michael Minn'
__date__ = 'May 2010'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/HubDistancePoints.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Michael Minn'
__date__ = 'May 2010'
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/HypsometricCurves.py
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/Intersection.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/LinesIntersection.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/MeanCoords.py
Expand Up @@ -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]
Expand Down
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next
from builtins import str

__author__ = 'Victor Olaya'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/PointDistance.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next
from builtins import str
from builtins import range

Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/qgis/PointsDisplacement.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'July 2013'
Expand Down Expand Up @@ -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])))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/PointsToPaths.py
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/RandomExtract.py
Expand Up @@ -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())
Expand Down
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'April 2014'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/RandomPointsLayer.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'April 2014'
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/RandomSelection.py
Expand Up @@ -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)
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Alexander Bruy'
__date__ = 'April 2015'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/SelectByLocation.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/SplitLinesWithLines.py
Expand Up @@ -17,6 +17,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Bernhard Ströbl'
__date__ = 'November 2014'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/SumLines.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/Union.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/qgis/VoronoiPolygons.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from builtins import next

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down Expand Up @@ -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)
Expand Down
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/qgis/voronoi.py
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/core/GeoAlgorithm.py
Expand Up @@ -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))

Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/core/ProcessingLog.py
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/core/outputs.py
Expand Up @@ -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:
Expand Down

0 comments on commit 4184934

Please sign in to comment.