Your IP : 3.145.84.128


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/webbrowser.cpython-35.opt-2.pyc



���]9U�@s�ddlZddlZddlZddlZddlZddddddgZGdd�de�ZiZgZ	dd	d
d�Z
ddd�Zddd
d�Zdd�Z
dd�Zd	dd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZeZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�Zd*d+�Zejjd,�re�ejjd-�r�ej d.�r:e
d.ded.��ej d/�r_e
d/ded/��ej d0�r�e
d0ded0��ej d1�r�e
d1ded1��ej d2�r�e
d2ded2��ej!dd3�d4kr�Gd5d6�d6e�Z"gZ	iZe
d7e"�ej#j$ejjd8d9�d:�Z%xHd;d<d=d>d?d@e%fD]+Z&ej e&�rVe
e&dee&��qVWej!dAkr$GdBdC�dCe�Z'GdDdE�dEe�Z(e
dFde(dF�dN�e
d;de(d;�dO�e
dGde(dG�dP�e
dCde(dH�dQ�dIejkr�ejdIj)ej*�Z+e+j,�xRe+D]JZ-e-dJkr]ee-dR�Z.e.d	dkr]e
e-dee-�dS�q]WdZ-[-[+dKdL�Z/e0dMkr�e/�dS)T�N�Error�open�open_new�open_new_tab�get�registerc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�//opt/alt/python35/lib64/python3.5/webbrowser.pyr
s�cCsR||gt|j�<|dkr2tj|�n|dkrNtjd|�dS)Nr)�	_browsers�lower�	_tryorder�append�insert)�name�klass�instance�update_tryorderrrrrs
cCs�|dk	r|g}nt}x�|D]�}d|krwtj|�}|ddkrjt|dd��St|�Sq%yt|j�}Wntk
r�t|�}YnX|ddk	r�|dS|ddk	r%|d�Sq%Wt	d��dS)Nz%sr
�&rz!could not locate runnable browser���r)
r�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)ZusingZalternatives�browser�commandrrrrs$


TcCs:x3tD]+}t|�}|j|||�rdSqWdS)NTF)rrr)�url�new�	autoraiserrrrrr9s

