+
    8i                    p   R t ^ RIHt ^ RIt^ RIHtHt ^ RIHtH	t	H
t
HtHt ^ RIHt ^ RIHtHt ^ RIHtHt ^ RIHtHt ]'       d   ^ R	IHt ^ R
IHt ^ RIHt ]! RRe4      t]! . . . . . 4      t ! R R4      t ! R R]4      t  ! R R]4      t! ! R R]4      t" ! R R]4      t# ! R R]4      t$R R lt%R R lt&R R lt'R R  lt( ! R! R"4      t) ! R# R$])4      t* ! R% R&])4      t+ ! R' R(])4      t, ! R) R*4      t- ! R+ R,]-4      t. ! R- R.]-4      t/ ! R/ R0]-4      t0 ! R1 R2]-4      t1 ! R3 R44      t2 ! R5 R64      t3 ! R7 R84      t4 ! R9 R:]44      t5 ! R; R<]54      t6 ! R= R>]54      t7 ! R? R@]64      t8 ! RA RB]54      t9 ! RC RD]44      t: ! RE RF]64      t; ! RG RH]64      t< ! RI RJ]54      t= ! RK RL4      t> ! RM RN]>4      t? ! RO RP]>4      t@ ! RQ RR]>4      tA ! RS RT4      tB ! RU RV]B4      tC ! RW RX]B4      tD ! RY RZ]B4      tE ! R[ R\4      tF ! R] R^]F4      tG ! R_ R`]F4      tH ! Ra Rb]F4      tI ! Rc Rd4      tJR# )fa  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
_Listenersc                      ] tR t^tRtRtR# )_EventListenerz,Abstract base class for all event listeners. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       P/var/www/html/photoedit/myenv/lib/python3.14/site-packages/pymongo/monitoring.pyr   r      s    6r   r   c                  >    ] tR t^tRtR R ltR R ltR R ltRtR	# )
CommandListenerz~Abstract base class for command listeners.

Handles `CommandStartedEvent`, `CommandSucceededEvent`,
and `CommandFailedEvent`.
c                    V ^8  d   QhRRRR/# )   eventCommandStartedEventreturnNoner   )formats   "r   __annotate__CommandListener.__annotate__   s     " "0 "T "r   c                    \         h)zoAbstract method to handle a `CommandStartedEvent`.

:param event: An instance of :class:`CommandStartedEvent`.
NotImplementedErrorselfr$   s   &&r   startedCommandListener.started   
    
 "!r   c                    V ^8  d   QhRRRR/# )r#   r$   CommandSucceededEventr&   r'   r   )r(   s   "r   r)   r*      s     " "4 " "r   c                    \         h)zsAbstract method to handle a `CommandSucceededEvent`.

:param event: An instance of :class:`CommandSucceededEvent`.
r,   r.   s   &&r   	succeededCommandListener.succeeded   r2   r   c                    V ^8  d   QhRRRR/# )r#   r$   CommandFailedEventr&   r'   r   )r(   s   "r   r)   r*           " ". "4 "r   c                    \         h)zmAbstract method to handle a `CommandFailedEvent`.

:param event: An instance of :class:`CommandFailedEvent`.
r,   r.   s   &&r   failedCommandListener.failed   r2   r   r   N	r   r   r   r   r   r0   r6   r<   r   r   r   r   r!   r!      s    """ "r   r!   c                      ] tR t^tRtR R ltR R ltR R ltR R	 ltR
 R lt	R R lt
R R ltR R ltR R ltR R ltR R ltRtR# )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                    V ^8  d   QhRRRR/# )r#   r$   PoolCreatedEventr&   r'   r   )r(   s   "r   r)   #ConnectionPoolListener.__annotate__       " ""2 "t "r   c                    \         h)zAbstract 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_created#ConnectionPoolListener.pool_created  
     "!r   c                    V ^8  d   QhRRRR/# )r#   r$   PoolReadyEventr&   r'   r   )r(   s   "r   r)   rC     s     	" 	" 	"4 	"r   c                    \         h)zAbstract 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_ready!ConnectionPoolListener.pool_ready  s
     "!r   c                    V ^8  d   QhRRRR/# )r#   r$   PoolClearedEventr&   r'   r   )r(   s   "r   r)   rC   "  rD   r   c                    \         h)zAbstract method to handle a `PoolClearedEvent`.

Emitted when a connection Pool is cleared.

:param event: An instance of :class:`PoolClearedEvent`.
r,   r.   s   &&r   pool_cleared#ConnectionPoolListener.pool_cleared"  rH   r   c                    V ^8  d   QhRRRR/# )r#   r$   PoolClosedEventr&   r'   r   )r(   s   "r   r)   rC   +  s     " " "T "r   c                    \         h)zAbstract method to handle a `PoolClosedEvent`.

Emitted when a connection Pool is closed.

:param event: An instance of :class:`PoolClosedEvent`.
r,   r.   s   &&r   pool_closed"ConnectionPoolListener.pool_closed+  rH   r   c                    V ^8  d   QhRRRR/# )r#   r$   ConnectionCreatedEventr&   r'   r   )r(   s   "r   r)   rC   4  s     " "(> "4 "r   c                    \         h)zAbstract 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_created)ConnectionPoolListener.connection_created4  rH   r   c                    V ^8  d   QhRRRR/# )r#   r$   ConnectionReadyEventr&   r'   r   )r(   s   "r   r)   rC   =  s     " "&: "t "r   c                    \         h)zAbstract 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_ready'ConnectionPoolListener.connection_ready=  
     "!r   c                    V ^8  d   QhRRRR/# )r#   r$   ConnectionClosedEventr&   r'   r   )r(   s   "r   r)   rC   G  s     " "'< " "r   c                    \         h)zAbstract 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_closed(ConnectionPoolListener.connection_closedG  rH   r   c                    V ^8  d   QhRRRR/# )r#   r$   ConnectionCheckOutStartedEventr&   r'   r   )r(   s   "r   r)   rC   P  s     " "2P "UY "r   c                    \         h)zAbstract 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_started3ConnectionPoolListener.connection_check_out_startedP  rH   r   c                    V ^8  d   QhRRRR/# )r#   r$   ConnectionCheckOutFailedEventr&   r'   r   )r(   s   "r   r)   rC   Y  s     " "1N "SW "r   c                    \         h)zAbstract 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_failed2ConnectionPoolListener.connection_check_out_failedY  rH   r   c                    V ^8  d   QhRRRR/# )r#   r$   ConnectionCheckedOutEventr&   r'   r   )r(   s   "r   r)   rC   b  s     " ",E "$ "r   c                    \         h)zAbstract 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_out-ConnectionPoolListener.connection_checked_outb  rH   r   c                    V ^8  d   QhRRRR/# )r#   r$   ConnectionCheckedInEventr&   r'   r   )r(   s   "r   r)   rC   k  s     " "+C " "r   c                    \         h)zAbstract 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_in,ConnectionPoolListener.connection_checked_ink  rb   r   r   N)r   r   r   r   r   rF   rL   rQ   rV   r[   r`   rf   rk   rp   ru   rz   r   r   r   r   r@   r@      sC    "	"""""""""" "r   r@   c                  >    ] tR tRtRtR R ltR R ltR R ltR	tR
# )ServerHeartbeatListeneriv  zAbstract base class for server heartbeat listeners.

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

.. versionadded:: 3.3
c                    V ^8  d   QhRRRR/# )r#   r$   ServerHeartbeatStartedEventr&   r'   r   )r(   s   "r   r)   $ServerHeartbeatListener.__annotate__  s     " "8 "T "r   c                    \         h)zAbstract method to handle a `ServerHeartbeatStartedEvent`.

