From e827a408591180531fc6c08616941685dd76e7ba Mon Sep 17 00:00:00 2001 From: code8buster Date: Sun, 23 Oct 2022 21:01:18 -0400 Subject: [PATCH 1/2] Python 3.10 quick fixup --- eventdispatcher/dictproperty.py | 3 ++- eventdispatcher/listproperty.py | 1 + eventdispatcher/setproperty.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eventdispatcher/dictproperty.py b/eventdispatcher/dictproperty.py index 14fbf62..856674c 100644 --- a/eventdispatcher/dictproperty.py +++ b/eventdispatcher/dictproperty.py @@ -1,5 +1,6 @@ __author__ = 'calvin' import collections +import collections.abc from future.utils import iteritems, iterkeys, itervalues from functools import partial from . import Property @@ -143,4 +144,4 @@ def __set__(self, obj, value): p['value'].dictionary.update(value) # Assign to the ObservableDict's value for callback in p['callbacks']: if callback(obj, value): - break \ No newline at end of file + break diff --git a/eventdispatcher/listproperty.py b/eventdispatcher/listproperty.py index eb54317..f5e4f0b 100644 --- a/eventdispatcher/listproperty.py +++ b/eventdispatcher/listproperty.py @@ -1,6 +1,7 @@ __author__ = 'calvin' import collections +import collections.abc from functools import partial from copy import copy import numpy as np diff --git a/eventdispatcher/setproperty.py b/eventdispatcher/setproperty.py index 0b414dc..f79f477 100644 --- a/eventdispatcher/setproperty.py +++ b/eventdispatcher/setproperty.py @@ -1,5 +1,6 @@ __author__ = 'calvin' import collections +import collections.abc from functools import partial from . import Property @@ -110,4 +111,4 @@ def __set__(self, obj, value): if do_dispatch: for callback in p['callbacks']: if callback(obj, value): - break \ No newline at end of file + break From 9de9f3361b2c25333b56575e1e9096d7766d1e8c Mon Sep 17 00:00:00 2001 From: code8buster Date: Sun, 23 Oct 2022 21:50:58 -0400 Subject: [PATCH 2/2] more stuff to make it work --- eventdispatcher/dictproperty.py | 2 +- eventdispatcher/listproperty.py | 2 +- eventdispatcher/setproperty.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eventdispatcher/dictproperty.py b/eventdispatcher/dictproperty.py index 856674c..3263b5c 100644 --- a/eventdispatcher/dictproperty.py +++ b/eventdispatcher/dictproperty.py @@ -11,7 +11,7 @@ class __DoesNotExist__: pass -class ObservableDict(collections.MutableMapping): +class ObservableDict(collections.abc.MutableMapping): def __init__(self, dictionary, dispatch_method): self.dictionary = dictionary.copy() diff --git a/eventdispatcher/listproperty.py b/eventdispatcher/listproperty.py index f5e4f0b..8162e87 100644 --- a/eventdispatcher/listproperty.py +++ b/eventdispatcher/listproperty.py @@ -9,7 +9,7 @@ from . import Property -class ObservableList(collections.MutableSequence): +class ObservableList(collections.abc.MutableSequence): def __init__(self, l, dispatch_method, dtype=None): if not type(l) == list and not type(l) == tuple and not isinstance(l, ObservableList): raise ValueError('Observable list must only be initialized with sequences as arguments') diff --git a/eventdispatcher/setproperty.py b/eventdispatcher/setproperty.py index f79f477..1f006d0 100644 --- a/eventdispatcher/setproperty.py +++ b/eventdispatcher/setproperty.py @@ -5,7 +5,7 @@ from . import Property -class ObservableSet(collections.MutableSet): +class ObservableSet(collections.abc.MutableSet): def __init__(self, dictionary, dispatch_method): self.set = dictionary.copy()