Ë
    Ü_ËiÌû  ã                  ó^  — d Z ddlmZ ddlZddlmZmZ ddlmZm	Z	m
Z
mZmZ ddlmZ ddlmZmZ ddlmZmZ dd	lmZmZ erdd
lmZ ddlmZ ddlmZ  edd«      Z eg g g g g «      Z G d„ d«      Z G d„ de«      Z  G d„ de«      Z! G d„ de«      Z" G d„ de«      Z# G d„ de«      Z$dcd„Z%	 	 	 	 	 	 ddd„Z&ded„Z'dfd„Z( G d„ d «      Z) G d!„ d"e)«      Z* G d#„ d$e)«      Z+ G d%„ d&e)«      Z, G d'„ d(«      Z- G d)„ d*e-«      Z. G d+„ d,e-«      Z/ G d-„ d.e-«      Z0 G d/„ d0e-«      Z1 G d1„ d2«      Z2 G d3„ d4«      Z3 G d5„ d6«      Z4 G d7„ d8e4«      Z5 G d9„ d:e5«      Z6 G d;„ d<e5«      Z7 G d=„ d>e6«      Z8 G d?„ d@e5«      Z9 G dA„ dBe4«      Z: G dC„ dDe6«      Z; G dE„ dFe6«      Z< G dG„ dHe5«      Z= G dI„ dJ«      Z> G dK„ dLe>«      Z? G dM„ dNe>«      Z@ G dO„ dPe>«      ZA G dQ„ dR«      ZB G dS„ dTeB«      ZC G dU„ dVeB«      ZD G dW„ dXeB«      ZE G dY„ dZ«      ZF G d[„ d\eF«      ZG G d]„ d^eF«      ZH G d_„ d`eF«      ZI G da„ db«      ZJy)ga  Tools to monitor driver events.

.. versionadded:: 3.1

.. attention:: Starting in PyMongo 3.11, the monitoring classes outlined below
    are included in the PyMongo distribution under the
    :mod:`~pymongo.event_loggers` submodule.

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.


Use :func:`register` to register global listeners for specific events.
Listeners must inherit from one of the abstract classes below and implement
the correct functions for that class.

For example, a simple command logger might be implemented like this::

    import logging

    from pymongo import monitoring

    class CommandLogger(monitoring.CommandListener):

        def started(self, event):
            logging.info("Command {0.command_name} with request id "
                         "{0.request_id} started on server "
                         "{0.connection_id}".format(event))

        def succeeded(self, event):
            logging.info("Command {0.command_name} with request id "
                         "{0.request_id} on server {0.connection_id} "
                         "succeeded in {0.duration_micros} "
                         "microseconds".format(event))

        def failed(self, event):
            logging.info("Command {0.command_name} with request id "
                         "{0.request_id} on server {0.connection_id} "
                         "failed in {0.duration_micros} "
                         "microseconds".format(event))

    monitoring.register(CommandLogger())

Server discovery and monitoring events are also available. For example::

    class ServerLogger(monitoring.ServerListener):

        def opened(self, event):
            logging.info("Server {0.server_address} added to topology "
                         "{0.topology_id}".format(event))

        def description_changed(self, event):
            previous_server_type = event.previous_description.server_type
            new_server_type = event.new_description.server_type
            if new_server_type != previous_server_type:
                # server_type_name was added in PyMongo 3.4
                logging.info(
                    "Server {0.server_address} changed type from "
                    "{0.previous_description.server_type_name} to "
                    "{0.new_description.server_type_name}".format(event))

        def closed(self, event):
            logging.warning("Server {0.server_address} removed from topology "
                            "{0.topology_id}".format(event))


    class HeartbeatLogger(monitoring.ServerHeartbeatListener):

        def started(self, event):
            logging.info("Heartbeat sent to server "
                         "{0.connection_id}".format(event))

        def succeeded(self, event):
            # The reply.document attribute was added in PyMongo 3.4.
            logging.info("Heartbeat to server {0.connection_id} "
                         "succeeded with reply "
                         "{0.reply.document}".format(event))

        def failed(self, event):
            logging.warning("Heartbeat to server {0.connection_id} "
                            "failed with error {0.reply}".format(event))

    class TopologyLogger(monitoring.TopologyListener):

        def opened(self, event):
            logging.info("Topology with id {0.topology_id} "
                         "opened".format(event))

        def description_changed(self, event):
            logging.info("Topology description updated for "
                         "topology id {0.topology_id}".format(event))
            previous_topology_type = event.previous_description.topology_type
            new_topology_type = event.new_description.topology_type
            if new_topology_type != previous_topology_type:
                # topology_type_name was added in PyMongo 3.4
                logging.info(
                    "Topology {0.topology_id} changed type from "
                    "{0.previous_description.topology_type_name} to "
                    "{0.new_description.topology_type_name}".format(event))
            # The has_writable_server and has_readable_server methods
            # were added in PyMongo 3.4.
            if not event.new_description.has_writable_server():
                logging.warning("No writable servers available.")
            if not event.new_description.has_readable_server():
                logging.warning("No readable servers available.")

        def closed(self, event):
            logging.info("Topology with id {0.topology_id} "
                         "closed".format(event))

Connection monitoring and pooling events are also available. For example::

    class ConnectionPoolLogger(ConnectionPoolListener):

        def pool_created(self, event):
            logging.info("[pool {0.address}] pool created".format(event))

        def pool_ready(self, event):
            logging.info("[pool {0.address}] pool is ready".format(event))

        def pool_cleared(self, event):
            logging.info("[pool {0.address}] pool cleared".format(event))

        def pool_closed(self, event):
            logging.info("[pool {0.address}] pool closed".format(event))

        def connection_created(self, event):
            logging.info("[pool {0.address}][connection #{0.connection_id}] "
                         "connection created".format(event))

        def connection_ready(self, event):
            logging.info("[pool {0.address}][connection #{0.connection_id}] "
                         "connection setup succeeded".format(event))

        def connection_closed(self, event):
            logging.info("[pool {0.address}][connection #{0.connection_id}] "
                         "connection closed, reason: "
                         "{0.reason}".format(event))

        def connection_check_out_started(self, event):
            logging.info("[pool {0.address}] connection check out "
                         "started".format(event))

        def connection_check_out_failed(self, event):
            logging.info("[pool {0.address}] connection check out "
                         "failed, reason: {0.reason}".format(event))

        def connection_checked_out(self, event):
            logging.info("[pool {0.address}][connection #{0.connection_id}] "
                         "connection checked out of pool".format(event))

        def connection_checked_in(self, event):
            logging.info("[pool {0.address}][connection #{0.connection_id}] "
                         "connection checked into pool".format(event))


Event listeners can also be registered per instance of
:class:`~pymongo.mongo_client.MongoClient`::

    client = MongoClient(event_listeners=[CommandLogger()])

Note that previously registered global listeners are automatically included
when configuring per client event listeners. Registering a new global listener
will not add that listener to existing client instances.

.. note:: Events are delivered **synchronously**. Application threads block
  waiting for event handlers (e.g. :meth:`~CommandListener.started`) to
  return. Care must be taken to ensure that your event handlers are efficient
  enough to not adversely affect overall application performance.

.. warning:: The command documents published through this API are *not* copies.
  If you intend to modify them in any way you must copy them in your event
  handler first.
é    )ÚannotationsN)ÚabcÚ
namedtuple)ÚTYPE_CHECKINGÚAnyÚMappingÚOptionalÚSequence)ÚObjectId)ÚHelloÚHelloCompat)Ú_SENSITIVE_COMMANDSÚ_handle_exception)Ú_AddressÚ_DocumentOut)Ú	timedelta)ÚServerDescription)ÚTopologyDescriptionÚ
_Listeners)Úcommand_listenersÚserver_listenersÚserver_heartbeat_listenersÚtopology_listenersÚcmap_listenersc                  ó   — e Zd ZdZy)Ú_EventListenerz,Abstract base class for all event listeners.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úU/var/www/pod-logistic/pod-api/venv/lib/python3.12/site-packages/pymongo/monitoring.pyr   r   Ý   s   „ Ú6r"   r   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚCommandListenerzŠAbstract base class for command listeners.

    Handles `CommandStartedEvent`, `CommandSucceededEvent`,
    and `CommandFailedEvent`.
    c                ó   — t         ‚)zAbstract method to handle a `CommandStartedEvent`.

        :param event: An instance of :class:`CommandStartedEvent`.
        ©ÚNotImplementedError©ÚselfÚevents     r#   ÚstartedzCommandListener.startedè   ó
   € ô
 "Ð!r"   c                ó   — t         ‚)zƒAbstract method to handle a `CommandSucceededEvent`.

        :param event: An instance of :class:`CommandSucceededEvent`.
        r'   r)   s     r#   Ú	succeededzCommandListener.succeededï   r-   r"   c                ó   — t         ‚)z}Abstract method to handle a `CommandFailedEvent`.

        :param event: An instance of :class:`CommandFailedEvent`.
        r'   r)   s     r#   ÚfailedzCommandListener.failedö   r-   r"   N)r+   ÚCommandStartedEventÚreturnÚNone)r+   ÚCommandSucceededEventr3   r4   )r+   ÚCommandFailedEventr3   r4   ©r   r   r   r    r,   r/   r1   r!   r"   r#   r%   r%   á   s   „ ñó"ó"ô"r"   r%   c                  óh   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zy)ÚConnectionPoolListenera-  Abstract base class for connection pool listeners.

    Handles all of the connection pool events defined in the Connection
    Monitoring and Pooling Specification:
    :class:`PoolCreatedEvent`, :class:`PoolClearedEvent`,
    :class:`PoolClosedEvent`, :class:`ConnectionCreatedEvent`,
    :class:`ConnectionReadyEvent`, :class:`ConnectionClosedEvent`,
    :class:`ConnectionCheckOutStartedEvent`,
    :class:`ConnectionCheckOutFailedEvent`,
    :class:`ConnectionCheckedOutEvent`,
    and :class:`ConnectionCheckedInEvent`.

    .. versionadded:: 3.9
    c                ó   — t         ‚)z´Abstract method to handle a :class:`PoolCreatedEvent`.

        Emitted when a connection Pool is created.

        :param event: An instance of :class:`PoolCreatedEvent`.
        r'   r)   s     r#   Úpool_createdz#ConnectionPoolListener.pool_created  ó
   € ô "Ð!r"   c                ó   — t         ‚)zÔAbstract method to handle a :class:`PoolReadyEvent`.

        Emitted when a connection Pool is marked ready.

        :param event: An instance of :class:`PoolReadyEvent`.

        .. versionadded:: 4.0
        r'   r)   s     r#   Ú
