Your IP : 18.117.145.41


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/webbrowser.cpython-312.opt-1.pyc

�

�Q�f�\��h�dZddlZddlZddlZddlZddlZddlZddlZgd�ZGd�de	�Z
ej�ZiZ
dadad1dd�d�Zd1d	�Zd2d
�Zd�Zd�Zdd�d
�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZeZGd�de�ZGd�de�Z Gd �d!e�Z!Gd"�d#e�Z"d$�Z#d%�Z$ejJdd&d'k(rGd(�d)e�Z&ejJd*k(rGd+�d,e�Z'Gd-�d.e�Z(d/�Z)e*d0k(re)�yy)3z?Interfaces for launching and remotely controlling web browsers.�N)�Error�open�open_new�open_new_tab�get�registerc��eZdZy)rN)�__name__�
__module__�__qualname__���1/opt/alt/python312/lib64/python3.12/webbrowser.pyrrs��rrF��	preferredc��t5t�
t�||gt|j	�<|st
r#|�d�t
k(rtj
d|�ntj|�ddd�y#1swYyxYw)zRegister a browser connector.Nz.desktopr)�_lock�	_tryorder�register_standard_browsers�	_browsers�lower�_os_preferred_browser�insert�append)�name�klass�instancers    rrrse��	���&�(�#(�(�"3�	�$�*�*�,��
�.�d�V�8�3D�H]�3]����Q��%����T�"�
���s�A*A:�:Bc��t�t5t�
t�ddd�|�|g}nt}|D]u}d|vr:tj|�}|ddk(rt|dd�cSt
|�cS	t|j�}|d�|dcS|d��k|d�cStd��#1swY��xYw#t$rt|�}Y�LwxYw)zCReturn a browser launcher instance appropriate for the environment.N�%s����&�rz!could not locate runnable browser)rrr�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)�using�alternatives�browser�commands    rrr&s�����
�� �*�,��
���w�� �����7�?��k�k�'�*�G��r�{�c�!�(���"��6�6�%�g�.�.�
/�#�G�M�M�O�4���q�z�%��q�z�!����'�!�w�q�z�|�#�# �$�3�
4�4�3�U��&�
/�%�g�.��
/�s�B7�6C�7C�C�Cc��t�t5t�
t�ddd�tD]"}t|�}|j	|||�s�"yy#1swY�5xYw)azDisplay url using the default browser.

    If possible, open url in a location determined by new.
    - 0: the same browser window (the default).
    - 1: a new browser window.
    - 2: a new browser page ("tab").
    If possible, autoraise raises the window (the default) or not.

    If opening the browser succeeds, return True.
    If there is a problem, return False.
    NTF)rrrrr)�url�new�	autoraiserr+s     rrrHsS����
�� �*�,�����d�)���<�<��S�)�,�����U�s�A�Ac��t|d�S)zuOpen url in a new window of the default browser.

    If not possible, then open url in the only browser window.
    r"�r�r.s rrr^���
��Q�<�rc��t|d�S)z�Open url in a new page ("tab") of the default browser.

    If not possible, then the behavior becomes equivalent to open_new().
    �r2r3s rrrer4rc���|j�d}tj|�sddgStjj|�}	t|j�}|d}|rp|j�|j
k(rSddl	}|j|�}||_
tjj|�|_t|d||��d|gSddgS#t$rddgcYSwxYw)a�Attempt to synthesize a controller based on existing controllers.

    This is useful to create a controller when a user specifies a path to
    an entry in the BROWSER environment variable -- we can copy a general
    controller to operate using a specific installation of the desired
    browser in this way.

    If we can't create a controller in this way, or if there is no
    executable for the requested browser, return [None, None].

    rNr")rr)r$�shutil�which�os�path�basenamerrr'�copyrr)r+r�cmdrr,�
controllerr=s       rr(r(ms����-�-�/�!�
�C��<�<����d�|��
�7�7���C� �D���D�J�J�L�)�����J��d�j�j�l�j�&9�&9�9���Y�Y�z�*�
�!�
�� �g�g�.�.�w�7�
����$��y�I��j�!�!��$�<������d�|���s�
C�
C/�.C/c�2�eZdZdZdgZdd�Zd	d�Zd�Zd�Zy)
�BaseBrowserz3Parent class for all browsers. Do not use directly.rc� �||_||_y�N)rr<��selfrs  r�__init__zBaseBrowser.__init__�s����	���
rc��t�rC)�NotImplementedError�rEr.r/r0s    rrzBaseBrowser.open�s��!�!rc�&�|j|d�S)Nr"r2�rEr.s  rrzBaseBrowser.open_new�����y�y��a� � rc�&�|j|d�S)Nr6r2rKs  rrzBaseBrowser.open_new_tab�rLrN)��rT)	r
rr�__doc__�argsrFrrrr
rrrArA�s ��=��6�D��"�!�!rrAc��eZdZdZd�Zdd�Zy)r&zVClass for all browsers started with a command
       and without remote functionality.c���t|t�r||_dg|_n|d|_|dd|_tj
j
|j�|_y)Nrrr")�
isinstance�strrrQr:r;r<rDs  rrFzGenericBrowser.__init__�sP���d�C� ��D�I���D�I��Q��D�I��Q�R��D�I����(�(����3��
rc�p�tjd|�|jg|jD�cgc]}|j	d|���c}z}	tj
dddk(rt
j|�}nt
j|d��}|j�Scc}w#t$rYywxYw)N�webbrowser.openr��winT)�	close_fdsF)
�sys�auditrrQ�replace�platform�
subprocess�Popen�wait�OSError�rEr.r/r0�arg�cmdline�ps       rrzGenericBrowser.open�s����	�	�#�S�)��9�9�+�,0�I�I�!7�,5�S�"%���T�3�!7�,5�!7�7��	��|�|�B�Q��5�(��$�$�W�-���$�$�W��=���v�v�x�<���!7���	��	�s�B$�AB)�)	B5�4B5NrO�r
rrrPrFrr
rrr&r&�s��,�4�rr&c��eZdZdZdd�Zy)r%zHClass for all browsers which are to be started in the
       background.c�t�|jg|jD�cgc]}|jd|���c}z}tjd|�	tj
dddk(rt
j|�}nt
j|dd��}|j�duScc}w#t$rYywxYw)NrrWrXrYT)rZ�start_new_sessionF)
rrQr]r[r\r^r_r`�pollrbrcs       rrzBackgroundBrowser.open�s����9�9�+�,0�I�I�!7�,5�S�"%���T�3�!7�,5�!7�7���	�	�#�S�)�	��|�|�B�Q��5�(��$�$�W�-���$�$�W��7;�=���F�F�H��$�%��!7���	��	�s�B&�AB+�+	B7�6B7NrO�r
rrrPrr
rrr%r%�s���rr%c�@�eZdZdZdZdZdZddgZdZdZ	dZ
d	d�Zd
d�Zy)�UnixBrowserz=Parent class for all Unix browsers with remote functionality.NFT�%actionrc���g}|r+|jrt|�}|j|}|r|g}|jg|z|z}|s|jrtj
}nd}t	j|d||jxr|xsd|d��}	|r	|	jd�}
|
S|jr|	j��yy|	j�S#tj$rYywxYw)NT�rZ�stdin�stdout�stderrrj�F)�
raise_opts�intr�
backgroundr_�DEVNULLr`�redirect_stdoutra�TimeoutExpiredrk)rErQ�remoter0r.�	raise_opt�optre�inoutrf�rcs           r�_invokezUnixBrowser._invoke�s����	��d�o�o��I��I��/�/�)�,�C����I��9�9�+�	�)�D�0���T�_�_��&�&�E��E����W��E�%)�%9�%9�%C�e�%K�t�$)�T�
C���
��V�V�A�Y���v�
��_�_��v�v�x�����v�v�x�<����,�,�
��
�s�C�C-�,C-c�H�tjd|�|dk(r
|j}nN|dk(r
|j}n<|dk(r&|j�
|j}n|j}ntdd|zz��|jD�cgc]$}|jd|�jd|���&}}|D�cgc]}|s�|��	}}|j|d	||�}|s<|jD�cgc]}|jd|���}}|j|d
d
�Sy	cc}wcc}wcc}w)NrWrr"r6zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %srroTF)
r[r\�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsr]r�rQ)rEr.r/r0�actionrdrQ�successs        rrzUnixBrowser.opens/���	�	�#�S�)��!�8��'�'�F�
�A�X��.�.�F�
�A�X��(�(�0��2�2���2�2���9�5��;�<�=�
=� �+�+�-�+�C����D�#�&�.�.�y�&�A�+�	
�-�#�+�t��s��t��+��,�,�t�T�9�c�:���6:�i�i�@�i�s�C�K�K��c�*�i�D�@��<�<��e�U�3�3���-��+��As�)D�4D�<D�&DrCrO)
r
rrrPrvrxrzr�r�r�r�r�rr
rrrnrn�s<��G��J��J��O��d�#�K��M�����! �Frrnc�(�eZdZdZddgZdZdZdZdZy)	�Mozillaz$Launcher class for Mozilla browsers.rorrNz-new-windowz-new-tabTN�	r
rrrPr�r�r�r�rxr
rrr�r� s%��.��d�#�K��M�(��%���Jrr�c�,�eZdZdZddgZddgZdZdZdZy	)
�Epiphanyz$Launcher class for Epiphany browser.z-noraiserNror�-nz-wTN)	r
rrrPrvr�r�r�rxr
rrr�r�*s)��.��b�!�J��d�#�K��M����Jrr�c�(�eZdZdZddgZdZdZdZdZy)�Chromez)Launcher class for Google Chrome browser.rorrN�--new-windowTNr�r
rrr�r�4s%��/��d�#�K��M�)�����Jrr�c�(�eZdZdZddgZdZdZdZdZy)�Operaz!Launcher class for Opera browser.rorrNr�TNr�r
rrr�r�@s%��'��d�#�K��M�)�����Jrr�c�,�eZdZdZddgZdZdZdZdZdZ	y)	�Elinksz#Launcher class for Elinks browsers.z-remotezopenURL(%s%action)rNz,new-windowz,new-tabFN)
r
rrrPr�r�r�r�rxrzr
rrr�r�Js-��)��2�3�K��M�(��%���J��Orr�c��eZdZdZdd�Zy)�	Konquerorz�Controller for the KDE File Manager (kfm, or Konqueror).

    See the output of ``kfmclient --commands``
    for more information on the Konqueror remote-control interface.
    c���tjd|�|dk(rd}nd}tj}	tjd||gd|||��}|j�y#t$rYnwxYw	tjdd	|gd|||d�
�}|j��y#t$rYnwxYw	tjdd|gd|||d�
�}|j�duS#t$rYy
wxYw)NrWr6�newTab�openURL�	kfmclientT)rZrrrsrt�	konquerorz--silentrq�kfmz-dF)r[r\r_ryr`rarbrk)rEr.r/r0r��devnullrfs       rrzKonqueror.open_s���	�	�#�S�)��!�8��F��F��$�$��
	�� � �+�v�s�!;�+/�w�(/��A�A�
�F�F�H���
�	��	��	�� � �+�z�3�!?�+/�w�(/��37�9�A��v�v�x����
�	��	��	&�� � �%��s�!3�+/�w�(/��37�9�A��F�F�H��$�%���	��	�s5�A � 	A,�+A,�0B�	B+�*B+�/C�	C+�*C+NrOrlr
rrr�r�Xs���+&rr�c�(�eZdZdZddgZdZdZdZdZy)�Edgez*Launcher class for Microsoft Edge browser.rorrNr�TNr�r
rrr�r��s%��0��d�#�K��M�)�����Jrr�c��tjd�rtddtd��tjd�rtddtgd���dtj
vr+tjd�rtddtd��dtj
vr/tjd�rtdtt
d��tjd�rtddtd��d	D].}tj|�s�t|dt|���0tjd
�rtd
tt
d
��n/tjd�rtdtt
d��tjd�rtddtd��d
D].}tj|�s�t|dt|���0tjd�rtddtd��tjd�rtddtd��yy)Nzxdg-open�gio)r�rz--r�GNOME_DESKTOP_SESSION_IDz	gvfs-open�KDE_FULL_SESSIONr�z
x-www-browser)�firefox�	iceweasel�	seamonkeyzmozilla-firefox�mozillar�r��epiphany)z
google-chrome�chrome�chromiumzchromium-browser�opera�microsoft-edge)r8r9rr%r:�environr�r�r�r�r�r�)r+s r�register_X_browsersr��s����|�|�J����T�#4�Z�#@�A��|�|�E�����/�0K�L�M�"�R�Z�Z�/�F�L�L��4M���d�$5�k�$B�C��R�Z�Z�'�F�L�L��,E���i��;�)?�@��|�|�O�$���$�(9�/�(J�K����<�<�� ��W�d�G�G�$4�5���|�|�E����	�9�U�#3�4�	���k�	"���i��;�)?�@��|�|�J����T�8�J�#7�8�O���<�<�� ��W�d�F�7�O�4�O�
�|�|�G����$��g��/��|�|�$�%��!�4��.>�)?�@�&rc���gatjdk(rXtddt	d��tddt	d��tddt	d��tddt	d��tjdk(rtddtd��tjdd	d
k(r�tdt�tjjtjjdd
�d�}tjjtjjdd�d�}ddddd||fD].}tj|�s�t|dt|���0tjd��r�tddtd���n�tjjd�stjjd�r`	dj�}t!j"|t j$��}|j'�j)�}|at5�tjjd�r�tjd�rtddt7d��tjd�rtddt7d��tjd�rtddt9d��tjd�rtddt7d��tjd�rtddt7d��d tjvrytjd jtj:�}|j=�|D]3}|d!k7s�	t?|d"�#�}|d$��t|dt7|�d"�#��5yy#t,t j.t0t2f$rY���wxYw)%N�darwin�MacOSX�defaultr�r��safari�
serenityos�BrowserrXrYzwindows-defaultzPROGRAMFILES(x86)zC:\Program Files (x86)z%Microsoft\Edge\Application\msedge.exe�PROGRAMFILESzC:\Program Filesr�r�r�zMicrosoftEdge.exer��DISPLAY�WAYLAND_DISPLAYz$xdg-settings get default-web-browser)rt�TERMzwww-browser�links�elinks�lynx�w3m�BROWSERrNTrr") rr[r^r�MacOSXOSAScriptr%�WindowsDefaultr:r;�joinr�rr8r9r�r$r_�check_outputry�decode�stripr�FileNotFoundError�CalledProcessError�PermissionError�NotADirectoryErrorr�r&r��pathsep�reverser()�edge64�edge32r+r>�
raw_result�result�userchoicesres        rrr�s����I�
�|�|�x����4���!;�<���4���!:�;���D�/�)�"<�=���4���!:�;��|�|�|�#���D�"3�I�">�?�
�|�|�B�Q��5� ��"�N�3������b�j�j�n�n�-@�B[�\�H�J�������b�j�j�n�n�^�=P�Q�H�J��!�;�	�8����1�G��|�|�G�$���$�(9�'�(B�C�1��<�<�+�,��%�t�T�2E�-F�G��:�:�>�>�)�$��
�
���7H�(I�
/�<�B�B�D��'�4�4�S��AS�AS�T�
�#�*�*�,�2�2�4��
)/�%��!��:�:�>�>�&�!��|�|�M�*����n�]�.K�L��|�|�G�$���$��w�(?�@��|�|�H�%���4���)9�:��|�|�F�#����~�f�'=�>��|�|�E�"����n�U�&;�<��B�J�J���j�j��+�1�1�"�*�*�=������#�G��"�}�!�'�T�:���q�6�>��W�d�N�7�,C�t�T�	#�
��7&�z�'D�'D�o�Wi�j�
��
�s� AO�#O(�'O(rXrYc��eZdZdd�Zy)r�c�z�tjd|�	tj|�y#t$rYywxYw)NrWTF)r[r\r:�	startfilerbrIs    rrzWindowsDefault.open+s=���I�I�'��-�
����S�!����
��
�s�.�	:�:NrO)r
rrrr
rrr�r�*s��		rr�r�c��eZdZdZd�Zdd�Zy)r�a{Launcher class for Aqua browsers on Mac OS X

        Optionally specify a browser name on instantiation.  Note that this
        will not work for Aqua browsers if the user has moved the application
        package after installation.

        If no browser is specified, the default browser, as specified in the
        Internet System Preferences panel, will be used.
        c�x�tj|jj�d�td��||_y)Nz3 is deprecated in 3.11 use MacOSXOSAScript instead.r6��
stacklevel��warnings�warn�	__class__r
�DeprecationWarningrrDs  rrFzMacOSX.__init__Fs5���M�M�T�^�^�4�4�5�6:�:�;M�Z[�
]��D�Irc��tjd|�d|vrd|z}tt|��}|jdk(rd|jdd�z}nE|jdk(rd	}nd
|dz
z}d|jdd�z}d
|j�d|�d|�d�}t
jdd�}|�y|j|�|j�}|S)NrW�:zfile:r��open location "%s"�"�%22�OmniWebrNztoWindow %dr"zOpenURL "%s"ztell application "zK"
                                activate
                                � z%
                            end tell�	osascript�wF)
r[r\rw�boolrr]r:�popen�write�close)	rEr.r/r0�script�toWindowr>�osapiper�s	         rrzMacOSX.openKs����I�I�'��-��#�:��c�k���d�3�i�.�C��y�y�I�%�-����C��0G�G���9�9�	�)�!�H� -��a��8�H�$�s�{�{�3��'>�>��,0�9�9�c�8�E��
�h�h�{�C�0�G�����M�M�&�!�����B��6�MrNrOrgr
rrr�r�<s��	�	�
 	rr�c�\��eZdZd�fd�	Zed��Zejd��Zdd�Z�xZS)r�c�$��t�|�|�yrC)�superrF)rErr�s  �rrFzMacOSXOSAScript.__init__ns����G��T�"rc��tj|jj�d|jj�d�td��|j
