AlkantarClanX12

Your IP : 3.144.249.63


Current Path : /lib64/python3.8/__pycache__/
Upload File :
Current File : //lib64/python3.8/__pycache__/webbrowser.cpython-38.opt-1.pyc

U

e5d^�@s�dZddlZddlZddlZddlZddlZddlZddddddgZGd	d�de�Z	e�
�ZiZda
dad<d
d�dd�Zd=d
d�Zd>dd�Zdd�Zdd�Zd
d�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�Z Gd(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)?z?Interfaces for launching and remotely controlling Web browsers.�N�Error�open�open_new�open_new_tab�get�registerc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.8/webbrowser.pyrsF��	preferredc	CsZt�Ltdkrt�||gt|��<|s4trB|tkrBt�d|�n
t�|�W5QRXdS)zRegister a browser connector.Nr)�_lock�	_tryorder�register_standard_browsers�	_browsers�lower�_os_preferred_browser�insert�append)�name�klass�instancerrrrrsc	Cs�tdkr&t�tdkrt�W5QRX|dk	r6|g}nt}|D]�}d|kr�t�|�}|ddkrtt|dd��St|�Sq>zt|��}Wnt	k
r�t
|�}YnX|ddk	r�|dS|ddk	r>|d�Sq>td��dS)zCReturn a browser launcher instance appropriate for the environment.N�%s����&�rz!could not locate runnable browser)rrr�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)ZusingZalternatives�browser�commandrrrr%s,
Tc	CsPtdkr&t�tdkrt�W5QRXtD] }t|�}|�|||�r*dSq*dS)aDisplay 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.
    NTF)rrrrr)�url�new�	autoraiserr$rrrrGs	cCs
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&rrrrZscCs
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().
    �r)r*rrrrascCs�|��d}t�|�sddgStj�|�}zt|��}Wntk
rVddgYSX|d}|r�|��|jkr�ddl	}|�	|�}||_
tj�|�|_t|d||d�d|gSddgS)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%Z
controllerr1rrrr#is"

r#c@s:eZdZdZdgZddd�Zddd	�Zd
d�Zdd
�ZdS)�BaseBrowserz3Parent class for all browsers. Do not use directly.r�cCs||_||_dS�N)rr0��selfrrrr�__init__�szBaseBrowser.__init__rTcCst�dSr5)�NotImplementedError�r7r&r'r(rrrr�szBaseBrowser.opencCs|�|d�S)Nrr)�r7r&rrrr�szBaseBrowser.open_newcCs|�|d�S)Nr+r)r;rrrr�szBaseBrowser.open_new_tabN)r4)rT)	rr	r
�__doc__�argsr8rrrrrrrr3�s

r3c@s"eZdZdZdd�Zd	dd�ZdS)
r!zVClass for all browsers started with a command
       and without remote functionality.cCsFt|t�r||_dg|_n|d|_|dd�|_tj�|j�|_dS)Nrrr)�
isinstance�strrr=r.r/r0r6rrrr8�s


zGenericBrowser.__init__rTcs|t�d��|jg�fdd�|jD�}z8tjdd�dkrHt�|�}ntj|dd�}|��WStk
rvYdSXdS)	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�r7r&r'r(�cmdline�prr*rr�s�zGenericBrowser.openN)rT�rr	r
r<r8rrrrrr!�s
r!c@seZdZdZddd�ZdS)r zHClass for all browsers which are to be started in the
       background.rTcs�|jg�fdd�|jD�}t�d��z<tjdd�dkrHt�|�}ntj|ddd�}|��dkWStk
