File: //usr/lib/python3/dist-packages/pip/_internal/network/__pycache__/auth.cpython-310.pyc
o
@%Ne�/ �
@ s. d Z ddlZddlmZmZmZmZmZ ddl m
Z
mZ ddlm
Z
mZ ddlmZ ddlmZ ddlmZmZmZmZmZ dd lmZ ee�Zeeeef ZzddlaW n& e y` daY n e!y{ Z" ze�#d
ee"�� daW Y dZ"["ndZ"["ww dee dee d
ee fdd�Z$G dd� de
�Z%dS )z�Network Authentication Helpers
Contains interface (MultiDomainBasicAuth) and associated glue code for
providing credentials in the context of network requests.
� N)�Any�Dict�List�Optional�Tuple)�AuthBase�
HTTPBasicAuth)�Request�Response)�get_netrc_auth)� getLogger)�ask� ask_input�ask_password�remove_auth_from_url�split_auth_netloc_from_url)�AuthInfo�*Keyring is skipped due to an exception: %s�url�username�returnc
C s� | rt sdS zCzt j}W n ty Y nw t�d| � || |�}|dur,|j|jfW S W dS |rDt�d| � t �| |�}|rG||fW S W dS W dS tyf } zt� dt
|�� da W Y d}~dS d}~ww )z3Return the tuple auth for a given url from keyring.Nz'Getting credentials from keyring for %sz$Getting password from keyring for %sr )�keyring�get_credential�AttributeError�logger�debugr �password�get_password� Exception�warning�str)r r r �credr �exc� r# �</usr/lib/python3/dist-packages/pip/_internal/network/auth.py�get_keyring_auth( s>