From 61eeb866b03f147503a10c4aa6546158e15793b3 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Fri, 7 Jan 2022 22:26:16 +0100 Subject: [PATCH] validate: loggable: fix Callable import Since 3.3 importing Callable from collections is deprecated, it should be imported from collections.abc . Since 3.10 the alias has been removed altogether. Part-of: --- subprojects/gst-devtools/validate/launcher/loggable.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-devtools/validate/launcher/loggable.py b/subprojects/gst-devtools/validate/launcher/loggable.py index 404fd69022..1dbad9f910 100644 --- a/subprojects/gst-devtools/validate/launcher/loggable.py +++ b/subprojects/gst-devtools/validate/launcher/loggable.py @@ -16,7 +16,6 @@ # License along with this program; if not, write to the # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301, USA. -import collections import errno import fnmatch import os @@ -27,6 +26,10 @@ import time import traceback import types +try: + from collections.abc import Callable +except ImportError: + from collections import Callable # environment variables controlling levels for each category _DEBUG = "*:1" @@ -765,7 +768,7 @@ def addLogHandler(func): TypeError: When func is not a callable. """ - if not isinstance(func, collections.Callable): + if not isinstance(func, Callable): raise TypeError("func must be callable") if func not in _log_handlers: @@ -787,7 +790,7 @@ def addLimitedLogHandler(func): Raises: TypeError: When func is not a callable. """ - if not isinstance(func, collections.Callable): + if not isinstance(func, Callable): raise TypeError("func must be callable") if func not in _log_handlers_limited: