Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/webbrowser.cpython-39.opt-2.pyc

a

R�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�d1k�r�Gd2d3�d3e�Z%ej$d4k�r�Gd5d6�d6e�Z&Gd7d8�d8e�Z'd9d:�Z(e)d;k�r�e(�dS)?�N)�Error�open�open_new�open_new_tab�get�registerc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�//opt/alt/python39/lib64/python3.9/webbrowser.pyrsrF��	preferredcCsnt�Vtdurt�||gt|��<|s4trB|tvrBt�d|�n
t�|�Wd�n1s`0YdS)Nr)�_lock�	_tryorder�register_standard_browsers�	_browsers�lower�_os_preferred_browser�insert�append)�name�klass�instancerrrrrsrc	Cstdur:t�tdurt�Wd�n1s00Y|durJ|g}nt}|D]�}d|vr�t�|�}|ddkr�t|dd��St|�SqRzt|��}Wnt	y�t
|�}Yn0|ddur�|dS|ddurR|d�SqRtd��dS)N�%s����&�rz!could not locate runnable browser)rrr�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)ZusingZalternatives�browser�commandrrrr%s,$
rTcCsdtdur:t�tdurt�Wd�n1s00YtD] }t|�}|�|||�r>dSq>dS)NTF)rrrrr)�url�new�	autoraiserr$rrrrGs	$rcCs
t|d�S�Nr�r�r&rrrrZsrcCs
t|d�S�N�r*r+rrrrasrcCs�|��d}t�|�sddgStj�|�}zt|��}WntyTddgYS0|d}|r�|��|jkr�ddl	}|�	|�}||_
tj�|�|_t|d||d�d|gSddgS)Nrr)rr)r�shutil�which�os�path�basenamerrr"�copyrr)r$r�cmdrr%Z
controllerr3rrrr#is"

r#c@s6eZdZdgZddd�Zddd�Zd	d
�Zdd�Zd
S)�BaseBrowserr�cCs||_||_dS�N)rr2��selfrrrr�__init__�szBaseBrowser.__init__rTcCst�dSr7)�NotImplementedError�r9r&r'r(rrrr�szBaseBrowser.opencCs|�|d�Sr)r*�r9r&rrrr�szBaseBrowser.open_newcCs|�|d�Sr,r*r=rrrr�szBaseBrowser.open_new_tabN)r6)rT)rr	r
�argsr:rrrrrrrr5�s


r5c@seZdZdd�Zddd�ZdS)	r!cCsFt|t�r||_dg|_n|d|_|dd�|_tj�|j�|_dS)Nrrr)�
isinstance�strrr>r0r1r2r8rrrr:�s


zGenericBrowser.__init__rTcszt�d��|jg�fdd�|jD�}z8tjdd�dkrHt�|�}ntj|dd�}|��WStytYdS0dS)	N�webbrowser.opencsg|]}|�d���qS�r��replace��.0�argr+rr�
<listcomp>�s�z'GenericBrowser.open.<locals>.<listcomp>��winT)�	close_fdsF)	�sys�auditrr>�platform�
subprocess�Popen�wait�OSError�r9r&r'r(�cmdline�prr+rr�s�zGenericBrowser.openN)rT�rr	r
r:rrrrrr!�s
r!c@seZdZddd�ZdS)r rTcs~|jg�fdd�|jD�}t�d��z<tjdd�dkrHt�|�}ntj|ddd�}|��duWStyxYdS0dS)	Ncsg|]}|�d���qSrBrCrEr+rrrH�s�z*BackgroundBrowser.open.<locals>.<listcomp>rArIrJT)rK�start_new_sessionF)	rr>rLrMrNrOrP�pollrRrSrr+rr�s��zBackgroundBrowser.openN)rT�rr	r
rrrrrr �sr c@s@eZdZdZdZdZddgZdZdZdZ	ddd�Z
dd	d
�ZdS)
�UnixBrowserNFT�%actionrcCs�g}|r*|jr*t|�}|j|}|r*|g}|jg||}|sD|jrLtj}nd}tj|d||jrd|pfd|dd�}	|r�z|	�d�}
|
WStj	y�YdS0n&|jr�|	�
�dur�dSdSn
|	��SdS)NT�rK�stdin�stdout�stderrrW�F)�
raise_opts�intr�
backgroundrO�DEVNULLrP�redirect_stdoutrQZTimeoutExpiredrX)r9r>Zremoter(r&Z	raise_opt�optrTZinoutrU�rcrrr�_invoke�s0




�

zUnixBrowser._invokercs�t�d��|dkr|j�nB|dkr,|j�n2|dkrN|jdurF|j�q^|j�ntdd|����fdd�|jD�}d	d�|D�}|�|d
|��}|s��fdd�|jD�}|�|dd�Sd
SdS)
NrArrr-zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs g|]}|�d���d���qS)rr[rCrE��actionr&rrrHs�z$UnixBrowser.open.<locals>.<listcomp>cSsg|]}|r|�qSrrrErrrrH�Tcsg|]}|�d���qSrBrCrEr+rrrHrkF)	rLrM�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsrhr>)r9r&r'r(r>Zsuccessrrirrs*
��zUnixBrowser.open)N)rT)rr	r
rarcrerorlrmrnrhrrrrrrZ�s
#rZc@s$eZdZddgZdZdZdZdZdS)�Mozillar[rr6z-new-windowz-new-tabTN�rr	r
rorlrmrnrcrrrrrps
rpc@s,eZdZddgZddgZdZdZdZdZd	S)
�Netscape�-noraisez-raise�-remote�openURL(%s%action)r6�,new-window�,new-tabTN)	rr	r
rarorlrmrnrcrrrrrr&srrc@s(eZdZddgZddgZdZdZdZdS)	�Galeonrsr6r[r�-nz-wTN)rr	r
rarorlrmrcrrrrrx1s
rxc@s$eZdZddgZdZdZdZdZdS)�Chromer[rr6�--new-windowTNrqrrrrrz;s
rzc@s$eZdZddgZdZdZdZdZdS)�Operar[rr6r{TNrqrrrrr|Gs
r|c@s(eZdZddgZdZdZdZdZdZdS)�Elinksrtrur6rvrwFN)	rr	r
rorlrmrnrcrerrrrr}Qsr}c@seZdZddd�ZdS)�	KonquerorrTcCs�t�d|�|dkrd}nd}tj}ztjd||gd|||d�}WntyTYn0|��dSz tjdd	|gd|||dd
�}Wnty�Yn0|��dur�dSz tjdd|gd|||dd
�}Wnty�Yd
S0|��duSdS)NrAr-ZnewTabZopenURL�	kfmclientT)rKr]r^r_�	konquerorz--silentr\�kfmz-dF)rLrMrOrdrPrRrQrX)r9r&r'r(rj�devnullrUrrrrfsB�
�
�
zKonqueror.openN)rTrYrrrrr~_sr~c@s&eZdZdd�Zdd�Zd
dd�Zd	S)�GrailcCs�ddl}ddl}ddl}ddl}tj�|��d�}|�t�	��d}tj�|�
|�|�
|�d�}|�|�}|stdS|�|j|j�}	|D]P}
z|	�
|
�Wn4ty�zt�|
�Wnty�Yn0Yq�0|	Sq�dS)Nrz.grail-unixz-*)�glob�pwd�socket�tempfiler0r1�joinZ
gettempdir�getpwuid�getuid�escapeZAF_UNIXZSOCK_STREAMZconnectrR�unlink)r9r�r�r�r�Ztempdir�user�filenameZmaybes�s�fnrrr�_find_grail_rc�s,�
zGrail._find_grail_rccCs&|��}|sdS|�|�|��dS)Nrr)r��send�close)r9rjr�rrr�_remote�s
z
Grail._remoterTcCs2t�d|�|r |�d|�}n|�d|�}|S)NrAzLOADNEW zLOAD )rLrMr�)r9r&r'r(�okrrrr�s
z
Grail.openN)rT)rr	r
r�r�rrrrrr��sr�cCs�t�d�rtddtd��dtjvr>t�d�r>tddtd��dtjvrbt�d�rbtddtd��dtjvr�t�d�r�tdttd��t�d�r�tddtd��dD]}t�|�r�t|dt|��q�d	D]}t�|�r�t|dt|��q�t�d
��rtd
ttd
��nt�d��r"tdttd��dD]"}t�|��r&t|dt	|���q&t�d
��rftd
dtd
��dD]"}t�|��rjt|dt
|���qjt�d��r�tddtd��t�d��r�tddtd��t�d��r�tdtd�dS)Nzxdg-openZGNOME_DESKTOP_SESSION_IDz	gvfs-openz
gnome-openZKDE_FULL_SESSIONrz
x-www-browser)�firefoxZ	iceweaselZiceape�	seamonkey)zmozilla-firefoxzmozilla-firebird�firebird�mozilla�netscaper�r�)ZgaleonZepiphanyZ	skipstone)z
google-chrome�chromeZchromiumzchromium-browser�operaZmosaicZgrail)
r.r/rr r0�environr~rprrrxrzr|r�)r$rrr�register_X_browsers�sD



r�cCs,gatjdkrNtddtd��tddtd��tddtd��tddtd��tjdd�dkr�td	t�tj�tj	�
d
d�d�}dd
dddd|fD]}t�|�r�t|dt
|��q��ntj	�
d�s�tj	�
d��r$z(d��}tj|tjd�}|����}Wnttjttf�yYn0|at�tj	�
d��r�t�d��rNtddtd��t�d��rjtddtd��t�d��r�tddtd��t�d��r�tddtd��t�d��r�tddtd��dtj	v�r(tj	d�tj�}|��|D]>}|dk�r�t|dd�}|d du�r�t|dt|�dd��q�dS)!N�darwin�MacOSX�defaultr�r�ZsafarirIrJzwindows-defaultZPROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXEr�r�r�r�r�ZDISPLAYZWAYLAND_DISPLAYz$xdg-settings get default-web-browser)r_ZTERMzwww-browserZlinksZelinksZlynxZw3mZBROWSERr6Tr
r)rrLrNr�MacOSXOSAScript�WindowsDefaultr0r1r�r�rr.r/r rrOZcheck_outputrd�decode�strip�FileNotFoundErrorZCalledProcessError�PermissionError�NotADirectoryErrorrr�r!r}�pathsep�reverser#)Ziexplorer$r4Z
raw_result�resultZuserchoicesrTrrrrsX

��

rrIrJc@seZdZddd�ZdS)r�rTcCs8t�d|�zt�|�Wnty.YdS0dSdS)NrAFT)rLrMr0Z	startfilerRr<rrrrXszWindowsDefault.openN)rTrYrrrrr�Wsr�r�c@seZdZdd�Zddd�ZdS)	r�cCs
||_dSr7)rr8rrrr:sszMacOSX.__init__rTc	Cs�t�d|�d|vrd|}tt|��}|jdkrDd|�dd�}n<|jdkrTd	}nd
|d}d|�dd�}d
|j||f}t�dd�}|dur�dS|�|�|�	�}|S)NrA�:zfile:r��open location "%s"�"�%22ZOmniWebr6ztoWindow %drzOpenURL "%s"z�tell application "%s"
                                activate
                                %s %s
                            end tell�	osascript�wF)
rLrMrb�boolrrDr0�popen�writer�)	r9r&r'r(�scriptZtoWindowr4�osapipergrrrrvs&


�
zMacOSX.openN)rTrVrrrrr�is
r�c@seZdZdd�Zddd�ZdS)	r�cCs
||_dSr7)�_namer8rrrr:�szMacOSXOSAScript.__init__rTcCsb|jdkrd|�dd�}nd|j|�dd�f}t�dd�}|durJdS|�|�|��}|S)	Nr�r�r�r�z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r�rDr0r�r�r�)r9r&r'r(r�r�rgrrrr�s
�
zMacOSXOSAScript.openN)rTrVrrrrr��sr�c	
Cs�ddl}dtjd}z|�tjdd�d�\}}WnL|jy�}z2t|tjd�t|tjd�t�d�WYd}~n
d}~00d}|D]"\}}|dkr�d}q�|dkr�d}q�t|�dkr�t|tjd�t�d�|d}t||�td	�dS)
NrzDUsage: %s [-n | -t] url
    -n: open new window
    -t: open new tabrZntd)�fileryz-tr-�)	�getoptrL�argv�error�printr_�exit�lenr)	r�ZusageZoptsr>�msgZnew_win�o�ar&rrr�main�s(� 

r��__main__)N)N)rT)*r0rr.rLrOZ	threading�__all__�	Exceptionr�RLockrrrrrrrrrr#�objectr5r!r rZrprrrxrzZChromiumr|r}r~r�r�rrNr�r�r�r�rrrrr�<module>sP
"
"O

	
56AK/


Hacked By AnonymousFox1.0, Coded By AnonymousFox