Skip to content

Commit f30945f

Browse files
committed
import cleanup
1 parent 552c5d0 commit f30945f

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/confluent_kafka/admin/__init__.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""
1616
Kafka admin client: create, view, alter, and delete topics and resources.
1717
"""
18+
import gc
1819
import warnings
1920
import concurrent.futures
2021
from typing import Any, Dict, List, Optional, Union, Tuple, Set
@@ -135,7 +136,6 @@ def _make_topics_result(f: concurrent.futures.Future, futmap: Dict[str, concurre
135136
Map per-topic results to per-topic futures in futmap.
136137
The result value of each (successful) future is None.
137138
"""
138-
import gc
139139
gc_was_enabled = gc.isenabled()
140140
gc.disable()
141141
try:
@@ -166,7 +166,6 @@ def _make_resource_result(f: concurrent.futures.Future,
166166
Map per-resource results to per-resource futures in futmap.
167167
The result value of each (successful) future is a ConfigResource.
168168
"""
169-
import gc
170169
gc_was_enabled = gc.isenabled()
171170
gc.disable()
172171
try:
@@ -201,7 +200,6 @@ def _make_consumer_groups_result(f: concurrent.futures.Future,
201200
"""
202201
Map per-group results to per-group futures in futmap.
203202
"""
204-
import gc
205203
gc_was_enabled = gc.isenabled()
206204
gc.disable()
207205
try:
@@ -233,8 +231,6 @@ def _make_consumer_group_offsets_result(f: concurrent.futures.Future,
233231
Map per-group results to per-group futures in futmap.
234232
The result value of each (successful) future is ConsumerGroupTopicPartitions.
235233
"""
236-
import gc
237-
238234
# Disable GC during callback to prevent AdminClient destruction from librdkafka thread.
239235
# This callback runs in librdkafka's background thread, and if GC runs here, it may
240236
# try to destroy AdminClient objects, which librdkafka forbids from its own threads.
@@ -271,7 +267,6 @@ def _make_acls_result(f: concurrent.futures.Future, futmap: Dict[Any, concurrent
271267
For create_acls the result value of each (successful) future is None.
272268
For delete_acls the result value of each (successful) future is the list of deleted AclBindings.
273269
"""
274-
import gc
275270
gc_was_enabled = gc.isenabled()
276271
gc.disable()
277272
try:
@@ -299,7 +294,6 @@ def _make_acls_result(f: concurrent.futures.Future, futmap: Dict[Any, concurrent
299294
@staticmethod
300295
def _make_futmap_result_from_list(f: concurrent.futures.Future,
301296
futmap: Dict[Any, concurrent.futures.Future]) -> None:
302-
import gc
303297
gc_was_enabled = gc.isenabled()
304298
gc.disable()
305299
try:
@@ -326,7 +320,6 @@ def _make_futmap_result_from_list(f: concurrent.futures.Future,
326320

327321
@staticmethod
328322
def _make_futmap_result(f: concurrent.futures.Future, futmap: Dict[str, concurrent.futures.Future]) -> None:
329-
import gc
330323
gc_was_enabled = gc.isenabled()
331324
gc.disable()
332325
try:

0 commit comments

Comments
 (0)