Skip to content

Commit bc9b1b6

Browse files
committed
Astyle
1 parent 9239753 commit bc9b1b6

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

python/core/__init__.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import functools
3434
from qgis._core import *
3535

36+
3637
# Boolean evaluation of QgsGeometry
3738

3839

@@ -44,7 +45,8 @@ def _geometryNonZero(self):
4445
QgsGeometry.__bool__ = _geometryNonZero
4546

4647

47-
def register_function(function, arg_count, group, usesgeometry=False, referenced_columns=[QgsFeatureRequest.ALL_ATTRIBUTES], **kwargs):
48+
def register_function(function, arg_count, group, usesgeometry=False,
49+
referenced_columns=[QgsFeatureRequest.ALL_ATTRIBUTES], **kwargs):
4850
"""
4951
Register a Python function to be used as a expression function.
5052
@@ -71,9 +73,11 @@ def myfunc(values, *args):
7173
:param usesgeometry:
7274
:return:
7375
"""
76+
7477
class QgsPyExpressionFunction(QgsExpressionFunction):
7578

76-
def __init__(self, func, name, args, group, helptext='', usesGeometry=True, referencedColumns=QgsFeatureRequest.ALL_ATTRIBUTES, expandargs=False):
79+
def __init__(self, func, name, args, group, helptext='', usesGeometry=True,
80+
referencedColumns=QgsFeatureRequest.ALL_ATTRIBUTES, expandargs=False):
7781
QgsExpressionFunction.__init__(self, name, args, group, helptext)
7882
self.function = func
7983
self.expandargs = expandargs
@@ -126,13 +130,16 @@ def referencedColumns(self, node):
126130
if register and QgsExpression.isFunctionName(name):
127131
if not QgsExpression.unregisterFunction(name):
128132
msgtitle = QCoreApplication.translate("UserExpressions", "User expressions")
129-
msg = QCoreApplication.translate("UserExpressions", "The user expression {0} already exists and could not be unregistered.").format(name)
133+
msg = QCoreApplication.translate("UserExpressions",
134+
"The user expression {0} already exists and could not be unregistered.").format(
135+
name)
130136
QgsMessageLog.logMessage(msg + "\n", msgtitle, QgsMessageLog.WARNING)
131137
return None
132138

133139
function.__name__ = name
134140
helptext = helptemplate.safe_substitute(name=name, doc=helptext)
135-
f = QgsPyExpressionFunction(function, name, arg_count, group, helptext, usesgeometry, referenced_columns, expandargs)
141+
f = QgsPyExpressionFunction(function, name, arg_count, group, helptext, usesgeometry, referenced_columns,
142+
expandargs)
136143

137144
# This doesn't really make any sense here but does when used from a decorator context
138145
# so it can stay.
@@ -163,6 +170,7 @@ def add(values, *args):
163170

164171
def wrapper(func):
165172
return register_function(func, args, group, **kwargs)
173+
166174
return wrapper
167175

168176

@@ -174,6 +182,7 @@ def __init__(self, value):
174182
def __str__(self):
175183
return repr(self.value)
176184

185+
177186
# Define a `with edit(layer)` statement
178187

179188

@@ -268,10 +277,16 @@ def calculation_finished(exception, value=None):
268277

269278
# add some __repr__ methods to processing classes
270279
def processing_source_repr(self):
271-
return "<QgsProcessingFeatureSourceDefinition {{'source':{}, 'selectedFeaturesOnly': {}}}>".format(self.source.staticValue(), self.selectedFeaturesOnly)
280+
return "<QgsProcessingFeatureSourceDefinition {{'source':{}, 'selectedFeaturesOnly': {}}}>".format(
281+
self.source.staticValue(), self.selectedFeaturesOnly)
282+
283+
272284
QgsProcessingFeatureSourceDefinition.__repr__ = processing_source_repr
273285

274286

275287
def processing_output_layer_repr(self):
276-
return "<QgsProcessingOutputLayerDefinition {{'sink':{}, 'createOptions': {}}}>".format(self.sink.staticValue(), self.createOptions)
288+
return "<QgsProcessingOutputLayerDefinition {{'sink':{}, 'createOptions': {}}}>".format(self.sink.staticValue(),
289+
self.createOptions)
290+
291+
277292
QgsProcessingOutputLayerDefinition.__repr__ = processing_output_layer_repr

0 commit comments

Comments
 (0)