cCs
t|d�S)Nr
)r)r!rrrr@scCs
t|d�S)N�)r)r!rrrrCsc
Cs�|j�d}tj|�s)ddgStjj|�}yt|j�}Wntk
rmddgSYnX|d}|r�|j�|jkr�ddl	}|j	|�}||_
tjj|�|_t|d||�d|gSddgS)Nrr
)r�shutil�which�os�path�basenamerrr�copyrr)rr�cmdrr Z
controllerr*rrrrGs"


	
rc@sReZdZdgZddd�Zdddd�Zd	d
�Zdd�Zd
S)�BaseBrowserz%s�cCs||_||_dS)N)rr))�selfrrrr�__init__ns	zBaseBrowser.__init__rTcCs
t�dS)N)�NotImplementedError)r.r!r"r#rrrrrszBaseBrowser.opencCs|j|d�S)Nr
)r)r.r!rrrruszBaseBrowser.open_newcCs|j|d�S)Nr$)r)r.r!rrrrxszBaseBrowser.open_new_tabN)rr	r
�argsr/rrrrrrrr,is
	r,c@s.eZdZdd�Zdddd�ZdS)rcCsct|t�r'||_dg|_n |d|_|dd�|_tjj|j�|_dS)Nz%srr
)�
isinstance�strrr1r'r(r))r.rrrrr/�s	
zGenericBrowser.__init__rTcs�|jg�fdd�|jD�}yOtjdd�dkrTtj|�}ntj|dd�}|j�SWntk
r�dSYnXdS)Ncs"g|]}|jd���qS)z%s)�replace)�.0�arg)r!rr�
<listcomp>�s	z'GenericBrowser.open.<locals>.<listcomp>��win�	close_fdsTF)rr1�sys�platform�
subprocess�Popen�wait�OSError)r.r!r"r#�cmdline�pr)r!rr�s
zGenericBrowser.openN)rr	r
r/rrrrrr|s
rc@s"eZdZdddd�ZdS)rrTcs�|jg�fdd�|jD�}yZtjdd�dkrTtj|�}ntj|dddd�}|j�dkSWntk
r�dSYnXdS)	Ncs"g|]}|jd���qS)z%s)r4)r5r6)r!rrr7�s	z*BackgroundBrowser.open.<locals>.<listcomp>r8r9r:T�start_new_sessionF)rr1r;r<r=r>�pollr@)r.r!r"r#rArBr)r!rr�s	
zBackgroundBrowser.openN)rr	r
rrrrrr�src@s^eZdZdZdZdZddgZdZdZdZ	dd�Z
ddd	d
�ZdS)�UnixBrowserNFTz%actionz%sc
Cs g}|r=|jr=t|�}|j|}|r=|g}|jg||}|s`|jrltj}nd}tj|ddd|d|jr�|p�dd|dd�}|r�y|jd�}	|	SWqtj	k
r�dSYqXn1|jr|j
�dkr
dSdSn|j�SdS)	Nr:T�stdin�stdout�stderrrC�F)�
raise_opts�intr�
backgroundr=�DEVNULLr>�redirect_stdoutr?�TimeoutExpiredrD)
r.r1Zremoter#Z	raise_opt�optrAZinoutrB�rcrrr�_invoke�s0
			zUnixBrowser._invokercs�|dkr|j�n_|dkr0|j�nG|dkrc|jdkrW|j�qw|j�ntdd|����fdd�|jD�}dd�|D�}|j|d	|�}|s��fd
d�|jD�}|j|dd�Sd	SdS)Nrr
r$zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs.g|]$}|jd��jd���qS)z%sz%action)r4)r5r6)�actionr!rrr7�s	z$UnixBrowser.open.<locals>.<listcomp>cSsg|]}|r|�qSrr)r5r6rrrr7�s	Tcs"g|]}|jd���qS)z%s)r4)r5r6)r!rrr7�s	F)�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsrRr1)r.r!r"r#r1�successr)rSr!rr�s$
zUnixBrowser.open)rr	r
rJrLrNrWrTrUrVrRrrrrrrE�s#rEc@s4eZdZddgZdZdZdZdZdS)�Mozillaz%actionz%sr-z-new-windowz-new-tabTN)rr	r
rWrTrUrVrLrrrrrY�s
rYc@s@eZdZddgZddgZdZdZdZdZd	S)
�Netscapez-noraisez-raisez-remotezopenURL(%s%action)r-z,new-windowz,new-tabTN)	rr	r
rJrWrTrUrVrLrrrrrZsrZc@s:eZdZddgZddgZdZdZdZdS)	�Galeonz-noraiser-z%actionz%sz-nz-wTN)rr	r
rJrWrTrUrLrrrrr[s
r[c@s4eZdZddgZdZdZdZdZdS)�Chromez%actionz%sr-z--new-windowTN)rr	r
rWrTrUrVrLrrrrr\s
r\c@s@eZdZddgZddgZdZdZdZdZdS)	�Operaz-noraiser-z-remotezopenURL(%s%action)z,new-windowz	,new-pageTN)	rr	r
rJrWrTrUrVrLrrrrr]"sr]c@s:eZdZddgZdZdZdZdZdZdS)�Elinksz-remotezopenURL(%s%action)r-z,new-windowz,new-tabFN)	rr	r
rWrTrUrVrLrNrrrrr^-sr^c@s"eZdZdddd�ZdS)�	KonquerorrTc"CsG|dkrd}nd}tj}y4tjd||gddd|d|d	|�}Wntk
rlYnX|j�dSy:tjd
d|gddd|d|d	|dd�}Wntk
r�YnX|j�dkr�dSy:tjd
d|gddd|d|d	|dd�}Wntk
r2dSYnX|j�dkSdS)Nr$ZnewTabZopenURL�	kfmclientr:TrFrGrH�	konquerorz--silentrC�kfmz-dF)r=rMr>r@r?rD)r.r!r"r#rS�devnullrBrrrrBs:		





	zKonqueror.openN)rr	r
rrrrrr_;sr_c@s:eZdZdd�Zdd�Zdddd�Zd	S)
�GrailcCsddl}ddl}ddl}ddl}tjj|j�d�}|jtj	��d}tjj||d�}|j|�}|s�dS|j|j
|j�}	x^|D]V}
y|	j|
�Wn8t
k
rytj|
�Wnt
k
rYnXYq�X|	Sq�WdS)Nrz.grail-unixz-*)�glob�pwd�socket�tempfiler'r(�join�
gettempdir�getpwuid�getuid�AF_UNIX�SOCK_STREAM�connectr@�unlink)r.rerfrgrh�tempdir�user�filenameZmaybes�s�fnrrr�_find_grail_rcss*	



zGrail._find_grail_rccCs1|j�}|sdS|j|�|j�dS)Nrr
)rv�send�close)r.rSrtrrr�_remote�s

z
Grail._remoterTcCs3|r|jd|�}n|jd|�}|S)NzLOADNEW zLOAD )ry)r.r!r"r#�okrrrr�sz
Grail.openN)rr	r
rvryrrrrrrdosrdcCs�tjd�r%tddtd��dtjkrYtjd�rYtddtd��dtjkr�tjd�r�tddtd��dtjkr�tjd�r�tdttd��tjd�r�tddtd��x3dD]+}tj|�r�t|dt|��q�Wx3dD]+}tj|�r#t|dt|��q#Wtjd�rztdttd��n%tjd�r�tdttd��x3dD]+}tj|�r�t|dt	|��q�Wtjd�r�tddtd��x3d D]+}tj|�rt|dt
|��qWtjd�rUtddtd��tjd�rztddtd��tjd�r�tdtd�dS)!Nzxdg-openZGNOME_DESKTOP_SESSION_IDz	gvfs-openz
gnome-openZKDE_FULL_SESSIONr`z
x-www-browser�firefox�	iceweasel�iceape�	seamonkey�mozilla-firefox�mozilla-firebird�firebird�mozilla�netscaperbra�galeon�epiphanyZ	skipstone�
google-chrome�chrome�chromium�chromium-browser�operaZmosaicZgrail)r{r|r}r~)rr�r�r�r�)r�r�)r�r�r�r�)
r%r&rrr'�environr_rYrZr[r\r]rd)rrrr�register_X_browsers�sH



