Skip to content
Permalink
Browse files
prepare-commit.sh: remove trailing blanks from python files
  • Loading branch information
jef-n committed Jan 12, 2013
1 parent 98dad7d commit 762120e08fe50b7ad58dfe3fa20b28642352f4d2
Showing with 287 additions and 286 deletions.
  1. +12 −12 python/plugins/sextante/admintools/ImportIntoPostGIS.py
  2. +2 −2 python/plugins/sextante/algs/AddTableField.py
  3. +14 −14 python/plugins/sextante/algs/FieldPyculator.py
  4. +2 −2 python/plugins/sextante/algs/FieldsCalculator.py
  5. +13 −13 python/plugins/sextante/algs/JoinAttributes.py
  6. +3 −3 python/plugins/sextante/algs/QGISAlgorithmProvider.py
  7. +3 −3 python/plugins/sextante/algs/ftools/BasicStatisticsNumbers.py
  8. +6 −6 python/plugins/sextante/algs/ftools/Buffer.py
  9. +4 −4 python/plugins/sextante/algs/ftools/Centroids.py
  10. +10 −10 python/plugins/sextante/algs/ftools/ConvexHull.py
  11. +2 −2 python/plugins/sextante/algs/ftools/Delaunay.py
  12. +4 −4 python/plugins/sextante/algs/ftools/DensifyGeometries.py
  13. +9 −9 python/plugins/sextante/algs/ftools/DensifyGeometriesInterval.py
  14. +2 −2 python/plugins/sextante/algs/ftools/Difference.py
  15. +2 −2 python/plugins/sextante/algs/ftools/Dissolve.py
  16. +4 −4 python/plugins/sextante/algs/ftools/ExportGeometryInfo.py
  17. +2 −2 python/plugins/sextante/algs/ftools/ExtentFromLayer.py
  18. +2 −2 python/plugins/sextante/algs/ftools/ExtractNodes.py
  19. +2 −2 python/plugins/sextante/algs/ftools/FToolsUtils.py
  20. +2 −2 python/plugins/sextante/algs/ftools/Intersection.py
  21. +1 −1 python/plugins/sextante/algs/ftools/LinesIntersection.py
  22. +3 −3 python/plugins/sextante/algs/ftools/LinesToPolygons.py
  23. +2 −2 python/plugins/sextante/algs/ftools/MultipartToSingleparts.py
  24. +3 −3 python/plugins/sextante/algs/ftools/NearestNeighbourAnalysis.py
  25. +1 −1 python/plugins/sextante/algs/ftools/PointsInPolygon.py
  26. +1 −1 python/plugins/sextante/algs/ftools/PointsInPolygonUnique.py
  27. +1 −1 python/plugins/sextante/algs/ftools/PointsInPolygonWeighted.py
  28. +1 −1 python/plugins/sextante/algs/ftools/PolygonsToLines.py
  29. +1 −1 python/plugins/sextante/algs/ftools/RandomSelection.py
  30. +2 −2 python/plugins/sextante/algs/ftools/ReprojectLayer.py
  31. +8 −8 python/plugins/sextante/algs/ftools/SimplifyGeometries.py
  32. +1 −1 python/plugins/sextante/algs/ftools/SumLines.py
  33. +1 −1 python/plugins/sextante/algs/ftools/ftools_utils.py
  34. +14 −14 python/plugins/sextante/algs/mmqgisx/MMQGISXAlgorithms.py
  35. +30 −30 python/plugins/sextante/algs/mmqgisx/mmqgisx_library.py
  36. +2 −2 python/plugins/sextante/core/QGisLayers.py
  37. +4 −4 python/plugins/sextante/core/SextanteTableWriter.py
  38. +3 −3 python/plugins/sextante/gdal/translate.py
  39. +22 −22 python/plugins/sextante/grass/GrassAlgorithm.py
  40. +4 −5 python/plugins/sextante/grass/ext/HtmlReportPostProcessor.py
  41. +1 −2 python/plugins/sextante/grass/ext/r_coin.py
  42. +2 −3 python/plugins/sextante/grass/ext/r_covar.py
  43. +1 −2 python/plugins/sextante/grass/ext/r_describe.py
  44. +2 −2 python/plugins/sextante/grass/ext/r_info.py
  45. +2 −2 python/plugins/sextante/grass/ext/r_quantile.py
  46. +2 −3 python/plugins/sextante/grass/ext/r_regression_line.py
  47. +1 −2 python/plugins/sextante/grass/ext/v_class.py
  48. +2 −2 python/plugins/sextante/grass/ext/v_info.py
  49. +2 −3 python/plugins/sextante/grass/ext/v_normal.py
  50. +1 −2 python/plugins/sextante/grass/ext/v_report.py
  51. +1 −1 python/plugins/sextante/grass/ext/v_univar.py
  52. +5 −5 python/plugins/sextante/grass/nviz.py
  53. +2 −2 python/plugins/sextante/gui/AlgorithmExecutionDialog.py
  54. +1 −1 python/plugins/sextante/gui/FileSelectionPanel.py
  55. +1 −1 python/plugins/sextante/gui/InputLayerSelectorPanel.py
  56. +4 −4 python/plugins/sextante/modeler/ModelerAlgorithm.py
  57. +15 −15 python/plugins/sextante/modeler/ModelerParameterDefinitionDialog.py
  58. +4 −4 python/plugins/sextante/modeler/ModelerParametersDialog.py
  59. +3 −3 python/plugins/sextante/outputs/OutputTable.py
  60. +1 −1 python/plugins/sextante/parameters/ParameterFile.py
  61. +3 −3 python/plugins/sextante/parameters/ParameterNumber.py
  62. +1 −1 python/plugins/sextante/parameters/ParameterString.py
  63. +1 −1 python/plugins/sextante/saga/SagaAlgorithm.py
  64. +3 −3 scripts/context_help_id.py
  65. +9 −0 scripts/prepare-commit.sh
  66. +12 −12 src/plugins/grass/qgis_grass_test.py
