1From 9b939c0b534c1b7958fa0a3c7aedf30bca910431 Mon Sep 17 00:00:00 2001 2From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz> 3Date: Mon, 7 Jun 2021 23:23:47 +0200 4Subject: [PATCH] Python 3.10+ fix: Use collections.abc.Callable instead of 5 collections.Callable 6 7The deprecated aliases to Collections Abstract Base Classes were removed from 8the collections module in Python 3.10. 9https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-0-alpha-5 10https://bugs.python.org/issue37324 11--- 12Upstream-Status: Pending 13 14 slip/dbus/polkit.py | 6 +++--- 15 slip/util/hookable.py | 6 +++--- 16 2 files changed, 6 insertions(+), 6 deletions(-) 17 18diff --git a/slip/dbus/polkit.py b/slip/dbus/polkit.py 19index 128e8ce..320676d 100644 20--- a/slip/dbus/polkit.py 21+++ b/slip/dbus/polkit.py 22@@ -26,7 +26,7 @@ 23 24 from __future__ import absolute_import 25 26-import collections 27+import collections.abc 28 import dbus 29 from decorator import decorator 30 from functools import reduce 31@@ -103,14 +103,14 @@ class MyProxy(object): 32 def some_method(self, ...): 33 ...""" 34 35- assert(func is None or isinstance(func, collections.Callable)) 36+ assert(func is None or isinstance(func, collections.abc.Callable)) 37 38 assert( 39 authfail_result in (None, AUTHFAIL_DONTCATCH) or 40 authfail_exception is None) 41 assert( 42 authfail_callback is None or 43- isinstance(authfail_callback, collections.Callable)) 44+ isinstance(authfail_callback, collections.abc.Callable)) 45 assert( 46 authfail_exception is None or 47 issubclass(authfail_exception, Exception)) 48diff --git a/slip/util/hookable.py b/slip/util/hookable.py 49index 89c7392..0cd9967 100644 50--- a/slip/util/hookable.py 51+++ b/slip/util/hookable.py 52@@ -23,7 +23,7 @@ 53 """This module contains variants of certain base types which call registered 54 hooks on changes.""" 55 56-import collections 57+import collections.abc 58 from six import with_metaclass 59 60 __all__ = ["Hookable", "HookableSet"] 61@@ -67,7 +67,7 @@ class _HookEntry(object): 62 63 def __init__(self, hook, args, kwargs, hookable=None): 64 65- assert(isinstance(hook, collections.Callable)) 66+ assert(isinstance(hook, collections.abc.Callable)) 67 assert(isinstance(hookable, Hookable)) 68 69 for n, x in enumerate(args): 70@@ -174,7 +174,7 @@ def add_hook_hookable(self, hook, *args, **kwargs): 71 self.__add_hook(hook, self, *args, **kwargs) 72 73 def __add_hook(self, hook, _hookable, *args, **kwargs): 74- assert isinstance(hook, collections.Callable) 75+ assert isinstance(hook, collections.abc.Callable) 76 assert isinstance(_hookable, Hookable) 77 hookentry = _HookEntry(hook, args, kwargs, hookable=_hookable) 78 self.__hooks__.add(hookentry) 79