o
    q>eb(                     @   sN  d dl Z d dlZd dlZd dlZd dlZejr)d dlZG dd dej	Z
edZdZedejZedejZdddZG dd deZG dd dejZedeeZdedejej dejejgef d
efddZG dd dZzddl m!Z! ddl m"Z" ddl m#Z# W dS  e$y   ddl%m!Z! ddl%m"Z" ddl%m#Z# Y dS w )    Nc                   @   s   e Zd ZdefddZdS )HasHTMLreturnc                 C   s   d S N selfr   r   T/var/www/bmteknikk.ddns.net/venv/lib/python3.10/site-packages/markupsafe/__init__.py__html__      zHasHTML.__html__N)__name__
__module____qualname__strr	   r   r   r   r   r   
   s    r   _Pz2.1.3z
<!--.*?-->z<.*?>funct.Callable[_P, str]r   t.Callable[_P, Markup]c                    s   t  d
 fdd	}|S )Nr   Markupargs_P.argskwargs	_P.kwargsr   c                    sD   t t|t|| j}t || | j |  | g|R i |S r   )_escape_argspeclist	enumerateescapeitems	__class__)r   r   r   arg_listr   r   r   wrapped   s   z)_simple_escaping_wrapper.<locals>.wrapped)r   r   r   r   r   r   r   r   )	functoolswraps)r   r    r   r   r   _simple_escaping_wrapper   s   r#   c                	       s  e Zd ZdZdZ	dCdejdeje ded	d
f fddZ	dDddZ
dejedf d	d
f fddZdejedf d	d
fddZdE fddZeZdejd	d
f fddZd	ef fddZdejejedf  d	d
f fdd Zejje_	!dFd"eje d#ed	ejd
 f fd$d%Zejje_	!dFd"eje d#ed	ejd
 f fd&d'Zejje_	(dGd)ed	ejd
 f fd*d+Zejje_d	efd,d-Zd	efd.d/Zed0ejd	d
fd1d2ZeejZeej Z eej!Z!eej"Z"eej#Z#eej$Z$eej%Z%eej&Z&eej'Z'eej(Z(eej)Z)eej*Z*eej+Z+eej,Z,eej-Z-eej.Z.eej/Z/e0j1d3kr>eej2Z2eej3Z3d"ed	ej4d4 f fd5d6Z5d"ed	ej4d4 f fd7d8Z6d9ejd:ejd	d
fd;d<Z7d=ej8eejf d	d
fd>d?Z9d@ed	d
fdAdBZ:  Z;S )Hr   a  A string that is ready to be safely inserted into an HTML or XML
    document, either because it was escaped or because it was marked
    safe.

    Passing an object to the constructor converts it to text and wraps
    it to mark it safe without escaping. To escape the text, use the
    :meth:`escape` class method instead.

    >>> Markup("Hello, <em>World</em>!")
    Markup('Hello, <em>World</em>!')
    >>> Markup(42)
    Markup('42')
    >>> Markup.escape("Hello, <em>World</em>!")
    Markup('Hello &lt;em&gt;World&lt;/em&gt;!')

    This implements the ``__html__()`` interface that some frameworks
    use. Passing an object that implements ``__html__()`` will wrap the
    output of that method, marking it safe.

    >>> class Foo:
    ...     def __html__(self):
    ...         return '<a href="/foo">foo</a>'
    ...
    >>> Markup(Foo())
    Markup('<a href="/foo">foo</a>')

    This is a subclass of :class:`str`. It has the same methods, but
    escapes their arguments and returns a ``Markup`` instance.

    >>> Markup("<em>%s</em>") % ("foo & bar",)
    Markup('<em>foo &amp; bar</em>')
    >>> Markup("<em>Hello</em> ") + "<foo>"
    Markup('<em>Hello</em> &lt;foo&gt;')
    r    Nstrictbaseencodingerrorsr   te.Selfc                    s:   t |dr	| }|d u rt | |S t | |||S Nr	   )hasattrr	   super__new__)clsr&   r'   r(   r   r   r   r-   G   s
   
zMarkup.__new__c                 C   s   | S r   r   r   r   r   r   r	   R   r
   zMarkup.__html__otherr   c                    s0   t |ts