:param event: An instance of :class:`ServerHeartbeatStartedEvent`.
r,   r.   s   &&r   r0   ServerHeartbeatListener.started  r2   r   c                    V ^8  d   QhRRRR/# )r#   r$   ServerHeartbeatSucceededEventr&   r'   r   )r(   s   "r   r)   r     s     " "< " "r   c                    \         h)zAbstract method to handle a `ServerHeartbeatSucceededEvent`.

:param event: An instance of :class:`ServerHeartbeatSucceededEvent`.
r,   r.   s   &&r   r6   !ServerHeartbeatListener.succeeded  r2   r   c                    V ^8  d   QhRRRR/# )r#   r$   ServerHeartbeatFailedEventr&   r'   r   )r(   s   "r   r)   r     s     " "6 "4 "r   c                    \         h)z}Abstract method to handle a `ServerHeartbeatFailedEvent`.

:param event: An instance of :class:`ServerHeartbeatFailedEvent`.
r,   r.   s   &&r   r<   ServerHeartbeatListener.failed  r2   r   r   Nr>   r   r   r   r}   r}   v  s    """ "r   r}   c                  >    ] tR tRtRtR R ltR R ltR R ltR	tR
# )TopologyListeneri  zAbstract base class for topology monitoring listeners.
Handles `TopologyOpenedEvent`, `TopologyDescriptionChangedEvent`, and
`TopologyClosedEvent`.

.. versionadded:: 3.3
c                    V ^8  d   QhRRRR/# )r#   r$   TopologyOpenedEventr&   r'   r   )r(   s   "r   r)   TopologyListener.__annotate__       " "/ "D "r   c                    \         h)zoAbstract method to handle a `TopologyOpenedEvent`.

:param event: An instance of :class:`TopologyOpenedEvent`.
r,   r.   s   &&r   openedTopologyListener.opened  r2   r   c                    V ^8  d   QhRRRR/# )r#   r$   TopologyDescriptionChangedEventr&   r'   r   )r(   s   "r   r)   r     s     " ")H "T "r   c                    \         h)zAbstract method to handle a `TopologyDescriptionChangedEvent`.

:param event: An instance of :class:`TopologyDescriptionChangedEvent`.
r,   r.   s   &&r   description_changed$TopologyListener.description_changed  r2   r   c                    V ^8  d   QhRRRR/# )r#   r$   TopologyClosedEventr&   r'   r   )r(   s   "r   r)   r     r   r   c                    \         h)zoAbstract method to handle a `TopologyClosedEvent`.

:param event: An instance of :class:`TopologyClosedEvent`.
r,   r.   s   &&r   closedTopologyListener.closed  r2   r   r   N	r   r   r   r   r   r   r   r   r   r   r   r   r   r         """ "r   r   c                  >    ] tR tRtRtR R ltR R ltR R ltR	tR
# )ServerListeneri  zAbstract base class for server listeners.
Handles `ServerOpeningEvent`, `ServerDescriptionChangedEvent`, and
`ServerClosedEvent`.

.. versionadded:: 3.3
c                    V ^8  d   QhRRRR/# )r#   r$   ServerOpeningEventr&   r'   r   )r(   s   "r   r)   ServerListener.__annotate__  r:   r   c                    \         h)zmAbstract method to handle a `ServerOpeningEvent`.

:param event: An instance of :class:`ServerOpeningEvent`.
r,   r.   s   &&r   r   ServerListener.opened  r2   r   c                    V ^8  d   QhRRRR/# )r#   r$   ServerDescriptionChangedEventr&   r'   r   )r(   s   "r   r)   r     s     " ")F "4 "r   c                    \         h)zAbstract method to handle a `ServerDescriptionChangedEvent`.

:param event: An instance of :class:`ServerDescriptionChangedEvent`.
r,   r.   s   &&r   r   "ServerListener.description_changed  r2   r   c                    V ^8  d   QhRRRR/# )r#   r$   ServerClosedEventr&   r'   r   )r(   s   "r   r)   r     s     " "- "$ "r   c                    \         h)zkAbstract method to handle a `ServerClosedEvent`.

:param event: An instance of :class:`ServerClosedEvent`.
r,   r.   s   &&r   r   ServerListener.closed  r2   r   r   Nr   r   r   r   r   r     r   r   r   c                    V ^8  d   QhRRRR/# )r#   durr   r&   intr   )r(   s   "r   r)   r)     s     + +I +# +r   c                B    \        V P                  4       R,          4      # )z'Convert duration 'dur' to microseconds.g    .A)r   total_seconds)r   s   &r   
_to_microsr     s    s  "T)**r   c               $    V ^8  d   QhRRRRRR/# )r#   optionstr	listenerszSequence[_EventListeners]r&   r   )r(   s   "r   r)   r)     s$      5r   c           	         \        V\        P                  4      '       g   \        V  R\	        V4       24      hV F3  p\        V\
        4      '       d   K  \        RV  R\	        V4       24      h	  V# )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   )r   r   listeners   && r   _validate_event_listenersr     sz     i..6("@i@QRSS(N33  ) H~&	(   r   c                    V ^8  d   QhRRRR/# )r#   r   r   r&   r'   r   )r(   s   "r   r)   r)     s     3 3~ 3$ 3r   c                |   \        V \        4      '       g   \        RV  R\        V 4       24      h\        V \        4      '       d    \
        P                  P                  V 4       \        V \        4      '       d    \
        P                  P                  V 4       \        V \        4      '       d    \
        P                  P                  V 4       \        V \        4      '       d    \
        P                  P                  V 4       \        V \        4      '       d"   \
        P                  P                  V 4       R# R# )zRegister 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!   
_LISTENERScommand_listenersappendr}   server_heartbeat_listenersr   server_listenersr   topology_listenersr@   cmap_listeners)r   s   &r   registerr     s     h//XJ ' >"	$
 	
 (O,,$$++H5(344--44X>(N++##**84(,--%%,,X6(233!!((2 4r   c               $    V ^8  d   QhRRRRRR/# )r#   command_namer   doczMapping[str, Any]r&   boolr   )r(   s   "r   r)   r)     s"      s 9J t r   c                b    V P                  4       R \        P                  39   d
   RV9   d   R# R# )hellospeculativeAuthenticateTF)lowerr   
LEGACY_CMD)r   r   s   &&r   _is_speculative_authenticater     s,    +*@*@ AA%,r   c                      ] tR tRtRtRtRR R llt]R R l4       t]R R	 l4       t	]R
 R l4       t
]R R l4       t]R R l4       t]R R l4       t]R R l4       tRtR# )_CommandEventi  zBase class for command events.Nc               8    V ^8  d   QhRRRRRRRRR	R
RRRRRR/# )r#   r   r   
request_idr   connection_idr   operation_idOptional[int]
service_idOptional[ObjectId]database_nameserver_connection_idr&   r'   r   )r(   s   "r   r)   _CommandEvent.__annotate__  sZ     5 55 5  	5
 $5 '5 5 ,5 
