
    Ii.                        S SK JrJr  S SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
r
 S SKrS SKJr  S SKJr  S SKJrJrJr  S SKJr  S SKJr  S S	KJr  S S
KJrJrJ r   S SK!J"r"  S SK#J$r$  S SK%J&r&  S SK'J(r(J)r)J*r*J+r+  S SKJ,r,  S SK-J.r.  \R^                  (       a  Sr0\Rb                  " S5      r2 " S S\35      r4 S SKJ5r5   " S S\35      r7 " S S\35      r8g! \ a	    S SKJr   Nf = f! \ a    \6r5 N3f = f)    )absolute_importdivisionN)selectors34)six)ClusterMetadata)BrokerConnectionConnectionStatesget_ip_port_afi)errors)Future)AnonMeasurable)AvgCountRate)TimeUnit)BROKER_API_VERSIONS)MetadataRequest)DictTimer
WeakMethodensure_valid_topic_name)
socketpair)__version__zkafka.clientc                   r   \ rS rSrSr0 SS_S\" 5       _SS\-   _SS	_S
S_SS_SS_SS	_SS_SS_SS_S\R                  \R                  S4/_SS_SS_SS_SS_S S!_0 S"S#_S$S_S%S_S&S_S'S_S(S_S)S_S*S_S+S_S,S_S-S._S/\
R                  _S0S_S1S2_S3S_S4S_S5S_ESS6SSSS7.ErS8 rS9 rS: rS; rS< rSbS= jrS> rS? rS@ rSbSA jrSB rSC rScSD jrSE rSF rSG rSH rSbSI jrSJ rSdSK jr SeSL jr!SM r"SN r#ScSO jr$SP r%SQ r&SR r'SS r(ST r)SU r*SV r+SfSW jr,SX r-SeSY jr.ScSZ jr/S[ r0S\ r1S] r2S^ r3SgS_ jr4S` r5Sar6g)hKafkaClient+   a  
A network client for asynchronous request/response network I/O.

This is an internal class used to implement the user-facing producer and
consumer clients.

This class is not thread-safe!

Attributes:
    cluster (:any:`ClusterMetadata`): Local cache of cluster metadata, retrieved
        via MetadataRequests during :meth:`~kafka.KafkaClient.poll`.

Keyword Arguments:
    bootstrap_servers: 'host[:port]' string (or list of 'host[:port]'
        strings) that the client should contact to bootstrap initial
        cluster metadata. This does not have to be the full node list.
        It just needs to have at least one broker that will respond to a
        Metadata API Request. Default port is 9092. If no servers are
        specified, will default to localhost:9092.
    client_id (str): a name for this client. This string is passed in
        each request to servers and can be used to identify specific
        server-side log entries that correspond to this client. Also
        submitted to GroupCoordinator for logging with respect to
        consumer group administration. Default: 'kafka-python-{version}'
    reconnect_backoff_ms (int): The amount of time in milliseconds to
        wait before attempting to reconnect to a given host.
        Default: 50.
    reconnect_backoff_max_ms (int): The maximum amount of time in
        milliseconds to backoff/wait when reconnecting to a broker that has
        repeatedly failed to connect. If provided, the backoff per host
        will increase exponentially for each consecutive connection
        failure, up to this maximum. Once the maximum is reached,
        reconnection attempts will continue periodically with this fixed
        rate. To avoid connection storms, a randomization factor of 0.2
        will be applied to the backoff resulting in a random range between
        20% below and 20% above the computed value. Default: 30000.
    request_timeout_ms (int): Client request timeout in milliseconds.
        Default: 30000.
    connections_max_idle_ms: Close idle connections after the number of
        milliseconds specified by this config. The broker closes idle
        connections after connections.max.idle.ms, so this avoids hitting
        unexpected socket disconnected errors on the client.
        Default: 540000
    retry_backoff_ms (int): Milliseconds to backoff when retrying on
        errors. Default: 100.
    max_in_flight_requests_per_connection (int): Requests are pipelined
        to kafka brokers up to this number of maximum requests per
        broker connection. Default: 5.
    receive_buffer_bytes (int): The size of the TCP receive buffer
        (SO_RCVBUF) to use when reading data. Default: None (relies on
        system defaults). Java client defaults to 32768.
    send_buffer_bytes (int): The size of the TCP send buffer
        (SO_SNDBUF) to use when sending data. Default: None (relies on
        system defaults). Java client defaults to 131072.
    socket_options (list): List of tuple-arguments to socket.setsockopt
        to apply to broker connection sockets. Default:
        [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]
    metadata_max_age_ms (int): The period of time in milliseconds after
        which we force a refresh of metadata even if we haven't seen any
        partition leadership changes to proactively discover any new
        brokers or partitions. Default: 300000
    allow_auto_create_topics (bool): Enable/disable auto topic creation
        on metadata request. Only available with api_version >= (0, 11).
        Default: True
    security_protocol (str): Protocol used to communicate with brokers.
        Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL.
        Default: PLAINTEXT.
    ssl_context (ssl.SSLContext): Pre-configured SSLContext for wrapping
        socket connections. If provided, all other ssl_* configurations
        will be ignored. Default: None.
    ssl_check_hostname (bool): Flag to configure whether SSL handshake
        should verify that the certificate matches the broker's hostname.
        Default: True.
    ssl_cafile (str): Optional filename of CA file to use in certificate
        verification. Default: None.
    ssl_certfile (str): Optional filename of file in PEM format containing
        the client certificate, as well as any CA certificates needed to
        establish the certificate's authenticity. Default: None.
    ssl_keyfile (str): Optional filename containing the client private key.
        Default: None.
    ssl_password (str): Optional password to be used when loading the
        certificate chain. Default: None.
    ssl_crlfile (str): Optional filename containing the CRL to check for
        certificate expiration. By default, no CRL check is done. When
        providing a file, only the leaf certificate will be checked against
        this CRL. The CRL can only be checked with Python 3.4+ or 2.7.9+.
        Default: None.
    ssl_ciphers (str): optionally set the available ciphers for ssl
        connections. It should be a string in the OpenSSL cipher list
        format. If no cipher can be selected (because compile-time options
        or other configuration forbids use of all the specified ciphers),
        an ssl.SSLError will be raised. See ssl.SSLContext.set_ciphers
    api_version (tuple): Specify which Kafka API version to use. If set to
        None, the client will attempt to determine the broker version via
        ApiVersionsRequest API or, for brokers earlier than 0.10, probing
        various known APIs. Dynamic version checking is performed eagerly
        during __init__ and can raise NoBrokersAvailableError if no connection
        was made before timeout (see api_version_auto_timeout_ms below).
        Different versions enable different functionality.

        Examples:
            (3, 9) most recent broker release, enable all supported features
            (0, 10, 0) enables sasl authentication
            (0, 8, 0) enables basic functionality only

        Default: None
    api_version_auto_timeout_ms (int): number of milliseconds to throw a
        timeout exception from the constructor when checking the broker
        api version. Only applies if api_version set to None.
        Default: 2000
    selector (selectors.BaseSelector): Provide a specific selector
        implementation to use for I/O multiplexing.
        Default: selectors.DefaultSelector
    metrics (kafka.metrics.Metrics): Optionally provide a metrics
        instance for capturing network IO stats. Default: None.
    metric_group_prefix (str): Prefix for metric names. Default: ''
    sasl_mechanism (str): Authentication mechanism when security_protocol
        is configured for SASL_PLAINTEXT or SASL_SSL. Valid values are:
        PLAIN, GSSAPI, OAUTHBEARER, SCRAM-SHA-256, SCRAM-SHA-512.
    sasl_plain_username (str): username for sasl PLAIN and SCRAM authentication.
        Required if sasl_mechanism is PLAIN or one of the SCRAM mechanisms.
    sasl_plain_password (str): password for sasl PLAIN and SCRAM authentication.
        Required if sasl_mechanism is PLAIN or one of the SCRAM mechanisms.
    sasl_kerberos_name (str or gssapi.Name): Constructed gssapi.Name for use with
        sasl mechanism handshake. If provided, sasl_kerberos_service_name and
        sasl_kerberos_domain name are ignored. Default: None.
    sasl_kerberos_service_name (str): Service name to include in GSSAPI
        sasl mechanism handshake. Default: 'kafka'
    sasl_kerberos_domain_name (str): kerberos domain name to use in GSSAPI
        sasl mechanism handshake. Default: one of bootstrap servers
    sasl_oauth_token_provider (kafka.sasl.oauth.AbstractTokenProvider): OAuthBearer
        token provider instance. Default: None
    socks5_proxy (str): Socks5 proxy URL. Default: None
