From fcd6b38bab8517d83e1ed48eef1bca9a9a190f57 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 20 May 2016 11:57:44 +0100 Subject: classes/lib: Complete transition to python3 This patch contains all the other misc pieces of the transition to python3 which didn't make sense to be broken into individual patches. Signed-off-by: Richard Purdie --- meta/lib/oe/maketype.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'meta/lib/oe/maketype.py') diff --git a/meta/lib/oe/maketype.py b/meta/lib/oe/maketype.py index 139f333691..f88981dd90 100644 --- a/meta/lib/oe/maketype.py +++ b/meta/lib/oe/maketype.py @@ -6,7 +6,8 @@ the arguments of the type's factory for details. """ import inspect -import types +import oe.types as types +import collections available_types = {} @@ -53,7 +54,9 @@ def get_callable_args(obj): if type(obj) is type: obj = obj.__init__ - args, varargs, keywords, defaults = inspect.getargspec(obj) + sig = inspect.signature(obj) + args = list(sig.parameters.keys()) + defaults = list(s for s in sig.parameters.keys() if sig.parameters[s].default != inspect.Parameter.empty) flaglist = [] if args: if len(args) > 1 and args[0] == 'self': @@ -93,7 +96,7 @@ for name in dir(types): continue obj = getattr(types, name) - if not callable(obj): + if not isinstance(obj, collections.Callable): continue register(name, obj) -- cgit 1.2.3-korg