%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__/PhysicalDevice.cpython-312.pyc

�

Hf�@��X�ddlZddlZejejej��ddlZddlZddlZddl	Z	ddl
�Gd�d�Zedk(r�ddl
Z
e
j�Zej e�ZgZej'�D]0Zee�Z	ej-e�Zeej1e��2ej7�eD]8Zeej;��ej=�ZeD]Zede��
�:yy#e$rej5e�Y��wxYw)�N)�domain�	localedir)�*c�`�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)�PhysicalDevicec��d|_d|_d|_d|_d|_|j|�i|_tj|_	y)NF)
�devices�
_network_host�dnssd_hostname�_cupsserver�firsturi�
add_device�
_user_data�	ppdippstr�backends�
_ppdippstr)�self�devices  �2/usr/share/system-config-printer/PhysicalDevice.py�__init__zPhysicalDevice.__init__sH�����!���"��� �����
����� ����#�,�,���c�Z�t|d�ru|jjdd�}|jjdd�}|dk(s-|j�j	|j��r|}n|�d|��}n|j
}tjj|�S)N�id_dict�MFG��MDL� )	�hasattrr�get�lower�
startswith�make_and_model�cupshelpers�ppds�ppdMakeModelSplit)rr�mfg�mdlr"s     r�
_canonical_idzPhysicalDevice._canonical_id)s����F�I�&��.�.�$�$�e�R�0�C��.�.�$�$�e�R�0�C��b�y�C�I�I�L�3�3�S�Y�Y�\�B�!$��,/��!5��$�3�3�^����1�1�>�B�Brc�0�|�yd|vrd|vr
|dk7r|dzS|S)N�.�:�	localhostz.local�)r�hostnames  r�_add_dot_local_if_neededz'PhysicalDevice._add_dot_local_if_needed7s0��������3�(�?�
��
$��h�&�&��Orc���	tj|dtj��ddd}|S#	tj|dtj��ddd}Y|S#d}YY|SxYwxYw)Nr)�family�)�socket�getaddrinfo�AF_INET�AF_INET6)rr.�addresss   r�_get_addresszPhysicalDevice._get_address@s���	��(�(��1�06���@�@A�C�CD�F�FG�I�G����
	�
� �,�,�X�q�4:�O�O�E�EF�H�HI�K�KL�N�����
�����s �/3�A3�/A(�(A0�,A3�0A3c���d}d}d}tjj|�\}}|dk(s|dk(r�d}|jd�r%tjj	|dd�\}}|�F|jd�r|dd}n`|jd�r|dd}nI|jd	�r|dd}n2y
y
|dk(s|dk(ry
tjj|�\}}|�y
|r"tjj
|�\}}|rd}		|j|�}	|	r|	}n|r	|j|�}|j|�|j|�fS#Y�&xYw#d}Y�/xYw)
N�hp�hpfaxz/net/�zip=�z	hostname=�	zzc=)NN�dnssd�mdns)	�urllib�parse�	splittyper!�
splitquery�	splithost�	splitportr8r/)
r�uri�hostport�host�	dnssdhost�scheme�rest�ipparam�port�ips
          r�_get_host_from_uriz!PhysicalDevice._get_host_from_uriLs��������	����/�/��5�����T�>�V�w�.��G�����(�"(�,�,�"9�"9�4���8�"D���w��"��%�%�e�,�&�q�r�{�H��'�'��5�&�q�r�{�H��'�'��.� '����I�%�!�
�w�
�&�F�"2��%�|�|�5�5�t�<��X�t���!��!�<�<�1�1�8�<�L�T�4���B�
��&�&�t�,����D���
��(�(��3���,�,�T�2��)�)�)�4�5�	5��
���
���s�
E�&E �E� E&c�,	�|js
|j�r	|j|j�\}}t	|d�r|j|j�}t	|d�r|�|j|j�}|�|��|r|jr||jk(sW|r|jr||jk(s:|r|jr||jk(s|r8|jr,||jk(r|�|j�|��|j��t�|j|�\}}|j�a||_||_|j�|_|j�|_|j j#dd�|_g|_
nxd�}||j|�|_||j|�|_|j j#dd�}|dk7r$|j$dk7r||j$k7rt�|j&dk(r!|jj)dd�|_|jj+d�r|jj-d	�d
k7sQ|jj+d�s|jj+d�r#|jj/d
�rd|_n
|j0ry|jD]}|j|jk(s�y|j2s|j|_|jj5|�|jj7�|jr|js;|j8dk(r,|j|j�\|_}|r||_t	|d�r0|j�$|j}	|	r|j|	�|_t	|d�r0|j�$|j}
|
r|j|
�|_|jr#|j�	|j;
�|_t=d|j�dt?|����y#d|_Y�0xYw)Nr7r.�SNrc�2�d�}||�||�kr|S|S)Nc�~�|j�}d}tt|��D]}||||k7s�|dz
}�|S)Nr�)r �range�len)�s�l�n�is    r�count_lowerz>PhysicalDevice.add_device.<locals>.nicest.<locals>.count_lower�sH���G�G�J����!&��Q���'�A� ��t�q��t�|� !�Q���'� !�rr-)�a�br\s   r�nicestz)PhysicalDevice.add_device.<locals>.nicest�s#��!�#�A���a��8� ���Hrr3z:9100�ipp:�
/printers/����dnssd:�mdns:�/cupsT�networkzDevice z added to physical device: ) r
rrPrGrr/r7r.�
ValueErrorr(r	r&r'r �	mfg_lower�	mdl_lowerrr�sn�type�replacer!�find�endswithrr
�append�sort�device_classr8�
debugprint�repr)rrrIrJr&r'r_rj�dr7r.s           rrzPhysicalDevice.add_device~s�������!4�!4�"�5�5�v�z�z�B�O�D�)����+��4�4�V�^�^�D�����,��1B� �9�9�&�/�/�J�	����!2��d�0�0��T�/�/�/��d�1�1��T�0�0�0��4�#5�#5��$�"4�"4�4��4�#6�#6��$�"5�"5�5����!4�!4�!<��!�d�&8�&8�&@� � ��+�+�V�4�J�S�#��|�|�#�������!$������!$������ �.�.�,�,�d�B�7���!���
�"�4�8�8�S�1���!�4�8�8�S�1����^�^�'�'��r�2����8����2�
�"����-�$�$��;�;�(�"����+�+�W�b�9�F�J��J�J�!�!�&�)��J�J�O�O�L�)�R�/�
�Z�Z�
"�
"�8�
,�
�Z�Z�
"�
"�7�
+��J�J����(�#�D��
�
�
�����	�A��u�u��
�
�"��	��}�}�"�J�J�D�M������V�$��������"�"�$�*=�*=����)�+��'�'����4�
*�D��	��&/��#��V�Y�'�D�,>�,>�,F��n�n�G��%)�%B�%B�7�%K��"��V�Z�(�T�-@�-@�-H����H��&*�&C�&C�H�&M��#����D�$6�$6�$>�
*�%)�%6�%6�x�%@��"�	��J�J��T�
�,�	-��
*�%)��"�s�
R�	Rc��|jS�N)r	�rs r�get_deviceszPhysicalDevice.get_devices�s���|�|�rc�(�|jdjjd�r+|jdjjd�dk7sx|jdjjd�s(|jdjjd�r�|jdjj	d�r�|j
sd|jz}�n|jr|jjd	�dk7rd|j
z}n�|j|j
k7r|j
�d
|j�d�}n�d|jz}n�|jdk(s*|jd
k(rN|jjd�r3|jj|jdj�}n|j�d|j��}|jrt|j�dkDs&|j
�rGt|j
�dkD�r.|jdjjd�s(|jdjjd�r(|jdjj	d�s�|jr|j|j�dk(r�|j
r|j|j
�dk(rb|j
s|d|jzz
}|S|js|d|j
zz
}|S|d
|j
�d|j�d�z
}|St|j�dkDr|d|jzz
}|S)Nrr`rarbrcrdrez%sr+z (�)r�HP�Faxrz (%s)z, )r	rGr!rmrnrr
r&r'rr�inforWrj)rr}s  r�get_infozPhysicalDevice.get_info�s���
�L�L��O���*�*�6�2��L�L��O���$�$�\�2�b�8�
�\�\�!�_�
 �
 �
+�
+�H�
5�
�\�\�!�_�
 �
 �
+�
+�G�
4��L�L��O���(�(��1��&�&��d�0�0�0���'�'�4�+=�+=�+B�+B�3�+G�2�+M��d�1�1�1���%�%��)<�)<�<�(,�(;�(;�T�=O�=O�P�D��$�"4�"4�4�D�
�X�X��^��H�H������!4�!4�U�!;��?�?�&�&����Q��(<�(<�=�D�"�h�h����1�D�
�
�
�C��);�);�$<�q�$@�
�
 �
 �S�$�*=�*=�%>��%B��l�l�1�o�!�!�,�,�X�6��l�l�1�o�!�!�,�,�W�5��l�l�1�o�!�!�*�*�7�3��#�#�
�Y�Y�t�)�)�
*�b�
0��$�$�
�Y�Y�t�*�*�
+�r�
1��&�&���$�"4�"4�4�4����
�'�'���$�"5�"5�5�5��
���t�':�':�D�<N�<N�O�O�����$�'�'�]�Q�
��G�d�g�g�%�%�D��rc�"�||j|<yrv)r)r�key�values   r�set_datazPhysicalDevice.set_datas��$�����rc�8�|jj|�Srv)rr)rr�s  r�get_datazPhysicalDevice.get_datas�����"�"�C�(�(rc�(�d|j�zS)Nz(description: %s))�__repr__rws r�__str__zPhysicalDevice.__str__s��"�T�]�]�%5�5�5rc
��d|j�d|j�d|j�d|j�d|j�d|j
�d�
S)Nz <PhysicalDevice.PhysicalDevice (�,z)>)r&r'rjr
rr
rws rr�zPhysicalDevice.__repr__s6�����4�8�8�T�W�W�d�.@�.@��$�$�d�m�m�5�	6rc��t|�t|�k7ry|jrt|j�dk(rn|jrt|j�dk(rJ|jrt|j�dk(r&|j�r�t|j�dk(�s�|jrVt|j�dkDr>|jr2t|j�dkDr|j|jk(�s$|jrUt|j�dkDr=|jr1t|j�dkDr|j|jk(s�|jrUt|j�dkDr=|jr1t|j�dkDr|j|jk(sb|jrUt|j�dkDr=|jr1t|j�dkDr|j|jk(sy|j	�}|r:|j
D�cgc]}|j��}}|D]}|j|vs�y|jdk(r|jdk(s|jdk(rM|jdk(r>|jdk(r.|jdk(r|j
d|j
dk(Syd�}||�\}}||�\}	}
||	k7ry|dk(r)|jdk7r|j|jk(ry||
k7ry|jdk(s|jdk(ry|j|jk(Scc}w)NFrTrc��|jdk(sA|jj�j|jj��r
|j}n|j�d|j��}tj
j
|�\}}tj
j|�tj
j|�fS�Nrr�r&r'r r!r#r$r%�	normalize��devr"r&r's    r�split_make_and_modelz3PhysicalDevice.__eq__.<locals>.split_make_and_modelF����w�w�"�}����
�
� 0� ;� ;�S�W�W�]�]�=M� N�!$����,/�G�G�S�W�W�!=��$�)�)�;�;�^�L�J�S�#��$�$�.�.��4��$�$�.�.��4�6�
6rr:)
rkr
rWrrxr	rGr&r'rj�r�other�devs�x�urisr�r��our_mfg�our_mdl�	other_mfg�	other_mdls           r�__eq__zPhysicalDevice.__eq__s�����<�4��;�&���(�(�C��1C�1C�,D��,I��)�)�S�%�2E�2E�-F�!�-K��)�)�S�$�2E�2E�-F�!�-K��*�*��u�+�+�,��1��#�#��T�-?�-?�(@�1�(D��$�$��e�.A�.A�)B�Q�)F��#�#�u�':�':�:��$�$��d�.A�.A�)B�Q�)F��%�%�#�u�/C�/C�*D�q�*H��$�$��(<�(<�<��#�#��T�-?�-?�(@�1�(D��%�%�#�u�/C�/C�*D�q�*H��#�#�u�';�';�;��$�$��d�.A�.A�)B�Q�)F��$�$��e�.A�.A�)B�Q�)F��$�$��(;�(;�;��� � �"���#'�<�<�0�a�A�E�E�0�D�0��
 ���7�7�d�?��
 �
�Y�Y�"�_����b��
�X�X��^����R���y�y�B��4�8�8�r�>��|�|�A��%�-�-��*:�:�:��	6�2�4�8���'�!5�u�!=���I��i����d�?�t�w�w�"�}����E�H�H�1D���i����7�7�b�=�E�H�H��N���w�w�%�(�(�"�"��O1s�Nc��t|�t|�k7ry||k(ry|j|jk7r3|j�y|j�y|j|jkS|j|jk7r3|j�y|j�y|j|jkS|j�}|r:|jD�cgc]}|j
��}}|D]}|j
|vs�y|jdk(r|jdk(s|jdk(rl|jdk(r]|jdk(r.|jdk(r|jd|jdkS|jdk(xr|jdk(Sd�}||�\}}||�\}	}
||	k7r||	kS||
k7r||
kS|jdk(s|jdk(ry|j|jkScc}w)NFTrrc��|jdk(sA|jj�j|jj��r
|j}n|j�d|j��}tj
j
|�\}}tj
j|�tj
j|�fSr�r�r�s    rr�z3PhysicalDevice.__lt__.<locals>.split_make_and_model�r�r)	rkr
rrxr	rGr&r'rjr�s           r�__lt__zPhysicalDevice.__lt__`s�����<�4��;�&���5�=������!4�!4�4��!�!�)���"�"�*���%�%��(;�(;�;�;����%�"6�"6�6��"�"�*���#�#�+���&�&��)=�)=�=�=�� � �"���#'�<�<�0�a�A�E�E�0�D�0��
!���7�7�d�?� �
!�
�Y�Y�"�_����b��
�X�X��^����R���y�y�B��4�8�8�r�>��|�|�A�����q�)9�9�9��9�9��?�6�u�y�y�B��6�	6�2�4�8���'�!5�u�!=���I��i���Y�&�&��i���Y�&�&��7�7�b�=�E�H�H��N���w�w����!�!��I1s�HN)�__name__�
__module__�__qualname__rr(r/r8rPrrxr~r�r�r�r�r�r�r-rrrrsO��-�C��
�05�db-�H�(�V%�)�6�6�
@#�D?"rr�__main__r)�config�gettext�install�PACKAGErr#�urllib.parserArr3�debugrr��authconn�
Connection�c�
getDevicesr	�physicaldevices�valuesr�physicaldevice�indexr[rrgrorp�printr~rxr-rr�<module>r�s8��*������v�~�~��1A�1A�B����
��A"�A"�F�z��������A�$�k�$�$�a�(�G��O��.�.�#�4��'��0��	4��%�%�~�6�A��A��)�)�6�2�	4�����)���
�n�%�%�(�)� �,�,�/���	�F��#�v��	�����	4��"�"�N�3�	4�s�%D�D)�(D)

Zerion Mini Shell 1.0