rzYdSXdS)	Ncsg|]}|�d���qSrArBrDr*rrrG�s�z*BackgroundBrowser.open.<locals>.<listcomp>r@rHrIT)rJ�start_new_sessionF)	rr=rKrLrMrNrO�pollrQrRrr*rr�s��zBackgroundBrowser.openN)rT�rr	r
r<rrrrrr �sr c@sDeZdZdZdZdZdZddgZdZdZ	dZ
ddd�Zd
d
d�ZdS)�UnixBrowserz=Parent class for all Unix browsers with remote functionality.NFT�%actionrcCs�g}|r*|jr*t|�}|j|}|r*|g}|jg||}|sD|jrLtj}nd}tj|d||jrd|pfd|dd�}	|r�z|	�d�}
|
WStj	k
r�YdSXn&|jr�|	�
�dkr�dSdSn
|	��SdS)NT�rJ�stdin�stdout�stderrrV�F)�
raise_opts�intr�
backgroundrN�DEVNULLrO�redirect_stdoutrPZTimeoutExpiredrW)r7r=Zremoter(r&Z	raise_opt�optrSZinoutrT�rcrrr�_invoke�s4



�

zUnixBrowser._invokercs�t�d��|dkr|j�nB|dkr,|j�n2|dkrN|jdkrF|j�q^|j�ntdd|����fdd�|jD�}d	d�|D�}|�|d
|��}|s��fdd�|jD�}|�|dd�Sd
SdS)
Nr@rrr+zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs g|]}|�d���d���qS)rrZrBrD��actionr&rrrGs�z$UnixBrowser.open.<locals>.<listcomp>cSsg|]}|r|�qSrrrDrrrrGsTcsg|]}|�d���qSrArBrDr*rrrGsF)	rKrL�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsrgr=)r7r&r'r(r=Zsuccessrrhrrs*
��zUnixBrowser.open)N)rT)
rr	r
r<r`rbrdrmrjrkrlrgrrrrrrY�s
#rYc@s(eZdZdZddgZdZdZdZdZdS)	�Mozillaz$Launcher class for Mozilla browsers.rZrr4z-new-windowz-new-tabTN�	rr	r
r<rmrjrkrlrbrrrrrnsrnc@s0eZdZdZddgZddgZdZdZdZd	Z	d
S)�Netscapez$Launcher class for Netscape browser.�-noraisez-raise�-remote�openURL(%s%action)r4�,new-window�,new-tabTN)
rr	r
r<r`rmrjrkrlrbrrrrrp&srpc@s,eZdZdZddgZddgZdZdZdZd	S)
�Galeonz,Launcher class for Galeon/Epiphany browsers.rqr4rZr�-nz-wTN)	rr	r
r<r`rmrjrkrbrrrrrv1srvc@s(eZdZdZddgZdZdZdZdZdS)�Chromez)Launcher class for Google Chrome browser.rZrr4�--new-windowTNrorrrrrx;srxc@s(eZdZdZddgZdZdZdZdZdS)�Operaz!Launcher class for Opera browser.rZrr4ryTNrorrrrrzGsrzc@s,eZdZdZddgZdZdZdZdZdZ	dS)	�Elinksz#Launcher class for Elinks browsers.rrrsr4rtruFN)
rr	r
r<rmrjrkrlrbrdrrrrr{Qsr{c@seZdZdZddd�ZdS)�	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.
    rTcCs�t�d|�|dkrd}nd}tj}ztjd||gd|||d�}Wntk
rVYnX|��dSz tjdd	|gd|||dd
�}Wntk
r�YnX|��dkr�dSz tjdd|gd|||dd
�}Wntk
r�Yd
SX|��dkSdS)Nr@r+ZnewTabZopenURL�	kfmclientT)rJr\r]r^�	konquerorz--silentr[�kfmz-dF)rKrLrNrcrOrQrPrW)r7r&r'r(ri�devnullrTrrrrfsN�
�
�
zKonqueror.openN)rTrXrrrr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]T}
z|	�
|
�Wn8tk
r�zt�|
�Wntk
r�YnXYq�X|	Sq�dS)Nrz.grail-unixz-*)�glob�pwd�socket�tempfiler.r/�joinZ
gettempdir�getpwuid�getuid�escapeZAF_UNIXZSOCK_STREAMZconnectrQ�unlink)r7r�r�r�r�Ztempdir�user�filenameZmaybes�s�fnrrr�_find_grail_rc�s,�
zGrail._find_grail_rccCs&|��}|sdS|�|�|��dS)Nrr)r��send�close)r7rir�rrr�_remote�s
z
Grail._remoterTcCs2t�d|�|r |�d|�}n|�d|�}|S)Nr@zLOADNEW zLOAD )rKrLr�)r7r&r'r(�okrrrr�s
z
Grail.openN)rT)rr	r
r�r�rrrrrr��sr�cCs�t�d�rtddtd��dtjkr>t�d�r>tddtd��dtjkrbt�d�rbtddtd��dtjkr�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_SESSIONr}z
x-www-browser)�firefoxZ	iceweaselZiceape�	seamonkey)zmozilla-firefoxzmozilla-firebird�firebird�mozilla�netscaperr~)ZgaleonZepiphanyZ	skipstone)z
google-chrome�chromeZchromiumzchromium-browser�operaZmosaicZgrail)
r,r-rr r.�environr|rnrprvrxrzr�)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�}|����}Wn ttjttfk
�rYnX|at�tj	�
d��r�t�d��rPtddtd��t�d��rltddtd��t�d��r�tddtd��t�d��r�tddtd��t�d��r�tddtd��dtj	k�r*tj	d�tj�}|��|D]>}|dk�r�t|dd�}|d dk�r�t|dt|�dd��q�dS)!N�darwin�MacOSX�defaultr�r�ZsafarirHrIzwindows-defaultZPROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXEr�r�r�r�r�ZDISPLAYZWAYLAND_DISPLAYz$xdg-settings get default-web-browser)r^ZTERMzwww-browserZlinksZelinksZlynxZw3mZBROWSERr4Tr
r)rrKrMr�MacOSXOSAScript�WindowsDefaultr.r/r�r�rr,r-r rrNZcheck_outputrc�decode�strip�FileNotFoundErrorZCalledProcessError�PermissionError�NotADirectoryErrorrr�r!r{�pathsep�reverser#)Ziexplorer$r2Z
raw_result�resultZuserchoicesrSrrrrs\

��

rrHrIc@seZdZddd�ZdS)r�rTcCs:t�d|�zt�|�Wntk
r0YdSXdSdS)Nr@FT)rKrLr.Z	startfilerQr:rrrrXszWindowsDefault.openN)rT)rr	r
rrrrrr�Wsr�r�c@s"eZdZdZdd�Zd	dd�ZdS)
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.
        cCs
||_dSr5)rr6rrrr8sszMacOSX.__init__rTc	Cs�t�d|�d|krd|}tt|��}|jdkrDd|�dd�}n<|jdkrTd	}nd
|d}d|�dd�}d
|j||f}t�dd�}|dkr�dS|�|�|�	�}|S)Nr@�:zfile:r��open location "%s"�"�%22ZOmniWebr4ztoWindow %drzOpenURL "%s"z�tell application "%s"
                                activate
                                %s %s
                            end tell�	osascript�wF)
rKrLra�boolrrCr.�popen�writer�)	r7r&r'r(�scriptZtoWindowr2�osapiperfrrrrvs&


�
zMacOSX.openN)rTrUrrrrr�is	r�c@seZdZdd�Zddd�ZdS)	r�cCs
||_dSr5)�_namer6rrrr8�szMacOSXOSAScript.__init__rTcCsb|jdkrd|�dd�}nd|j|�dd�f}t�dd�}|dkrJdS|�|�|��}|S)	Nr�r�r�r�z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r�rCr.r�r�r�)r7r&r'r(r�r�rfrrrr�s
�
zMacOSXOSAScript.openN)rT)rr	r
r8rrrrrr��sr�c	
Cs�ddl}dtjd}z|�tjdd�d�\}}WnJ|jk
r~}z*t|tjd�t|tjd�t�d�W5d}~XYnXd}|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)�filerwz-tr+�)	�getoptrK�argv�error�printr^�exit�lenr)	r�ZusageZoptsr=�msgZnew_win�o�ar&rrr�main�s,�

r��__main__)N)N)rT)+r<r.rr,rKrNZ	threading�__all__�	Exceptionr�RLockrrrrrrrrrr#�objectr3r!r rYrnrprvrxZChromiumrzr{r|r�r�rrMr�r�r�r�rrrrr�<module>sR
"
"O

	
56AK/