From 32a64f95d486acb4cde1c44c7da45c710a156d24 Mon Sep 17 00:00:00 2001 From: Maksym Balatsko Date: Tue, 19 Sep 2023 10:52:58 +0200 Subject: [PATCH] Fix python 3.11 compatibility issue --- pykalman/tests/test_unscented.py | 4 ++-- pykalman/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pykalman/tests/test_unscented.py b/pykalman/tests/test_unscented.py index 47cf150..d2e6d59 100644 --- a/pykalman/tests/test_unscented.py +++ b/pykalman/tests/test_unscented.py @@ -59,7 +59,7 @@ def check_dims(n_dim_state, n_dim_obs, n_func_args, kf_cls, kwargs): if not 'transition_functions' in kwargs else (len(kwargs['transition_functions']),) ) - assert all([len(inspect.getargspec(f).args) == n_func_args + assert all([len(inspect.getfullargspec(f).args) == n_func_args for f in transition_functions]) assert transition_covariance.shape == (n_dim_state, n_dim_state) assert ( @@ -67,7 +67,7 @@ def check_dims(n_dim_state, n_dim_obs, n_func_args, kf_cls, kwargs): if not 'observation_functions' in kwargs else (len(kwargs['observation_functions']),) ) - assert all([len(inspect.getargspec(f).args) == n_func_args + assert all([len(inspect.getfullargspec(f).args) == n_func_args for f in observation_functions]) assert observation_covariance.shape == (n_dim_obs, n_dim_obs) assert initial_state_mean.shape == (n_dim_state,) diff --git a/pykalman/utils.py b/pykalman/utils.py index 3f6356f..c6a099e 100644 --- a/pykalman/utils.py +++ b/pykalman/utils.py @@ -102,7 +102,7 @@ def get_params(obj): '''Get names and values of all parameters in `obj`'s __init__''' try: # get names of every variable in the argument - args = inspect.getargspec(obj.__init__)[0] + args = inspect.getfullargspec(obj.__init__)[0] args.pop(0) # remove "self" # get values for each of the above in the object