remove inspect.getargspec deprecation warning

In python 3 inspect.getargspec is deprecated and
replaced with inspect.getfullargspec which does not
exist on python 2.7. This change uses six to select
the correct version to use based on the python version
used.

Change-Id: I234a3509ff850d0c5616ebcfa240212b03db9e76
Closes-Bug: #1814288
This commit is contained in:
Sean Mooney 2019-09-17 02:05:19 +01:00
parent 971b9e62df
commit 5d1f322542

View File

@ -141,8 +141,14 @@ class PythonScript(base.BaseScript):
script_func = self._func(funcname) script_func = self._func(funcname)
# check for old way of using engine # check for old way of using engine
if not inspect.getargspec(script_func)[0]: arg_spec = None
raise TypeError("upgrade/downgrade functions must accept engine" if six.PY2:
arg_spec = inspect.getargspec(script_func)
else:
arg_spec = inspect.getfullargspec(script_func)
if not arg_spec[0]:
raise TypeError(
"upgrade/downgrade functions must accept engine"
" parameter (since version 0.5.4)") " parameter (since version 0.5.4)")
script_func(engine) script_func(engine)