Skip to content
Permalink
Browse files

Formatting update, using newer autopep8 version

  • Loading branch information
nyalldawson committed Jan 29, 2016
1 parent 4a3d3db commit cbe8cb7282adab4b3ffc7ff41b36c6019bcafbc8
Showing with 128 additions and 128 deletions.
  1. +1 −1 python/console/console_sci.py
  2. +5 −5 python/custom_widgets/qgis_customwidgets.py
  3. +4 −4 python/plugins/MetaSearch/plugin.py
  4. +1 −1 python/plugins/db_manager/db_plugins/oracle/info_model.py
  5. +15 −15 python/plugins/fTools/tools/doEliminate.py
  6. +1 −1 python/plugins/fTools/tools/doValidate.py
  7. +1 −1 python/plugins/processing/algs/gdal/ClipByMask.py
  8. +1 −1 python/plugins/processing/algs/gdal/ogrinfo.py
  9. +1 −1 python/plugins/processing/algs/gdal/ogrsql.py
  10. +1 −1 python/plugins/processing/algs/grass7/nviz7.py
  11. +1 −1 python/plugins/processing/algs/lidar/LidarToolsAlgorithmProvider.py
  12. +1 −1 python/plugins/processing/algs/qgis/AddTableField.py
  13. +2 −2 python/plugins/processing/algs/qgis/ExtentFromLayer.py
  14. +1 −1 python/plugins/processing/algs/qgis/FieldPyculator.py
  15. +2 −2 python/plugins/processing/algs/qgis/PointDistance.py
  16. +1 −1 python/plugins/processing/algs/qgis/Polygonize.py
  17. +1 −1 python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py
  18. +1 −1 python/plugins/processing/algs/qgis/UniqueValues.py
  19. +7 −7 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  20. +1 −1 python/plugins/processing/algs/qgis/postgis_utils.py
  21. +13 −13 python/plugins/processing/algs/qgis/scripts/Fill_holes.py
  22. +19 −19 python/plugins/processing/algs/qgis/scripts/Keep_n_biggest_parts.py
  23. +1 −1 python/plugins/processing/algs/r/RAlgorithm.py
  24. +1 −1 python/plugins/processing/algs/saga/SagaAlgorithm213.py
  25. +2 −2 python/plugins/processing/core/ProcessingConfig.py
  26. +7 −7 python/plugins/processing/gui/NumberInputDialog.py
  27. +1 −1 python/plugins/processing/gui/ScriptEdit.py
  28. +2 −2 python/plugins/processing/gui/ScriptEditorDialog.py
  29. +1 −1 python/plugins/processing/modeler/CalculatorModelerAlgorithm.py
  30. +1 −1 python/plugins/processing/modeler/ModelerArrowItem.py
  31. +8 −8 python/plugins/processing/modeler/ModelerGraphicItem.py
  32. +3 −3 python/plugins/processing/modeler/RasterLayerBoundsAlgorithm.py
  33. +3 −3 python/plugins/processing/modeler/VectorLayerBoundsAlgorithm.py
  34. +6 −6 python/plugins/processing/script/ScriptAlgorithmProvider.py
  35. +3 −3 python/plugins/processing/tests/qgis_interface.py
  36. +1 −1 python/plugins/processing/tests/test.py
  37. +2 −2 python/plugins/processing/tools/vector.py
  38. +1 −1 python/pyplugin_installer/installer_data.py
  39. +4 −4 src/plugins/grass/scripts/r.external.all.py
@@ -449,7 +449,7 @@ def keyPressEvent(self, e):
return
elif t == '(' and (re.match(r'^[ \t]*def \w+$', txt)
or re.match(r'^[ \t]*class \w+$', txt)):
self.insert('):')
self.insert('):')
else:
self.insert(self.closing[i])
## FIXES #8392 (automatically removes the redundant char
@@ -48,8 +48,8 @@


