Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/secretstorage/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/secretstorage/__pycache__/collection.cpython-310.pyc
o

j�_� �@sNdZddlmZmZmZddlmZddlmZm	Z	ddl
mZddlm
Z
mZmZddlmZddlmZmZmZmZmZed	Zed
ZdZdZGd
d	�d	e�Z		d"dedededeedef
dd�Zdedeefdd�Z 	d#dedeedefdd�Z!dedefdd�Z"dededefdd�Z#dedeeefdeefd d!�Z$dS)$arCollection 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�eZdZdZedfdededeeddfdd�Z	de
fd	d
�Zd$dd�Zde
fd
d�Z
d$dd�Zd$dd�Zdeefdd�Zdeeefdeefdd�Zdefdd�Zdeddfdd�Z		d%dedeeefded e
d!edefd"d#�ZdS)&rzRepresents a collection.N�
connection�collection_path�session�returncCs0||_||_||_t|t|�|_|j�d�dS)N�Label)rrrr
�COLLECTION_IFACE�_collection�get_property)�selfrrr�r�:/usr/lib/python3/dist-packages/secretstorage/collection.py�__init__$s�zCollection.__init__cCst|j�d��S)zDReturns :const:`True` if item is locked, otherwise
		:const:`False`.�Locked)�boolrr�rrrr�	is_locked.szCollection.is_lockedcCs|��rtd��dS)zSIf collection is locked, raises
		:exc:`~secretstorage.exceptions.LockedException`.zCollection is locked!N)r#r	r"rrr�ensure_not_locked3s�zCollection.ensure_not_lockedcCst|j|jg�S)aRequests unlocking the collection.

		Returns a boolean representing whether the prompt has been
		dismissed; that means :const:`False` on successful unlocking
		and :const:`True` if it has been dismissed.

		.. versionchanged:: 3.0
		   No longer accepts the ``callback`` argument.
		)rrrr"rrr�unlock9s
zCollection.unlockcCs$ttt|j�}|�dd|jg�dS)zLocks the collection.�Lock�aoN)r
r�
SERVICE_IFACEr�callr)r�servicerrr�lockEszCollection.lockcCsD|��|j�dd�\}|dkrt|j|�\}}|r td��dSdS)z/Deletes the collection and all items inside it.�Delete��/�Prompt dismissed.N)r$rr)rrr)r�prompt�	dismissed�_resultrrr�deleteJs�zCollection.deleteccs*�|j�d�D]}t|j||j�VqdS)z3Returns a generator of all items in the collection.�ItemsN)rrrrr)r�	item_pathrrr�
get_all_itemsSs��zCollection.get_all_items�
attributesccs4�|j�dd|�\}|D]}t|j||j�VqdS)z^Returns a generator of items with the given attributes.
		`attributes` should be a dictionary.�SearchItems�a{ss}N)rr)rrr)rr7�resultr5rrr�search_itemsXs
��zCollection.search_itemscCs|j�d�}t|t�s
J�|S)zReturns the collection label.r)rr�
isinstance�str�r�labelrrr�	get_label_szCollection.get_labelr?cCs|��|j�dd|�dS)z!Sets collection label to `label`.r�sN)r$r�set_propertyr>rrr�	set_labeleszCollection.set_labelF�
text/plain�secret�replace�content_typec
Csl|��|js
t|j�|_t|j||�}tdd|ftdd|fi}|j�dd|||�\}}	t|j||j�S)acCreates a new :class:`~secretstorage.item.Item` with given
		`label` (unicode string), `attributes` (dictionary) and `secret`
		(bytestring). If `replace` is :const:`True`, replaces the existing
		item with the same attributes. If `content_type` is given, also
		sets the content type of the secret (``text/plain`` by default).
		Returns the created item.z
Item.LabelrAzItem.Attributesr9�
CreateItemza{sv}(oayays)b)	r$rrrrrrr)r)
rr?r7rErFrG�_secret�
properties�new_itemr0rrr�create_itemjs	�
�zCollection.create_item)rN)FrD)�__name__�
__module__�__qualname__�__doc__�DEFAULT_COLLECTIONrr=rrrr!r#r$r%r+r3rrr6rr;r@rC�bytesrLrrrrr!s>���
�



	�����r-Nrr?�aliasrrcCs�|st|�}tdd|fi}ttt|�}|�dd||�\}}t|�dkr+t|||d�St||�\}}	|r8t	d��|	\}
}|
dksBJ�t|||d�S)	z�Creates a new :class:`Collection` with the given `label` and `alias`
	and returns it. This action requires prompting.

	:raises: :exc:`~secretstorage.exceptions.PromptDismissedException`
	         if the prompt is dismissed.
	zCollection.LabelrA�CreateCollectionza{sv}s�)rr/�o)
rrr
rr(r)�lenrrr)rr?rSrrJr*rr0r1r:�	signaturerrr�create_collections�rYccs.�ttt|�}|�d�D]}t||�VqdS)z1Returns a generator of all available collections.�CollectionsN)r
rr(rr)rr*rrrr�get_all_collections�s
��r[cCs,zt|�WStyt|dd|�YSw)zAReturns the default collection. If it doesn't exist,
	creates it.�Default�default)rr
rY)rrrrr�get_default_collection�s
��r^cCs^zt|�WStyYnwzt|t�WStyYnwtt|��}|r+|dStd��)z�Returns any collection, in the following order of preference:

	- The default collection;
	- The "session" collection (usually temporary);
	- The first collection in the collections list.rzNo collections found.)rr
�SESSION_COLLECTION�listr[)r�collectionsrrr�get_any_collection�s
��rbcCs:ttt|�}|�dd|�\}t|�dkrtd��t||�S)z�Returns the collection with the given `alias`. If there is no
	such collection, raises
	:exc:`~secretstorage.exceptions.ItemNotFoundException`.�	ReadAliasrArUzNo collection with such alias.)r
rr(r)rWr
r)rrSr*rrrr�get_collection_by_alias�s

rdr7ccs>�ttt|�}|�dd|�\}}||D]}t||�VqdS)zpReturns a generator of items in all collections with the given
	attributes. `attributes` should be a dictionary.r8r9N)r
rr(r)r)rr7r*�locked�unlockedr5rrrr;�s��r;)r-N)N)%rP�typingrrr�jeepney.io.blockingr�secretstorage.definesrr�secretstorage.dhcryptor�secretstorage.exceptionsr	r
r�secretstorage.itemr�secretstorage.utilr
rrrrrr(rQr_�objectrr=rYr[r^rbrdr;rrrr�<module>sL^��
���
�
�
�
��

Spamworldpro Mini