
    k7ih                         S SK r S SKJr  S SKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJrJrJr   S SKrS SKJr  \ R*                  " \5      r " S
 S\R0                  \5      rg! \ a     N1\ a     N8f = f)    N)closing)ExceptionTrap   )backend)KeyringBackend)
properties)SimpleCredential)	InitErrorKeyringLockedPasswordDeleteErrorc                   l    \ rS rSrSrSr\R                  S\4S j5       r	S r
S rS rS	 rS
 rS rSrg)Keyring   zSecret Service KeyringzPython keyring libraryreturnc                    [        5        n[        R                    S S S 5        W(       a  [        S5      e[        R                  S:  a  [        S5      e [        [        R                  " 5       5       n[        R                  " U5      (       d  [        S5      e S S S 5        g! , (       d  f       N= f! , (       d  f       g= f! [        R                   a  n[        SU 35      UeS nAff = f)NzSecretStorage required)   r   z#SecretStorage 3.2 or newer requiredzJThe Secret Service daemon is neither running nor activatable through D-Busz$Unable to initialize SecretService:    )
r   secretstorage__name__RuntimeError__version_tuple__r   	dbus_initcheck_service_availability
exceptionsSecretStorageException)clsexc
connectiones       X/home/james-whalen/.local/lib/python3.13/site-packages/keyring/backends/SecretService.pypriorityKeyring.priority!   s    _"" 788**V3DEE	R0023z$??
KK&4  L 4  _ 43  00 	R!EaSIJPQQ	RsA   B%C 4'B6C %
B36
C C C C/C**C/c                    [         R                  " 5       n [        U S5      (       a!  [         R                  " XR                  5      nO[         R
                  " U5      n UR                  5       (       a0  UR                  5         UR                  5       (       a  [        S5      eU$ ! [        R                   a  n[        SU S35      UeSnAff = f)zIf self.preferred_collection contains a D-Bus path,
the collection at that address is returned. Otherwise,
the default collection is returned.
preferred_collectionz!Failed to create the collection: .Nz Failed to unlock the collection!)r   r   hasattr
Collectionr$   get_default_collectionr   r   r
   	is_lockedunlockr   )selfbus
collectionr   s       r    get_preferred_collection Keyring.get_preferred_collection4   s    
 %%'	Mt344*55c;T;TU
*AA#F
 !!##%%#$FGG 00 	M?s!DE1L	Ms   1B' 	B' 'C;CCc                     [        US5      (       a  UR                  5         UR                  5       (       a  [        S5      eg )Nr*   zFailed to unlock the item!)r&   r*   r)   r   )r+   items     r    r*   Keyring.unlockG   s6    4""KKM>> <==     c                 F   U R                  5       n[        UR                  5         UR                  U R	                  X5      5      nU H<  nU R                  U5        UR                  5       R                  S5      s  sSSS5        $    SSS5        g! , (       d  f       g= f)z,Get password of the username for the serviceutf-8N)r.   r   r   search_items_queryr*   
get_secretdecoder+   serviceusernamer-   itemsr1   s         r    get_passwordKeyring.get_passwordM   sw    224
Z**+++DKK,JKED!(//88	 ,+ ,++s   ABB
B c                     U R                  5       nU R                  XU R                  S9nSU SU S3n[        UR                  5         UR                  XeUSS9  SSS5        g! , (       d  f       g= f)z,Set password for the username of the service)applicationzPassword for 'z' on ''T)replaceN)r.   r7   appidr   r   create_item)r+   r;   r<   passwordr-   
attributeslabels          r    set_passwordKeyring.set_passwordV   si    224
[[

[K
 
&	;Z**+""5h"M ,++s   	A$$
A2c                    U R                  5       n[        UR                  5         UR                  U R	                  X5      5      nU H  nUR                  5       s  sSSS5        $    SSS5        [        S5      e! , (       d  f       N= f)z/Delete the stored password (only the first one)NzNo such password!)r.   r   r   r6   r7   deleter   r:   s         r    delete_passwordKeyring.delete_password^   so    224
Z**+++DKK,JKE{{}$ ,+ , ""566	 ,+s   7A<'A<<
B
c                    U R                   U R                     nU R                  X5      nU R                  5       n[	        UR
                  5         UR                  U5      nU Hg  nU R                  U5        UR                  5       R                  US   5      n[        X'R                  5       R                  S5      5      s  sSSS5        $    SSS5        g! , (       d  f       g= f)a1  Gets the first username and password for a service.
Returns a Credential instance

The username can be omitted, but if there is one, it will use get_password
and return a SimpleCredential containing  the username and password
Otherwise, it will return the first username and password combo that it finds.
r<   r5   N)schemesschemer7   r.   r   r   r6   r*   get_attributesgetr	   r8   r9   )r+   r;   r<   rQ   queryr-   r=   r1   s           r    get_credentialKeyring.get_credentialg   s     dkk*G.224
Z**+++E2ED!..044VJ5GH'//2C2J2J72STT ,+ ,++s   A3CC
C& N)r   
__module____qualname____firstlineno____doc__rD   r   classpropertyfloatr!   r.   r*   r>   rI   rM   rU   __static_attributes__rW   r3   r    r   r      sI     $E  $&>9N7Ur3   r   )logging
contextlibr   jaraco.contextr    r   r   compatr   credentialsr	   errorsr
   r   r   r   secretstorage.exceptionsr   ImportErrorAttributeError	getLoggerr   logSchemeSelectabler   rW   r3   r    <module>rl      sx      (  $  * 	1 !\Ug&& \U  	 		s   
A' 'A7/A76A7