def moduleInformation():
try:
import qgis.gui
return "qgis.gui", dir(qgis.gui)
except ImportError:
return "", []
try:
import qgis.gui
return "qgis.gui", dir(qgis.gui)
except ImportError:
return "", []
@@ -57,9 +57,9 @@ def initGui(self):
self.action_run = QAction(run_icon, 'MetaSearch',
self.iface.mainWindow())
self.action_run.setWhatsThis(QCoreApplication.translate('MetaSearch',
'MetaSearch plugin'))
'MetaSearch plugin'))
self.action_run.setStatusTip(QCoreApplication.translate('MetaSearch',
'Search Metadata Catalogues'))
'Search Metadata Catalogues'))

self.action_run.triggered.connect(self.run)

@@ -70,9 +70,9 @@ def initGui(self):
help_icon = QIcon('%s/%s' % (self.context.ppath, 'images/help.png'))
self.action_help = QAction(help_icon, 'Help', self.iface.mainWindow())
self.action_help.setWhatsThis(QCoreApplication.translate('MetaSearch',
'MetaSearch plugin help'))
'MetaSearch plugin help'))
self.action_help.setStatusTip(QCoreApplication.translate('MetaSearch',
'Get Help on MetaSearch'))
'Get Help on MetaSearch'))
self.action_help.triggered.connect(self.help)

self.iface.addPluginToWebMenu(self.web_menu, self.action_help)
@@ -50,7 +50,7 @@ def connectionDetails(self):
tbl.append((QApplication.translate("DBManagerPlugin", "Host:"),
self.db.connector.host))
tbl.append((QApplication.translate("DBManagerPlugin", "Database:"),
self.db.connector.dbname))
self.db.connector.dbname))
tbl.append((QApplication.translate("DBManagerPlugin", "User:"),
self.db.connector.user))
tbl.append((QApplication.translate("DBManagerPlugin",
@@ -174,24 +174,24 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):

selFeat = QgsFeature()
while fit.nextFeature(selFeat):
selGeom = selFeat.geometry()
selGeom = selFeat.geometry()

if geom2Eliminate.intersects(selGeom): # we have a candidate
iGeom = geom2Eliminate.intersection(selGeom)
if geom2Eliminate.intersects(selGeom): # we have a candidate
iGeom = geom2Eliminate.intersection(selGeom)

if boundary:
selValue = iGeom.length()
if boundary:
selValue = iGeom.length()
else:
# we need a common boundary
if 0 < iGeom.length():
selValue = selGeom.area()
else:
# we need a common boundary
if 0 < iGeom.length():
selValue = selGeom.area()
else:
selValue = 0

if selValue > max:
max = selValue
mergeWithFid = selFeat.id()
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry
selValue = 0

if selValue > max:
max = selValue
mergeWithFid = selFeat.id()
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry

if mergeWithFid is not None: # a successful candidate
newGeom = mergeWithGeom.combine(geom2Eliminate)
@@ -112,7 +112,7 @@ def closeEvent(self, e):

def keyPressEvent(self, e):
if (e.modifiers() == Qt.ControlModifier or
e.modifiers() == Qt.MetaModifier ) and \
e.modifiers() == Qt.MetaModifier ) and \
e.key() == Qt.Key_C:
items = ""
for row in range(self.tblUnique.rowCount()):
@@ -70,7 +70,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Extraction')
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterVector(self.MASK, self.tr('Mask layer'),
[ParameterVector.VECTOR_TYPE_POLYGON]))
[ParameterVector.VECTOR_TYPE_POLYGON]))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave blank to take the nodata value from input"),
'-9999'))
@@ -48,7 +48,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Miscellaneous')

self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer'),
[ParameterVector.VECTOR_TYPE_ANY], False))
[ParameterVector.VECTOR_TYPE_ANY], False))
self.addParameter(ParameterBoolean(self.SUMMARY_ONLY,
self.tr('Summary output only'),
True))
@@ -52,7 +52,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Miscellaneous')

