@@ -150,7 +150,8 @@ def async_send_with_transport(
150150
151151
152152class Zeroconf (QuietLogger ):
153-
153+ """High level mDNS service discovery: register services, browse for
154+ them, and resolve their details on the local network."""
154155
155156 def __init__ (
156157 self ,
@@ -160,7 +161,7 @@ def __init__(
160161 apple_p2p : bool = False ,
161162 use_asyncio : bool | None = None ,
162163 ) -> None :
163- multicast communications , listening and reaping threads .
164+ """Open the multicast sockets and start serving on the chosen interfaces .
164165
165166 :param interfaces: :class:`InterfaceChoice` or a list of IP addresses
166167 (IPv4 and IPv6) and interface indexes (IPv6 only).
@@ -317,17 +318,18 @@ def get_service_info(
317318 return None
318319
319320 def add_service_listener (self , type_ : str , listener : ServiceListener ) -> None :
320- will then have its add_service and remove_service methods called when
321- services of that type become available and unavailable."""
321+ """Browse for a type and deliver add, remove, and update callbacks to the listener."""
322322 self .remove_service_listener (listener )
323323 self .browsers [listener ] = ServiceBrowser (self , type_ , listener )
324324
325325 def remove_service_listener (self , listener : ServiceListener ) -> None :
326+ """Stop the browser behind the given listener."""
326327 if listener in self .browsers :
327328 self .browsers [listener ].cancel ()
328329 del self .browsers [listener ]
329330
330331 def remove_all_service_listeners (self ) -> None :
332+ """Stop the browsers behind every registered listener."""
331333 for listener in list (self .browsers ):
332334 self .remove_service_listener (listener )
333335
@@ -647,6 +649,7 @@ async def async_check_service(
647649 cooperating_responders : bool = False ,
648650 strict : bool = True ,
649651 ) -> None :
652+ """Probe the network for name uniqueness, renaming first when allowed."""
650653 instance_name = instance_name_from_service_info (info , strict = strict )
651654 if cooperating_responders :
652655 return
@@ -685,11 +688,7 @@ def add_listener(
685688 listener : RecordUpdateListener ,
686689 question : DNSQuestion | list [DNSQuestion ] | None ,
687690 ) -> None :
688- its update_record method called when information is available to
689- answer the question (s ).
690-
691- This function is threadsafe
692- """
691+ """Subscribe a record update listener, optionally scoped to questions; threadsafe."""
693692 assert self .loop is not None
694693 self .loop .call_soon_threadsafe (self .record_manager .async_add_listener , listener , question )
695694
@@ -706,11 +705,7 @@ def async_add_listener(
706705 listener : RecordUpdateListener ,
707706 question : DNSQuestion | list [DNSQuestion ] | None ,
708707 ) -> None :
709- its update_record method called when information is available to
710- answer the question(s).
711-
712- This function is not threadsafe and must be called in the eventloop.
713- """
708+ """Subscribe a record update listener, optionally scoped to questions; event loop only."""
714709 self .record_manager .async_add_listener (listener , question )
715710
716711 def async_remove_listener (self , listener : RecordUpdateListener ) -> None :
@@ -797,10 +792,7 @@ def _shutdown_threads(self) -> None:
797792 self .loop .close ()
798793
799794 def close (self ) -> None :
800- servicing further queries .
801-
802- This method is idempotent and irreversible .
803- """
795+ """Shut down the sockets and engine for good; safe to call repeatedly."""
804796 assert self .loop is not None
805797 if self .loop .is_running ():
806798 if self .loop == get_running_loop ():
@@ -814,15 +806,7 @@ def close(self) -> None:
814806 self ._shutdown_threads ()
815807
816808 async def _async_close (self ) -> None :
817- servicing further queries.
818-
819- This method is idempotent and irreversible.
820-
821- This call only intended to be used by AsyncZeroconf
822-
823- Callers are responsible for unregistering all services
824- before calling this function
825- """
809+ """Shut down for AsyncZeroconf; callers unregister services first."""
826810 self ._close ()
827811 await self .engine ._async_close () # pylint: disable=protected-access
828812 self ._shutdown_threads ()
0 commit comments