Moved Multiqueue, invQueue and addrQueue to network module #2256

Merged
anand-skss merged 3 commits from test3 into v0.6 2024-07-06 16:43:51 +02:00
3 changed files with 6 additions and 12 deletions
Showing only changes of commit 6578b5b925 - Show all commits

View File

@ -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

View File

@ -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):

View File

@ -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):