5r   c                	Z    Wn         W n        W0n        W@n        WPn        W`n        Wpn        R # N)_CommandEvent__cmd_name_CommandEvent__rqst_id_CommandEvent__conn_id_CommandEvent__op_id_CommandEvent__service_id_CommandEvent__db_CommandEvent__server_conn_id)r/   r   r   r   r   r   r   r   s   &&&&&&&&r   __init___CommandEvent.__init__  s)     '#&#&!	 4r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r   .  s      c r   c                    V P                   # )zThe command name.)r   r/   s   &r   r   _CommandEvent.command_name-       r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r   3  s      C r   c                    V P                   # )z"The request id for this operation.)r   r   s   &r   r   _CommandEvent.request_id2       ~~r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r   8  s      x r   c                    V P                   # )z@The address (host, port) of the server this command was sent to.)r   r   s   &r   r   _CommandEvent.connection_id7  r   r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r   =  s     ! !. !r   c                    V P                   # )zNThe service_id this command was sent to, or ``None``.

.. versionadded:: 3.12
)r   r   s   &r   r   _CommandEvent.service_id<  s        r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r   E  s      m r   c                    V P                   # )z(An id for this series of events or None.)r   r   s   &r   r   _CommandEvent.operation_idD       ||r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r   J  s      s r   c                    V P                   # )zNThe database_name this command was sent to, or ``""``.

.. versionadded:: 4.6
)r   r   s   &r   r   _CommandEvent.database_nameI  s     yyr   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r   R  s     % %m %r   c                    V P                   # )zoThe server-side connection id for the connection this command was sent on, or ``None``.

.. versionadded:: 4.7
)r   r   s   &r   r   "_CommandEvent.server_connection_idQ  s     $$$r   )
__cmd_name	__conn_id__db__op_id	__rqst_id__server_conn_id__service_id)r
  r  r  r  r  r  r  N N)r   r   r   r   r   	__slots__r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r     s    (I5$       ! !     % %r   r   c                  x   a  ] tR tRtRtRtRR V 3R lllt]R R l4       t]R V 3R ll4       t	R	 R
 lt
RtV ;t# )r%   iZ  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``.
c               8    V ^8  d   QhRRRRRRRRR	R
RRRR
RR/# )r#   commandr   r   r   r   r   r   r   r   r   r   r   r   r&   r'   r   )r(   s   "r   r)    CommandStartedEvent.__annotate__h  sZ     ! !! ! 	!
  ! $! '! ,! 
!r   c           
     	   < V'       g   \        V: R 24      h\        \        V4      4      p\        S
V `  VVVVVVVR7       VP                  4       p	V	\        9   g   \        W4      '       d
   / V n        R# Wn        R# )z is not a valid commandr   r   r   N)	
ValueErrornextitersuperr   r   r   r   _CommandStartedEvent__cmd)r/   r  r   r   r   r   r   r   r   cmd_name	__class__s   &&&&&&&&  r   r   CommandStartedEvent.__init__h  s     {*ABCCDM*!'!5 	 	
  %%'**.J8.].]')DJ Jr   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r    s       r   c                    V P                   # )zThe command document.)r  r   s   &r   r  CommandStartedEvent.command  s     zzr   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    s     % %s %r   c                   < \         SV `  # )z6The name of the database this command was run against.)r  r   r/   r!  s   &r   r   !CommandStartedEvent.database_name  s     w$$r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    s     
 
# 
r   c           	     	    R P                  V P                  P                  V P                  V P                  V P
                  V P                  V P                  V P                  4      # )z[<{} {} db: {!r}, command: {!r}, operation_id: {}, service_id: {}, server_connection_id: {}>)	r(   r!  r   r   r   r   r   r   r   r   s   &r   __repr__CommandStartedEvent.__repr__  sU    i
&NN##OO%%

	
r   )__cmdNN)r   r   r   r   r   r  r   r  r  r   r-  r   __classcell__r!  s   @r   r%   r%   Z  sK    	 I! !:   % %
 
r   r%   c                  r   a  ] tR tRtRtRtRR V 3R lllt]R R l4       t]R R l4       t	R	 R
 lt
RtV ;t# )r4   i  a'  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 ``""``.
c               @    V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRR/
# )r#   durationdatetime.timedeltareplyr   r   r   r   r   r   r   r   r   r   r   r   r   r&   r'   r   )r(   s   "r   r)   "CommandSucceededEvent.__annotate__  sn     ! !$! ! 	!
 !  ! $! '! ! ,! 
!r   c
           
     	   < \         SV `  VVVVVVV	R 7       \        V4      V n        VP	                  4       p
V
\
        9   g   \        W4      '       d
   / V n        R# W n        R# r  N)r  r   r   '_CommandSucceededEvent__duration_microsr   r   r   _CommandSucceededEvent__reply)r/   r5  r7  r   r   r   r   r   r   r   r   r!  s   &&&&&&&&&& r   r   CommandSucceededEvent.__init__  si     	!'!5 	 	
 ",H!5%%'**.J8.[.[)+DL Lr   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r8         & & &r   c                    V P                   # z/The duration of this operation in microseconds.)r;  r   s   &r   duration_micros%CommandSucceededEvent.duration_micros       %%%r   c                   V ^8  d   QhRR/# r$  r   )r(   s   "r   r)   r8    s      | r   c                    V P                   # z/The server failure document for this operation.)r<  r   s   &r   r7  CommandSucceededEvent.reply  r  r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r8    s     
 
# 
r   c           
     	    R P                  V P                  P                  V P                  V P                  V P
                  V P                  V P                  V P                  V P                  4      # )zp<{} {} db: {!r}, command: {!r}, operation_id: {}, duration_micros: {}, service_id: {}, server_connection_id: {}>)
r(   r!  r   r   r   r   r   rB  r   r   r   s   &r   r-  CommandSucceededEvent.__repr__  s^    ~
&NN##  OO%%	
	
r   )__duration_micros__replyr  )r   r   r   r   r   r  r   r  rB  r7  r-  r   r1  r2  s   @r   r4   r4     sK     1I! !8 & &  
 
r   r4   c                  r   a  ] tR tRtRtRtRR V 3R lllt]R R l4       t]R R l4       t	R	 R
 lt
RtV ;t# )r9   i  a&  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 ``""``.
c               @    V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRR/
# )r#   r5  r6  failurer   r   r   r   r   r   r   r   r   r   r   r   r   r&   r'   r   )r(   s   "r   r)   CommandFailedEvent.__annotate__  sn     ! !$! ! 	!
 !  ! $! '! ! ,! 
!r   c
           
     	`   < \         S
V `  VVVVVVV	R 7       \        V4      V n        W n        R# r:  )r  r   r   $_CommandFailedEvent__duration_micros_CommandFailedEvent__failure)r/   r5  rP  r   r   r   r   r   r   r   r!  s   &&&&&&&&&&r   r   CommandFailedEvent.__init__  s@     	!'!5 	 	
 ",H!5 r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   rQ    r?  r   c                    V P                   # rA  )rS  r   s   &r   rB  "CommandFailedEvent.duration_micros
  rD  r   c                   V ^8  d   QhRR/# r$  r   )r(   s   "r   r)   rQ    s       r   c                    V P                   # rG  )rT  r   s   &r   rP  CommandFailedEvent.failure  r   r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   rQ    s     
 
# 
r   c                	    R P                  V P                  P                  V P                  V P                  V P
                  V P                  V P                  V P                  V P                  V P                  4	      # )z<{} {} db: {!r}, command: {!r}, operation_id: {}, duration_micros: {}, failure: {!r}, service_id: {}, server_connection_id: {}>)r(   r!  r   r   r   r   r   rB  rP  r   r   r   s   &r   r-  CommandFailedEvent.__repr__  sh    G
&NN##  LLOO%%

	
r   )rL  	__failurer  )r   r   r   r   r   r  r   r  rB  rP  r-  r   r1  r2  s   @r   r9   r9     sK     3I! !0 & &  
 
r   r9   c                  L    ] tR tRtRtR	tR R lt]R R l4       tR R lt	R	t
R
# )
_PoolEventi%  zBase class for pool events.c                    V ^8  d   QhRRRR/# r#   addressr   r&   r'   r   )r(   s   "r   r)   _PoolEvent.__annotate__*       ! ! !T !r   c                	    Wn         R # r   _PoolEvent__addressr/   rd  s   &&r   r   _PoolEvent.__init__*       r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   re  .         r   c                    V P                   # )zRThe address (host, port) pair of the server the pool is attempting
to connect to.
rh  r   s   &r   rd  _PoolEvent.address-      
 ~~r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   re  4       @ @# @r   c                	P    V P                   P                   R V P                  : R2# ())r!  r   ri  r   s   &r   r-  _PoolEvent.__repr__4  %    ..))*!DNN+=Q??r   	__addressNr   r   r   r   r   r  r   r  rd  r-  r   r   r   r   ra  ra  %  s/    %I!  @ @r   ra  c                  X   a  ] tR tRtRtR	tR V 3R llt]R R l4       tR R lt	R	t
V ;t# )
rB   i8  zPublished 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
c               $    V ^8  d   QhRRRRRR/# r#   rd  r   optionsdict[str, Any]r&   r'   r   )r(   s   "r   r)   PoolCreatedEvent.__annotate__C  s!     ! ! !> !d !r   c                	2   < \         SV `  V4       W n        R # r   )r  r   _PoolCreatedEvent__options)r/   rd  r  r!  s   &&&r   r   PoolCreatedEvent.__init__C  s    ! r   c                   V ^8  d   QhRR/# )r#   r&   r  r   )r(   s   "r   r)   r  H  s       r   c                    V P                   # )zCAny non-default pool options that were set on this Connection Pool.)r  r   s   &r   r  PoolCreatedEvent.optionsG  r   r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r  L  s     R R# Rr   c                	l    V P                   P                   R V P                  : RV P                  : R2# rv  z, rw  )r!  r   rd  r  r   s   &r   r-  PoolCreatedEvent.__repr__L  s0    ..))*!DLL+;2dnn=OqQQr   )	__options)r   r   r   r   r   r  r   r  r  r-  r   r1  r2  s   @r   rB   rB   8  s9     I! !  R Rr   rB   c                      ] tR tRtRtRtRtR# )rJ   iP  zPublished 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   r   r   rJ   rJ   P       Ir   rJ   c                  r   a  ] tR tRtRtRtRR V 3R lllt]R R l4       t]R R l4       t	R	 R
 lt
