+
    ei\  c                   s    ^ RI t ^ RIt^ RIt^ RIt^ RIt ! R R4      t] P                  R 4       tR t]P                  ]P                  ,           t]3R ltR# )i    Nc                   sF   a  ] tR t^t o RtR tR	R ltR tR tR t	Rt
V tR# )
ImportKillerz@Context manager to make an import of a given name or names fail.c                s    Wn         R # Nnames)selfr   s   &*9/usr/lib/python3.14/site-packages/keyring/testing/util.py__init__ZImportKiller.__init__   s    
    Nc                s*    WP                   9   d   V # R # r   r   )r   fullnameZpaths   &&&r   find_moduleZImportKiller.find_module   s    zz!K "r   c                s    \        V4      hr   )ZImportError)r   r   s   &&r   load_moduleZImportKiller.load_module   s    (##r   c                s    / V n         V P                   F0  p\        P                  P	                  VR 4      V P                   V&   K2  	  \        P
                  P                  ^ V 4       R # r   )originalr   sysmodulesZpop	meta_pathZinsert)r   Znames   & r   	__enter__ZImportKiller.__enter__   sH    JJD"%++//$"=DMM$ Q%r   c                s    \         P                  P                  V 4       V P                  P	                  4        F  w  r#Vf   K  V\         P
                  V&   K   	  R # r   )r   r   Zremover   itemsr   )r   Zargskeyvalues   &*  r   __exit__ZImportKiller.__exit__   sA    T"----/JC #(C  0r   )r   r   r   )Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__r   r	   r
   r   r   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r    r       s&     F$&) )r   r    c              +  s   "   / pVP                  4        F,  w  r4V P                  V4      W#&   Vf   W09   d   W K&  K(  W@V&   K.  	  Rx  VP                  4        F  w  r4Vf   W09   d   W K  K  W@V&   K  	  R# 5i)zHelper context manager to make and unmake changes to a dict.

A None is not a valid value for the destination, and so means that the
associated name should be removed.N)r   Zget)Zdestinationchangesr   r   r   s   &,   r   NoNoneDictMutatorr   #   s      Hmmo
#,=!$ "  % & 
nn&
=!$ "  % 's   A6A8c                 s6    \        \        P                  3/ V B # )z6A context manager to temporarily change the os.environ)r   osZenviron)r   s   ,r   Environr   :   s    RZZ3733r   c                sL   a RP                  V3R l\        V 4       4       4      # )z-Generate a random string with length <i>k</i>Z c              3   sP   <"   T F  p\         P                  ! S4      x  K  	  R # 5ir   )randomZchoice)Z.0Z_unusedsources   & r   Z	<genexpr>Z random_string.<locals>.<genexpr>D   s     AW6==((s   #&)ZjoinZrange)Zkr   s   &fr   random_stringr   B   s    77AaAAAr   )Z
contextlibr   r   Zstringr   r    Zcontextmanagerr   r   Zascii_lettersZdigitsZALPHABETr   ) r   r   <module>r      s^     	   
) )6 % %,4
 &--/ % Br   