Skip to content

Commit 7537d67

Browse files
authored
Fix for removing DeprecationWarning (#105)
* Fix for removing `DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc'`.
1 parent 9b619cd commit 7537d67

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

mocket/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
__all__ = ("mocketize", "Mocket", "MocketEntry", "Mocketizer")
99

10-
__version__ = "3.8.1"
10+
__version__ = "3.8.2"

mocket/compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
PY2 = sys.version_info[0] == 2
1616
if PY2:
17+
import collections as collections_abc
1718
from BaseHTTPServer import BaseHTTPRequestHandler
1819
from urlparse import urlsplit, parse_qs, unquote
1920

@@ -29,6 +30,7 @@ def unquote_utf8(qs):
2930
FileNotFoundError = IOError
3031
BlockingIOError = sock_error
3132
else:
33+
import collections.abc as collections_abc
3234
from http.server import BaseHTTPRequestHandler
3335
from urllib.parse import urlsplit, parse_qs, unquote as unquote_utf8
3436

mocket/mocket.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
JSONDecodeError,
2424
basestring,
2525
byte_type,
26+
collections_abc,
2627
decode_from_bytes,
2728
encode_to_bytes,
2829
text_type,
@@ -543,7 +544,7 @@ def __init__(self, location, responses):
543544
self.location = location
544545
self.response_index = 0
545546

546-
if not isinstance(responses, collections.Iterable) or isinstance(
547+
if not isinstance(responses, collections_abc.Iterable) or isinstance(
547548
responses, basestring
548549
):
549550
responses = [responses]

0 commit comments

Comments
 (0)