RtV ;t# )rO   i\  a_  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
c               (    V ^8  d   QhRRRRRRRR/# 	r#   rd  r   r   r   interrupt_connectionsr   r&   r'   r   )r(   s   "r   r)   PoolClearedEvent.__annotate__i  s2     = == '=  $	=
 
=r   c                	>   < \         SV `  V4       W n        W0n        R # r   )r  r   _PoolClearedEvent__service_id(_PoolClearedEvent__interrupt_connections)r/   rd  r   r  r!  s   &&&&r   r   PoolClearedEvent.__init__i  s     	!&'<$r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r  t  s     ! !. !r   c                    V P                   # )zConnections 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   PoolClearedEvent.service_ids  s        r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r  ~  s     , ,t ,r   c                    V P                   # )zTIf True, active connections are interrupted during clearing.

.. versionadded:: 4.7
)r  r   s   &r   r  &PoolClearedEvent.interrupt_connections}  s     +++r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    s     w w# wr   c                	    V P                   P                   R V P                  : RV P                  : RV P                  : R2# r  )r!  r   rd  r  r  r   s   &r   r-  PoolClearedEvent.__repr__  sB    ..))*!DLL+;2d>O>O=RRTUYUqUqTttuvvr   )__interrupt_connectionsr  )r  r  )NF)r   r   r   r   r   r  r   r  r   r  r-  r   r1  r2  s   @r   rO   rO   \  sM     <I= = ! ! , ,w wr   rO   c                      ] tR tRtRtRtRtR# )rT   i  zPublished 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   rT   rT     r  r   rT   c                  0    ] tR tRtRtRt Rt Rt RtRt	R# )	ConnectionClosedReasoni  zeAn enum that defines values for `reason` on a
:class:`ConnectionClosedEvent`.

.. versionadded:: 3.9
staleidleerror
poolClosedr   N)
r   r   r   r   r   STALEIDLEERRORPOOL_CLOSEDr   r   r   r   r  r    s-     EFD EIKEr   r  c                  *    ] tR tRtRtRt Rt RtRtR# )ConnectionCheckOutFailedReasoni  zmAn enum that defines values for `reason` on a
:class:`ConnectionCheckOutFailedEvent`.

.. versionadded:: 3.9
timeoutr  connectionErrorr   N)	r   r   r   r   r   TIMEOUTr  
CONN_ERRORr   r   r   r   r  r    s#     GJKM"Jr   r  c                  L    ] tR tRtRtR	tR R lt]R R l4       tR R lt	R	t
R
# )_ConnectionEventi  z)Private base class for connection events.c                    V ^8  d   QhRRRR/# rc  r   )r(   s   "r   r)   _ConnectionEvent.__annotate__  rf  r   c                	    Wn         R # r   _ConnectionEvent__addressrj  s   &&r   r   _ConnectionEvent.__init__  rl  r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    rn  r   c                    V P                   # )zYThe address (host, port) pair of the server this connection is
attempting to connect to.
r  r   s   &r   rd  _ConnectionEvent.address  rq  r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    rs  r   c                	P    V P                   P                   R V P                  : R2# ru  )r!  r   r  r   s   &r   r-  _ConnectionEvent.__repr__  ry  r   rz  Nr|  r   r   r   r  r    s/    3I!  @ @r   r  c                  X   a  ] tR tRtRtR	tR V 3R llt]R R l4       tR R lt	R	t
V ;t# )
_ConnectionIdEventi  z4Private base class for connection events with an id.c               $    V ^8  d   QhRRRRRR/# r#   rd  r   r   r   r&   r'   r   )r(   s   "r   r)   _ConnectionIdEvent.__annotate__  s!     - - - - -r   c                	2   < \         SV `  V4       W n        R # r   )r  r   !_ConnectionIdEvent__connection_id)r/   rd  r   r!  s   &&&r   r   _ConnectionIdEvent.__init__  s    !,r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    s     $ $s $r   c                    V P                   # )zThe ID of the connection.)r  r   s   &r   r    _ConnectionIdEvent.connection_id  s     ###r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    s     X X# Xr   c                	l    V P                   P                   R V P                  : RV P                  : R2# r  )r!  r   rd  r  r   s   &r   r-  _ConnectionIdEvent.__repr__  s3    ..))*!DLL+;2d>R>R=UUVWWr   )__connection_id)r   r   r   r   r   r  r   r  r   r-  r   r1  r2  s   @r   r  r    s5    >$I- - $ $X Xr   r  c                  X   a  ] tR tRtRtR	tR V 3R llt]R R l4       tR R lt	R	t
V ;t# )
_ConnectionDurationEventi  z9Private base class for connection events with a duration.c               (    V ^8  d   QhRRRRRRRR/# )	r#   rd  r   r   r   r5  Optional[float]r&   r'   r   )r(   s   "r   r)   %_ConnectionDurationEvent.__annotate__  s)     # # # # #\` #r   c                	2   < \         SV `  W4       W0n        R # r   )r  r   "_ConnectionDurationEvent__duration)r/   rd  r   r5  r!  s   &&&&r   r   !_ConnectionDurationEvent.__init__  s    0"r   c                   V ^8  d   QhRR/# )r#   r&   r  r   )r(   s   "r   r)   r    s      / r   c                    V P                   # )z=The duration of the connection event.

.. versionadded:: 4.7
)r  r   s   &r   r5  !_ConnectionDurationEvent.duration  s     r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    s     k k# kr   c                	    V P                   P                   R V P                  : RV P                  : RV P                  : R2# r  )r!  r   rd  r   r  r   s   &r   r-  !_ConnectionDurationEvent.__repr__  sB    ..))*!DLL+;2d>P>P=SSUVZVeVeUhhijjr   )
__duration)r   r   r   r   r   r  r   r  r5  r-  r   r1  r2  s   @r   r  r    s5    CI# #  k kr   r  c                      ] tR tRtRtRtRtR# )rY   i  ai  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   rY   rY     s    
 Ir   rY   c                      ] tR tRtRtRtRtR# )r^   i  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   r^   r^          Ir   r^   c                  X   a  ] tR tRtRtR	tR V 3R llt]R R l4       tR R lt	R	t
