mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1504>
This commit is contained in:
parent
1be6d6ccf5
commit
61eeb866b0
1 changed files with 6 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue