MutableMapping finally moved to collections.abc in py310

This commit is contained in:
Lee Miller 2022-09-20 23:50:28 +03:00
parent e1592a4260
commit 81f574c618
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -1,10 +1,15 @@
""" """
Storing inventory items Storing inventory items
""" """
import collections
InventoryItem = collections.namedtuple( from collections import namedtuple
'InventoryItem', 'type stream payload expires tag') 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 class Storage(object): # pylint: disable=too-few-public-methods
@ -13,7 +18,7 @@ class Storage(object): # pylint: disable=too-few-public-methods
pass pass
class InventoryStorage(Storage, collections.MutableMapping): class InventoryStorage(Storage, MutableMapping):
"""Module used for inventory storage""" """Module used for inventory storage"""
def __init__(self): # pylint: disable=super-init-not-called def __init__(self): # pylint: disable=super-init-not-called
@ -54,7 +59,7 @@ class InventoryStorage(Storage, collections.MutableMapping):
raise NotImplementedError raise NotImplementedError
class MailboxStorage(Storage, collections.MutableMapping): class MailboxStorage(Storage, MutableMapping):
"""Method for storing mails""" """Method for storing mails"""
def __delitem__(self, key): def __delitem__(self, key):