Your IP : 18.119.235.107


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/webbrowser.cpython-310.opt-2.pyc

o

6��f�^�@s�	ddlZddlZddlZddlZddlZddlZgd�ZGdd�de�Ze�	�Z
iZdada
d<dd�dd�Zd<d	d
�Zd=dd
�Zdd�Zdd�Zdd�dd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZeZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�Z Gd*d+�d+e�Z!d,d-�Z"d.d/�Z#ej$dd0�d1kr�Gd2d3�d3e�Z%ej$d4kr�Gd5d6�d6e�Z&Gd7d8�d8e�Z'd9d:�Z(e)d;kr�e(�dSdS)>�N)�Error�open�open_new�open_new_tab�get�registerc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�1/opt/alt/python310/lib64/python3.10/webbrowser.pyrsrF��	preferredcCs�	t�4tdurt�||gt|��<|str"|tvr"t�d|�n
t�|�Wd�dSWd�dS1s:wYdS)Nr)�_lock�	_tryorder�register_standard_browsers�	_browsers�lower�_os_preferred_browser�insert�append)�name�klass�instancerrrrrs�	"�rc	Cs�	tdurt�tdurt�Wd�n1swY|dur&|g}nt}|D]P}d|vrKt�|�}|ddkrEt|dd��St|�Szt|��}Wn
t	y`t
|�}Ynw|ddurm|dS|ddurz|d�Sq*td��)N�%s����&�rz!could not locate runnable browser)rrr�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)ZusingZalternatives�browser�commandrrrr%s6��
��rTcCsf	tdurt�tdurt�Wd�n1swYtD]}t|�}|�|||�r0dSq dS)NTF)rrrrr)�url�new�	autoraiserr$rrrrGs���rcC�	t|d�S�Nr�r�r&rrrrZ�
rcCr)�N�r+r,rrrrar-rcCs�	|��d}t�|�sddgStj�|�}zt|��}Wn
ty+ddgYSw|d}|rX|��|jkrXddl	}|�	|�}||_
tj�|�|_t|d||d�d|gSddgS)Nrr)rr)r�shutil�which�os�path�basenamerrr"�copyrr)r$r�cmdrr%Z
controllerr5rrrr#is&
�
r#c@s8eZdZ	dgZddd�Zddd�Zd	d
�Zdd�Zd
S)�BaseBrowserr�cCs||_||_dS�N)rr4��selfrrrr�__init__�s
zBaseBrowser.__init__rTcCst�r9)�NotImplementedError�r;r&r'r(rrrr�szBaseBrowser.opencC�|�|d�Sr*r+�r;r&rrrr��zBaseBrowser.open_newcCr?r.r+r@rrrr�rAzBaseBrowser.open_new_tabN)r8�rT)rr	r
�argsr<rrrrrrrr7�s

r7c@� eZdZ	dd�Zddd�ZdS)	r!cCsFt|t�r
||_dg|_n|d|_|dd�|_tj�|j�|_dS)Nrrr)�
isinstance�strrrCr2r3r4r:rrrr<�s


zGenericBrowser.__init__rTcsvt�d��|jg�fdd�|jD�}ztjdd�dkr$t�|�}ntj|dd�}|��WSty:YdSw)	N�webbrowser.openc�g|]}|�d���qS�r��replace��.0�argr,rr�
<listcomp>���z'GenericBrowser.open.<locals>.<listcomp>��winT)�	close_fdsF)	�sys�auditrrC�platform�
subprocess�Popen�wait�OSError�r;r&r'r(�cmdline�prr,rr�s��zGenericBrowser.openNrB�rr	r
r<rrrrrr!�s
r!c@�eZdZ	ddd�ZdS)r rTcsz|jg�fdd�|jD�}t�d��ztjdd�dkr$t�|�}ntj|ddd�}|��duWSty<YdSw)	NcrHrIrJrLr,rrrO�rPz*BackgroundBrowser.open.<locals>.<listcomp>rGrQrRT)rS�start_new_sessionF)	rrCrTrUrVrWrX�pollrZr[rr,rr�s���zBackgroundBrowser.openNrB�rr	r
rrrrrr �sr c@sBeZdZ	dZdZdZddgZdZdZdZ	ddd�Z
dd	d
�ZdS)
�UnixBrowserNFT�%actionrcCs�g}|r|jrt|�}|j|}|r|g}|jg||}|s"|jr&tj}nd}tj|d||jr2|p3d|dd�}	|rOz	|	�d�}
|
WStj	yNYdSw|jr\|	�
�durZdSdS|	��S)NT�rS�stdin�stdout�stderrr`�F)�
raise_opts�intr�
backgroundrW�DEVNULLrX�redirect_stdoutrYZTimeoutExpiredra)r;rCZremoter(r&Z	raise_opt�optr\Zinoutr]�rcrrr�_invoke�s2