@@ -50,7 +50,7 @@ def getIcon(self):
def processAlgorithm(self, progress):
connection = self.getParameterValue(self.DATABASE)
overwrite = self.getParameterValue(self.OVERWRITE)
createIndex = self.getParameterValue(self.CREATEINDEX)
createIndex = self.getParameterValue(self.CREATEINDEX)
settings = QSettings()
mySettings = "/PostgreSQL/connections/"+ connection
try:
@@ -61,33 +61,33 @@ def processAlgorithm(self, progress):
password = settings.value(mySettings+"/password").toString()
except Exception, e:
raise GeoAlgorithmExecutionException("Wrong database connection name: " + connection)

table = self.getParameterValue(self.TABLENAME);
table.replace(" ", "")
providerName = "postgres"

try:
db = postgis_utils.GeoDB(host=host, port=port, dbname=database, user=username, passwd=password)
except postgis_utils.DbError, e:
raise GeoAlgorithmExecutionException("Couldn't connect to database:\n"+e.message)

uri = QgsDataSourceURI()
uri.setConnection(host, str(port), database, username, password)
uri.setConnection(host, str(port), database, username, password)
uri.setDataSource("public", table, "the_geom", "")

options = {}
if overwrite:
options['overwrite'] = True

layerUri = self.getParameterValue(self.INPUT);
layer = QGisLayers.getObjectFromUri(layerUri)
layerUri = self.getParameterValue(self.INPUT);
layer = QGisLayers.getObjectFromUri(layerUri)
ret, errMsg = QgsVectorLayerImport.importLayer(layer, uri.uri(), providerName, self.crs, False, False, options)
if ret != 0:
raise GeoAlgorithmExecutionException(u"Error importing to PostGIS\n%s" % errMsg)
raise GeoAlgorithmExecutionException(u"Error importing to PostGIS\n%s" % errMsg)

if createIndex:
db.create_spatial_index(table, "public", "the_geom")

db.vacuum_analyze(table, "public")

def defineCharacteristics(self):
@@ -96,10 +96,10 @@ def defineCharacteristics(self):
self.addParameter(ParameterVector(self.INPUT, "Layer to import"))
self.addParameter(ParameterString(self.DATABASE, "Database (connection name)"))
self.addParameter(ParameterString(self.TABLENAME, "Table to import to"))
self.addParameter(ParameterBoolean(self.OVERWRITE, "Overwrite", True))
self.addParameter(ParameterBoolean(self.CREATEINDEX, "Create spatial index", True))
self.addParameter(ParameterBoolean(self.OVERWRITE, "Overwrite", True))
self.addParameter(ParameterBoolean(self.CREATEINDEX, "Create spatial index", True))