V ;t# )
rd   i  a3  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
c               $    V ^8  d   QhRRRRRR/# )r#   rd  r   r   r   reasonr   r   )r(   s   "r   r)   "ConnectionClosedEvent.__annotate__!  s!        c r   c                	2   < \         SV `  W4       W0n        R # r   )r  r   _ConnectionClosedEvent__reason)r/   rd  r   r  r!  s   &&&&r   r   ConnectionClosedEvent.__init__!  s    0r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r  &         r   c                    V P                   # )zA reason explaining why this connection was closed.

The reason must be one of the strings from the
:class:`ConnectionClosedReason` enum.
)r  r   s   &r   r  ConnectionClosedEvent.reason%       }}r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r  .       
 
# 
r   c                	    R P                  V P                  P                  V P                  V P                  V P
                  4      # )z{}({!r}, {!r}, {!r}))r(   r!  r   rd  r   r  r   s   &r   r-  ConnectionClosedEvent.__repr__.  s9    %,,NN##LLMM	
 	
r   __reasonr   r   r   r   r   r  r   r  r  r-  r   r1  r2  s   @r   rd   rd     s7     I   
 
r   rd   c                      ] tR tRtRtRtRtR# )ri   i7  zPublished 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   ri   ri   7  r  r   ri   c                  X   a  ] tR tRtRtR	tR V 3R llt]R R l4       tR R lt	R	t
V ;t# )
rn   iC  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
c               (    V ^8  d   QhRRRRRRRR/# )	r#   rd  r   r  r   r5  r  r&   r'   r   )r(   s   "r   r)   *ConnectionCheckOutFailedEvent.__annotate__O  s)       #  UY r   c                	8   < \         SV `  V^ VR7       W n        R# )    )rd  r   r5  N)r  r   &_ConnectionCheckOutFailedEvent__reason)r/   rd  r  r5  r!  s   &&&&r   r   &ConnectionCheckOutFailedEvent.__init__O  s    HMr   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r  T  r  r   c                    V P                   # )zA reason explaining why connection check out failed.

The reason must be one of the strings from the
:class:`ConnectionCheckOutFailedReason` enum.
)r  r   s   &r   r  $ConnectionCheckOutFailedEvent.reasonS  r  r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r  \       d d# dr   c                	    V P                   P                   R V P                  : RV P                  : RV P                  : R2# r  )r!  r   rd  r  r5  r   s   &r   r-  &ConnectionCheckOutFailedEvent.__repr__\  s?    ..))*!DLL+;2dmm=NbQUQ^Q^Paabccr   r  r  r2  s   @r   rn   rn   C  s9     I   d dr   rn   c                      ] tR tRtRtRtRtR# )rs   i`  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   rs   rs   `  r  r   rs   c                      ] tR tRtRtRtRtR# )rx   im  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   rx   rx   m  r  r   rx   c                  b    ] tR tRtRtRtR R lt]R R l4       t]R R l4       t	R	 R
 lt
RtR# )_ServerEventiz  zBase class for server events.c               $    V ^8  d   QhRRRRRR/# r#   server_addressr   topology_idr
   r&   r'   r   )r(   s   "r   r)   _ServerEvent.__annotate__  s!     ) )x )h )4 )r   c                	    Wn         W n        R # r   )_ServerEvent__server_address_ServerEvent__topology_id)r/   r  r  s   &&&r   r   _ServerEvent.__init__  s     .(r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    s     % % %r   c                    V P                   # )z+The address (host, port) pair of the server)r  r   s   &r   r  _ServerEvent.server_address  s     $$$r   c                   V ^8  d   QhRR/# r#   r&   r
   r   )r(   s   "r   r)   r         " "X "r   c                    V P                   # z>A unique identifier for the topology this server is a part of.)r  r   s   &r   r  _ServerEvent.topology_id       !!!r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    r  r   c                	j    R V P                   P                   RV P                   RV P                   R2# )<  topology_id: >)r!  r   r  r  r   s   &r   r-  _ServerEvent.__repr__  s8    4>>**+1T-@-@,APTP`P`Oaabccr   )__server_address__topology_idN)r   r   r   r   r   r  r   r  r  r  r-  r   r   r   r   r
  r
  z  sC    '5I) % % " "d dr   r
  c                  n   a  ] tR tRtRtRtR V 3R llt]R R l4       t]R R l4       t	R	 R
 lt
RtV ;t# )r   i  zBPublished when server description changes.

.. versionadded:: 3.3
c               (    V ^8  d   QhRRRRRRRR/# )r#   previous_descriptionr   new_descriptionargsr   r&   r'   r   )r(   s   "r   r)   *ServerDescriptionChangedEvent.__annotate__  s2     1 1/1 +1 	1
 
1r   c                	<   < \         SV `  ! V!   Wn        W n        R # r   )r  r   4_ServerDescriptionChangedEvent__previous_description/_ServerDescriptionChangedEvent__new_descriptionr/   r)  r*  r+  r!  s   &&&*r   r   &ServerDescriptionChangedEvent.__init__       	$&:#!0r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   r,    s     + +&7 +r   c                    V P                   # )zEThe previous
:class:`~pymongo.server_description.ServerDescription`.
)r.  r   s   &r   r)  2ServerDescriptionChangedEvent.previous_description      
 ***r   c                   V ^8  d   QhRR/# r4  r   )r(   s   "r   r)   r,    s     & &!2 &r   c                    V P                   # )z@The new
:class:`~pymongo.server_description.ServerDescription`.
)r/  r   s   &r   r*  -ServerDescriptionChangedEvent.new_description      
 %%%r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r,    r  r   c                	    R P                  V P                  P                  V P                  V P                  V P
                  4      # )z <{} {} changed from: {}, to: {}>)r(   r!  r   r  r)  r*  r   s   &r   r-  &ServerDescriptionChangedEvent.__repr__  s=    188NN##%%  	
 	
r   __new_description__previous_descriptionrA  r@  r   r   r   r   r   r  r   r  r)  r*  r-  r   r1  r2  s   @r   r   r     L    
 @I1 1 + + & &
 
r   r   c                      ] tR tRtRtRtRtR# )r   i  z=Published when server is initialized.

.. versionadded:: 3.3
r   Nr  r   r   r   r   r         
 Ir   r   c                      ] tR tRtRtRtRtR# )r   i  z8Published when server is closed.

.. versionadded:: 3.3
r   Nr  r   r   r   r   r     rF  r   r   c                  L    ] tR tRtRtR	tR R lt]R R l4       tR R lt	R	t
R
# )TopologyEventi  z+Base class for topology description events.c                    V ^8  d   QhRRRR/# r#   r  r
   r&   r'   r   )r(   s   "r   r)   TopologyEvent.__annotate__  s     ) )H ) )r   c                	    Wn         R # r   _TopologyEvent__topology_id)r/   r  s   &&r   r   TopologyEvent.__init__  s    (r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   rL    r  r   c                    V P                   # r  rN  r   s   &r   r  TopologyEvent.topology_id  r  r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   rL    s     N N# Nr   c                	P    R V P                   P                   RV P                   R2# )r   r"  r#  )r!  r   r  r   s   &r   r-  TopologyEvent.__repr__  s)    4>>**+>$:J:J9K1MMr   )r&  N)r   r   r   r   r   r  r   r  r  r-  r   r   r   r   rI  rI    s/    5"I) " "N Nr   rI  c                  n   a  ] tR tRtRtRtR V 3R llt]R R l4       t]R R l4       t	R	 R
 lt
RtV ;t# )r   i  zHPublished when the topology description changes.

.. versionadded:: 3.3
c               (    V ^8  d   QhRRRRRRRR/# )r#   r)  r   r*  r+  r   r&   r'   r   )r(   s   "r   r)   ,TopologyDescriptionChangedEvent.__annotate__  s2     1 111 -1 	1
 
1r   c                	<   < \         SV `  ! V!   Wn        W n        R # r   )r  r   6_TopologyDescriptionChangedEvent__previous_description1_TopologyDescriptionChangedEvent__new_descriptionr0  s   &&&*r   r   (TopologyDescriptionChangedEvent.__init__  r2  r   c                   V ^8  d   QhRR/# r#   r&   r   r   )r(   s   "r   r)   rY    s     + +&9 +r   c                    V P                   # )zIThe previous
:class:`~pymongo.topology_description.TopologyDescription`.
)r[  r   s   &r   r)  4TopologyDescriptionChangedEvent.previous_description  r7  r   c                   V ^8  d   QhRR/# r_  r   )r(   s   "r   r)   rY    s     & &!4 &r   c                    V P                   # )zDThe new
:class:`~pymongo.topology_description.TopologyDescription`.
)r\  r   s   &r   r*  /TopologyDescriptionChangedEvent.new_description  r;  r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   rY    r  r   c                	    R P                  V P                  P                  V P                  V P                  V P
                  4      # )z-<{} topology_id: {} changed from: {}, to: {}>)r(   r!  r   r  r)  r*  r   s   &r   r-  (TopologyDescriptionChangedEvent.__repr__  s=    >EENN##%%  	
 	