r�ZDISPLAYZTERMzwww-browserZlinksZelinksZlynxZw3mr8r9c@s"eZdZdddd�ZdS)�WindowsDefaultrTcCs2ytj|�Wntk
r)dSYnXdSdS)NFT)r'Z	startfiler@)r.r!r"r#rrrr�s

	zWindowsDefault.openN)rr	r
rrrrrr��sr�zwindows-defaultZPROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXEr{r�r~r�r�r��darwinc@s.eZdZdd�Zdddd�ZdS)�MacOSXcCs
||_dS)N)r)r.rrrrr/'szMacOSX.__init__rTc	Cs�d|krd|}tt|��}|jdkrPd|jdd�}nR|jdkrhd}nd	|d
}d|jdd�}d|j||f}tjd
d�}|dkr�dS|j|�|j�}|S)N�:zfile:�defaultzopen location "%s"�"z%22ZOmniWebr-ztoWindow %dr
zOpenURL "%s"z�tell application "%s"
                                activate
                                %s %s
                            end tell�	osascript�wF)rK�boolrr4r'�popen�writerx)	r.r!r"r#�scriptZtoWindowr+�osapiperQrrrr*s 
	
zMacOSX.openN)rr	r
r/rrrrrr�s
r�c@s.eZdZdd�Zdddd�ZdS)�MacOSXOSAScriptcCs
||_dS)N)�_name)r.rrrrr/LszMacOSXOSAScript.__init__rTcCs�|jdkr(d|jdd�}nd|j|jdd�f}tjdd�}|dkridS|j|�|j�}|S)	Nr�zopen location "%s"r�z%22z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r�r4r'r�r�rx)r.r!r"r#r�r�rQrrrrOs
zMacOSXOSAScript.openN)rr	r
r/rrrrrr�Ksr�Zsafarir�r�ZBROWSERr-c	Cs?ddl}dtjd}y)|jtjdd�d�\}}Wn[|jk
r�}z8t|dtj�t|dtj�tjd�WYdd}~XnXd}x;|D]3\}}|dkr�d}q�|dkr�d}q�Wt|�dkrt|dtj�tjd�|d}t||�td	�dS)
NrzDUsage: %s [-n | -t] url
    -n: open new window
    -t: open new tabr
Zntd�filez-nz-tr$�)	�getoptr;�argv�error�printrH�exit�lenr)	r��usageZoptsr1�msgZnew_win�o�ar!rrr�mains() 	



r��__main__rrrrrr)1r'rr%r;r=�__all__�	Exceptionrrrrrrrrr�objectr,rrrErYrZr[r\ZChromiumr]r^r_rdr�r�r&r<r�r(riZiexplorerr�r�r�pathsepZ_userchoices�reverserAr+r�rrrrr�<module>s�"N

	45B
	.



?>