pool_readyz!ConnectionPoolListener.pool_ready  s
   € ô "Ð!r"   c                ó   — t         ‚)z­Abstract method to handle a `PoolClearedEvent`.

        Emitted when a connection Pool is cleared.

        :param event: An instance of :class:`PoolClearedEvent`.
        r'   r)   s     r#   Úpool_clearedz#ConnectionPoolListener.pool_cleared"  r<   r"   c                ó   — t         ‚)zªAbstract method to handle a `PoolClosedEvent`.

        Emitted when a connection Pool is closed.

        :param event: An instance of :class:`PoolClosedEvent`.
        r'   r)   s     r#   Úpool_closedz"ConnectionPoolListener.pool_closed+  r<   r"   c                ó   — t         ‚)zÑAbstract method to handle a :class:`ConnectionCreatedEvent`.

        Emitted when a connection Pool creates a Connection object.

        :param event: An instance of :class:`ConnectionCreatedEvent`.
        r'   r)   s     r#   Úconnection_createdz)ConnectionPoolListener.connection_created4  r<   r"   c                ó   — t         ‚)zäAbstract method to handle a :class:`ConnectionReadyEvent`.

        Emitted when a connection has finished its setup, and is now ready to
        use.

        :param event: An instance of :class:`ConnectionReadyEvent`.
        r'   r)   s     r#   Úconnection_readyz'ConnectionPoolListener.connection_ready=  ó
   € ô "Ð!r"   c                ó   — t         ‚)zÇAbstract method to handle a :class:`ConnectionClosedEvent`.

        Emitted when a connection Pool closes a connection.

        :param event: An instance of :class:`ConnectionClosedEvent`.
        r'   r)   s     r#   Úconnection_closedz(ConnectionPoolListener.connection_closedG  r<   r"   c                ó   — t         ‚)zêAbstract method to handle a :class:`ConnectionCheckOutStartedEvent`.

        Emitted when the driver starts attempting to check out a connection.

        :param event: An instance of :class:`ConnectionCheckOutStartedEvent`.
        r'   r)   s     r#   Úconnection_check_out_startedz3ConnectionPoolListener.connection_check_out_startedP  r<   r"   c                ó   — t         ‚)zæAbstract method to handle a :class:`ConnectionCheckOutFailedEvent`.

        Emitted when the driver's attempt to check out a connection fails.

        :param event: An instance of :class:`ConnectionCheckOutFailedEvent`.
        r'   r)   s     r#   Úconnection_check_out_failedz2ConnectionPoolListener.connection_check_out_failedY  r<   r"   c                ó   — t         ‚)zÙAbstract method to handle a :class:`ConnectionCheckedOutEvent`.

        Emitted when the driver successfully checks out a connection.

        :param event: An instance of :class:`ConnectionCheckedOutEvent`.
        r'   r)   s     r#   Úconnection_checked_outz-ConnectionPoolListener.connection_checked_outb  r<   r"   c                ó   — t         ‚)zíAbstract method to handle a :class:`ConnectionCheckedInEvent`.

        Emitted when the driver checks in a connection back to the connection
        Pool.

        :param event: An instance of :class:`ConnectionCheckedInEvent`.
        r'   r)   s     r#   Úconnection_checked_inz,ConnectionPoolListener.connection_checked_ink  rG   r"   N)r+   ÚPoolCreatedEventr3   r4   )r+   ÚPoolReadyEventr3   r4   )r+   ÚPoolClearedEventr3   r4   )r+   ÚPoolClosedEventr3   r4   )r+   ÚConnectionCreatedEventr3   r4   )r+   ÚConnectionReadyEventr3   r4   )r+   ÚConnectionClosedEventr3   r4   )r+   ÚConnectionCheckOutStartedEventr3   r4   )r+   ÚConnectionCheckOutFailedEventr3   r4   )r+   ÚConnectionCheckedOutEventr3   r4   )r+   ÚConnectionCheckedInEventr3   r4   )r   r   r   r    r;   r>   r@   rB   rD   rF   rI   rK   rM   rO   rQ   r!   r"   r#   r9   r9   þ   s>   „ ñó"ó	"ó"ó"ó"ó"ó"ó"ó"ó"ô"r"   r9   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚServerHeartbeatListenerzÆAbstract base class for server heartbeat listeners.

    Handles `ServerHeartbeatStartedEvent`, `ServerHeartbeatSucceededEvent`,
    and `ServerHeartbeatFailedEvent`.

    .. versionadded:: 3.3
    c                ó   — t         ‚)z�Abstract method to handle a `ServerHeartbeatStartedEvent`.

        :param event: An instance of :class:`ServerHeartbeatStartedEvent`.
        r'   r)   s     r#   r,   zServerHeartbeatListener.started  r-   r"   c                ó   — t         ‚)z“Abstract method to handle a `ServerHeartbeatSucceededEvent`.

        :param event: An instance of :class:`ServerHeartbeatSucceededEvent`.
        r'   r)   s     r#   r/   z!ServerHeartbeatListener.succeeded†  r-   r"   c                ó   — t         ‚)z�Abstract method to handle a `ServerHeartbeatFailedEvent`.

        :param event: An instance of :class:`ServerHeartbeatFailedEvent`.
        r'   r)   s     r#   r1   zServerHeartbeatListener.failed�  r-   r"   N)r+   ÚServerHeartbeatStartedEventr3   r4   )r+   ÚServerHeartbeatSucceededEventr3   r4   )r+   ÚServerHeartbeatFailedEventr3   r4   r7   r!   r"   r#   r^   r^   v  s   „ ñó"ó"ô"r"   r^   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚTopologyListenerz»Abstract base class for topology monitoring listeners.
    Handles `TopologyOpenedEvent`, `TopologyDescriptionChangedEvent`, and
    `TopologyClosedEvent`.

    .. versionadded:: 3.3
    c                ó   — t         ‚)zAbstract method to handle a `TopologyOpenedEvent`.

        :param event: An instance of :class:`TopologyOpenedEvent`.
        r'   r)   s     r#   ÚopenedzTopologyListener.opened�  r-   r"   c                ó   — t         ‚)z—Abstract method to handle a `TopologyDescriptionChangedEvent`.

        :param event: An instance of :class:`TopologyDescriptionChangedEvent`.
        r'   r)   s     r#   Údescription_changedz$TopologyListener.description_changed¤  r-   r"   c                ó   — t         ‚)zAbstract method to handle a `TopologyClosedEvent`.

        :param event: An instance of :class:`TopologyClosedEvent`.
        r'   r)   s     r#   ÚclosedzTopologyListener.closed«  r-   r"   N)r+   ÚTopologyOpenedEventr3   r4   )r+   ÚTopologyDescriptionChangedEventr3   r4   )r+   ÚTopologyClosedEventr3   r4   ©r   r   r   r    rh   rj   rl   r!   r"   r#   rf   rf   •  ó   „ ñó"ó"ô"r"   rf   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	ÚServerListenerz©Abstract base class for server listeners.
    Handles `ServerOpeningEvent`, `ServerDescriptionChangedEvent`, and
    `ServerClosedEvent`.

    .. versionadded:: 3.3
    c                ó   — t         ‚)z}Abstract method to handle a `ServerOpeningEvent`.

        :param event: An instance of :class:`ServerOpeningEvent`.
        r'   r)   s     r#   rh   zServerListener.opened»  r-   r"   c                ó   — t         ‚)z“Abstract method to handle a `ServerDescriptionChangedEvent`.

        :param event: An instance of :class:`ServerDescriptionChangedEvent`.
        r'   r)   s     r#   rj   z"ServerListener.description_changedÂ  r-   r"   c                ó   — t         ‚)z{Abstract method to handle a `ServerClosedEvent`.

        :param event: An instance of :class:`ServerClosedEvent`.
        r'   r)   s     r#   rl   zServerListener.closedÉ  r-   r"   N)r+   ÚServerOpeningEventr3   r4   )r+   ÚServerDescriptionChangedEventr3   r4   )r+   ÚServerClosedEventr3   r4   rp   r!   r"   r#   rs   rs   ³  rq   r"   rs   c                ó:   — t        | j                  «       dz  «      S )z'Convert duration 'dur' to microseconds.g    €„.A)ÚintÚtotal_seconds)Údurs    r#   Ú
_to_microsr~   Ñ  s   € äˆs× Ñ Ó" TÑ)Ó*Ð*r"   c           	     óÎ   — t        |t        j                  «      st        | › dt	        |«      › �«      ‚|D ],  }t        |t
        «      rŒt        d| › dt	        |«      › �«      ‚ |S )zValidate event listenersz must be a list or tuple, not úListeners for ú| must be either a CommandListener, ServerHeartbeatListener, ServerListener, TopologyListener, or ConnectionPoolListener,not )Ú
isinstancer   r
   Ú	TypeErrorÚtyper   )ÚoptionÚ	listenersÚlisteners      r#   Ú_validate_event_listenersrˆ   Ö  sy   € ô �i¤§¡Ô.Ü˜6˜(Ð"@ÄÀiÃÐ@QÐRÓSÐSØò ˆÜ˜(¤NÕ3ÜØ   ð )ô ˜H“~Ð&ð	(óð ðð Ðr"   c                ó0  — t        | t        «      st        d| › dt        | «      › �«      ‚t        | t        «      rt
        j                  j                  | «       t        | t        «      rt
        j                  j                  | «       t        | t        «      rt
        j                  j                  | «       t        | t        «      rt
        j                  j                  | «       t        | t        «      r t
        j                  j                  | «       yy)zðRegister a global event listener.

    :param listener: A subclasses of :class:`CommandListener`,
        :class:`ServerHeartbeatListener`, :class:`ServerListener`,
        :class:`TopologyListener`, or :class:`ConnectionPoolListener`.
    r€   r�   N)r‚   r   rƒ   r„   r%   Ú
