Skip to content

Commit ddb104c

Browse files
committed
admin: list_partition_offsets takes IsolationLevel enum
1 parent bf61df5 commit ddb104c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

kafka/admin/_partitions.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def _list_partition_offsets_process_response(response):
510510
)
511511
return results
512512

513-
async def _async_list_partition_offsets(self, topic_partition_specs, isolation_level='read_uncommitted', timeout_ms=None):
513+
async def _async_list_partition_offsets(self, topic_partition_specs, isolation_level=IsolationLevel.READ_UNCOMMITTED, timeout_ms=None):
514514
isolation_level = IsolationLevel.build_from(isolation_level)
515515
timer = Timer(self._validate_timeout(timeout_ms))
516516
backoff_secs = self.config['retry_backoff_ms'] / 1000
@@ -539,7 +539,7 @@ async def _async_list_partition_offsets(self, topic_partition_specs, isolation_l
539539
await self._net.sleep(min(backoff_secs, max(0.0, timer.timeout_secs or 0.0)))
540540
return results
541541

542-
def list_partition_offsets(self, topic_partition_specs, isolation_level='read_uncommitted', timeout_ms=None):
542+
def list_partition_offsets(self, topic_partition_specs, isolation_level=IsolationLevel.READ_UNCOMMITTED, timeout_ms=None):
543543
"""Look up offsets for the given partitions by spec.
544544
545545
Partitions are routed to their respective leader brokers via cluster
@@ -554,9 +554,8 @@ def list_partition_offsets(self, topic_partition_specs, isolation_level='read_un
554554
wire-level sentinel).
555555
556556
Keyword Arguments:
557-
isolation_level (str, optional): One of ``'read_uncommitted'``
558-
(default) or ``'read_committed'``. ``read_committed`` requires
559-
broker support for ListOffsets v2+.
557+
isolation_level (IsolationLevel, optional): Requires broker support
558+
for ListOffsets v2+. Default: IsolationLevel.READ_UNCOMMITTED.
560559
timeout_ms (int, optional): Maximum time to spend retrying
561560
NotLeaderForPartitionError. Default: ``request_timeout_ms``.
562561

0 commit comments

Comments
 (0)