← Back
Editing: backend.cpython-38.pyc
U ۦ�\� � @ s� d Z ddlmZ ddlZddlZddlZddlZddlmZm Z m Z ddl mZ ddlm Z mZ eZe�e�Ze�d�ZdZG d d � d ej�Ze e�G dd� d��ZG d d� d�ZG dd� de�Zdd� Ze jdd� �ZdS )z Keyring implementation support � )�absolute_importN� )�credentials�errors�util)� properties)� add_metaclass�filter�priorityc s e Zd ZdZ� fdd�Z� ZS )�KeyringBackendMetazn A metaclass that's both an ABCMeta and a type that keeps a registry of all (non-abstract) types. c s@ t t| ��|||� t| d�s&t� | _| j}| js<|�| � d S )N�_classes)�superr �__init__�hasattr�setr �__abstractmethods__�add)�cls�name�bases�dict�classes�� __class__� �1/usr/lib/python3/dist-packages/keyring/backend.pyr s zKeyringBackendMeta.__init__)�__name__� __module__�__qualname__�__doc__r � __classcell__r r r r r s r c @ s| e Zd ZdZdd� Zejedd� ��Zedd� �Z ejedd � ��Z d d� Zej dd � �Zej dd� �Zdd� Zdd� ZdS )�KeyringBackendz]The abstract base class of the keyring, every backend must implement this interface. c C s dS )a� Each backend class must supply a priority, a number (float or integer) indicating the priority of the backend relative to all other backends. The priority need not be static -- it may (and should) vary based attributes of the environment in which is runs (platform, available packages, etc.). A higher number indicates a higher priority. The priority should raise a RuntimeError with a message indicating the underlying cause if the backend is not suitable for the current environment. As a rule of thumb, a priority between zero but less than one is suitable, but a priority of one or greater is recommended. Nr �r r r r r / s zKeyringBackend.priorityc C s$ t �� �}| j W 5 Q R X t|� S �N)r ZExceptionRaisedContextr �bool)r �excr r r �viable? s zKeyringBackend.viablec C s t t�d�| j�S )z6 Return all subclasses deemed viable. r&