File: //usr/lib/python3/dist-packages/secretstorage/__pycache__/collection.cpython-310.pyc
o
    j�_�   �                   @   sN  d Z ddlmZmZmZ ddlmZ ddlmZm	Z	 ddl
mZ ddlm
Z
mZmZ ddlmZ ddlmZmZmZmZmZ ed	 Zed
 ZdZdZG d
d	� d	e�Z		d"dedededee def
dd�Zdedee fdd�Z 	d#dedee defdd�Z!dedefdd�Z"dededefdd�Z#dedeeef dee fd d!�Z$dS )$ar  Collection is a place where secret items are stored. Normally, only
the default collection should be used, but this module allows to use any
registered collection. Use :func:`get_default_collection` to get the
default collection (and create it, if necessary).
Collections are usually automatically unlocked when user logs in, but
collections can also be locked and unlocked using
:meth:`Collection.lock` and :meth:`Collection.unlock` methods (unlocking
requires showing the unlocking prompt to user and can be synchronous or
asynchronous). Creating new items and editing existing ones is possible
only in unlocked collection.�    )�Dict�Iterator�Optional)�DBusConnection)�	SS_PREFIX�SS_PATH)�Session)�LockedException�ItemNotFoundException�PromptDismissedException)�Item)�DBusAddressWrapper�exec_prompt�
format_secret�open_session�unlock_objects�
Collection�Servicez(/org/freedesktop/secrets/aliases/defaultz+/org/freedesktop/secrets/collection/sessionc                
   @   s�   e Zd ZdZedfdededee ddfdd�Z	de
fd	d
�Zd$dd�Zde
fd
d�Z
d$dd�Zd$dd�Zdee fdd�Zdeeef dee fdd�Zdefdd�Zdeddfdd�Z		d%dedeeef ded e
d!edefd"d#�ZdS )&r   zRepresents a collection.N�
connection�collection_path�session�returnc                 C   s0   || _ || _|| _t|t|�| _| j�d� d S )N�Label)r   r   r   r
   �COLLECTION_IFACE�_collection�get_property)�selfr   r   r   � r   �:/usr/lib/python3/dist-packages/secretstorage/collection.py�__init__$   s   �zCollection.__init__c                 C   s   t | j�d��S )zDReturns :const:`True` if item is locked, otherwise
		:const:`False`.�Locked)�boolr   r   �r   r   r   r   �	is_locked.   s   zCollection.is_lockedc                 C   s   | � � rtd��dS )zSIf collection is locked, raises
		:exc:`~secretstorage.exceptions.LockedException`.zCollection is locked!N)r#   r	   r"