self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer'),
[ParameterVector.VECTOR_TYPE_ANY], False))
[ParameterVector.VECTOR_TYPE_ANY], False))
self.addParameter(ParameterString(self.SQL, self.tr('SQL'), ''))

self.addParameter(ParameterSelection(
@@ -165,7 +165,7 @@ def getDefaultCellsize(self):
else:
layer = dataobjects.getObjectFromUri(param.value)
cellsize = max(cellsize, (layer.extent().xMaximum()
- layer.extent().xMinimum())
- layer.extent().xMinimum())
/ layer.width())
elif isinstance(param, ParameterMultipleInput):

@@ -200,7 +200,7 @@ def _loadAlgorithms(self):
Catalog(), CloudMetrics(), CanopyMaxima(), CanopyModel(), ClipData(),
Csv2Grid(), Cover(), FilterData(), GridMetrics(), GroundFilter(),
GridSurfaceCreate(), MergeData(), TinSurfaceCreate(), PolyClipData(),
DTM2TIF(), FirstLastReturn(), ASCII2DTM()
DTM2TIF(), FirstLastReturn(), ASCII2DTM()
]
for alg in fusiontools:
alg.group, alg.i18n_group = alg.trAlgorithm('Fusion')
@@ -81,7 +81,7 @@ def processAlgorithm(self, progress):
provider = layer.dataProvider()
fields = provider.fields()
fields.append(QgsField(fieldName, self.TYPES[fieldType], '',
fieldLength, fieldPrecision))
fieldLength, fieldPrecision))
writer = output.getVectorWriter(fields, provider.geometryType(),
layer.crs())
outFeat = QgsFeature()
@@ -94,7 +94,7 @@ def layerExtent(self, layer, writer, progress):
perim = 2 * width + 2 * height

rect = [QgsPoint(minx, miny), QgsPoint(minx, maxy), QgsPoint(maxx,
maxy), QgsPoint(maxx, miny), QgsPoint(minx, miny)]
maxy), QgsPoint(maxx, miny), QgsPoint(minx, miny)]
geometry = QgsGeometry().fromPolygon([rect])
feat = QgsFeature()
feat.setGeometry(geometry)
@@ -131,7 +131,7 @@ def featureExtent(self, layer, writer, progress):
area = width * height
perim = 2 * width + 2 * height
rect = [QgsPoint(minx, miny), QgsPoint(minx, maxy), QgsPoint(maxx,
maxy), QgsPoint(maxx, miny), QgsPoint(minx, miny)]
maxy), QgsPoint(maxx, miny), QgsPoint(minx, miny)]

geometry = QgsGeometry().fromPolygon([rect])
feat.setGeometry(geometry)
@@ -91,7 +91,7 @@ def processAlgorithm(self, progress):
provider = layer.dataProvider()
fields = provider.fields()
fields.append(QgsField(fieldName, self.TYPES[fieldType], '',
fieldLength, fieldPrecision))
fieldLength, fieldPrecision))
writer = output.getVectorWriter(fields, provider.geometryType(),
layer.crs())
outFeat = QgsFeature()
@@ -145,8 +145,8 @@ def linearMatrix(self, inLayer, inField, targetLayer, targetField,
vari += (i - mean) * (i - mean)
vari = math.sqrt(vari / len(distList))
self.writer.addRecord([inID, unicode(mean),
unicode(vari), unicode(min(distList)),
unicode(max(distList))])
unicode(vari), unicode(min(distList)),
unicode(max(distList))])

current += 1
progress.setPercentage(int(current * total))
@@ -97,7 +97,7 @@ def processAlgorithm(self, progress):
outFeat.setGeometry(QgsGeometry.fromWkt(polygon.wkt))
if self.getParameterValue(self.GEOMETRY):
outFeat.setAttributes([None] * fieldsCount + [polygon.area,
polygon.length])
polygon.length])
writer.addFeature(outFeat)
current += 1
progress.setPercentage(50 + int(current * total))
@@ -93,7 +93,7 @@ def processAlgorithm(self, progress):