�
�
zUnixBrowser._invokercs�t�d��|dkr|j�n!|dkr|j�n|dkr'|jdur#|j�n|j�ntdd|����fdd�|jD�}d	d�|D�}|�|d
|��}|s\�fdd�|jD�}|�|dd�Sd
S)
NrGrrr/zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs g|]}|�d���d���qS)rrdrJrL��actionr&rrrOs�z$UnixBrowser.open.<locals>.<listcomp>cSsg|]}|r|�qSrrrLrrrrOsTcrHrIrJrLr,rrrOsF)	rTrU�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsrqrC)r;r&r'r(rCZsuccessrrrrrs*
��zUnixBrowser.openr9rB)rr	r
rjrlrnrwrtrurvrqrrrrrrc�s
#rcc@s&eZdZ	ddgZdZdZdZdZdS)�Mozillardrr8z-new-windowz-new-tabTN�rr	r
rwrtrurvrlrrrrrx�rxc@s.eZdZ	ddgZddgZdZdZdZdZd	S)
�Netscape�-noraisez-raise�-remote�openURL(%s%action)r8�,new-window�,new-tabTN)	rr	r
rjrwrtrurvrlrrrrr{&sr{c@s*eZdZ	ddgZddgZdZdZdZdS)	�Galeonr|r8rdr�-nz-wTN)rr	r
rjrwrtrurlrrrrr�1sr�c@�&eZdZ	ddgZdZdZdZdZdS)�Chromerdrr8�--new-windowTNryrrrrr�;rzr�c@r�)�Operardrr8r�TNryrrrrr�Grzr�c@s*eZdZ	ddgZdZdZdZdZdZdS)�Elinksr}r~r8rr�FN)	rr	r
rwrtrurvrlrnrrrrr�Qsr�c@r_)�	KonquerorrTcCs�t�d|�|dkr
d}nd}tj}ztjd||gd|||d�}Wn	ty*Ynw|��dSztjdd	|gd|||dd
�}Wn	tyJYn	w|��durSdSztjdd|gd|||dd
�}Wn
tymYd
Sw|��duS)NrGr/ZnewTabZopenURL�	kfmclientT)rSrfrgrh�	konquerorz--silentre�kfmz-dF)rTrUrWrmrXrZrYra)r;r&r'r(rs�devnullr]rrrrfsH
��
��
��zKonqueror.openNrBrbrrrrr�_sr�c@s&eZdZdd�Zdd�Zd
dd�Zd	S)�GrailcCs�ddl}ddl}ddl}ddl}tj�|��d�}|�t�	��d}tj�|�
|�|�
|�d�}|�|�}|s:dS|�|j|j�}	|D]&}
z
|	�
|
�W|	Styjzt�|
�Wn	tygYnwYqDwdS)Nrz.grail-unixz-*)�glob�pwd�socket�tempfiler2r3�joinZ
gettempdir�getpwuid�getuid�escapeZAF_UNIXZSOCK_STREAMZconnectrZ�unlink)r;r�r�r�r�Ztempdir�user�filenameZmaybes�s�fnrrr�_find_grail_rc�s4�
�����zGrail._find_grail_rccCs&|��}|sdS|�|�|��dS)Nrr)r��send�close)r;rsr�rrr�_remote�s
z
Grail._remoterTcCs4t�d|�|r|�d|�}|S|�d|�}|S)NrGzLOADNEW zLOAD )rTrUr�)r;r&r'r(�okrrrr�s�z
Grail.openNrB)rr	r
r�r�rrrrrr��sr�cCs�t�d�r
tddtd��dtjvrt�d�rtddtd��dtjvr1t�d�r1tddtd��dtjvrCt�d�rCtdttd��t�d�rPtddtd��dD]}t�|�rat|dt|��qRd	D]}t�|�rst|dt|��qdt�d
�r�td
ttd
��n
t�d�r�tdttd��dD]}t�|�r�t|dt	|��q�t�d
�r�td
dtd
��dD]}t�|�r�t|dt
|��q�t�d�r�tddtd��t�d�r�tddtd��t�d�r�tdtd�dSdS)Nzxdg-openZGNOME_DESKTOP_SESSION_IDz	gvfs-openz
gnome-openZKDE_FULL_SESSIONr�z
x-www-browser)�firefoxZ	iceweaselZiceape�	seamonkey)zmozilla-firefoxzmozilla-firebird�firebird�mozilla�netscaper�r�)ZgaleonZepiphanyZ	skipstone)z
google-chrome�chromeZchromiumzchromium-browser�operaZmosaicZgrail)
r0r1rr r2�environr�rxr{r�r�r�r�)r$rrr�register_X_browsers�sN


