+
    eim#  c                  s  a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIHt ^ RIHt ^RIHtHtHt ^RIHt ^RIHt ]P0                  ! ]4      t]P6                  ! R4      tRtR	]R
&    ! R R]P>                  4      t  ! R R] R7      t! ! R R4      t" ! R R]"4      t#R R lt$]R R l4       t% ! R R4      t&R# )z 
Keyring implementation support
)annotationsN)ExceptionTrap)once)credentialserrorsutil)
properties)metadatapriorityz.typing.Callable[[KeyringBackend], bool] | None_limitc                  s8   a  ] tR t^tRtV 3R ltR tR tRtV ;t	# )KeyringBackendMetaz}
Specialized subclass behavior.

Keeps a registry of all (non-abstract) types.

Wraps set_password to validate the username.
c                	sh   < \         SV `  WV4       V P                  4        V P                  4        R # N)Zsuper__init__	_register"_validate_username_in_set_password)clsnameZbasesdict	__class__s   &&&&4/usr/lib/python3.14/site-packages/keyring/backend.pyr   ZKeyringBackendMeta.__init__'   s'    d+..0    c                	s    \        V R 4      '       g   \        4       V n        V P                  pV P                  '       g   VP	                  V 4       R# R# )_classesN)ZhasattrZsetr   Z__abstractmethods__Zadd)r   Zclasses   & r   r   ZKeyringBackendMeta._register,   s>    sJ''5CL,,&&&KK 'r   c                sj   a V P                   o\        P                  ! S4      V3R l4       pWn         R# )z=
Wrap ``set_password`` such to validate the passed username.
c                s@   < V P                  V4       S! WV.VO5/ VB # r   )_validate_username)selfZsystemusernameZargskwargsorigs   &&&*,r   wrapperZFKeyringBackendMeta._validate_username_in_set_password.<locals>.wrapper9   s(    ##H-h@@@@r   N)set_password	functoolsZwraps)r   r   r   s   & @r   r   Z5KeyringBackendMeta._validate_username_in_set_password3   s5     			A 
	A #r    )
__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes__Z__classcell__)r      @r   r
   r
      s    1
# #r   r
   c                  sv   ] tR t^AtRtR t]P                  R R l4       t]	! 4       P                  t
]P                  ]
R 4       4       t]R R l4       t]P                  R R	 l4       tR
 R lt]P"                  R R l4       tR R lt]P"                  R R l4       tR R ltR R ltR R ltR R ltRtR# )KeyringBackendzUThe abstract base class of the keyring, every backend must implement
this interface.
c                	s&    V P                  4        R # r   )set_properties_from_envr      &r   r   ZKeyringBackend.__init__F   s    $$&r   c                   V ^8  d   QhRR/# )   returnZfloatr   Zformat   "r   __annotate__KeyringBackend.__annotate__J   s     " "% "r   c                s    \         h)ae  
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.
)ZNotImplementedErrorr)   r*   r   r   ZKeyringBackend.priorityI   s
      "!r   c                	s    V P                    R # r   )r   r   r*   r   viableZKeyringBackend.viable^   s     	r   c                    V ^8  d   QhRRRR/# )r,   r   ztype[KeyringBackend]r-   zfilter[type[KeyringBackend]]r   r.   r/   r   r0   r1   d   s      C C!C	%Cr   c                sV    \        \        P                  ! R4      V P                  4      # )z&
Return all subclasses deemed viable.
r3   )filteroperator
attrgetterr   r2   r*   r   get_viable_backendsZ"KeyringBackend.get_viable_backendsc   s      h))(3S\\BBr   c               r+   r,   r-   strr   r.   r/   r   r0   r1   m   s     	2 	2S 	2r   c                s    V P                   P                  R4      w  rpVP                  RR4      pRP                  W0P                  .4      # )zZ
The keyring name, suitable for display.

The name is derived from module and class name.
.Z_Z )r!   Z
rpartitionZreplaceZjoinr    )r   ZparentsepZmod_names   &   r   r   ZKeyringBackend.namel   sE     !$ 9 9# >X##C-xx<<011r   c               r+   r9   r   r.   r/   r   r0   r1   x   s     m m mr   c                	sl    \        V 4      pVP                   R VP                   RVP                  R R2# )r;   z (priority: ZgZ))Ztyper!   r    r   )r   Zkeyring_classr   r   __str__ZKeyringBackend.__str__x   s>    T
**+1]-C-C,DLQ^QgQghiPjjkllr   c               $    V ^8  d   QhRRRRRR/# )r,   servicer:   r   r-   
str | Noner   r.   r/   r   r0   r1   }   s!      C 3 : r   c                    R# )z,Get password of the username for the serviceNr   r   r?   r      &&&r   get_passwordZKeyringBackend.get_password|   s     r   c               r4   )r,   r   r:   r-   Noner   r.   r/   r   r0   r1      s     	 	3 	4 	r   c                sT    V'       g    \         P                  ! R\        ^R7       R# R# )z#
Ensure the username is not empty.
z(Empty usernames are deprecated. See #668)Z
stacklevelN)warningsZwarnZDeprecationWarning)r   r      &&r   r   Z!KeyringBackend._validate_username   s!     MM:" r   c               s(    V ^8  d   QhRRRRRRRR/# )r,   r?   r:   r   passwordr-   rE   r   r.   r/   r   r0   r1      s(     0 0C 03 0# 0$ 0r   c                .    \         P                  ! R4      h)znSet password for the username of the service.

If the backend cannot store passwords, raise
PasswordSetError.
reason)r   ZPasswordSetErrorr   r?   r   rH   s   &&&&r   r   ZKeyringBackend.set_password   s     %%h//r   c               r>   )r,   r?   r:   r   r-   rE   r   r.   r/   r   r0   r1      s!     3 3s 3c 3d 3r   c                rI   )zyDelete the password for the username of the service.

If the backend cannot delete passwords, raise
PasswordDeleteError.
rJ   )r   ZPasswordDeleteErrorrB   rC   r   delete_passwordZKeyringBackend.delete_password   s     ((22r   c               s$    V ^8  d   QhRRRRRR/# )r,   r?   r:   r   r@   r-   zcredentials.Credential | Noner   r.   r/   r   r0   r1      s(        
'	r   c                sd    Ve,   V P                  W4      pVe   \        P                  ! W#4      # R# )zGets the username and password for the service.
Returns a Credential instance.

The *username* argument is optional and may be omitted by
the caller or ignored by the backend. Callers must use the
returned username.
N)rD   r   ZSimpleCredentialrK   s   &&& r   get_credentialZKeyringBackend.get_credential   s4     ((;H#"33HGGr   c               r+   r,   r-   rE   r   r.   r/   r   r0   r1      s     
' 
' 
'r   c                s    R R lp\        R\        V\        P                  P	                  4       4      4      pV F  w  r4\        WV4       K  	  R# )z6For all KEYRING_PROPERTY_* env var, set that property.c               r+   )r,   itemztuple[str, str]r   r.   r/   r   r0   Z<KeyringBackend.set_properties_from_env.<locals>.__annotate__   s     	1 	1 	1r   c                sj    V w  rVP                  R 4      w  r4pT;'       d    VP                  4       V3# )ZKEYRING_PROPERTY_)Z	partitionZlower)rO   ZkeyvalueZprer<   r   s   &     r   parseZ5KeyringBackend.set_properties_from_env.<locals>.parse   s5    JC ]]+>?NCd00DJJL%00r   N)r5   ZmaposZenvironZitemsZsetattr)r   rQ   Zpropsr   rP   s   &    r   r(   Z&KeyringBackend.set_properties_from_env   s?    	1
 *0c%AQAQAS6T)U KDD& !r   c               r4   )r,   r   
typing.Anyr-   r'   r   r.   r/   r   r0   r1      s      
 ~ r   c                	sf    \         P                   ! V 4      p\        V4      P                  V4       V# r   )copyZvarsZupdate)r   r   Zalts   &, r   with_propertiesZKeyringBackend.with_properties   s&    iioS	 
r   r   N)r    r!   r"   r#   r$   r   r   Zclasspropertyr   r   Zpassesr3   Zclassmethodr8   r   r=   abcabstractmethodrD   r   r   rL   rM   r(   rU   r%   r   r   r   r'   r'   A   s    ' " "$ _##F   C C 	2 	2m 	 	 	0 03&
' r   r'   )Z	metaclassc                  sb    ] tR t^tRt]P                  R 4       t]P                  R 4       tRt	R# )Crypterz.Base class providing encryption and decryptionc                rA   )zEncrypt the value.Nr   r   rP   rG   r   encryptZCrypter.encrypt        	r   c                rA   )zDecrypt the value.Nr   rY   rG   r   decryptZCrypter.decrypt   r[   r   r   N)
r    r!   r"   r#   r$   rV   rW   rZ   r\   r%   r   r   r   rX   rX      s7    8  	 r   rX   c                  s&    ] tR t^tRtR tR tRtR# )NullCrypterzA crypter that does nothingc                	    V# r   r   rY   rG   r   rZ   ZNullCrypter.encrypt       r   c                	r^   r   r   rY   rG   r   r\   ZNullCrypter.decrypt   r_   r   r   N)r    r!   r"   r#   r$   rZ   r\   r%   r   r   r   r]   r]      s    %r   r]   c               r+   rN   r   r.   r/   r   r0   r0      s     > >t >r   c                 s.   \         P                  ! RR7       FN  p  \        P                  RV P                  4       V P                  4       p\        V4      '       d
   V! 4        KN  KP  	  R#   \         d    \        P                  RT  R24        K{  i ; i)a  
Locate all setuptools entry points by the name 'keyring backends'
and initialize them.
Any third-party library may register an entry point by adding the
following to their setup.cfg::

    [options.entry_points]
    keyring.backends =
        plugin_name = mylib.mymodule:initialize_func

`plugin_name` can be anything, and is only used to display the name
of the plugin at initialization time.

`initialize_func` is optional, but will be invoked if callable.
zkeyring.backends)Zgroupz
Loading %szError initializing plugin r;   N)	r   Zentry_pointslogZdebugr   ZloadZcallableZ	ExceptionZ	exception)ZepZ	init_func     r   _load_pluginsrb      sx      ##*<=	>IIlBGG,	I	"" #	 >  	>MM6rd!<=	>s   AA,,$BBc               r+   )r,   r-   zlist[KeyringBackend]r   r.   r/   r   r0   r0      s      - r   c                 s    \        4        \        P                  4       p \        P                  ! V \
        R7      p\        V4      # )zW
Return a list of all implemented keyrings that can be constructed without
parameters.
)Z
exceptions)rb   r'   r8   r   Zsuppress_exceptionsZ	TypeErrorZlist)Zviable_classesZringsra   r   get_all_keyringrc      s3     O#779N$$^	JE;r   c                  sb    ] tR tRtRtRt]! ]! RRR7      ]! RRR7      R	7      tRR R lltRt	R
# )SchemeSelectablei  a  
Allow a backend to select different "schemes" for the
username and service.

>>> backend = SchemeSelectable()
>>> backend._query('contoso', 'alice')
{'username': 'alice', 'service': 'contoso'}
>>> backend._query('contoso')
{'service': 'contoso'}
>>> backend.scheme = 'KeePassXC'
>>> backend._query('contoso', 'alice')
{'UserName': 'alice', 'Title': 'contoso'}
>>> backend._query('contoso', 'alice', foo='bar')
{'UserName': 'alice', 'Title': 'contoso', 'foo': 'bar'}
defaultr   r?   )r   r?   ZUserNameZTitle)re   Z	KeePassXCNc               s(    V ^8  d   QhRRRRRRRR/# )	r,   r?   r:   r   r@   baserS   r-   zdict[str, str]r   r.   r/   r   r0   ZSchemeSelectable.__annotate__  s,     
 

&0
AK
	
r   c                	s    V P                   V P                  ,          p\        Ve   VR,          VVR,          V/M
VR,          V/3/ VB # )Nr   r?   )schemesschemer   )r   r?   r   rf   rh   s   &&&, r   _queryZSchemeSelectable._query  sa     dkk*
 # z"Hy!7 y!7

 

 
	
r   r   r   )
r    r!   r"   r#   r$   rh   r   rg   ri   r%   r   r   r   rd   rd     s6      Fj)<
G<G

 
r   rd   )'__conditional_annotations__r$   Z
__future__r    rV   rT   r   Zloggingr6   rR   ZtypingrF   Zjaraco.contextr   Zjaraco.functoolsr   Z r   r   r   Zcompatr   Zcompat.py312r   Z	getLoggerr    r`   r7   Zby_priorityr	   Z__annotations__ZABCMetar
   r'   rX   r]   rb   rc   rd   )rj   r&   r   <module>rk      s    # 
     	   ( ! ' '  "! !!*-9=6 = #  #FE1 EP ' >4  %
 %
r   