From 590f9d9f4983cafb63b34cab24f3956b59c42ae8 Mon Sep 17 00:00:00 2001 From: Ryan Little Date: Mon, 12 Dec 2022 14:01:49 -0500 Subject: [PATCH] feat(python): update collections import for 3.10 --- flanker/addresslib/drivers/dns_lookup.py | 8 ++++++-- flanker/addresslib/drivers/redis_driver.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/flanker/addresslib/drivers/dns_lookup.py b/flanker/addresslib/drivers/dns_lookup.py index b3625082..349e97f9 100644 --- a/flanker/addresslib/drivers/dns_lookup.py +++ b/flanker/addresslib/drivers/dns_lookup.py @@ -1,8 +1,12 @@ -import collections import dnsq +import sys +if sys.version_info.major == 3 and sys.version_info.minor >= 10: + from collections.abc import MutableMapping +else: + from collections import MutableMapping -class DNSLookup(collections.MutableMapping): +class DNSLookup(MutableMapping): """ DNSLookup has the same interface as a dict, but talks to a DNS server """ diff --git a/flanker/addresslib/drivers/redis_driver.py b/flanker/addresslib/drivers/redis_driver.py index 773b1c3f..16b68d53 100644 --- a/flanker/addresslib/drivers/redis_driver.py +++ b/flanker/addresslib/drivers/redis_driver.py @@ -1,9 +1,13 @@ -import collections import os import redis +import sys +if sys.version_info.major == 3 and sys.version_info.minor >= 10: + from collections.abc import MutableMapping +else: + from collections import MutableMapping -class RedisCache(collections.MutableMapping): +class RedisCache(MutableMapping): """ RedisCache has the same interface as a dict, but talks to a redis server. """