o
    <‘ði$  ã                   @   sr   d dl Z d dlmZmZ d dlmZmZmZmZm	Z	 e  
e¡ZG dd„ dƒZG dd„ deeƒZG dd	„ d	eƒZdS )
é    N)ÚABCÚabstractmethod)ÚAnyÚCallableÚOptionalÚTupleÚUnionc                   @   sT   e Zd ZdZdeee eeef f fdd„Zdeee eeef f fdd„ZdS )ÚCredentialProviderz
    Credentials Provider.
    Úreturnc                 C   s   t dƒ‚)Nz#get_credentials must be implemented)ÚNotImplementedError©Úself© r   úP/root/parts/websockify/install/lib/python3.10/site-packages/redis/credentials.pyÚget_credentials   s   z"CredentialProvider.get_credentialsc                 Ã   s   �t  d¡ |  ¡ S )Nz[This method is added for backward compatability. Please override it in your implementation.)ÚloggerÚwarningr   r   r   r   r   Úget_credentials_async   s
   €ÿz(CredentialProvider.get_credentials_asyncN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ústrr   r   r   r   r   r   r	      s    "&r	   c                   @   sZ   e Zd ZdZedeegdf fdd„ƒZedeegdf fdd„ƒZ	ede
fd	d
„ƒZdS )ÚStreamingCredentialProviderzI
    Credential provider that streams credentials in the background.
    ÚcallbackNc                 C   s   dS )z­
        Specifies the callback that should be invoked
        when the next credentials will be retrieved.

        :param callback: Callback with
        :return:
        Nr   ©r   r   r   r   r   Úon_next   s   	z#StreamingCredentialProvider.on_nextc                 C   ó   d S ©Nr   r   r   r   r   Úon_error(   ó   z$StreamingCredentialProvider.on_errorr
   c                 C   r   r   r   r   r   r   r   Úis_streaming,   r    z(StreamingCredentialProvider.is_streaming)r   r   r   r   r   r   r   r   Ú	Exceptionr   Úboolr!   r   r   r   r   r      s    
r   c                   @   sV   e Zd ZdZddee dee fdd„Zdd„ Zd	ee	e e	eef f fd
d„Z
dS )Ú"UsernamePasswordCredentialProviderzg
    Simple implementation of CredentialProvider that just wraps static
    username and password.
    NÚusernameÚpasswordc                 C   s   |pd| _ |pd| _d S )NÚ ©r%   r&   )r   r%   r&   r   r   r   Ú__init__7   s   
z+UsernamePasswordCredentialProvider.__init__c                 C   s   | j r	| j | jfS | jfS r   r(   r   r   r   r   r   ;   s   z2UsernamePasswordCredentialProvider.get_credentialsr
   c                 Ã   s
   �|   ¡ S r   )r   r   r   r   r   r   @   s   €z8UsernamePasswordCredentialProvider.get_credentials_async)NN)r   r   r   r   r   r   r)   r   r   r   r   r   r   r   r   r$   1   s
    &r$   )ÚloggingÚabcr   r   Útypingr   r   r   r   r   Ú	getLoggerr   r   r	   r   r$   r   r   r   r   Ú<module>   s    
