Skip to content

Commit 551813c

Browse files
authored
Merge pull request #258 from mailgun/feat/py310-compatiblity
feat(python): update collections import for 3.10
2 parents 2bb021e + 590f9d9 commit 551813c

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

flanker/addresslib/drivers/dns_lookup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import collections
21
import dnsq
2+
import sys
3+
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
4+
from collections.abc import MutableMapping
5+
else:
6+
from collections import MutableMapping
37

48

5-
class DNSLookup(collections.MutableMapping):
9+
class DNSLookup(MutableMapping):
610
"""
711
DNSLookup has the same interface as a dict, but talks to a DNS server
812
"""

flanker/addresslib/drivers/redis_driver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import collections
21
import os
32
import redis
3+
import sys
44

5+
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
6+
from collections.abc import MutableMapping
7+
else:
8+
from collections import MutableMapping
59

6-
class RedisCache(collections.MutableMapping):
10+
class RedisCache(MutableMapping):
711
"""
812
RedisCache has the same interface as a dict, but talks to a redis server.
913
"""

0 commit comments

Comments
 (0)