+
    Z8im#                      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                  8   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                	h   < \         SV `  WV4       V P                  4        V P                  4        R # N)super__init__	_register"_validate_username_in_set_password)clsnamebasesdict	__class__s   &&&&/lib/python3.14/site-packages/keyring/backend.pyr   KeyringBackendMeta.__init__'   s'    d+..0    c                	    \        V R 4      '       g   \        4       V n        V P                  pV P                  '       g   VP	                  V 4       R# R# )_classesN)hasattrsetr   __abstractmethods__add)r   classess   & r   r   KeyringBackendMeta._register,   s>    sJ''5CL,,&&&KK 'r   c                j   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                @   < V P                  V4       S! WV.VO5/ VB # r   )_validate_username)selfsystemusernameargskwargsorigs   &&&*,r   wrapperFKeyringBackendMeta._validate_username_in_set_password.<locals>.wrapper9   s(    ##H-h@@@@r   N)set_password	functoolswraps)r   r-   r,   s   & @r   r   5KeyringBackendMeta._validate_username_in_set_password3   s5     			A 
	A #r    )
__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes____classcell__)r   s   @r   r   r      s    1
# #r   r   c                  v   ] 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                	&    V P                  4        R # r   )set_properties_from_envr'   s   &r   r   KeyringBackend.__init__F   s    $$&r   c                   V ^8  d   QhRR/# )   returnfloatr3   )formats   "r   __annotate__KeyringBackend.__annotate__J   s     " "% "r   c                    \         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.
)NotImplementedErrorr?   s   &r   r
   KeyringBackend.priorityI   s
      "!r   c                	    V P                    R # r   )r
   r   s   &r   viableKeyringBackend.viable^   s     	r   c                    V ^8  d   QhRRRR/# )rB   r   ztype[KeyringBackend]rC   zfilter[type[KeyringBackend]]r3   )rE   s   "r   rF   rG   d   s      C C!C	%Cr   c                V    \        \        P                  ! R4      V P                  4      # )z&
Return all subclasses deemed viable.
rM   )filteroperator
attrgetterr   rL   s   &r   get_viable_backends"KeyringBackend.get_viable_backendsc   s      h))(3S\\BBr   c                   V ^8  d   QhRR/# rB   rC   strr3   )rE   s   "r   rF   rG   m   s     	2 	2S 	2r   c                    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.
._ )r5   
rpartitionreplacejoinr4   )r   parentsepmod_names   &   r   r   KeyringBackend.namel   sE     !$ 9 9# >X##C-xx<<011r   c                   V ^8  d   QhRR/# rW   r3   )rE   s   "r   rF   rG   x   s     m m mr   c                	l    \        V 4      pVP                   R VP                   RVP                  R R2# )rZ   z (priority: g))typer5   r4   r
   )r'   keyring_classs   & r   __str__KeyringBackend.__str__x   s>    T
**+1]-C-C,DLQ^QgQghiPjjkllr   c               $    V ^8  d   QhRRRRRR/# )rB   servicerX   r)   rC   
str | Noner3   )rE   s   "r   rF   rG   }   s!      C 3 : r   c                    R# )z,Get password of the username for the serviceNr3   r'   rm   r)   s   &&&r   get_passwordKeyringBackend.get_password|   s     r   c                    V ^8  d   QhRRRR/# )rB   r)   rX   rC   Noner3   )rE   s   "r   rF   rG      s     	 	3 	4 	r   c                T    V'       g    \         P                  ! R\        ^R7       R# R# )z#
Ensure the username is not empty.
z(Empty usernames are deprecated. See #668)
stacklevelN)warningswarnDeprecationWarning)r'   r)   s   &&r   r&   !KeyringBackend._validate_username   s!     MM:" r   c               (    V ^8  d   QhRRRRRRRR/# )rB   rm   rX   r)   passwordrC   rt   r3   )rE   s   "r   rF   rG      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   PasswordSetErrorr'   rm   r)   r|   s   &&&&r   r/   KeyringBackend.set_password   s     %%h//r   c               $    V ^8  d   QhRRRRRR/# )rB   rm   rX   r)   rC   rt   r3   )rE   s   "r   rF   rG      s!     3 3s 3c 3d 3r   c                .    \         P                  ! R4      h)zyDelete the password for the username of the service.

