Replace deprecated inspect.getargspec

inspect.getargspec was deprecated since Python 3.0 and
inspect.getfullargspec is its replacement with correct handling of
function annotations and keyword-only parameters[1].

[1] https://docs.python.org/3/library/inspect.html#inspect.getargspec

Change-Id: I2d3591e41ae35479b613487a81c43548c7cd3f9c
This commit is contained in:
wu.shiming 2021-08-13 16:51:31 +08:00
parent a10bf6348c
commit ec2a079753

View File

@ -90,7 +90,7 @@ def validate_args(fn, *args, **kwargs):
:param arg: the positional arguments supplied
:param kwargs: the keyword arguments supplied
"""
argspec = inspect.getargspec(fn)
argspec = inspect.getfullargspec(fn)
num_defaults = len(argspec.defaults or [])
required_args = argspec.args[:len(argspec.args) - num_defaults]