Skip to content

Commit 998efc2

Browse files
committed
Fix lint errors
1 parent cb2868f commit 998efc2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

kafka/admin/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def _refresh_controller_id(self, timeout_ms=30000):
274274
self._controller_id = controller_id
275275
return
276276
else:
277-
raise Errors.NodeNotAvailableError('controller')
277+
raise Errors.NodeNotReadyError('controller')
278278
else:
279279
raise UnrecognizedBrokerVersion(
280280
"Kafka Admin interface cannot determine the controller using MetadataRequest_v{}."

kafka/producer/sender.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def _maybe_send_transactional_request(self):
315315
return True
316316

317317
except Exception as e:
318-
log.warn("%s: Got an exception when trying to find a node to send a transactional request to. Going to back off and retry", str(self), e)
318+
log.warn("%s: Got an exception when trying to find a node to send a transactional request to. Going to back off and retry: %s", str(self), e)
319319
if next_request_handler.needs_coordinator():
320320
self._transaction_manager.lookup_coordinator_for_request(next_request_handler)
321321
break

kafka/producer/transaction_manager.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def transition_to_abortable_error(self, exc):
260260
with self._lock:
261261
if self._current_state == TransactionState.ABORTING_TRANSACTION:
262262
log.debug("Skipping transition to abortable error state since the transaction is already being "
263-
" aborted. Underlying exception: ", exc)
263+
" aborted. Underlying exception: %s", exc)
264264
return
265265
self._transition_to(TransactionState.ABORTABLE_ERROR, error=exc)
266266

@@ -687,7 +687,7 @@ def handle_response(self, response):
687687
if error is Errors.NoError:
688688
continue
689689
elif error in (Errors.CoordinatorNotAvailableError, Errors.NotCoordinatorError):
690-
self.transaction_manager._lookup_coordinator('transaction', self.transactiona_id)
690+
self.transaction_manager._lookup_coordinator('transaction', self.transactional_id)
691691
self.reenqueue()
692692
return
693693
elif error is Errors.ConcurrentTransactionsError:
@@ -726,7 +726,7 @@ def handle_response(self, response):
726726
self.transaction_manager._pending_partitions_in_transaction -= partitions
727727

728728
if unauthorized_topics:
729-
self.abortable_error(Errors.TopicAuthorizationError(unauthorized_topics))
729+
self.abortable_error(Errors.TopicAuthorizationFailedError(unauthorized_topics))
730730
elif has_partition_errors:
731731
self.abortable_error(Errors.KafkaError("Could not add partitions to transaction due to errors: %s" % (results)))
732732
else:
@@ -795,7 +795,7 @@ def handle_response(self, response):
795795
elif error is Errors.TransactionalIdAuthorizationFailedError:
796796
self.fatal_error(error())
797797
elif error is Errors.GroupAuthorizationFailedError:
798-
self.abortable_error(Errors.GroupAuthorizationError(self._coord_key))
798+
self.abortable_error(error(self._coord_key))
799799
else:
800800
self.fatal_error(Errors.KafkaError(
801801
"Could not find a coordinator with type %s with key %s due to"
@@ -888,7 +888,7 @@ def handle_response(self, response):
888888
elif error is Errors.TransactionalIdAuthorizationFailedError:
889889
self.fatal_error(error())
890890
elif error is Errors.GroupAuthorizationFailedError:
891-
self.abortable_error(Errors.GroupAuthorizationError(self.consumer_group_id))
891+
self.abortable_error(error(self.consumer_group_id))
892892
else:
893893
self.fatal_error(Errors.KafkaError("Unexpected error in AddOffsetsToTxnResponse: %s" % (error())))
894894

@@ -955,7 +955,7 @@ def handle_response(self, response):
955955
elif error is Errors.UnknownTopicOrPartitionError:
956956
retriable_failure = True
957957
elif error is Errors.GroupAuthorizationFailedError:
958-
self.abortable_error(Errors.GroupAuthorizationError(self.consumer_group_id))
958+
self.abortable_error(error(self.consumer_group_id))
959959
return
960960
elif error in (Errors.TransactionalIdAuthorizationFailedError,
961961
Errors.InvalidProducerEpochError,

kafka/record/default_records.py

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def _assert_has_codec(self, compression_type):
117117
checker, name = codecs.has_lz4, "lz4"
118118
elif compression_type == self.CODEC_ZSTD:
119119
checker, name = codecs.has_zstd, "zstd"
120+
else:
121+
raise UnsupportedCodecError("Unrecognized compression type: %s" % (compression_type,))
120122
if not checker():
121123
raise UnsupportedCodecError(
122124
"Libraries for {} compression codec not found".format(name))

0 commit comments

Comments
 (0)