If the backend cannot delete passwords, raise
PasswordDeleteError.
r~   )r   PasswordDeleteErrorrp   s   &&&r   delete_passwordKeyringBackend.delete_password   s     ((22r   c               $    V ^8  d   QhRRRRRR/# )rB   rm   rX   r)   rn   rC   zcredentials.Credential | Noner3   )rE   s   "r   rF   rG      s(        
'	r   c                d    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)rq   r   SimpleCredentialr   s   &&& r   get_credentialKeyringBackend.get_credential   s4     ((;H#"33HGGr   c                   V ^8  d   QhRR/# rB   rC   rt   r3   )rE   s   "r   rF   rG      s     
' 
' 
'r   c                    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                   V ^8  d   QhRR/# )rB   itemztuple[str, str]r3   )rE   s   "r   rF   <KeyringBackend.set_properties_from_env.<locals>.__annotate__   s     	1 	1 	1r   c                j    V w  rVP                  R 4      w  r4pT;'       d    VP                  4       V3# )KEYRING_PROPERTY_)	partitionlower)r   keyvalueprera   r   s   &     r   parse5KeyringBackend.set_properties_from_env.<locals>.parse   s5    JC ]]+>?NCd00DJJL%00r   N)rQ   maposenvironitemssetattr)r'   r   propsr   r   s   &    r   r>   &KeyringBackend.set_properties_from_env   s?    	1
 *0c%AQAQAS6T)U KDD& !r   c                    V ^8  d   QhRRRR/# )rB   r+   
typing.AnyrC   r<   r3   )rE   s   "r   rF   rG      s      
 ~ r   c                	f    \         P                   ! V 4      p\        V4      P                  V4       V# r   )copyvarsupdate)r'   r+   alts   &, r   with_propertiesKeyringBackend.with_properties   s&    iioS	 
r   r3   N)r4   r5   r6   r7   r8   r   r   classpropertyr
   r   passesrM   classmethodrT   r   rj   abcabstractmethodrq   r&   r/   r   r   r>   r   r9   r3   r   r   r<   r<   A   s    ' " "$ _##F   C C 	2 	2m 	 	 	0 03&
' r   r<   )	metaclassc                  b    ] tR t^tRt]P                  R 4       t]P                  R 4       tRt	R# )Crypterz.Base class providing encryption and decryptionc                    R# )zEncrypt the value.Nr3   r'   r   s   &&r   encryptCrypter.encrypt        	r   c                    R# )zDecrypt the value.Nr3   r   s   &&r   decryptCrypter.decrypt   r   r   r3   N)
r4   r5   r6   r7   r8   r   r   r   r   r9   r3   r   r   r   r      s7    8  	 r   r   c                  &    ] tR t^tRtR tR tRtR# )NullCrypterzA crypter that does nothingc                	    V# r   r3   r   s   &&r   r   NullCrypter.encrypt       r   c                	    V# r   r3   r   s   &&r   r   NullCrypter.decrypt   r   r   r3   N)r4   r5   r6   r7   r8   r   r   r9   r3   r   r   r   r      s    %r   r   c                   V ^8  d   QhRR/# r   r3   )rE   s   "r   rF   rF      s     > >t >r   c                 .   \         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)groupz
Loading %szError initializing plugin rZ   N)	r	   entry_pointslogdebugr   loadcallable	Exception	exception)ep	init_funcs     r   _load_pluginsr      sx      ##*<=	>IIlBGG,	I	"" #	 >  	>MM6rd!<=	>s   AA,,$BBc                   V ^8  d   QhRR/# )rB   rC   zlist[KeyringBackend]r3   )rE   s   "r   rF   rF      s      - r   c                     \        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.
)
exceptions)r   r<   rT   r   suppress_exceptions	TypeErrorlist)viable_classesringss     r   get_all_keyringr      s3     O#779N$$^	JE;r   c                  b    ] 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)   rm   )r)   rm   UserNameTitle)r   	KeePassXCNc               (    V ^8  d   QhRRRRRRRR/# )	rB   rm   rX   r)   rn   baser   rC   zdict[str, str]r3   )rE   s   "r   rF   SchemeSelectable.__annotate__  s,     
 

&0
AK
	
r   c                	    V P                   V P                  ,          p\        Ve   VR,          VVR,          V/M
VR,          V/3/ VB # )Nr)   rm   )schemesschemer   )r'   rm   r)   r   r   s   &&&, r   _querySchemeSelectable._query  sa     dkk*
 # z"Hy!7 y!7

 

 
	
r   r3   r   )
r4   r5   r6   r7   r8   r   r   r   r   r9   r3   r   r   r   r     s6      Fj)<
G<G

 
r   r   )'__conditional_annotations__r8   
__future__r   r   r   r0   loggingrR   r   typingrw   jaraco.contextr   jaraco.functoolsr    r   r   r   compatr   compat.py312r	   	getLoggerr4   r   rS   by_priorityr   __annotations__ABCMetar   r<   r   r   r   r   r   )r   s   @r   <module>r      s    # 
     	   ( ! ' '  "! !!*-9=6 = #  #FE1 EP ' >4  %
 %
r   