Ë
    R/jM  ã                  óD   — d Z ddlmZ ddlmZ ddlmZ eZ G d„ d«      Z	y	)
a‡  Multicast DNS Service Discovery for Python, v0.14-wmcbrine
Copyright 2003 Paul Scott-Murphy, 2014 William McBrine

This module provides a framework for the use of DNS Service Discovery
using IP multicast.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
é    )Úannotationsé   )ÚServiceNameAlreadyRegisteredé   )ÚServiceInfoc                  óx   — e Zd ZdZdZ	 	 dd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zy)ÚServiceRegistryz„A registry to keep track of services.

    The registry must only be accessed from
    the event loop as it is not thread safe.
    )Ú	_servicesÚhas_entriesÚserversÚtypesc                ó<   — i | _         i | _        i | _        d| _        y)z!Create the ServiceRegistry class.FN)r
   r   r   r   ©Úselfs    úM/home/josh/.local/lib/python3.12/site-packages/zeroconf/_services/registry.pyÚ__init__zServiceRegistry.__init__(   s!   € ð 24ˆŒØ&(ˆŒ
Ø(*ˆŒØ!&ˆÕó    c                ó&   — | j                  |«       y)z"Add a new service to the registry.N)Ú_add©r   Úinfos     r   Ú	async_addzServiceRegistry.async_add1   s   € à�	‰	�$�r   c                óV   — | j                  t        |t        «      r|«       y|g«       y)z'Remove a new service from the registry.N)Ú_removeÚ
isinstanceÚlistr   s     r   Úasync_removezServiceRegistry.async_remove5   s   € à�‰œZ¨¬dÔ3�TÕ@¸$¸Õ@r   c                óJ   — | j                  |g«       | j                  |«       y)z#Update new service in the registry.N)r   r   r   s     r   Úasync_updatezServiceRegistry.async_update9   s   € à�‰�d�VÔØ�	‰	�$�r   c                óH   — t        | j                  j                  «       «      S )zReturn all ServiceInfo.)r   r
   Úvaluesr   s    r   Úasync_get_service_infosz'ServiceRegistry.async_get_service_infos>   s   € ä�D—N‘N×)Ñ)Ó+Ó,Ð,r   c                ó8   — | j                   j                  |«      S )z$Return all ServiceInfo for the name.)r
   Úget)r   Únames     r   Úasync_get_info_namez#ServiceRegistry.async_get_info_nameB   s   € à�~‰~×!Ñ! $Ó'Ð'r   c                ó,   — t        | j                  «      S )zReturn all types.)r   r   r   s    r   Úasync_get_typeszServiceRegistry.async_get_typesF   s   € ä�D—J‘JÓÐr   c                ó:   — | j                  | j                  |«      S )z%Return all ServiceInfo matching type.)Ú_async_get_by_indexr   )r   Útype_s     r   Úasync_get_infos_typez$ServiceRegistry.async_get_infos_typeJ   s   € à×'Ñ'¨¯
©
°EÓ:Ð:r   c                ó:   — | j                  | j                  |«      S )z'Return all ServiceInfo matching server.)r*   r   )r   Úservers     r   Úasync_get_infos_serverz&ServiceRegistry.async_get_infos_serverN   s   € à×'Ñ'¨¯©°fÓ=Ð=r   c                óp   — |j                  |«      }|€g S |D �cg c]  }| j                  |   ‘Œ c}S c c}w )z*Return all ServiceInfo matching the index.)r$   r
   )r   ÚrecordsÚkeyÚrecord_listr%   s        r   r*   z#ServiceRegistry._async_get_by_indexR   s8   € à—k‘k #Ó&ˆØÐØˆIØ1<Ö=¨�—‘˜tÓ$Ò=Ð=ùÒ=s   š3c                óÞ  — |j                   €J d«       ‚|j                  | j                  v rt        ‚|j	                  «        || j                  |j                  <   | j
                  j                  |j                  j                  «       g «      j                  |j                  «       | j                  j                  |j                   g «      j                  |j                  «       d| _        y)z!Add a new service under the lock.NzServiceInfo must have a serverT)Ú
server_keyr2   r
   r   Úasync_clear_cacher   Ú
setdefaultÚtypeÚlowerÚappendr   r   r   s     r   r   zServiceRegistry._addY   s©   € à�‰Ð*ÐLÐ,LÓLÐ*Ø�8‰8�t—~‘~Ñ%Ü.Ð.à×ÑÔ Ø#'ˆ�‰�t—x‘xÑ Ø�
‰
×Ñ˜dŸi™iŸo™oÓ/°Ó4×;Ñ;¸D¿H¹HÔEØ�‰×Ñ §¡°Ó4×;Ñ;¸D¿H¹HÔEØˆÕr   c                óÄ  — |D ]Á  }| j                   j                  |j                  «      }|€Œ+|j                  €J ‚| j                  |j
                  j                  «          j                  |j                  «       | j                  |j                     j                  |j                  «       | j                   |j                  = ŒÃ t        | j                   «      | _
        y)z!Remove a services under the lock.N)r
   r$   r2   r5   r   r8   r9   Úremover   Úboolr   )r   Úinfosr   Úold_service_infos       r   r   zServiceRegistry._removee   sµ   € àò 	)ˆDØ#Ÿ~™~×1Ñ1°$·(±(Ó;ÐØÐ'ØØ#×.Ñ.Ð:Ð:Ð:Ø�J‰JÐ'×,Ñ,×2Ñ2Ó4Ñ5×<Ñ<¸T¿X¹XÔFØ�L‰LÐ)×4Ñ4Ñ5×<Ñ<¸T¿X¹XÔFØ—‘˜tŸx™xÑ(ð	)ô   §¡Ó/ˆÕr   N)ÚreturnÚNone)r   r   r@   rA   )r   zlist[ServiceInfo] | ServiceInfor@   rA   )r@   úlist[ServiceInfo])r%   Ústrr@   zServiceInfo | None)r@   z	list[str])r+   rC   r@   rB   )r.   rC   r@   rB   )r1   zdict[str, list]r2   Ú_strr@   rB   )r>   rB   r@   rA   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   r"   r&   r(   r,   r/   r*   r   r   © r   r   r	   r	      sT   „ ñð A€Ið'à	ó'óóAóó
-ó(ó ó;ó>ó>ó
 ô0r   r	   N)
rH   Ú
__future__r   Ú_exceptionsr   r   r   rC   rD   r	   rJ   r   r   ú<module>rM      s&   ðñõ, #å 6Ý à
€÷Q0ò Q0r   