From 81f574c618f400ac3ac8e9985efba83ad70625b9 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Tue, 20 Sep 2022 23:50:28 +0300 Subject: [PATCH] MutableMapping finally moved to collections.abc in py310 --- src/storage/storage.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/storage/storage.py b/src/storage/storage.py index 0391979a..e60d7dcb 100644 --- a/src/storage/storage.py +++ b/src/storage/storage.py @@ -1,10 +1,15 @@ """ Storing inventory items """ -import collections -InventoryItem = collections.namedtuple( - 'InventoryItem', 'type stream payload expires tag') +from collections import namedtuple +try: + from collections import MutableMapping # pylint: disable=deprecated-class +except ImportError: + from collections.abc import MutableMapping + + +InventoryItem = namedtuple('InventoryItem', 'type stream payload expires tag') class Storage(object): # pylint: disable=too-few-public-methods @@ -13,7 +18,7 @@ class Storage(object): # pylint: disable=too-few-public-methods pass -class InventoryStorage(Storage, collections.MutableMapping): +class InventoryStorage(Storage, MutableMapping): """Module used for inventory storage""" def __init__(self): # pylint: disable=super-init-not-called @@ -54,7 +59,7 @@ class InventoryStorage(Storage, collections.MutableMapping): raise NotImplementedError -class MailboxStorage(Storage, collections.MutableMapping): +class MailboxStorage(Storage, MutableMapping): """Method for storing mails""" def __delitem__(self, key):