Skip to content

Commit a9ddf15

Browse files
author
Dana Powers
committed
Cleanup imports in kafka/client and kafka/consumer
1 parent 3d4d98e commit a9ddf15

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

kafka/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import functools
55
import logging
66
import time
7-
import kafka.common
87

8+
import kafka.common
99
from kafka.common import (TopicAndPartition, BrokerMetadata,
1010
ConnectionError, FailedPayloadsError,
1111
KafkaTimeoutError, KafkaUnavailableError,

kafka/consumer/multiprocess.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
from __future__ import absolute_import
22

3-
import logging
4-
import time
5-
63
from collections import namedtuple
4+
import logging
75
from multiprocessing import Process, Manager as MPManager
8-
96
try:
10-
from Queue import Empty, Full
11-
except ImportError: # python 2
12-
from queue import Empty, Full
7+
from Queue import Empty, Full # python 3
8+
except ImportError:
9+
from queue import Empty, Full # python 2
10+
import time
1311

1412
from .base import (
13+
Consumer,
1514
AUTO_COMMIT_MSG_COUNT, AUTO_COMMIT_INTERVAL,
1615
NO_MESSAGES_WAIT_TIME_SECONDS,
1716
FULL_QUEUE_WAIT_TIME_SECONDS
1817
)
19-
from .simple import Consumer, SimpleConsumer
18+
from .simple import SimpleConsumer
2019

2120

2221
log = logging.getLogger(__name__)

kafka/consumer/simple.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,18 @@
22

33
try:
44
from itertools import zip_longest as izip_longest, repeat # pylint: disable-msg=E0611
5-
except ImportError: # python 2
6-
from itertools import izip_longest as izip_longest, repeat
5+
except ImportError:
6+
from itertools import izip_longest as izip_longest, repeat # python 2
77
import logging
8+
try:
9+
from Queue import Empty, Queue # python 3
10+
except ImportError:
11+
from queue import Empty, Queue # python 2
12+
import sys
813
import time
914

1015
import six
11-
import sys
12-
13-
try:
14-
from Queue import Empty, Queue
15-
except ImportError: # python 2
16-
from queue import Empty, Queue
1716

18-
from kafka.common import (
19-
FetchRequest, OffsetRequest,
20-
ConsumerFetchSizeTooSmall, ConsumerNoMoreData,
21-
UnknownTopicOrPartitionError, NotLeaderForPartitionError,
22-
OffsetOutOfRangeError, FailedPayloadsError, check_error
23-
)
2417
from .base import (
2518
Consumer,
2619
FETCH_DEFAULT_BLOCK_TIMEOUT,
@@ -33,6 +26,12 @@
3326
ITER_TIMEOUT_SECONDS,
3427
NO_MESSAGES_WAIT_TIME_SECONDS
3528
)
29+
from ..common import (
30+
FetchRequest, OffsetRequest,
31+
ConsumerFetchSizeTooSmall, ConsumerNoMoreData,
32+
UnknownTopicOrPartitionError, NotLeaderForPartitionError,
33+
OffsetOutOfRangeError, FailedPayloadsError, check_error
34+
)
3635

3736

3837
log = logging.getLogger(__name__)

0 commit comments

Comments
 (0)