
    iM                    D    S r SSKJr  SSKJr  SSKJr  \r " S S5      r	g	)
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                      \ rS rSrSrSr  SS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSS jrSS jrSrg)ServiceRegistry   zxA 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                <    0 U l         0 U l        0 U l        SU l        g)z!Create the ServiceRegistry class.FN)r   r   r   r   selfs    R/home/sebas/venvs/catt/lib/python3.13/site-packages/zeroconf/_services/registry.py__init__ServiceRegistry.__init__(   s!     24&(
(*!&    c                &    U R                  U5        g)z"Add a new service to the registry.N)_addr   infos     r   	async_addServiceRegistry.async_add1   s    		$r   c                `    U R                  [        U[        5      (       a  U5        gU/5        g)z'Remove a new service from the registry.N)_remove
isinstancelistr   s     r   async_removeServiceRegistry.async_remove5   s!    Zd33T@$@r   c                J    U R                  U/5        U R                  U5        g)z#Update new service in the registry.N)r   r   r   s     r   async_updateServiceRegistry.async_update9   s    dV		$r   c                H    [        U R                  R                  5       5      $ )zReturn all ServiceInfo.)r   r   valuesr   s    r   async_get_service_infos'ServiceRegistry.async_get_service_infos>   s    DNN))+,,r   c                8    U R                   R                  U5      $ )z$Return all ServiceInfo for the name.)r   get)r   names     r   async_get_info_name#ServiceRegistry.async_get_info_nameB   s    ~~!!$''r   c                ,    [        U R                  5      $ )zReturn all types.)r   r   r   s    r   async_get_typesServiceRegistry.async_get_typesF   s    DJJr   c                :    U R                  U R                  U5      $ )z%Return all ServiceInfo matching type.)_async_get_by_indexr   )r   type_s     r   async_get_infos_type$ServiceRegistry.async_get_infos_typeJ   s    ''

E::r   c                :    U R                  U R                  U5      $ )z'Return all ServiceInfo matching server.)r2   r   )r   servers     r   async_get_infos_server&ServiceRegistry.async_get_infos_serverN   s    ''f==r   c                v    UR                  U5      nUc  / $ U Vs/ s H  o@R                  U   PM     sn$ s  snf )z*Return all ServiceInfo matching the index.)r*   r   )r   recordskeyrecord_listr+   s        r   r2   #ServiceRegistry._async_get_by_indexR   s:    kk#&I1<=t$===s   6c                   UR                   c   S5       eUR                  U R                  ;   a  [        eUR	                  5         XR                  UR                  '   U R
                  R                  UR                  R                  5       / 5      R                  UR                  5        U R                  R                  UR                   / 5      R                  UR                  5        SU l        g)z!Add a new service under the lock.NzServiceInfo must have a serverT)
server_keyr<   r   r   async_clear_cacher   
setdefaulttypelowerappendr   r   r   s     r   r   ServiceRegistry._addY   s    *L,LL*88t~~%.. #'txx 

diioo/4;;DHHE4;;DHHEr   c                   U H  nU R                   R                  UR                  5      nUc  M-  UR                  c   eU R                  UR
                  R                  5          R                  UR                  5        U R                  UR                     R                  UR                  5        U R                   UR                  	 M     [        U R                   5      U l
        g)z!Remove a services under the lock.N)r   r*   r<   r@   r   rC   rD   remover   boolr   )r   infosr   old_service_infos       r   r   ServiceRegistry._removee   s    D#~~11$((;'#..:::JJ',,2245<<TXXFLL)445<<TXXFtxx(   /r   N)returnNone)r   r   rM   rN   )r   zlist[ServiceInfo] | ServiceInforM   rN   )rM   list[ServiceInfo])r+   strrM   zServiceInfo | None)rM   z	list[str])r3   rP   rM   rO   )r7   rP   rM   rO   )r;   zdict[str, list]r<   _strrM   rO   )rJ   rO   rM   rN   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r    r#   r'   r,   r/   r4   r8   r2   r   r   __static_attributes__ r   r   r	   r	      sT     AI'	'A
-( ;>>
 0r   r	   N)
rV   
__future__r   _exceptionsr   r   r   rP   rQ   r	   rY   r   r   <module>r\      s&   , # 6 
Q0 Q0r   