@@ -67,12 +67,12 @@ def processAlgorithm(self, progress):
vprovider.select( allAttrs )
fields = vprovider.fields()
fields[len(fields)] = QgsField(fieldname, self.TYPES[fieldtype])
writer = output.getVectorWriter(fields, vprovider.geometryType(), vprovider.crs() )
writer = output.getVectorWriter(fields, vprovider.geometryType(), vprovider.crs() )
outFeat = QgsFeature()
inGeom = QgsGeometry()
nFeat = vprovider.featureCount()
nElement = 0
features = QGisLayers.features(vlayer)
features = QGisLayers.features(vlayer)
for inFeat in features:
progress.setPercentage(int((100 * nElement)/nFeat))
nElement += 1
@@ -53,7 +53,7 @@ class FieldsPyculator(GeoAlgorithm):
def defineCharacteristics(self):
self.name = "Advanced Python field calculator"
self.group = "Vector table tools"
self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterVector(self.INPUT_LAYER, "Input layer", ParameterVector.VECTOR_TYPE_ANY, False))
self.addParameter(ParameterString(self.FIELD_NAME, "Result field name", "NewField"))
self.addParameter(ParameterString(self.GLOBAL, "Global expression", multiline = True))
self.addParameter(ParameterString(self.FORMULA, "Formula", "value = ", multiline = True))
@@ -63,7 +63,7 @@ def defineCharacteristics(self):
def processAlgorithm(self, progress):
fieldname = self.getParameterValue(self.FIELD_NAME)
code = self.getParameterValue(self.FORMULA)
globalExpression = self.getParameterValue(self.GLOBAL)
globalExpression = self.getParameterValue(self.GLOBAL)
output = self.getOutputFromName(self.OUTPUT_LAYER)
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))
vprovider = layer.dataProvider()
@@ -108,40 +108,40 @@ def processAlgorithm(self, progress):
"Field code block can't be executed! %s \n %s"
(unicode(sys.exc_info()[0].__name__), unicode(sys.exc_info()[1])))

#run
#run
if need_attrs:
attr_ind = vprovider.attributeIndexes()
else:
attr_ind = []
vprovider.select(attr_ind, QgsRectangle(), True)

features = QGisLayers.features(layer)
nFeatures = len(features)
nElement = 1
for feat in features:
progress.setPercentage(int((100 * nElement)/nFeatures))
attrMap = feat.attributeMap()
feat_id = feat.id()

#add needed vars
if need_id:
new_ns['__id'] = feat_id

if need_geom:
geom = feat.geometry()
new_ns['__geom'] = geom

if need_attrs:
attr = []
for num,a in attrMap.iteritems():
attr.append(self.Qvar2py(a))
new_ns['__attr'] = attr

#clear old result
if new_ns.has_key(self.RESULT_VAR_NAME):
del new_ns[self.RESULT_VAR_NAME]


#exec
#try:
exec bytecode in new_ns
@@ -154,21 +154,21 @@ def processAlgorithm(self, progress):
# unicode(sys.exc_info()[1]),
# unicode(feat_id)))
#===============================================================

#check result
if not new_ns.has_key(self.RESULT_VAR_NAME):
raise GeoAlgorithmExecutionException("FieldPyculator code execute error\n" +
"Field code block does not return '%s1' variable! Please declare this variable in your code!" %
self.RESULT_VAR_NAME)


#write feature
nElement += 1
outFeat.setGeometry( feat.geometry() )
outFeat.setAttributeMap( attrMap )
outFeat.addAttribute(len(vprovider.fields()), QVariant(new_ns[self.RESULT_VAR_NAME]))
writer.addFeature(outFeat)

del writer


@@ -64,12 +64,12 @@ def processAlgorithm(self, progress):
vprovider.select(allAttrs)
fields = vprovider.fields()
fields[len(fields)] = QgsField(fieldname, QVariant.Double)
writer = output.getVectorWriter(fields, vprovider.geometryType(), vprovider.crs())
writer = output.getVectorWriter(fields, vprovider.geometryType(), vprovider.crs())
outFeat = QgsFeature()
inGeom = QgsGeometry()
nFeat = vprovider.featureCount()
nElement = 0
features = QGisLayers.features(vlayer)
features = QGisLayers.features(vlayer)
for inFeat in features:
progress.setPercentage(int((100 * nElement) / nFeat))
attrs = inFeat.attributeMap()
@@ -35,7 +35,7 @@


class JoinAttributes(GeoAlgorithm):

OUTPUT_LAYER = "OUTPUT_LAYER"
INPUT_LAYER = "INPUT_LAYER"
INPUT_LAYER_2 = "INPUT_LAYER_2"
@@ -56,8 +56,8 @@ def processAlgorithm(self, progress):
input2 = self.getParameterValue(self.INPUT_LAYER_2)
output = self.getOutputFromName(self.OUTPUT_LAYER)
field = self.getParameterValue(self.TABLE_FIELD)
field2 = self.getParameterValue(self.TABLE_FIELD_2)
field2 = self.getParameterValue(self.TABLE_FIELD_2)

# Layer 1
layer = QGisLayers.getObjectFromUri(input)
provider = layer.dataProvider()
@@ -71,36 +71,36 @@ def processAlgorithm(self, progress):
provider2.select(allAttrs)
fields2 = provider2.fields()
join_field2_index = provider2.fieldNameIndex(field2)

