o
    `j:                     @   s   d dl mZ G dd dZdS )    )TopicPartitionc                   @   s,   e Zd ZdZdZedd Zedd ZdS )DescribeProducerszdescribe-producersz8Describe active producers on a partition (broker >= 2.8)c              	   C   sB   |j ddtddd |j ddtdd	dd
d |j dtd dd d S )Nz-tz--topicTzTopic name.)typerequiredhelpz-pz--partitionappend
partitionszPartition index (repeatable).)r   actiondestr   r   z--broker-idz5Send to this replica instead of the partition leader.)r   defaultr   )add_argumentstrint)clsparser r   m/home/djax/ivt_ai_plugin/venv/lib/python3.10/site-packages/kafka/cli/admin/transactions/describe_producers.pyadd_arguments   s   
zDescribeProducers.add_argumentsc                    s6    fdd j D }|j| jd}dd | D S )Nc                    s   g | ]}t  j|qS r   )r   topic.0pargsr   r   
<listcomp>   s    z-DescribeProducers.command.<locals>.<listcomp>)	broker_idc                 S   s4   i | ]\}}|j  d |j ddd |jD iqS ):active_producersc                 S   s   g | ]}|  qS r   )_asdictr   r   r   r   r      s    z8DescribeProducers.command.<locals>.<dictcomp>.<listcomp>)r   	partitionr   )r   tpstater   r   r   
<dictcomp>   s    z-DescribeProducers.command.<locals>.<dictcomp>)r   describe_producersr   items)r   clientr   tpsresultsr   r   r   command   s
   zDescribeProducers.commandN)__name__
__module____qualname__COMMANDHELPclassmethodr   r(   r   r   r   r   r      s    
r   N)kafka.structsr   r   r   r   r   r   <module>   s    