Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Formatting update, using newer autopep8 version
  • Loading branch information
nyalldawson committed Jan 29, 2016
1 parent 4a3d3db commit cbe8cb7
Show file tree
Hide file tree
Showing 39 changed files with 128 additions and 128 deletions.
2 changes: 1 addition & 1 deletion python/console/console_sci.py
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions python/custom_widgets/qgis_customwidgets.py
Expand Up @@ -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 "", []
8 changes: 4 additions & 4 deletions python/plugins/MetaSearch/plugin.py
Expand Up @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/oracle/info_model.py
Expand Up @@ -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",
Expand Down
30 changes: 15 additions & 15 deletions python/plugins/fTools/tools/doEliminate.py
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/fTools/tools/doValidate.py
Expand Up @@ -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()):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ClipByMask.py
Expand Up @@ -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'))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ogrinfo.py
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ogrsql.py
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/grass7/nviz7.py
Expand Up @@ -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):

Expand Down
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/AddTableField.py
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/ExtentFromLayer.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/FieldPyculator.py
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/PointDistance.py
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/Polygonize.py
Expand Up @@ -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))
Expand Down
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/UniqueValues.py
Expand Up @@ -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')
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/processing/algs/qgis/VoronoiPolygons.py
Expand Up @@ -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()

Expand Down Expand Up @@ -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):
Expand All @@ -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
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/postgis_utils.py
Expand Up @@ -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):
Expand Down
26 changes: 13 additions & 13 deletions python/plugins/processing/algs/qgis/scripts/Fill_holes.py
Expand Up @@ -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
38 changes: 19 additions & 19 deletions python/plugins/processing/algs/qgis/scripts/Keep_n_biggest_parts.py
Expand Up @@ -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)
Expand All @@ -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
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/r/RAlgorithm.py
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/saga/SagaAlgorithm213.py
Expand Up @@ -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 + ' "' \
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/core/ProcessingConfig.py
Expand Up @@ -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):
Expand Down

0 comments on commit cbe8cb7

Please sign in to comment.