Your IP : 216.73.216.182


Current Path : /lib/python3/dist-packages/certbot/compat/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/certbot/compat/__pycache__/misc.cpython-38.pyc

U

�]r�@s�dZddlmZddlZddlZzddlmZdZWne	k
rLdZYnXddl
mZddlm
Z
ertd	d
dgngZdd
�Zdd�Zdddd�Zdddd�Zdd�Zdd�ZdS)zk
This compat module handles various platform specific calls that do not fall into one
particular category.
�)�absolute_importN)�shellFT)�errors)�osz	/usr/sbinz/usr/local/binz/usr/local/sbincCstst��dkrt�d��dS)z�
    On Windows, raise if current shell does not have the administrative rights.
    Do nothing on Linux.

    :raises .errors.Error: If the current shell does not have administrative rights on Windows.
    rzAError, certbot must be run on a shell with administrative rights.N)�
POSIX_MODE�
shellwin32Z
IsUserAnAdminr�Error�r	r	�5/usr/lib/python3/dist-packages/certbot/compat/misc.py�+raise_for_non_administrative_windows_rightssrcCs`z<t�tjggg|�\}}}|s0t�d�|���|d��WStk
rZtj��YSXdS)a(
    Read user input to return the first line entered, or raise after specified timeout.

    :param float timeout: The timeout in seconds given to the user.
    :param str prompt: The prompt message to display to the user.

    :returns: The first line entered by the user.
    :rtype: str

    z,Timed out waiting for answer to prompt '{0}'rN)�select�sys�stdinrr�format�readline�OSError)Ztimeout�promptZrlist�_r	r	r
�readline_with_timeout$s�rz
C:\CertbotzC:\Certbot\libzC:\Certbot\log)ZconfigZworkZlogsz/etc/letsencryptz/var/lib/letsencryptz/var/log/letsencryptcCstjdkrt|St|S)z�
    Return the relevant default folder for the current OS

    :param str folder_type: The type of folder to retrieve (config, work or logs)

    :returns: The relevant default folder.
    :rtype: str

    �nt)r�name�LINUX_DEFAULT_FOLDERS�WINDOWS_DEFAULT_FOLDERS)Zfolder_typer	r	r
�get_default_folderNs
rcCs.tjdkr|Stj�|�\}}||�dd�S)z�
    Replace unsupported characters in path for current OS by underscores.
    :param str path: the path to normalize
    :return: the normalized path
    :rtype: str
    r�:r)rr�path�
splitdrive�replace)rZdrive�tailr	r	r
�.underscores_for_unsupported_characters_in_path`s
r)�__doc__Z
__future__rrr
Zwin32com.shellrrr�ImportErrorZcertbotrZcertbot.compatrZSTANDARD_BINARY_DIRSrrrrrrr	r	r	r
�<module>s.
��