outFeat.setAttributes(attrs)
outGeom = QgsGeometry(self.convertGeometry(multi_feature,
vType))
vType))
outFeat.setGeometry(outGeom)
writer.addFeature(outFeat)

@@ -63,7 +63,7 @@ def processAlgorithm(self, progress):
self.createHTML(outputFile, values)
self.setOutputValue(self.TOTAL_VALUES, len(values))
self.setOutputValue(self.UNIQUE_VALUES, ';'.join([unicode(v) for v in
values]))
values]))

def createHTML(self, outputFile, algData):
f = codecs.open(outputFile, 'w', encoding='utf-8')
@@ -93,7 +93,7 @@ def processAlgorithm(self, progress):
uniqueSet = Set(item for item in pts)
ids = [pts.index(item) for item in uniqueSet]
sl = voronoi.SiteList([voronoi.Site(i[0], i[1], sitenum=j) for (j,
i) in enumerate(uniqueSet)])
i) in enumerate(uniqueSet)])
voronoi.voronoi(sl, c)
inFeat = QgsFeature()

@@ -223,9 +223,9 @@ def clip_line(x1, y1, x2, y2, w, h, x, y):
)
if x1 or x2 or y1 or y2:
lines.append(QgsPoint(x1 + extent.xMinimum(), y1
+ extent.yMinimum()))
+ extent.yMinimum()))
lines.append(QgsPoint(x2 + extent.xMinimum(), y2
+ extent.yMinimum()))
+ extent.yMinimum()))
if 0 - exX in (x1, x2):
hasXMin = True
if 0 - exY in (y1, y2):
@@ -237,15 +237,15 @@ def clip_line(x1, y1, x2, y2, w, h, x, y):
if hasXMin:
if hasYMax:
lines.append(QgsPoint(extent.xMinimum() - exX, height
+ extent.yMinimum() + exY))
+ extent.yMinimum() + exY))
if hasYMin:
lines.append(QgsPoint(extent.xMinimum() - exX,
extent.yMinimum() - exY))
extent.yMinimum() - exY))
if hasXMax:
if hasYMax:
lines.append(QgsPoint(width + extent.xMinimum() + exX, height
+ extent.yMinimum() + exY))
+ extent.yMinimum() + exY))
if hasYMin:
lines.append(QgsPoint(width + extent.xMinimum() + exX,
extent.yMinimum() - exY))
extent.yMinimum() - exY))
return lines
@@ -295,7 +295,7 @@ def list_geotables(self, schema=None):
def get_table_rows(self, table, schema=None):
c = self.con.cursor()
self._exec_sql(c, 'SELECT COUNT(*) FROM %s' % self._table_name(schema,
table))
table))
return c.fetchone()[0]

def get_table_fields(self, table, schema=None):
@@ -22,23 +22,23 @@
resfeat = QgsFeature()

for feat in processing.features(polyLayer):
progress.setPercentage(int(100 * l / n))
l += 1
progress.setPercentage(int(100 * l / n))
l += 1

g = loads(feat.geometry().asWkb())
g = loads(feat.geometry().asWkb())

if g.geom_type == 'MultiPolygon':
resg = [Polygon(p.exterior,
[r for r in p.interiors if Polygon(r).area > Max_area]) for p in g]
if g.geom_type == 'MultiPolygon':
resg = [Polygon(p.exterior,
[r for r in p.interiors if Polygon(r).area > Max_area]) for p in g]

else:
resg = [Polygon(g.exterior,
[r for r in g.interiors if Polygon(r).area > Max_area])]
else:
resg = [Polygon(g.exterior,
[r for r in g.interiors if Polygon(r).area > Max_area])]

