From 4bc94b7d1508d779a4ede1dbd4d0df72bc001551 Mon Sep 17 00:00:00 2001 From: Stefan Lieberth Date: Fri, 5 Jul 2024 10:44:15 +0200 Subject: [PATCH 1/3] change Iterable --- ancp/client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ancp/client.py b/ancp/client.py index db80a3e..373baa6 100644 --- a/ancp/client.py +++ b/ancp/client.py @@ -14,6 +14,11 @@ import logging import collections +try: + from collections.abc import Iterable +except ImportError: + from collections import Iterable + log = logging.getLogger(__name__) @@ -173,7 +178,7 @@ def port_up(self, subscribers): :param subscriber: collection of ANCP subscribers :type subscriber: [ancp.subscriber.Subscriber] """ - if not isinstance(subscribers, collections.Iterable): + if not isinstance(subscribers, Iterable): subscribers = [subscribers] elif len(subscribers) == 0: raise ValueError("No Subscribers passed") @@ -187,7 +192,7 @@ def port_down(self, subscribers): :param subscriber: collection of ANCP subscribers :type subscriber: [ancp.subscriber.Subscriber] """ - if not isinstance(subscribers, collections.Iterable): + if not isinstance(subscribers, Iterable): subscribers = [subscribers] elif len(subscribers) == 0: raise ValueError("No Subscribers passed") From 51e856ad53d8e5d03e6e425387dfc9948aa761ec Mon Sep 17 00:00:00 2001 From: Stefan Lieberth Date: Fri, 5 Jul 2024 10:54:14 +0200 Subject: [PATCH 2/3] fix Iterable remove collections --- ancp/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ancp/client.py b/ancp/client.py index 373baa6..ad92dff 100644 --- a/ancp/client.py +++ b/ancp/client.py @@ -12,7 +12,7 @@ import struct import socket import logging -import collections +# import collections try: from collections.abc import Iterable From 4082e54bd3a88401f2bf89642de346074dee4a81 Mon Sep 17 00:00:00 2001 From: Stefan Lieberth Date: Fri, 5 Jul 2024 10:56:03 +0200 Subject: [PATCH 3/3] Update client.py --- ancp/client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ancp/client.py b/ancp/client.py index ad92dff..19056ed 100644 --- a/ancp/client.py +++ b/ancp/client.py @@ -12,7 +12,6 @@ import struct import socket import logging -# import collections try: from collections.abc import Iterable