
    di4                         S SK r S SKrS SKJr  S SKJrJrJr  S SK	J
r
  SSKJr  SSKJrJr  SSKJr   " S	 S
\5      r " S S\5      r " S S\5      rg)    N)	timedelta)AnyOptionalProtocol)Flask   )total_seconds)ServerSideSessionServerSideSessionInterface)Defaultsc                   X    \ rS rSrS\S\\   4S jrS\S\S\S\	4S jr
S\S\	4S jrS	rg
)MemcacheClientProtocol   keyreturnc                     g N selfr   s     k/var/www/fortnox.synktek.com/backend/venv/lib/python3.13/site-packages/flask_session/memcached/memcached.pygetMemcacheClientProtocol.get   s    c    valuetimeoutc                     g r   r   )r   r   r   r   s       r   setMemcacheClientProtocol.set   s    sr   c                     g r   r   r   s     r   deleteMemcacheClientProtocol.delete   s    r   r   N)__name__
__module____qualname____firstlineno__strr   r   r   intboolr   r!   __static_attributes__r   r   r   r   r      s7    1s1x}1BsB3BBB+#+$+r   r   c                       \ rS rSrSrg)MemcachedSession   r   N)r#   r$   r%   r&   r*   r   r   r   r,   r,      s    r   r,   c                   V  ^  \ rS rSrSr\R                  r\rSr	\
R                  \
R                  \
R                  \
R                  \
R                  \
R                   4S\S\\   S\S\S\S	\S
\4U 4S jjjrS rS\S\4S jrS\S\\   4S jrS\SS4S jrS\S\S\SS4S jrSr U =r!$ )MemcachedSessionInterface   a  A Session interface that uses memcached as session storage. (`pylibmc`, `libmc`, `python-memcached` or `pymemcache` required)

:param client: A ``memcache.Client`` instance.
:param key_prefix: A prefix that is added to all storage keys.
:param use_signer: Whether to sign the session id cookie or not.
:param permanent: Whether to use permanent session or not.
:param sid_length: The length of the generated session id in bytes.
:param serialization_format: The serialization format to use for the session data.

.. versionadded:: 0.7
    The `serialization_format` and `app` parameters were added.

.. versionadded:: 0.6
    The `sid_length` parameter was added.

.. versionadded:: 0.2
    The `use_signer` parameter was added.
Tappclient
key_prefix
use_signer	permanent
sid_lengthserialization_formatc                    >^ Tb  [        U4S jS 5       5      (       d*  [        R                  " S[        SS9  U R	                  5       mTU l        [        TU ]  XXEXg5        g )Nc              3   <   >#    U  H  n[        TU5      v   M     g 7fr   )hasattr).0methodr2   s     r   	<genexpr>5MemcachedSessionInterface.__init__.<locals>.<genexpr>9   s      %
2JGFF##2Js   )r   r   r!   zsNo valid memcache.Client instance provided, attempting to create a new instance on localhost with default settings.   )
stacklevel)allwarningswarnRuntimeWarning_get_preferred_memcache_clientr2   super__init__)	r   r1   r2   r3   r4   r5   r6   r7   	__class__s	     `     r   rG   "MemcachedSessionInterface.__init__/   sh     > %
2J%
 "
 "
 MM F
 88:FZJ	
r   c                     SS/4SS/4SSS/4/nU H%  u  p# [        U5      nUR                  nU" U5      s  $    [        S5      e! [         a     MA  f = f)Npylibmc127.0.0.1:11211memcache)zpymemcache.client.baserL   libmczlocalhost:11211zNo memcache module found)
__import__ClientImportError)r   clientsmodule_nameservermoduleClientClasss         r   rE   8MemcachedSessionInterface._get_preferred_memcache_clientG   s    *+,+,-9()*	
 $+K#K0$mm"6**	 $+ 455  s   A
AAr   r   c                 T    US:  a!  U[        [        R                  " 5       5      -  nU$ )z~
Memcached deals with long (> 30 days) timeouts in a special
way. Call this function to obtain a safe value for your timeout.
i ' )r(   time)r   r   s     r   _get_memcache_timeout/MemcachedSessionInterface._get_memcache_timeoutY   s&    
 Ws499;''Gr   store_idc                 ~    U R                   R                  U5      nU(       a  U R                  R                  U5      $ g r   )r2   r   
serializerdecode)r   r\   serialized_session_datas      r   _retrieve_session_data0MemcachedSessionInterface._retrieve_session_datac   s1    "&++//(";"??))*ABBr   Nc                 :    U R                   R                  U5        g r   )r2   r!   )r   r\   s     r   _delete_session)MemcachedSessionInterface._delete_sessionj   s    8$r   session_lifetimesessionc                     [        U5      nU R                  R                  U5      nU R                  R	                  UUU R                  U5      5        g r   )r	   r^   encoder2   r   rZ   )r   rf   rg   r\   storage_time_to_liver`   s         r   _upsert_session)MemcachedSessionInterface._upsert_sessionm   sN      --=> #'//"8"8"A 	#&&';<	
r   )r2   )"r#   r$   r%   r&   __doc__r   r^   r,   session_classttlr   SESSION_MEMCACHEDSESSION_KEY_PREFIXSESSION_USE_SIGNERSESSION_PERMANENTSESSION_ID_LENGTHSESSION_SERIALIZATION_FORMATr   r   r   r'   r)   r(   rG   rE   rZ   dictra   rd   	TimeDeltar
   rk   r*   __classcell__)rH   s   @r   r/   r/      s   & ,66J$M
C
 4<3M3M"55#66"44"44$,$I$I

 /0
 	

 
 
 
 "
 
06$S S s x~ % % %
 )
4E
QT
	
 
r   r/   )rY   rB   datetimer   rw   typingr   r   r   flaskr   _utilsr	   baser
   r   defaultsr   r   r,   r/   r   r   r   <module>r      sH      + * *  " @ ,X ,	( 	c
 : c
r   