
    qh                     P    S r SSKJr  SSKrSSKr " S S\5      r " S S\5      rg)z,A simple store using only in-process memory.    )nonceNc                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
ServerAssocs	   c                     0 U l         g Nassocsselfs    G/var/www/html/env/lib/python3.13/site-packages/openid/store/memstore.py__init__ServerAssocs.__init__
   s	        c                 4    XR                   UR                  '   g r   )r
   handle)r   assocs     r   setServerAssocs.set   s    $)ELL!r   c                 8    U R                   R                  U5      $ r   )r
   getr   r   s     r   r   ServerAssocs.get   s    {{v&&r   c                 @     U R                   U	 g! [         a     gf = f)NTF)r
   KeyErrorr   s     r   removeServerAssocs.remove   s,    	F#   		s    
c                     Sn[        U R                  R                  5       5       H$  nUb  UR                  UR                  :  d  M"  UnM&     U$ )zXReturns association with the oldest issued date.

or None if there are no associations.
N)listr
   valuesissued)r   bestr   s      r   r"   ServerAssocs.best   sE    
 $++,,./E|t{{U\\9 0 r   c                     / nU R                   R                  5        H(  u  p#UR                  S:X  d  M  UR                  U5        M*     U H  nU R                   U	 M     [	        U5      [	        U R                   5      4$ )z_Remove expired associations.

@return: tuple of (removed associations, remaining associations)
r   )r
   items	expiresInappendlen)r   r   r   r   s       r   cleanupServerAssocs.cleanup&   sj    
 ![[..0MF!#f% 1 FF# 6{C,,,r   r	   N)__name__
__module____qualname____firstlineno__r   r   r   r   r"   r)   __static_attributes__ r   r   r   r   	   s     *'	-r   r   c                   X    \ rS rSrSrS rS rS rSS jrS r	S	 r
S
 rS rS rS rSrg)MemoryStore4   z[In-process memory store.

Use for single long-running processes.  No persistence supplied.
c                      0 U l         0 U l        g r   server_assocsnoncesr   s    r   r   MemoryStore.__init__:   s    r   c                 v     U R                   U   $ ! [         a    [        5       =o R                   U'   Us $ f = fr   )r6   r   r   )r   
server_urlr
   s      r   _getServerAssocsMemoryStore._getServerAssocs>   sA    	%%j11 	6BnDF''
3M	s    $88c                 p    U R                  U5      nUR                  [        R                  " U5      5        g r   )r;   r   copydeepcopy)r   r:   r   r
   s       r   storeAssociationMemoryStore.storeAssociationE   s'    &&z2

4=='(r   Nc                 l    U R                  U5      nUc  UR                  5       $ UR                  U5      $ r   )r;   r"   r   r   r:   r   r
   s       r   getAssociationMemoryStore.getAssociationI   s2    &&z2>;;= ::f%%r   c                 F    U R                  U5      nUR                  U5      $ r   )r;   r   rC   s       r   removeAssociationMemoryStore.removeAssociationP   s!    &&z2}}V$$r   c                     [        U[        R                  " 5       -
  5      [        R                  :  a  g[	        U5      [        U5      [	        U5      4nX@R                  ;   a  gS U R                  U'   g)NFT)abstimer   SKEWstrintr7   )r   r:   	timestampsaltanonces        r   useNonceMemoryStore.useNonceT   sW    y499;&'%**4j/3y>3t9=[[ "&DKKr   c                     [         R                   " 5       n/ nU R                  R                  5        H9  n[        US   U-
  5      [        R
                  :  d  M(  UR                  U5        M;     U H  nU R                  U	 M     [        U5      $ )N   )rK   r7   keysrJ   r   rL   r'   r(   )r   nowexpiredrQ   s       r   cleanupNoncesMemoryStore.cleanupNonces_   sp    iikkk&&(F6!9s?#ejj0v& )
 FF# 7|r   c                     / nSnU R                   R                  5        H5  u  p4UR                  5       u  pVX%-  nU(       a  M$  UR                  U5        M7     U H  nU R                   U	 M     U$ )Nr   )r6   r%   r)   r'   )r   remove_urlsremoved_assocsr:   r
   removed	remainings          r   cleanupAssociationsMemoryStore.cleanupAssociationsk   sr    "&"4"4":":"<J!'!1G%N9"":.	 #= &J"":. &r   c                 t    U R                   UR                   :H  =(       a    U R                  UR                  :H  $ r   r5   r   others     r   __eq__MemoryStore.__eq__y   s0    ##u':':: .,	/r   c                     X:X  + $ r   r0   rc   s     r   __ne__MemoryStore.__ne__}   s    ""r   )r7   r6   r   )r+   r,   r-   r.   __doc__r   r;   r@   rD   rG   rR   rY   r`   re   rh   r/   r0   r   r   r2   r2   4   s9    
)&%	
/#r   r2   )rj   openid.storer   r>   rK   objectr   r2   r0   r   r   <module>rm      s,    2   (-6 (-VJ#& J#r   