�
�


�

�


�r�cCs6gatjdkr'tddtd��tddtd��tddtd��tddtd��tjdkr4tddtd��tjdd	�d
krhtdt�tj�	tj
�dd
�d�}dddddd|fD]}t�
|�rft|dt|��qWn{tj
�d�sttj
�d�r�zd��}tj|tjd�}|����}Wnttjttfy�Ynw|at�tj
�d�r�t�
d�r�tddtd��t�
d�r�tddtd��t�
d�r�tddtd��t�
d�r�tddtd��t�
d�r�tddtd��dtj
v�rtj
d�tj�}|��|D] }|dk�rt|d d!�}|d"du�rt|dt|�d d!�q�dSdS)#N�darwin�MacOSX�defaultr�r�ZsafariZ
serenityosZBrowserrQrRzwindows-defaultZPROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXEr�r�r�r�r�ZDISPLAYZWAYLAND_DISPLAYz$xdg-settings get default-web-browser)rhZTERMzwww-browserZlinksZelinksZlynxZw3mZBROWSERr8Tr
r)rrTrVr�MacOSXOSAScriptr �WindowsDefaultr2r3r�r�rr0r1rrWZcheck_outputrm�decode�strip�FileNotFoundErrorZCalledProcessError�PermissionError�NotADirectoryErrorrr�r!r��pathsep�reverser#)Ziexplorer$r6Z
raw_result�resultZuserchoicesr\rrrrsh


��
���





��rrQrRc@seZdZddd�ZdS)r�rTcCs2t�d|�zt�|�WdStyYdSw)NrGFT)rTrUr2Z	startfilerZr>rrrr\s��zWindowsDefault.openNrBrbrrrrr�[sr�r�c@rD)	r�cC�
||_dSr9)rr:rrrr<w�
zMacOSX.__init__rTc	Cs�t�d|�d|vrd|}tt|��}|jdkr"d|�dd�}n|jdkr*d	}nd
|d}d|�dd�}d
|j||f}t�dd�}|durLdS|�|�|�	�}|S)NrG�:zfile:r��open location "%s"�"�%22ZOmniWebr8ztoWindow %drzOpenURL "%s"z�tell application "%s"
                                activate
                                %s %s
                            end tell�	osascript�wF)
rTrUrk�boolrrKr2�popen�writer�)	r;r&r'r(�scriptZtoWindowr6�osapiperprrrrzs&


�
zMacOSX.openNrBr^rrrrr�ms	r�c@seZdZdd�Zddd�ZdS)	r�cCr�r9)�_namer:rrrr<�r�zMacOSXOSAScript.__init__rTcCsb|jdkrd|�dd�}nd|j|�dd�f}t�dd�}|dur%dS|�|�|��}|S)	Nr�r�r�r�z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r�rKr2r�r�r�)r;r&r'r(r�r�rprrrr�s
�
zMacOSXOSAScript.openNrBr^rrrrr��sr�c	
Cs�ddl}dtjd}z|�tjdd�d�\}}Wn&|jy@}zt|tjd�t|tjd�t�d�WYd}~nd}~wwd}|D]\}}|dkrPd}qE|dkrVd}qEt|�dkrit|tjd�t�d�|d}t||�td	�dS)
NrzDUsage: %s [-n | -t] url
    -n: open new window
    -t: open new tabrZntd)�filer�z-tr/�)	�getoptrT�argv�error�printrh�exit�lenr)	r�ZusageZoptsrC�msgZnew_win�o�ar&rrr�main�s.����

r��__main__r9rB)*r2rr0rTrWZ	threading�__all__�	Exceptionr�RLockrrrrrrrrrr#�objectr7r!r rcrxr{r�r�ZChromiumr�r�r�r�r�rrVr�r�r�r�rrrrr�<module>sV

""O

	
56AO
/
�

?>