Moved multiqueue to network module
This commit is contained in:
parent
27e566140d
commit
6578b5b925
|
@ -2,16 +2,11 @@
|
|||
A queue with multiple internal subqueues.
|
||||
Elements are added into a random subqueue, and retrieval rotates
|
||||
"""
|
||||
|
||||
import random
|
||||
from collections import deque
|
||||
|
||||
from six.moves import queue
|
||||
|
||||
try:
|
||||
import helper_random
|
||||
except ImportError:
|
||||
from . import helper_random
|
||||
|
||||
|
||||
class MultiQueue(queue.Queue):
|
||||
"""A base queue class"""
|
||||
|
@ -38,7 +33,7 @@ class MultiQueue(queue.Queue):
|
|||
# Put a new item in the queue
|
||||
def _put(self, item):
|
||||
# self.queue.append(item)
|
||||
self.queues[helper_random.randomrandrange(self.queueCount)].append(
|
||||
self.queues[random.randrange(self.queueCount)].append( # nosec B311
|
||||
(item))
|
||||
|
||||
# Get an item from the queue
|
|
@ -5,10 +5,9 @@ import time
|
|||
|
||||
from six.moves import queue
|
||||
|
||||
try:
|
||||
from multiqueue import MultiQueue
|
||||
except ImportError:
|
||||
from .multiqueue import MultiQueue
|
||||
|
||||
from network.multiqueue import MultiQueue
|
||||
|
||||
|
||||
|
||||
class ObjectProcessorQueue(queue.Queue):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Test cases for multiqueue"""
|
||||
|
||||
import unittest
|
||||
from pybitmessage.multiqueue import MultiQueue
|
||||
from pybitmessage.network.multiqueue import MultiQueue
|
||||
|
||||
|
||||
class TestMultiQueue(unittest.TestCase):
|
||||
|
|
Reference in New Issue
Block a user