_LISTENERSr   Úappendr^   r   rs   r   rf   r   r9   r   )r‡   s    r#   ÚregisterrŒ   è  sØ   € ô �h¤Ô/ÜØ˜X˜Jð 'ô ˜“>Ð"ð	$ó
ð 	
ô �(œOÔ,Ü×$Ñ$×+Ñ+¨HÔ5Ü�(Ô3Ô4Ü×-Ñ-×4Ñ4°XÔ>Ü�(œNÔ+Ü×#Ñ#×*Ñ*¨8Ô4Ü�(Ô,Ô-Ü×%Ñ%×,Ñ,¨XÔ6Ü�(Ô2Ô3Ü×!Ñ!×(Ñ(¨Õ2ð 4r"   c                óR   — | j                  «       dt        j                  fv rd|v ryy)NÚhelloÚspeculativeAuthenticateTF)Úlowerr   Ú
LEGACY_CMD)Úcommand_nameÚdocs     r#   Ú_is_speculative_authenticater”     s,   € à×ÑÓ ¬+×*@Ñ*@Ð AÑAØ%¨Ñ,àØr"   c                  óÀ   — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zedd„«       Zedd„«       Zedd„«       Z	edd„«       Z
edd	„«       Zedd
„«       Zedd„«       Zy)Ú_CommandEventzBase class for command events.)Ú
__cmd_nameÚ	__rqst_idÚ	__conn_idÚ__op_idÚ__service_idÚ__dbÚ__server_conn_idNc                óf   — || _         || _        || _        || _        || _        || _        || _        y ©N)Ú_CommandEvent__cmd_nameÚ_CommandEvent__rqst_idÚ_CommandEvent__conn_idÚ_CommandEvent__op_idÚ_CommandEvent__service_idÚ_CommandEvent__dbÚ_CommandEvent__server_conn_id)r*   r’   Ú
request_idÚconnection_idÚoperation_idÚ
service_idÚdatabase_nameÚserver_connection_ids           r#   Ú__init__z_CommandEvent.__init__  s7   € ð 'ˆŒØ#ˆŒØ&ˆŒØ#ˆŒØ&ˆÔØ!ˆŒ	Ø 4ˆÕr"   c                ó   — | j                   S )zThe command name.)r    ©r*   s    r#   r’   z_CommandEvent.command_name-  ó   € ð �‰Ðr"   c                ó   — | j                   S )z"The request id for this operation.)r¡   r¯   s    r#   r§   z_CommandEvent.request_id2  ó   € ð �~‰~Ðr"   c                ó   — | j                   S )z@The address (host, port) of the server this command was sent to.)r¢   r¯   s    r#   r¨   z_CommandEvent.connection_id7  r²   r"   c                ó   — | j                   S )z^The service_id this command was sent to, or ``None``.

        .. versionadded:: 3.12
        )r¤   r¯   s    r#   rª   z_CommandEvent.service_id<  s   € ð × Ñ Ð r"   c                ó   — | j                   S )z(An id for this series of events or None.)r£   r¯   s    r#   r©   z_CommandEvent.operation_idD  ó   € ð �|‰|Ðr"   c                ó   — | j                   S )z^The database_name this command was sent to, or ``""``.

        .. versionadded:: 4.6
        )r¥   r¯   s    r#   r«   z_CommandEvent.database_nameI  s   € ð �y‰yÐr"   c                ó   — | j                   S )zThe server-side connection id for the connection this command was sent on, or ``None``.

        .. versionadded:: 4.7
        )r¦   r¯   s    r#   r¬   z"_CommandEvent.server_connection_idQ  s   € ð ×$Ñ$Ð$r"   ©NÚ N)r’   Ústrr§   r{   r¨   r   r©   úOptional[int]rª   úOptional[ObjectId]r«   r»   r¬   r¼   r3   r4   ©r3   r»   ©r3   r{   ©r3   r   ©r3   r½   )r3   r¼   )r   r   r   r    Ú	__slots__r­   Úpropertyr’   r§   r¨   rª   r©   r«   r¬   r!   r"   r#   r–   r–     sö   „ Ù(ð€Ið  *.ØØ.2ð5àð5ð ð5ð  ð	5ð
 $ð5ð 'ð5ð ð5ð ,ð5ð 
ó5ð$ òó ðð òó ðð òó ðð ò!ó ð!ð òó ðð òó ðð ò%ó ñ%r"   r–   c                  ó|   ‡ — e Zd ZdZdZ	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„Zed	d„«       Zed
ˆ fd„«       Zd
d„Z	ˆ xZ
S )r2   aá  Event published when a command starts.

    :param command: The command document.
    :param database_name: The name of the database this command was run against.
    :param request_id: The request id for this operation.
    :param connection_id: The address (host, port) of the server this command
        was sent to.
    :param operation_id: An optional identifier for a series of related events.
    :param service_id: The service_id this command was sent to, or ``None``.
    )Ú__cmdc           	     óà   •— |st        |›d�«      ‚t        t        |«      «      }t        ‰
| �  |||||||¬«       |j                  «       }	|	t        v st        |	|«      ri | _        y || _        y )Nz is not a valid command©rª   r«   r¬   )	Ú
ValueErrorÚnextÚiterÚsuperr­   r�   r   r”   Ú_CommandStartedEvent__cmd)r*   Úcommandr«   r§   r¨   r©   rª   r¬   r’   Úcmd_nameÚ	__class__s             €r#   r­   zCommandStartedEvent.__init__h  s‚   ø€ ñ Ü ˜{Ð*AÐBÓCÐCäœD ›MÓ*ˆÜ‰ÑØØØØØ!Ø'Ø!5ð 	ô 	
ð  ×%Ñ%Ó'ˆØÔ*Ñ*Ô.JÈ8ÐU\Ô.]Ø')ˆD�Jà ˆD�Jr"   c                ó   — | j                   S )zThe command document.)rÌ   r¯   s    r#   rÍ   zCommandStartedEvent.command…  s   € ð �z‰zÐr"   c                ó   •— t         ‰| �  S )z6The name of the database this command was run against.)rË   r«   ©r*   rÏ   s    €r#   r«   z!CommandStartedEvent.database_nameŠ  s   ø€ ô ‰wÑ$Ð$r"   c           	     óÐ   — dj                  | j                  j                  | j                  | j                  | j
                  | j                  | j                  | j                  «      S )Nz[<{} {} db: {!r}, command: {!r}, operation_id: {}, service_id: {}, server_connection_id: {}>)	ÚformatrÏ   r   r¨   r«   r’   r©   rª   r¬   r¯   s    r#   Ú__repr__zCommandStartedEvent.__repr__�  sU   € àiß
‰&Ø�N‰N×#Ñ#Ø×ÑØ×ÑØ×ÑØ×ÑØ�O‰OØ×%Ñ%ó
ð
	
r"   ©NN)rÍ   r   r«   r»   r§   r{   r¨   r   r©   r¼   rª   r½   r¬   r¼   r3   r4   ©r3   r   r¾   )r   r   r   r    rÂ   r­   rÃ   rÍ   r«   rÕ   Ú__classcell__©rÏ   s   @r#   r2   r2   Z  s—   ø„ ñ	ð €Ið *.Ø.2ð!àð!ð ð!ð ð	!ð
  ð!ð $ð!ð 'ð!ð ,ð!ð 
õ!ð: òó ðð ô%ó ð%÷
r"   r2   c                  ó‚   ‡ — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„Zed	d„«       Zed
d„«       Zdd„Z	ˆ xZ
S )r5   aO  Event published when a command succeeds.

    :param duration: The command duration as a datetime.timedelta.
    :param reply: The server reply document.
    :param command_name: The command name.
    :param request_id: The request id for this operation.
    :param connection_id: The address (host, port) of the server this command
        was sent to.
    :param operation_id: An optional identifier for a series of related events.
    :param service_id: The service_id this command was sent to, or ``None``.
    :param database_name: The database this command was sent to, or ``""``.
    )Ú__duration_microsÚ__replyc
           	     ó¸   •— t         ‰| �  |||||||	¬«       t        |«      | _        |j	                  «       }
|
t
        v st        |
|«      ri | _        y || _        y ©NrÇ   )rË   r­   r~   Ú'_CommandSucceededEvent__duration_microsr�   r   r”   Ú_CommandSucceededEvent__reply)r*   ÚdurationÚreplyr’   r§   r¨   r©   rª   r«   r¬   rÎ   rÏ   s              €r#   r­   zCommandSucceededEvent.__init__­  sk   ø€ ô 	‰ÑØØØØØ!Ø'Ø!5ð 	ô 	
ô ",¨HÓ!5ˆÔØ×%Ñ%Ó'ˆØÔ*Ñ*Ô.JÈ8ÐUZÔ.[Ø)+ˆD�Là ˆD�Lr"   c                ó   — | j                   S ©z/The duration of this operation in microseconds.)rß   r¯   s    r#   Úduration_microsz%CommandSucceededEvent.duration_microsÉ  ó   € ð ×%Ñ%Ð%r"   c                ó   — | j                   S ©z/The server failure document for this operation.)rà   r¯   s    r#   râ   zCommandSucceededEvent.replyÎ  r¶   r"   c           
     óæ   — dj                  | j                  j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  «      S )Nzp<{} {} db: {!r}, command: {!r}, operation_id: {}, duration_micros: {}, service_id: {}, server_connection_id: {}>)
rÔ   rÏ   r   r¨   r«   r’   r©   rå   rª   r¬   r¯   s    r#   rÕ   zCommandSucceededEvent.__repr__Ó  s^   € à~ß
‰&Ø�N‰N×#Ñ#Ø×ÑØ×ÑØ×ÑØ×ÑØ× Ñ Ø�O‰OØ×%Ñ%ó	
ð	
r"   r¹   )rá   údatetime.timedeltarâ   r   r’   r»   r§   r{   r¨   r   r©   r¼   rª   r½   r«   r»   r¬   r¼   r3   r4   r¿   r×   r¾   )r   r   r   r    rÂ   r­   rÃ   rå   râ   rÕ   rØ   rÙ   s   @r#   r5   r5   �  s®   ø„ ñð 1€Ið *.ØØ.2ð!à$ð!ð ð!ð ð	!ð
 ð!ð  ð!ð $ð!ð 'ð!ð ð!ð ,ð!ð 