r   r?  rB  rC  r2  s   @r   r   r     rD  r   r   c                      ] tR tRtRtRtRtR# )r   i  zCPublished when the topology is initialized.

.. versionadded:: 3.3
r   Nr  r   r   r   r   r     rF  r   r   c                      ] tR tRtRtRtRtR# )r   i  z>Published when the topology is closed.

.. versionadded:: 3.3
r   Nr  r   r   r   r   r     rF  r   r   c                  f    ] tR tRtRtRtRR R llt]R R l4       t]R R l4       t	R	 R
 lt
RtR# )_ServerHeartbeatEventi  z'Base class for server heartbeat events.c               $    V ^8  d   QhRRRRRR/# r#   r   r   awaitedr   r&   r'   r   )r(   s   "r   r)   "_ServerHeartbeatEvent.__annotate__  s!     ! !h ! !$ !r   c                	    Wn         W n        R # r   )$_ServerHeartbeatEvent__connection_id_ServerHeartbeatEvent__awaited)r/   r   rn  s   &&&r   r   _ServerHeartbeatEvent.__init__  s    , r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   ro  "  s     $ $x $r   c                    V P                   # )zCThe address (host, port) of the server this heartbeat was sent
to.
)rq  r   s   &r   r   #_ServerHeartbeatEvent.connection_id!  s    
 ###r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   ro  )  s       r   c                    V P                   # )zWWhether the heartbeat was issued as an awaitable hello command.

.. versionadded:: 4.6
)rr  r   s   &r   rn  _ServerHeartbeatEvent.awaited(  s     ~~r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   ro  0  s     [ [# [r   c                	j    R V P                   P                   RV P                   RV P                   R2# )r   r!  z
 awaited: r#  )r!  r   r   rn  r   s   &r   r-  _ServerHeartbeatEvent.__repr__0  s4    4>>**+1T-?-?,@
4<<.XYZZr   )	__awaitedr  N)r  r}  F)r   r   r   r   r   r  r   r  r   rn  r-  r   r   r   r   rk  rk    sC    10I! $ $  [ [r   rk  c                      ] tR tRtRtRtRtR# )r   i4  z>Published when a heartbeat is started.

.. versionadded:: 3.3
r   Nr  r   r   r   r   r   4  rF  r   r   c                     a  ] tR tRtRtRtRR V 3R lllt]R R l4       t]R R l4       t	]R	 V 3R
 ll4       t
R R ltRtV ;t# )r   i=  zAFired when the server heartbeat succeeds.

.. versionadded:: 3.3
c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r#   r5  floatr7  Hello[dict[str, Any]]r   r   rn  r   r&   r'   r   )r(   s   "r   r)   *ServerHeartbeatSucceededEvent.__annotate__E  s<     	 		 %	  		
 	 
	r   c                	>   < \         SV `  W44       Wn        W n        R # r   )r  r   (_ServerHeartbeatSucceededEvent__duration%_ServerHeartbeatSucceededEvent__replyr/   r5  r7  r   rn  r!  s   &&&&&r   r   &ServerHeartbeatSucceededEvent.__init__E  s     	0"r   c                   V ^8  d   QhRR/# r#   r&   r  r   )r(   s   "r   r)   r  Q        % r   c                    V P                   # z/The duration of this heartbeat in microseconds.)r  r   s   &r   r5  &ServerHeartbeatSucceededEvent.durationP  r   r   c                   V ^8  d   QhRR/# )r#   r&   r  r   )r(   s   "r   r)   r  V  s      , r   c                    V P                   # )z-An instance of :class:`~pymongo.hello.Hello`.)r  r   s   &r   r7  #ServerHeartbeatSucceededEvent.replyU  r  r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r  [       	 	 	r   c                   < \         SV `  # zWhether 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  rn  r)  s   &r   rn  %ServerHeartbeatSucceededEvent.awaitedZ       wr   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r  f       
 
# 
r   c                	    R P                  V P                  P                  V P                  V P                  V P
                  V P                  4      # )z,<{} {} duration: {}, awaited: {}, reply: {}>r(   r!  r   r   r5  rn  r7  r   s   &r   r-  &ServerHeartbeatSucceededEvent.__repr__f  s@    =DDNN##MMLLJJ
 	
r   r  rM  r~  r   r   r   r   r   r  r   r  r5  r7  rn  r-  r   r1  r2  s   @r   r   r   =  s_    
 *I	 	     	 	
 
r   r   c                     a  ] tR tRtRtRtRR V 3R lllt]R R l4       t]R R l4       t	]R	 V 3R
 ll4       t
R R ltRtV ;t# )r   ip  zlFired when the server heartbeat fails, either with an "ok: 0"
or a socket exception.

.. versionadded:: 3.3
c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r#   r5  r  r7  	Exceptionr   r   rn  r   r&   r'   r   )r(   s   "r   r)   'ServerHeartbeatFailedEvent.__annotate__y  s4      &/@HSW	r   c                	>   < \         SV `  W44       Wn        W n        R # r   )r  r   %_ServerHeartbeatFailedEvent__duration"_ServerHeartbeatFailedEvent__replyr  s   &&&&&r   r   #ServerHeartbeatFailedEvent.__init__y  s     	0"r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r    r  r   c                    V P                   # r  )r  r   s   &r   r5  #ServerHeartbeatFailedEvent.duration  r   r   c                   V ^8  d   QhRR/# )r#   r&   r  r   )r(   s   "r   r)   r    s      y r   c                    V P                   # )zA subclass of :exc:`Exception`.)r  r   s   &r   r7   ServerHeartbeatFailedEvent.reply  r  r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r    r  r   c                   < \         SV `  # r  r  r)  s   &r   rn  "ServerHeartbeatFailedEvent.awaited  r  r   c                   V ^8  d   QhRR/# r   r   )r(   s   "r   r)   r    r  r   c                	    R P                  V P                  P                  V P                  V P                  V P
                  V P                  4      # )z.<{} {} duration: {}, awaited: {}, reply: {!r}>r  r   s   &r   r-  #ServerHeartbeatFailedEvent.__repr__  s@    ?FFNN##MMLLJJ
 	
r   r  r~  r  r2  s   @r   r   r   p  s_     *I      	 	
 
