Fixed flake8 CQ issues
This commit is contained in:
parent
46e2f04488
commit
7a010441c3
|
@ -4,7 +4,7 @@ Track randomize ordered dict
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from pybitmessage import helper_random
|
import helper_random
|
||||||
|
|
||||||
|
|
||||||
class RandomTrackingDict(object):
|
class RandomTrackingDict(object):
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
"""
|
"""
|
||||||
Module for using filesystem (directory with files) for inventory storage
|
Module for using filesystem (directory with files) for inventory storage
|
||||||
"""
|
"""
|
||||||
|
import logging
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
from binascii import hexlify, unhexlify
|
from binascii import hexlify, unhexlify
|
||||||
from os import listdir, makedirs, path, remove, rmdir
|
from os import listdir, makedirs, path, remove, rmdir
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
|
|
||||||
from debug import logger
|
|
||||||
from paths import lookupAppdataFolder
|
from paths import lookupAppdataFolder
|
||||||
from storage import InventoryItem, InventoryStorage
|
from storage import InventoryItem, InventoryStorage
|
||||||
|
|
||||||
|
logger = logging.getLogger('default')
|
||||||
|
|
||||||
|
|
||||||
class FilesystemInventory(InventoryStorage):
|
class FilesystemInventory(InventoryStorage):
|
||||||
"""Filesystem for inventory storage"""
|
"""Filesystem for inventory storage"""
|
||||||
|
@ -163,7 +165,8 @@ class FilesystemInventory(InventoryStorage):
|
||||||
newInventory[streamNumber][hashId] = InventoryItem(
|
newInventory[streamNumber][hashId] = InventoryItem(
|
||||||
objectType, streamNumber, None, expiresTime, tag)
|
objectType, streamNumber, None, expiresTime, tag)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.warning('error loading %s', hexlify(hashId))
|
logger.debug(
|
||||||
|
'error loading %s', hexlify(hashId), exc_info=True)
|
||||||
self._inventory = newInventory
|
self._inventory = newInventory
|
||||||
# for i, v in self._inventory.items():
|
# for i, v in self._inventory.items():
|
||||||
# print "loaded stream: %s, %i items" % (i, len(v))
|
# print "loaded stream: %s, %i items" % (i, len(v))
|
||||||
|
|
|
@ -46,4 +46,4 @@ class TestRandomTrackingDict(unittest.TestCase):
|
||||||
a.append(time())
|
a.append(time())
|
||||||
|
|
||||||
for x in range(len(a) - 1):
|
for x in range(len(a) - 1):
|
||||||
self.assertLess(a[x + 1] - a[x], 10)
|
self.assertLess(a[x + 1] - a[x], 10)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user