# Output
outFields = provider.fields()
for (i, f) in fields2.iteritems():
f.setName("x_" + f.name())
outFields[len(outFields)] = f

writer = output.getVectorWriter(outFields, provider.geometryType(), provider.crs())

inFeat = QgsFeature()
inFeat2 = QgsFeature()
outFeat = QgsFeature()

# Create output vector layer with additional attribute
while provider.nextFeature(inFeat):
inGeom = inFeat.geometry()
atMap = inFeat.attributeMap()
join_value1 = atMap[join_field1_index].toString()
provider2.rewind()
while provider2.nextFeature(inFeat2):
join_value1 = atMap[join_field1_index].toString()
provider2.rewind()
while provider2.nextFeature(inFeat2):
atMap2 = inFeat2.attributeMap()
join_value2 = atMap2[join_field2_index].toString()
join_value2 = atMap2[join_field2_index].toString()
if join_value1 == join_value2:
# create the new feature
outFeat.setGeometry(inGeom)
outFeat.setAttributeMap(atMap)
l = len(provider.fields())
for (i, a) in atMap2.iteritems():
outFeat.addAttribute(l + i, a)

writer.addFeature(outFeat)

del writer
@@ -61,8 +61,8 @@
from sextante.algs.ftools.Union import Union
from sextante.algs.ftools.DensifyGeometriesInterval import DensifyGeometriesInterval
from sextante.algs.mmqgisx.MMQGISXAlgorithms import (mmqgisx_delete_columns_algorithm,
mmqgisx_delete_duplicate_geometries_algorithm,
mmqgisx_geometry_convert_algorithm,
mmqgisx_delete_duplicate_geometries_algorithm,
mmqgisx_geometry_convert_algorithm,
mmqgisx_grid_algorithm, mmqgisx_gridify_algorithm,
mmqgisx_hub_distance_algorithm, mmqgisx_hub_lines_algorithm,
mmqgisx_label_point_algorithm, mmqgisx_merge_algorithm,
@@ -95,7 +95,7 @@ def __init__(self):
# geometry
ExportGeometryInfo(), Centroids(), Delaunay(), VoronoiPolygons(),
SimplifyGeometries(), DensifyGeometries(), DensifyGeometriesInterval(),
MultipartToSingleparts(), SinglePartsToMultiparts(), PolygonsToLines(),
MultipartToSingleparts(), SinglePartsToMultiparts(), PolygonsToLines(),
LinesToPolygons(), ExtractNodes(),
# geoprocessing
ConvexHull(), FixedDistanceBuffer(), VariableDistanceBuffer(),
@@ -93,7 +93,7 @@ def processAlgorithm(self, progress):

index = layer.fieldNameIndex(fieldName)
layer.select([index], QgsRectangle(), False)

cvValue = 0
minValue = 0
maxValue = 0
@@ -104,12 +104,12 @@ def processAlgorithm(self, progress):

isFirst = True
values = []

features = QGisLayers.features(layer)
count = len(features)
total = 100.0 / float(count)
current = 0
for ft in features:
for ft in features:
value = float(ft.attributeMap()[index].toDouble()[0])

if isFirst:
@@ -47,7 +47,7 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
current = 0
features = QGisLayers.features(layer)
total = 100.0 / float(len(features))

# with dissolve
if dissolve:
first = True
@@ -57,7 +57,7 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
value = atMap[field].toDouble()[0]
else:
value = distance

inGeom = QgsGeometry(inFeat.geometry())
try:
outGeom = inGeom.buffer(float(value), segments)
@@ -73,7 +73,7 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
except:
GEOS_EXCEPT = False
continue

current += 1
progress.setPercentage(int(current * total))
try:
@@ -89,7 +89,7 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
value = atMap[field].toDouble()[0]
else:
value = distance

inGeom = QgsGeometry(inFeat.geometry())
try:
outGeom = inGeom.buffer(float(value), segments)
@@ -103,10 +103,10 @@ def buffering(progress, writer, distance, field, useField, layer, dissolve, segm
except:
GEOS_EXCEPT = False
continue

current += 1
progress.setPercentage(int(current * total))

del writer

if not GEOS_EXCEPT:
@@ -55,16 +55,16 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT_LAYER))

writer = self.getOutputFromName(self.OUTPUT_LAYER).getVectorWriter(layer.pendingFields(),
QGis.WKBPoint, layer.dataProvider().crs())

layer.select(layer.pendingAllAttributesList())

outFeat = QgsFeature()

features = QGisLayers.features(layer)
total = 100.0 / float(len(features))
total = 100.0 / float(len(features))
current = 0

for inFeat in features:

0 comments on commit 762120e

Please sign in to comment.