resgeom = QgsGeometry().fromWkt(dumps(MultiPolygon(resg)))
resgeom = QgsGeometry().fromWkt(dumps(MultiPolygon(resg)))

resfeat.setAttributes(feat.attributes())
resfeat.setGeometry(resgeom)
writer.addFeature(resfeat)
resfeat.setAttributes(feat.attributes())
resfeat.setGeometry(resgeom)
writer.addFeature(resfeat)

del writer
@@ -8,8 +8,8 @@

To_keep = int(To_keep)
if To_keep < 1:
progress.setInfo("'To keep' value has been modified to be at least 1.")
To_keep = 1
progress.setInfo("'To keep' value has been modified to be at least 1.")
To_keep = 1


polyLayer = processing.getObject(Polygons)
@@ -20,23 +20,23 @@


for n, feat in enumerate(processing.features(polyLayer)):
progress.setPercentage(int(100 * n / count))
geom = feat.geometry()
if geom.isMultipart():
featres = feat
geoms = geom.asGeometryCollection()
geomarea = [(i, geoms[i].area()) for i in range(len(geoms))]
geomarea.sort(key=itemgetter(1))
if To_keep == 1:
featres.setGeometry(geoms[geomarea[-1][0]])
elif To_keep > len(geoms):
featres.setGeometry(geom)
else:
featres.setGeometry(geom)
geomres = [geoms[i].asPolygon() for i, a in geomarea[-1 * To_keep:]]
featres.setGeometry(QgsGeometry.fromMultiPolygon(geomres))
writer.addFeature(featres)
progress.setPercentage(int(100 * n / count))
geom = feat.geometry()
if geom.isMultipart():
featres = feat
geoms = geom.asGeometryCollection()
geomarea = [(i, geoms[i].area()) for i in range(len(geoms))]
geomarea.sort(key=itemgetter(1))
if To_keep == 1:
featres.setGeometry(geoms[geomarea[-1][0]])
elif To_keep > len(geoms):
featres.setGeometry(geom)
else:
writer.addFeature(feat)
featres.setGeometry(geom)
geomres = [geoms[i].asPolygon() for i, a in geomarea[-1 * To_keep:]]
featres.setGeometry(QgsGeometry.fromMultiPolygon(geomres))
writer.addFeature(featres)
else:
writer.addFeature(feat)

del writer
@@ -342,7 +342,7 @@ def getImportCommands(self):
commands.append(param.name + ' <- read.csv("' + value
+ '", head=TRUE, sep=",")')
elif isinstance(param, (ParameterTableField, ParameterString,
ParameterFile)):
ParameterFile)):
commands.append(param.name + '="' + param.value + '"')
elif isinstance(param, (ParameterNumber, ParameterSelection)):
commands.append(param.name + '=' + unicode(param.value))
@@ -121,7 +121,7 @@ def processAlgorithm(self, progress):
if param.value is None:
continue
if isinstance(param, (ParameterRaster, ParameterVector,
ParameterTable)):
ParameterTable)):
value = param.value
if value in self.exportedLayers.keys():
command += ' -' + param.name + ' "' \
@@ -137,13 +137,13 @@ def initialize():
ProcessingConfig.tr('General'),
ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT,
ProcessingConfig.tr('Default output vector layer extension'), extensions[0],
valuetype=Setting.SELECTION, options=extensions))
valuetype=Setting.SELECTION, options=extensions))
extensions = processing.tools.dataobjects.getSupportedOutputRasterLayerExtensions()
ProcessingConfig.addSetting(Setting(
ProcessingConfig.tr('General'),
ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT,
ProcessingConfig.tr('Default output raster layer extension'), extensions[0],
valuetype=Setting.SELECTION, options=extensions))
valuetype=Setting.SELECTION, options=extensions))

@staticmethod
def setGroupIcon(group, icon):

0 comments on commit cbe8cb7

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