%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/system-config-printer/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/system-config-printer/__pycache__/dnssdresolve.cpython-312.pyc

�

Hf���Z�ddlZddlZddlZddl�Gd�d�Zedk(r�Gd�d�Ze�e�d�Zdd	l	m
Z
e
d
��Gd�d
�Zddlm
Z
ddlmZe
j�Zed
�ej$eee�j&�ej'�yy)�N)�*c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�DNSSDHostNamesResolverc�\�||_t|�|_i|_t	d|z�y)Nz+%s)�_devices�len�_unresolved�_device_uri_by_name�
debugprint)�self�devicess  �0/usr/share/system-config-printer/dnssdresolve.py�__init__zDNSSDHostNamesResolver.__init__s)����
���=���#%�� ��E�D�L�!�c� �td|z�y)Nz-%s)r�rs r�__del__zDNSSDHostNamesResolver.__del__ s���E�D�L�!rc
�x���|�_tj�}|s
|g��`�`y�jj	�D�](\�}�jd�s�xjdzc_�.tjj��}|j}|jdd�}t|�dk7r�j���|\}}}	}
tjj|�}|d|	zz
}	|jdd�}tj |d�}��j"|||
f<t%d	|z�|j'd
d
|||
d
d�j(��fd��
�	��+y#tj*$r2}
t%dt-|
�z��j�Yd}
~
��md}
~
wwxYw)Nzdnssd://��.��zorg.freedesktop.Avahi�/zorg.freedesktop.Avahi.ServerzResolving address for %s���rc�(���j�|�S�N)�_error)�er�uris ��r�<lambda>z0DNSSDHostNamesResolver.resolve.<locals>.<lambda>Js���,0�K�K��a�,@�r)�
reply_handler�
error_handlerzFailed to resolve address: %s)�_reply_handler�dbus�	SystemBusr�items�
startswithr	�urllib�parse�urlparse�netloc�rsplitr�	_resolved�unquote�
get_object�	Interfacer
r�ResolveService�_reply�
DBusException�repr)rr!�bus�device�result�hostname�elements�name�stype�protocol�domain�obj�serverrrs`             @r�resolvezDNSSDHostNamesResolver.resolve#s����+����n�n�����2���
��#���=�=�.�.�1� 	"�K�C���>�>�:�.�� � �A�%� ���\�\�*�*�C�0�F��}�}�H�����Q�/�H��H�~��"����!��,4�)�D�%��6��<�<�'�'��.�D��S�8�^�#�E�
"��n�n�&=�s�C������)G�I��BE��(�(�$��v�)>�?��6��A�B��%�%�r�2�(,�e�V�(*�A�6:�k�k�7A�	&�B�1 	"��<�%�%�
"��;�d�A�h�F�G����!�!��
"�s�A0E4�4F9�'F4�4F9c��|xjdzc_|jdk(r+td�|j|j�|`|`yy)NrrzAll addresses resolved)r	rr#rrs rr-z DNSSDHostNamesResolver._resolvedPsL�����A������q� ��0�1�������/��
��#�	!rc��|j|||f}||j|_|}
|
jd�}|dk7r|
d|}
t	|�d|�d|
�d��|
|j|_|j
�y)Nrrz is at z (�))r
r�address�findrr8r-)r�	interfacer<r:r;r=�host�	aprotocolrD�port�txt�flagsrr8�ps               rr2zDNSSDHostNamesResolver._replyXsy���&�&��e�V�'<�=��%,��
�
�c��"����M�M�#�����7����|�H��#�w��A�B�&.��
�
�c��#����rc�X�td|�dt|����|j�y)NzError resolving z: )rr4r-)rr�errors   rrzDNSSDHostNamesResolver._errords����T�5�\�B�C����rN)	�__name__�
__module__�__qualname__rrr@r-r2r�rrrrs!��"�"�+"�Z$�
�rr�__main__c��eZdZd�Zy)�Devicec�0�	d|jzS#YyxYw)Nz
<Device @ %s>z<Device>)rDrs r�__repr__zDevice.__repr__js ��
"�&����5�5��
"�!�s��N)rOrPrQrWrRrrrUrUis��	"rrU)z*dnssd://dlk-08E206-P1._printer._tcp.local/z dnssd://foo._printer._tcp.local/)�
DBusGMainLoopT)�set_as_defaultc��eZdZd�Zd�Zd�Zy)�Testc� �||_||_yr)�_loopr)r�loopr
s   rrz
Test.__init__vs���D�J�#�D�Mrc�f�t|j�}|j|j��y)N)r!F)rrr@�reply)r�rs  r�runzTest.runzs%��&��
�
�6�A�
�I�I�T�Z�Z�I�0�rc�N�t|�|jj�yr)�printr]�quit)r�argss  rr`z
Test.replys���$�K��J�J�O�O�rN)rOrPrQrrbr`rRrrr[r[us��	$�	�
	rr[)�GObject)�GLib)r$�re�urllib.parser(�debugrrOrUr
�	dbus.glibrXr[�
gi.repositoryrgrh�MainLoopr^�
set_debugging�idle_addrbrRrr�<module>rqs���*���M�M�^�z��"�"�>D�X�39�8�=�G�'��$�'���&�"��7����D��4���D�M�M�4��w�'�+�+�,��H�H�K�Ar

Zerion Mini Shell 1.0