õ!ð8 ò&ó ð&ð òó ð÷
r"   r5   c                  ó‚   ‡ — e Zd ZdZdZ	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„Zed	d„«       Zed
d„«       Zdd„Z	ˆ xZ
S )r6   aN  Event published when a command fails.

    :param duration: The command duration as a datetime.timedelta.
    :param failure: The server reply document.
    :param command_name: The command name.
    :param request_id: The request id for this operation.
    :param connection_id: The address (host, port) of the server this command
        was sent to.
    :param operation_id: An optional identifier for a series of related events.
    :param service_id: The service_id this command was sent to, or ``None``.
    :param database_name: The database this command was sent to, or ``""``.
    )rÛ   Ú	__failurec
           	     ó`   •— t         ‰
| �  |||||||	¬«       t        |«      | _        || _        y rÞ   )rË   r­   r~   Ú$_CommandFailedEvent__duration_microsÚ_CommandFailedEvent__failure)r*   rá   Úfailurer’   r§   r¨   r©   rª   r«   r¬   rÏ   s             €r#   r­   zCommandFailedEvent.__init__ò  sB   ø€ ô 	‰ÑØØØØØ!Ø'Ø!5ð 	ô 	
ô ",¨HÓ!5ˆÔØ ˆ�r"   c                ó   — | j                   S rä   )rî   r¯   s    r#   rå   z"CommandFailedEvent.duration_micros
  ræ   r"   c                ó   — | j                   S rè   )rï   r¯   s    r#   rð   zCommandFailedEvent.failure  r²   r"   c                óü   — dj                  | j                  j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  «	      S )Nz<{} {} db: {!r}, command: {!r}, operation_id: {}, duration_micros: {}, failure: {!r}, service_id: {}, server_connection_id: {}>)rÔ   rÏ   r   r¨   r«   r’   r©   rå   rð   rª   r¬   r¯   s    r#   rÕ   zCommandFailedEvent.__repr__  sh   € ðGç
‰&Ø�N‰N×#Ñ#Ø×ÑØ×ÑØ×ÑØ×ÑØ× Ñ Ø�L‰LØ�O‰OØ×%Ñ%ó

ð	
r"   r¹   )rá   rê   rð   r   r’   r»   r§   r{   r¨   r   r©   r¼   rª   r½   r«   r»   r¬   r¼   r3   r4   r¿   r×   r¾   )r   r   r   r    rÂ   r­   rÃ   rå   rð   rÕ   rØ   rÙ   s   @r#   r6   r6   â  s®   ø„ ñð 3€Ið *.ØØ.2ð!à$ð!ð ð!ð ð	!ð
 ð!ð  ð!ð $ð!ð 'ð!ð ð!ð ,ð!ð 
õ!ð0 ò&ó ð&ð òó ð÷
r"   r6   c                  ó6   — e Zd ZdZdZdd„Zedd„«       Zd	d„Zy)
Ú
_PoolEventzBase class for pool events.©Ú	__addressc                ó   — || _         y rŸ   ©Ú_PoolEvent__address©r*   Úaddresss     r#   r­   z_PoolEvent.__init__*  ó	   € Ø ˆ�r"   c                ó   — | j                   S )zbThe address (host, port) pair of the server the pool is attempting
        to connect to.
        rù   r¯   s    r#   rü   z_PoolEvent.address-  ó   € ð
 �~‰~Ðr"   c                óN   — | j                   j                  › d| j                  ›d�S ©Nú(ú))rÏ   r   rú   r¯   s    r#   rÕ   z_PoolEvent.__repr__4  ó%   € Ø—.‘.×)Ñ)Ð*¨!¨D¯N©NÐ+=¸QÐ?Ð?r"   N©rü   r   r3   r4   rÀ   r¾   ©	r   r   r   r    rÂ   r­   rÃ   rü   rÕ   r!   r"   r#   rõ   rõ   %  s)   „ Ù%à€Ió!ð òó ðô@r"   rõ   c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zedd„«       Zdd„Zˆ xZ	S )	rR   z»Published when a Connection Pool is created.

    :param address: The address (host, port) pair of the server this Pool is
       attempting to connect to.

    .. versionadded:: 3.9
    )Ú	__optionsc                ó2   •— t         ‰| �  |«       || _        y rŸ   )rË   r­   Ú_PoolCreatedEvent__options)r*   rü   ÚoptionsrÏ   s      €r#   r­   zPoolCreatedEvent.__init__C  s   ø€ Ü‰Ñ˜Ô!Ø ˆ�r"   c                ó   — | j                   S )zCAny non-default pool options that were set on this Connection Pool.)r
  r¯   s    r#   r  zPoolCreatedEvent.optionsG  r²   r"   c                óh   — | j                   j                  › d| j                  ›d| j                  ›d�S ©Nr  z, r  )rÏ   r   rü   r
  r¯   s    r#   rÕ   zPoolCreatedEvent.__repr__L  s0   € Ø—.‘.×)Ñ)Ð*¨!¨D¯L©LÐ+;¸2¸d¿n¹nÐ=OÈqÐQÐQr"   ©rü   r   r  údict[str, Any]r3   r4   )r3   r  r¾   )
r   r   r   r    rÂ   r­   rÃ   r  rÕ   rØ   rÙ   s   @r#   rR   rR   8  s.   ø„ ñð €Iõ!ð òó ð÷Rr"   rR   c                  ó   — e Zd ZdZdZy)rS   zÀPublished when a Connection Pool is marked ready.

    :param address: The address (host, port) pair of the server this Pool is
       attempting to connect to.

    .. versionadded:: 4.0
    r!   N©r   r   r   r    rÂ   r!   r"   r#   rS   rS   P  ó   „ ñð �Ir"   rS   c                  óh   ‡ — e Zd ZdZdZ	 	 d	 	 	 	 	 	 	 dˆ fd„Zed	d„«       Zed
d„«       Zdd„Z	ˆ xZ
S )rT   aw  Published when a Connection Pool is cleared.

    :param address: The address (host, port) pair of the server this Pool is
       attempting to connect to.
    :param service_id: The service_id this command was sent to, or ``None``.
    :param interrupt_connections: True if all active connections were interrupted by the Pool during clearing.

    .. versionadded:: 3.9
    )r›   Ú__interrupt_connectionsc                ó@   •— t         ‰| �  |«       || _        || _        y rŸ   )rË   r­   Ú_PoolClearedEvent__service_idÚ(_PoolClearedEvent__interrupt_connections)r*   rü   rª   Úinterrupt_connectionsrÏ   s       €r#   r­   zPoolClearedEvent.__init__i  s"   ø€ ô 	‰Ñ˜Ô!Ø&ˆÔØ'<ˆÕ$r"   c                ó   — | j                   S )z¥Connections with this service_id are cleared.

        When service_id is ``None``, all connections in the pool are cleared.

        .. versionadded:: 3.12
        )r  r¯   s    r#   rª   zPoolClearedEvent.service_ids  s   € ð × Ñ Ð r"   c                ó   — | j                   S )zdIf True, active connections are interrupted during clearing.

        .. versionadded:: 4.7
        )r  r¯   s    r#   r  z&PoolClearedEvent.interrupt_connections}  s   € ð ×+Ñ+Ð+r"   c                ó‚   — | j                   j                  › d| j                  ›d| j                  ›d| j                  ›d�S r  )rÏ   r   rü   r  r  r¯   s    r#   rÕ   zPoolClearedEvent.__repr__…  sB   € Ø—.‘.×)Ñ)Ð*¨!¨D¯L©LÐ+;¸2¸d×>OÑ>OÐ=RÐRTÐUY×UqÑUqÐTtÐtuÐvÐvr"   )NF©rü   r   rª   r½   r  Úboolr3   r4   rÁ   ©r3   r  r¾   )r   r   r   r    rÂ   r­   rÃ   rª   r  rÕ   rØ   rÙ   s   @r#   rT   rT   \  sp   ø„ ñð <€Ið
 *.Ø&+ð	=àð=ð 'ð=ð  $ð	=ð
 
õ=ð ò!ó ð!ð ò,ó ð,÷wr"   rT   c                  ó   — e Zd ZdZdZy)rU   zºPublished when a Connection Pool is closed.

    :param address: The address (host, port) pair of the server this Pool is
       attempting to connect to.

    .. versionadded:: 3.9
    r!   Nr  r!   r"   r#   rU   rU   ‰  r  r"   rU   c                  ó&   — e Zd ZdZdZ	 dZ	 dZ	 dZy)ÚConnectionClosedReasonzqAn enum that defines values for `reason` on a
    :class:`ConnectionClosedEvent`.

    .. versionadded:: 3.9
    ÚstaleÚidleÚerrorÚ
poolClosedN)r   r   r   r    ÚSTALEÚIDLEÚERRORÚPOOL_CLOSEDr!   r"   r#   r"  r"  •  s-   „ ñð €EØFà€Dðð €EØIà€KØEr"   r"  c                  ó    — e Zd ZdZdZ	 dZ	 dZy)ÚConnectionCheckOutFailedReasonzyAn enum that defines values for `reason` on a
    :class:`ConnectionCheckOutFailedEvent`.

    .. versionadded:: 3.9
    Útimeoutr&  ÚconnectionErrorN)r   r   r   r    ÚTIMEOUTr*  Ú
CONN_ERRORr!   r"   r#   r,  r,  ª  s#   „ ñð €GØJà€KØMà"€Jðr"   r,  c                  ó6   — e Zd ZdZdZdd„Zedd„«       Zd	d„Zy)
Ú_ConnectionEventz)Private base class for connection events.rö   c                ó   — || _         y rŸ   ©Ú_ConnectionEvent__addressrû   s     r#   r­   z_ConnectionEvent.__init__Â  rý   r"   c                ó   — | j                   S )ziThe address (host, port) pair of the server this connection is
        attempting to connect to.
        r4  r¯   s    r#   rü   z_ConnectionEvent.addressÅ  rÿ   r"   c                óN   — | j                   j                  › d| j                  ›d�S r  )rÏ   r   r5  r¯   s    r#   rÕ   z_ConnectionEvent.__repr__Ì  r  r"   Nr  rÀ   r¾   r  r!   r"   r#   r2  r2  ½  s)   „ Ù3à€Ió!ð òó ðô@r"   r2  c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zedd„«       Zdd„Zˆ xZ	S )	Ú_ConnectionIdEventz4Private base class for connection events with an id.)Ú__connection_idc                ó2   •— t         ‰| �  |«       || _        y rŸ   )rË   r­   Ú!_ConnectionIdEvent__connection_id)r*   rü   r¨   rÏ   s      €r#   r­   z_ConnectionIdEvent.__init__Õ  s   ø€ Ü‰Ñ˜Ô!Ø,ˆÕr"   c                ó   — | j                   S )zThe ID of the connection.)r<  r¯   s    r#   r¨   z _ConnectionIdEvent.connection_idÙ  s   € ð ×#Ñ#Ð#r"   c                óh   — | j                   j                  › d| j                  ›d| j                  ›d�S r  )rÏ   r   rü   r<  r¯   s    r#   rÕ   z_ConnectionIdEvent.__repr__Þ  s3   € Ø—.‘.×)Ñ)Ð*¨!¨D¯L©LÐ+;¸2¸d×>RÑ>RÐ=UÐUVÐWÐWr"   ©rü   r   r¨   r{   r3   r4   r¿   r¾   )
r   r   r   r    rÂ   r­   rÃ   r¨   rÕ   rØ   rÙ   s   @r#   r9  r9  Ð  s*   ø„ Ù>à$€Iõ-ð ò$ó ð$÷Xr"   r9  c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zedd„«       Zdd„Zˆ xZ	S )	Ú_ConnectionDurationEventz9Private base class for connection events with a duration.)Ú
__durationc                ó4   •— t         ‰| �  ||«       || _        y rŸ   )rË   r­   Ú"_ConnectionDurationEvent__duration)r*   rü   r¨   rá   rÏ   s       €r#   r­   z!_ConnectionDurationEvent.__init__ç  s   ø€ Ü‰Ñ˜ -Ô0Ø"ˆ�r"   c                ó   — | j                   S )zMThe duration of the connection event.

        .. versionadded:: 4.7
        )rD  r¯   s    r#   rá   z!_ConnectionDurationEvent.durationë  s   € ð �‰Ðr"   c                ó‚   — | j                   j                  › d| j                  ›d| j                  ›d| j                  ›d�S r  )rÏ   r   rü   r¨   rD  r¯   s    r#   rÕ   z!_ConnectionDurationEvent.__repr__ó  sB   € Ø—.‘.×)Ñ)Ð*¨!¨D¯L©LÐ+;¸2¸d×>PÑ>PÐ=SÐSUÐVZ×VeÑVeÐUhÐhiÐjÐjr"   )rü   r   r¨   r{   rá   úOptional[float]r3   r4   )r3   rG  r¾   )
r   r   r   r    rÂ   r­   rÃ   rá   rÕ   rØ   rÙ   s   @r#   rA  rA  â  s*   ø„ ÙCà€Iõ#ð òó ð÷kr"   rA  c                  ó   — e Zd ZdZdZy)rV   a…  Published when a Connection Pool creates a Connection object.

    NOTE: This connection is not ready for use until the
    :class:`ConnectionReadyEvent` is published.

    :param address: The address (host, port) pair of the server this
       Connection is attempting to connect to.
    :param connection_id: The integer ID of the Connection in this Pool.

    .. versionadded:: 3.9
    r!   Nr  r!   r"   r#   rV   rV   ÷  s   „ ñ
ð �Ir"   rV   c                  ó   — e Zd ZdZdZy)rW   a&  Published when a Connection has finished its setup, and is ready to use.

    :param address: The address (host, port) pair of the server this
       Connection is attempting to connect to.
    :param connection_id: The integer ID of the Connection in this Pool.

    .. versionadded:: 3.9
    r!   Nr  r!   r"   r#   rW   rW     ó   „ ñð �Ir"   rW   c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zedd„«       Zdd„Zˆ xZ	S )rX   aK  Published when a Connection is closed.

    :param address: The address (host, port) pair of the server this
       Connection is attempting to connect to.
    :param connection_id: The integer ID of the Connection in this Pool.
    :param reason: A reason explaining why this connection was closed.

    .. versionadded:: 3.9
    ©Ú__reasonc                ó4   •— t         ‰| �  ||«       || _        y rŸ   )rË   r­   Ú_ConnectionClosedEvent__reason)r*   rü   r¨   ÚreasonrÏ   s       €r#   r­   zConnectionClosedEvent.__init__!  s   ø€ Ü‰Ñ˜ -Ô0Øˆ�r"   c                ó   — | j                   S )z¢A reason explaining why this connection was closed.

        The reason must be one of the strings from the
        :class:`ConnectionClosedReason` enum.
        )rO  r¯   s    r#   rP  zConnectionClosedEvent.reason%  ó   € ð �}‰}Ðr"   c                óŽ   — dj                  | j                  j                  | j                  | j                  | j
                  «      S )Nz{}({!r}, {!r}, {!r}))rÔ   rÏ   r   rü   r¨   rO  r¯   s    r#   rÕ   zConnectionClosedEvent.__repr__.  s9   € Ø%×,Ñ,Ø�N‰N×#Ñ#Ø�L‰LØ×ÑØ�M‰Mó	
ð 	
r"   )rü   r   r¨   r{   rP  r»   r¾   ©
r   r   r   r    rÂ   r­   rÃ   rP  rÕ   rØ   rÙ   s   @r#   rX   rX     s-   ø„ ñð €Iõð òó ð÷
r"   rX   c                  ó   — e Zd ZdZdZy)rY   zÛPublished when the driver starts attempting to check out a connection.

    :param address: The address (host, port) pair of the server this
       Connection is attempting to connect to.

    .. versionadded:: 3.9
    r!   Nr  r!   r"   r#   rY   rY   7  r  r"   rY   c                  óB   ‡ — e Zd ZdZdZdˆ fd„Zedd„«       Zdd„Zˆ xZ	S )rZ   a!  Published when the driver's attempt to check out a connection fails.

    :param address: The address (host, port) pair of the server this
       Connection is attempting to connect to.
    :param reason: A reason explaining why connection check out failed.

    .. versionadded:: 3.9
    rL  c                ó8   •— t         ‰| �  |d|¬«       || _        y )Nr   )rü   r¨   rá   )rË   r­   Ú&_ConnectionCheckOutFailedEvent__reason)r*   rü   rP  rá   rÏ   s       €r#   r­   z&ConnectionCheckOutFailedEvent.__init__O  s   ø€ Ü‰Ñ ¸ÀHÐÔMØˆ�r"   c                ó   — | j                   S )z«A reason explaining why connection check out failed.

        The reason must be one of the strings from the
        :class:`ConnectionCheckOutFailedReason` enum.
        )rX  r¯   s    r#   rP  z$ConnectionCheckOutFailedEvent.reasonS  rR  r"   c                ó‚   — | j                   j                  › d| j                  ›d| j                  ›d| j                  ›d�S r  )rÏ   r   rü   rX  rá   r¯   s    r#   rÕ   z&ConnectionCheckOutFailedEvent.__repr__\  s?   € Ø—.‘.×)Ñ)Ð*¨!¨D¯L©LÐ+;¸2¸d¿m¹mÐ=NÈbÐQU×Q^ÑQ^ÐPaÐabÐcÐcr"   )rü   r   rP  r»   rá   rG  r3   r4   r¾   rT  rÙ   s   @r#   rZ   rZ   C  s.   ø„ ñð €Iõð òó ð÷dr"   rZ   c                  ó   — e Zd ZdZdZy)r[   a  Published when the driver successfully checks out a connection.

    :param address: The address (host, port) pair of the server this
       Connection is attempting to connect to.
    :param connection_id: The integer ID of the Connection in this Pool.

    .. versionadded:: 3.9
    r!   Nr  r!   r"   r#   r[   r[   `  rJ  r"   r[   c                  ó   — e Zd ZdZdZy)r\   a  Published when the driver checks in a Connection into the Pool.

    :param address: The address (host, port) pair of the server this
       Connection is attempting to connect to.
    :param connection_id: The integer ID of the Connection in this Pool.

    .. versionadded:: 3.9
    r!   Nr  r!   r"   r#   r\   r\   m  rJ  r"   r\   c                  óH   — e Zd ZdZdZdd„Zed	d„«       Zed
