L i0]ddlZddlmZddlmZGddeZdZejdejZ ejd ejZ ejd Z d Z y) N)_BaseHTMLProcessor)make_safe_absolute_uriceZdZhdZhdZhdZhdZhdZejdZ hdZ hdZ hd Z hd Zd Zd Zhd Zdfd ZfdZfdZfdZdZdZfdZdZdfd ZxZS)_HTMLSanitizer>d event-sourceabimpqsubrdddldtemh1h2h3h4h5h6hrlioltdthtrttulbigcoldeldfndirdivimginskbdmapnavpresubsupvarabbrareacitecodefontformmenusampspantimeasideaudioinputlabelmetersmallsoundtabletbodytfoottheadvideobuttoncanvascenterdialogfigurefooterheaderkeygenlegendnextidoptionoutputselectsourcespacerstrikestrongacronymaddressarticlecaptioncommanddetailssectioncolgroupdatagriddatalistfieldsetmulticolnoscriptoptgroupprogresstextarea blockquote figcaption> point-size repeat-max repeat-minaccept-charsetchidaltr(endforlowmaxminpqgrelrevsrcurnr3axischarr5colsdatafacer8highhreficonlanglistloopnameopenpingrowssizer;steptypevrmlwrapalignchoffclassclearcolordelayframeismapr@mediarulesscopeshapestartstyletitlevaluewidthacceptactionbordercoordsdynsrcgutterheighthiddenhspacelowsrcmethodnohrefnowrapposterprompttargetusemapvalignvolumevspacebalancebgcolorcharoffcharsetcheckedcolspancompactdataflddatasrcdefaultenctypeheaderskeytypeloopendnoshadeoptimumpatternpreloadreplacerowspansummarycontrolsdatetimedisabledhreflanglongdescmultiplereadonlyrequiredselectedsuppresstabindextemplatevariable accesskey autofocus challenge draggable hidefocus inputmode loopcount loopstart maxlength background galleryimg radiogroup toppadding bordercolor cellpadding cellspacing leftspacing autocomplete bgproperties datapagesize rightspacing unselectable bottompaddingbordercolordarkcontenteditablebordercolorlightxml:lang>rappletscript>. text-align line-height pause-after pitch-range speech-rate text-indent white-space border-color pause-before speak-header unicode-bidi voice-family speak-numeralletter-spacingvertical-alignborder-collapsetext-decorationbackground-colorborder-top-colorborder-left-colorspeak-punctuationborder-right-colorborder-bottom-colorr7rrfloatpausepitchspeakrcursorrstressrazimuthdisplayoverflowrichness direction elevation font-size font-style font-family font-weight font-variant>' !importantredtopaquaautoblueboldbothgrayleftlimenavynonetealblackblockbrowngreenoliverightsolidwhitebottomrKdasheddotteditalicmaroonmediumnormalrpurplesilveryellowfuchsiapointercollapse underline transparentz\^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$>,annotation-xmlmimnmomsmtdmtrmathmrowmsubmsupr)mfracmovermrootmsqrtmsrowmtextmerrormglyphmslinemspacemstackmstylemtablemundermactionmfencedmpaddedmscarrymsgroupmsubsupmenclosemlongdivmphantom mscarries semantics annotation malignmark mlabeledtr munderover maligngroup mprescripts mmultiscripts>c altimg-width altimg-height altimg-valignrqr(r{edger8rrsiderclosedepthfencerothershiftrxmlnsaccentaltimgrlengthlquotelspacerquoterspacealttextrlargeopmaxsizeminsizervoffsetbevelledcrossoutencodinglocationmathsizenotationnumalignrpositionrowalignrowlinesstretchy charalign equalrows fontstyle linebreak mathcolor selection separator symmetric actiontype columnspan denomalign fontweight groupalign rowspacing separators stackalign accentunder columnalign columnlines columnwidth indentalign indentshift lineleading mathvariant scriptlevel decimalpoint displaystyle equalcolumns framespacing indenttarget longdivstyle columnspacing linethickness movablelimits scriptminsizealignmentscopelinebreakstylemathbackgroundsubscriptshiftindentalignlastindentshiftlastminlabelspacingindentalignfirstindentshiftfirstsuperscriptshiftlinebreakmultcharinfixlinebreakstylescriptsizemultiplier xlink:href xlink:show xlink:type xmlns:xlink># font-face font-face-src missing-glyphfont-face-namer gsetsvgusedefsdesclinepathrectstoptextglyphhkernmpathrtspancirclemarkerswitchanimateellipsepolygonmetadatapolyline animateColor animateMotion foreignObjectlinearGradientradialGradientanimateTransform>panose-1x-heightxml:base xml:space cap-height glyph-name marker-end marker-mid stop-color xlink:role arabic-form horiz-adv-x text-anchor xlink:title font-stretch marker-start stop-opacity units-per-em accent-height unicode-range xlink:actuate xlink:arcrolehoriz-origin-xcolor-renderingstroke-dasharrayoverline-positionstroke-dashoffsetstroke-miterlimitoverline-thicknessunderline-positionunderline-thicknessstrikethrough-positionstrikethrough-thicknessdkrxybycxcydxdyfxfyg1g2rqrxrytou1u2x1x2y1y2durrsrvrwbboxfillfromrrrrefXrefYrbeginrrslopestemhstemvrrwascentroffsetorientoriginpointsrotatestrokervalueswidthscontentdescentrhangingopacityrestartunicodeversionviewBoxadditivecalcModekeyTimes keyPoints repeatDur transform accumulate alphabetic keySplines pathLength visibility zoomAndPan baseProfile ideographic markerUnits markerWidth repeatCount markerHeight mathematical attributeName attributeType gradientUnitssystemLanguagerequiredFeaturesrequiredExtensionspreserveAspectRatior fill-rulerrrrrrrr fill-opacityr stroke-widthstroke-linecapstroke-opacitystroke-linejoinN>rr,rQrRrSrTrUrVcXtt| ||d|_d|_d|_yNr)superr__init__unacceptablestackmathmlOKsvgOK)selfr_type __class__s Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/feedparser/sanitizer.pyrZz_HTMLSanitizer.__init__s* nd,Xu=!"  cTtt| d|_d|_d|_yrX)rYrresetr[r\r])r^r`s rardz_HTMLSanitizer.resets& nd)+!"  rbc|j}i}||jvs |jr4||jvr|xjdz c_|j j drFt|jds,|dk(r|jd|dk(r|jd|dk(rd|vr|xjdz c_ |dk(rd|vr|xjdz c_|jr||jvr|j}nL|jr0||jvr!|js|jDcgc]}|j!}}|jDcgc] }||vs| }}||_|Dcic]}|j!|c}|_|jDcgc]}|j!}}|jDcgc] }||vs| }}||_ |Dcic]}|j!|c}|_|j}|j"j||}|j}n||jvry|js |jr't%d|Drd |vr|jd g} |j'|D]p\} } | d k(r,d |vr(|j)| } | s#| j| | f7| |vs<|j| | } | d k(r t+| } | j| | frt,t.|c|| ycc}wcc}wcc}wcc}wcc}wcc}w) Nrhtmlrwr)rwzhttp://www.w3.org/2000/svgrI)rwz"http://www.w3.org/1998/Math/MathMLc3JK|]}|djds|yw)rzxlink:N) startswith).0r s ra z2_HTMLSanitizer.unknown_starttag..sB!!(AABs##)rzhttp://www.w3.org/1999/xlinkrr)acceptable_attributesacceptable_elementsr]"unacceptable_elements_with_end_tagr[r_endswithdictgetappendr\mathml_elementsmathml_attributes svg_elements svg_attr_mapsvg_attributeslower svg_elem_mapanynormalize_attrssanitize_stylerrYrunknown_starttag)r^tagattrsrkkeymapattrrwr mix clean_attrskeyr clean_valuer`s rar|z_HTMLSanitizer.unknown_starttags $ : : d.. .$**d===&&!+&zz""6*E{w/e| %LMf} %TUf}!PTY!Y " e| G5 P a }}(<((>%t'8'8 8((6:6I6IJdTZZ\JEJ&*&9&9LQe^1LCL*/D'?B(C!A(CD%6:6G6GHdTZZ\HEH&*&7&7J1E>1JCJ(-D%?B(C!A(CD%(,(;(;%''++C5**D444 ==DJJBuBCF%OLL!PQ ..u5 1JCg~'-B"B"11%8 &&['9:--jjc*&=259E""C<0 1 nd4S+FCKL(CHJ(Cs0 L90 L>:L> M9M M *M ;Mc||jvr||jvr|xjdzc_|jr5||jvr'|dk(r|jrt|xjdzc_n^|j rQ||j vrC|jj||}|dk(r#|j r|xj dzc_nytt|/|y)NrrIr) rlrmr[r\rrr]rtrxrprYrunknown_endtag)r^r}r`s rarz_HTMLSanitizer.unknown_endtag*s d.. .d===&&!+&}}(<(>sEJxx_afg 66-r5 9 ? ? A::&@%H 8KD%zz|t=== TD[50367C#))+/\\${{}]*>) rYr parse_commentrrsearchrawdatarslen)r^r reportretrr`s rarz_HTMLSanitizer.parse_commentcseND76B !8J ;'..t||QqSA 99; 4<<  rb)Nzapplication/xhtml+xml)r)__name__ __module__ __qualname__rlrkrmrrrrrrrrsrtrvrurxrrZrdr|rrrrr{r __classcell__)r`s@rarr"seNN`*& /!d(T"rzz -O^dN$LNMN^LL ! =G~ 8  :@ ! !rbrct||}|jdd}|j||j}|j jdd}|S)Nz BKFF; 88:D ::<   -D Krbs^\s*]*?)>s^\s*]*?)>s\s+(\w+)\s+"(&#\w+;|[^&"]*)"ctjd|}|xr|jxsd}|d|dz||dzd}}tj |}tj d|}t j |}|xr|dxsd}d|jvrd}nd}d}t|dk(r?|r=|Dcgc]}tj|r|} }| rd d j| zd z}t j |||z}tj |D cic]&\} } | jd | jd (} } } ||| fScc}wcc} } w) zStrips and replaces the DOCTYPE, returns (rss_version, stripped_data) rss_version may be 'rss091n' or None stripped_data is the same XML document with a replaced DOCTYPE s<\wNrrbrsnetscaperss091ns ]>zutf-8) rrrRE_ENTITY_PATTERNrr0RE_DOCTYPE_PATTERNrwrRE_SAFE_ENTITY_PATTERNrrdecode) rrheadentity_resultsdoctype_resultsdoctyper5 replacemente safe_entitiesrvs rareplace_doctypers IIgt $E  #ekkm )rEhuQweAgh$D'..t4N  d +D)006O4/!"4;Ggmmo%K ?q ^$ %++A.   7)..}=>"#K  ! !+t 4t ;D +22;? Aq 188G,,M D- ''! s 9E#+E) rrfrurlsrrrr MULTILINErrrrrrbrarsr8 $(K !'K !\BJJ8",,G RZZ :BLLI$$DE,(rb