r   r   c                     ] tR tRtRtR R lt]R R l4       t]R R l4       t]R	 R
 l4       t	]R R l4       t
]R R l4       tR R ltRAR R lltRBR R lltRCR R lltR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR( R) ltR* R+ ltR, R- ltRDR. R/ lltR0 R1 ltR2 R3 ltR4 R5 ltR6 R7 ltR8 R9 lt R: R; lt!R< R= lt"R> R? lt#R@t$R# )E_EventListenersi  zConfigure event listeners for a client instance.

Any event listeners registered globally are included by default.

:param listeners: A list of event listeners.
c                   V ^8  d   QhRR/# )r#   r   z"Optional[Sequence[_EventListener]]r   )r(   s   "r   r)   _EventListeners.__annotate__  s     > >"D >r   c                	0   \         P                  R ,          V n        \         P                  R ,          V n        \         P
                  pVR ,          V n        \         P                  R ,          V n        \         P                  R ,          V n
        VEe   V F  p\        V\        4      '       d   V P                  P                  V4       \        V\        4      '       d   V P                  P                  V4       \        V\        4      '       d   V P                  P                  V4       \        V\         4      '       d   V P                  P                  V4       \        V\"        4      '       g   K  V P                  P                  V4       K  	  \%        V P                  4      V n        \%        V P                  4      V n        \%        V P                  4      V n        \%        V P                  4      V n        \%        V P                  4      V n        R# ):NNNN)r   r   "_EventListeners__command_listenersr   !_EventListeners__server_listenersr   +_EventListeners__server_heartbeat_listenersr   #_EventListeners__topology_listenersr   _EventListeners__cmap_listenersr   r!   r   r   r}   r   r@   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   _EventListeners.__init__  s~   #-#?#?#B ","="=a"@33,/F)$.$A$A!$D! * 9 9! <  c?33,,33C8c>22++2237c#:;;55<<SAc#344--44S9c#9::))005 ! '+4+C+C&D#$()@)@$A!.243T3T.U+&*4+D+D&E#"&t'<'<"=r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r         + +d +r   c                    V P                   # )z-Are any CommandListener instances registered?)r  r   s   &r   enabled_for_commands$_EventListeners.enabled_for_commands       ***r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r    s     ) )D )r   c                    V P                   # )z,Are any ServerListener instances registered?)r  r   s   &r   enabled_for_server"_EventListeners.enabled_for_server  s     (((r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r    s     3 3d 3r   c                    V P                   # )z5Are any ServerHeartbeatListener instances registered?)r  r   s   &r   enabled_for_server_heartbeat,_EventListeners.enabled_for_server_heartbeat  s     222r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r    r  r   c                    V P                   # )z.Are any TopologyListener instances registered?)r  r   s   &r   enabled_for_topology$_EventListeners.enabled_for_topology  r  r   c                   V ^8  d   QhRR/# r  r   )r(   s   "r   r)   r    s     ' '$ 'r   c                    V P                   # )z4Are any ConnectionPoolListener instances registered?)r  r   s   &r   enabled_for_cmap _EventListeners.enabled_for_cmap  s     &&&r   c                   V ^8  d   QhRR/# )r#   r&   zlist[_EventListeners]r   )r(   s   "r   r)   r    s     
 
!6 
r   c                    V P                   V P                  ,           V P                  ,           V P                  ,           V P                  ,           # )z#List of registered event listeners.)r  r  r  r  r  r   s   &r   event_listeners_EventListeners.event_listeners  sN     $$//0%%& ''( ##	$	
r   Nc               8    V ^8  d   Qh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   op_idr   r   r&   r'   r   )r(   s   "r   r)   r    sZ     $$ $$$$ $$ 	$$
  $$ ,$$ $$ '$$ 
$$r   c           
         Vf   Tp\        VVVVVVVR7      pV P                   F  p	 V	P                  V4       K  	  R#   \         d    \	        4         K3  i ; i)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   )r%   r  r0   r  r   )
r/   r  r   r   r   r   r  r   r$   
subscribers
   &&&&&&&&  r   publish_command_start%_EventListeners.publish_command_start  si    * =E#!!5
 22J$""5) 3  $!#$s   A  AAc               D    V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRR/# )r#   r5  r   r7  r   r   r   r   r   r   r   r   r   r  r   r   speculative_hellor   r   r&   r'   r   )r(   s   "r   r)   r  
  sx     /$ /$/$ /$ 	/$
 /$  /$ ,/$ /$ '/$  /$ /$ 
/$r   c                    Vf   TpV	'       d   / p\        VVVVVVVV
VR7	      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)ap  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   )r4   r  r6   r  r   )r/   r5  r7  r   r   r   r   r  r   r  r   r$   r  s   &&&&&&&&&&&  r   publish_command_success'_EventListeners.publish_command_success
  sy    4 =E E%'!5

 22J$$$U+ 3  $!#$s   AA%$A%c               @    V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRR/
# )r#   r5  r   rP  r   r   r   r   r   r   r   r   r   r  r   r   r   r&   r'   r   )r(   s   "r   r)   r  ;  sn     *$ *$*$ *$ 	*$
 *$  *$ ,*$ *$ '*$ *$ 
*$r   c
                    Vf   Tp\        VVVVVVVV	VR7	      p
V P                   F  p VP                  V
4       K  	  R#   \         d    \	        4         K3  i ; i)aM  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  )r9   r  r<   r  r   )r/   r5  rP  r   r   r   r   r  r   r   r$   r  s   &&&&&&&&&&  r   publish_command_failure'_EventListeners.publish_command_failure;  so    2 =E"!'!5

 22J$!!%( 3  $!#$s   AAAc               $    V ^8  d   QhRRRRRR/# rm  r   )r(   s   "r   r)   r  g  s#     $ $h $QU $Z^ $r   c                    \        W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zPublish 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)r   r  r0   r  r   )r/   r   rn  r$   r  s   &&&  r    publish_server_heartbeat_started0_EventListeners.publish_server_heartbeat_startedg  sH     ,MC;;J$""5) <  $!#$   3AAc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r#   r   r   r5  r  r7  r  rn  r   r&   r'   r   )r(   s   "r   r)   r  u  s4     $ $%$16$?T$_c$	$r   c                    \        W#W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)aP  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)r   r  r6   r  r   r/   r   r5  r7  rn  r$   r  s   &&&&&  r   "publish_server_heartbeat_succeeded2_EventListeners.publish_server_heartbeat_succeededu  sJ     .h}V;;J$$$U+ <  $!#$   4AAc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r#   r   r   r5  r  r7  r  rn  r   r&   r'   r   )r(   s   "r   r)   r    s4     $ $%$16$?H$SW$	$r   c                    \        W#W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)aM  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)r   r  r<   r  r   r  s   &&&&&  r   publish_server_heartbeat_failed/_EventListeners.publish_server_heartbeat_failed  sJ     +8MS;;J$!!%( <  $!#$r  c               $    V ^8  d   QhRRRRRR/# r  r   )r(   s   "r   r)   r    "     $ $H $8 $X\ $r   c                    \        W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zPublish 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)r   r  r   r  r   r/   r  r  r$   r  s   &&&  r   publish_server_opened%_EventListeners.publish_server_opened  sH     #>?11J$!!%( 2  $!#$r  c               $    V ^8  d   QhRRRRRR/# r  r   )r(   s   "r   r)   r    r  r   c                    \        W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zPublish 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)r   r  r   r  r   r  s   &&&  r   publish_server_closed%_EventListeners.publish_server_closed  sH     ".>11J$!!%( 2  $!#$r  c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r#   r)  r   r*  r  r   r  r
   r&   r'   r   )r(   s   "r   r)   r    s<     $ $/$ +$ !	$
 $ 
$r   c                    \        WW44      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)aN  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)r   r  r   r  r   )r/   r)  r*  r  r  r$   r  s   &&&&&  r   "publish_server_description_changed2_EventListeners.publish_server_description_changed  sO     . >
 11J$..u5 2  $!#$r  c                    V ^8  d   QhRRRR/# rK  r   )r(   s   "r   r)   r         $ $8 $ $r   c                    \        V4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zPublish a TopologyOpenedEvent to all topology listeners.