d„«       Zdd„Z	y)Ú_ServerEventzBase class for server events.)Ú__server_addressÚ__topology_idc                ó    — || _         || _        y rŸ   )Ú_ServerEvent__server_addressÚ_ServerEvent__topology_id)r*   Úserver_addressÚtopology_ids      r#   r­   z_ServerEvent.__init__  s   € Ø .ˆÔØ(ˆÕr"   c                ó   — | j                   S )z+The address (host, port) pair of the server)rb  r¯   s    r#   rd  z_ServerEvent.server_addressƒ  s   € ð ×$Ñ$Ð$r"   c                ó   — | j                   S ©z>A unique identifier for the topology this server is a part of.)rc  r¯   s    r#   re  z_ServerEvent.topology_idˆ  ó   € ð ×!Ñ!Ð!r"   c                ój   — d| j                   j                  › d| j                  › d| j                  › d�S )Nú<ú ú topology_id: ú>)rÏ   r   rd  re  r¯   s    r#   rÕ   z_ServerEvent.__repr__�  s8   € Ø�4—>‘>×*Ñ*Ð+¨1¨T×-@Ñ-@Ð,AÀÐPT×P`ÑP`ÐOaÐabÐcÐcr"   N©rd  r   re  r   r3   r4   rÀ   ©r3   r   r¾   )
r   r   r   r    rÂ   r­   rÃ   rd  re  rÕ   r!   r"   r#   r^  r^  z  s=   „ Ù'à5€Ió)ð ò%ó ð%ð ò"ó ð"ôdr"   r^  c                  ód   ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 dˆ fd„Zedd„«       Zedd„«       Zd	d„Z	ˆ xZ
S )
rx   zJPublished when server description changes.

    .. versionadded:: 3.3
    ©Ú__previous_descriptionÚ__new_descriptionc                ó:   •— t        ‰| �  |Ž  || _        || _        y rŸ   )rË   r­   Ú4_ServerDescriptionChangedEvent__previous_descriptionÚ/_ServerDescriptionChangedEvent__new_description©r*   Úprevious_descriptionÚnew_descriptionÚargsrÏ   s       €r#   r­   z&ServerDescriptionChangedEvent.__init__™  ó"   ø€ ô 	‰Ñ˜$ÑØ&:ˆÔ#Ø!0ˆÕr"   c                ó   — | j                   S )zUThe previous
        :class:`~pymongo.server_description.ServerDescription`.
        )rv  r¯   s    r#   ry  z2ServerDescriptionChangedEvent.previous_description£  ó   € ð
 ×*Ñ*Ð*r"   c                ó   — | j                   S )zPThe new
        :class:`~pymongo.server_description.ServerDescription`.
        )rw  r¯   s    r#   rz  z-ServerDescriptionChangedEvent.new_descriptionª  ó   € ð
 ×%Ñ%Ð%r"   c                óŽ   — dj                  | j                  j                  | j                  | j                  | j
                  «      S )Nz <{} {} changed from: {}, to: {}>)rÔ   rÏ   r   rd  ry  rz  r¯   s    r#   rÕ   z&ServerDescriptionChangedEvent.__repr__±  s=   € Ø1×8Ñ8Ø�N‰N×#Ñ#Ø×ÑØ×%Ñ%Ø× Ñ ó	
ð 	
r"   )ry  r   rz  r   r{  r   r3   r4   )r3   r   r¾   ©r   r   r   r    rÂ   r­   rÃ   ry  rz  rÕ   rØ   rÙ   s   @r#   rx   rx   ‘  sh   ø„ ñð
 @€Ið1à/ð1ð +ð1ð ð	1ð
 
õ1ð ò+ó ð+ð ò&ó ð&÷
r"   rx   c                  ó   — e Zd ZdZdZy)rw   zEPublished when server is initialized.

    .. versionadded:: 3.3
    r!   Nr  r!   r"   r#   rw   rw   º  ó   „ ñð
 �Ir"   rw   c                  ó   — e Zd ZdZdZy)ry   z@Published when server is closed.

    .. versionadded:: 3.3
    r!   Nr  r!   r"   r#   ry   ry   Ã  r„  r"   ry   c                  ó6   — e Zd ZdZdZdd„Zedd„«       Zd	d„Zy)