t|dr| t | |S tS r*   )
isinstancer   r+   r   r,   __add__r   NotImplementedr   r0   r/   r   r   r2   U   s   zMarkup.__add__c                 C   s(   t |ts
t|dr| || S tS r*   )r1   r   r+   r   r2   r3   r4   r   r   r   __radd__[   s   zMarkup.__radd__numte.SupportsIndexc                    s    t |tr| t |S tS r   )r1   intr   r,   __mul__r3   )r   r6   r/   r   r   r9   a   s   
zMarkup.__mul__argc                    sh   t |trt fdd|D }ntt|dr$t |ts$t| j}nt| jf} t 	|S )Nc                 3   s    | ]	}t | jV  qd S r   )_MarkupEscapeHelperr   ).0xr   r   r   	<genexpr>l   s    z!Markup.__mod__.<locals>.<genexpr>__getitem__)
r1   tupler+   typer   r;   r   r   r,   __mod__)r   r:   r/   r   r   rB   i   s   
zMarkup.__mod__c                    s   | j j dt   dS )N())r   r   r,   __repr__r   r/   r   r   rE   v      zMarkup.__repr__seqc                    s   |  t t| j|S r   )r   r,   joinmapr   )r   rG   r/   r   r   rH   y   rF   zMarkup.joinsepmaxsplitc                        fddt  ||D S )Nc                       g | ]}  |qS r   r/   r<   vr   r   r   
<listcomp>       z Markup.split.<locals>.<listcomp>)r,   splitr   rK   rL   r/   r   r   rS   ~      zMarkup.splitc                    rM   )Nc                    rN   r   r/   rO   r   r   r   rQ      rR   z!Markup.rsplit.<locals>.<listcomp>)r,   rsplitrT   r/   r   r   rV      rU   zMarkup.rsplitFkeependsc                    s    fddt  |D S )Nc                    rN   r   r/   rO   r   r   r   rQ      rR   z%Markup.splitlines.<locals>.<listcomp>)r,   
splitlines)r   rW   r/   r   r   rX      s   zMarkup.splitlinesc                 C   s   ddl m} |t| S )u   Convert escaped markup back into a text string. This replaces
        HTML entities with the characters they represent.

        >>> Markup("Main &raquo; <em>About</em>").unescape()
        'Main » <em>About</em>'
        r   )unescape)htmlrY   r   )r   rY   r   r   r   rY      s   zMarkup.unescapec                 C   s4   t d| }td|}d| }| | S )u   :meth:`unescape` the markup, remove tags, and normalize
        whitespace to single spaces.

        >>> Markup("Main &raquo;	<em>About</em>").striptags()
        'Main » About'
        r$    )_strip_comments_resub_strip_tags_rerH   rS   r   rY   )r   valuer   r   r   	striptags   s   zMarkup.striptagssc                 C   s   t |}|j| ur| |S |S )ztEscape a string. Calls :func:`escape` and ensures that for
        subclasses the correct type is returned.
        )r   r   )r.   ra   rvr   r   r   r      s   
zMarkup.escape)   	   )r)   r)   r)   c                    4   t  | |\}}}| j}||||||fS r   )r,   	partitionr   r   r   rK   lra   rr.   r/   r   r   rf         zMarkup.partitionc                    re   r   )r,   
rpartitionr   r   rg   r/   r   r   rk      rj   zMarkup.rpartitionr   r   c                 O   s   t | j}| || ||S r   EscapeFormatterr   r   vformat)r   r   r   	formatterr   r   r   format   s   
zMarkup.formatrI   c                 C   s   t | j}| || d|S )Nr   rl   )r   rI   ro   r   r   r   
format_map   s   
zMarkup.format_mapformat_specc                 C   s   |rt d| S )Nz,Unsupported format specification for Markup.)
ValueError)r   rr   r   r   r   __html_format__   s   zMarkup.__html_format__)r$   Nr%   )r   r)   )r6   r7   r   r)   )NrJ   )F)<r   r   r   __doc__	__slots__tAnyOptionalr   r-   r	   Unionr2   r5   r9   __rmul__rB   rE   IterablerH   r8   ListrS   rV   boolrX   rY   r`   classmethodr   r#   r?   
capitalizetitlelowerupperreplaceljustrjustlstriprstripcenterstrip	translate
expandtabsswapcasezfillcasefoldsysversion_inforemoveprefixremovesuffixTuplerf   rk   rp   Mappingrq   rt   __classcell__r   r   r/   r   r   !   s    #
 &























r   c                       sP   e Zd ZdZdejejgef ddf fddZdejde	de	fd	d
Z
  ZS )rm   r   r   r   Nc                    s   || _ t   d S r   )r   r,   __init__)r   r   r/   r   r   r      s   zEscapeFormatter.__init__r_   rr   c                 C   sj   t |dr||}n#t |dr$|rtd| dt| d| }n
tj| |t|}t| 	|S )Nrt   r	   zFormat specifier z given, but z{ does not define __html_format__. A class that defines __html__ must define __html_format__ to work with format specifiers.)
r+   rt   rs   rA   r	   string	Formatterformat_fieldr   r   )r   r_   rr   rb   r   r   r   r      s   


zEscapeFormatter.format_field)r   r   r   rv   rw   Callablerx   r   r   r   r   r   r   r   r/   r   rm      s    $ rm   _ListOrDictobjiterabler   c                 C   s2   |D ]\}}t |tst|dr||| |< q| S )z,Helper for various string-wrapped functions.r	   )r1   r   r+   )r   r   r   keyr_   r   r   r   r     s
   r   c                   @   s   e Zd ZdZdZdejdejejgef ddfddZ	d	ejdd
fddZ
defddZdefddZdefddZdefddZdS )r;   z"Helper for :meth:`Markup.__mod__`.r   r   r   r   r   Nc                 C   s   || _ || _d S r   r   )r   r   r   r   r   r   r     s   
z_MarkupEscapeHelper.__init__itemr)   c                 C   s   |  | j| | jS r   )r   r   r   )r   r   r   r   r   r?        z_MarkupEscapeHelper.__getitem__c                 C   s   t | | jS r   )r   r   r   r   r   r   r   __str__  s   z_MarkupEscapeHelper.__str__c                 C   s   t | t| jS r   )r   r   reprr   r   r   r   r   rE     r   z_MarkupEscapeHelper.__repr__c                 C   
   t | jS r   )r8   r   r   r   r   r   __int__!     
z_MarkupEscapeHelper.__int__c                 C   r   r   )floatr   r   r   r   r   	__float__$  r   z_MarkupEscapeHelper.__float__)r   r   r   ru   rv   rw   rx   r   r   r   r?   r   r   rE   r8   r   r   r   r   r   r   r   r;     s    &r;      r   )escape_silent)soft_str)r   r   r   r   )&r!   rer   r   typingrw   TYPE_CHECKINGtyping_extensionsteProtocolr   	ParamSpecr   __version__compileDOTALLr\   r^   r#   r   r   r   rm   TypeVarr   dictr   r|   rx   r   r   r;   	_speedupsr   r   r   ImportError_nativer   r   r   r   <module>   sH    


 H

