Viewing File: /lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyo

�
��abcE@`s2ddlmZmZmZddlZddlmZmZddlm	Z
ddlmZddl
mZmZd	gZeed
dfed
dfed
d
fed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
dfed
d fed
d!fed
d"fed
d#fed
d$fed
d%fed
d&fed
d'fed
d(fed
d)fed
d*fed
d+fed
d,fed
d-fed
d.fed
d/fed
d0fed
d1fed
d2fed
d3fed
d4fed
d5fed
d6fed
d7fed
d8fed
d9fed
d:fed
d;fed
d<fed
d=fed
d>fed
d?fed
d@fed
dAfed
dBfed
dCfed
dDfed
dEfed
dFfed
dGfed
dHfed
dIfed
dJfed
dKfed
dLfed
dMfed
dNfed
dOfed
dPfed
dQfed
dRfed
dSfed
dTfed
dUfed
dVfed
dWfed
dXfed
dYfed
dZfed
d[fed
d\fed
d]fed
d^fed
d_fed
d`fed
dafed
dbfed
dcfed
ddfed
defed
dffed
dgfed
dhfed
difed
djfed
dkfed
dlfed
dmfedndofedndpfedndqfedndrfedndsfedndtfedndufedndvfedndwfedndxfedndyfedndzfednd{fednd|fednd}fednd~fedndfednd�fednd�fednd�fednd�fednd�fednd�fednd�fednd�fednd�fednd�fed�dfed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�fed�d�ff��Zed4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�ed1d�fd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�edOd�fedOdPfedOd%fd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcddedOd�fedOd�fedOd�fedOd�fedOdPfedOd�fedOd%fed1d�fed1d�fed1d�fdedfdgdhfC�ZedidjdkdldmdndodpdqdrdsedOd�fed1d�ff
�Zedtdudvdwdxdydzd{d|d}d~f�Zedd�d�d�d�d�d�d�d�d�d�d�d�d�d�f�Zed��Zed��Zed��Zed��Zed��Zejd1ej�Zd2ej fd3��YZ dS(�i(tabsolute_importtdivisiontunicode_literalsN(tescapetunescape(turllib_parsei(tbasei(t
namespacestprefixesuFilteruhtmluauabbruacronymuaddressuareauarticleuasideuaudioububigu
blockquoteubrubuttonucanvasucaptionucenteruciteucodeucolucolgroupucommandudatagridudatalistuddudeludetailsudfnudialogudirudivudludtuemuevent-sourceufieldsetu
figcaptionufigureufooterufontuformuheaderuh1uh2uh3uh4uh5uh6uhruiuimguinputuinsukeygenukbdulabelulegenduliumumapumenuumeterumulticolunavunextiduoluoutputuoptgroupuoptionupupreuprogressuqususampusectionuselectusmallusoundusourceuspaceruspanustrikeustrongusubusuputableutbodyutdutextareautimeutfootuthutheadutruttuuuuluvaruvideoumathmlumactionumathumerrorumfracumiu
mmultiscriptsumnumoumoverumpaddedumphantomumprescriptsumrootumrowumspaceumsqrtumstyleumsubumsubsupumsupumtableumtdumtextumtrumunderu
munderoverunoneusvguanimateuanimateColoru
animateMotionuanimateTransformuclipPathucircleudefsudescuellipseu	font-faceufont-face-nameu
font-face-srcuguglyphuhkernulinearGradientulineumarkerumetadatau
missing-glyphumpathupathupolygonupolylineuradialGradienturectusetustopuswitchutextutitleutspanuuseuacceptuaccept-charsetu	accesskeyuactionualignualtuautocompleteu	autofocusuaxisu
backgroundubalanceubgcolorubgpropertiesuborderubordercolorubordercolordarkubordercolorlightu
bottompaddingucellpaddingucellspacinguchu	challengeucharucharoffuchoffucharsetucheckeduclassuclearucolorucolsucolspanucompactucontenteditableucontrolsucoordsudataudatafldudatapagesizeudatasrcudatetimeudefaultudelayudisabledu	draggableudynsrcuenctypeuendufaceuforuframeu
galleryimgugutteruheadersuheightu	hidefocusuhiddenuhighuhrefuhreflanguhspaceuiconuidu	inputmodeuismapukeytypeuleftspacingulangulistulongdesculoopu	loopcountuloopendu	loopstartulowulowsrcumaxu	maxlengthumediaumethoduminumultipleunameunohrefunoshadeunowrapuopenuoptimumupatternupingu
point-sizeuposterupqgupreloadupromptu
radiogroupureadonlyurelu
repeat-maxu
repeat-minureplaceurequiredurevurightspacingurowsurowspanurulesuscopeuselectedushapeusizeusrcustartustepustyleusummaryusuppressutabindexutargetutemplateu
toppaddingutypeuunselectableuusemapuurnuvalignuvalueuvariableuvolumeuvspaceuvrmluwidthuwrapuxmlu
actiontypeucolumnalignucolumnlinesu
columnspacingu
columnspanudepthudisplayudisplaystyleuequalcolumnsu	equalrowsufenceu	fontstyleu
fontweightu
linethicknessulspaceumathbackgroundu	mathcolorumathvariantumaxsizeuminsizeuotherurowalignurowlinesu
rowspacingurspaceuscriptlevelu	selectionu	separatorustretchyuxlinkushowu
accent-heightu
accumulateuadditiveu
alphabeticuarabic-formuascentu
attributeNameu
attributeTypeubaseProfileubboxubeginubyucalcModeu
cap-heightu	clip-pathucolor-renderingucontentucxucyududxudyudescentudurufillufill-opacityu	fill-ruleufont-familyu	font-sizeufont-stretchu
font-styleufont-variantufont-weightufromufxufyug1ug2u
glyph-nameu
gradientUnitsuhanginguhoriz-adv-xuhoriz-origin-xuideographicuku	keyPointsu
keySplinesukeyTimesu
marker-endu
marker-midumarker-startumarkerHeightumarkerUnitsumarkerWidthumathematicaluoffsetuopacityuorientuoriginuoverline-positionuoverline-thicknessupanose-1u
pathLengthupointsupreserveAspectRatioururefXurefYurepeatCountu	repeatDururequiredExtensionsurequiredFeaturesurestarturotateurxuryuslopeustemhustemvu
stop-colorustop-opacityustrikethrough-positionustrikethrough-thicknessustrokeustroke-dasharrayustroke-dashoffsetustroke-linecapustroke-linejoinustroke-miterlimitustroke-opacityustroke-widthusystemLanguageutext-anchorutou	transformuu1uu2uunderline-positionuunderline-thicknessuunicodeu
unicode-rangeuunits-per-emuvaluesuversionuviewBoxu
visibilityuwidthsuxux-heightux1ux2uactuateuarcroleuroleubaseuspaceuyuy1uy2u
zoomAndPanu
color-profileucursorufilterumaskualtGlyphufeImageutextpathutrefuazimuthubackground-coloruborder-bottom-coloruborder-collapseuborder-coloruborder-left-coloruborder-right-coloruborder-top-coloru	directionu	elevationufloatuletter-spacinguline-heightuoverflowupauseupause-afterupause-beforeupitchupitch-rangeurichnessuspeakuspeak-headeru
speak-numeraluspeak-punctuationuspeech-rateustressu
text-alignutext-decorationutext-indentuunicode-bidiuvertical-alignuvoice-familyuwhite-spaceuautouaquaublackublockublueuboldubothubottomubrownucollapseudashedudottedufuchsiaugrayugreenu
!importantuitaliculeftulimeumaroonumediumunavyunormaluoliveupointerupurpleuredurightusolidusilverutealutoputransparentu	underlineuwhiteuyellowued2kuftpuhttpuhttpsuircumailtounewsugopherunntputelnetuwebcaluxmppucalltoufeeduaimursyncutagusshusftpurtspuafsu	image/pngu
image/jpegu	image/gifu
image/webpu	image/bmpu
text/plainuL
                                ^
                                # Match a content type <application>/<type>
                                (?P<content_type>[-a-zA-Z0-9.]+/[-a-zA-Z0-9.]+)
                                # Match any character set and encoding
                                (?:(?:;charset=(?:[-a-zA-Z0-9]+)(?:;(?:base64))?)
                                  |(?:;(?:base64))?(?:;charset=(?:[-a-zA-Z0-9]+))?)
                                # Assume the rest is data
                                ,.*
                                $
                                tFiltercB`sbeZdZeeeeeee	e
eed�
Z
d�Zd�Zd�Zd�Zd�ZRS(uA sanitization of XHTML+MathML+SVG and of inline style attributes.cC`sttt|�j|�||_||_||_||_||_||_||_	|	|_
|
|_||_dS(N(
tsuperR	t__init__tallowed_elementstallowed_attributestallowed_css_propertiestallowed_css_keywordstallowed_svg_propertiestallowed_protocolstallowed_content_typestattr_val_is_uritsvg_attr_val_allows_reftsvg_allow_local_href(tselftsourceRR
RRRRRRRR((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR�s									cc`s>x7tjj|�D]#}|j|�}|r|VqqWdS(N(RR	t__iter__tsanitize_token(Rttoken((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR�scC`s�|d}|d	kr�|d}|d}||f|jksd|dkrqtd|f|jkrq|j|�S|j|�Sn|dkr�n|SdS(
NutypeuStartTaguEndTaguEmptyTagunameu	namespaceuhtmluComment(uStartTaguEndTaguEmptyTag(RtNoneRt
allowed_tokentdisallowed_token(RRt
token_typetnamet	namespace((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR�s



c	C`s9d|kr5|d}t|j��}x-||jD]}|d|=|j|�q6Wx||j@D]�}tjddt||��j�}|j	dd�}yt
j
|�}Wntk
r�d}||=nX|rf|j
rf|j
|jkr||=n|j
dkr[tj|j�}|s3||=qX|jd�|jkrX||=qXq[qfqfWxC|jD]8}||kritjddt||��||<qiqiW|d|jkrtd	d
f|krtjd|td	d
f�r|td	d
f=nd
|kr(|j|d�|d<n||d<n|S(Nudatau
[`- - \s]+uu�ucontent_typeuurl\s*\(\s*[^#\s][^)]+?\)u unameuxlinkuhrefu^\s*[^#\s].*ustyle(Nustyle(Nustyle(Nustyle(tsettkeysR
tremoveRtretsubRtlowertreplaceturlparset
ValueErrorRtschemeRtdata_content_typetmatchtpathtgroupRRRRtsearchtsanitize_css(	RRtattrst
attr_namest	to_removetattrt
val_unescapedturitm((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyRsJ



	
cC`s|d}|dkr+d|d|d<n�|dr�g}xa|dj�D]O\\}}}|jd|dkry|ndt||ft|�f�qLWd|dd	j|�f|d<nd
|d|d<|jd�r�|dd d
|d<nd|d<|d=|S(NutypeuEndTagu</%s>unameudatau %s="%s"u%s:%su<%s%s>uu<%s>uselfClosingi����u/>u
Characters(titemstappendRRRtjointget(RRRR1tnsRtv((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR2s

#A$
cC`sctjd�jd|�}tjd|�s1dStjd|�sGdSg}xtjd|�D]�\}}|sxq`n|j�|jkr�|j|d|d�q`|jd	�d
j�dkr!x�|j�D],}||j	kr�tjd|�r�Pq�q�W|j|d|d�q`|j�|j
kr`|j|d|d�q`q`Wdj|�S(Nuurl\s*\(\s*[^\s)]+?\s*\)\s*u u@^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$uu ^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$u([-\w]+)\s*:\s*([^:;]*)u: u;u-iu
backgrounduborderumarginupaddingu\^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$(u
backgrounduborderumarginupadding(R$tcompileR%R,tfindallR&RR9tsplitRRR:(Rtstyletcleantproptvaluetkeyword((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR0Fs*	 (t__name__t
__module__t__doc__RR
RRRRRRRRRRRRRR0(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyR	�s 
			2	(Nuabbr(Nuaccept(Nuaccept-charset(Nu	accesskey(Nuaction(Nualign(Nualt(Nuautocomplete(Nu	autofocus(Nuaxis(Nu
background(Nubalance(Nubgcolor(Nubgproperties(Nuborder(Nubordercolor(Nubordercolordark(Nubordercolorlight(Nu
bottompadding(Nucellpadding(Nucellspacing(Nuch(Nu	challenge(Nuchar(Nucharoff(Nuchoff(Nucharset(Nuchecked(Nucite(Nuclass(Nuclear(Nucolor(Nucols(Nucolspan(Nucompact(Nucontenteditable(Nucontrols(Nucoords(Nudata(Nudatafld(Nudatapagesize(Nudatasrc(Nudatetime(Nudefault(Nudelay(Nudir(Nudisabled(Nu	draggable(Nudynsrc(Nuenctype(Nuend(Nuface(Nufor(Nuform(Nuframe(Nu
galleryimg(Nugutter(Nuheaders(Nuheight(Nu	hidefocus(Nuhidden(Nuhigh(Nuhref(Nuhreflang(Nuhspace(Nuicon(Nuid(Nu	inputmode(Nuismap(Nukeytype(Nulabel(Nuleftspacing(Nulang(Nulist(Nulongdesc(Nuloop(Nu	loopcount(Nuloopend(Nu	loopstart(Nulow(Nulowsrc(Numax(Nu	maxlength(Numedia(Numethod(Numin(Numultiple(Nuname(Nunohref(Nunoshade(Nunowrap(Nuopen(Nuoptimum(Nupattern(Nuping(Nu
point-size(Nuposter(Nupqg(Nupreload(Nuprompt(Nu
radiogroup(Nureadonly(Nurel(Nu
repeat-max(Nu
repeat-min(Nureplace(Nurequired(Nurev(Nurightspacing(Nurows(Nurowspan(Nurules(Nuscope(Nuselected(Nushape(Nusize(Nuspan(Nusrc(Nustart(Nustep(Nustyle(Nusummary(Nusuppress(Nutabindex(Nutarget(Nutemplate(Nutitle(Nu
toppadding(Nutype(Nuunselectable(Nuusemap(Nuurn(Nuvalign(Nuvalue(Nuvariable(Nuvolume(Nuvspace(Nuvrml(Nuwidth(Nuwrap(Nu
actiontype(Nualign(Nucolumnalign(Nucolumnalign(Nucolumnalign(Nucolumnlines(Nu
columnspacing(Nu
columnspan(Nudepth(Nudisplay(Nudisplaystyle(Nuequalcolumns(Nu	equalrows(Nufence(Nu	fontstyle(Nu
fontweight(Nuframe(Nuheight(Nu
linethickness(Nulspace(Numathbackground(Nu	mathcolor(Numathvariant(Numathvariant(Numaxsize(Numinsize(Nuother(Nurowalign(Nurowalign(Nurowalign(Nurowlines(Nu
rowspacing(Nurowspan(Nurspace(Nuscriptlevel(Nu	selection(Nu	separator(Nustretchy(Nuwidth(Nuwidth(Nu
accent-height(Nu
accumulate(Nuadditive(Nu
alphabetic(Nuarabic-form(Nuascent(Nu
attributeName(Nu
attributeType(NubaseProfile(Nubbox(Nubegin(Nuby(NucalcMode(Nu
cap-height(Nuclass(Nu	clip-path(Nucolor(Nucolor-rendering(Nucontent(Nucx(Nucy(Nud(Nudx(Nudy(Nudescent(Nudisplay(Nudur(Nuend(Nufill(Nufill-opacity(Nu	fill-rule(Nufont-family(Nu	font-size(Nufont-stretch(Nu
font-style(Nufont-variant(Nufont-weight(Nufrom(Nufx(Nufy(Nug1(Nug2(Nu
glyph-name(Nu
gradientUnits(Nuhanging(Nuheight(Nuhoriz-adv-x(Nuhoriz-origin-x(Nuid(Nuideographic(Nuk(Nu	keyPoints(Nu
keySplines(NukeyTimes(Nulang(Nu
marker-end(Nu
marker-mid(Numarker-start(NumarkerHeight(NumarkerUnits(NumarkerWidth(Numathematical(Numax(Numin(Nuname(Nuoffset(Nuopacity(Nuorient(Nuorigin(Nuoverline-position(Nuoverline-thickness(Nupanose-1(Nupath(Nu
pathLength(Nupoints(NupreserveAspectRatio(Nur(NurefX(NurefY(NurepeatCount(Nu	repeatDur(NurequiredExtensions(NurequiredFeatures(Nurestart(Nurotate(Nurx(Nury(Nuslope(Nustemh(Nustemv(Nu
stop-color(Nustop-opacity(Nustrikethrough-position(Nustrikethrough-thickness(Nustroke(Nustroke-dasharray(Nustroke-dashoffset(Nustroke-linecap(Nustroke-linejoin(Nustroke-miterlimit(Nustroke-opacity(Nustroke-width(NusystemLanguage(Nutarget(Nutext-anchor(Nuto(Nu	transform(Nutype(Nuu1(Nuu2(Nuunderline-position(Nuunderline-thickness(Nuunicode(Nu
unicode-range(Nuunits-per-em(Nuvalues(Nuversion(NuviewBox(Nu
visibility(Nuwidth(Nuwidths(Nux(Nux-height(Nux1(Nux2(Nuy(Nuy1(Nuy2(Nu
zoomAndPan(Nuhref(Nusrc(Nucite(Nuaction(Nulongdesc(Nuposter(Nu
background(Nudatasrc(Nudynsrc(Nulowsrc(Nuping(Nu	clip-path(Nu
color-profile(Nucursor(Nufill(Nufilter(Numarker(Numarker-start(Nu
marker-mid(Nu
marker-end(Numask(Nustroke(NualtGlyph(Nuanimate(NuanimateColor(Nu
animateMotion(NuanimateTransform(Nucursor(NufeImage(Nufilter(NulinearGradient(Nupattern(NuradialGradient(Nutextpath(Nutref(Nuset(Nuuse(.uazimuthubackground-coloruborder-bottom-coloruborder-collapseuborder-coloruborder-left-coloruborder-right-coloruborder-top-coloruclearucolorucursoru	directionudisplayu	elevationufloatufontufont-familyu	font-sizeu
font-styleufont-variantufont-weightuheightuletter-spacinguline-heightuoverflowupauseupause-afterupause-beforeupitchupitch-rangeurichnessuspeakuspeak-headeru
speak-numeraluspeak-punctuationuspeech-rateustressu
text-alignutext-decorationutext-indentuunicode-bidiuvertical-alignuvoice-familyuvolumeuwhite-spaceuwidth('uautouaquaublackublockublueuboldubothubottomubrownucenterucollapseudashedudottedufuchsiaugrayugreenu
!importantuitaliculeftulimeumaroonumediumunoneunavyunormalunowrapuoliveupointerupurpleuredurightusolidusilverutealutoputransparentu	underlineuwhiteuyellow(ufillufill-opacityu	fill-ruleustrokeustroke-widthustroke-linecapustroke-linejoinustroke-opacity(ued2kuftpuhttpuhttpsuircumailtounewsugopherunntputelnetuwebcaluxmppucalltoufeeduurnuaimursyncutagusshusftpurtspuafsudata(u	image/pngu
image/jpegu	image/gifu
image/webpu	image/bmpu
text/plain(!t
__future__RRRR$txml.sax.saxutilsRRtpip._vendor.six.movesRR(tRt	constantsRRt__all__t	frozensetRRR
RRRRRRRRR>tVERBOSER+R	(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/filters/sanitizer.pyt<module>s2	














































































































































































					

Back to Directory File Manager
<