ÚTopologyEventz+Base class for topology description events.)r`  c                ó   — || _         y rŸ   ©Ú_TopologyEvent__topology_id)r*   re  s     r#   r­   zTopologyEvent.__init__Ñ  s
   € Ø(ˆÕr"   c                ó   — | j                   S rh  r‰  r¯   s    r#   re  zTopologyEvent.topology_idÔ  ri  r"   c                óP   — d| j                   j                  › d| j                  › d�S )Nrk  rm  rn  )rÏ   r   re  r¯   s    r#   rÕ   zTopologyEvent.__repr__Ù  s)   € Ø�4—>‘>×*Ñ*Ð+¨>¸$×:JÑ:JÐ9KÈ1ÐMÐMr"   N©re  r   r3   r4   rp  r¾   )	r   r   r   r    rÂ   r­   rÃ   re  rÕ   r!   r"   r#   r‡  r‡  Ì  s)   „ Ù5à"€Ió)ð ò"ó ð"ôNr"   r‡  c                  ód   ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 dˆ fd„Zedd„«       Zedd„«       Zd	d„Z	ˆ xZ
S )
rn   zPPublished when the topology description changes.

    .. versionadded:: 3.3
    rr  c                ó:   •— t        ‰| �  |Ž  || _        || _        y rŸ   )rË   r­   Ú6_TopologyDescriptionChangedEvent__previous_descriptionÚ1_TopologyDescriptionChangedEvent__new_descriptionrx  s       €r#   r­   z(TopologyDescriptionChangedEvent.__init__å  r|  r"   c                ó   — | j                   S )zYThe previous
        :class:`~pymongo.topology_description.TopologyDescription`.
        )r�  r¯   s    r#   ry  z4TopologyDescriptionChangedEvent.previous_descriptionï  r~  r"   c                ó   — | j                   S )zTThe new
        :class:`~pymongo.topology_description.TopologyDescription`.
        )r‘  r¯   s    r#   rz  z/TopologyDescriptionChangedEvent.new_descriptionö  r€  r"   c                óŽ   — dj                  | j                  j                  | j                  | j                  | j
                  «      S )Nz-<{} topology_id: {} changed from: {}, to: {}>)rÔ   rÏ   r   re  ry  rz  r¯   s    r#   rÕ   z(TopologyDescriptionChangedEvent.__repr__ý  s=   € Ø>×EÑEØ�N‰N×#Ñ#Ø×ÑØ×%Ñ%Ø× Ñ ó	
ð 	
r"   )ry  r   rz  r   r{  r   r3   r4   )r3   r   r¾   r‚  rÙ   s   @r#   rn   rn   Ý  sh   ø„ ñð
 @€Ið1à1ð1ð -ð1ð ð	1ð
 
õ1ð ò+ó ð+ð ò&ó ð&÷
r"   rn   c                  ó   — e Zd ZdZdZy)rm   zKPublished when the topology is initialized.

    .. versionadded:: 3.3
    r!   Nr  r!   r"   r#   rm   rm     r„  r"   rm   c                  ó   — e Zd ZdZdZy)ro   zFPublished when the topology is closed.

    .. versionadded:: 3.3
    r!   Nr  r!   r"   r#   ro   ro     r„  r"   ro   c                  óJ   — e Zd ZdZdZdd	d„Zed
d„«       Zedd„«       Zdd„Z	y)Ú_ServerHeartbeatEventz'Base class for server heartbeat events.)r:  Ú	__awaitedc                ó    — || _         || _        y rŸ   )Ú$_ServerHeartbeatEvent__connection_idÚ_ServerHeartbeatEvent__awaited)r*   r¨   Úawaiteds      r#   r­   z_ServerHeartbeatEvent.__init__  s   € Ø,ˆÔØ ˆ�r"   c                ó   — | j                   S )zSThe address (host, port) of the server this heartbeat was sent
        to.
        )r›  r¯   s    r#   r¨   z#_ServerHeartbeatEvent.connection_id!  s   € ð
 ×#Ñ#Ð#r"   c                ó   — | j                   S )zgWhether the heartbeat was issued as an awaitable hello command.

        .. versionadded:: 4.6
        )rœ  r¯   s    r#   r�  z_ServerHeartbeatEvent.awaited(  s   € ð �~‰~Ðr"   c                ój   — d| j                   j                  › d| j                  › d| j                  › d�S )Nrk  rl  z
 awaited: rn  )rÏ   r   r¨   r�  r¯   s    r#   rÕ   z_ServerHeartbeatEvent.__repr__0  s4   € Ø�4—>‘>×*Ñ*Ð+¨1¨T×-?Ñ-?Ð,@À
È4Ï<É<È.ÐXYÐZÐZr"   N©F©r¨   r   r�  r  r3   r4   rÀ   r  r¾   )
r   r   r   r    rÂ   r­   rÃ   r¨   r�  rÕ   r!   r"   r#   r˜  r˜    s=   „ Ù1à0€Iô!ð ò$ó ð$ð òó ðô[r"   r˜  c                  ó   — e Zd ZdZdZy)rb   zFPublished when a heartbeat is started.

    .. versionadded:: 3.3
    r!   Nr  r!   r"   r#   rb   rb   4  r„  r"   rb   c                  ó€   ‡ — e Zd ZdZdZ	 d	 	 	 	 	 	 	 	 	 d	ˆ fd„Zed
d„«       Zedd„«       Zedˆ fd„«       Z	dd„Z
ˆ xZS )rc   zIFired when the server heartbeat succeeds.

    .. versionadded:: 3.3
    ©rB  rÜ   c                óB   •— t         ‰| �  ||«       || _        || _        y rŸ   )rË   r­   Ú(_ServerHeartbeatSucceededEvent__durationÚ%_ServerHeartbeatSucceededEvent__reply©r*   rá   râ   r¨   r�  rÏ   s        €r#   r­   z&ServerHeartbeatSucceededEvent.__init__E  s"   ø€ ô 	‰Ñ˜¨Ô0Ø"ˆŒØˆ�r"   c                ó   — | j                   S ©z/The duration of this heartbeat in microseconds.)r§  r¯   s    r#   rá   z&ServerHeartbeatSucceededEvent.durationP  r°   r"   c                ó   — | j                   S )z-An instance of :class:`~pymongo.hello.Hello`.)r¨  r¯   s    r#   râ   z#ServerHeartbeatSucceededEvent.replyU  r¶   r"   c                ó   •— t         ‰| �  S ©zøWhether the heartbeat was awaited.

        If true, then :meth:`duration` reflects the sum of the round trip time
        to the server and the time that the server waited before sending a
        response.

        .. versionadded:: 3.11
        ©rË   r�  rÒ   s    €r#   r�  z%ServerHeartbeatSucceededEvent.awaitedZ  ó   ø€ ô ‰w‰Ðr"   c                ó¤   — dj                  | j                  j                  | j                  | j                  | j
                  | j                  «      S )Nz,<{} {} duration: {}, awaited: {}, reply: {}>©rÔ   rÏ   r   r¨   rá   r�  râ   r¯   s    r#   rÕ   z&ServerHeartbeatSucceededEvent.__repr__f  s@   € Ø=×DÑDØ�N‰N×#Ñ#Ø×ÑØ�M‰MØ�L‰LØ�J‰Jó
ð 	
r"   r¡  )
rá   Úfloatrâ   úHello[dict[str, Any]]r¨   r   r�  r  r3   r4   ©r3   r³  )r3   r´  r  r¾   ©r   r   r   r    rÂ   r­   rÃ   rá   râ   r�  rÕ   rØ   rÙ   s   @r#   rc   rc   =  sŠ   ø„ ñð
 *€Ið ð	àð	ð %ð	ð  ð		ð
 ð	ð 
õ	ð òó ðð òó ðð ô	ó ð	÷
r"   rc   c                  ó€   ‡ — e Zd ZdZdZ	 d	 	 	 	 	 	 	 	 	 d	ˆ fd„Zed
d„«       Zedd„«       Zedˆ fd„«       Z	dd„Z
ˆ xZS )rd   zxFired when the server heartbeat fails, either with an "ok: 0"
    or a socket exception.

    .. versionadded:: 3.3
    r¥  c                óB   •— t         ‰| �  ||«       || _        || _        y rŸ   )rË   r­   Ú%_ServerHeartbeatFailedEvent__durationÚ"_ServerHeartbeatFailedEvent__replyr©  s        €r#   r­   z#ServerHeartbeatFailedEvent.__init__y  s"   ø€ ô 	‰Ñ˜¨Ô0Ø"ˆŒØˆ�r"   c                ó   — | j                   S r«  )r¹  r¯   s    r#   rá   z#ServerHeartbeatFailedEvent.duration€  r°   r"   c                ó   — | j                   S )zA subclass of :exc:`Exception`.)rº  r¯   s    r#   râ   z ServerHeartbeatFailedEvent.reply…  r¶   r"   c                ó   •— t         ‰| �  S r®  r¯  rÒ   s    €r#   r�  z"ServerHeartbeatFailedEvent.awaitedŠ  r°  r"   c                ó¤   — dj                  | j                  j                  | j                  | j                  | j
                  | j                  «      S )Nz.<{} {} duration: {}, awaited: {}, reply: {!r}>r²  r¯   s    r#   rÕ   z#ServerHeartbeatFailedEvent.__repr__–  s@   € Ø?×FÑFØ�N‰N×#Ñ#Ø×ÑØ�M‰MØ�L‰LØ�J‰Jó
ð 	
r"   r¡  )
rá   r³  râ   Ú	Exceptionr¨   r   r�  r  r3   r4   rµ  )r3   r¿  r  r¾   r¶  rÙ   s   @r#   rd   rd   p  s„   ø„ ñð *€Ið [`ðØðØ&/ðØ@HðØSWðà	õð òó ðð òó ðð ô	ó ð	÷
r"   rd   c                  óF  — e Zd ZdZd!d„Zed"d„«       Zed"d„«       Zed"d„«       Zed"d„«       Z	ed"d„«       Z
d#d„Z	 	 d$	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d%d
„Z	 	 	 	 d&	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d'd„Z	 	 	 d(	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d)d„Zd*d„Z	 	 	 	 	 	 	 	 	 	 d+d„Z	 	 	 	 	 	 	 	 	 	 d,d„Zd-d„Zd-d„Z	 	 	 	 	 	 	 	 	 	 d.d„Zd/d„Zd/d„Z	 	 	 	 	 	 	 	 d0d„Zd1d„Zd2d„Z	 d3	 	 	 	 	 	 	 d4d„Zd2d„Zd5d„Z	 	 	 	 	 	 	 	 d6d„Zd7d„Zd2d„Z	 	 	 	 	 	 	 	 d8d„Z 	 	 	 	 	 	 	 	 d6d„Z!d5d „Z"y	)9Ú_EventListenersz­Configure event listeners for a client instance.

    Any event listeners registered globally are included by default.

    :param listeners: A list of event listeners.
    c                ó¾  — t         j                  d d  | _        t         j                  d d  | _        t         j
                  }|d d  | _        t         j                  d d  | _        t         j                  d d  | _
        |�ß|D ]Ú  }t        |t        «      r| j                  j                  |«       t        |t        «      r| j                  j                  |«       t        |t        «      r| j                  j                  |«       t        |t         «      r| j                  j                  |«       t        |t"        «      sŒÀ| j                  j                  |«       ŒÜ t%        | j                  «      | _        t%        | j                  «      | _        t%        | j                  «      | _        t%        | j                  «      | _        t%        | j                  «      | _        y rŸ   )rŠ   r   Ú"_EventListeners__command_listenersr   Ú!_EventListeners__server_listenersr   Ú+_EventListeners__server_heartbeat_listenersr   Ú#_EventListeners__topology_listenersr   Ú_EventListeners__cmap_listenersr‚   r%   r‹   rs   r^   rf   r9   r  Ú%_EventListeners__enabled_for_commandsÚ#_EventListeners__enabled_for_serverÚ-_EventListeners__enabled_for_server_heartbeatÚ%_EventListeners__enabled_for_topologyÚ!_EventListeners__enabled_for_cmap)r*   r†   Úlsts      r#   r­   z_EventListeners.__init__¨  st  € Ü#-×#?Ñ#?ÁÐ#BˆÔ Ü",×"=Ñ"=¹aÐ"@ˆÔÜ×3Ñ3ˆØ,/±¨FˆÔ)Ü$.×$AÑ$AÁ!Ð$DˆÔ!Ü *× 9Ñ 9¹!Ð <ˆÔØÐ Ø ò 