S�Nz!._name is deprecated in 3.11 use z.name instead.r6r�r�)rEs r�_namezMacOSXOSAScript._nameqsK���M�M�T�^�^�4�4�5�6"�"&�.�.�"9�"9�!:�.�J�,��
<��9�9�rc��tj|jj�d|jj�d�td��||_yr�r�)rE�vals  rr�zMacOSXOSAScript._namexsH���M�M�T�^�^�4�4�5�6"�"&�.�.�"9�"9�!:�.�J�,��
<��D�Irc�4�tjd|�|jdk(rd|jdd�z}n!d|j|jdd�fz}t	j
dd�}|�y	|j
|�|j�}|S)
NrWr�r�r�r�z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r[r\rr]r:r�r�r�)rEr.r/r0r�r�r�s       rrzMacOSXOSAScript.opens����I�I�'��-��y�y�I�%�-����C��0G�G���
�	�	�3�;�;�s�E�#:�;�<���h�h�{�C�0�G�����M�M�&�!�����B��6�Mr)r�rO)	r
rrrF�propertyr��setterr�
__classcell__)r�s@rr�r�ms9���	#�
�	�
�	�
���	�
�	�	rr�c��ddl}dtjdz}	|jtjddddg�\}}d}D]O\}}|dk(rd}�|dk(rd	}�|d
k(s|dk(s�!t	|tj
��tj��Qt�dk7r0t	|tj
��tjd�|d}t||�t	d�y#|j$rV}t	|tj
��t	|tj
��tjd�Yd}~��d}~wwxYw)
NrzcUsage: %s [-n | -t | -h] url
    -n: open new window
    -t: open new tab
    -h, --help: show helpr"�ntdh�help)�filer�z-tr6z-hz--help�)	�getoptr[�argv�error�printrt�exit�lenr)	r��usage�optsrQ�msg�new_win�o�ar.s	         r�mainr
�s���
� #�x�x��{�
+�E���]�]�3�8�8�A�B�<����A�
��d�
�G����1���9��g�
�$�Y�!��
�$�Y�!�x�-��%�c�j�j�)��H�H�J���4�y�A�~�
�e�#�*�*�%������
�q�'�C���g��	�$�K��%�<�<��
�c��
�
�#�
�e�#�*�*�%���������s�(C5�5E�AE�E�__main__rCrO)+rPr:r#r8r[r_�	threadingr��__all__�	Exceptionr�RLockrrrrrrrrrr(�objectrAr&r%rnr�r�r��Chromiumr�r�r�r�r�rr^r�r�r�r
r
r
rr�<module>rs|��E�
��
�
����
J��	�I�	�	�	������	��	���
#�e�
#�5�D�,��',��D!�&�!�&�[��8���&L�+�L�^�k���{���[�����K���[��2&��2&�j�;��"2A�jMU�l�<�<����u��
��
� �<�<�8��/��/�b$�+�$�N�8�z���F�r

?>