storage quality fixes

This commit is contained in:
lakshyacis 2019-12-24 18:23:48 +05:30
parent 108b231c1c
commit e37d52d950
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
1 changed files with 24 additions and 11 deletions

View File

@ -1,21 +1,22 @@
""" """
src/storage/storage.py Storing inventory items
======================
""" """
import collections import collections
InventoryItem = collections.namedtuple('InventoryItem', 'type stream payload expires tag') InventoryItem = collections.namedtuple(
'InventoryItem', 'type stream payload expires tag')
class Storage(object): class Storage(object): # pylint: disable=too-few-public-methods
"""Base class for storing inventory (extendable for other items to store)""" """Base class for storing inventory
(extendable for other items to store)"""
pass pass
class InventoryStorage(Storage, collections.MutableMapping): class InventoryStorage(Storage, collections.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
self.numberOfInventoryLookupsPerformed = 0 self.numberOfInventoryLookupsPerformed = 0
def __contains__(self, _): def __contains__(self, _):
@ -53,8 +54,20 @@ class InventoryStorage(Storage, collections.MutableMapping):
raise NotImplementedError raise NotImplementedError
class MailboxStorage(Storage, collections.MutableMapping): # pylint: disable=abstract-method class MailboxStorage(Storage, collections.MutableMapping):
"""Method for storing mails""" """Method for storing mails"""
def __init__(self):
# pylint: disable=super-init-not-called def __delitem__(self, key):
pass raise NotImplementedError
def __getitem__(self, key):
raise NotImplementedError
def __iter__(self):
raise NotImplementedError
def __len__(self):
raise NotImplementedError
def __setitem__(self, key, value):
raise NotImplementedError