Fixed ABC import compatibility for Python 3.8.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 28 Aug 2022 10:49:08 +0000 (12:49 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 28 Aug 2022 10:49:08 +0000 (12:49 +0200)
wrw/proto.py
wrw/sp/cons.py

index a30b8bf..2438c7c 100644 (file)
@@ -1,4 +1,4 @@
-import time, calendar, collections, binascii, base64
+import time, calendar, collections.abc, binascii, base64
 
 statusinfo = {
     400: ("Bad Request", "Invalid HTTP request."),
@@ -210,7 +210,7 @@ def parurl(url, pars={}, **augment):
 def enhex(bs):
     return base64.b16encode(bs).decode("us-ascii")
 def unhex(es):
-    if not isinstance(es, collections.ByteString):
+    if not isinstance(es, collections.abc.ByteString):
         try:
             es = es.encode("us-ascii")
         except UnicodeError:
@@ -219,7 +219,7 @@ def unhex(es):
 def enb32(bs):
     return base64.b32encode(bs).decode("us-ascii")
 def unb32(es):
-    if not isinstance(es, collections.ByteString):
+    if not isinstance(es, collections.abc.ByteString):
         try:
             es = es.encode("us-ascii")
         except UnicodeError:
@@ -231,7 +231,7 @@ def unb32(es):
 def enb64(bs):
     return base64.b64encode(bs).decode("us-ascii")
 def unb64(es):
-    if not isinstance(es, collections.ByteString):
+    if not isinstance(es, collections.abc.ByteString):
         try:
             es = es.encode("us-ascii")
         except UnicodeError:
index d8b30a8..b9437bf 100644 (file)
@@ -1,4 +1,4 @@
-import sys, collections
+import sys, collections.abc
 import xml.dom.minidom
 
 class node(object):
@@ -64,7 +64,7 @@ class context(object):
         new = self.nodefrom(child)
         if new is not None:
             node.children.append(new)
-        elif isinstance(child, collections.Iterable):
+        elif isinstance(child, collections.abc.Iterable):
             for ch in child:
                 self.addchild(node, ch)
         else: