Sindbad~EG File Manager
�
'ٜg�/ � � � d dl mZ d dlZd dlmZ d dlZd dlZddl m
Z
G d� de
eee
f � Z ej d� Zdd�Z G d � d
e� Z ej d� Zdd�Z G d
� de� Z G d� de� Zy)� )�annotationsN� )�
ImmutableListc �~ � � e Zd ZdZ d d� fd�
Zdd�Zdd�Zej dd�� Z ej dd�� Z ej dd�� Z dd�Z dd �Z
dd
�Zdd�Zd d�Z
d d
�Zd!d�Zdd�Zdd�Zd"d�Zej d#d�� Zej d$d%d�� Z d& d'd�Zed(d�� Z� xZS ))�Accepta� An :class:`Accept` object is just a list subclass for lists of
``(value, quality)`` tuples. It is automatically sorted by specificity
and quality.
All :class:`Accept` objects work similar to a list but provide extra
functionality for working with the data. Containment checks are
normalized to the rules of that header:
>>> a = CharsetAccept([('ISO-8859-1', 1), ('utf-8', 0.7)])
>>> a.best
'ISO-8859-1'
>>> 'iso-8859-1' in a
True
>>> 'UTF8' in a
True
>>> 'utf7' in a
False
To get the quality for an item you can use normal item lookup:
>>> print a['utf-8']
0.7
>>> a['utf7']
0
.. versionchanged:: 0.5
:class:`Accept` objects are forced immutable now.
.. versionchanged:: 1.0.0
:class:`Accept` internal values are no longer ordered
alphabetically for equal quality tags. Instead the initial
order is preserved.
c �� �� � |�t �� � � d� _ y t |t � r!|j � _ t �� � |� y d� _ t |� fd�d�� }t �� � |� y )NFTc �6 �� �j | d � | d fS )Nr r )�_specificity)�x�selfs ��I/usr/local/lib/python3.12/site-packages/werkzeug/datastructures/accept.py�<lambda>z!Accept.__init__.<locals>.<lambda>; s �� �t�'8�'8��1��'>��!��&E� )�key�reverse)�super�__init__�provided�
isinstancer �sorted)r �values� __class__s ` �r
r zAccept.__init__/ sf �� � �>��G���!�D�M�
���
'�"�O�O�D�M��G��V�$� �D�M���E�t��F�
�G��V�$r c � � |dk7 fS )z3Returns a tuple describing the value's specificity.�*� �r �values r
r
zAccept._specificity? s � �����r c �R � |dk( xs! |j � |j � k( S )z-Check if a value matches a given accept item.r )�lower�r r �items r
�_value_matcheszAccept._value_matchesC s"