Navigation Menu

Skip to content

Commit

Permalink
qgsfunction: replace deprecated inspect.getargspec() to inspect.getfu…
Browse files Browse the repository at this point in the history
…llargspec()

(cherry picked from commit b830a4a)
  • Loading branch information
jef-n committed Nov 18, 2019
1 parent a48f4c4 commit 354c591
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/core/additions/qgsfunction.py
Expand Up @@ -50,7 +50,7 @@ def myfunc(values, *args):
:param function:
:param arg_count:
:param group:
:param usesgeometry:
:param usesgeometry:
:param handlesnull: Needs to be set to True if this function does not always return NULL if any parameter is NULL. Default False.
:return:
"""
Expand All @@ -75,11 +75,11 @@ def func(self, values, context, parent, node):
if self.expandargs:
values.append(feature)
values.append(parent)
if inspect.getargspec(self.function).args[-1] == 'context':
if inspect.getfullargspec(self.function).args[-1] == 'context':
values.append(context)
return self.function(*values)
else:
if inspect.getargspec(self.function).args[-1] == 'context':
if inspect.getfullargspec(self.function).args[-1] == 'context':
self.function(values, feature, parent, context)
return self.function(values, feature, parent)
except Exception as ex:
Expand All @@ -104,7 +104,7 @@ def handlesNull(self):
if arg_count == "auto":
# Work out the number of args we need.
# Number of function args - 2. The last two args are always feature, parent.
args = inspect.getargspec(function).args
args = inspect.getfullargspec(function).args
number = len(args)
arg_count = number - 2
if args[-1] == 'context':
Expand Down

0 comments on commit 354c591

Please sign in to comment.