o
    VÌh$  ã                   @   s¼   d Z ddlmZ ddlmZmZmZ ddlmZm	Z	m
Z
mZmZmZmZ ddlmZ ddlmZmZmZmZmZ ddlmZ dZd	 eeeƒ¡Zg d
¢Zdefdd„Zdede fdd„Z!dS )zThis file provides quick access to all SecretStorage API. Please
refer to documentation of individual modules for API details.
é    )Úmessage_bus)ÚDBusConnectionÚProxyÚopen_dbus_connection)Ú
CollectionÚcreate_collectionÚget_all_collectionsÚget_default_collectionÚget_any_collectionÚget_collection_by_aliasÚsearch_items)ÚItem)ÚSecretStorageExceptionÚ"SecretServiceNotAvailableExceptionÚLockedExceptionÚItemNotFoundExceptionÚPromptDismissedException)Úadd_match_rules)é   r   r   Ú.)r   r   r   r   r   r   r   Úcheck_service_availabilityr   Ú	dbus_initr   r
   r   r	   r   Úreturnc               
   C   sp   z
t ƒ } t| ƒ | W S  ty# } zd |jd ¡}t|ƒ|‚d}~w ttfy7 } ztt|ƒƒ|‚d}~ww )aA  Returns a new connection to the session bus, instance of
    jeepney's :class:`DBusConnection` class. This connection can
    then be passed to various SecretStorage functions, such as
    :func:`~secretstorage.collection.get_default_collection`.

    .. warning::
       The D-Bus socket will not be closed automatically. You can
       close it manually using the :meth:`DBusConnection.close` method,
       or you can use the :class:`contextlib.closing` context manager:

       .. code-block:: python

          from contextlib import closing
          with closing(dbus_init()) as conn:
              collection = secretstorage.get_default_collection(conn)
              items = collection.search_items({'application': 'myapp'})

       However, you will not be able to call any methods on the objects
       created within the context after you leave it.

    .. versionchanged:: 3.0
       Before the port to Jeepney, this function returned an
       instance of :class:`dbus.SessionBus` class.

    .. versionchanged:: 3.1
       This function no longer accepts any arguments.
    z Environment variable {} is unsetr   N)	r   r   ÚKeyErrorÚformatÚargsr   ÚConnectionErrorÚ
ValueErrorÚstr)Ú
connectionÚexÚreason© r"   új/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/secretstorage/__init__.pyr   ,   s   
€€ÿr   r   c                 C   s8   ddl m} tt| ƒ}| |¡d dkp|| ¡ d v S )z—Returns True if the Secret Service daemon is either running or
    available for activation via D-Bus, False otherwise.

    .. versionadded:: 3.2
    r   )ÚBUS_NAMEé   )Úsecretstorage.utilr$   r   r   ÚNameHasOwnerÚListActivatableNames)r   r$   Úproxyr"   r"   r#   r   T   s
   
ÿr   N)"Ú__doc__Újeepney.bus_messagesr   Újeepney.io.blockingr   r   r   Úsecretstorage.collectionr   r   r   r	   r
   r   r   Úsecretstorage.itemr   Úsecretstorage.exceptionsr   r   r   r   r   r&   r   Ú__version_tuple__ÚjoinÚmapr   Ú__version__Ú__all__r   Úboolr   r"   r"   r"   r#   Ú<module>   s   $(