6�Ü˜c¤?Ô3Ø×,Ñ,×3Ñ3°CÔ8Ü˜c¤>Ô2Ø×+Ñ+×2Ñ2°3Ô7Ü˜cÔ#:Ô;Ø×5Ñ5×<Ñ<¸SÔAÜ˜cÔ#3Ô4Ø×-Ñ-×4Ñ4°SÔ9Ü˜cÔ#9Õ:Ø×)Ñ)×0Ñ0°Õ5ð
6ô '+¨4×+CÑ+CÓ&DˆÔ#Ü$(¨×)@Ñ)@Ó$AˆÔ!Ü.2°4×3TÑ3TÓ.UˆÔ+Ü&*¨4×+DÑ+DÓ&EˆÔ#Ü"& t×'<Ñ'<Ó"=ˆÕr"   c                ó   — | j                   S )z-Are any CommandListener instances registered?)rÈ  r¯   s    r#   Úenabled_for_commandsz$_EventListeners.enabled_for_commandsÁ  ó   € ð ×*Ñ*Ð*r"   c                ó   — | j                   S )z,Are any ServerListener instances registered?)rÉ  r¯   s    r#   Úenabled_for_serverz"_EventListeners.enabled_for_serverÆ  s   € ð ×(Ñ(Ð(r"   c                ó   — | j                   S )z5Are any ServerHeartbeatListener instances registered?)rÊ  r¯   s    r#   Úenabled_for_server_heartbeatz,_EventListeners.enabled_for_server_heartbeatË  s   € ð ×2Ñ2Ð2r"   c                ó   — | j                   S )z.Are any TopologyListener instances registered?)rË  r¯   s    r#   Úenabled_for_topologyz$_EventListeners.enabled_for_topologyÐ  rÐ  r"   c                ó   — | j                   S )z4Are any ConnectionPoolListener instances registered?)rÌ  r¯   s    r#   Úenabled_for_cmapz _EventListeners.enabled_for_cmapÕ  s   € ð ×&Ñ&Ð&r"   c                ó‚   — | j                   | j                  z   | j                  z   | j                  z   | j                  z   S )z#List of registered event listeners.)rÃ  rÅ  rÄ  rÆ  rÇ  r¯   s    r#   Úevent_listenersz_EventListeners.event_listenersÚ  sN   € ð ×$Ñ$Ø×/Ñ/ñ0à×%Ñ%ñ&ð ×'Ñ'ñ(ð ×#Ñ#ñ	$ð	
r"   Nc           	     ó¨   — |€|}t        |||||||¬«      }| j                  D ]  }		 |	j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)a  Publish a CommandStartedEvent to all command listeners.

        :param command: The command document.
        :param database_name: The name of the database this command was run
            against.
        :param request_id: The request id for this operation.
        :param connection_id: The address (host, port) of the server this
            command was sent to.
        :param op_id: The (optional) operation id for this operation.
        :param service_id: The service_id this command was sent to, or ``None``.
        N)rª   r¬   )r2   rÃ  r,   r¿  r   )
r*   rÍ   r«   r§   r¨   r¬   Úop_idrª   r+   Ú
subscribers
             r#   Úpublish_command_startz%_EventListeners.publish_command_startä  sn   € ð* ˆ=ØˆEÜ#ØØØØØØ!Ø!5ô
ˆð ×2Ñ2ò 	$ˆJð$Ø×"Ñ" 5Õ)ñ	$øô ò $Ü!Ö#ð$ús   §;»AÁAc                ó´   — |€|}|	ri }t        ||||||||
|¬«	      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)aÈ  Publish a CommandSucceededEvent to all command listeners.

        :param duration: The command duration as a datetime.timedelta.
        :param reply: The server reply document.
        :param command_name: The command name.
        :param request_id: The request id for this operation.
        :param connection_id: The address (host, port) of the server this
            command was sent to.
        :param op_id: The (optional) operation id for this operation.
        :param service_id: The service_id this command was sent to, or ``None``.
        :param speculative_hello: Was the command sent with speculative auth?
        :param database_name: The database this command was sent to, or ``""``.
        N)r«   r¬   )r5   rÃ  r/   r¿  r   )r*   rá   râ   r’   r§   r¨   r¬   rÜ  rª   Úspeculative_hellor«   r+   rÝ  s                r#   Úpublish_command_successz'_EventListeners.publish_command_success
  s~   € ð4 ˆ=ØˆEÙð ˆEÜ%ØØØØØØØØ'Ø!5ô

ˆð ×2Ñ2ò 	$ˆJð$Ø×$Ñ$ UÕ+ñ	$øô ò $Ü!Ö#ð$ús   ­AÁAÁAc
                ó¬   — |€|}t        ||||||||	|¬«	      }
| j                  D ]  }	 |j                  |
«       Œ y# t        $ r t	        «        Y Œ-w xY w)a¥  Publish a CommandFailedEvent to all command listeners.

        :param duration: The command duration as a datetime.timedelta.
        :param failure: The server reply document or failure description
            document.
        :param command_name: The command name.
        :param request_id: The request id for this operation.
        :param connection_id: The address (host, port) of the server this
            command was sent to.
        :param op_id: The (optional) operation id for this operation.
        :param service_id: The service_id this command was sent to, or ``None``.
        :param database_name: The database this command was sent to, or ``""``.
        NrÇ   )r6   rÃ  r1   r¿  r   )r*   rá   rð   r’   r§   r¨   r¬   rÜ  rª   r«   r+   rÝ  s               r#   Úpublish_command_failurez'_EventListeners.publish_command_failure;  st   € ð2 ˆ=ØˆEÜ"ØØØØØØØ!Ø'Ø!5ô

ˆð ×2Ñ2ò 	$ˆJð$Ø×!Ñ! %Õ(ñ	$øô ò $Ü!Ö#ð$ús   ©=½AÁAc                ó”   — t        ||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zÿPublish a ServerHeartbeatStartedEvent to all server heartbeat
        listeners.

        :param connection_id: The address (host, port) pair of the connection.
        :param awaited: True if this heartbeat is part of an awaitable hello command.
        N)rb   rÅ  r,   r¿  r   )r*   r¨   r�  r+   rÝ  s        r#   Ú publish_server_heartbeat_startedz0_EventListeners.publish_server_heartbeat_startedg  sO   € ô ,¨M¸7ÓCˆØ×;Ñ;ò 	$ˆJð$Ø×"Ñ" 5Õ)ñ	$øô ò $Ü!Ö#ð$úó   �1±AÁAc                ó˜   — t        ||||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)aˆ  Publish a ServerHeartbeatSucceededEvent to all server heartbeat
        listeners.

        :param connection_id: The address (host, port) pair of the connection.
        :param duration: The execution time of the event in the highest possible
            resolution for the platform.
        :param reply: The command reply.
        :param awaited: True if the response was awaited.
        N)rc   rÅ  r/   r¿  r   ©r*   r¨   rá   râ   r�  r+   rÝ  s          r#   Ú"publish_server_heartbeat_succeededz2_EventListeners.publish_server_heartbeat_succeededu  sS   € ô .¨h¸¸}ÈgÓVˆØ×;Ñ;ò 	$ˆJð$Ø×$Ñ$ UÕ+ñ	$øô ò $Ü!Ö#ð$úó   Ÿ3³A	ÁA	c                ó˜   — t        ||||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)a…  Publish a ServerHeartbeatFailedEvent to all server heartbeat
        listeners.

        :param connection_id: The address (host, port) pair of the connection.
        :param duration: The execution time of the event in the highest possible
            resolution for the platform.
        :param reply: The command reply.
        :param awaited: True if the response was awaited.
        N)rd   rÅ  r1   r¿  r   rè  s          r#   Úpublish_server_heartbeat_failedz/_EventListeners.publish_server_heartbeat_failedˆ  sS   € ô +¨8°U¸MÈ7ÓSˆØ×;Ñ;ò 	$ˆJð$Ø×!Ñ! %Õ(ñ	$øô ò $Ü!Ö#ð$úrê  c                ó”   — t        ||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zñPublish a ServerOpeningEvent to all server listeners.

        :param server_address: The address (host, port) pair of the server.
        :param topology_id: A unique identifier for the topology this server
           is a part of.
        N)rw   rÄ  rh   r¿  r   ©r*   rd  re  r+   rÝ  s        r#   Úpublish_server_openedz%_EventListeners.publish_server_opened›  sO   € ô # >°;Ó?ˆØ×1Ñ1ò 	$ˆJð$Ø×!Ñ! %Õ(ñ	$øô ò $Ü!Ö#ð$úræ  c                ó”   — t        ||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zðPublish a ServerClosedEvent to all server listeners.

        :param server_address: The address (host, port) pair of the server.
        :param topology_id: A unique identifier for the topology this server
           is a part of.
        N)ry   rÄ  rl   r¿  r   rî  s        r#   Úpublish_server_closedz%_EventListeners.publish_server_closed©  sO   € ô " .°+Ó>ˆØ×1Ñ1ò 	$ˆJð$Ø×!Ñ! %Õ(ñ	$øô ò $Ü!Ö#ð$úræ  c                ó˜   — t        ||||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)a~  Publish a ServerDescriptionChangedEvent to all server listeners.

        :param previous_description: The previous server description.
        :param server_address: The address (host, port) pair of the server.
        :param new_description: The new server description.
        :param topology_id: A unique identifier for the topology this server
           is a part of.
        N)rx   rÄ  rj   r¿  r   )r*   ry  rz  rd  re  r+   rÝ  s          r#   Ú"publish_server_description_changedz2_EventListeners.publish_server_description_changed·  sX   € ô .Ø  /°>À;ó