:param topology_id: A unique identifier for the topology this server
   is a part of.
N)r   r  r   r  r   r/   r  r$   r  s   &&  r   publish_topology_opened'_EventListeners.publish_topology_opened  H     $K033J$!!%( 4  $!#$r  c                    V ^8  d   QhRRRR/# rK  r   )r(   s   "r   r)   r    r  r   c                    \        V4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zPublish a TopologyClosedEvent to all topology listeners.

:param topology_id: A unique identifier for the topology this server
   is a part of.
N)r   r  r   r  r   r  s   &&  r   publish_topology_closed'_EventListeners.publish_topology_closed  r  r  c               (    V ^8  d   QhRRRRRRRR/# )r#   r)  r   r*  r  r
   r&   r'   r   )r(   s   "r   r)   r    s2     $ $1$ -$ 	$
 
$r   c                    \        WV4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)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)r   r  r   r  r   )r/   r)  r*  r  r$   r  s   &&&&  r   $publish_topology_description_changed4_EventListeners.publish_topology_description_changed  sL     00DWbc33J$..u5 4  $!#$r  c               $    V ^8  d   QhRRRRRR/# r  r   )r(   s   "r   r)   r    s"     $ $H $~ $RV $r   c                    \        W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)z:Publish a :class:`PoolCreatedEvent` to all pool listeners.N)rB   r  rF   r  r   )r/   rd  r  r$   r  s   &&&  r   publish_pool_created$_EventListeners.publish_pool_created  sF     2//J$''. 0  $!#$r  c                    V ^8  d   QhRRRR/# rc  r   )r(   s   "r   r)   r    s     $ $( $t $r   c                    \        V4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)z8Publish a :class:`PoolReadyEvent` to all pool listeners.N)rJ   r  rL   r  r   r/   rd  r$   r  s   &&  r   publish_pool_ready"_EventListeners.publish_pool_ready  sF    w'//J$%%e, 0  $!#$r  c               (    V ^8  d   QhRRRRRRRR/# r  r   )r(   s   "r   r)   r    s2     $ $$ '$  $	$
 
$r   c                    \        WV4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)z:Publish a :class:`PoolClearedEvent` to all pool listeners.N)rO   r  rQ   r  r   )r/   rd  r   r  r$   r  s   &&&&  r   publish_pool_cleared$_EventListeners.publish_pool_cleared  sK     !6KL//J$''. 0  $!#$r  c                    V ^8  d   QhRRRR/# rc  r   )r(   s   "r   r)   r    s     $ $8 $ $r   c                    \        V4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)z9Publish a :class:`PoolClosedEvent` to all pool listeners.N)rT   r  rV   r  r   r!  s   &&  r   publish_pool_closed#_EventListeners.publish_pool_closed  sF    (//J$&&u- 0  $!#$r  c               $    V ^8  d   QhRRRRRR/# r  r   )r(   s   "r   r)   r  &  s"     	$ 	$( 	$3 	$SW 	$r   c                    \        W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zGPublish a :class:`ConnectionCreatedEvent` to all connection
listeners.
N)rY   r  r[   r  r   r/   rd  r   r$   r  s   &&&  r   publish_connection_created*_EventListeners.publish_connection_created&  sH     'w>//J$--e4 0  $!#$r  c               (    V ^8  d   QhRRRRRRRR/# 	r#   rd  r   r   r   r5  r  r&   r'   r   )r(   s   "r   r)   r  1  s,     	$ 	$	$03	$?D	$		$r   c                    \        WV4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zDPublish a :class:`ConnectionReadyEvent` to all connection listeners.N)r^   r  r`   r  r   r/   rd  r   r5  r$   r  s   &&&&  r   publish_connection_ready(_EventListeners.publish_connection_ready1  sJ     %WXF//J$++E2 0  $!#$r  c               (    V ^8  d   QhRRRRRRRR/# )	r#   rd  r   r   r   r  r   r&   r'   r   )r(   s   "r   r)   r  <  s*     	$ 	$ 	$# 	$WZ 	$_c 	$r   c                    \        WV4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zFPublish a :class:`ConnectionClosedEvent` to all connection
listeners.
N)rd   r  rf   r  r   )r/   rd  r   r  r$   r  s   &&&&  r   publish_connection_closed)_EventListeners.publish_connection_closed<  sJ     &gfE//J$,,U3 0  $!#$r  c                    V ^8  d   QhRRRR/# rc  r   )r(   s   "r   r)   r  G  s     	$ 	$H 	$ 	$r   c                    \        V4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zOPublish a :class:`ConnectionCheckOutStartedEvent` to all connection
listeners.
N)ri   r  rk   r  r   r!  s   &&  r   $publish_connection_check_out_started4_EventListeners.publish_connection_check_out_startedG  sH     /w7//J$77> 0  $!#$r  c               (    V ^8  d   QhRRRRRRRR/# )	r#   rd  r   r  r   r5  r  r&   r'   r   )r(   s   "r   r)   r  R  s,     $ $$),$8=$	$r   c                    \        WV4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zNPublish a :class:`ConnectionCheckOutFailedEvent` to all connection
listeners.
N)rn   r  rp   r  r   )r/   rd  r  r5  r$   r  s   &&&&  r   #publish_connection_check_out_failed3_EventListeners.publish_connection_check_out_failedR  sJ     .gxH//J$66u= 0  $!#$r  c               (    V ^8  d   QhRRRRRRRR/# r2  r   )r(   s   "r   r)   r  _  s,     $ $$03$?D$	$r   c                    \        WV4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zJPublish a :class:`ConnectionCheckedOutEvent` to all connection
listeners.
N)rs   r  ru   r  r   r4  s   &&&&  r   publish_connection_checked_out._EventListeners.publish_connection_checked_out_  sJ     *'(K//J$11%8 0  $!#$r  c               $    V ^8  d   QhRRRRRR/# r  r   )r(   s   "r   r)   r  l  s"     	$ 	$X 	$c 	$VZ 	$r   c                    \        W4      pV P                   F  p VP                  V4       K  	  R#   \         d    \	        4         K3  i ; i)zIPublish a :class:`ConnectionCheckedInEvent` to all connection
listeners.
N)rx   r  rz   r  r   r.  s   &&&  r   publish_connection_checked_in-_EventListeners.publish_connection_checked_inl  sH     )@//J$007 0  $!#$r  )
__cmap_listeners__command_listeners__enabled_for_cmap__enabled_for_commands__enabled_for_server__enabled_for_server_heartbeat__enabled_for_topology__server_heartbeat_listeners__server_listeners__topology_listenersr0  )NNFr  )NNr  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/  r5  r9  r=  rA  rE  rI  r   r   r   r   r  r    s    >2 + + ) ) 3 3 + + ' '
$$L/$b*$X$$&$&$$$0$$$($$$$	$	$	$	$$$	$ 	$r   r  )r   r   r   r   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!   r@   r}   r   r   r   r   r   r   r   r%   r4   r9   ra  rB   rJ   rO   rT   r  r  r  r  r  rY   r^   rd   ri   rn   rs   rx   r
  r   r   r   rI  r   r   r   rk  r   r   r   r  r   r   r   <module>r_     sv  l\ #  ' B B " , I 2"<@ 	
 BB+
7 7"n ":u"^ u"p"n ">"~ "<"^ "<+
$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   