Import queue from six.moves
This commit is contained in:
		@@ -3,12 +3,10 @@ from __future__ import absolute_import
 | 
				
			|||||||
from collections import namedtuple
 | 
					from collections import namedtuple
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
from multiprocessing import Process, Manager as MPManager
 | 
					from multiprocessing import Process, Manager as MPManager
 | 
				
			||||||
try:
 | 
					 | 
				
			||||||
    import queue # python 3
 | 
					 | 
				
			||||||
except ImportError:
 | 
					 | 
				
			||||||
    import Queue as queue # python 2
 | 
					 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from six.moves import queue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from ..common import KafkaError
 | 
					from ..common import KafkaError
 | 
				
			||||||
from .base import (
 | 
					from .base import (
 | 
				
			||||||
    Consumer,
 | 
					    Consumer,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,14 +5,11 @@ try:
 | 
				
			|||||||
except ImportError:
 | 
					except ImportError:
 | 
				
			||||||
    from itertools import izip_longest as izip_longest, repeat  # pylint: disable=E0611
 | 
					    from itertools import izip_longest as izip_longest, repeat  # pylint: disable=E0611
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
try:
 | 
					 | 
				
			||||||
    import queue # python 3
 | 
					 | 
				
			||||||
except ImportError:
 | 
					 | 
				
			||||||
    import Queue as queue # python 2
 | 
					 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import six
 | 
					import six
 | 
				
			||||||
 | 
					from six.moves import queue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .base import (
 | 
					from .base import (
 | 
				
			||||||
    Consumer,
 | 
					    Consumer,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import collections
 | 
					import collections
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
 | 
					import threading
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from mock import MagicMock, patch
 | 
					from mock import MagicMock, patch
 | 
				
			||||||
@@ -15,15 +16,7 @@ from kafka.common import (
 | 
				
			|||||||
from kafka.producer.base import Producer, _send_upstream
 | 
					from kafka.producer.base import Producer, _send_upstream
 | 
				
			||||||
from kafka.protocol import CODEC_NONE
 | 
					from kafka.protocol import CODEC_NONE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import threading
 | 
					from six.moves import queue, xrange
 | 
				
			||||||
try:
 | 
					 | 
				
			||||||
    from queue import Empty, Queue
 | 
					 | 
				
			||||||
except ImportError:
 | 
					 | 
				
			||||||
    from Queue import Empty, Queue
 | 
					 | 
				
			||||||
try:
 | 
					 | 
				
			||||||
    xrange
 | 
					 | 
				
			||||||
except NameError:
 | 
					 | 
				
			||||||
    xrange = range
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestKafkaProducer(unittest.TestCase):
 | 
					class TestKafkaProducer(unittest.TestCase):
 | 
				
			||||||
@@ -130,7 +123,7 @@ class TestKafkaProducerSendUpstream(unittest.TestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def setUp(self):
 | 
					    def setUp(self):
 | 
				
			||||||
        self.client = MagicMock()
 | 
					        self.client = MagicMock()
 | 
				
			||||||
        self.queue = Queue()
 | 
					        self.queue = queue.Queue()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _run_process(self, retries_limit=3, sleep_timeout=1):
 | 
					    def _run_process(self, retries_limit=3, sleep_timeout=1):
 | 
				
			||||||
        # run _send_upstream process with the queue
 | 
					        # run _send_upstream process with the queue
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user