%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/CommandNotFound/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/CommandNotFound/__pycache__/CommandNotFound.cpython-312.pyc

�

{��cx=����ddlmZmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
e
jdk\rdZndZeej"dd�	�e�Zd
�Zd�ZdZGd
�de�Zy)�)�print_function�absolute_importN)�SqliteDatabase�3�gettext�ugettextzcommand-not-foundT)�fallbackc
��d}tt|�dz�D�cgc]}|d|||df��}}|D��cgc]\}}|s�	||ddz��}}}|D��cgc](\}}t|�dkDs�||dz|dz|ddz��*}}}|D���cgc]\}}|D]}|s�||z|ddz���}	}}}|D���cgc]\}}|D]
}||z|z���}
}}}t||z|	z|
z�Scc}wcc}}wcc}}wcc}}}wcc}}}w)zw
    return a set with spelling1 distance alternative spellings

    based on http://norvig.com/spell-correct.html
    z&abcdefghijklmnopqrstuvwxyz-_0123456789�Nr�)�range�len�set)�word�alphabet�i�s�a�b�deletes�
transposes�c�replaces�insertss           �A/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py�
similar_wordsrs(��8�H�',�S��Y��]�';�<�!�$�r��(�D���H�	�<�A�<�%&�,�T�Q��!�q�1�Q�R�5�y�,�G�,�67�F�d�a��3�q�6�A�:�!�a��d�(�Q�q�T�/�A�a�b�E�)�F�J�F�*+�C�C�$�!�Q�X�C����A���!�"��
�C�
�C�H�C�)*�=�=���A�H�=�q�q�1�u�q�y�=�y�=�G�=��w��#�h�.��8�9�9��	=��,��F��C��=s-�C!�
C&�
C&�C,�(C,�C2�C2�0C9c��	tj�}tjd�d|vxstjd�d|vS#t$rYywxYw)N�sudor�adminF)�posix�	getgroups�grp�getgrnam�KeyError)�groupss r�
user_can_sudor&+s[������"�����V�$�Q�'�6�1�3����W�%�a�(�F�2�	4������s�A	A�	A�Az&/var/lib/command-not-found/commands.dbc��eZdZdZdZdZdZejZ	dd�Z
dd�Zd�Zd�Z
d	�Zd
�Zd�Zdd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zy)�CommandNotFoundz
programs.d�)z	/snap/binz/binz/usr/binz/usr/local/binz/sbinz	/usr/sbinz/usr/local/sbinz
/usr/gamesz
/usr/bin/snapc�T�|j�|_tjj	t
�r=tjt
tj�rtt
�|_	ntd��t�|_tj�|_y)NzCannot find database)�_getSourcesList�sources_list�os�path�exists�dbpath�access�R_OKr�db�FileNotFoundErrorr&r �geteuid�euid)�self�data_dirs  r�__init__zCommandNotFound.__init__Ksc�� �0�0�2���
�7�7�>�>�&�!�b�i�i�����&@�$�V�,�D�G�#�$:�;�;�*�_����M�M�O��	�c���g}|t|�cxkr|jks|S|St|�D]3}|j|�}|D]\}}}|j	||||f���5|S)z try to correct the spelling )r�max_lenr�get_packages�append)	r7r�min_len�possible_alternatives�w�packages�package�ver�comps	         r�spelling_suggestionsz$CommandNotFound.spelling_suggestionsUs��� "���3�t�9�4����4�(�(�5�(�(��t�$�	F�A��(�(��+�H�(0�
F�$��#�t�%�,�,�a��$��-D�E�
F�	F�%�$r:c�8�|jj|�S�N)r3�lookup�r7�commands  rr=zCommandNotFound.get_packages`s���w�w�~�~�g�&�&r:c�l�g}g}tjj|j�s&t	j
d|jz�ggfS	t
tj�5}tj|jddd|g|d��}ddd�t	j
dz�	tj|�}|D]]}|d
|k(r*|j|d|d
|jd�f��5|j|d
|d|jd�f��_||fS#1swY��xYw#tj$r&}t	j
d|z�ggfcYd}~Sd}~wwxYw#tj$r&}t	j
d	|z�ggfcYd}~Sd}~wwxYw)
Nz
%s not existszadvise-snapz
--format=jsonz	--commandT)�stderr�universal_newlinesz.calling snap advice-snap returned an error: %szgot %s from snap advise-snapzcannot decoding json: %s�Command�Snap�Version)r-r.r/�snap_cmd�logging�debug�open�devnull�
subprocess�check_output�CalledProcessError�json�loads�JSONDecodeErrorr>�get)	r7rK�exact_result�mispell_resultrV�output�e�snaps�snaps	         r�	get_snapszCommandNotFound.get_snapscs��������w�w�~�~�d�m�m�,��M�M�/�D�M�M�9�:��r�6�M�		��b�j�j�!�
-�W�#�0�0��]�]�M�?� �'�+�"�'+�	-��
-�	�
�
�4�v�=�>�	��J�J�v�&�E��	\�D��I��'�)��#�#�T�&�\�4�	�?�D�H�H�Y�DW�$X�Y��%�%�t�I���V��d�h�h�y�FY�&Z�[�		\�
�^�+�+�)
-�
-���,�,�	��M�M�J�Q�N�O��r�6�M��	���#�#�	��M�M�4�q�8�9��r�6�M��	�sT�D>�.(D2�D>�7E:�2D;�7D>�>E7�E2�,E7�2E7�:F3�
F.�(F3�.F3c�<�	ttjjtjdd�df��5}|D�cgc]&}|j�dk7s�|j���(c}cddd�Scc}w#1swYyxYw#t$rgcYSwxYw)N�HOMEz/rootz.command-not-found.blacklist�)rUr-�sep�join�getenv�strip�IOError)r7�	blacklist�lines   r�getBlacklistzCommandNotFound.getBlacklist�s���	��b�f�f�k�k�2�9�9�V�W�#=�?]�"^�_�`�
R�dm�1:�Q��d�j�j�l�b�>P��
�
��Q�
R�
R��Q�
R�
R���	��I�	�sG�>B
�B�A<�A<�0B�2	B
�<B�B
�B
�
B
�
B�Bc�L�	ddl}ddlm}|j�t
g�}	|dd��}|D]>}|jr�|jr�|jD]}|j|���@|S#tt
f$rgcYSwxYw#t$r|d��}Y�pwxYw)Nr)�SourcesListFT)�withMatcher�deb822)rr)�apt_pkg�aptsources.sourceslistrq�init�SystemError�ImportErrorr�	TypeError�disabled�invalid�comps�add)r7rtrqr,�sources�source�	components       rr+zCommandNotFound._getSourcesList�s���	��:��L�L�N��2�w��	5�!�e�D�A�G��	0�F��?�?�6�>�>�!'���0�I� �$�$�Y�/�0�	0�����[�)�	��I�	���	5�!�e�4�G�	5�s"�A7�
B�7B�
B�B#�"B#c�8�dtjvry|�rtd�}tjdk\rt|�}d�}n[|�}tjjr9t|t�r)|jtjj�}|j�td�k(r_|jdk(rd}nd}|�d	|��}td
|ztj��tj |j#�d�
�yyy)N� COMMAND_NOT_FOUND_INSTALL_PROMPTz Do you want to install it? (N/y)rc��|SrH�)�xs r�<lambda>z0CommandNotFound.install_prompt.<locals>.<lambda>�s��a�r:�yrrg�sudo zapt install z%s��fileF)�shell)r-�environ�_�sys�version�input�stdin�encoding�
isinstance�str�decode�lowerr6�print�stdoutrW�call�split)r7�package_name�prompt�answer�	raw_input�command_prefix�install_commands       r�install_promptzCommandNotFound.install_prompt�s���1�R�Z�Z�?����9�:�F��{�{�c�!��v���'�	�"�6�*���9�9�%�%�*�V�S�*A�#�]�]�3�9�9�+=�+=�>�F��|�|�~��3��'��9�9��>�%'�N�%,�N�8F��"U���d�_�,�3�:�:�>����� 5� 5� 7�u�E�(�r:c��t|�t|�z|kDrIttd�|t|�fz|j��|jj	�yt|�t|�zdkDr�ttd�|z|j��|D]6\}}}|rd|z}nd}ttd�|||fz|j���8|D]7\}}}	}|rd|z}nd}ttd	�|||fz|j���9t|�dkDr!ttd
�|j��nat|�dkDrS|j
r$ttd�dz|j��n#ttd�d
z|j��|jj	�y)z3 print spelling suggestions for packages and snaps z6Command '%s' not found, but there are %s similar ones.r�Nr�%Command '%s' not found, did you mean:z (%s)rgz  command '%s' from snap %s%s�  command '%s' from deb %s%s�3See 'snap info <snapname>' for additional versions.zTry: %s <deb name>zsudo apt installzapt install)rr�r��	output_fd�flushr&)
r7r�mispell_packages�
mispell_snaps�max_altrKrcrDrCrEs
          r�print_spelling_suggestionsz*CommandNotFound.print_spelling_suggestions�s����� ��]�!3�3�g�=��!�L�M�QU�WZ�[k�Wl�Pm�m�tx�uC�uC�
D��N�N� � �"��
�!�
"�3�}�#5�
5��
9��!�;�<�t�C�$�.�.�Y�(5�
f�$��$���!�C�-�C��C��a�7�8�G�T�3�;O�O�VZ�Vd�Vd�e�
f�2B�
h�-��'�4���!�C�-�C��C��a�6�7�7�G�S�:Q�Q�X\�Xf�Xf�g�
h��}���!��!�I�J�QU�Q_�Q_�`�
�!�
"�Q�
&��!�!��a�,�-�0B�B����X��a�,�-�
�=�D�N�N�S������r:c�N�ttd�d|iz|j��y)Nz;Command '%(command)s' not found, but can be installed with:rKr�)r�r�r�rJs  r�_print_exact_headerz#CommandNotFound._print_exact_header�s)��
�a�M�N��w�R � �&*�n�n�	6r:c�t�|j|�|d}|jdk(rtd|dz|j��n[|jrtd|dz|j��n1td|dz|j��ttd��|jj
�y)Nrzsnap install %sr�zsudo snap install %s�Please ask your administrator.)r�r6r�r�r&r�r�)r7rKrBrbrcs     r�advice_single_snap_packagez*CommandNotFound.advice_single_snap_package�s���� � ��)��Q�x���9�9��>��#�d�1�g�-�D�N�N�C�
�
�
��(�4��7�2����H��#�d�1�g�-�D�N�N�C��!�4�5�6������r:c�R�|j|�|jdk(r8td|ddz|j��|j	|dd�n�|j
r8td|ddz|j��|j	|dd�nqtd|ddz|j��tt
d��|dd|jvr)tt
d�|ddz|j��|jj�y)Nrzapt install %sr�zsudo apt install %sr�rz1You will have to enable the component called '%s')	r�r6r�r�r�r&r�r,r�)r7rKrBrbs    r�advice_single_deb_packagez)CommandNotFound.advice_single_deb_package�s���� � ��)��9�9��>��"�X�a�[��^�3�$�.�.�I�������A��/�
�
�
��'�(�1�+�a�.�8�t�~�~�N�������A��/��"�X�a�[��^�3�$�.�.�I��!�4�5�6��A�;�q�>�T�%6�%6�6��a�K�L�x�XY�{�[\�~�]�dh�dr�dr�s������r:c�<�|jdk7r
|jryy)Nrr�rg)r6r&)r7s rrzCommandNotFound.sudo�s���9�9��>�d�0�0��r:c	��|j|�t||zD�cgc]}t|d���c}�}t|�D]�\}}d}|dr$|dk(rt|�dkDr	d|dz}nd|dz}|d|jvr0td|j
�||d|fz|j���rtd|j
�||d|fzd	ztd
�|dzzdz|j����|jdk7r,|js ttd�|j��|jj�ycc}w)
Nrrgr�  # version %s, or�  # version %srz%sapt install %-*s%sr�z (z-You will have to enable component called '%s'�)z.Ask your administrator to install one of them.)r��maxr�	enumerater,r�rr�r�r6r&r�)	r7rKrBrbr�padrrCrDs	         r�advice_multi_deb_packagez(CommandNotFound.advice_multi_deb_package�s~��� � ��)��e�H�n�5��3�q��t�9�5�6��#�H�-�
	x�J�A�w��C��q�z���6�c�'�l�Q�.�.�'�!�*�=�C�*�g�a�j�9�C��q�z�T�.�.�.��,��	�	��S�'�!�*�c�/R�R�Y]�Yg�Yg�h��,��	�	��S�'�!�*�c�/R�R�UY�Y�\]�_N�]O�RY�Z[�R\�]\�\�_b�b�im�iw�iw�x�
	x��9�9��>�$�"4�"4��!�D�E�D�N�N�[��������6s�Ec	���|j|�t||zD�cgc]}t|d���c}�}t|�D]_\}}d}|dr$|dk(rt|�dkDr	d|dz}nd|dz}t	d|j�||d|fz|j���at	td�|j��|jj�ycc}w)	Nrrgrr�r��%ssnap install %-*s%sr�r��	r�r�rr�r�rr�r�r�)	r7rKrBrbrr�rrcrDs	         r�advice_multi_snap_packagesz*CommandNotFound.advice_multi_snap_packagess���� � ��)��e�H�n�5��3�q��t�9�5�6�� ��'�	c�G�A�t��C��A�w���6�c�%�j�1�n�.��a��8�C�*�T�!�W�4�C��)�T�Y�Y�[�#�t�A�w��,L�L�SW�Sa�Sa�b�	c�	�a�E�F�T�^�^�\��������6s�C"c	��|j|�t||zD�cgc]}t|d���c}�}t|�D]Q\}}d}|dr|dk(r	d|dz}nd|dz}t	d|j�||d|fz|j���S|D]@}	d}|	drd|	dz}t	d	|j�||	d|fz|j���Bt|�dk(r*t	td
�|ddz|j��n t	td�|j��|jj�ycc}w)Nrrgrr�r�r�r�rz%sapt  install %-*s%sz+See 'snap info %s' for additional versions.r�r�)
r7rKrBrbrr�rrcrDrCs
          r�advice_multi_mixed_packagesz+CommandNotFound.advice_multi_mixed_packagessX��� � ��)��e�H�n�5��3�q��t�9�5�6�� ��'�	c�G�A�t��C��A�w���6�.��a��8�C�*�T�!�W�4�C��)�T�Y�Y�[�#�t�A�w��,L�L�SW�Sa�Sa�b�	c� �	f�G��C��q�z�&����3���)�T�Y�Y�[�#�w�q�z�3�,O�O�VZ�Vd�Vd�e�		f�
�u�:��?��!�A�B�U�1�X�a�[�P�W[�We�We�f��!�I�J�QU�Q_�Q_�`��������%6s�Ec	�8	�d�}t|�|jkDry|jd�rCtjj|�r!tjj
|�g}n&g}n#|jD�cgc]}|||�s�
|��}}|�rt|�sqt|�dk(rHttd�|tjj|d|�d�z|j��ndttd	�d
|iz|j��|D]:}tdtjj||�z|j���<tt|�ttjdd
�jd��z
�}t|�dkDrettd�dj|�z|j��ddj|�vr ttd�|j��ytjjd�s tjjd�sy||j!�vry|dk(rjttd�|z|j��ttd�dz|j��ttd�dz|j��y|j#|�}|j%|�\}}	t'j(d|�d|���t|�dk(rPt|�dk(rB|j+|�}
t|
�dkDst|	�dkD�r|j-||
|	�n�t|�dk(r"t|�dk(r|j/|||�n�t|�dkDr"t|�dk(r|j1|||�n�t|�dk(r"t|�dk(r|j3|||�n_t|�dkDr"t|�dk(r|j5|||�n/t|�dkDr!t|�dkDr|j7|||�t|�dkDxs.t|�dkDxst|	�dkDxst
�dkDScc}w)z7 give advice where to find the given command to stderr c��tjjtjj||��xr>tjj	tjj||��S)z? helper that returns if a command is found in the given prefix )r-r.r/ri�isdir)�prefixrKs  r�
_in_prefixz*CommandNotFound.advise.<locals>._in_prefix+sO���G�G�N�N�2�7�7�<�<���#@�A�I��G�G�M�M�"�'�'�,�,�v�w�*G�H�H�
Jr:F�/rz1Command '%(command)s' is available in '%(place)s'r)rK�placer�z:Command '%(command)s' is available in the following placesrKz * %s�PATHrg�:z_The command could not be located because '%s' is not included in the PATH environment variable.�sbinzfThis is most likely caused by the lack of administrative privileges associated with your user account.z/usr/bin/aptz/usr/bin/aptitude�pythonr�r�)�python3r�rg)r�zpython-is-python3rgTz
got debs: z snaps: )rr<�
startswithr-r.r/�dirname�prefixesr�r�rir��listrrjr�ror=rdrSrTrFr�r�r�r�r�r�)r7rK�ignore_installedr�r�r��missingrBrbr�r�s           r�advisezCommandNotFound.advise)sV��	J�
�w�<�$�,�,�&�����c�"��w�w�~�~�g�&��G�G�O�O�G�4�5����-1�]�]�Z�6�j��QX�>Y��Z�H�Z��,��8�}��!��a�K�L�[b�mo�mt�mt�my�my�{C�DE�{F�HO�nP�PQ�Q�X\�Xf�Xf�g��a�T�U�Yb�dk�Xl�l�sw�tB�tB�C�&�X�F��'�B�G�G�L�L���$A�A����W�X��3�x�=�3�r�y�y���/D�/J�/J�3�/O�+P�P�Q�G��7�|�a���a�y�z�~A�~F�~F�GN�~O�O�VZ�Vd�Vd�e��S�X�X�g�.�.��!�E�F�MQ�M[�M[�\�������~�.������2�3���d�'�'�)�)��
�h���!�;�<�w�F�T�^�^�\��!�2�3�6P�P�W[�We�We�f��!�2�3�6Y�Y�`d�`n�`n�o���$�$�W�-��#�~�~�g�6���}��
�
�(�E�B�C��x�=�A��#�e�*��/�#�8�8��A���#�$�q�(�C�
�,>��,B��/�/��9I�=�Y�
��]�a�
�C��J�!�O��+�+�G�X�u�E�
��Z�!�^��H�
�� 2��+�+�G�X�u�E�
��]�a�
�C��J�!�O��*�*�7�H�e�D�
��]�Q�
�3�u�:��?��)�)�'�8�U�C�
��]�Q�
�3�u�:��>��,�,�W�h��F��H�
��!�D�S��Z�!�^�D��M�"�Q�&�D�*-�.>�*?�!�*C�	E��k[s�?R�RN)z/usr/share/command-not-found)�)�)F)�__name__�
__module__�__qualname__�programs_dirr<r�rRr�rMr�r9rFr=rdror+r�r�r�r�r�rr�r�r�r�r�r:rr(r(8sv���L��G��H��H��
�
�I�$�	%�'�,�:��*F�,�:6�
�
��
�$��,FEr:r()�
__future__rrrr"rZrSr-�os.pathr r�rW�CommandNotFound.db.dbrr��_gettext_method�getattr�translationr�rr&r0�objectr(r�r:r�<module>r�s~���
�
���	���
��0��;�;�#���O� �O���G��� 3�d�C�_�U��:��
2��wE�f�wEr:

Zerion Mini Shell 1.0