idb(.ddlZddlZddlZddlZddlZejr'ddlZGddej Z ej dZ dZ ejdejZejdejZdd ZGd deZGddejZejdeeZdedejejdejejgefd efdZGddZ ddl m!Z!ddl m"Z"ddl m#Z#dS#e$$rddl%m!Z!ddl%m"Z"ddl%m#Z#YdSwxYw)NceZdZdefdZdS)HasHTMLreturncdSNselfs H/opt/cloudlinux/venv/lib/python3.11/site-packages/markupsafe/__init__.py__html__zHasHTML.__html__ s DN)__name__ __module__ __qualname__strr rr r rr s/ c      r r_Pz2.1.3z z<.*?>funct.Callable[_P, str]rt.Callable[_P, Markup]cHtjd fd }|S) Nr Markupargs_P.argskwargs _P.kwargsrctt|t||j}t|||j||g|Ri|Sr)_escape_argspeclist enumerateescapeitems __class__)r rrarg_listrs r wrappedz)_simple_escaping_wrapper..wrappedsj"4::y LL  <<<~~dd4=(===f==>>>r )r rrrrrrr) functoolswraps)rr$s` r _simple_escaping_wrapperr's=_T?????? Nr c eZdZdZdZ d0dejdejeded d ffd Z d1d Z d ej edfd d ffd Z d ej edfd d fdZ d2fd ZeZdejd d ffd Zd effd Zdejej edfd d ffd Zejje_ d3dejeded ejd ffd Zejje_ d3dejeded ejd ffd Zejje_ d4ded ejd ffd Zejje_d efd!Zd efd"Zed#ejd d fd$ZeejZeej Z eej!Z!eej"Z"eej#Z#eej$Z$eej%Z%eej&Z&eej'Z'eej(Z(eej)Z)eej*Z*eej+Z+eej,Z,eej-Z-eej.Z.eej/Z/e0j1d%kr eej2Z2eej3Z3ded ej4d&ffd' Z5ded ej4d&ffd( Z6d)ejd*ejd d fd+Z7d,ej8eejfd d fd-Z9d.ed d fd/Z:xZ;S)5raA 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, World!") Markup('Hello, World!') >>> Markup(42) Markup('42') >>> Markup.escape("Hello, World!") Markup('Hello <em>World</em>!') 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 'foo' ... >>> Markup(Foo()) Markup('foo') This is a subclass of :class:`str`. It has the same methods, but escapes their arguments and returns a ``Markup`` instance. >>> Markup("%s") % ("foo & bar",) Markup('foo & bar') >>> Markup("Hello ") + "" Markup('Hello <foo>') rNstrictbaseencodingerrorsrte.Selfct|dr|}|"t||St||||SNr )hasattrr super__new__)clsr+r,r-r"s r r3zMarkup.__new__Gs^ 4 $ $ #==??D  77??3-- -wwsD(F;;;r c|Srrr s r r zMarkup.__html__Rs r otherrct|tst|drG|t ||StSr0) isinstancerr1r"r2__add__r NotImplemented)r r6r"s r r9zMarkup.__add__Us\ eS ! ! GWUJ%?%? G>>%''//$++e2D2D"E"EFF Fr ct|tst|dr(|||St Sr0)r8rr1r r9r:)r r6s r __radd__zMarkup.__radd__[sK eS ! ! 4WUJ%?%? 4;;u%%--d33 3r numte.SupportsIndexct|tr4|t|St Sr)r8intr"r2__mul__r:)r r=r"s r rAzMarkup.__mul__as= c3   8>>%''//#"6"677 7r argct|trtfd|D}n^tt|dr+t|tst |j}nt |jf}t |S)Nc3BK|]}t|jVdSr)_MarkupEscapeHelperr ).0xr s r z!Markup.__mod__..ls0II+At{;;IIIIIIr __getitem__) r8tupler1typerrEr r"r2__mod__)r rBr"s` r rLzMarkup.__mod__is c5 ! ! ;IIIISIIIIICC T#YY . . ;z#s7K7K ;%c4;77CC'sDK88:C~~eggooc22333r cd|jjdtdS)N())r"rr2__repr__)r r"s r rPzMarkup.__repr__vs/.)AAEGG,<,<,>,>AAAAr seqc|tt|j|Sr)r"r2joinmapr )r rQr"s r rSz Markup.joinys1~~eggll3t{C+@+@AABBBr sepmaxsplitcbfdt||DS)Nc:g|]}|Srr"rFvr s r z Markup.split..%HHHaq!!HHHr )r2splitr rVrWr"s` r r_z Markup.split~s3IHHH577==h+G+GHHHHr cbfdt||DS)Nc:g|]}|SrrZr[s r r]z!Markup.rsplit..s%IIIaq!!IIIr )r2rsplitr`s` r rcz Markup.rsplits3JIII577>>#x+H+HIIIIr Fkeependsc`fdt|DS)Nc:g|]}|SrrZr[s r r]z%Markup.splitlines..r^r )r2 splitlines)r rdr"s` r rgzMarkup.splitliness3IHHH577+=+=h+G+GHHHHr c>ddlm}|t|S)uConvert escaped markup back into a text string. This replaces HTML entities with the characters they represent. >>> Markup("Main » About").unescape() 'Main » About' r)unescape)htmlrir)r ris r rizMarkup.unescapes, "!!!!!xD """r c td|}td|}d|}||S)u:meth:`unescape` the markup, remove tags, and normalize whitespace to single spaces. >>> Markup("Main » About").striptags() 'Main » About' r) )_strip_comments_resub_strip_tags_rerSr_r"ri)r values r striptagszMarkup.striptagsse#&&r400""2u--''~~e$$--///r scLt|}|j|ur ||S|S)ztEscape a string. Calls :func:`escape` and ensures that for subclasses the correct type is returned. )r r")r4rrrvs r r z Markup.escapes. AYY >???r format_specc(|rtd|S)Nz,Unsupported format specification for Markup.) ValueError)r rs r __html_format__zMarkup.__html_format__s  MKLL L r )r)Nr*)rr.)r=r>rr.)NrU)F)#:;C CCCCCC8#DL<>II:c?I58I  IIIIII I%EM<>JJ:c?J58J  JJJJJJ Z'FN %III  IIIIII /J ## # # # # 03 0 0 0 0 qu    [ +*3?;;K))#.99J $ $SY / /E $ $SY / /E $ $SY / /E&&s{33G $ $SY / /E $ $SY / /E % %cj 1 1F % %cj 1 1F % %cj 1 1F $ $SY / /E((77I))#.99J'' 55H $ $SY / /E'' 55H 6!!//0@AA //0@AA &S&QW-L%M&&&&&& &c&ag.M&N&&&&&& EAEEQUEyEEEE@9S!%Z(@ @@@@ 39r rcpeZdZdZdejejgefddffd Zdejde de fdZ xZ S) rr r rNcV||_tdSr)r r2__init__)r r r"s r rzEscapeFormatter.__init__s&  r rprct|dr||}nxt|dr:|r#td|dt|d|}n.t j||t|}t| |S)Nrr zFormat specifier z given, but z{ does not define __html_format__. A class that defines __html__ must define __html_format__ to work with format specifiers.) r1rrrKr string Formatter format_fieldrr )r rprrts r rzEscapeFormatter.format_fields 5+ , , N&&{33BB UJ ' ' N  G GGeGGG !!BB!..tUC rsY ?"""""+ d  B RZ ry99Hbi00DDDDDSDDDN$$$$$f&$$$2ai tT22   ! 15 1;<:qugvo;V4.++++++999999////////...))))))777777---------.s%C99DD