ˆð ×1Ñ1ò 	$ˆJð$Ø×.Ñ.¨uÕ5ñ	$øô ò $Ü!Ö#ð$úrê  c                ó’   — t        |«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z¨Publish a TopologyOpenedEvent to all topology listeners.

        :param topology_id: A unique identifier for the topology this server
           is a part of.
        N)rm   rÆ  rh   r¿  r   ©r*   re  r+   rÝ  s       r#   Úpublish_topology_openedz'_EventListeners.publish_topology_openedÏ  óM   € ô $ KÓ0ˆØ×3Ñ3ò 	$ˆJð$Ø×!Ñ! %Õ(ñ	$øô ò $Ü!Ö#ð$úó   œ0°AÁAc                ó’   — t        |«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z¨Publish a TopologyClosedEvent to all topology listeners.

        :param topology_id: A unique identifier for the topology this server
           is a part of.
        N)ro   rÆ  rl   r¿  r   rõ  s       r#   Úpublish_topology_closedz'_EventListeners.publish_topology_closedÜ  r÷  rø  c                ó–   — t        |||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)a:  Publish a TopologyDescriptionChangedEvent to all topology listeners.

        :param previous_description: The previous topology description.
        :param new_description: The new topology description.
        :param topology_id: A unique identifier for the topology this server
           is a part of.
        N)rn   rÆ  rj   r¿  r   )r*   ry  rz  re  r+   rÝ  s         r#   Ú$publish_topology_description_changedz4_EventListeners.publish_topology_description_changedé  sS   € ô 0Ð0DÀoÐWbÓcˆØ×3Ñ3ò 	$ˆJð$Ø×.Ñ.¨uÕ5ñ	$øô ò $Ü!Ö#ð$úó   ž2²AÁAc                ó”   — t        ||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z:Publish a :class:`PoolCreatedEvent` to all pool listeners.N)rR   rÇ  r;   r¿  r   )r*   rü   r  r+   rÝ  s        r#   Úpublish_pool_createdz$_EventListeners.publish_pool_createdý  sM   € ä  ¨'Ó2ˆØ×/Ñ/ò 	$ˆJð$Ø×'Ñ'¨Õ.ñ	$øô ò $Ü!Ö#ð$úræ  c                ó’   — t        |«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z8Publish a :class:`PoolReadyEvent` to all pool listeners.N)rS   rÇ  r>   r¿  r   ©r*   rü   r+   rÝ  s       r#   Úpublish_pool_readyz"_EventListeners.publish_pool_ready  sK   € ä˜wÓ'ˆØ×/Ñ/ò 	$ˆJð$Ø×%Ñ% eÕ,ñ	$øô ò $Ü!Ö#ð$úrø  c                ó–   — t        |||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z:Publish a :class:`PoolClearedEvent` to all pool listeners.N)rT   rÇ  r@   r¿  r   )r*   rü   rª   r  r+   rÝ  s         r#   Úpublish_pool_clearedz$_EventListeners.publish_pool_cleared  sR   € ô ! ¨*Ð6KÓLˆØ×/Ñ/ò 	$ˆJð$Ø×'Ñ'¨Õ.ñ	$øô ò $Ü!Ö#ð$úrý  c                ó’   — t        |«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z9Publish a :class:`PoolClosedEvent` to all pool listeners.N)rU   rÇ  rB   r¿  r   r  s       r#   Úpublish_pool_closedz#_EventListeners.publish_pool_closed  sK   € ä Ó(ˆØ×/Ñ/ò 	$ˆJð$Ø×&Ñ& uÕ-ñ	$øô ò $Ü!Ö#ð$úrø  c                ó”   — t        ||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zWPublish a :class:`ConnectionCreatedEvent` to all connection
        listeners.
        N)rV   rÇ  rD   r¿  r   ©r*   rü   r¨   r+   rÝ  s        r#   Úpublish_connection_createdz*_EventListeners.publish_connection_created&  sO   € ô ' w°Ó>ˆØ×/Ñ/ò 	$ˆJð$Ø×-Ñ-¨eÕ4ñ	$øô ò $Ü!Ö#ð$úræ  c                ó–   — t        |||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zDPublish a :class:`ConnectionReadyEvent` to all connection listeners.N)rW   rÇ  rF   r¿  r   ©r*   rü   r¨   rá   r+   rÝ  s         r#   Úpublish_connection_readyz(_EventListeners.publish_connection_ready1  sQ   € ô % W¨m¸XÓFˆØ×/Ñ/ò 	$ˆJð$Ø×+Ñ+¨EÕ2ñ	$øô ò $Ü!Ö#ð$úrý  c                ó–   — t        |||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zVPublish a :class:`ConnectionClosedEvent` to all connection
        listeners.
        N)rX   rÇ  rI   r¿  r   )r*   rü   r¨   rP  r+   rÝ  s         r#   Úpublish_connection_closedz)_EventListeners.publish_connection_closed<  sQ   € ô & g¨}¸fÓEˆØ×/Ñ/ò 	$ˆJð$Ø×,Ñ,¨UÕ3ñ	$øô ò $Ü!Ö#ð$úrý  c                ó’   — t        |«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z_Publish a :class:`ConnectionCheckOutStartedEvent` to all connection
        listeners.
        N)rY   rÇ  rK   r¿  r   r  s       r#   Ú$publish_connection_check_out_startedz4_EventListeners.publish_connection_check_out_startedG  sM   € ô /¨wÓ7ˆØ×/Ñ/ò 	$ˆJð$Ø×7Ñ7¸Õ>ñ	$øô ò $Ü!Ö#ð$úrø  c                ó–   — t        |||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)z^Publish a :class:`ConnectionCheckOutFailedEvent` to all connection
        listeners.
        N)rZ   rÇ  rM   r¿  r   )r*   rü   rP  rá   r+   rÝ  s         r#   Ú#publish_connection_check_out_failedz3_EventListeners.publish_connection_check_out_failedR  sQ   € ô .¨g°v¸xÓHˆØ×/Ñ/ò 	$ˆJð$Ø×6Ñ6°uÕ=ñ	$øô ò $Ü!Ö#ð$úrý  c                ó–   — t        |||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zZPublish a :class:`ConnectionCheckedOutEvent` to all connection
        listeners.
        N)r[   rÇ  rO   r¿  r   r  s         r#   Úpublish_connection_checked_outz._EventListeners.publish_connection_checked_out_  sQ   € ô *¨'°=À(ÓKˆØ×/Ñ/ò 	$ˆJð$Ø×1Ñ1°%Õ8ñ	$øô ò $Ü!Ö#ð$úrý  c                ó”   — t        ||«      }| j                  D ]  }	 |j                  |«       Œ y# t        $ r t	        «        Y Œ-w xY w)zYPublish a :class:`ConnectionCheckedInEvent` to all connection
        listeners.
        N)r\   rÇ  rQ   r¿  r   r  s        r#   Úpublish_connection_checked_inz-_EventListeners.publish_connection_checked_inl  sO   € ô )¨°-Ó@ˆØ×/Ñ/ò 	$ˆJð$Ø×0Ñ0°Õ7ñ	$øô ò $Ü!Ö#ð$úræ  )r†   z"Optional[Sequence[_EventListener]]r  )r3   zlist[_EventListeners]rÖ   )rÍ   r   r«   r»   r§   r{   r¨   r   r¬   r¼   rÜ  r¼   rª   r½   r3   r4   )NNFrº   )rá   r   râ   r   r’   r»   r§   r{   r¨   r   r¬   r¼   rÜ  r¼   rª   r½   rà  r  r«   r»   r3   r4   )NNrº   )rá   r   rð   r   r’   r»   r§   r{   r¨   r   r¬   r¼   rÜ  r¼   rª   r½   r«   r»   r3   r4   r¢  )
r¨   r   rá   r³  râ   r´  r�  r  r3   r4   )
r¨   r   rá   r³  râ   r¿  r�  r  r3   r4   ro  )
ry  r   rz  r   rd  r   re  r   r3   r4   r�  )ry  r   rz  r   re  r   r3   r4   r  r  r¡  r  r?  )rü   r   r¨   r{   rá   r³  r3   r4   )rü   r   r¨   r{   rP  r»   r3   r4   )rü   r   rP  r»   rá   r³  r3   r4   )#r   r   r   r    r­   rÃ   rÏ  rÒ  rÔ  rÖ  rØ  rÚ  rÞ  rá  rã  rå  ré  rì  rï  rñ  ró  rö  rú  rü  rÿ  r  r  r  r	  r  r  r  r  r  r  r!   r"   r#   rÁ  rÁ     sY  „ ñó>ð2 ò+ó ð+ð ò)ó ð)ð ò3ó ð3ð ò+ó ð+ð ò'ó ð'ó
ð"  $Ø)-ð$$àð$$ð ð$$ð ð	$$ð
  ð$$ð ,ð$$ð ð$$ð 'ð$$ð 
ó$$ð\  $Ø)-Ø"'Øð/$àð/$ð ð/$ð ð	/$ð
 ð/$ð  ð/$ð ,ð/$ð ð/$ð 'ð/$ð  ð/$ð ð/$ð 
ó/$ðr  $Ø)-Øð*$àð*$ð ð*$ð ð	*$ð
 ð*$ð  ð*$ð ,ð*$ð ð*$ð 'ð*$ð ð*$ð 
ó*$óX$ð$Ø%ð$Ø16ð$Ø?Tð$Ø_cð$à	ó$ð&$Ø%ð$Ø16ð$Ø?Hð$ØSWð$à	ó$ó&$ó$ð$à/ð$ð +ð$ð !ð	$ð
 ð$ð 
ó$ó0$ó$ð$à1ð$ð -ð$ð ð	$ð
 
ó$ó($ó$ð ',ð	$àð$ð 'ð$ð  $ð	$ð
 
ó$ó$ó	$ð	$Øð	$Ø03ð	$Ø?Dð	$à	ó	$ó	$ó	$ð$Øð$Ø),ð$Ø8=ð$à	ó$ð$Øð$Ø03ð$Ø?Dð$à	ó$ô	$r"   rÁ  )r}   r   r3   r{   )r…   r»   r†   úSequence[_EventListeners]r3   r  )r‡   r   r3   r4   )r’   r»   r“   zMapping[str, Any]r3   r  )Kr    Ú
__future__r   ÚdatetimeÚcollectionsr   r   Útypingr   r   r   r	   r
   Úbson.objectidr   Úpymongo.hellor   r   Úpymongo.helpers_sharedr   r   Úpymongo.typingsr   r   r   Úpymongo.server_descriptionr   Úpymongo.topology_descriptionr   r   rŠ   r   r%   r9   r^   rf   rs   r~   rˆ   rŒ   r”   r–   r2   r5   r6   rõ   rR   rS   rT   rU   r"  r,  r2  r9  rA  rV   rW   rX   rY   rZ   r[   r\   r^  rx   rw   ry   r‡  rn   rm   ro   r˜  rb   rc   rd   rÁ  r!   r"   r#   ú<module>r"     sŽ  ðñlõ\ #ã ß 'ß BÕ Bå "ß ,ß Iß 2áÝ"å<Ý@ñ Øðó	€
ñ ˜˜B  B¨Ó+€
÷7ñ 7ô"�nô "ô:u"˜^ô u"ôp"˜nô "ô>"�~ô "ô<"�^ô "ó<+ð
ØðØ5ðàóó$3ó:÷I%ñ I%ôX@
˜-ô @
ôFB
˜Mô B
ôJ@
˜ô @
÷F@ñ @ô&R�zô Rô0	�Zô 	ô*w�zô *wôZ	�jô 	÷Fñ F÷*ñ ÷&@ñ @ô&XÐ)ô Xô$kÐ1ô kô*Ð/ô ô 
Ð3ô 
ô 
Ð.ô  
ôF	Ð%5ô 	ôdÐ$<ô dô:
Ð 8ô 
ô
Ð1ô 
÷dñ dô.&
 Lô &
ôR˜ô ô˜ô ÷Nñ Nô"&
 mô &
ôR˜-ô ô˜-ô ÷[ñ [ô8Ð"7ô ô0
Ð$9ô 0
ôf-
Ð!6ô -
÷`U$ò U$r"   