HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/html5lib/__pycache__/_utils.cpython-310.pyc
o

%we7�@sHddlmZmZmZddlmZzddlmZWney'ddl	mZYnwddl
mZmZer<ddl
mmZnzddlmmZWneyYddl
mmZYnwgd�Zzed�Zeee�ssed�Zeee�ssJ�Wneyd	ZYnwd
ZGdd�de�ZGd
d�de�Zdd�Zdd�Zdd�Zdd�ZdS)�)�absolute_import�division�unicode_literals)�
ModuleType)�Mapping)�	text_type�PY3N)�
default_etree�MethodDispatcher�isSurrogatePair�surrogatePairToCodepoint�moduleFactoryFactory�supports_lone_surrogatesz"\uD800"z	u"\uD800"FTc@s,eZdZdZd
dd�Zdd�Zddd	�ZdS)r
apDict with 2 special properties:

    On initiation, keys that are lists, sets or tuples are converted to
    multiple keys so accessing any one of the items in the original
    list-like object returns the matching value

    md = MethodDispatcher({("foo", "bar"):"baz"})
    md["foo"] == "baz"

    A default value which can be set through the default attribute.
    �cCsvg}|D]!\}}t|ttttf�r|D]	}|�||f�qq|�||f�qt�||�t|�t|�ks6J�d|_	dS�N)
�
isinstance�list�tuple�	frozenset�set�append�dict�__init__�len�default)�self�items�_dictEntries�name�value�itemrr�H/home/arjun/projects/env/lib/python3.10/site-packages/html5lib/_utils.pyr9s�
zMethodDispatcher.__init__cCst�|||j�Sr)r�getr�r�keyrrr!�__getitem__EszMethodDispatcher.__getitem__NcCs
t||�Sr)�BoundMethodDispatcher)r�instance�ownerrrr!�__get__H�
zMethodDispatcher.__get__)rr)�__name__�
__module__�__qualname__�__doc__rr%r)rrrr!r
,s

r
c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)r&zAWraps a MethodDispatcher, binding its return values to `instance`cCs||_||_dSr)r'�
dispatcher)rr'r/rrr!rNs
zBoundMethodDispatcher.__init__cCs|j|�|j�Sr)r/r)r'r#rrr!r%Rsz!BoundMethodDispatcher.__getitem__cCs||jvr	||S|Sr�r/)rr$rrrr!r"Ws
zBoundMethodDispatcher.getcC�
t|j�Sr)�iterr/�rrrr!�__iter__]r*zBoundMethodDispatcher.__iter__cCr1r)rr/r3rrr!�__len__`r*zBoundMethodDispatcher.__len__cCs
||jvSrr0r#rrr!�__contains__cr*z"BoundMethodDispatcher.__contains__N)
r+r,r-r.rr%r"r4r5r6rrrr!r&Lsr&cCsLt|�dko%t|d�dko%t|d�dko%t|d�dko%t|d�dkS)N�r��i�����i��)r�ord)�datarrr!rjs����rcCs,dt|d�ddt|d�d}|S)Nirr8ir9r:)r;)r<�char_valrrr!rps�rcsi���fdd�}|S)Ncs�ttjtd��rd|j}nd|j}t|���}z	�|||WStynt|�}�|g|�Ri|��}|j�|�d�vrFi�|<d�|vrRi�||<d�||vrbi�|||<|�|||<|YSw)N�z_%s_factorys_%s_factoryr�args�kwargs)	rrr+�typerr�KeyError�__dict__�update)�
baseModuler?r@r�kwargs_tuple�mod�objs��factory�moduleCacherr!�
moduleFactory|s&
�z+moduleFactoryFactory.<locals>.moduleFactoryr)rJrLrrIr!r
ysr
csi���fdd�}|S)Ncs6t|�t|���f}|�vr�|i|���|<�|Sr)rr)r?r@r$��cache�funcrr!�wrapped�szmemoize.<locals>.wrappedr)rOrPrrMr!�memoize�srQ) �
__future__rrr�typesr�collections.abcr�ImportError�collections�sixrr�xml.etree.ElementTree�etree�ElementTreer	�xml.etree.cElementTree�cElementTree�__all__�eval�_xr�	Exceptionrrr
r&rrr
rQrrrr!�<module>s@��
��