bootstrap_servers	localhostbootstrap_topics_filter	client_idzkafka-python-request_timeout_ms0u  wakeup_timeout_msi  connections_max_idle_msi`= reconnect_backoff_ms2   reconnect_backoff_max_ms%max_in_flight_requests_per_connection   receive_buffer_bytesNsend_buffer_bytessocket_options   sock_chunk_bytesi   sock_chunk_buffer_count  retry_backoff_msd   allow_auto_create_topicsTmetadata_max_age_msi security_protocol	PLAINTEXTssl_contextssl_check_hostname
ssl_cafilessl_certfilessl_keyfilessl_passwordssl_crlfilessl_ciphersapi_versionapi_version_auto_timeout_msi  selectormetricsmetric_group_prefix sasl_mechanismsasl_plain_usernamesasl_plain_passwordkafka)sasl_kerberos_namesasl_kerberos_service_namesasl_kerberos_domain_namesasl_oauth_token_providersocks5_proxyc                    [         R                   " U R                  5      U l        U R                   H  nX!;   d  M
  X   U R                  U'   M     SU l        U R                  S   " 5       U l        U R                  5         [        R                  " 5       U l        [        S0 U R                  D6U l
        [        5       U l        SU l        [        5       U l        S U l        [        5       U l        [        5       U l        SU l        SU l        [        R*                  " 5       U l        [.        R0                  " 5       U l        [5        U R                  S   5      U l        S U l        U R                  S   (       aJ  [;        U R                  S   U R                  S   [<        R>                  " U R                  5      5      U l        U R                  S   c  U RA                  5       U R                  S'   g U R                  S   [B        ;   a  [B        U R                  S      U l        g U R                  S   S-   [B        ;   ao  [D        RG                  S	U R                  S   U R                  S   S-   5        U R                  S   S-   U R                  S'   [B        U R                  S      U l        g S n[I        [B        RJ                  " 5       S
S9 H  nX@R                  S   ::  d  M  Un  O   U(       aA  [D        RG                  SU R                  S   U5        X0R                  S'   [B        U   U l        g [L        RN                  " U R                  S   5      e)NFrA   r   r$   rB   rC   r?   )r   z0Configured api_version %s is ambiguous; using %sT)reversez1Configured api_version %s not supported; using %s )(copyDEFAULT_CONFIGconfig_closed	_selector_init_wakeup_socketpair	threadingLock
_wake_lockr   clusterset_topics_metadata_refresh_in_progressr   _conns_api_versions_connecting_sending_last_bootstrap_bootstrap_failsRLock_lockcollectionsdeque_pending_completionIdleConnectionManager_idle_expiry_manager_sensorsKafkaClientMetricsweakrefproxycheck_versionr   logwarningsortedkeysErrorsUnrecognizedBrokerVersion)selfconfigskeycompatible_versionvs        8/venv/lib/python3.13/site-packages/kafka/client_async.py__init__KafkaClient.__init__   s   ii 3 34;;C~#*<C   Z02$$&#..*&55u-2*f!5  ! !__&

 $/#4#4#6 $9$++F_:`$a!;;y!.t{{9/E/3{{;P/Q/6}}T[[/IKDM
 ;;}%-)-););)=DKK&[['+>>!4T[[5O!PDkk-(4/4GGKKJM2DKK4NQU4UW)-])Cd)JDKK&!4T[[5O!PD!%/446EM22)*& F "O KK68JL-?M*%89K%L"66t{{=7QRR    c                 J   [         R                  " 5       u  U l        U l        U R                  R	                  S5        U R                  R                  U R                  S   S-  5        SU l        U R                  R                  U R                  [        R                  5        g )NFr#        @@)socketr   _wake_r_wake_wsetblocking
settimeoutrS   _wakingrU   register	selectors
EVENT_READrv   s    r{   rV   #KafkaClient._init_wakeup_socketpair  sq    %+%6%6%8"dl  ',? @6 IJi.B.BCr~   c                 >   U R                   b@   U R                  R                  U R                   5        U R                   R                  5         U R                  b  U R                  R                  5         S U l         S U l        g ! [        [        [
        4 a     Ngf = fN)r   rU   
unregisterKeyError
ValueError	TypeErrorcloser   r   s    r{   _close_wakeup_socketpair$KafkaClient._close_wakeup_socketpair#  s|    <<#))$,,7 LL <<#LL  j)4 s   %B BBc                     XR                   ;  a"  U R                  R                  U5      (       a  ggU R                   U   nUR                  5       =(       a    UR	                  5       (       + $ )NTF)r^   rZ   broker_metadatadisconnectedblacked_outrv   node_idconns      r{   _can_connectKafkaClient._can_connect/  sU    ++%||++G44{{7#  "=4+;+;+='==r~   c                 ,   U R                      UR                  [        R                  L a  XR                  ;  a  U R                  R                  U5         U R                  R                  U[        R                  U5        U R                  R                  U5      (       a  [        R                  " 5       U l        GOUR                  [        R                   L a.   U R                  R                  U[        R                  U5        GOoUR                  [        R"                  [        R$                  4;   a.   U R                  R                  U[        R&                  U5        GOUR                  [        R(                  L Gaz  [*        R-                  SU5        XR                  ;   a  U R                  R/                  U5         U R                  R                  U[        R&                  U5        U R0                  (       a$  U R0                  R2                  R5                  5         U R6                  R9                  U5        U R                  R                  U5      (       a'  SU l        U R<                  c  UR<                  U l        GO[?        U R@                  RC                  5       5       HN  nU R                  R                  U5      (       d  M%  U R@                  RE                  U5      RG                  5         MP     GO{UR                  [        RH                  L Ga]  XR                  ;   a  U R                  R/                  U5         U R                  RK                  U5        U R0                  (       a$  U R0                  RN                  R5                  5         SnU R6                  RQ                  U5      (       a  SnU R6                  R/                  U5        XR@                  ;  a  OU R                  R                  U5      (       a  U =R:                  S-  sl        O]URS                  5       (       aH  U RT                  (       d7  U(       d0  [*        RW                  SU5        U R                  RY                  5         S S S 5        g ! [         a/    U R                  R                  U[        R                  U5         GN7f = f! [         a.    U R                  R                  U[        R                  U5         N|f = f! [         a.    U R                  R                  U[        R&                  U5         Nf = f! [         a/    U R                  R                  U[        R&                  U5         GN|f = f! [        [L        4 a     GN!f = f! , (       d  f       g = f)NzNode %s connectedr   FTr-   z0Node %s connection failed -- refreshing metadata)-re   stater	   
CONNECTINGr`   addrU   r   r   EVENT_WRITEr   modifyrZ   is_bootstraptimerb   API_VERSIONS_SENDAPI_VERSIONS_RECVAUTHENTICATINGr   	CONNECTEDrp   debugremoverk   connection_createdrecordrj   updaterc   r_   listr^   rs   popr   DISCONNECTEDr   r   connection_closed
is_expiredconnect_failedrT   rq   request_update)rv   r   sockr   idle_disconnects        r{   _conn_state_changeKafkaClient._conn_state_change7  s   ZZzz-888"2"22$$((1MNN++D)2G2GN <<,,W55+/99;D(/AAAMNN++D)2G2GN  0 B BDTDcDcddLNN++D)2F2FM /999		-w7...$$++G4NNN))$	0D0DdK ==MM44;;=))009<<,,W55,-D)))1-1-?-?* $((8(8(:#;<<44W== KKOOG4::< $<
 /<<<...$$++G4NN--d3 ==MM33::<"',,77@@&*O))009 ++-\\..w77))Q.)((**4<<KK RT[\LL//1[ Z   MNN))$	0E0EtLM   MNN))$	0E0EtLM   LNN))$	0D0DdKL   NNN++D)2F2FMN0 !*- q Zs   AV+R AV+R<0V7+S7"A V+T2.CVA7VU. DV 5R95V8R99V<5S41V3S44V75T/,V.T//V25U+'V*U++V.V>VVV
Vc                     U R                  U5      (       a3  U R                  R                  U5        U(       a  U R                  5         gg)zAQueues a node for asynchronous connection during the next .poll()TF)r   r`   r   wakeup)rv   r   r   s      r{   maybe_connectKafkaClient.maybe_connect  s;    W%%  ) r~   c                 \    XR                   ;  a  gU R                   U   R                  5       $ NF)r^   r   rv   r   s     r{   connection_failedKafkaClient.connection_failed  s'    ++%{{7#2244r~   c                    UR                  5       (       d  gU R                  R                  UR                  5      nUc  g[	        UR
                  5      u  n  nUR
                  U:w  d  UR                  UR                  :w  aM  [        R                  SUR                  UR
                  UR                  UR
                  UR                  5        gg)NFz?Broker metadata change detected for node %s from %s:%s to %s:%sT)	r   rZ   r   r   r
   hostportrp   info)rv   r   brokerr   _s        r{   _should_recycle_connection&KafkaClient._should_recycle_connection  s      "" --dll;>$V[[1
a99		V[[ 8HH ,-1\\499dii[[&++/ r~   c                    U R                      U R                  R                  U5      nUbA  U R                  U5      (       a+  U R                  R	                  U5      R                  5         SnUc  U R                  R                  U5      nUc   [        R                  SU5         SSS5        g[        R                  SXR                  UR                  5        [        UR                  5      u  pEn[        U R                  5      n[        XCR                  U4UUS.U R                   D6nX R                  U'   UR#                  5       (       a  UR%                  5         UR#                  5       (       + sSSS5        $ ! , (       d  f       g= f)zIdempotent non-blocking connection attempt to the given node id.

Returns True if connection object exists and is connected / connecting
Nz$Broker id %s not in current metadataFz)Initiating connection to node %s at %s:%s)state_change_callbackr   )re   r^   getr   r   r   rZ   r   rp   r   r   r   r
   r   r   r   rS   r   connect)rv   r   r   r   r   r   aficbs           r{   _init_connectKafkaClient._init_connect  s4   
 ZZ;;??7+D D$C$CD$I$I(..0|55g>>IIDgN  Z 		E!;;="1&++">C 7 78'kk3 7>@077 +/++7 (,G$  ""((**5 ZZs   BE;.CE;;
F	c                 B    U R                  U5        U R                  XS9$ )a,  Check whether a node is connected and ok to send more requests.

Arguments:
    node_id (int): the id of the node to check
    metadata_priority (bool): Mark node as not-ready if a metadata
        refresh is required. Default: True

Returns:
    bool: True if we are ready to send to the given node
)metadata_priority)r   is_readyrv   r   r   s      r{   readyKafkaClient.ready  s#     	7#}}W}JJr~   c                 `    U R                   R                  U5      nUc  gUR                  5       $ )z)Return True iff the node_id is connected.F)r^   r   	connectedr   s      r{   r   KafkaClient.connected  s)    {{w'<~~r~   c                     U R                   (       d2  SU l         U R                  5         U R                  R                  5         g g )NT)rT   r   rU   r   r   s    r{   _closeKafkaClient._close  s1    ||DL))+NN  " r~   c                    U R                      Ucg  U R                  5         [        U R                  R	                  5       5      nU R                  R                  5         U H  nUR                  5         M     OYXR                  ;   a*  U R                  R                  U5      R                  5         O [        R                  SU5         SSS5        gSSS5        g! , (       d  f       g= f)zjClose one or all broker connections.

Arguments:
    node_id (int, optional): the id of the node to close
Nz6Node %s not found in current connection list; skipping)
re   r   r   r^   valuesclearr   r   rp   rq   )rv   r   connsr   s       r{   r   KafkaClient.close  s     ZZT[[//12!!#!DJJL "KK'(..0TV]^ ZZZs   B;C
C(c                 $    U R                  5         g r   )r   r   s    r{   __del__KafkaClient.__del__  s    r~   c                 `    U R                   R                  U5      nUc  gUR                  5       $ )a  Check whether the node connection has been disconnected or failed.

A disconnected node has either been closed or has failed. Connection
failures are usually transient and can be resumed in the next ready()
call, but there are cases where transient failures need to be caught
and re-acted upon.

Arguments:
    node_id (int): the id of the node to check

Returns:
    bool: True iff the node exists and is disconnected
F)r^   r   r   r   s      r{   is_disconnectedKafkaClient.is_disconnected  s-     {{w'<  ""r~   c                 `    U R                   R                  U5      nUc  gUR                  5       $ )ax  
Return the number of milliseconds to wait, based on the connection
state, before attempting to send data. When connecting or disconnected,
this respects the reconnect backoff time. When connected, returns a very large
number to handle slow/stalled connections.

Arguments:
    node_id (int): The id of the node to check

Returns:
    int: The number of milliseconds to wait.
r   )r^   r   connection_delayr   s      r{   r   KafkaClient.connection_delay  s-     {{w'<$$&&r~   c                 `    U R                   R                  U5      nUc  gUR                  5       $ )z}
Return the number of milliseconds to wait until a broker is no longer throttled.
When disconnected / connecting, returns 0.
r   )r^   r   throttle_delayr   s      r{   r   KafkaClient.throttle_delay"  s-    
 {{w'<""$$r~   c                     U R                  U5      (       d  gU(       a1  U R                  (       a  gU R                  R                  5       S:X  a  gg)a  Check whether a node is ready to send more requests.

In addition to connection-level checks, this method also is used to
block additional requests from being sent during a metadata refresh.

Arguments:
    node_id (int): id of the node to check
    metadata_priority (bool): Mark node as not-ready if a metadata
        refresh is required. Default: True

Returns:
    bool: True if the node is ready and metadata is not refreshing
Fr   T)_can_send_requestr]   rZ   ttlr   s      r{   r   KafkaClient.is_ready,  sD     %%g.. 11||!Q&r~   c                     U R                   R                  U5      nU(       d  gUR                  5       =(       a    UR                  5       $ r   )r^   r   r   can_send_morer   s      r{   r   KafkaClient._can_send_requestF  s5    {{w'~~8D$6$6$88r~   c                    U R                   R                  U5      nU(       a  U R                  U5      (       d<  U R                  XS9  [	        5       R                  [        R                  " U5      5      $ UR                  USUS9nUR                  (       d  U R                  R                  U5        U(       a  U R                  5         U$ )a  Send a request to a specific node. Bytes are placed on an
internal per-connection send-queue. Actual network I/O will be
triggered in a subsequent call to .poll()

Arguments:
    node_id (int): destination node
    request (Struct): request object (not-encoded)

Keyword Arguments:
    wakeup (bool, optional): optional flag to disable thread-wakeup.
    request_timeout_ms (int, optional): Provide custom timeout in milliseconds.
        If response is not processed before timeout, client will fail the
        request and close the connection.
        Default: None (uses value from client configuration)

Raises:
    AssertionError: if node_id is not in current cluster metadata

Returns:
    Future: resolves to Response struct or Error
r   F)blockingr!   )r^   r   r   r   r   failurert   NodeNotReadyErrorsendis_donera   r   r   )rv   r   requestr   r!   r   futures          r{   r   KafkaClient.sendL  s    , {{w'411'::w68##F$<$<W$EFF
 7UGYZ~~MMd#
 KKMr~   c                    [        U[        [        [        S5      45      (       d  [	        S[        U5      -  5      e[        U5      n/ n U R                     U R                  (       a   SSS5        U$ [        U R                  5       HG  nU R                  U5      (       a  M  XPR                  ;   d  M,  U R                  R                  U5        MI     U R                  5       nUb  UR                  (       a  SnOyUb  UR                  OU R                  S   nU R                   R#                  5       n	U R%                  5       n
[&        R)                  SXX5        [+        UUU	U
5      n[-        SU5      nU R/                  US-  5        SSS5        UR1                  U R3                  5       5        Uc   U$ UR                  (       a   U$ Ub  UR4                  (       a   U$ GM  ! , (       d  f       Na= f)a*  Try to read and write to sockets.

This method will also attempt to complete node connections, refresh
stale metadata, and run previously-scheduled tasks.

Arguments:
    timeout_ms (int, optional): maximum amount of time to wait (in ms)
        for at least one response. Must be non-negative. The actual
        timeout will be the minimum of timeout, request timeout and
        metadata timeout. Default: request_timeout_ms
    future (Future, optional): if provided, blocks until future.is_done

Returns:
    list: responses received (can be empty)
NzInvalid type for timeout: %sr   r!   z>Timeouts: user %f, metadata %f, idle connection %f, request %fr0   )
isinstanceintfloattyper   r   re   rT   r   r`   r   r   _maybe_refresh_metadatar   
timeout_msrS   rj   next_check_ms_next_ifr_request_timeout_msrp   r   minmax_pollextend _fire_pending_completed_requestsexpired)rv   r  r   timer	responsesr   metadata_timeout_mstimeoutuser_timeout_msidle_connection_timeout_msr!   s              r{   pollKafkaClient.pollv  s     *sE4:&>??:T*=MMNNj! 	<< ^ U  $D$4$45G  --g66 #&6&66 ,,33G<  6 '+&B&B&D# %&..G:D:Pe&6&6VZVaVabvVwO151J1J1X1X1Z.)-)J)J)L&II^`o  Ga  v!'+2*	,G
 "!WoG

7T>*A H TBBDE ~    'EMMa s   G#4,G#$G#5CG##
G1c                    U R                   (       a  U R                   R                  5       nUR                  c  M:   U R                  R	                  UR                  5      nUR
                  [        R                  -  nU R                  R                  UR                  X2R                  5        U R                   (       a  M  g g ! [         a8    U R                  R                  UR                  [        R                  U5         NVf = fr   )ra   r   _sockrU   get_keyeventsr   r   r   fileobjdatar   r   )rv   r   rx   r  s       r{   _register_send_sockets"KafkaClient._register_send_sockets  s    mm==$$&Dzz!Qnn,,TZZ8i&;&;;%%ckk688D mmm  Q''

I4I4I4PQs   A2C ?DDc                    US:  a  S n[        5       nU R                  5         [        R                  " 5       nU R                  R	                  U5      n[        R                  " 5       nU R
                  (       a*  U R
                  R                  R                  XS-
  S-  5        U GH  u  pgUR                  U R                  L a  U R                  5         M1  U[        R                  -  (       a  UR                  nUR                  5       (       a  UR                  5         OUR!                  5       (       a  UR"                  [        R                  -  (       aM  U R                  R%                  UR                  UR"                  [        R                  -  UR                  5        O%U R                  R'                  UR                  5        U[        R(                  -  (       d  GM?  UR                  nUR+                  U5        UR,                  (       da   UR                  R/                  S5      n	U	(       a  [0        R3                  SU5        UR9                  [:        R<                  " S5      5        GM  U R>                  RA                  URB                  5        U RD                  RG                  UR/                  5       5        GM     U RH                  S   S;   a  U RJ                  RM                  5        Hk  nX;  d  M
  URO                  5       (       d  M!  URP                  RS                  5       (       d  MB  U RD                  RG                  UR/                  5       5        Mm     [T        RV                  " U RJ                  5       Hz  nURY                  5       (       d  M  UR[                  5       n
U
S   S	   U
S   S   -
  S
-  n[0        R3                  SX5        UR9                  [:        R\                  " SU-  5      S9  M|     U R
                  (       a>  U R
                  R^                  R                  [        R                  " 5       U-
  S-  5        U Ra                  5         g ! [4        R6                   a     GN,f = f)Ni  i ʚ;r-   z#Protocol out of sync on %r, closingz,Socket EVENT_READ without in-flight-requestsr5   )SSLSASL_SSLr      r0   z-%s timed out after %s ms. Closing connection.zRequest timed out after %s ms)error)1r[   r  r   rU   selectrk   select_timer   r  r   _clear_wake_fdr   r   r  
connectingr   send_pending_requests_v2r  r   r   r   r   in_flight_requestsrecvrp   rq   r   r$  r   rt   KafkaConnectionErrorrj   r   r   rh   r  rS   r^   r   r   r  pendingr   
itervaluesrequests_timed_outtimed_out_ifrsRequestTimedOutErrorio_time_maybe_close_oldest_connection)rv   r  	processedstart_selectr   
end_selectrx   r  r   unexpected_data	timed_outr  s               r{   r  KafkaClient._poll  s7    WG E	 	##%yy{%%g.YY[
==MM%%,,j.G:-UV KC{{dll*##% 	---xx??$$LLN4466 ::	(=(== NN11 # #

Y-B-B B #*
 !NN55ckkBY11188DMM$**&)kk&6&6q&9O&$I4P 

6667efg%%,,T\\:$$++DIIK8a !f ;;*+/BB**,(T^^-=-=$**BTBTBVBV,,33DIIK@ - NN4;;/D&&(( //1	'l1o	!Q?4G
K .

!<!<3" 
 ! 0 ==MM!!(($))+
*Bj)PQ++-9 || s   8Q  Q87Q8c                    Ub4  U R                   R                  U5      nUc  g[        UR                  5      $ [	        [        U R                   R                  5       5       Vs/ s H  n[        UR                  5      PM     sn5      $ s  snf )a	  Get the number of in-flight requests for a node or all nodes.

Arguments:
    node_id (int, optional): a specific node to check. If unspecified,
        return the total for all nodes

Returns:
    int: pending in-flight requests for the node, or all nodes if None
r   )r^   r   lenr*  sumr   r   r   s      r{   in_flight_request_count#KafkaClient.in_flight_request_count%  s     ;;??7+D|t..//$(););)=$>@$>D D334$>@ A A @s   "Bc                     / n  U R                   R                  5       u  p#UR                  U5        UR	                  U5        MA  ! [         a     U$ f = fr   )rh   popleft
IndexErrorsuccessappend)rv   r  responser   s       r{   r  ,KafkaClient._fire_pending_completed_requests8  se    	 $(#;#;#C#C#E  NN8$X&    s   A 
AAc                 J   U R                   R                  5        Vs/ s H  oR                  PM     nn[        R                  " U5        [        S5      nSnU H  nU R                  R                  U5      nUSL=(       a'    UR                  5       =(       a    UR                  5       nUSL=(       a'    UR                  5       =(       d    UR                  5       nUb  [        UR                  5      OSn	U(       a
  U	S:X  a  Us  $ U(       a  M  X:  d  M  U	nUnM     U$ s  snf )a  Choose the node with fewest outstanding requests, with fallbacks.

This method will prefer a node with an existing connection (not throttled)
with no in-flight-requests. If no such node is found, a node will be chosen
randomly from all nodes that are not throttled or "blacked out" (i.e.,
are not subject to a reconnect backoff). If no node metadata has been
obtained, will return a bootstrap node.

Returns:
    node_id or None if no suitable node was found
infNr   )rZ   brokersnodeIdrandomshuffler  r^   r   r   r   r   	throttledr;  r*  )
rv   r   nodesinflightfoundr   r   r   r   curr_inflights
             r{   least_loaded_nodeKafkaClient.least_loaded_nodeG  s     .2\\-A-A-CD-C6-CDu<G;;??7+DD(VT^^-=V$BTBTBVId*W0@0@0B0VdnnFVK<@<LC 7 78RSM]a/  []%=(  ' Es   D c                     U R                   R                  U5      nUb&  UR                  5       (       a  U R                  U5      $ U R	                  U5      $ r   )r^   r   r   r   r   r   s      r{   _refresh_delay_msKafkaClient._refresh_delay_msh  sH    {{w' 0 0&&w//((11r~   c                     [        U R                  R                  5        Vs/ s H  oR                  UR                  5      PM     sn5      $ s  snf )zReturn connection or throttle delay in milliseconds for next available node.

This method is used primarily for retry/backoff during metadata refresh
during / after a cluster outage, in which there are no available nodes.

Returns:
   float: delay_ms
)r
  rZ   rH  rT  rI  )rv   r   s     r{   least_loaded_node_refresh_ms(KafkaClient.least_loaded_node_refresh_mso  s=     H\H\H^_H^f**6==9H^_``_s   $Ac                     [        U5      R                  U R                  5      (       a  U R                  R	                  5       nO"[        5       R                  [        U5      5      n[        U5      U l        U$ )zSet specific topics to track for metadata.

Arguments:
    topics (list of str): topics to check for metadata

Returns:
    Future: resolves after metadata request/response
)r[   
differencer\   rZ   r   r   rB  )rv   topicsr   s      r{   
set_topicsKafkaClient.set_topicsz  sU     v;!!$,,//\\002FX%%c&k2F6{r~   c                     [        U5        XR                  ;   a,  [        5       R                  [	        U R                  5      5      $ U R                  R                  U5        U R                  R                  5       $ )a0  Add a topic to the list of topics tracked via metadata.

Arguments:
    topic (str): topic to track

Returns:
    Future: resolves after metadata request/response

Raises:
    TypeError: if topic is not a string
    ValueError: if topic is invalid: must be chars (a-zA-Z0-9._-), and less than 250 length
)r   r\   r   rB  r[   r   rZ   r   )rv   topics     r{   	add_topicKafkaClient.add_topic  sW     	 &LL 8##C$566||**,,r~   c                     U R                   (       aG  [        [        R                  " U R                   5       Vs/ s H  oR	                  5       PM     sn5      $ [        S5      $ s  snf )NrG  )r^   r
  r   r.  next_ifr_request_timeout_msr  )rv   r   s     r{   r	  (KafkaClient._next_ifr_request_timeout_ms  sL    ;;s~~VZVaVaGbcGbt88:Gbcdd< ds   A$c                   ^  T R                   R                  5       nT R                  (       a  T R                  S   OSn[	        X#5      nUS:  a  U$ T R                  5       nUc(  T R                  5       n[        R                  SU5        U$ T R                  U5      (       d  T R                  (       a  [        S5      $ T R                  U5      (       a  [        R                  SU5        T R                  R                  U5        T R                  U5      (       d:  UT R                  ;   a  T R                  R                  U5        T R                  S   $ O'T R!                  U5      =(       d    T R                  S   $ T R                  U5      (       Ga  [#        T R$                  5      nU(       d8  T R                   R'                  U5      (       a  [#        T R                  S   5      nT R)                  [*        SS	9nT R                   R,                  (       a  [*        U   R.                  nOU(       d  [*        U   R0                  nUS
:  a  [*        U   " UT R                  S   5      n	O[*        U   " U5      n	[        R                  SX5        T R3                  XYUS9n
U
R5                  T R                   R6                  5        U
R9                  T R                   R:                  5        ST l        U 4S jnU
R5                  U5        U
R9                  U5        T R                  S   $ T R                  (       a  [        S5      $ T R                  S   $ )zXSend a metadata request if needed.

Returns:
    float: milliseconds until next refresh
r!   r   zTGive up sending metadata request since no node is available. (reconnect delay %d ms)rG  z7Initializing connection to node %s for metadata requestr%   r      )max_version   r3   z&Sending metadata request %s to node %sr   Tc                    > STl         g r   )r]   )val_or_errorrv   s    r{   refresh_done9KafkaClient._maybe_refresh_metadata.<locals>.refresh_done  s    5:2r~   )rZ   r   r]   rS   r  rQ  rW  rp   r   r   r`   r  r   r   r   r   r   r   r\   r   r?   r   need_all_topic_metadata
ALL_TOPICS	NO_TOPICSr   add_callbackupdate_metadataadd_errbackfailed_update)rv   r   r   wait_for_in_progress_msmetadata_timeoutr   next_connect_msr[  r?   r   r   rk  s   `           r{   r  #KafkaClient._maybe_refresh_metadata  s    ll GKGiGi$++.B"Cops<a##
 ((*?"??AOIIln}~""%%g.. U|#""7++		SU\]  $$W-))'22$"2"22((//8;;'=>>	 3 **73Xt{{CW7XX !!'**$,,'Fdll77@@dkk*CDE**?*JK||33(5@@(5??a)+6vt{{Ke?fg)+6v>II>QYYwY?F < <=t||99:15D.;-|,;;344 <;;566r~   c                     U R                   $ )zReturn the ApiVersions map, if available.

Note: Only available after bootstrap; requires broker version 0.10.0 or later.

Returns: a map of dict mapping {api_key : (min_version, max_version)},
or None if ApiVersion is not supported by the kafka cluster.
)r_   r   s    r{   get_api_versionsKafkaClient.get_api_versions  s     !!!r~   c                 z   U=(       d    U R                   S   S-  nU R                     [        R                  " 5       U-   n[        R                  " 5       U:  Ga#  [        U[        R                  " 5       -
  S5      nUbP  U R	                  U5      S:  a;  [        XPR	                  U5      S-  5      nUS:  a  [        R                  " U5        M  U=(       d    U R                  5       nUcP  [        XPR                  5       S-  5      nUS:  a,  [        R                  SU5        [        R                  " U5        M  [        R                  SU5        U R                  U5      (       d!  Xq:X  a  [        R                  " SU-  5      eGMH  U R                  U   nUR!                  5       (       a}  [        R                  " 5       U:  ad  [        U[        R                  " 5       -
  S-  S	5      n	U R#                  U	S
9  UR!                  5       (       a  [        R                  " 5       U:  a  Md  UR$                  b  UR$                  sSSS5        $ [        R                  SU5        [        R                  " 5       U:  a  GM#  Ub  [        R                  " U5      e[        R&                  " 5       e! , (       d  f       g= f)ap  Attempt to guess the version of a Kafka broker.

Keyword Arguments:
    node_id (str, optional): Broker node id from cluster metadata. If None, attempts
        to connect to any available broker until version is identified.
        Default: None
    timeout (num, optional): Maximum time in seconds to try to check broker version.
        If unable to identify version before timeout, raise error (see below).
        Default: api_version_auto_timeout_ms / 1000

Returns: version tuple, i.e. (3, 9), (2, 0), (0, 10, 2) etc

Raises:
    NodeNotReadyError (if node_id is provided)
    NoBrokersAvailable (if node_id is None)
r@   r0   r   Nr   z:No node available during check_version; sleeping %.2f secsz(Attempting to check version with node %szConnection failed to %s   r  z=Failed to identify api_version after connection attempt to %s)rS   re   r   r  r   r
  sleeprQ  rW  rp   rq   r   r   rt   r   r^   r(  r  _api_versionNoBrokersAvailable)
rv   r   r  kwargsendtime_remaining
sleep_timetry_noder   r  s
             r{   ro   KafkaClient.check_version  s   " Pdkk*GH4OZZ))+'C))+#!$S499;%6!:&4+@+@+IA+M!$^5J5J75SV\5\!]J!A~

:.">d&<&<&>#!$^6W6W6Y\b6b!cJ!A~$`blm

:.		DhO))(33*$667PSZ7Z[[ {{8,oo''DIIK#,=!$cDIIK&74%?!EJIII4 oo''DIIK#,= $$0,,; Z> II]_cd; ))+#B & 227;; 3355M Zs   H J,*J,/J,>.J,,
J:c                    [        [        U5      S-
  Ub  UO
[        S5      5      nU R                  nUS   R                  nUb  XC;  a2  [
        R                  " SR                  US   R                  5      5      eX4   u  pV[        X&5      nXu:  a2  [
        R                  " SR                  US   R                  5      5      eU$ )a^  Find the latest version of the protocol operation supported by both
this library and the broker.

This resolves to the lesser of either the latest api version this
library supports, or the max version supported by the broker.

Arguments:
    operation: A list of protocol operation versions from kafka.protocol.

Keyword Arguments:
    max_version (int, optional): Provide an alternate maximum api version
        to reflect limitations in user code.

Returns:
    int: The highest api version number compatible between client and broker.

Raises: IncompatibleBrokerVersion if no matching version is found
r-   rG  r   z6Kafka broker does not support the '{}' Kafka protocol.zQNo version of the '{}' Kafka protocol is supported by both the client and broker.)	r
  r;  r  r_   API_KEYrt   IncompatibleBrokerVersionformat__name__)rv   	operationrg  broker_api_versionsapi_keybroker_min_versionbroker_max_versionversions           r{   r?   KafkaClient.api_version4  s    ( #i.1,[=TkZ_`eZfg"00A,&&&'*L22H	!--.0 0 2E1M.k6' 22c	!--.0 0 r~   c                    U R                   (       d  U R                  (       d  U R                  c  g U R                      U R                  R	                  S5        SU l         S S S 5        g ! [
        R                   a0  n[        R                  S5        [        R                  " U5      eS nAf[
        R                   a  n[        R                  SU5        UeS nAff = f! , (       d  f       g = f)N   xTz!Timeout to send to wakeup socket!z#Unable to send to wakeup socket! %s)rT   r   r   rY   sendallr   r  rp   rq   rt   KafkaTimeoutErrorr$  )rv   es     r{   r   KafkaClient.wakeupY  s    <<4<<4<<+?__$$T*# _ >> 2?@..q11<< A1E _s4   C!"A++C?+B**CCCC!!
C/c                 J   U R                      SU l          U R                  R                  S5      (       d6  [        R                  S5        U R                  5         U R                  5         O MZ  S S S 5        g ! [        R                   a     M   f = f! , (       d  f       g = f)NFi   z3Error reading wakeup socket. Rebuilding socketpair.)
rY   r   r   r+  rp   rq   r   rV   r   r$  r   s    r{   r'  KafkaClient._clear_wake_fdg  s    __ DL	<<,,T22$YZ557446 3  _ ||  _s/   	BAA9,B9BBBB
B"c                     U R                   R                  5       nU(       aE  Uu  p#[        R                  " 5       U-
  S-  n[        R	                  SX$5        U R                  US9  g g )Nr0   z1Closing idle connection %s, last active %d ms ago)r   )rj   poll_expired_connectionr   rp   r   r   )rv   expired_connectionconn_idtsidle_mss        r{   r3  *KafkaClient._maybe_close_oldest_connectionw  sX    !66NNP,KGyy{R'4/GHHH'[JJwJ'	 r~   c                     U R                    HI  nU R                  R                  U5      (       d  M%  U R                   U   R                  5       (       d  MI    g   g)z,Return True if a bootstrap node is connectedTF)r^   rZ   r   r   r   s     r{   bootstrap_connectedKafkaClient.bootstrap_connected  sH    {{G<<,,W55{{7#--//	 # r~   c                    [        U5      nU R                  SS9  U R                  U5      (       a  gU R                  U5      (       d  UR                  (       d  U R	                  U5      (       a  [
        R                  " SU< S35      eU R                  U5        U R                  UR                  S9  U R                  U5      (       d  UR                  (       d  M  U R                  U5      $ )a  
Invokes `poll` to discard pending disconnects, followed by `client.ready` and 0 or more `client.poll`
invocations until the connection to `node` is ready, the timeoutMs expires or the connection fails.

It returns `true` if the call completes normally or `false` if the timeoutMs expires. If the connection fails,
an `IOException` is thrown instead. Note that if the `NetworkClient` has been configured with a positive
connection timeoutMs, it is possible for this method to raise an `IOException` for a previous connection which
has recently disconnected.

This method is useful for implementing blocking behaviour on top of the non-blocking `NetworkClient`, use it with
care.
r   r}  TzConnection to z failed.)	r   r  r   r  r   rt   r,  r   r  )rv   r   r  r  s       r{   await_readyKafkaClient.await_ready  s     j!		Q	==!!--((%%g..11PW2YZZw'II!1!1I2	 --((
 }}W%%r~   c                     U R                  X5      nU R                  US9  UR                  (       d   eUR                  5       (       a  UR                  eUR
                  $ )N)r   )r   r  r   failed	exceptionvalue)rv   r   r   r   s       r{   send_and_receiveKafkaClient.send_and_receive  sK    7,			 ~~~==??"""||r~   )r_   rc   rT   r`   r^   rj   rb   re   r]   rh   rU   ra   rk   r\   rY   r   r   r   rZ   rS   )Tr   )TN)NN)F)r"   )7r  
__module____qualname____firstlineno____doc__r[   r   r   IPPROTO_TCPTCP_NODELAYr   DefaultSelectorrR   r|   rV   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r=  r  rQ  rT  rW  r\  r`  r	  r  ry  ro   r?   r   r'  r3  r  r  r  __static_attributes__rP   r~   r{   r   r   +   s   EN([(!35( 	_{2( 	e	(
 	T( 	"=( 	( 	#E( 	0( 	( 	T( 	F..0B0BAFG( 	D( 	"4( 	C(  	#D!(" 	v#($ 	[%(& 	t'(( 	d)(* 	d+(, 	-(. 	t/(0 	1(2 	t3(4 	t5(6 	t7(8 	&t9(: 	I--;(< 	4=(> 	r?(@ 	$A(B 	tC(D 	tE(F #&-%)%)O(NT=S~D
>N2`
5
&+BK #&#&'$%49(TFP
QY.vA&B2	a -* H7T"86t#J (&2r~   r   )OrderedDictc                   >    \ rS rSrS rS rS rS rS rS r	S r
S	rg
)ri   i  c                     US:  a  US-  U l         O[        S5      U l         S U l        U R                  [        R                  " 5       5        [        5       U l        g )Nr   r0   rG  )connections_max_idler  next_idle_close_check_time!update_next_idle_close_check_timer   r  lru_connections)rv   r$   s     r{   r|   IdleConnectionManager.__init__  sI    "Q&(?$(FD%(-eD%*.'..tyy{;*}r~   c                     XR                   ;   a  U R                   U	 [        R                  " 5       U R                   U'   g r   )r  r   rv   r  s     r{   r   IdleConnectionManager.update  s2    ***$$W-(,		W%r~   c                 >    XR                   ;   a  U R                   U	 g g r   )r  r  s     r{   r   IdleConnectionManager.remove  s!    ***$$W- +r~   c                     XR                   ;  a  g [        R                  " 5       U R                   U   U R                  -   :  $ r   )r  r   r  r  s     r{   r    IdleConnectionManager.is_expired  s8    ...yy{d227;d>W>WWWWr~   c                     [         R                   " 5       nU R                  (       a  U R                  [        S5      :X  a  [        S5      $ U R                  U::  a  g[	        U R                  U-
  S-  5      $ )NrG  r   r0   )r   r  r  r  r  )rv   nows     r{   r  #IdleConnectionManager.next_check_ms  s^    iik##t'F'F%PU,'V<,,377#=EFFr~   c                 *    XR                   -   U l        g r   )r  r  )rv   r  s     r{   r  7IdleConnectionManager.update_next_idle_close_check_time  s    *,/H/H*H'r~   c                    [         R                   " 5       U R                  :  a  g [        U R                  5      (       d  g S nS n[        [
        L a2  U R                  R                  5        H  u  p4Ub  XB:  d  M  UnUnM     O.[        [        U R                  R                  5       5      5      u  pU R                  U5        [         R                   " 5       X R                  -   :  a  X4$ g r   )r   r  r;  r  r  dictitemsnextiterr  r  )rv   oldest_conn_id	oldest_tsr  r  s        r{   r  -IdleConnectionManager.poll_expired_connection  s    99;8884''((	$#3399;!)R^%,N "I  <
 +/tD4H4H4N4N4P/Q*R'^..y999;)&?&???"..r~   )r  r  r  N)r  r  r  r  r|   r   r   r   r  r  r  r  rP   r~   r{   ri   ri     s(    -4.X
GIr~   ri   c                       \ rS rSrS rSrg)rl   i  c                   ^ Xl         US-   U l        UR                  S5      U l        U R                  R	                  UR                  SU R                  S5      [        5       5        UR                  S5      U l        U R                  R	                  UR                  SU R                  S5      [        5       5        UR                  S5      U l        U R                  R	                  UR                  S	U R                  S
5      [        [        5       S95        U R                  R	                  UR                  SU R                  S5      [        5       5        U R                  R	                  UR                  SU R                  S5      [        [        R                  S95        UR                  S5      U l        U R                  R	                  UR                  SU R                  S5      [        5       5        U R                  R	                  UR                  SU R                  S5      [        [        R                  S95        UR                  UR                  SU R                  S5      [        U4S j5      5        g )Nz-metricszconnections-closedzconnection-close-ratez,Connections closed per second in the window.zconnections-createdzconnection-creation-ratez5New connections established per second in the window.zselect-timezselect-ratezGNumber of times the I/O layer checked for new I/O to perform per second)sampled_statzio-wait-time-ns-avgznThe average length of time the I/O thread spent waiting for a socket ready for reads or writes in nanoseconds.zio-wait-ratioz2The fraction of time the I/O thread spent waiting.)	time_unitzio-timezio-time-ns-avgzBThe average length of time for I/O per select call in nanoseconds.zio-ratioz3The fraction of time the I/O thread spent doing I/Ozconnection-countz)The current number of active connections.c                    > [        T5      $ r   )r;  )rS   r  r   s     r{   <lambda>-KafkaClientMetrics.__init__.<locals>.<lambda>  s	    CJr~   )rB   metric_group_namesensorr   r   metric_namer   r   r&  r   r   r   NANOSECONDSr2  
add_metricr   )rv   rB   rC   r   s      `r{   r|   KafkaClientMetrics.__init__  s4   !4z!A!(0D!E""7#6#6#T%;%;:$<=AV	E #*..1F"G##G$7$7&(>(>C%EFJf	N #>>-8W00411 %'2	4 	W00!4#9#9@A CF%	I 	W00T33@B 8//0	2
 ~~i0,,d44PR E	 	,,..AC 8//0	2
 	7.. 6 679:H.;0	1r~   )r   r   r2  r  rB   r&  N)r  r  r  r  r|   r  rP   r~   r{   rl   rl     s    (1r~   rl   )9
__future__r   r   rf   rQ   loggingrJ  r   rW   r   rm   r   ImportErrorkafka.vendorr   r   kafka.clusterr   
kafka.connr   r	   r
   rH   r   rt   kafka.futurer   kafka.metricsr   kafka.metrics.statsr   r   r   kafka.metrics.stats.rater   "kafka.protocol.broker_api_versionsr   kafka.protocol.metadatar   
kafka.utilr   r   r   r   r   kafka.versionr   PY2ConnectionError	getLoggerrp   objectr   r  r  ri   rl   rP   r~   r{   <module>r     s    0        6
  ) J J "  ( 0 0 - B 3 G G $ %77O '}& }B$';F ;|)1 )1E'  656~$  Ks#   C ;C* C'&C'*C54C5