�
u��g3 � � � d dl mZ d dlZ d dlmZ n# e$ r d dlmZ Y nw xY wd dlZd dlm Z G d� de� � Z
G d� de� � ZdS ) � ��wrapsN)�MutableMapping)�Lockc �` � � e Zd ZdZd� fd� Zd� Zd� Zd� Zd� Zd� Z d � Z
d
� Zd� Zd� Z
d
� Z� xZS )�_ExpiringMapping�_index_Nc � �� t t | � � j |i |�� |�|ni | _ || _ || _ |�t
� � n|| _ dS )a] Items in this mapping can have individual shelf life,
just like food items in your refrigerator have their different shelf life
determined by each food, not by the refrigerator.
Expired items will be automatically evicted.
The clean-up will be done at each time when adding a new item,
or when looping or counting the entire mapping.
(This is better than being done indecisively by a background thread,
which might not always happen before your accessing the mapping.)
This implementation uses no dependency other than Python standard library.
:param MutableMapping mapping:
A dict-like key-value mapping, which needs to support __setitem__(),
__getitem__(), __delitem__(), get(), pop().
The default mapping is an in-memory dict.
You could potentially supply a file-based dict-like object, too.
This implementation deliberately avoid mapping.__iter__(),
which could be slow on a file-based mapping.
:param int capacity:
How many items this mapping will hold.
When you attempt to add new item into a full mapping,
it will automatically delete the item that is expiring soonest.
The default value is None, which means there is no capacity limit.
:param int expires_in:
How many seconds an item would expire and be purged from this mapping.
Also known as time-to-live (TTL).
You can also use :func:`~set()` to provide per-item expires_in value.
:param Lock lock:
A locking mechanism with context manager interface.
If no lock is provided, a threading.Lock will be used.
But you may want to supply a different lock,
if your customized mapping is being shared differently.
N)�superr �__init__�_mapping� _capacity�_expires_inr �_lock)�self�mapping�capacity�
expires_in�lock�args�kwargs� __class__s ��e/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/msal/individual_cache.pyr z_ExpiringMapping.__init__ s_ �� �T /����%�%�.��?��?�?�?�#*�#6���B��
�!���%���#�|�T�V�V�V���
�
�
� c �v � || j k r-t d� || j j � � � � �d S )Nz"key {} is a reserved keyword in {})�_INDEX�
ValueError�formatr �__name__)r �keys r �
_validate_keyz_ExpiringMapping._validate_key>