Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/twine/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/twine/__pycache__/utils.cpython-37.pyc

B

Fd�WN�@stddlmZmZmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
yddlZWnek
rxddl
ZYnXyddlmZmZWn$ek
r�ddlmZmZYnXe	jdkr�eZneZdZdZd#d	d
�Zd$dd�Zed
dddg�Zdd�Zdd�Zd%dd�Zdd�Zejede�ed�d�Z ejeded�d�Z!ejedd�Z"ejed d�Z#Gd!d"�d"e
j$�Z%dS)&�)�absolute_import�division�print_function)�unicode_literalsN)�urlparse�
urlunparse)�zhttps://upload.pypi.org/legacy/zhttps://test.pypi.org/legacy/�	~/.pypirccCs.tj�|�}tj�|�s2tddd�tddd�d�St��}|�|�|�	d�rl|�
dd�rl|�dd���}ndg}i}ddd�}|�	d�r�x(dD] }|�
d|�r�|�d|�||<q�Wxt|D]l}|�	|�s�q�tddd�||<xJdD]B}|�
||��r|�||�|||<q�|�|�r�|||||<q�Wq�W|S)	N)�
repository�username�password)�pypiZpypitest�	distutilsz
index-serversr
)rrzserver-login)rr
r)
�os�path�
expanduser�isfile�DEFAULT_REPOSITORY�TEST_REPOSITORY�configparser�RawConfigParser�read�has_section�
has_option�get�split)r�parserZrepositories�config�defaults�keyr
�r �</opt/alt/python37/lib/python3.7/site-packages/twine/utils.py�
get_config.s@








r"cCsTyt|�|Stk
rN|r4d|kr4|ddd�Sdj||d�}t|��YnXdS)Nz://)r
rrz�Missing '{repo}' section from the configuration file
or not a complete URL in --repository.
Maybe you have a out-dated '{cfg}' format?
more info: https://docs.python.org/distutils/packageindex.html#pypirc
)ZrepoZcfg)r"�KeyError�format)�config_filer
Zrepository_url�msgr r r!�get_repository_from_configfsr'zpypi.python.orgztestpypi.python.orgzupload.pypi.orgz
test.pypi.orgcCs.t|�}|jtkr&td|dd��St|�S)N)�https�)r�netloc�
_HOSTNAMESr)�url�parsedr r r!�normalize_repository_url�s
r.cCs*|jdkr|j�d�rtd�|��dS)Ni�)zhttps://pypi.python.orgzhttps://testpypi.python.orga!It appears you're uploading to pypi.python.org (or testpypi) you've recieved a 500 error response. PyPI is being phased out for pypi.org. Try using https://upload.pypi.org/legacy/ (or https://test.pypi.org/legacy/) to upload your packages instead. These are the default URLs for Twine now.)Zstatus_coder,�
startswith�printZraise_for_status)�responser r r!�check_status_code�s
r2cCs0|dk	r|S|�|�r||S|r(|�SdSdS)a�Gets the username / password from config.

    Uses the following rules:

    1. If it is specified on the cli (`cli_value`), use that.
    2. If `config[key]` is specified, use that.
    3. If `prompt_strategy`, prompt using `prompt_strategy`.
    4. Otherwise return None

    :param cli_value: The value supplied from the command line or `None`.
    :type cli_value: unicode or `None`
    :param config: Config dictionary
    :type config: dict
    :param key: Key to find the config value.
    :type key: unicode
    :prompt_strategy: Argumentless function to return fallback value.
    :type prompt_strategy: function
    :returns: The value for the username / password
    :rtype: unicode
    N)r)Z	cli_valuerr�prompt_strategyr r r!�get_userpass_value�s
r4cCs2|}tjdkr"tjdkr"|�d�}tjtj|d�S)N�nt)rr�utf8)�prompt)r�name�sys�version_info�encode�	functools�partial�getpass)Zprompt_textr7r r r!�password_prompt�s
r?rzEnter your username: )rr3rzEnter your password: Zca_cert)rZclient_certcs,eZdZdZd�fdd�	Zd	dd�Z�ZS)
�EnvironmentDefaultz%Get values from environment variable.TNcs<tj�||�}||_|rd}tt|�jf||d�|��dS)NF)�default�required)r�environr�env�superr@�__init__)�selfrDrBrA�kwargs)�	__class__r r!rF�szEnvironmentDefault.__init__cCst||j|�dS)N)�setattr�dest)rGr�	namespace�valuesZ
option_stringr r r!�__call__�szEnvironmentDefault.__call__)TN)N)�__name__�
__module__�__qualname__�__doc__rFrN�
__classcell__r r )rIr!r@�sr@)r	)N)N)&�
__future__rrrrr�os.pathr<r>r9�argparser�ImportError�ConfigParserrr�urllib.parser:�inputZ
input_funcZ	raw_inputrrr"r'�setr+r.r2r4r?r=Zget_usernameZget_passwordZ
get_cacertZget_clientcertZActionr@r r r r!�<module>sV

8