support to compat python 3.11
The python 3.11 has removed long-deprecated inspect methods [1],
use collections.namedtuple to instead
[1]
@@ -19,8 +19,18 @@ import inspect as _inspect
import tensorflow.compat.v2 as tf
+if hasattr(_inspect, "ArgSpec"):
ArgSpec = _inspect.ArgSpec
-
+else:
+ ArgSpec = collections.namedtuple(
+ "ArgSpec",
+ [
+ "args",
+ "varargs",
+ "keywords",
+ "defaults",
+ ],
+ )
if hasattr(_inspect, "FullArgSpec"):
FullArgSpec = _inspect.FullArgSpec
