ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- idna/__pycache__/compat.cpython-36.pyc000064400000001036152347724720013615 0ustar003 Pf@s,ddlTddlTddZddZddZdS) )*cCst|S)N)encode)labelr/usr/lib/python3.6/compat.pyToASCIIsrcCst|S)N)decode)rrrr ToUnicodesr cCs tddS)Nz,IDNA 2008 does not utilise nameprep protocol)NotImplementedError)srrrnameprep sr N)Zcorecodecrr r rrrrsidna/__pycache__/package_data.cpython-36.pyc000064400000000210152347724720014707 0ustar003 Pf@sdZdS)z2.6N) __version__rr"/usr/lib/python3.6/package_data.pysidna/__pycache__/core.cpython-36.pyc000064400000021303152347724720013261 0ustar003 Pf~,@s>ddlmZddlZddlZddlZddlZddlmZdZdZ ej dZ ej ddkr`e ZeZGd d d eZGd d d eZGd ddeZGdddeZddZddZddZddZddZddZd7ddZd d!Zd"d#Zd$d%Zd&d'Z d8d(d)Z!d*d+Z"d,d-Z#d.d/Z$d9d1d2Z%d:d3d4Z&d;d5d6Z'dS)<)idnadataN)intranges_contain sxn--u [.。.。]c@seZdZdZdS) IDNAErrorz7 Base exception for all IDNA-encoding related problems N)__name__ __module__ __qualname____doc__r r /usr/lib/python3.6/core.pyrsrc@seZdZdZdS) IDNABidiErrorz= Exception when bidirectional requirements are not satisfied N)rr r r r r r r rsrc@seZdZdZdS)InvalidCodepointz> Exception when a disallowed or unallocated codepoint is used N)rr r r r r r r rsrc@seZdZdZdS)InvalidCodepointContextzE Exception when the codepoint is not valid in the context it is used N)rr r r r r r r rsrcCstjt|S)N) unicodedataZ combiningunichr)cpr r r _combining_class$srcCstt|tj|S)N)rordrscripts)rZscriptr r r _is_script'srcCs |jdS)Npunycode)encode)sr r r _punycode*srcCs dj|S)Nz U+{0:04X})format)rr r r _unot-srcCst|dkrdSdS)N?FT)len)labelr r r valid_label_length1s r!cCst||rdndkrdSdS)NFT)r)r trailing_dotr r r valid_string_length8sr%Fc Cspd}xJt|dD]<\}}tj|}|dkr>tdjt|||dkrd}PqW| r`| r`dStj|d }|dkr|d}n |d krd}ntd jt|d}d}xt|dD]\}}tj|}|r&|dkrtdj||dkrd}n|dkrd}|dkrZ|s|}n||krZtdq|dkr>tdj||dkrNd}q|dkrd}qW|sltddS)NFrz3Unknown directionality in label {0} at position {1}RALANTrLz>First codepoint in label {0} must be directionality L, R or ALENESCSETONBNNSMzHInvalid direction for codepoint at position {0} in a right-to-left labelz2Can not mix numeral types in a right-to-left labelzHInvalid direction for codepoint at position {0} in a left-to-right labelz0Label ends with illegal codepoint directionality)r'r(r))r'r() r'r(r)r+r,r-r.r/r0r1)r'r(r+r))r)r+)r*r+r,r-r.r/r0r1)r*r+) enumeraterZ bidirectionalrrrepr) r Z check_ltrZ bidi_labelidxr directionZrtlZ valid_endingZ number_typer r r check_bidi?sR          r6cCs"tj|dddkrtddS)NrMz0Label begins with an illegal combining characterT)rcategoryr)r r r r check_initial_combiner|sr9cCs<|dddkrtd|ddks0|d dkr8tdd S) Nz--z4Label has disallowed hyphens in 3rd and 4th positionr-rz)Label must not start or end with a hyphenT)r)r r r r check_hyphen_oks r>cCstjd||krtddS)NNFCz%Label must be in Normalization Form C)r normalizer)r r r r check_nfcsrAcCs:t||}|dkr|dkr:tt||dtkr:dSd}xTt|dd d D]@}tjjt||}|tdkrvqP|tdtdgkrPd}PqPW|sdSd}xVt|dt|D]@}tjjt||}|tdkrq|td tdgkrd}PqW|S|d kr2|dkr.tt||dtkr.dSdSdSdS) Ni rrTFTr*Dr'i r=r=)rr_virama_combining_classrangerZ joining_typesgetr)r poscp_valueokiZ joining_typer r r valid_contextjs<      rKcCst||}|dkrdd|ko.t|dknr`t||ddkr`t||ddkr`dSdS|dkr|t|dkrt|dkrt||ddSdS|d ks|d kr|dkrt||dd SdS|d krx<|D]4}|d krqt|ds t|ds t|drdSqWdSd|ko,dknrlx2|D]*}dt|koVdknr:dSq:WdSd|kodknrx2|D]*}dt|kodknrdSqWdSdS)NrrlTFiuZGreekiiZHebrewi0u・ZHiraganaZKatakanaZHani`iiii)rrr)r rGZ exceptionrHrr r r valid_contextos>  (  "      rNcCst|ttfr|jd}t|dkr,tdt|t|t|xt |D]\}}t |}t |t j drrqNqNt |t j drt||stdjt||dt|qNt |t j drt||std jt||dt|qNtd jt||dt|qNWt|dS) Nzutf-8rz Empty LabelZPVALIDZCONTEXTJz-Joiner {0} not allowed at position {1} in {2}rZCONTEXTOz0Codepoint {0} not allowed at position {1} in {2}z0Codepoint {0} at position {1} of {2} not allowed) isinstancebytes bytearraydecoderrrAr>r9r2rrrZcodepoint_classesrKrrrr3rNrr6)r rGrrHr r r check_labels&      "rScCsyN|jd}y t|Wn"tk r:tdj|YnXt|sLtd|Stk rbYnX|sptdt|}t|t|}t |}t|std|S)Nasciiz$The label {0} is not a valid A-labelzLabel too longzNo Input) rulabelrrr!UnicodeEncodeErrorunicoderSr_alabel_prefix)r r r r alabels(  rYc Cst|ttfs:y|jd}Wntk r8t||SX|j}|jtr^|t td}nt||j dS|j d}t||S)NrTr) rOrPrQrrVrSlower startswithrXrrR)r r r r rUs   rUTc Cs,ddlm}d}yxt|D]\}}t|}||dkr:|ntj||dfd}|d} t|dkrl|dnd} | d ks| d kr| s| d kr|r| dkr||7}q| dk r| d ks| d kr|s| d kr|r|| 7}q| d krtqWtjd|Stk r&t dj t ||dt |YnXdS)zBRe-map the characters in the string according to UTS46 processing.r) uts46datar&Zrr:NVrC3r7Ir?z0Codepoint {0} not allowed at position {1} in {2}) r\r2rbisectZ bisect_leftr IndexErrorrr@rrrr3) Zdomain std3_rules transitionalr\outputrGcharZ code_pointZuts46rowZstatusZ replacementr r r uts46_remap3s0       rhc Cst|ttfr|jd}|r(t|||}d}g}|r@|jd}n tj|}x|rb|d rb|d=qLW|sptd|d dkr|d =d}x|D]}|jt |qW|r|jd d j |}t ||std |S)NrTF.rz Empty domainrr&T.zDomain too longr=r=) rOrPrQrRrhsplit_unicode_dots_rerappendrYjoinr%) rstrictuts46rdrer$resultlabelsr r r r rOs0          rcCst|ttfr|jd}|r(t||d}d}g}|s@tj|}n |jd}x|rb|d rb|d=qLW|sptd|d s|d =d}x|D]}|jt |qW|r|jddj |S) NrTFrirz Empty domainrTr&r=r=) rOrPrQrRrhrmrlrrnrUro)rrprqrdr$rrrsr r r r rRls*       rR)F)F)TF)FFFF)FFF)(r&rrbrresysZ intrangesrrDrXcompilerm version_infostrrWchrr UnicodeErrorrrrrrrrrr!r%r6r9r>rArKrNrSrYrUrhrrRr r r r sB    = , )  idna/__pycache__/uts46data.cpython-36.opt-1.pyc000064400000671047152347724720015127 0ustar003 Pfp@sdZdZddZddZddZdd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dBdCZ"dDdEZ#dFdGZ$dHdIZ%dJdKZ&dLdMZ'dNdOZ(dPdQZ)dRdSZ*dTdUZ+dVdWZ,dXdYZ-dZd[Z.d\d]Z/d^d_Z0d`daZ1dbdcZ2dddeZ3dfdgZ4dhdiZ5djdkZ6dldmZ7dndoZ8dpdqZ9drdsZ:dtduZ;dvdwZd|d}Z?d~dZ@ddZAddZBddZCddZDddZEddZFddZGddZHddZIddZJeKeeeeeeee e e e e eeeeeeeeeeeeeeeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;e<e=e>e?e@eAeBeCeDeEeFeGeHeIeJZLdS)zIDNA Mapping Table from UTS46.z6.3.0ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N3  !"#$%&'()*+,-V./0123456789:;<=>?@AMaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz[\]^_`abc)rr)rr)rr)rr)rr)rr)rr)r r)r r)r r)r r)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)r!r)r"r)r#r)r$r)r%r)r&r)r'r)r(r)r)r)r*r)r+r)r,r)r-r)r.r)r/r0)r1r0)r2r)r3r0)r4r0)r5r0)r6r0)r7r0)r8r0)r9r0)r:r0)r;r0)r<r0)r=r)r>r)r?r)r@r)rAr)rBr)rCr)rDrErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErr)rsrErt)rurErv)rwrErx)ryr)rzr)r{r)r|r)r}r)r~r)rr0)rr0)rr0rrr/usr/lib/python3.6/uts46data.py_seg_0srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Ndr0efghijklmnopqrstuvwxyz{r|}~X  ̈rErFI ̄2 ́μ ̧1rb1⁄41⁄23⁄4àáâãäåæç)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rrr)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rrr)rr0)rrErF)rr0)rr0)rr)rr0)rrr)rr0)rr0)rrEr)rrEr)rrr)rrEr)rr0)rr0)rrr)rrEr)rrErb)rr0)rrEr)rrEr)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_1psrceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrEèéêëìíîïðñòóôõör0øùúûüýþDssāăąćĉ  ċ  č ďđēĕėęěĝğ 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r0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rr0)r rEr )r r0)r rErj)r r0)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rrEr)rrEr )r!r0)r"rEr#)r$rEr%)r&rEr')r(rEr))r*r0)r+rEr,rrrrr_seg_3@sr-cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEɣr0ɩɨƙɯɲɵơƣƥʀƨʃƭʈưʊʋƴƶʒƹƽdžljnjǎǐǒǔǖǘǚǜǟǡǣǥǧǩǫǭǯdzǵƕƿǹǻǽǿȁȃȅȇȉ  ȋ  ȍ)r.rEr/)r0r0)r1rEr2)r3rEr4)r5rEr6)r7r0)r8rEr9)r:rEr;)r<r0)r=rEr>)r?rEr@)rAr0)rBrErC)rDr0)rErErF)rGr0)rHrErI)rJrErK)rLr0)rMrErN)rOr0)rPrErQ)rRr0)rSrErT)rUrErV)rWr0)rXrErY)rZrEr[)r\rEr])r^r0)r_rEr`)rar0)rbrErc)rdrEre)rfr0)rgrErh)rir0)rjrErk)rlrErm)rnrEro)rprErq)rrr0)rsrErt)rur0)rvrErw)rxr0)ryrErz)r{r0)r|rEr})r~r0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrErrrrrr_seg_4srceCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd gdS( N r0rEȏ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rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rr-r)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_6xsrcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddgdS(NrEєѕіїј љ њ ћ ќ ѝўџабвгдежзийклмноп р!с"т#у$ф%х&ц'ч(ш)щ*ъ+ы,ь-э.ю/я0r0`ѡabѣcdѥefѧghѩijѫklѭmnѯopѱqrѳstѵuvѷwxѹyzѻ{|ѽ}~ѿҁҋҍҏґғҕҗҙқҝҟ)rrEr )r rEr )r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`r0)rarErb)rcr0)rdrEre)rfr0)rgrErh)rir0)rjrErk)rlr0)rmrErn)ror0)rprErq)rrr0)rsrErt)rur0)rvrErw)rxr0)ryrErz)r{r0)r|rEr})r~r0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrErrrrrr_seg_7srceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nr0rEҡңҥҧҩҫҭүұҳҵҷҹһҽҿrӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃ)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr )r r0)r rEr )r r0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)r rEr!)r"r0)r#rEr$)r%r0)r&rEr')r(r0)r)rEr*)r+r0)r,rEr-)r.r0)r/rEr0)r1r0)r2rEr3)r4r0)r5rEr6)r7r0)r8rEr9)r:r0)r;rEr<)r=r0)r>rEr?)r@r0)rArErB)rCr0)rDrErE)rFr0)rGrErH)rIr0rrrrr_seg_8HsrJceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS( NrEԅr0ԇԉ  ԋ  ԍ ԏԑԓԕԗԙԛԝԟ ԡ!"ԣ#$ԥ%&ԧ'(r1ա2բ3գ4դ5ե6զ7է8ը9թ:ժ;ի<լ=խ>ծ?կ@հAձBղCճDմEյFնGշHոIչJպKջLռMսNվOտPրQցRւSփTքUօVֆWY`aեւuاٴvوٴwۇٴxيٴy)rKrErL)rMr0)rNrErO)rPr0)rQrErR)rSr0)rTrErU)rVr0)rWrErX)rYr0)rZrEr[)r\r0)r]rEr^)r_r0)r`rEra)rbr0)rcrErd)rer0)rfrErg)rhr0)rirErj)rkr0)rlrErm)rnr0)rorErp)rqr0)rrrErs)rtr0)rurErv)rwr0)rxrEry)rzr0)r{rEr|)r}r0)r~rEr)rr0)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rr0)rr)rr0)rrEr)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rrEr)rrEr)rrEr)rrEr)rr0)rrrrrrr_seg_9srceCsdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nr0rKM.0?@\^_ X rEक़Y ख़Z ग़[ ज़\ ड़] ढ़^ फ़_ य़` x y ড় ঢ় য়       ) * 1 2 3 ਲ਼4 5 6 ਸ਼7 8 : < = > C G I K N Q R Y ਖ਼Z ਗ਼[ ਜ਼\ ] ^ ਫ਼_ )rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrEr)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r!r)r"r0)r#r)r$r0)r%r)r&r0)r'r)r(r0)r)r)r*r0)r+r)r,r0)r-r)r.rEr/)r0rEr1)r2r)r3rEr4)r5r0)r6r)r7r0)r8r)r9r0)r:r)r;r0)r<r)r=r0)r>r)r?r0)r@r)rAr0)rBr)rCr0)rDrErE)rFr)rGr0)rHrErI)rJr)rKr0)rLr)rMr0)rNr)rOr0)rPr)rQr0)rRr)rSr0)rTr)rUr0)rVr)rWrErX)rYrErZ)r[rEr\)r]r0)r^r)r_rEr`)rarrrrrr_seg_10srbceCsdjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nf r0v r       ) * 1 2 4 5 : < E G I K N V X \ rEଡ଼] ଢ଼^ _ d f x       ) * 4 5 )rcr0)rdr)rer0)rfr)rgr0)rhr)rir0)rjr)rkr0)rlr)rmr0)rnr)ror0)rpr)rqr0)rrr)rsr0)rtr)rur0)rvr)rwr0)rxr)ryr0)rzr)r{r0)r|r)r}r0)r~r)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rrEr)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0rrrrr_seg_11srceCsdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N: r= r0E F I J N U W X Z ` d f p x       ; = E F I J O W X ` d f v y 3rEํา4;?\)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r r)r r0)r r)r r0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)r r)r!r0)r"r)r#r0)r$rEr%)r&r0)r'r)r(r0)r)r)r*r0)r+r)r,r0)r-r)r.r0rrrrr_seg_12sr/ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nrr0rEໍາຫນຫມ ་ CགྷDHIMཌྷNRདྷSWབྷX\ཛྷ]iཀྵjmqsཱིtuཱུvྲྀw ྲཱྀxླྀy ླཱྀzཱྀྒྷྜྷྡྷྦྷྫྷྐྵⴧⴭნ_aIJNPWX)r0r)r1r0)r2r)r3r0)r4r)r5r0)r6r)r7r0)r8r)r9r0)r:r)r;r0)r<r)r=r0)r>r)r?r0)r@r)rAr0)rBrErC)rDr0)rEr)rFr0)rGr)rHr0)rIr)rJr0)rKr)rLr0)rMr)rNr0)rOr)rPrErQ)rRrErS)rTr0)rUr)rVr0)rWrErX)rYr0)rZrEr[)r\r0)r]r)r^r0)r_rEr`)rar0)rbrErc)rdr0)rerErf)rgr0)rhrEri)rjr0)rkrErl)rmr0)rnr)ror0)rprErq)rrr0)rsrErt)rurErv)rwrErx)ryrErz)r{rEr|)r}r0)r~rEr)rr0)rrEr)rr0)rr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rr)rrEr)rr)rr0)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0rrrrr_seg_13PsrceCsdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NYrZr0^`[]}  7@T`mnqrt r x ,0<@ADnpu_`})rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r r)r r0)r r)r r0)rr)rr0)rr)rr0)rrrrrrr_seg_14srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(Nr0rLP}8;JM,rErF-r.rH/0rL1rN2ǝ3rR4rT5rV6rX7rZ8r\9r^:r`;<rb=ȣ>rd?rh@rlArnBrrCDɐEɑFᴂGHIJəKɛLɜMNOPQŋRSɔTᴖUᴗVWXYᴝZɯ[rp\ᴥ]β^γ_δ`φaχbcdefghρijkxнyɒrJɕrrPɟɡɥɨɩɪᵻʝɭ)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r!r)r"r0)r#r)r$r0)r%r)r&r0)r'rErF)r(rEr)r)rErH)r*r0)r+rErL)r,rErN)r-rEr.)r/rErR)r0rErT)r1rErV)r2rErX)r3rErZ)r4rEr\)r5rEr^)r6rEr`)r7r0)r8rErb)r9rEr:)r;rErd)r<rErh)r=rErl)r>rErn)r?rErr)r@rErF)rArErB)rCrErD)rErErF)rGrErH)rHrErL)rIrErN)rJrErK)rLrErM)rNrErO)rPrErR)rQr0)rRrErZ)rSrEr^)rTrErU)rVrErb)rWrErX)rYrErZ)r[rEr\)r]rErd)r^rErl)r_rErn)r`rEra)rbrErc)rdrErp)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErV)rrrErh)rsrErn)rtrErp)rurErh)rvrErj)rwrErx)ryrErn)rzrErp)r{r0)r|rEr})r~r0)rrEr)rrErJ)rrEr)rrEr)rrErO)rrErP)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_15 srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEᶅʟɱɰɲɳɴɵɸʂʃƫʉʊᴜʋʌrxʐʑʒθr0rḁḃḅḇḉ  ḋ  ḍ ḏḑḓḕḗḙḛḝḟ ḡ!"ḣ#$ḥ%&ḧ'(ḩ)*ḫ+,ḭ-.ḯ/0ḱ12ḳ34ḵ56ḷ78ḹ9:ḻ;<ḽ=>ḿ?@ṁABṃCDṅEFṇGHṉIJṋ)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErx)rrEr)rrEr)rrEr)rrEr)rr0)rr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r! r0)r" rEr# )r$ r0)r% rEr& )r' r0)r( rEr) )r* r0)r+ rEr, )r- r0)r. rEr/ )r0 r0)r1 rEr2 )r3 r0)r4 rEr5 )r6 r0)r7 rEr8 rrrrr_seg_16sr9 ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NKr0LrEṍMNṏOPṑQRṓSTṕUVṗWXṙYZṛ[\ṝ]^ṟ_`ṡabṣcdṥefṧghṩijṫklṭmnṯopṱqrṳstṵuvṷwxṹyzṻ{|ṽ}~ṿẁẃẅẇẉẋẍẏẑẓẕaʾr.ạảấầẩẫậắằẳ)r: r0)r; rEr< )r= r0)r> rEr? )r@ r0)rA rErB )rC r0)rD rErE )rF r0)rG rErH )rI r0)rJ rErK )rL r0)rM rErN )rO r0)rP rErQ )rR r0)rS rErT )rU r0)rV rErW )rX r0)rY rErZ )r[ r0)r\ rEr] )r^ r0)r_ rEr` )ra r0)rb rErc )rd r0)re rErf )rg r0)rh rEri )rj r0)rk rErl )rm r0)rn rEro )rp r0)rq rErr )rs r0)rt rEru )rv r0)rw rErx )ry r0)rz rEr{ )r| r0)r} rEr~ )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r rErZ )r r0)r rEr.)r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0rrrrr_seg_17sr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEẵr0ặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿἀ ἁ ἂ ἃ ἄ ἅἆἇrἐἑἒἓἔἕ (ἠ)ἡ*ἢ+ἣ,ἤ-ἥ)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr! )r" r0)r# rEr$ )r% r0)r& rEr' )r( r0)r) rEr* )r+ r0)r, rEr- )r. r0)r/ rEr0 )r1 r0)r2 rEr3 )r4 r0)r5 rEr6 )r7 r0)r8 rEr9 )r: r0)r; rEr< )r= r0)r> rEr? )r@ r0)rA rErB )rC rErD )rE rErF )rG rErH )rI rErJ )rK rErL )rM rErN )rO rErP )rQ r0)rR r)rS rErT )rU rErV )rW rErX )rY rErZ )r[ rEr\ )r] rEr^ )r_ r)r` r0)ra rErb )rc rErd )re rErf )rg rErh )ri rErj )rk rErl rrrrr_seg_18Xsrm cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(N.rEἦ/ἧ0r08ἰ9ἱ:ἲ;ἳ<ἴ=ἵ>ἶ?ἷ@FrHὀIὁJὂKὃLὄMὅNPXYὑZ[ὓ\]ὕ^_ὗ`hὠiὡjὢkὣlὤmὥnὦoὧpqάrsέtuήvwίxyόz{ύ|}ώ~ἀιἁιἂιἃιἄιἅιἆιἇιἠιἡιἢιἣιἤιἥιἦιἧιὠιὡιὢιὣιὤιὥιὦιὧι)rn rEro )rp rErq )rr r0)rs rErt )ru rErv )rw rErx )ry rErz )r{ rEr| )r} rEr~ )r rEr )r rEr )r r0)r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r r0)r r)r rEr )r r)r rEr )r r)r rEr )r r)r rEr )r r0)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr rrrrr_seg_19sr ceCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddgdS(NrEὧιr0ὰιαιάιrᾶιᾰᾱὰάr ̓ι ͂ ̈͂ὴιηιήιῆιὲέὴή ̓̀ ̓́ ̓͂ΐῐῑὶί ̔̀ ̔́ ̔͂ΰῠῡὺύῥ ̈̀ ̈́`ὼιωιώιῶιὸόὼώ ́ ̔ r r r-   ‐   ̳ $ ' ( / 0 3 ′′4 ′′′5 6 ‵‵7 ‵‵‵8 < !!= >  ̅? G ??H ?!I !?J W ′′′′X )r rEr )r r0)r rEr )r rEr )r rEr )r r)r r0)r rEr )r rEr )r rEr )r rEr )r! rEr" )r# rEr )r$ rr% )r& rEr' )r( rr% )r) rr* )r+ rr, )r- rEr. )r/ rEr0 )r1 rEr2 )r3 r)r4 r0)r5 rEr6 )r7 rEr8 )r9 rEr: )r; rEr< )r= rEr> )r? rEr0 )r@ rrA )rB rrC )rD rrE )rF r0)rG rErH )rI r)rJ r0)rK rErL )rM rErN )rO rErP )rQ rErR )rS r)rT rrU )rV rrW )rX rrY )rZ r0)r[ rEr\ )r] r0)r^ rEr_ )r` rEra )rb rErc )rd rEre )rf rErg )rh rri )rj rrk )rl rrm )rn r)ro rErp )rq rErr )rs rErt )ru r)rv r0)rw rErx )ry rErz )r{ rEr| )r} rEr~ )r rEr )r rErr )r rr )r rr )r r)r rr)r r)r r-r )r r)r r0)r rEr )r r0)r rr )r r0)r r)r r0)r r)r rr)r r0)r rEr )r rEr )r r0)r rEr )r rEr )r r0)r rr )r r0)r rr )r r0)r rr )r rr )r rr )r r0)r rEr )r r0rrrrr_seg_20(sr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(N_ rr` ra rd e p rE0q rVr t 4u 5v 6w 7x 8y 9z +{ −| =} (~ ) r` r r rF rN rb rt ə rT rZ r\ r^ rd rj rl r0 rs !a/c!a/s!rJ!°c!!c/o!c/u!ɛ! !°f !rR !!ħ!!!!!no!!!rf!rh! !sm!!tel"!tm#!$!rx%!&!ω'!(!)!*!+!r,!rH-!.!/!1!rP2!3!4!5!א)r rr)r r)r r)r r)r r)r rEr )r rErV)r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rr )r rEr )r rr )r rr )r rr )r rEr`)r rEr )r rEr)r rEr)r rEr)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rr )r rEr )r rr )r rr )r rr )r r)r rErF)r rErN)r rErb)r rErt)r rEr )r rErT)r rErZ)r rEr\)r rEr^)r rEr`)r rErd)r rErj)r rErl)r r)r r0)r rEr )r r0)r r)r r0)r r)r rr )r rr )r rErJ)r rEr )r r0)r rr )r rr )r rEr )r r0)r rEr )r rErR)r rErT)r rEr )r rErV)r rEr\)r r0)r rEr`)r rEr )r r0)r rErd)r rErf)r rErh)r r0)r rEr )r rEr )r rEr )r r0)r rErx)r! r0)r" rEr# )r$ r0)r% rErx)r& r0)r' rErZ)r( rEr)r) rErH)r* rErJ)r+ r0)r, rErN)r- rErP)r. r)r/ rEr^)r0 rErb)r1 rEr2 rrrrr_seg_21sr3 cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(N6!rEב7!ג8!ד9!rV:!r0;!fax rEr? )r@ rErA )rB rEr? )rC rErD )rE r0)rF rErL)rG rErN)rH rErV)rI rErX)rJ r0)rK rErL )rM rErN )rO rErP )rQ rErR )rS rErT )rU rErV )rW rErX )rY rErZ )r[ rEr\ )r] rEr^ )r_ rEr` )ra rErb )rc rErd )re rErf )rg rErh )ri rErj )rk rErV)rl rErm )rn rEro )rp rErq )rr rErp)rs rErt )ru rErv )rw rErx )ry rErz )r{ rErt)r| rEr} )r~ rEr )r rEr\)r rErJ)r rErL)r rEr^)r rErV)r rErm )r rEro )r rErq )r rErp)r rErt )r rErv )r rErx )r rErz )r rErt)r rEr} )r rEr )r rEr\)r rErJ)r rErL)r rEr^)r r0)r r)r r0)r rEr )r r)r r0)r rEr )r rEr )r r0)r rEr )r rEr )r r0)r r)r r0)r r)r r0)r rEr )r rEr )r r0)r r)r r0)r r)r r0)r r)r rEr)r rEr)r rEr)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr rrrrr_seg_22sr cfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddgdS(Nl$rE13m$14n$15o$16p$17q$18r$19s$20t$r(1)u$(2)v$(3)w$(4)x$(5)y$(6)z$(7){$(8)|$(9)}$(10)~$(11)$(12)$(13)$(14)$(15)$(16)$(17)$(18)$(19)$(20)$r$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)$(k)$(l)$(m)$(n)$(o)$(p)$(q)$(r)$(s)$(t)$(u)$(v)$(w)$(x)$(y)$(z)$rF$rH$rJ$rL$rN$rP$rR$rT$rV$rX$rZ$r\$r^$r`$rb$rd$rf$rh$rj$rl$rn$rp$rr$rt$rv$rx$$$$$$$$$$$$$$$$$$$)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r r)r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr! )r" rr# )r$ rr% )r& rr' )r( rr) )r* rr+ )r, rr- )r. rr/ )r0 rErF)r1 rErH)r2 rErJ)r3 rErL)r4 rErN)r5 rErP)r6 rErR)r7 rErT)r8 rErV)r9 rErX)r: rErZ)r; rEr\)r< rEr^)r= rEr`)r> rErb)r? rErd)r@ rErf)rA rErh)rB rErj)rC rErl)rD rErn)rE rErp)rF rErr)rG rErt)rH rErv)rI rErx)rJ rErF)rK rErH)rL rErJ)rM rErL)rN rErN)rO rErP)rP rErR)rQ rErT)rR rErV)rS rErX)rT rErZ)rU rEr\)rV rEr^)rW rEr`)rX rErb)rY rErd)rZ rErf)r[ rErh)r\ rErjrrrrr_seg_23` sr] cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddddddgdS(N$rErl$rn$rp$rr$rt$rv$rx$r $r0'r' * ∫∫∫∫ *t*r::=u*==v*===w**⫝̸*M+P+Z+,ⰰ,ⰱ,ⰲ,ⰳ,ⰴ,ⰵ,ⰶ,ⰷ,ⰸ ,ⰹ ,ⰺ ,ⰻ ,ⰼ ,ⰽ,ⰾ,ⰿ,ⱀ,ⱁ,ⱂ,ⱃ,ⱄ,ⱅ,ⱆ,ⱇ,ⱈ,ⱉ,ⱊ,ⱋ,ⱌ,ⱍ,ⱎ,ⱏ ,ⱐ!,ⱑ",ⱒ#,ⱓ$,ⱔ%,ⱕ&,ⱖ',ⱗ(,ⱘ),ⱙ*,ⱚ+,ⱛ,,ⱜ-,ⱝ.,ⱞ/,0,_,`,ⱡa,b,ɫc,ᵽd,ɽe,g,ⱨh,i,ⱪj,k,ⱬl,m,ɑn,ɱo,ɐp,ɒq,r,ⱳs,u,ⱶv,|,rX},~,ȿ,ɀ,ⲁ,,ⲃ)r^ rErl)r_ rErn)r` rErp)ra rErr)rb rErt)rc rErv)rd rErx)re rEr )rf r0)rg r)rh r0)ri rErj )rk r0)rl rrm )rn rro )rp rrq )rr r0)rs rErt )ru r0)rv r)rw r0)rx r)ry rErz )r{ rEr| )r} rEr~ )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r r0)r r)r rEr )r r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0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrErrrrrr_seg_250 srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd gdS( N,r0,rEⳳ,,r,&-'-(---.-0-h-o-ⵡp-q--------------------<.....母..龟./一/丨/丶/丿/乙/亅/二/亠/人 /儿 /入 /八 /冂 /冖/冫/几/凵/刀/力/勹/匕/匚/匸/十/卜/卩/厂/厶/又/口/囗/土 /士!/夂"/夊#/夕$/大%/女&/子'/宀(/寸)/小*/尢+/尸,/屮-/山./巛//工0/己1/巾2/干3/幺4/广5/廴6/廾7/弋8/弓9/彐)rr0)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rrEr)rr0)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@rrrrr_seg_26 srAcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N:/rE彡;/彳/戶?/手@/支A/攴B/文C/斗D/斤E/方F/无G/日H/曰I/月J/木K/欠L/止M/歹N/殳O/毋P/比Q/毛R/氏S/气T/水U/火V/爪W/父X/爻Y/爿Z/片[/牙\/牛]/犬^/玄_/玉`/瓜a/瓦b/甘c/生d/用e/田f/疋g/疒h/癶i/白j/皮k/皿l/目m/矛n/矢o/石p/示q/禸r/禾s/穴t/立u/竹v/米w/糸x/缶y/网z/羊{/羽|/老}/而~/耒/耳/聿/肉/臣/自/至/臼/舌/舛/舟/艮/色/艸/虍/虫/血/行/衣/襾/見/角/言/谷/豆/豕/豸/貝/赤/走/足/身)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrEre)rfrErg)rhrEri)rjrErk)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr rrrrr_seg_27 sr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"gdS(#N/rE車/辛/辰/辵/邑/酉/釆/里/金/長/門/阜/隶/隹/雨/靑/非/面/革/韋/韭/音/頁/風/飛/食/首/香/馬/骨/高/髟/鬥/鬯/鬲/鬼/魚/鳥/鹵/鹿/麥/麻/黃/黍/黑/黹/黽/鼎/鼓/鼠/鼻/齊/齒/龍/龜/龠/r0rr0r00.060〒7080十90卄:0卅;0@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마)2(바)2(사)2(아)2(자)2(차)2(카)2(타)2(파)2(하)2(주)2(오전)2(오후)2r 2(一)!2(二)"2(三)#2(四)$2(五)%2(六)&2(七)'2(八)(2(九))2(十)*2(月)+2(火),2(水)-2(木).2(金)/2(土)02(日)12(株)22(有)32(社)42(名)52(特)62(財)72(祝)82(労)92(代):2(呼);2(学)<2(監)=2(企)>2(資)?2(協)@2(祭)A2(休)B2(自)C2(至)D2rE問E2幼F2文G2箏H2r0P2pteQ221R222S223T224U225V226W227X228Y229Z230[231\232]233^234_235`2ᄀa2ᄂb2ᄃc2ᄅd2ᄆe2ᄇf2ᄉg2ᄋh2ᄌi2ᄎj2ᄏk2ᄐl2ᄑm2ᄒn2가o2나)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrEr)rrEr)rrEr)r rEr )r r0)r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErKrrrrr_seg_308 srLcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.Np2rE다q2라r2마s2바t2사u2아v2자w2차x2카y2타z2파{2하|2참고}2주의~2우2r02一2二2三2四2五2六2七2八2九2十2月2火2水2木2金2土2日2株2有2社2名2特2財2祝2労2秘2男2女2適2優2印2注2項2休2写2正2上2中2下2左2右2医2宗2学2監2企2資2協2夜23623723823924024124224324424524624724824925021月22月23月24月25月26月27月28月29月210月211月212月2hg2erg2ev2ltd2ア2イ2ウ2エ)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkr0)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrEr)rrErrrrrr_seg_31 srcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N2rEオ2カ2キ2ク2ケ2コ2サ2シ2ス2セ2ソ2タ2チ2ツ2テ2ト2ナ2ニ2ヌ2ネ2ノ2ハ2ヒ2フ2ヘ2ホ2マ2ミ2ム2メ2モ2ヤ2ユ2ヨ2ラ2リ2ル2レ2ロ2ワ2ヰ2ヱ2ヲ2r3 アパート3 アルファ3 アンペア3 アール3 イニング3 インチ3 ウォン3エスクード3 エーカー 3 オンス 3 オーム 3 カイリ 3 カラット 3 カロリー3 ガロン3 ガンマ3ギガ3 ギニー3 キュリー3 ギルダー3キロ3キログラム3キロメートル3キロワット3 グラム3グラムトン3クルゼイロ3 クローネ3 ケース3 コルナ3 コーポ3 サイクル 3サンチーム!3 シリング"3 センチ#3 セント$3 ダース%3デシ&3ドル'3トン(3ナノ)3 ノット*3 ハイツ+3パーセント,3 パーツ-3 バーレル.3ピアストル/3 ピクル03ピコ13ビル23ファラッド33 フィート43ブッシェル53 フラン63ヘクタール73ペソ)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkr)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_32 srcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N83rE ペニヒ93 ヘルツ:3 ペンス;3 ページ<3 ベータ=3 ポイント>3 ボルト?3ホン@3 ポンドA3 ホールB3 ホーンC3 マイクロD3 マイルE3 マッハF3 マルクG3マンションH3 ミクロンI3ミリJ3ミリバールK3メガL3 メガトンM3 メートルN3 ヤードO3 ヤールP3 ユアンQ3 リットルR3リラS3 ルピーT3 ルーブルU3レムV3レントゲンW3 ワットX30点Y31点Z32点[33点\34点]35点^36点_37点`38点a39点b310点c311点d312点e313点f314点g315点h316点i317点j318点k319点l320点m321点n322点o323点p324点q3hpar3das3aut3baru3ovv3pcw3dmx3dm2y3dm3z3iu{3平成|3昭和}3大正~3明治3 株式会社3pa3na3μa3ma3ka3kb3mb3gb3cal3kcal3pf3nf3μf3μg3mg3kg3hz3khz3mhz3ghz3thz3μl3ml3dl3kl3fm3nm3μm)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErr)rsrErt)rurErv)rwrErx)ryrErz)r{rEr|)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_33p srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(gdS()N3rEmm3cm3km3mm23cm23m23km23mm33cm33m33km33m∕s3m∕s23rn3kpa3mpa3gpa3rad3rad∕s3rad∕s23ps3ns3μs3ms3pv3nv3μv3mv3kv33pw3nw3μw3mw3kw33kω3mω3r3bq3cc3cd3c∕kg33db3gy3ha3hp3in3kk33kt3lm3ln3log3lx3rz3mil3mol3ph33ppm3pr3sr3sv3wb3v∕m3a∕m31日32日33日34日35日36日37日38日39日310日311日312日313日314日315日316日317日318日319日320日321日322日323日324日325日326日327日328日329日330日331日3gal)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErn)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrErz)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrErerrrrr_seg_34 srfceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N4r0MrM͟鍤鐤ǤФ,@rEꙁABꙃCDꙅEFꙇGHꙉIJꙋKLꙍMNꙏOPꙑQRꙓSTꙕUVꙗWXꙙYZꙛ[\ꙝ]^ꙟ_`ꙡabꙣcdꙥefꙧghꙩijꙫklꙭm逦ꚁ遦邦ꚃ郦鄦ꚅ酦醦ꚇ釦鈦ꚉ鉦銦ꚋ鋦錦ꚍ鍦鎦ꚏ鏦鐦ꚑ鑦钦ꚓ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rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)r r0)r!rEr")r#r0)r$rEr%)r&r0)r'rEr()r)r0)r*rEr+)r,r0)r-rEr.)r/r0)r0rEr1)r2r0)r3rEr4)r5r0)r6rEr7)r8r0)r9rEr:)r;r0)r<rEr=)r>r0)r?rEr@)rAr0)rBrErC)rDr0)rErErF)rGr0)rHrErI)rJr0)rKrErL)rMr0)rNrErO)rPr0)rQrErO)rRr0)rSrErT)rUr0)rVrErW)rXr0)rYrErZ)r[rEr\)r]r0)r^rEr_)r`r0)rarErb)rcr0)rdrEre)rfr0)rgrErh)rir0)rjrErk)rlr0)rmrErn)ror0)rpr)rqrErr)rsr0)rtrEru)rvr0)rwr)rxrEry)rzr0)r{rEr|)r}r0)r~rEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr)rrErrrrrr_seg_36srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrEœr0,r0:@x逨ŨΨڨT_}逩Ωϩکީ7@NPZ\|逪ê۪  '(/豈更車賈滑串句龜 契 金 喇 奈 懶癩羅蘿螺裸邏樂洛烙珞落酪駱亂卵欄爛蘭 鸞!嵐"濫#藍$襤%拉&臘'蠟(廊)朗*浪+狼,郎-來)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_37srcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N.rE冷/勞0擄1櫓2爐3盧4老5蘆6虜7路8露9魯:鷺;碌<祿=綠>菉?錄@鹿A論B壟C弄D籠E聾F牢G磊H賂I雷J壘K屢L樓M淚N漏O累P縷Q陋R勒S肋T凜U凌V稜W綾X菱Y陵Z讀[拏\樂]諾^丹_寧`怒a率b異c北d磻e便f復g不h泌i數j索k參l塞m省n葉o說p殺q辰r沈s拾t若u掠v略w亮x兩y凉z梁{糧|良}諒~量勵呂女廬旅濾礪閭驪麗黎力曆歷轢年憐戀撚)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrEre)rfrErg)rhrEri)rjrErk)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_38xsrcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.NrE漣煉璉秊練聯輦蓮連鍊列劣咽烈裂說廉念捻殮簾獵令囹寧嶺怜玲瑩羚聆鈴零靈領例禮醴隸惡了僚寮尿料樂燎療蓼遼龍暈阮劉杻柳流溜琉留硫紐類六戮陸倫崙淪輪律慄栗率隆利吏履易李梨泥理痢罹裏裡里離匿溺吝燐璘藺隣鱗麟林淋)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErr)rsrErt)rurErv)rwrErx)ryrErz)r{rEr|)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_39srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'gdS((NrE臨立笠粒狀炙識什茶刺切度拓糖宅洞暴輻行 降 見 廓 兀 嗀r0塚晴凞猪益礼神祥福靖精羽 蘒!"諸#%逸&都'*飯+飼,館-鶴.郞/隷0侮1僧2免3勉4勤5卑6喝7嘆8器9塀:墨;層<屮=悔>慨?憎@懲A敏B既C暑D梅E海F渚G漢H煮I爫J琢K碑L社M祉N祈O祐P祖Q祝R禍S禎T穀U突V節W練X縉Y繁Z署[者\臭]艹_著)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErrrrrrr_seg_40HsrscfCs dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)gdS(*N`rE褐a視b謁c謹d賓e贈f辶g逸h難i響j頻k恵l𤋮m舘nrp並q况r全s侀t充u冀v勇w勺x喝y啕z喙{嗢|塚}墳~奄奔婢嬨廒廙彩徭惘慎愈憎慠懲戴揄搜摒敖晴朗望杖歹殺流滛滋漢瀞煮瞧爵犯猪瑱甆画瘝瘟益盛直睊着磌窱節类絛練缾者荒華蝹襁覆調諸請諾諭變輸遲醙)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rErw)r"rEr#)r$rEr%)r&rEr')r(rEry)r)rEr*)r+rEr,)r-rEr{)r.rEr/)r0rEr)r1rEr2)r3rEr4)r5rEr6rrrrr_seg_41sr7cfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'gdS((NrE鉶陼難靖韛響頋頻鬒龜𢡊𢡄𣏕㮝䀘䀹𥉉𥳐𧻓齃龎rfffiflffifflstմնմեմիվնմխיִr0ײַ ע!א"ד#ה$כ%ל&ם'ר(ת)rr *שׁ+שׂ,שּׁ-שּׂ.אַ/אָ0אּ1בּ2גּ3דּ4הּ5וּ6זּ78טּ9יּ:ךּ;כּ<לּ=>מּ?@נּAסּBCףּDפּEFצּGקּHרּIשּJתּKוֹLבֿMכֿNפֿOאלPٱRٻVپZڀ^ٺbٿfٹjڤnڦrڄvڃzچ~ڇڍ)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbr)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)ror)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzr)r{rEr|)r}r0)r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rr)rrEr)rrEr)rr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_42srcfCs&ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,gdS(-NrEڌڎڈژڑکگڳڱںڻۀہھےۓr0rڭۇۆۈۇٴۋۅۉېىئائەئوئۇئۆئۈئېئىیئجئحئمئيبجبحبخبم بى بي تج تح تختمتىتيثجثمثىثيجحجمحجحمخجخحخمسجسحسخسم صح!صم"ضج#ضح$ضخ%ضم&طح'طم(ظم)عج*عم+غج,غم-فج.فح/فخ0فم1فى2في3قح4قم5قى6قي7كا8كج9كح:كخ;كل<كم=كى>كي)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rr0)rr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErEr<)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrEre)rfrErg)rhrEri)rjrErk)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_43srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!gdS("N?rEلج@لحAلخBلمCلىDليEمجFمحGمخHممIمىJميKنجLنحMنخNنمOنىPنيQهجRهمSهىTهيUيجVيحWيخXيمYيىZيي[ذٰ\رٰ]ىٰ^r ٌّ_ ٍّ` َّa ُّb ِّc ّٰdئرeئزfئمgئنhئىiئيjبرkبزlبمmبنnبىoبيpترqتزrتمsتنtتىuتيvثرwثزxثمyثنzثى{ثي|فى}في~قىقيكاكلكمكىكيمانرنزننيريزينئجئحئخئهبجبحبخبهتجتح)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrr)rrr)rrr)rrr)rrr)rrr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrEr)rJrEr)rKrEr)rLrErM)rNrEr)rOrErP)rQrErR)rSrEr)rTrErU)rVrEr)rWrEr)rXrEr)rYrErZ)r[rEr\)r]rEr)r^rEr_)r`rEr)rarEr)rbrErc)rdrEre)rfrErg)rhrEr )rirErj)rkrErl)rmrErn)rorErp)rqrEr)rrrErs)rtrEru)rvrErwrrrrr_seg_44srxcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"gdS(#NrEتختمتهثمجحجمحجحمخجخمسجسحسخسمصحصخصمضجضحضخضمطحظمعجعمغجغمفجفحفخفمقحقمكجكحكخكلكملجلحلخلملهمجمحمخممنجنحنخنمنههجهمهٰيجيحيخيميهئمئهبمبهثهسهشمشهـَّـُّـِّطىطيعىعيغىغيسىسيشىشيحىحيجىجيخىخيصىصي)ryrErz)r{rEr|)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr|)rrEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr)r rEr)r rEr)r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5rrrrr_seg_45Psr6cfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddgdS(NrEضىضي شج شح شخ شم شرسرصرضرطىطيعىعيغىغيسىسيشىشيحىحيجىجيخى خي!صى"صي#$%&'()*+,-./01سه2شه3طم4سج5سح6سخ789:;ظم<اً>r0@rPتجمQتحجSتحمTتخمUتمجVتمحWتمخXجمحZحمي[حمى\سحج]سجح^سجى_سمحaسمجbسممdصححfصممgشحمiشجيjشمخlشممnضحىoضخمqطمحsطممtطميuعجمvعممxعمىyغممzغمي{غمى|فخم~قمحقمملحملحيلحىلججلخملمحمحجمحم)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorEr8)rprEr:)rqrEr<)rrrEr>)rsrEr@)rtrErB)rurErD)rvrErF)rwrErH)rxrErJ)ryrEr<)rzrEr>)r{rEr@)r|rErB)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr<)rrEr>)rrEr@)rrEr)rrEr)rrEr)rr0)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_46srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%gdS(&NrEمحيمجحمجممخجمخمrمجخهمجهممنحمنحىنجمنجىنمينمىيممبخيتجيتجىتخيتخىتميتمىجميجحىجمىسخىصحيشحيضحيلجيلمييحييجييميمميقمينحيقمحلحمعميكمينجحمخيلجمكممجحيحجيمجيفميبحيعجمصممسخينجيصلےقلےاللهاكبرمحمدصلعمرسولعليهوسلمصلىr!صلى الله عليه وسلمجل جلالهریالr0r,、:rl!?〖〗 '1—2–3_5r 6r 7{8}9〔:〕;【<】=《>》)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErD)rHrEr@)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErF)rTrErU)rVrErW)rXrErY)rZrEr[)r\r)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrrr)rsrrt)rurErv)rwr0)rxr)ryr)rzrr{)r|rEr})r~r)rrr)rrrl)rrr)rrr)rrEr)rrEr)rr)rr0)rr)rrEr)rrEr)rrr)rrr )rrr )rrr)rrr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_47 srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'gdS((N?rE〈@〉A「B」C『D』Er0Gr[H]I ̅MrPr{Q、RrTrlUrVrWrX—Yr Zr [r\r]〔^〕_#`&a*br c-dfr gh\i$j%k@lp ًqـًr ٌst ٍuv َwـَx ُyـُz ِ{ـِ| ّ}ـّ~ ْـْءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيلآلألإلاr")rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrr)rrr)rrr)rrr)rrr{)rrEr)rr)rrrl)rrr)rrr)rrr)rrEr)rrr )rrr )rrr)rrr)rrEr)rrEr)rrr)rrr)rrr)rrr )rrEr)rrr)rrr)rrr )rr)rrr)rrr)rrr)rrr)rr)rrr)rrEr)rrr)rr0)rrr)rr)rrr)rrEr)rrr)rrEr)rrr)rrEr)rrr)rrEr)rrr)rrEr)rrEr)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRr)rSr)rTr)rUrr)rVrrWrrrrr_seg_48srXcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddgdS(Nrrrrr'r r r r r{ rErr/r rrr r r r r r rrlrr rr r!rF"rH#rJ$rL%rN&rP'rR(rT)rV*rX+rZ,r\-r^.r`/rb0rd1rf2rh3rj4rl5rn6rp7rr8rt9rv:rx;r<r=r>^?r@rm ABCDEFGHIJKLMNOPQRSTUVWXYZ[r\|]r^~_⦅`⦆ab「c」d、e・fヲ)rYrr)rZrr)r[rr)r\rr)r]rr^)r_rr )r`rr )rarr)rbrr )rcrr{)rdrEr)rerEr)rfrrg)rhrEr )rirEr)rjrEr)rkrEr)rlrEr )rmrEr )rnrEr )rorEr )rprEr )rqrEr )rrrr)rsrrl)rtrr)rurr )rvrr)rwrr)rxrr)ryrErF)rzrErH)r{rErJ)r|rErL)r}rErN)r~rErP)rrErR)rrErT)rrErV)rrErX)rrErZ)rrEr\)rrEr^)rrEr`)rrErb)rrErd)rrErf)rrErh)rrErj)rrErl)rrErn)rrErp)rrErr)rrErt)rrErv)rrErx)rrr)rrr)rrr)rrr)rrr)rrrm )rrErF)rrErH)rrErJ)rrErL)rrErN)rrErP)rrErR)rrErT)rrErV)rrErX)rrErZ)rrEr\)rrEr^)rrEr`)rrErb)rrErd)rrErf)rrErh)rrErj)rrErl)rrErn)rrErp)rrErr)rrErt)rrErv)rrErx)rrr)rrr)rrr)rrr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_49srcfCs$dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+gdS(,NgrEァhィiゥjェkォlャmュnョoッpーqアrイsウtエuオvカwキxクyケzコ{サ|シ}ス~セソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚rᄀᄁᆪᄂᆬᆭᄃᄄᄅᆰᆱᆲᆳᆴᆵᄚᄆᄇᄈᄡᄉᄊᄋᄌᄍᄎᄏᄐᄑ하ᅢᅣᅤᅥᅦᅧᅨᅩᅪ)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr! )r" rEr# )r$ rEr% )r& rEr' )r( rEr) )r* rEr+ )r, rEr- )r. rEr/ )r0 rEr1 )r2 rEr3 )r4 rEr5 )r6 rEr7 )r8 rEr9 )r: rEr; )r< r)r= rEr> )r? rEr@ )rA rErB )rC rErD )rE rErF )rG rErH )rI rErJ )rK rErL )rM rErN )rO rErP )rQ rErR )rS rErT )rU rErV )rW rErX )rY rErZ )r[ rEr\ )r] rEr^ )r_ rEr` )ra rErb )rc rErd )re rErf )rg rErh )ri rErj )rk rErl )rm rErn )ro rErp )rq rErr )rs rErt )ru rErv )rw rErx )ry r)rz rEr{ )r| rEr} )r~ rEr )r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rEr rrrrr_seg_50Xsr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEᅫᅬrᅭᅮᅯᅰᅱᅲᅳᅴᅵ¢£¬r ̄¦¥₩│←↑→↓■○r0  '(;<>?NP^47 $0K𐐨𐐩𐐪𐐫𐐬𐐭𐐮𐐯𐐰 𐐱 𐐲 𐐳 𐐴 𐐵𐐶𐐷𐐸𐐹𐐺𐐻𐐼𐐽𐐾𐐿𐑀𐑁𐑂𐑃𐑄𐑅)r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rr )r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r !rEr !)r !rEr !)r !rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr !)r!!rEr"!)r#!rEr$!)r%!rEr&!)r'!rEr(!)r)!rEr*!rrrrr_seg_51sr+!ceCsdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrE𐑆𐑇 𐑈!𐑉"𐑊#𐑋$𐑌%𐑍&𐑎'𐑏(r0r  679<=?VW`   : ? @              4 8 ; ? H P Y `   6 9 V X s x   I `NRp56D o#$c$p$t$0/4)r,!rEr-!)r.!rEr/!)r0!rEr1!)r2!rEr3!)r4!rEr5!)r6!rEr7!)r8!rEr9!)r:!rEr;!)r!rEr?!)r@!r0)rA!r)rB!r0)rC!r)rD!r0)rE!r)rF!r0)rG!r)rH!r0)rI!r)rJ!r0)rK!r)rL!r0)rM!r)rN!r0)rO!r)r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h)r!rErj)r!rErl)r!rErn)r!rErp)r!rErr)r!rErt)r!rErv)r!rErx)r!rErF)r!rErH)r!rErJ)r!rErL)r!rErN)r!rErP)r!rErR)r!rErT)r!rErV)r!rErX)r!rErZ)r!rEr\)r!rEr^)r!rEr`)r!rErb)r!rErd)r!rErf)r!rErh)r!rErj)r!rErl)r!rErn)r!rErp)r!rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r "rErR)r "rErT)r "rErVrrrrr_seg_53sr "ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N=rErX>rZ?r\@r^Ar`BrbCrdDrfErhFrjGrlHrnIrpJrrKrtLrvMrxNrFOrHPrJQrLRrNSrPTrRUrVrVWXYZ[\]^_`abcdefghijklmnorTpqrstuvwxyz{|}~)r "rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r "rErJ)r!"rErL)r""rErN)r#"rErP)r$"rErR)r%"r)r&"rErV)r'"rErX)r("rErZ)r)"rEr\)r*"rEr^)r+"rEr`)r,"rErb)r-"rErd)r."rErf)r/"rErh)r0"rErj)r1"rErl)r2"rErn)r3"rErp)r4"rErr)r5"rErt)r6"rErv)r7"rErx)r8"rErF)r9"rErH)r:"rErJ)r;"rErL)r<"rErN)r="rErP)r>"rErR)r?"rErT)r@"rErV)rA"rErX)rB"rErZ)rC"rEr\)rD"rEr^)rE"rEr`)rF"rErb)rG"rErd)rH"rErf)rI"rErh)rJ"rErj)rK"rErl)rL"rErn)rM"rErp)rN"rErr)rO"rErt)rP"rErv)rQ"rErx)rR"rErF)rS"rErH)rT"rErJ)rU"rErL)rV"rErN)rW"rErP)rX"rErR)rY"rErT)rZ"rErV)r["rErX)r\"rErZ)r]"rEr\)r^"rEr^)r_"rEr`)r`"rErb)ra"rErd)rb"rErf)rc"rErh)rd"rErj)re"rErl)rf"rErn)rg"rErp)rh"rErr)ri"rErt)rj"rErv)rk"rErx)rl"rErF)rm"r)rn"rErJ)ro"rErL)rp"rrrrrr_seg_54srq"cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErRrrXrZr`rbrdrfrjrlrnrprrrtrvrxrFrHrJrLrPrTrVr\r^rhrN)rr"rErR)rs"r)rt"rErX)ru"rErZ)rv"r)rw"rEr`)rx"rErb)ry"rErd)rz"rErf)r{"r)r|"rErj)r}"rErl)r~"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"r)r"rErP)r"r)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"r)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r"rErR)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r"rErR)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"r)r"rErLrrrrr_seg_55`sr"cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErN rP rR r rXrZr\r^r`rbrdrfrjrlrnrprrrtrvrFrH rJ!rL"#$%rT&rV'()*+,-./rh01234567rx89:;<=>?@ABCDEFGJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn)r"rErN)r"rErP)r"rErR)r"r)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"r)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"r)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r"rErR)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#r)r #rErL)r #rErN)r #rErP)r #rErR)r #r)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#r)r#rErb)r#r)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#r)r#rErF)r#rErH)r #rErJ)r!#rErL)r"#rErN)r##rErP)r$#rErR)r%#rErT)r&#rErV)r'#rErX)r(#rErZ)r)#rEr\)r*#rEr^)r+#rEr`)r,#rErb)r-#rErd)r.#rErf)r/#rErh)r0#rErj)r1#rErl)r2#rErn)r3#rErp)r4#rErr)r5#rErt)r6#rErv)r7#rErx)r8#rErF)r9#rErH)r:#rErJrrrrr_seg_56sr;#cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NorErLprNqrPrrRsrTtrVurXvrZwr\xr^yr`zrb{rd|rf}rh~rjrlrnrprrrtrvrxrFrHrJ)r<#rErL)r=#rErN)r>#rErP)r?#rErR)r@#rErT)rA#rErV)rB#rErX)rC#rErZ)rD#rEr\)rE#rEr^)rF#rEr`)rG#rErb)rH#rErd)rI#rErf)rJ#rErh)rK#rErj)rL#rErl)rM#rErn)rN#rErp)rO#rErr)rP#rErt)rQ#rErv)rR#rErx)rS#rErF)rT#rErH)rU#rErJ)rV#rErL)rW#rErN)rX#rErP)rY#rErR)rZ#rErT)r[#rErV)r\#rErX)r]#rErZ)r^#rEr\)r_#rEr^)r`#rEr`)ra#rErb)rb#rErd)rc#rErf)rd#rErh)re#rErj)rf#rErl)rg#rErn)rh#rErp)ri#rErr)rj#rErt)rk#rErv)rl#rErx)rm#rErF)rn#rErH)ro#rErJ)rp#rErL)rq#rErN)rr#rErP)rs#rErR)rt#rErT)ru#rErV)rv#rErX)rw#rErZ)rx#rEr\)ry#rEr^)rz#rEr`)r{#rErb)r|#rErd)r}#rErf)r~#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErvrrrrr_seg_570sr#cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErxrFrHrJrLrNrPrRrTrVrXrZr\r^r`rbrdrfrhrjrlrnrprrrtrv      !"#$%&'()*+,-./0123456)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r$rErf)r$rErh)r$rErj)r$rErl)r$rErnrrrrr_seg_58sr$cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N7rErp8rr9rt:rv;rx<rF=rH>rJ?rL@rNArPBrRCrTDrVErXFrZGr\Hr^Ir`JrbKrdLrfMrhNrjOrlPrnQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~)r$rErp)r$rErr)r$rErt)r $rErv)r $rErx)r $rErF)r $rErH)r $rErJ)r$rErL)r$rErN)r$rErP)r$rErR)r$rErT)r$rErV)r$rErX)r$rErZ)r$rEr\)r$rEr^)r$rEr`)r$rErb)r$rErd)r$rErf)r$rErh)r$rErj)r$rErl)r$rErn)r $rErp)r!$rErr)r"$rErt)r#$rErv)r$$rErx)r%$rErF)r&$rErH)r'$rErJ)r($rErL)r)$rErN)r*$rErP)r+$rErR)r,$rErT)r-$rErV)r.$rErX)r/$rErZ)r0$rEr\)r1$rEr^)r2$rEr`)r3$rErb)r4$rErd)r5$rErf)r6$rErh)r7$rErj)r8$rErl)r9$rErn)r:$rErp)r;$rErr)r<$rErt)r=$rErv)r>$rErx)r?$rErF)r@$rErH)rA$rErJ)rB$rErL)rC$rErN)rD$rErP)rE$rErR)rF$rErT)rG$rErV)rH$rErX)rI$rErZ)rJ$rEr\)rK$rEr^)rL$rEr`)rM$rErb)rN$rErd)rO$rErf)rP$rErh)rQ$rErj)rR$rErl)rS$rErn)rT$rErp)rU$rErr)rV$rErt)rW$rErv)rX$rErx)rY$rErF)rZ$rErH)r[$rErJ)r\$rErL)r]$rErN)r^$rErP)r_$rErR)r`$rErT)ra$rErV)rb$rErX)rc$rErZ)rd$rEr\)re$rEr^)rf$rEr`)rg$rErb)rh$rErd)ri$rErfrrrrr_seg_59srj$cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErhrjrlrnrprrrtrvrxıȷrαβγδεζηθικλμνξοπρστυφχψω∇∂)rk$rErh)rl$rErj)rm$rErl)rn$rErn)ro$rErp)rp$rErr)rq$rErt)rr$rErv)rs$rErx)rt$rEru$)rv$rErw$)rx$r)ry$rErz$)r{$rEr|$)r}$rEr~$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rErz$)r$rEr|$)r$rEr~$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rErz$)r$rEr|$)r$rEr~$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rErz$)r$rEr|$)r$rEr~$)r$rEr$)r$rEr$rrrrr_seg_60hsr$cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrEζηθικλμν ξ ο π ρ στυφχψω∂εαβγδ !"#$%&'()*+,-./012345∇6789:;<=>?@ABCDEFG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%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErn%)r%rErp%)r%rErr%)r%rErt%)r%rErv%)r%rErx%)r%rErz%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rErt%)r%rEr%)r%rEr%)r%rEr~%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rErn%)r%rErp%)r%rErr%)r%rErt%)r%rErv%)r%rErx%)r%rErz%)r%rEr|%)r%rEr~%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErn%)r%rErp%)r%rErr%)r%rErt%)r%rErv%)r%rErx%)r%rErz%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rErt%)r%rEr%)r%rEr%)r%rEr%)r%r)r%rEr rrrrr_seg_628sr%cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErrrr r r r r r r rابجدوزحط ي ك ل م نسعفصقرشتثخذضظغٮںڡٯ !"#$ه%'()*+,-./012)r%rEr)r%rEr)r%rEr)r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr)r%rEr)r%rEr)r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr)r&rEr)r&rEr)r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r &rEr)r &rEr)r &rEr)r &rEr )r &rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr)r&rEr)r&rEr)r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&r)r&rEr&)r&rEr &)r!&rEr"&)r#&rEr$&)r%&r)r&&rEr'&)r(&rEr)&)r*&rEr+&)r,&rEr-&)r.&rEr/&)r0&rEr1&)r2&rEr3&)r4&rEr5&)r6&rEr7&)r8&rEr9&)r:&rEr;&)r<&rEr=&)r>&rEr?&)r@&rErA&)rB&rErC&)rD&rErE&)rF&rErG&)rH&rErI&)rJ&rErK&)rL&rErM&)rN&rErO&)rP&rErQ&)rR&rErS&)rT&rErU&)rV&rErW&)rX&rErY&)rZ&rEr[&)r\&r)r]&rEr &)r^&rEr"&)r_&r)r`&rEra&)rb&r)rc&rEr+&)rd&r)re&rEr/&)rf&rEr1&)rg&rEr3&)rh&rEr5&)ri&rEr7&)rj&rEr9&)rk&rEr;&)rl&rEr=&)rm&rEr?&)rn&rErA&rrrrr_seg_63sro&ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N3r4rEش5ت6ث7خ89ض:;غ<BجCGحHIيJKلLMنNسOعPQصRقSTUWXYZ[\]ں^_ٯ`aبbcdهeghطijكklمmnopفqrstuvwxyzظ{|ٮ}~ڡادوزرذ)rp&r)rq&rErr&)rs&rErt&)ru&rErv&)rw&rErx&)ry&r)rz&rEr{&)r|&r)r}&rEr~&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&r)r&rEr&)r&rEr&)r&r)r&rErr&)r&r)r&rErx&)r&r)r&rEr{&)r&r)r&rEr~&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r&rErr&)r&rErt&)r&rErv&)r&rErx&)r&r)r&rEr{&)r&rEr&)r&rEr~&)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rErr&)r&rErt&)r&rErv&)r&rErx&)r&rEr&)r&rEr{&)r&rEr&)r&rEr~&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rrrrrr_seg_64sr&cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddddddddgdS(NrEوزحطيrلمنسعفصقرشتثخذضظغr0,0r0,1,2,3,4,5,6,7, 8, 9, (a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p) (q)!(r)"(s)#(t)$(u)%(v)&(w)'(x)((y))(z)*〔s〕+rJ,rh-r.wz/0rF1rH23rL4rN5rP6rR7rT8rV9rX:rZ;r\<r^=r`>rb?rd@rfABrj)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r'rEr')r'rEr')r'rEr')r'rEr')r'rEr ')r 'rEr ')r 'rEr ')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r 'rEr!')r"'r)r#'r0)r$'r)r%'r0)r&'r)r''r0)r('r)r)'r0)r*'r)r+'r0)r,'r)r-'r0)r.'r)r/'r0)r0'r)r1'rr2')r3'rr4')r5'rr6')r7'rr8')r9'rr:')r;'rr<')r='rr>')r?'rr@')rA'rrB')rC'rrD')rE'r)rF'rrG')rH'rrI')rJ'rrK')rL'rrM')rN'rrO')rP'rrQ')rR'rrS')rT'rrU')rV'rrW')rX'rrY')rZ'rr[')r\'rr]')r^'rr_')r`'rra')rb'rrc')rd'rre')rf'rrg')rh'rri')rj'rrk')rl'rrm')rn'rro')rp'rrq')rr'rrs')rt'rru')rv'rrw')rx'rry')rz'rEr{')r|'rErJ)r}'rErh)r~'rEr)r'rEr')r'r)r'rErF)r'rErH)r'rErJ)r'rErL)r'rErN)r'rErP)r'rErR)r'rErT)r'rErV)r'rErX)r'rErZ)r'rEr\)r'rEr^)r'rEr`)r'rErb)r'rErd)r'rErf)r'rErh)r'rErjrrrrr_seg_65psr'ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddgdS(NCrErlDrnErpFrrGrtHrvIrxJhvKrLsdMr.NppvOwcPr0jmckmdlrpdjほかココサ手字双デ二多解天交映無料前後再新 初!終"生#販$声%吹&演'投(捕)一*三+遊,左-中.右/指0走1打2禁3空4合5満6有7月8申9割:営;@ 〔本〕A 〔三〕B 〔二〕C 〔安〕D 〔点〕E 〔打〕F 〔盗〕G 〔勝〕H 〔敗〕IP得Q可R!067}?@)r'rErl)r'rErn)r'rErp)r'rErr)r'rErt)r'rErv)r'rErx)r'rEr')r'rEr)r'rEr')r'rEr.)r'rEr')r'rEr')r'r0)r'rEr')r'rEr')r'r)r'r0)r'rEr')r'r0)r'r)r'r0)r'rEr')r'rEr')r'rEr')r'r)r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r(rEr()r(rEr()r(rEr()r(rEr()r(rEr ()r (rEr ()r (rEr ()r(rEr()r(r)r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr ()r!(rEr"()r#(r)r$(rEr%()r&(rEr'()r((r)r)(r0)r*(r)r+(r0)r,(r)r-(r0)r.(r)r/(r0)r0(r)r1(r0)r2(r)r3(r0)r4(r)r5(r0)r6(r)r7(r0)r8(r)r9(r0rrrrr_seg_66sr:(cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddgdS(NArBr0>@DPhAEPtצ5@rE丽丸乁𠄢你侮侻倂偺 備 僧 像 㒞 𠘺免兔兤具𠔜㒹內再𠕋冗冤仌冬况𩇟凵刃㓟 刻!剆"割#剷$㔕%勇&勉'勤(勺)包*匆+北,卉-卑.博/即0卽1卿4𠨬5灰6及7叟8𠭣9叫:叱;吆<咞=吸>呈?周@咢A哶B唐C啓D啣E善G喙H喫I喳J嗂K圖L嘆M圗)r;(r)r<(r0)r=(r)r>(r0)r?(r)r@(r0)rA(r)rB(r0)rC(r)rD(r0)rE(r)rF(r0)rG(r)rH(r0)rI(r)rJ(r0)rK(r)rL(r0)rM(r)rN(r0)rO(r)rP(r0)rQ(r)rR(r0)rS(r)rT(rErU()rV(rErW()rX(rErY()rZ(rEr[()r\(rEr]()r^(rEr_()r`(rEra()rb(rErc()rd(rEre()rf(rErg()rh(rEri()rj(rErk()rl(rErm()rn(rEro()rp(rErq()rr(rErs()rt(rEru()rv(rErw()rx(rEry()rz(rEr{()r|(rEr}()r~(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr(rrrrr_seg_67@sr(cfCs$dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+gdS(,NNrE噑O噴P切Q壮R城S埴T堍U型V堲W報X墬Y𡓤Z売[壷\夆]多^夢_奢`𡚨a𡛪b姬c娛d娧e姘f婦g㛮hri嬈j嬾l𡧈m寃n寘o寧p寳q𡬘r寿s将tu尢v㞁w屠x屮y峀z岍{𡷤|嵃}𡷦~嵮嵫嵼巡巢㠯巽帨帽幩㡢𢆃㡼庰庳庶廊𪎒廾𢌱舁弢㣇𣊸𦇚形彫㣣徚忍志忹悁㤺㤜悔𢛔惇慈慌慎慺憎憲憤憯懞懲懶成戛扝)r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr))r)rEr))r)rEr))r)rEr))r)rEr))r )rEr ))r )rEr ))r )rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)r)r )rEr!))r")rEr#))r$)rEr%))r&)rEr'))r()rEr)))r*)rEr+))r,)rEr-))r.)rEr/))r0)rEr1))r2)rEr3))r4)r)r5)rEr6))r7)rEr8))r9)rEr:))r;)rEr<))r=)rEr>))r?)rEr@))rA)rErB))rC)rErD))rE)rErF))rG)rErH))rI)rErJ))rK)rErL))rM)rErN))rO)rErP))rQ)rErR))rS)rErT))rU)rErV))rW)rErX))rY)rErZ))r[)rEr\))r])rEr^))r_)rEr`))ra)rErb))rc)rErd))re)rErf))rg)rErh))ri)rErj))rk)rErl))rm)rErn))ro)rErp))rq)rErr))rs)rErt))ru)rErv))rw)rErx))ry)rErz))r{)rEr|))r})rEr~))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr)rrrrr_seg_68sr)cfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.NrE抱拔捐𢬌挽拼捨掃揤𢯱搢揅掩㨮摩摾撝摷㩬敏敬𣀊旣書晉㬙暑㬈㫤冒冕最暜肭䏙朗望朡杞杓𣏃㭉柺枅桒梅𣑭梎栟椔㮝楂榣槪檨𣚣櫛㰘次𣢧歔㱎歲殟殺殻𣪍𡴋𣫺汎𣲼沿泍汧洖派海流浩浸涅𣴞洴港 湮 㴳 滋 滇 𣻑淹潮𣽞𣾎濆瀹瀞瀛㶖灊災)r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r *rEr *)r *rEr *)r *rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr *)r!*rEr"*)r#*rEr$*)r%*rEr&*)r'*rEr(*)r)*rEr**)r+*rEr,*)r-*rEr.*)r/*rEr0*)r1*rEr2*)r3*rEr4*)r5*rEr6*)r7*rEr8*)r9*rEr:*)r;*rEr<*)r=*rEr>*)r?*rEr@*)rA*rErB*)rC*rErD*)rE*rErF*)rG*rErH*)rI*rErJ*)rK*rErL*)rM*rErN*)rO*rErP*)rQ*rErR*)rS*rErT*)rU*rErV*)rW*rErX*)rY*rErZ*)r[*rEr\*)r]*rEr^*)r_*rEr`*)ra*rErb*)rc*rErd*)re*rErf*)rg*rErh*)ri*rErj*)rk*rErl*)rm*rErn*)ro*rErp*)rq*rErr*)rs*rErt*)ru*rErv*)rw*rErx*rrrrr_seg_69sry*cfCs&ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,gdS(-NrE灷炭𠔥煅𤉣熜r 爨!爵"牐#𤘈$犀%犕&𤜵'𤠔(獺)王*㺬+玥,㺸.瑇/瑜0瑱1璅2瓊3㼛4甤5𤰶6甾7𤲒8異9𢆟:瘐;𤾡<𤾸=𥁄>㿼?䀈@直A𥃳B𥃲C𥄙D𥄳E眞F真H睊I䀹J瞋K䁆L䂖M𥐝N硎O碌P磌Q䃣R𥘦S祖T𥚚U𥛅V福W秫X䄯Y穀Z穊[穏\𥥼]𥪧_`䈂a𥮫b篆c築d䈧e𥲀f糒g䊠h糨i糣j紀k𥾆l絣m䌁n緇o縂p繅q䌴r𦈨s𦉇t䍙u𦋙v罺w𦌾x羕y翺z者{𦓚|𦔣}聠~𦖨聰)rz*rEr{*)r|*rEr}*)r~*rEr*)r*rEr*)r*rEr*)r*rEr*)r*r)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*r)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr +)r +rEr +)r +rEr +)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r +rEr!+)r"+rEr#+)r$+rEr%+)r&+rEr'+)r(+rEr)+)r*+rEr++)r,+rEr-+)r.+rEr/+)r0+rEr1+)r2+rEr3+)r4+rEr5+)r6+rEr7+)r8+rEr9+)r:+rEr;+)r<+rEr=+)r>+rEr?+rrrrr_seg_70xsr@+cfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.NrE𣍟䏕育脃䐋脾媵𦞧𦞵𣎓𣎜舁舄辞䑫芑芋芝劳花芳芽苦𦬼若茝荣莭茣莽菧著荓菊菌菜𦰶𦵫𦳕䔫蓱蓳蔖𧏊蕤𦼬䕝䕡𦾱𧃒䕫虐虜虧虩蚩蚈蜎蛢蝹蜨蝫螆r蟡蠁䗹衠衣𧙧裗裞䘵裺㒻𧢮𧥦䚾䛇誠諭變豕𧲨貫賁贛起𧼯𠠄跋趼跰𠣞軔輸𨗒𨗭邔郱)rA+rErB+)rC+rErD+)rE+rErF+)rG+rErH+)rI+rErJ+)rK+rErL+)rM+rErN+)rO+rErP+)rQ+rErR+)rS+rErT+)rU+rErV+)rW+rErX+)rY+rErZ+)r[+rEr\+)r]+rEr^+)r_+rEr`+)ra+rErb+)rc+rErd+)re+rErf+)rg+rErh+)ri+rErj+)rk+rErl+)rm+rErn+)ro+rErp+)rq+rErr+)rs+rErt+)ru+rErv+)rw+rErx+)ry+rErz+)r{+rEr|+)r}+rEr~+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+r)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r+rEr+)r,rEr,)r,rEr,)r,rEr,)r,rEr,rrrrr_seg_71sr,c=Cs|dydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddg,)r?,rEr@,)rA,rErB,)rC,rErD,)rE,rErF,)rG,rErH,)rI,rErJ,)rK,rErL,)rM,rErN,)rO,rErP,)rQ,rErR,)rS,rErT,)rU,rErV,)rW,rErX,)rY,rErZ,)r[,rEr\,)r],rEr^,)r_,rEr`,)ra,rErb,)rc,rErd,)re,rErf,)rg,rErh,)ri,rErj,)rk,rErl,)rm,rErn,)ro,rErp,)rq,rErr,)rs,rErt,)ru,rErv,)rw,rErx,)ry,rErz,)r{,r)r|,r)r},rrrrrr_seg_72Hsxr~,N)M__doc__ __version__rrrr-rrfrrrJrrbrr/rrrr9 r rm r r r3 r r] rrrAr rrrLrrrrfrrrrrrsr7rrrxr6rrrXrr r+!r!r "rq"r"r;#r#r$rj$r$rj%r%ro&r&r'r:(r(r)ry*r@+r,r~,tupleZ uts46datarrrrshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh@Iidna/__pycache__/compat.cpython-36.opt-1.pyc000064400000001036152347724720014554 0ustar003 Pf@s,ddlTddlTddZddZddZdS) )*cCst|S)N)encode)labelr/usr/lib/python3.6/compat.pyToASCIIsrcCst|S)N)decode)rrrr ToUnicodesr cCs tddS)Nz,IDNA 2008 does not utilise nameprep protocol)NotImplementedError)srrrnameprep sr N)Zcorecodecrr r rrrrsidna/__pycache__/codec.cpython-36.opt-1.pyc000064400000005725152347724720014357 0ustar003 Pf @sddlmZmZmZmZmZddlZddlZejdZ Gdddej Z Gdddej Z Gd d d ej ZGd d d e ejZGd dde ejZddZdS))encodedecodealabelulabel IDNAErrorNu [.。.。]c@s eZdZdddZdddZdS) CodecstrictcCs.|dkrtdj||sdSt|t|fS)Nr z Unsupported error handling "{0}"r)r r)rformatrlen)selfdataerrorsr/usr/lib/python3.6/codec.pyr s z Codec.encodecCs.|dkrtdj||sdSt|t|fS)Nr z Unsupported error handling "{0}"r r)r r)rr rr )r rrrrrrs z Codec.decodeN)r )r )__name__ __module__ __qualname__rrrrrrrs rc@seZdZddZdS)IncrementalEncoderc Cs|dkrtdj||sdStj|}d}|rV|dsDd}|d =n|sV|d =|rVd}g}d}x2|D]*}|jt||r|d7}|t|7}qdWdj||}|t|7}||fS) Nr z Unsupported error handling "{0}"r rr.)r rrr)rr _unicode_dots_resplitappendrr join) r rrfinallabels trailing_dotresultsizelabelrrr_buffer_encodes0   z!IncrementalEncoder._buffer_encodeN)rrrr"rrrrrsrc@seZdZddZdS)IncrementalDecoderc Cs|dkrtdj||sdSt|tr4tj|}nt|}t|d|jd}d}|r~|d sld}|d =n|s~|d =|r~d}g}d}x2|D]*}|jt||r|d7}|t |7}qWdj ||}|t |7}||fS) Nr z Unsupported error handling "{0}"r rasciirr)r rrrr) rr isinstanceZunicoderrstrrrr r) r rrrrrrr r!rrr_buffer_decode?s8      z!IncrementalDecoder._buffer_decodeN)rrrr'rrrrr#>sr#c@s eZdZdS) StreamWriterN)rrrrrrrr(gsr(c@s eZdZdS) StreamReaderN)rrrrrrrr)jsr)c Cs tjdtjtjttttdS)NZidna)namerrincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInforrrrr#r(r)rrrr getregentrymsr1)Zcorerrrrrr/recompilerrBufferedIncrementalEncoderrBufferedIncrementalDecoderr#r(r)r1rrrrs !)idna/__pycache__/core.cpython-36.opt-1.pyc000064400000021303152347724720014220 0ustar003 Pf~,@s>ddlmZddlZddlZddlZddlZddlmZdZdZ ej dZ ej ddkr`e ZeZGd d d eZGd d d eZGd ddeZGdddeZddZddZddZddZddZddZd7ddZd d!Zd"d#Zd$d%Zd&d'Z d8d(d)Z!d*d+Z"d,d-Z#d.d/Z$d9d1d2Z%d:d3d4Z&d;d5d6Z'dS)<)idnadataN)intranges_contain sxn--u [.。.。]c@seZdZdZdS) IDNAErrorz7 Base exception for all IDNA-encoding related problems N)__name__ __module__ __qualname____doc__r r /usr/lib/python3.6/core.pyrsrc@seZdZdZdS) IDNABidiErrorz= Exception when bidirectional requirements are not satisfied N)rr r r r r r r rsrc@seZdZdZdS)InvalidCodepointz> Exception when a disallowed or unallocated codepoint is used N)rr r r r r r r rsrc@seZdZdZdS)InvalidCodepointContextzE Exception when the codepoint is not valid in the context it is used N)rr r r r r r r rsrcCstjt|S)N) unicodedataZ combiningunichr)cpr r r _combining_class$srcCstt|tj|S)N)rordrscripts)rZscriptr r r _is_script'srcCs |jdS)Npunycode)encode)sr r r _punycode*srcCs dj|S)Nz U+{0:04X})format)rr r r _unot-srcCst|dkrdSdS)N?FT)len)labelr r r valid_label_length1s r!cCst||rdndkrdSdS)NFT)r)r trailing_dotr r r valid_string_length8sr%Fc Cspd}xJt|dD]<\}}tj|}|dkr>tdjt|||dkrd}PqW| r`| r`dStj|d }|dkr|d}n |d krd}ntd jt|d}d}xt|dD]\}}tj|}|r&|dkrtdj||dkrd}n|dkrd}|dkrZ|s|}n||krZtdq|dkr>tdj||dkrNd}q|dkrd}qW|sltddS)NFrz3Unknown directionality in label {0} at position {1}RALANTrLz>First codepoint in label {0} must be directionality L, R or ALENESCSETONBNNSMzHInvalid direction for codepoint at position {0} in a right-to-left labelz2Can not mix numeral types in a right-to-left labelzHInvalid direction for codepoint at position {0} in a left-to-right labelz0Label ends with illegal codepoint directionality)r'r(r))r'r() r'r(r)r+r,r-r.r/r0r1)r'r(r+r))r)r+)r*r+r,r-r.r/r0r1)r*r+) enumeraterZ bidirectionalrrrepr) r Z check_ltrZ bidi_labelidxr directionZrtlZ valid_endingZ number_typer r r check_bidi?sR          r6cCs"tj|dddkrtddS)NrMz0Label begins with an illegal combining characterT)rcategoryr)r r r r check_initial_combiner|sr9cCs<|dddkrtd|ddks0|d dkr8tdd S) Nz--z4Label has disallowed hyphens in 3rd and 4th positionr-rz)Label must not start or end with a hyphenT)r)r r r r check_hyphen_oks r>cCstjd||krtddS)NNFCz%Label must be in Normalization Form C)r normalizer)r r r r check_nfcsrAcCs:t||}|dkr|dkr:tt||dtkr:dSd}xTt|dd d D]@}tjjt||}|tdkrvqP|tdtdgkrPd}PqPW|sdSd}xVt|dt|D]@}tjjt||}|tdkrq|td tdgkrd}PqW|S|d kr2|dkr.tt||dtkr.dSdSdSdS) Ni rrTFTr*Dr'i r=r=)rr_virama_combining_classrangerZ joining_typesgetr)r poscp_valueokiZ joining_typer r r valid_contextjs<      rKcCst||}|dkrdd|ko.t|dknr`t||ddkr`t||ddkr`dSdS|dkr|t|dkrt|dkrt||ddSdS|d ks|d kr|dkrt||dd SdS|d krx<|D]4}|d krqt|ds t|ds t|drdSqWdSd|ko,dknrlx2|D]*}dt|koVdknr:dSq:WdSd|kodknrx2|D]*}dt|kodknrdSqWdSdS)NrrlTFiuZGreekiiZHebrewi0u・ZHiraganaZKatakanaZHani`iiii)rrr)r rGZ exceptionrHrr r r valid_contextos>  (  "      rNcCst|ttfr|jd}t|dkr,tdt|t|t|xt |D]\}}t |}t |t j drrqNqNt |t j drt||stdjt||dt|qNt |t j drt||std jt||dt|qNtd jt||dt|qNWt|dS) Nzutf-8rz Empty LabelZPVALIDZCONTEXTJz-Joiner {0} not allowed at position {1} in {2}rZCONTEXTOz0Codepoint {0} not allowed at position {1} in {2}z0Codepoint {0} at position {1} of {2} not allowed) isinstancebytes bytearraydecoderrrAr>r9r2rrrZcodepoint_classesrKrrrr3rNrr6)r rGrrHr r r check_labels&      "rScCsyN|jd}y t|Wn"tk r:tdj|YnXt|sLtd|Stk rbYnX|sptdt|}t|t|}t |}t|std|S)Nasciiz$The label {0} is not a valid A-labelzLabel too longzNo Input) rulabelrrr!UnicodeEncodeErrorunicoderSr_alabel_prefix)r r r r alabels(  rYc Cst|ttfs:y|jd}Wntk r8t||SX|j}|jtr^|t td}nt||j dS|j d}t||S)NrTr) rOrPrQrrVrSlower startswithrXrrR)r r r r rUs   rUTc Cs,ddlm}d}yxt|D]\}}t|}||dkr:|ntj||dfd}|d} t|dkrl|dnd} | d ks| d kr| s| d kr|r| dkr||7}q| dk r| d ks| d kr|s| d kr|r|| 7}q| d krtqWtjd|Stk r&t dj t ||dt |YnXdS)zBRe-map the characters in the string according to UTS46 processing.r) uts46datar&Zrr:NVrC3r7Ir?z0Codepoint {0} not allowed at position {1} in {2}) r\r2rbisectZ bisect_leftr IndexErrorrr@rrrr3) Zdomain std3_rules transitionalr\outputrGcharZ code_pointZuts46rowZstatusZ replacementr r r uts46_remap3s0       rhc Cst|ttfr|jd}|r(t|||}d}g}|r@|jd}n tj|}x|rb|d rb|d=qLW|sptd|d dkr|d =d}x|D]}|jt |qW|r|jd d j |}t ||std |S)NrTF.rz Empty domainrr&T.zDomain too longr=r=) rOrPrQrRrhsplit_unicode_dots_rerappendrYjoinr%) rstrictuts46rdrer$resultlabelsr r r r rOs0          rcCst|ttfr|jd}|r(t||d}d}g}|s@tj|}n |jd}x|rb|d rb|d=qLW|sptd|d s|d =d}x|D]}|jt |qW|r|jddj |S) NrTFrirz Empty domainrTr&r=r=) rOrPrQrRrhrmrlrrnrUro)rrprqrdr$rrrsr r r r rRls*       rR)F)F)TF)FFFF)FFF)(r&rrbrresysZ intrangesrrDrXcompilerm version_infostrrWchrr UnicodeErrorrrrrrrrrr!r%r6r9r>rArKrNrSrYrUrhrrRr r r r sB    = , )  idna/__pycache__/uts46data.cpython-36.pyc000064400000671047152347724720014170 0ustar003 Pfp@sdZdZddZddZddZdd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dBdCZ"dDdEZ#dFdGZ$dHdIZ%dJdKZ&dLdMZ'dNdOZ(dPdQZ)dRdSZ*dTdUZ+dVdWZ,dXdYZ-dZd[Z.d\d]Z/d^d_Z0d`daZ1dbdcZ2dddeZ3dfdgZ4dhdiZ5djdkZ6dldmZ7dndoZ8dpdqZ9drdsZ:dtduZ;dvdwZd|d}Z?d~dZ@ddZAddZBddZCddZDddZEddZFddZGddZHddZIddZJeKeeeeeeee e e e e eeeeeeeeeeeeeeeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;e<e=e>e?e@eAeBeCeDeEeFeGeHeIeJZLdS)zIDNA Mapping Table from UTS46.z6.3.0ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N3  !"#$%&'()*+,-V./0123456789:;<=>?@AMaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz[\]^_`abc)rr)rr)rr)rr)rr)rr)rr)r r)r r)r r)r r)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)r!r)r"r)r#r)r$r)r%r)r&r)r'r)r(r)r)r)r*r)r+r)r,r)r-r)r.r)r/r0)r1r0)r2r)r3r0)r4r0)r5r0)r6r0)r7r0)r8r0)r9r0)r:r0)r;r0)r<r0)r=r)r>r)r?r)r@r)rAr)rBr)rCr)rDrErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErr)rsrErt)rurErv)rwrErx)ryr)rzr)r{r)r|r)r}r)r~r)rr0)rr0)rr0rrr/usr/lib/python3.6/uts46data.py_seg_0srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Ndr0efghijklmnopqrstuvwxyz{r|}~X  ̈rErFI ̄2 ́μ ̧1rb1⁄41⁄23⁄4àáâãäåæç)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rrr)rr0)rr0)rr0)rr0)rr0)rr0)rr0)rrr)rr0)rrErF)rr0)rr0)rr)rr0)rrr)rr0)rr0)rrEr)rrEr)rrr)rrEr)rr0)rr0)rrr)rrEr)rrErb)rr0)rrEr)rrEr)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_1psrceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrEèéêëìíîïðñòóôõör0øùúûüýþDssāăąćĉ  ċ  č ďđēĕėęěĝğ ġ!"ģ#$ĥ%&ħ'(ĩ)*ī+)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,r-r.)r/r0)r0r0)r1r0)r2r0)r3r0)r4r0)r5r0)r6r0)r7r0)r8r0)r9r0)r:r0)r;r0)r<r0)r=r0)r>r0)r?r0)r@r0)rAr0)rBr0)rCr0)rDr0)rEr0)rFr0)rGr0)rHr0)rIr0)rJr0)rKr0)rLr0)rMr0)rNr0)rOrErP)rQr0)rRrErS)rTr0)rUrErV)rWr0)rXrErY)rZr0)r[rEr\)r]r0)r^rEr_)r`r0)rarErb)rcr0)rdrEre)rfr0)rgrErh)rir0)rjrErk)rlr0)rmrErn)ror0)rprErq)rrr0)rsrErt)rur0)rvrErw)rxr0)ryrErz)r{r0)r|rEr})r~r0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0rrrrr_seg_2srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(N,rEĭ-r0.į/0i̇12ij4ĵ56ķ79ĺ:;ļ<=ľ>?l·AłBCńDEņFGňHIʼnJŋKLōMNŏOPőQRœSTŕUVŗWXřYZś[\ŝ]^ş_`šabţcdťefŧghũijūklŭmnůopűqrųstŵuvŷwxÿyźz{ż|}ž~rjɓƃƅɔƈɖɗƌǝəɛƒɠ)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rr0)r rEr )r r0)r rErj)r r0)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rrEr)rrEr )r!r0)r"rEr#)r$rEr%)r&rEr')r(rEr))r*r0)r+rEr,rrrrr_seg_3@sr-cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEɣr0ɩɨƙɯɲɵơƣƥʀƨʃƭʈưʊʋƴƶʒƹƽdžljnjǎǐǒǔǖǘǚǜǟǡǣǥǧǩǫǭǯdzǵƕƿǹǻǽǿ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rEr)rr0)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)rr0)r rEr!)r"r0)r#rEr$)r%r0)r&rEr')r(r0)r)rErT)r*rEr+)r,rErX)r-rErh)r.rEr/)r0rEr1)r2rEr3)r4rErr)r5rErv)r6r0)r7rr8)r9rr:)r;rr<)r=rr>)r?rr@)rArrB)rCr0)rDrErE)rFrEr\)rGrErj)rHrErt)rIrErJ)rKr0)rLrErM)rNrErO)rPr0)rQrErR)rSrErT)rUrErV)rWr0)rXr)rYr0)rZrEr[)r\r0)r]rEr^)r_r0)r`rEra)rbr0)rcrErd)rer0rrrrr_seg_5srfcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd gdS( Nxrzr ι{r0~; ́ ̈́rEά·έήίόύώαβγδεζηθικλμνξοπρστυφχψωϊϋr-ϗϙϛϝϟϡϣϥϧϩϫϭϯϸϻͻͼͽѐёђѓ)rgr)rhrri)rjr0)rkrrl)rmr)rnrro)rprrq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|r)r}rEr~)rr)rrEr)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rr-r)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_6xsrcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddgdS(NrEєѕіїј љ њ ћ ќ ѝўџабвгдежзийклмноп р!с"т#у$ф%х&ц'ч(ш)щ*ъ+ы,ь-э.ю/я0r0`ѡabѣcdѥefѧghѩijѫklѭmnѯopѱqrѳstѵuvѷwxѹyzѻ{|ѽ}~ѿҁҋҍҏґғҕҗҙқҝҟ)rrEr )r rEr )r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`r0)rarErb)rcr0)rdrEre)rfr0)rgrErh)rir0)rjrErk)rlr0)rmrErn)ror0)rprErq)rrr0)rsrErt)rur0)rvrErw)rxr0)ryrErz)r{r0)r|rEr})r~r0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrErrrrrr_seg_7srceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nr0rEҡңҥҧҩҫҭүұҳҵҷҹһҽҿrӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃ)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr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)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rrEr)rrEr)rrEr)rrEr)rr0)rrrrrrr_seg_9srceCsdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nr0rKM.0?@\^_ X rEक़Y ख़Z ग़[ ज़\ ड़] ढ़^ फ़_ य़` x y ড় ঢ় য়       ) * 1 2 3 ਲ਼4 5 6 ਸ਼7 8 : < = > C G I K N Q R Y ਖ਼Z ਗ਼[ ਜ਼\ ] ^ ਫ਼_ )rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrEr)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r!r)r"r0)r#r)r$r0)r%r)r&r0)r'r)r(r0)r)r)r*r0)r+r)r,r0)r-r)r.rEr/)r0rEr1)r2r)r3rEr4)r5r0)r6r)r7r0)r8r)r9r0)r:r)r;r0)r<r)r=r0)r>r)r?r0)r@r)rAr0)rBr)rCr0)rDrErE)rFr)rGr0)rHrErI)rJr)rKr0)rLr)rMr0)rNr)rOr0)rPr)rQr0)rRr)rSr0)rTr)rUr0)rVr)rWrErX)rYrErZ)r[rEr\)r]r0)r^r)r_rEr`)rarrrrrr_seg_10srbceCsdjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nf r0v r       ) * 1 2 4 5 : < E G I K N V X \ rEଡ଼] ଢ଼^ _ d f x       ) * 4 5 )rcr0)rdr)rer0)rfr)rgr0)rhr)rir0)rjr)rkr0)rlr)rmr0)rnr)ror0)rpr)rqr0)rrr)rsr0)rtr)rur0)rvr)rwr0)rxr)ryr0)rzr)r{r0)r|r)r}r0)r~r)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rrEr)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0rrrrr_seg_11srceCsdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N: r= r0E F I J N U W X Z ` d f p x       ; = E F I J O W X ` d f v y 3rEํา4;?\)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r r)r r0)r r)r r0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)r r)r!r0)r"r)r#r0)r$rEr%)r&r0)r'r)r(r0)r)r)r*r0)r+r)r,r0)r-r)r.r0rrrrr_seg_12sr/ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nrr0rEໍາຫນຫມ ་ CགྷDHIMཌྷNRདྷSWབྷX\ཛྷ]iཀྵjmqsཱིtuཱུvྲྀw ྲཱྀxླྀy ླཱྀzཱྀྒྷྜྷྡྷྦྷྫྷྐྵⴧⴭნ_aIJNPWX)r0r)r1r0)r2r)r3r0)r4r)r5r0)r6r)r7r0)r8r)r9r0)r:r)r;r0)r<r)r=r0)r>r)r?r0)r@r)rAr0)rBrErC)rDr0)rEr)rFr0)rGr)rHr0)rIr)rJr0)rKr)rLr0)rMr)rNr0)rOr)rPrErQ)rRrErS)rTr0)rUr)rVr0)rWrErX)rYr0)rZrEr[)r\r0)r]r)r^r0)r_rEr`)rar0)rbrErc)rdr0)rerErf)rgr0)rhrEri)rjr0)rkrErl)rmr0)rnr)ror0)rprErq)rrr0)rsrErt)rurErv)rwrErx)ryrErz)r{rEr|)r}r0)r~rEr)rr0)rrEr)rr0)rr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rr)rrEr)rr)rr0)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0rrrrr_seg_13PsrceCsdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NYrZr0^`[]}  7@T`mnqrt r x ,0<@ADnpu_`})rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r r)r r0)r r)r r0)rr)rr0)rr)rr0)rrrrrrr_seg_14srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(Nr0rLP}8;JM,rErF-r.rH/0rL1rN2ǝ3rR4rT5rV6rX7rZ8r\9r^:r`;<rb=ȣ>rd?rh@rlArnBrrCDɐEɑFᴂGHIJəKɛLɜMNOPQŋRSɔTᴖUᴗVWXYᴝZɯ[rp\ᴥ]β^γ_δ`φaχbcdefghρijkxнyɒrJɕrrPɟɡɥɨɩɪᵻʝɭ)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)r r0)r!r)r"r0)r#r)r$r0)r%r)r&r0)r'rErF)r(rEr)r)rErH)r*r0)r+rErL)r,rErN)r-rEr.)r/rErR)r0rErT)r1rErV)r2rErX)r3rErZ)r4rEr\)r5rEr^)r6rEr`)r7r0)r8rErb)r9rEr:)r;rErd)r<rErh)r=rErl)r>rErn)r?rErr)r@rErF)rArErB)rCrErD)rErErF)rGrErH)rHrErL)rIrErN)rJrErK)rLrErM)rNrErO)rPrErR)rQr0)rRrErZ)rSrEr^)rTrErU)rVrErb)rWrErX)rYrErZ)r[rEr\)r]rErd)r^rErl)r_rErn)r`rEra)rbrErc)rdrErp)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErV)rrrErh)rsrErn)rtrErp)rurErh)rvrErj)rwrErx)ryrErn)rzrErp)r{r0)r|rEr})r~r0)rrEr)rrErJ)rrEr)rrEr)rrErO)rrErP)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_15 srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEᶅʟɱɰɲɳɴɵɸʂʃƫʉʊᴜʋʌrxʐʑʒθr0rḁḃḅḇḉ  ḋ  ḍ ḏḑḓḕḗḙḛḝḟ ḡ!"ḣ#$ḥ%&ḧ'(ḩ)*ḫ+,ḭ-.ḯ/0ḱ12ḳ34ḵ56ḷ78ḹ9:ḻ;<ḽ=>ḿ?@ṁABṃCDṅEFṇGHṉIJṋ)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErx)rrEr)rrEr)rrEr)rrEr)rr0)rr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r! r0)r" rEr# )r$ r0)r% rEr& )r' r0)r( rEr) )r* r0)r+ rEr, )r- r0)r. rEr/ )r0 r0)r1 rEr2 )r3 r0)r4 rEr5 )r6 r0)r7 rEr8 rrrrr_seg_16sr9 ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NKr0LrEṍMNṏOPṑQRṓSTṕUVṗWXṙYZṛ[\ṝ]^ṟ_`ṡabṣcdṥefṧghṩijṫklṭmnṯopṱqrṳstṵuvṷwxṹyzṻ{|ṽ}~ṿẁẃẅẇẉẋẍẏẑẓẕaʾr.ạảấầẩẫậắằẳ)r: r0)r; rEr< )r= r0)r> rEr? )r@ r0)rA rErB )rC r0)rD rErE )rF r0)rG rErH )rI r0)rJ rErK )rL r0)rM rErN )rO r0)rP rErQ )rR r0)rS rErT )rU r0)rV rErW )rX r0)rY rErZ )r[ r0)r\ rEr] )r^ r0)r_ rEr` )ra r0)rb rErc )rd r0)re rErf )rg r0)rh rEri )rj r0)rk rErl )rm r0)rn rEro )rp r0)rq rErr )rs r0)rt rEru )rv r0)rw rErx )ry r0)rz rEr{ )r| r0)r} rEr~ )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r rErZ )r r0)r rEr.)r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0rrrrr_seg_17sr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEẵr0ặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿἀ ἁ ἂ ἃ ἄ ἅἆἇrἐἑἒἓἔἕ (ἠ)ἡ*ἢ+ἣ,ἤ-ἥ)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr! )r" r0)r# rEr$ )r% r0)r& rEr' )r( r0)r) rEr* )r+ r0)r, rEr- )r. r0)r/ rEr0 )r1 r0)r2 rEr3 )r4 r0)r5 rEr6 )r7 r0)r8 rEr9 )r: r0)r; rEr< )r= r0)r> rEr? )r@ r0)rA rErB )rC rErD )rE rErF )rG rErH )rI rErJ )rK rErL )rM rErN )rO rErP )rQ r0)rR r)rS rErT )rU rErV )rW rErX )rY rErZ )r[ rEr\ )r] rEr^ )r_ r)r` r0)ra rErb )rc rErd )re rErf )rg rErh )ri rErj )rk rErl rrrrr_seg_18Xsrm cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(N.rEἦ/ἧ0r08ἰ9ἱ:ἲ;ἳ<ἴ=ἵ>ἶ?ἷ@FrHὀIὁJὂKὃLὄMὅNPXYὑZ[ὓ\]ὕ^_ὗ`hὠiὡjὢkὣlὤmὥnὦoὧpqάrsέtuήvwίxyόz{ύ|}ώ~ἀιἁιἂιἃιἄιἅιἆιἇιἠιἡιἢιἣιἤιἥιἦιἧιὠιὡιὢιὣιὤιὥιὦιὧι)rn rEro )rp rErq )rr r0)rs rErt )ru rErv )rw rErx )ry rErz )r{ rEr| )r} rEr~ )r rEr )r rEr )r r0)r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r r0)r r)r rEr )r r)r rEr )r r)r rEr )r r)r rEr )r r0)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr rrrrr_seg_19sr ceCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddgdS(NrEὧιr0ὰιαιάιrᾶιᾰᾱὰάr ̓ι ͂ ̈͂ὴιηιήιῆιὲέὴή ̓̀ ̓́ ̓͂ΐῐῑὶί ̔̀ ̔́ ̔͂ΰῠῡὺύῥ ̈̀ ̈́`ὼιωιώιῶιὸόὼώ ́ ̔ r r r-   ‐   ̳ $ ' ( / 0 3 ′′4 ′′′5 6 ‵‵7 ‵‵‵8 < !!= >  ̅? G ??H ?!I !?J W ′′′′X )r rEr )r r0)r rEr )r rEr )r rEr )r r)r r0)r rEr )r rEr )r rEr )r rEr )r! rEr" )r# rEr )r$ rr% )r& rEr' )r( rr% )r) rr* )r+ rr, )r- rEr. )r/ rEr0 )r1 rEr2 )r3 r)r4 r0)r5 rEr6 )r7 rEr8 )r9 rEr: )r; rEr< )r= rEr> )r? rEr0 )r@ rrA )rB rrC )rD rrE )rF r0)rG rErH )rI r)rJ r0)rK rErL )rM rErN )rO rErP )rQ rErR )rS r)rT rrU )rV rrW )rX rrY )rZ r0)r[ rEr\ )r] r0)r^ rEr_ )r` rEra )rb rErc )rd rEre )rf rErg )rh rri )rj rrk )rl rrm )rn r)ro rErp )rq rErr )rs rErt )ru r)rv r0)rw rErx )ry rErz )r{ rEr| )r} rEr~ )r rEr )r rErr )r rr )r rr )r r)r rr)r r)r r-r )r r)r r0)r rEr )r r0)r rr )r r0)r r)r r0)r r)r rr)r r0)r rEr )r rEr )r r0)r rEr )r rEr )r r0)r rr )r r0)r rr )r r0)r rr )r rr )r rr )r r0)r rEr )r r0rrrrr_seg_20(sr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(N_ rr` ra rd e p rE0q rVr t 4u 5v 6w 7x 8y 9z +{ −| =} (~ ) r` r r rF rN rb rt ə rT rZ r\ r^ rd rj rl r0 rs !a/c!a/s!rJ!°c!!c/o!c/u!ɛ! !°f !rR !!ħ!!!!!no!!!rf!rh! !sm!!tel"!tm#!$!rx%!&!ω'!(!)!*!+!r,!rH-!.!/!1!rP2!3!4!5!א)r rr)r r)r r)r r)r r)r rEr )r rErV)r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rr )r rEr )r rr )r rr )r rr )r rEr`)r rEr )r rEr)r rEr)r rEr)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rr )r rEr )r rr )r rr )r rr )r r)r rErF)r rErN)r rErb)r rErt)r rEr )r rErT)r rErZ)r rEr\)r rEr^)r rEr`)r rErd)r rErj)r rErl)r r)r r0)r rEr )r r0)r r)r r0)r r)r rr )r rr )r rErJ)r rEr )r r0)r rr )r rr )r rEr )r r0)r rEr )r rErR)r rErT)r rEr )r rErV)r rEr\)r r0)r rEr`)r rEr )r r0)r rErd)r rErf)r rErh)r r0)r rEr )r rEr )r rEr )r r0)r rErx)r! r0)r" rEr# )r$ r0)r% rErx)r& r0)r' rErZ)r( rEr)r) rErH)r* rErJ)r+ r0)r, rErN)r- rErP)r. r)r/ rEr^)r0 rErb)r1 rEr2 rrrrr_seg_21sr3 cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(N6!rEב7!ג8!ד9!rV:!r0;!fax rEr? )r@ rErA )rB rEr? )rC rErD )rE r0)rF rErL)rG rErN)rH rErV)rI rErX)rJ r0)rK rErL )rM rErN )rO rErP )rQ rErR )rS rErT )rU rErV )rW rErX )rY rErZ )r[ rEr\ )r] rEr^ )r_ rEr` )ra rErb )rc rErd )re rErf )rg rErh )ri rErj )rk rErV)rl rErm )rn rEro )rp rErq )rr rErp)rs rErt )ru rErv )rw rErx )ry rErz )r{ rErt)r| rEr} )r~ rEr )r rEr\)r rErJ)r rErL)r rEr^)r rErV)r rErm )r rEro )r rErq )r rErp)r rErt )r rErv )r rErx )r rErz )r rErt)r rEr} )r rEr )r rEr\)r rErJ)r rErL)r rEr^)r r0)r r)r r0)r rEr )r r)r r0)r rEr )r rEr )r r0)r rEr )r rEr )r r0)r r)r r0)r r)r r0)r rEr )r rEr )r r0)r r)r r0)r r)r r0)r r)r rEr)r rEr)r rEr)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr rrrrr_seg_22sr cfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddgdS(Nl$rE13m$14n$15o$16p$17q$18r$19s$20t$r(1)u$(2)v$(3)w$(4)x$(5)y$(6)z$(7){$(8)|$(9)}$(10)~$(11)$(12)$(13)$(14)$(15)$(16)$(17)$(18)$(19)$(20)$r$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)$(k)$(l)$(m)$(n)$(o)$(p)$(q)$(r)$(s)$(t)$(u)$(v)$(w)$(x)$(y)$(z)$rF$rH$rJ$rL$rN$rP$rR$rT$rV$rX$rZ$r\$r^$r`$rb$rd$rf$rh$rj$rl$rn$rp$rr$rt$rv$rx$$$$$$$$$$$$$$$$$$$)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r r)r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr )r rr! )r" rr# )r$ rr% )r& rr' )r( rr) )r* rr+ )r, rr- )r. rr/ )r0 rErF)r1 rErH)r2 rErJ)r3 rErL)r4 rErN)r5 rErP)r6 rErR)r7 rErT)r8 rErV)r9 rErX)r: rErZ)r; rEr\)r< rEr^)r= rEr`)r> rErb)r? rErd)r@ rErf)rA rErh)rB rErj)rC rErl)rD rErn)rE rErp)rF rErr)rG rErt)rH rErv)rI rErx)rJ rErF)rK rErH)rL rErJ)rM rErL)rN rErN)rO rErP)rP rErR)rQ rErT)rR rErV)rS rErX)rT rErZ)rU rEr\)rV rEr^)rW rEr`)rX rErb)rY rErd)rZ rErf)r[ rErh)r\ rErjrrrrr_seg_23` sr] cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddddddgdS(N$rErl$rn$rp$rr$rt$rv$rx$r $r0'r' * ∫∫∫∫ *t*r::=u*==v*===w**⫝̸*M+P+Z+,ⰰ,ⰱ,ⰲ,ⰳ,ⰴ,ⰵ,ⰶ,ⰷ,ⰸ ,ⰹ ,ⰺ ,ⰻ ,ⰼ ,ⰽ,ⰾ,ⰿ,ⱀ,ⱁ,ⱂ,ⱃ,ⱄ,ⱅ,ⱆ,ⱇ,ⱈ,ⱉ,ⱊ,ⱋ,ⱌ,ⱍ,ⱎ,ⱏ ,ⱐ!,ⱑ",ⱒ#,ⱓ$,ⱔ%,ⱕ&,ⱖ',ⱗ(,ⱘ),ⱙ*,ⱚ+,ⱛ,,ⱜ-,ⱝ.,ⱞ/,0,_,`,ⱡa,b,ɫc,ᵽd,ɽe,g,ⱨh,i,ⱪj,k,ⱬl,m,ɑn,ɱo,ɐp,ɒq,r,ⱳs,u,ⱶv,|,rX},~,ȿ,ɀ,ⲁ,,ⲃ)r^ rErl)r_ rErn)r` rErp)ra rErr)rb rErt)rc rErv)rd rErx)re rEr )rf r0)rg r)rh r0)ri rErj )rk r0)rl rrm )rn rro )rp rrq )rr r0)rs rErt )ru r0)rv r)rw r0)rx r)ry rErz )r{ rEr| )r} rEr~ )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r r0)r r)r rEr )r r0)r rEr )r rEr )r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r r0)r rEr )r rEr )r rEr )r rEr )r r0)r rEr )r r0)r rEr )r r0)r rErX)r rErp)r rEr )rrEr)rrEr)rr0)rrErrrrrr_seg_24 srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N,r0,rEⲅ,,ⲇ,,ⲉ,,ⲋ,,ⲍ,,ⲏ,,ⲑ,,ⲓ,,ⲕ,,ⲗ,,ⲙ,,ⲛ,,ⲝ,,ⲟ,,ⲡ,,ⲣ,,ⲥ,,ⲧ,,ⲩ,,ⲫ,,ⲭ,,ⲯ,,ⲱ,,ⲳ,,ⲵ,,ⲷ,,ⲹ,,ⲻ,,ⲽ,,ⲿ,,ⳁ,,ⳃ,,ⳅ,,ⳇ,,ⳉ,,ⳋ,,ⳍ,,ⳏ,,ⳑ,,ⳓ,,ⳕ,,ⳗ,,ⳙ,,ⳛ,,ⳝ,,ⳟ,,ⳡ,,ⳣ,,ⳬ,,ⳮ)rr0)r rEr )r r0)r rEr )rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)r r0)r!rEr")r#r0)r$rEr%)r&r0)r'rEr()r)r0)r*rEr+)r,r0)r-rEr.)r/r0)r0rEr1)r2r0)r3rEr4)r5r0)r6rEr7)r8r0)r9rEr:)r;r0)r<rEr=)r>r0)r?rEr@)rAr0)rBrErC)rDr0)rErErF)rGr0)rHrErI)rJr0)rKrErL)rMr0)rNrErO)rPr0)rQrErR)rSr0)rTrErU)rVr0)rWrErX)rYr0)rZrEr[)r\r0)r]rEr^)r_r0)r`rEra)rbr0)rcrErd)rer0)rfrErg)rhr0)rirErj)rkr0)rlrErm)rnr0)rorErp)rqr0)rrrErs)rtr0)rurErv)rwr0)rxrEry)rzr0)r{rEr|)r}r0)r~rEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrErrrrrr_seg_250 srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd gdS( N,r0,rEⳳ,,r,&-'-(---.-0-h-o-ⵡp-q--------------------<.....母..龟./一/丨/丶/丿/乙/亅/二/亠/人 /儿 /入 /八 /冂 /冖/冫/几/凵/刀/力/勹/匕/匚/匸/十/卜/卩/厂/厶/又/口/囗/土 /士!/夂"/夊#/夕$/大%/女&/子'/宀(/寸)/小*/尢+/尸,/屮-/山./巛//工0/己1/巾2/干3/幺4/广5/廴6/廾7/弋8/弓9/彐)rr0)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rrEr)rr0)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@rrrrr_seg_26 srAcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N:/rE彡;/彳/戶?/手@/支A/攴B/文C/斗D/斤E/方F/无G/日H/曰I/月J/木K/欠L/止M/歹N/殳O/毋P/比Q/毛R/氏S/气T/水U/火V/爪W/父X/爻Y/爿Z/片[/牙\/牛]/犬^/玄_/玉`/瓜a/瓦b/甘c/生d/用e/田f/疋g/疒h/癶i/白j/皮k/皿l/目m/矛n/矢o/石p/示q/禸r/禾s/穴t/立u/竹v/米w/糸x/缶y/网z/羊{/羽|/老}/而~/耒/耳/聿/肉/臣/自/至/臼/舌/舛/舟/艮/色/艸/虍/虫/血/行/衣/襾/見/角/言/谷/豆/豕/豸/貝/赤/走/足/身)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrEre)rfrErg)rhrEri)rjrErk)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr rrrrr_seg_27 sr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"gdS(#N/rE車/辛/辰/辵/邑/酉/釆/里/金/長/門/阜/隶/隹/雨/靑/非/面/革/韋/韭/音/頁/風/飛/食/首/香/馬/骨/高/髟/鬥/鬯/鬲/鬼/魚/鳥/鹵/鹿/麥/麻/黃/黍/黑/黹/黽/鼎/鼓/鼠/鼻/齊/齒/龍/龜/龠/r0rr0r00.060〒7080十90卄:0卅;0@0A0000 ゙0 ゚00より00コト11.111ᄀ21ᄁ31ᆪ41ᄂ51ᆬ61ᆭ71ᄃ81ᄄ91ᄅ:1ᆰ;1ᆱ<1ᆲ=1ᆳ>1ᆴ?1ᆵ@1ᄚA1ᄆB1ᄇC1ᄈD1ᄡ)r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarEr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rEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXr)rYr0)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrEre)rfrErg)rhrEri)rjrErk)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvr0)rwr)rxr0)ryr)rzr0)r{rr|)r}rr~)rrr)rrr)rrrrrrrr_seg_29 srcfCs*ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.gdS(/N2r(ᄇ)2(ᄉ)2(ᄋ)2(ᄌ) 2(ᄎ) 2(ᄏ) 2(ᄐ) 2(ᄑ) 2(ᄒ)2(가)2(나)2(다)2(라)2(마)2(바)2(사)2(아)2(자)2(차)2(카)2(타)2(파)2(하)2(주)2(오전)2(오후)2r 2(一)!2(二)"2(三)#2(四)$2(五)%2(六)&2(七)'2(八)(2(九))2(十)*2(月)+2(火),2(水)-2(木).2(金)/2(土)02(日)12(株)22(有)32(社)42(名)52(特)62(財)72(祝)82(労)92(代):2(呼);2(学)<2(監)=2(企)>2(資)?2(協)@2(祭)A2(休)B2(自)C2(至)D2rE問E2幼F2文G2箏H2r0P2pteQ221R222S223T224U225V226W227X228Y229Z230[231\232]233^234_235`2ᄀa2ᄂb2ᄃc2ᄅd2ᄆe2ᄇf2ᄉg2ᄋh2ᄌi2ᄎj2ᄏk2ᄐl2ᄑm2ᄒn2가o2나)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrEr)rrEr)rrEr)r rEr )r r0)r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErKrrrrr_seg_308 srLcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.Np2rE다q2라r2마s2바t2사u2아v2자w2차x2카y2타z2파{2하|2참고}2주의~2우2r02一2二2三2四2五2六2七2八2九2十2月2火2水2木2金2土2日2株2有2社2名2特2財2祝2労2秘2男2女2適2優2印2注2項2休2写2正2上2中2下2左2右2医2宗2学2監2企2資2協2夜23623723823924024124224324424524624724824925021月22月23月24月25月26月27月28月29月210月211月212月2hg2erg2ev2ltd2ア2イ2ウ2エ)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkr0)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrEr)rrErrrrrr_seg_31 srcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N2rEオ2カ2キ2ク2ケ2コ2サ2シ2ス2セ2ソ2タ2チ2ツ2テ2ト2ナ2ニ2ヌ2ネ2ノ2ハ2ヒ2フ2ヘ2ホ2マ2ミ2ム2メ2モ2ヤ2ユ2ヨ2ラ2リ2ル2レ2ロ2ワ2ヰ2ヱ2ヲ2r3 アパート3 アルファ3 アンペア3 アール3 イニング3 インチ3 ウォン3エスクード3 エーカー 3 オンス 3 オーム 3 カイリ 3 カラット 3 カロリー3 ガロン3 ガンマ3ギガ3 ギニー3 キュリー3 ギルダー3キロ3キログラム3キロメートル3キロワット3 グラム3グラムトン3クルゼイロ3 クローネ3 ケース3 コルナ3 コーポ3 サイクル 3サンチーム!3 シリング"3 センチ#3 セント$3 ダース%3デシ&3ドル'3トン(3ナノ)3 ノット*3 ハイツ+3パーセント,3 パーツ-3 バーレル.3ピアストル/3 ピクル03ピコ13ビル23ファラッド33 フィート43ブッシェル53 フラン63ヘクタール73ペソ)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkr)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_32 srcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N83rE ペニヒ93 ヘルツ:3 ペンス;3 ページ<3 ベータ=3 ポイント>3 ボルト?3ホン@3 ポンドA3 ホールB3 ホーンC3 マイクロD3 マイルE3 マッハF3 マルクG3マンションH3 ミクロンI3ミリJ3ミリバールK3メガL3 メガトンM3 メートルN3 ヤードO3 ヤールP3 ユアンQ3 リットルR3リラS3 ルピーT3 ルーブルU3レムV3レントゲンW3 ワットX30点Y31点Z32点[33点\34点]35点^36点_37点`38点a39点b310点c311点d312点e313点f314点g315点h316点i317点j318点k319点l320点m321点n322点o323点p324点q3hpar3das3aut3baru3ovv3pcw3dmx3dm2y3dm3z3iu{3平成|3昭和}3大正~3明治3 株式会社3pa3na3μa3ma3ka3kb3mb3gb3cal3kcal3pf3nf3μf3μg3mg3kg3hz3khz3mhz3ghz3thz3μl3ml3dl3kl3fm3nm3μm)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErr)rsrErt)rurErv)rwrErx)ryrErz)r{rEr|)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_33p srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(gdS()N3rEmm3cm3km3mm23cm23m23km23mm33cm33m33km33m∕s3m∕s23rn3kpa3mpa3gpa3rad3rad∕s3rad∕s23ps3ns3μs3ms3pv3nv3μv3mv3kv33pw3nw3μw3mw3kw33kω3mω3r3bq3cc3cd3c∕kg33db3gy3ha3hp3in3kk33kt3lm3ln3log3lx3rz3mil3mol3ph33ppm3pr3sr3sv3wb3v∕m3a∕m31日32日33日34日35日36日37日38日39日310日311日312日313日314日315日316日317日318日319日320日321日322日323日324日325日326日327日328日329日330日331日3gal)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErn)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr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0)rrEr)rr)rrErrrrrr_seg_36srcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrEœr0,r0:@x逨ŨΨڨT_}逩Ωϩکީ7@NPZ\|逪ê۪  '(/豈更車賈滑串句龜 契 金 喇 奈 懶癩羅蘿螺裸邏樂洛烙珞落酪駱亂卵欄爛蘭 鸞!嵐"濫#藍$襤%拉&臘'蠟(廊)朗*浪+狼,郎-來)rrEr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rr0)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_37srcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.N.rE冷/勞0擄1櫓2爐3盧4老5蘆6虜7路8露9魯:鷺;碌<祿=綠>菉?錄@鹿A論B壟C弄D籠E聾F牢G磊H賂I雷J壘K屢L樓M淚N漏O累P縷Q陋R勒S肋T凜U凌V稜W綾X菱Y陵Z讀[拏\樂]諾^丹_寧`怒a率b異c北d磻e便f復g不h泌i數j索k參l塞m省n葉o說p殺q辰r沈s拾t若u掠v略w亮x兩y凉z梁{糧|良}諒~量勵呂女廬旅濾礪閭驪麗黎力曆歷轢年憐戀撚)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrEre)rfrErg)rhrEri)rjrErk)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_38xsrcfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.NrE漣煉璉秊練聯輦蓮連鍊列劣咽烈裂說廉念捻殮簾獵令囹寧嶺怜玲瑩羚聆鈴零靈領例禮醴隸惡了僚寮尿料樂燎療蓼遼龍暈阮劉杻柳流溜琉留硫紐類六戮陸倫崙淪輪律慄栗率隆利吏履易李梨泥理痢罹裏裡里離匿溺吝燐璘藺隣鱗麟林淋)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErr)rsrErt)rurErv)rwrErx)ryrErz)r{rEr|)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_39srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'gdS((NrE臨立笠粒狀炙識什茶刺切度拓糖宅洞暴輻行 降 見 廓 兀 嗀r0塚晴凞猪益礼神祥福靖精羽 蘒!"諸#%逸&都'*飯+飼,館-鶴.郞/隷0侮1僧2免3勉4勤5卑6喝7嘆8器9塀:墨;層<屮=悔>慨?憎@懲A敏B既C暑D梅E海F渚G漢H煮I爫J琢K碑L社M祉N祈O祐P祖Q祝R禍S禎T穀U突V節W練X縉Y繁Z署[者\臭]艹_著)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrEr)rr0)rrEr)rr0)rrEr)rrEr)rr0)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrErrrrrrr_seg_40HsrscfCs dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)gdS(*N`rE褐a視b謁c謹d賓e贈f辶g逸h難i響j頻k恵l𤋮m舘nrp並q况r全s侀t充u冀v勇w勺x喝y啕z喙{嗢|塚}墳~奄奔婢嬨廒廙彩徭惘慎愈憎慠懲戴揄搜摒敖晴朗望杖歹殺流滛滋漢瀞煮瞧爵犯猪瑱甆画瘝瘟益盛直睊着磌窱節类絛練缾者荒華蝹襁覆調諸請諾諭變輸遲醙)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rErw)r"rEr#)r$rEr%)r&rEr')r(rEry)r)rEr*)r+rEr,)r-rEr{)r.rEr/)r0rEr)r1rEr2)r3rEr4)r5rEr6rrrrr_seg_41sr7cfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'gdS((NrE鉶陼難靖韛響頋頻鬒龜𢡊𢡄𣏕㮝䀘䀹𥉉𥳐𧻓齃龎rfffiflffifflstմնմեմիվնմխיִr0ײַ ע!א"ד#ה$כ%ל&ם'ר(ת)rr *שׁ+שׂ,שּׁ-שּׂ.אַ/אָ0אּ1בּ2גּ3דּ4הּ5וּ6זּ78טּ9יּ:ךּ;כּ<לּ=>מּ?@נּAסּBCףּDפּEFצּGקּHרּIשּJתּKוֹLבֿMכֿNפֿOאלPٱRٻVپZڀ^ٺbٿfٹjڤnڦrڄvڃzچ~ڇڍ)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbr)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)ror)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzr)r{rEr|)r}r0)r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rr)rrEr)rrEr)rr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_42srcfCs&ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,gdS(-NrEڌڎڈژڑکگڳڱںڻۀہھےۓr0rڭۇۆۈۇٴۋۅۉېىئائەئوئۇئۆئۈئېئىیئجئحئمئيبجبحبخبم بى بي تج تح تختمتىتيثجثمثىثيجحجمحجحمخجخحخمسجسحسخسم صح!صم"ضج#ضح$ضخ%ضم&طح'طم(ظم)عج*عم+غج,غم-فج.فح/فخ0فم1فى2في3قح4قم5قى6قي7كا8كج9كح:كخ;كل<كم=كى>كي)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rr0)rr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErEr<)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRrErS)rTrErU)rVrErW)rXrErY)rZrEr[)r\rEr])r^rEr_)r`rEra)rbrErc)rdrEre)rfrErg)rhrEri)rjrErk)rlrErm)rnrEro)rprErq)rrrErs)rtrEru)rvrErw)rxrEry)rzrEr{)r|rEr})r~rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_43srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!gdS("N?rEلج@لحAلخBلمCلىDليEمجFمحGمخHممIمىJميKنجLنحMنخNنمOنىPنيQهجRهمSهىTهيUيجVيحWيخXيمYيىZيي[ذٰ\رٰ]ىٰ^r ٌّ_ ٍّ` َّa ُّb ِّc ّٰdئرeئزfئمgئنhئىiئيjبرkبزlبمmبنnبىoبيpترqتزrتمsتنtتىuتيvثرwثزxثمyثنzثى{ثي|فى}في~قىقيكاكلكمكىكيمانرنزننيريزينئجئحئخئهبجبحبخبهتجتح)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrr)rrr)rrr)rrr)rrr)rrr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrEr)rJrEr)rKrEr)rLrErM)rNrEr)rOrErP)rQrErR)rSrEr)rTrErU)rVrEr)rWrEr)rXrEr)rYrErZ)r[rEr\)r]rEr)r^rEr_)r`rEr)rarEr)rbrErc)rdrEre)rfrErg)rhrEr )rirErj)rkrErl)rmrErn)rorErp)rqrEr)rrrErs)rtrEru)rvrErwrrrrr_seg_44srxcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"gdS(#NrEتختمتهثمجحجمحجحمخجخمسجسحسخسمصحصخصمضجضحضخضمطحظمعجعمغجغمفجفحفخفمقحقمكجكحكخكلكملجلحلخلملهمجمحمخممنجنحنخنمنههجهمهٰيجيحيخيميهئمئهبمبهثهسهشمشهـَّـُّـِّطىطيعىعيغىغيسىسيشىشيحىحيجىجيخىخيصىصي)ryrErz)r{rEr|)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr|)rrEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr)r rEr)r rEr)r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5rrrrr_seg_45Psr6cfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddgdS(NrEضىضي شج شح شخ شم شرسرصرضرطىطيعىعيغىغيسىسيشىشيحىحيجىجيخى خي!صى"صي#$%&'()*+,-./01سه2شه3طم4سج5سح6سخ789:;ظم<اً>r0@rPتجمQتحجSتحمTتخمUتمجVتمحWتمخXجمحZحمي[حمى\سحج]سجح^سجى_سمحaسمجbسممdصححfصممgشحمiشجيjشمخlشممnضحىoضخمqطمحsطممtطميuعجمvعممxعمىyغممzغمي{غمى|فخم~قمحقمملحملحيلحىلججلخملمحمحجمحم)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErH)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErT)rUrErV)rWrErX)rYrErZ)r[rEr\)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorEr8)rprEr:)rqrEr<)rrrEr>)rsrEr@)rtrErB)rurErD)rvrErF)rwrErH)rxrErJ)ryrEr<)rzrEr>)r{rEr@)r|rErB)r}rEr~)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr<)rrEr>)rrEr@)rrEr)rrEr)rrEr)rr0)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_46srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%gdS(&NrEمحيمجحمجممخجمخمrمجخهمجهممنحمنحىنجمنجىنمينمىيممبخيتجيتجىتخيتخىتميتمىجميجحىجمىسخىصحيشحيضحيلجيلمييحييجييميمميقمينحيقمحلحمعميكمينجحمخيلجمكممجحيحجيمجيفميبحيعجمصممسخينجيصلےقلےاللهاكبرمحمدصلعمرسولعليهوسلمصلىr!صلى الله عليه وسلمجل جلالهریالr0r,、:rl!?〖〗 '1—2–3_5r 6r 7{8}9〔:〕;【<】=《>》)rrEr)rrEr)rrEr)rrEr)rrEr)rr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr )r!rEr")r#rEr$)r%rEr&)r'rEr()r)rEr*)r+rEr,)r-rEr.)r/rEr0)r1rEr2)r3rEr4)r5rEr6)r7rEr8)r9rEr:)r;rEr<)r=rEr>)r?rEr@)rArErB)rCrErD)rErErF)rGrErD)rHrEr@)rIrErJ)rKrErL)rMrErN)rOrErP)rQrErR)rSrErF)rTrErU)rVrErW)rXrErY)rZrEr[)r\r)r]rEr^)r_rEr`)rarErb)rcrErd)rerErf)rgrErh)rirErj)rkrErl)rmrErn)rorErp)rqrrr)rsrrt)rurErv)rwr0)rxr)ryr)rzrr{)r|rEr})r~r)rrr)rrrl)rrr)rrr)rrEr)rrEr)rr)rr0)rr)rrEr)rrEr)rrr)rrr )rrr )rrr)rrr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_47 srcfCsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'gdS((N?rE〈@〉A「B」C『D』Er0Gr[H]I ̅MrPr{Q、RrTrlUrVrWrX—Yr Zr [r\r]〔^〕_#`&a*br c-dfr gh\i$j%k@lp ًqـًr ٌst ٍuv َwـَx ُyـُz ِ{ـِ| ّ}ـّ~ ْـْءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيلآلألإلاr")rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rr0)rrr)rrr)rrr)rrr)rrr{)rrEr)rr)rrrl)rrr)rrr)rrr)rrEr)rrr )rrr )rrr)rrr)rrEr)rrEr)rrr)rrr)rrr)rrr )rrEr)rrr)rrr)rrr )rr)rrr)rrr)rrr)rrr)rr)rrr)rrEr)rrr)rr0)rrr)rr)rrr)rrEr)rrr)rrEr)rrr)rrEr)rrr)rrEr)rrr)rrEr)rrEr)rrEr)rrEr)rrEr )r rEr )r rEr )rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr!)r"rEr#)r$rEr%)r&rEr')r(rEr))r*rEr+)r,rEr-)r.rEr/)r0rEr1)r2rEr3)r4rEr5)r6rEr7)r8rEr9)r:rEr;)r<rEr=)r>rEr?)r@rErA)rBrErC)rDrErE)rFrErG)rHrErI)rJrErK)rLrErM)rNrErO)rPrErQ)rRr)rSr)rTr)rUrr)rVrrWrrrrr_seg_48srXcfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddgdS(Nrrrrr'r r r r r{ rErr/r rrr r r r r r rrlrr rr r!rF"rH#rJ$rL%rN&rP'rR(rT)rV*rX+rZ,r\-r^.r`/rb0rd1rf2rh3rj4rl5rn6rp7rr8rt9rv:rx;r<r=r>^?r@rm ABCDEFGHIJKLMNOPQRSTUVWXYZ[r\|]r^~_⦅`⦆ab「c」d、e・fヲ)rYrr)rZrr)r[rr)r\rr)r]rr^)r_rr )r`rr )rarr)rbrr )rcrr{)rdrEr)rerEr)rfrrg)rhrEr )rirEr)rjrEr)rkrEr)rlrEr )rmrEr )rnrEr )rorEr )rprEr )rqrEr )rrrr)rsrrl)rtrr)rurr )rvrr)rwrr)rxrr)ryrErF)rzrErH)r{rErJ)r|rErL)r}rErN)r~rErP)rrErR)rrErT)rrErV)rrErX)rrErZ)rrEr\)rrEr^)rrEr`)rrErb)rrErd)rrErf)rrErh)rrErj)rrErl)rrErn)rrErp)rrErr)rrErt)rrErv)rrErx)rrr)rrr)rrr)rrr)rrr)rrrm )rrErF)rrErH)rrErJ)rrErL)rrErN)rrErP)rrErR)rrErT)rrErV)rrErX)rrErZ)rrEr\)rrEr^)rrEr`)rrErb)rrErd)rrErf)rrErh)rrErj)rrErl)rrErn)rrErp)rrErr)rrErt)rrErv)rrErx)rrr)rrr)rrr)rrr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrErrrrrr_seg_49srcfCs$dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+gdS(,NgrEァhィiゥjェkォlャmュnョoッpーqアrイsウtエuオvカwキxクyケzコ{サ|シ}ス~セソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚rᄀᄁᆪᄂᆬᆭᄃᄄᄅᆰᆱᆲᆳᆴᆵᄚᄆᄇᄈᄡᄉᄊᄋᄌᄍᄎᄏᄐᄑ하ᅢᅣᅤᅥᅦᅧᅨᅩᅪ)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)rrEr)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr! )r" rEr# )r$ rEr% )r& rEr' )r( rEr) )r* rEr+ )r, rEr- )r. rEr/ )r0 rEr1 )r2 rEr3 )r4 rEr5 )r6 rEr7 )r8 rEr9 )r: rEr; )r< r)r= rEr> )r? rEr@ )rA rErB )rC rErD )rE rErF )rG rErH )rI rErJ )rK rErL )rM rErN )rO rErP )rQ rErR )rS rErT )rU rErV )rW rErX )rY rErZ )r[ rEr\ )r] rEr^ )r_ rEr` )ra rErb )rc rErd )re rErf )rg rErh )ri rErj )rk rErl )rm rErn )ro rErp )rq rErr )rs rErt )ru rErv )rw rErx )ry r)rz rEr{ )r| rEr} )r~ rEr )r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rEr rrrrr_seg_50Xsr cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS(NrEᅫᅬrᅭᅮᅯᅰᅱᅲᅳᅴᅵ¢£¬r ̄¦¥₩│←↑→↓■○r0  '(;<>?NP^47 $0K𐐨𐐩𐐪𐐫𐐬𐐭𐐮𐐯𐐰 𐐱 𐐲 𐐳 𐐴 𐐵𐐶𐐷𐐸𐐹𐐺𐐻𐐼𐐽𐐾𐐿𐑀𐑁𐑂𐑃𐑄𐑅)r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rr )r rEr )r rEr )r rEr )r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r r0)r r)r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr )r rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r !rEr !)r !rEr !)r !rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr !)r!!rEr"!)r#!rEr$!)r%!rEr&!)r'!rEr(!)r)!rEr*!rrrrr_seg_51sr+!ceCsdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrE𐑆𐑇 𐑈!𐑉"𐑊#𐑋$𐑌%𐑍&𐑎'𐑏(r0r  679<=?VW`   : ? @              4 8 ; ? H P Y `   6 9 V X s x   I `NRp56D o#$c$p$t$0/4)r,!rEr-!)r.!rEr/!)r0!rEr1!)r2!rEr3!)r4!rEr5!)r6!rEr7!)r8!rEr9!)r:!rEr;!)r!rEr?!)r@!r0)rA!r)rB!r0)rC!r)rD!r0)rE!r)rF!r0)rG!r)rH!r0)rI!r)rJ!r0)rK!r)rL!r0)rM!r)rN!r0)rO!r)rP!r0)rQ!r)rR!r0)rS!r)rT!r0)rU!r)rV!r0)rW!r)rX!r0)rY!r)rZ!r0)r[!r)r\!r0)r]!r)r^!r0)r_!r)r`!r0)ra!r)rb!r0)rc!r)rd!r0)re!r)rf!r0)rg!r)rh!r0)ri!r)rj!r0)rk!r)rl!r0)rm!r)rn!r0)ro!r)rp!r0)rq!r)rr!r0)rs!r)rt!r0)ru!r)rv!r0)rw!r)rx!r0)ry!r)rz!r0)r{!r)r|!r0)r}!r)r~!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!rrrrrr_seg_52(sr!cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)Nhr09jroEoPoooo')^rE𝅗𝅥_𝅘𝅥` 𝅘𝅥𝅮a 𝅘𝅥𝅯b 𝅘𝅥𝅰c 𝅘𝅥𝅱d 𝅘𝅥𝅲es{𝆹𝅥𝆺𝅥 𝆹𝅥𝅮 𝆺𝅥𝅮 𝆹𝅥𝅯 𝆺𝅥𝅯FW`rrFrHrJrLrNrPrRrTrV rX rZ r\ r^ r`rbrdrfrhrjrlrnrprrrtrvrx !"#$%&'()*+,-./0123456789:;<)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!r0)r!r)r!r0)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!rEr!)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!r0)r!r)r!rErF)r!rErH)r!rErJ)r!rErL)r!rErN)r!rErP)r!rErR)r!rErT)r!rErV)r!rErX)r!rErZ)r!rEr\)r!rEr^)r!rEr`)r!rErb)r!rErd)r!rErf)r!rErh)r!rErj)r!rErl)r!rErn)r!rErp)r!rErr)r!rErt)r!rErv)r!rErx)r!rErF)r!rErH)r!rErJ)r!rErL)r!rErN)r!rErP)r!rErR)r!rErT)r!rErV)r!rErX)r!rErZ)r!rEr\)r!rEr^)r!rEr`)r!rErb)r!rErd)r!rErf)r!rErh)r!rErj)r!rErl)r!rErn)r!rErp)r!rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r "rErR)r "rErT)r "rErVrrrrr_seg_53sr "ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N=rErX>rZ?r\@r^Ar`BrbCrdDrfErhFrjGrlHrnIrpJrrKrtLrvMrxNrFOrHPrJQrLRrNSrPTrRUrVrVWXYZ[\]^_`abcdefghijklmnorTpqrstuvwxyz{|}~)r "rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r "rErJ)r!"rErL)r""rErN)r#"rErP)r$"rErR)r%"r)r&"rErV)r'"rErX)r("rErZ)r)"rEr\)r*"rEr^)r+"rEr`)r,"rErb)r-"rErd)r."rErf)r/"rErh)r0"rErj)r1"rErl)r2"rErn)r3"rErp)r4"rErr)r5"rErt)r6"rErv)r7"rErx)r8"rErF)r9"rErH)r:"rErJ)r;"rErL)r<"rErN)r="rErP)r>"rErR)r?"rErT)r@"rErV)rA"rErX)rB"rErZ)rC"rEr\)rD"rEr^)rE"rEr`)rF"rErb)rG"rErd)rH"rErf)rI"rErh)rJ"rErj)rK"rErl)rL"rErn)rM"rErp)rN"rErr)rO"rErt)rP"rErv)rQ"rErx)rR"rErF)rS"rErH)rT"rErJ)rU"rErL)rV"rErN)rW"rErP)rX"rErR)rY"rErT)rZ"rErV)r["rErX)r\"rErZ)r]"rEr\)r^"rEr^)r_"rEr`)r`"rErb)ra"rErd)rb"rErf)rc"rErh)rd"rErj)re"rErl)rf"rErn)rg"rErp)rh"rErr)ri"rErt)rj"rErv)rk"rErx)rl"rErF)rm"r)rn"rErJ)ro"rErL)rp"rrrrrr_seg_54srq"cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErRrrXrZr`rbrdrfrjrlrnrprrrtrvrxrFrHrJrLrPrTrVr\r^rhrN)rr"rErR)rs"r)rt"rErX)ru"rErZ)rv"r)rw"rEr`)rx"rErb)ry"rErd)rz"rErf)r{"r)r|"rErj)r}"rErl)r~"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"r)r"rErP)r"r)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"r)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r"rErR)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r"rErR)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"rErx)r"rErF)r"rErH)r"r)r"rErLrrrrr_seg_55`sr"cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErN rP rR r rXrZr\r^r`rbrdrfrjrlrnrprrrtrvrFrH rJ!rL"#$%rT&rV'()*+,-./rh01234567rx89:;<=>?@ABCDEFGJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn)r"rErN)r"rErP)r"rErR)r"r)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"r)r"rErj)r"rErl)r"rErn)r"rErp)r"rErr)r"rErt)r"rErv)r"r)r"rErF)r"rErH)r"rErJ)r"rErL)r"rErN)r"rErP)r"rErR)r"rErT)r"rErV)r"rErX)r"rErZ)r"rEr\)r"rEr^)r"rEr`)r"rErb)r"rErd)r"rErf)r"rErh)r"rErj)r"rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#r)r #rErL)r #rErN)r #rErP)r #rErR)r #r)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#r)r#rErb)r#r)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#r)r#rErF)r#rErH)r #rErJ)r!#rErL)r"#rErN)r##rErP)r$#rErR)r%#rErT)r&#rErV)r'#rErX)r(#rErZ)r)#rEr\)r*#rEr^)r+#rEr`)r,#rErb)r-#rErd)r.#rErf)r/#rErh)r0#rErj)r1#rErl)r2#rErn)r3#rErp)r4#rErr)r5#rErt)r6#rErv)r7#rErx)r8#rErF)r9#rErH)r:#rErJrrrrr_seg_56sr;#cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NorErLprNqrPrrRsrTtrVurXvrZwr\xr^yr`zrb{rd|rf}rh~rjrlrnrprrrtrvrxrFrHrJ)r<#rErL)r=#rErN)r>#rErP)r?#rErR)r@#rErT)rA#rErV)rB#rErX)rC#rErZ)rD#rEr\)rE#rEr^)rF#rEr`)rG#rErb)rH#rErd)rI#rErf)rJ#rErh)rK#rErj)rL#rErl)rM#rErn)rN#rErp)rO#rErr)rP#rErt)rQ#rErv)rR#rErx)rS#rErF)rT#rErH)rU#rErJ)rV#rErL)rW#rErN)rX#rErP)rY#rErR)rZ#rErT)r[#rErV)r\#rErX)r]#rErZ)r^#rEr\)r_#rEr^)r`#rEr`)ra#rErb)rb#rErd)rc#rErf)rd#rErh)re#rErj)rf#rErl)rg#rErn)rh#rErp)ri#rErr)rj#rErt)rk#rErv)rl#rErx)rm#rErF)rn#rErH)ro#rErJ)rp#rErL)rq#rErN)rr#rErP)rs#rErR)rt#rErT)ru#rErV)rv#rErX)rw#rErZ)rx#rEr\)ry#rEr^)rz#rEr`)r{#rErb)r|#rErd)r}#rErf)r~#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErvrrrrr_seg_570sr#cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErxrFrHrJrLrNrPrRrTrVrXrZr\r^r`rbrdrfrhrjrlrnrprrrtrv      !"#$%&'()*+,-./0123456)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r#rErf)r#rErh)r#rErj)r#rErl)r#rErn)r#rErp)r#rErr)r#rErt)r#rErv)r#rErx)r#rErF)r#rErH)r#rErJ)r#rErL)r#rErN)r#rErP)r#rErR)r#rErT)r#rErV)r#rErX)r#rErZ)r#rEr\)r#rEr^)r#rEr`)r#rErb)r#rErd)r$rErf)r$rErh)r$rErj)r$rErl)r$rErnrrrrr_seg_58sr$cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N7rErp8rr9rt:rv;rx<rF=rH>rJ?rL@rNArPBrRCrTDrVErXFrZGr\Hr^Ir`JrbKrdLrfMrhNrjOrlPrnQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~)r$rErp)r$rErr)r$rErt)r $rErv)r $rErx)r $rErF)r $rErH)r $rErJ)r$rErL)r$rErN)r$rErP)r$rErR)r$rErT)r$rErV)r$rErX)r$rErZ)r$rEr\)r$rEr^)r$rEr`)r$rErb)r$rErd)r$rErf)r$rErh)r$rErj)r$rErl)r$rErn)r $rErp)r!$rErr)r"$rErt)r#$rErv)r$$rErx)r%$rErF)r&$rErH)r'$rErJ)r($rErL)r)$rErN)r*$rErP)r+$rErR)r,$rErT)r-$rErV)r.$rErX)r/$rErZ)r0$rEr\)r1$rEr^)r2$rEr`)r3$rErb)r4$rErd)r5$rErf)r6$rErh)r7$rErj)r8$rErl)r9$rErn)r:$rErp)r;$rErr)r<$rErt)r=$rErv)r>$rErx)r?$rErF)r@$rErH)rA$rErJ)rB$rErL)rC$rErN)rD$rErP)rE$rErR)rF$rErT)rG$rErV)rH$rErX)rI$rErZ)rJ$rEr\)rK$rEr^)rL$rEr`)rM$rErb)rN$rErd)rO$rErf)rP$rErh)rQ$rErj)rR$rErl)rS$rErn)rT$rErp)rU$rErr)rV$rErt)rW$rErv)rX$rErx)rY$rErF)rZ$rErH)r[$rErJ)r\$rErL)r]$rErN)r^$rErP)r_$rErR)r`$rErT)ra$rErV)rb$rErX)rc$rErZ)rd$rEr\)re$rEr^)rf$rEr`)rg$rErb)rh$rErd)ri$rErfrrrrr_seg_59srj$cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErhrjrlrnrprrrtrvrxıȷrαβγδεζηθικλμνξοπρστυφχψω∇∂)rk$rErh)rl$rErj)rm$rErl)rn$rErn)ro$rErp)rp$rErr)rq$rErt)rr$rErv)rs$rErx)rt$rEru$)rv$rErw$)rx$r)ry$rErz$)r{$rEr|$)r}$rEr~$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$rEr$)r$r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r9%)r:%rEr%)r;%rEr%)r<%rEr %)r=%rEr"%)r>%rEr%)r?%rEr$)r@%rEr$)rA%rEr$)rB%rEr$)rC%rEr$)rD%rEr$)rE%rEr$)rF%rEr$)rG%rEr$)rH%rEr$)rI%rEr%)rJ%rEr%)rK%rEr%)rL%rEr%)rM%rEr %)rN%rEr %)rO%rEr %)rP%rEr%)rQ%rEr%)rR%rEr%)rS%rEr%)rT%rEr$)rU%rEr$)rV%rEr %)rW%rEr%)rX%rEr%)rY%rEr%)rZ%rEr%)r[%rEr %)r\%rEr"%)r]%rEr%)r^%rEr$)r_%rEr$)r`%rEr$)ra%rEr$)rb%rEr$)rc%rEr$)rd%rEr$)re%rEr$)rf%rEr$)rg%rEr$)rh%rEr%)ri%rEr%rrrrr_seg_61srj%cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NgrEθhσiτjυkφlχmψnωo∇pαqβrγsδtεuζvηwxιyκzλ{μ|ν}ξ~οπρ∂ϝrr )rk%rErl%)rm%rErn%)ro%rErp%)rq%rErr%)rs%rErt%)ru%rErv%)rw%rErx%)ry%rErz%)r{%rEr|%)r}%rEr~%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErn%)r%rErp%)r%rErr%)r%rErt%)r%rErv%)r%rErx%)r%rErz%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rErt%)r%rEr%)r%rEr%)r%rEr~%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rErn%)r%rErp%)r%rErr%)r%rErt%)r%rErv%)r%rErx%)r%rErz%)r%rEr|%)r%rEr~%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rEr%)r%rErn%)r%rErp%)r%rErr%)r%rErt%)r%rErv%)r%rErx%)r%rErz%)r%rEr%)r%rEr%)r%rErl%)r%rEr%)r%rErt%)r%rEr%)r%rEr%)r%rEr%)r%r)r%rEr rrrrr_seg_628sr%cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)NrErrrr r r r r r r rابجدوزحط ي ك ل م نسعفصقرشتثخذضظغٮںڡٯ !"#$ه%'()*+,-./012)r%rEr)r%rEr)r%rEr)r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr)r%rEr)r%rEr)r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr )r%rEr)r&rEr)r&rEr)r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r &rEr)r &rEr)r &rEr)r &rEr )r &rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr)r&rEr)r&rEr)r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&rEr )r&r)r&rEr&)r&rEr &)r!&rEr"&)r#&rEr$&)r%&r)r&&rEr'&)r(&rEr)&)r*&rEr+&)r,&rEr-&)r.&rEr/&)r0&rEr1&)r2&rEr3&)r4&rEr5&)r6&rEr7&)r8&rEr9&)r:&rEr;&)r<&rEr=&)r>&rEr?&)r@&rErA&)rB&rErC&)rD&rErE&)rF&rErG&)rH&rErI&)rJ&rErK&)rL&rErM&)rN&rErO&)rP&rErQ&)rR&rErS&)rT&rErU&)rV&rErW&)rX&rErY&)rZ&rEr[&)r\&r)r]&rEr &)r^&rEr"&)r_&r)r`&rEra&)rb&r)rc&rEr+&)rd&r)re&rEr/&)rf&rEr1&)rg&rEr3&)rh&rEr5&)ri&rEr7&)rj&rEr9&)rk&rEr;&)rl&rEr=&)rm&rEr?&)rn&rErA&rrrrr_seg_63sro&ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgdS)N3r4rEش5ت6ث7خ89ض:;غ<BجCGحHIيJKلLMنNسOعPQصRقSTUWXYZ[\]ں^_ٯ`aبbcdهeghطijكklمmnopفqrstuvwxyzظ{|ٮ}~ڡادوزرذ)rp&r)rq&rErr&)rs&rErt&)ru&rErv&)rw&rErx&)ry&r)rz&rEr{&)r|&r)r}&rEr~&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&r)r&rEr&)r&rEr&)r&r)r&rErr&)r&r)r&rErx&)r&r)r&rEr{&)r&r)r&rEr~&)r&r)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r&rErr&)r&rErt&)r&rErv&)r&rErx&)r&r)r&rEr{&)r&rEr&)r&rEr~&)r&rEr&)r&r)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rErr&)r&rErt&)r&rErv&)r&rErx&)r&rEr&)r&rEr{&)r&rEr&)r&rEr~&)r&r)r&rEr&)r&rEr&)r&rEr&)r&rrrrrr_seg_64sr&cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddddddddgdS(NrEوزحطيrلمنسعفصقرشتثخذضظغr0,0r0,1,2,3,4,5,6,7, 8, 9, (a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p) (q)!(r)"(s)#(t)$(u)%(v)&(w)'(x)((y))(z)*〔s〕+rJ,rh-r.wz/0rF1rH23rL4rN5rP6rR7rT8rV9rX:rZ;r\<r^=r`>rb?rd@rfABrj)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&rEr&)r&r)r'rEr')r'rEr')r'rEr')r'rEr')r'rEr ')r 'rEr ')r 'rEr ')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r 'rEr!')r"'r)r#'r0)r$'r)r%'r0)r&'r)r''r0)r('r)r)'r0)r*'r)r+'r0)r,'r)r-'r0)r.'r)r/'r0)r0'r)r1'rr2')r3'rr4')r5'rr6')r7'rr8')r9'rr:')r;'rr<')r='rr>')r?'rr@')rA'rrB')rC'rrD')rE'r)rF'rrG')rH'rrI')rJ'rrK')rL'rrM')rN'rrO')rP'rrQ')rR'rrS')rT'rrU')rV'rrW')rX'rrY')rZ'rr[')r\'rr]')r^'rr_')r`'rra')rb'rrc')rd'rre')rf'rrg')rh'rri')rj'rrk')rl'rrm')rn'rro')rp'rrq')rr'rrs')rt'rru')rv'rrw')rx'rry')rz'rEr{')r|'rErJ)r}'rErh)r~'rEr)r'rEr')r'r)r'rErF)r'rErH)r'rErJ)r'rErL)r'rErN)r'rErP)r'rErR)r'rErT)r'rErV)r'rErX)r'rErZ)r'rEr\)r'rEr^)r'rEr`)r'rErb)r'rErd)r'rErf)r'rErh)r'rErjrrrrr_seg_65psr'ceCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddgdS(NCrErlDrnErpFrrGrtHrvIrxJhvKrLsdMr.NppvOwcPr0jmckmdlrpdjほかココサ手字双デ二多解天交映無料前後再新 初!終"生#販$声%吹&演'投(捕)一*三+遊,左-中.右/指0走1打2禁3空4合5満6有7月8申9割:営;@ 〔本〕A 〔三〕B 〔二〕C 〔安〕D 〔点〕E 〔打〕F 〔盗〕G 〔勝〕H 〔敗〕IP得Q可R!067}?@)r'rErl)r'rErn)r'rErp)r'rErr)r'rErt)r'rErv)r'rErx)r'rEr')r'rEr)r'rEr')r'rEr.)r'rEr')r'rEr')r'r0)r'rEr')r'rEr')r'r)r'r0)r'rEr')r'r0)r'r)r'r0)r'rEr')r'rEr')r'rEr')r'r)r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r'rEr')r(rEr()r(rEr()r(rEr()r(rEr()r(rEr ()r (rEr ()r (rEr ()r(rEr()r(r)r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr ()r!(rEr"()r#(r)r$(rEr%()r&(rEr'()r((r)r)(r0)r*(r)r+(r0)r,(r)r-(r0)r.(r)r/(r0)r0(r)r1(r0)r2(r)r3(r0)r4(r)r5(r0)r6(r)r7(r0)r8(r)r9(r0rrrrr_seg_66sr:(cfCsddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddgdS(NArBr0>@DPhAEPtצ5@rE丽丸乁𠄢你侮侻倂偺 備 僧 像 㒞 𠘺免兔兤具𠔜㒹內再𠕋冗冤仌冬况𩇟凵刃㓟 刻!剆"割#剷$㔕%勇&勉'勤(勺)包*匆+北,卉-卑.博/即0卽1卿4𠨬5灰6及7叟8𠭣9叫:叱;吆<咞=吸>呈?周@咢A哶B唐C啓D啣E善G喙H喫I喳J嗂K圖L嘆M圗)r;(r)r<(r0)r=(r)r>(r0)r?(r)r@(r0)rA(r)rB(r0)rC(r)rD(r0)rE(r)rF(r0)rG(r)rH(r0)rI(r)rJ(r0)rK(r)rL(r0)rM(r)rN(r0)rO(r)rP(r0)rQ(r)rR(r0)rS(r)rT(rErU()rV(rErW()rX(rErY()rZ(rEr[()r\(rEr]()r^(rEr_()r`(rEra()rb(rErc()rd(rEre()rf(rErg()rh(rEri()rj(rErk()rl(rErm()rn(rEro()rp(rErq()rr(rErs()rt(rEru()rv(rErw()rx(rEry()rz(rEr{()r|(rEr}()r~(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr(rrrrr_seg_67@sr(cfCs$dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+gdS(,NNrE噑O噴P切Q壮R城S埴T堍U型V堲W報X墬Y𡓤Z売[壷\夆]多^夢_奢`𡚨a𡛪b姬c娛d娧e姘f婦g㛮hri嬈j嬾l𡧈m寃n寘o寧p寳q𡬘r寿s将tu尢v㞁w屠x屮y峀z岍{𡷤|嵃}𡷦~嵮嵫嵼巡巢㠯巽帨帽幩㡢𢆃㡼庰庳庶廊𪎒廾𢌱舁弢㣇𣊸𦇚形彫㣣徚忍志忹悁㤺㤜悔𢛔惇慈慌慎慺憎憲憤憯懞懲懶成戛扝)r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr()r(rEr))r)rEr))r)rEr))r)rEr))r)rEr))r )rEr ))r )rEr ))r )rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)r)r )rEr!))r")rEr#))r$)rEr%))r&)rEr'))r()rEr)))r*)rEr+))r,)rEr-))r.)rEr/))r0)rEr1))r2)rEr3))r4)r)r5)rEr6))r7)rEr8))r9)rEr:))r;)rEr<))r=)rEr>))r?)rEr@))rA)rErB))rC)rErD))rE)rErF))rG)rErH))rI)rErJ))rK)rErL))rM)rErN))rO)rErP))rQ)rErR))rS)rErT))rU)rErV))rW)rErX))rY)rErZ))r[)rEr\))r])rEr^))r_)rEr`))ra)rErb))rc)rErd))re)rErf))rg)rErh))ri)rErj))rk)rErl))rm)rErn))ro)rErp))rq)rErr))rs)rErt))ru)rErv))rw)rErx))ry)rErz))r{)rEr|))r})rEr~))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr)rrrrr_seg_68sr)cfCs(dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gdS(.NrE抱拔捐𢬌挽拼捨掃揤𢯱搢揅掩㨮摩摾撝摷㩬敏敬𣀊旣書晉㬙暑㬈㫤冒冕最暜肭䏙朗望朡杞杓𣏃㭉柺枅桒梅𣑭梎栟椔㮝楂榣槪檨𣚣櫛㰘次𣢧歔㱎歲殟殺殻𣪍𡴋𣫺汎𣲼沿泍汧洖派海流浩浸涅𣴞洴港 湮 㴳 滋 滇 𣻑淹潮𣽞𣾎濆瀹瀞瀛㶖灊災)r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr))r)rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r *rEr *)r *rEr *)r *rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr*)r*rEr *)r!*rEr"*)r#*rEr$*)r%*rEr&*)r'*rEr(*)r)*rEr**)r+*rEr,*)r-*rEr.*)r/*rEr0*)r1*rEr2*)r3*rEr4*)r5*rEr6*)r7*rEr8*)r9*rEr:*)r;*rEr<*)r=*rEr>*)r?*rEr@*)rA*rErB*)rC*rErD*)rE*rErF*)rG*rErH*)rI*rErJ*)rK*rErL*)rM*rErN*)rO*rErP*)rQ*rErR*)rS*rErT*)rU*rErV*)rW*rErX*)rY*rErZ*)r[*rEr\*)r]*rEr^*)r_*rEr`*)ra*rErb*)rc*rErd*)re*rErf*)rg*rErh*)ri*rErj*)rk*rErl*)rm*rErn*)ro*rErp*)rq*rErr*)rs*rErt*)ru*rErv*)rw*rErx*rrrrr_seg_69sry*cfCs&ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,gdS(-NrE灷炭𠔥煅𤉣熜r 爨!爵"牐#𤘈$犀%犕&𤜵'𤠔(獺)王*㺬+玥,㺸.瑇/瑜0瑱1璅2瓊3㼛4甤5𤰶6甾7𤲒8異9𢆟:瘐;𤾡<𤾸=𥁄>㿼?䀈@直A𥃳B𥃲C𥄙D𥄳E眞F真H睊I䀹J瞋K䁆L䂖M𥐝N硎O碌P磌Q䃣R𥘦S祖T𥚚U𥛅V福W秫X䄯Y穀Z穊[穏\𥥼]𥪧_`䈂a𥮫b篆c築d䈧e𥲀f糒g䊠h糨i糣j紀k𥾆l絣m䌁n緇o縂p繅q䌴r𦈨s𦉇t䍙u𦋙v罺w𦌾x羕y翺z者{𦓚|𦔣}聠~𦖨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re,rErf,)rg,rErh,)ri,rErj,)rk,rErl,)rm,rErn,)ro,rErp,)rq,rErr,)rs,rErt,)ru,rErv,)rw,rErx,)ry,rErz,)r{,r)r|,r)r},rrrrrr_seg_72Hsxr~,N)M__doc__ __version__rrrr-rrfrrrJrrbrr/rrrr9 r rm r r r3 r r] rrrAr rrrLrrrrfrrrrrrsr7rrrxr6rrrXrr r+!r!r "rq"r"r;#r#r$rj$r$rj%r%ro&r&r'r:(r(r)ry*r@+r,r~,tupleZ uts46datarrrrshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh@Iidna/__pycache__/__init__.cpython-36.pyc000064400000000266152347724720014075 0ustar003 Pf:@sddlmZddlTdS)) __version__)*N)Z package_datarZcorerr/usr/lib/python3.6/__init__.pys idna/__pycache__/package_data.cpython-36.opt-1.pyc000064400000000210152347724720015646 0ustar003 Pf@sdZdS)z2.6N) __version__rr"/usr/lib/python3.6/package_data.pysidna/__pycache__/__init__.cpython-36.opt-1.pyc000064400000000266152347724720015034 0ustar003 Pf:@sddlmZddlTdS)) __version__)*N)Z package_datarZcorerr/usr/lib/python3.6/__init__.pys idna/__pycache__/codec.cpython-36.pyc000064400000005725152347724720013420 0ustar003 Pf @sddlmZmZmZmZmZddlZddlZejdZ Gdddej Z Gdddej Z Gd d d ej ZGd d d e ejZGd dde ejZddZdS))encodedecodealabelulabel IDNAErrorNu [.。.。]c@s eZdZdddZdddZdS) CodecstrictcCs.|dkrtdj||sdSt|t|fS)Nr z Unsupported error handling "{0}"r)r r)rformatrlen)selfdataerrorsr/usr/lib/python3.6/codec.pyr s z Codec.encodecCs.|dkrtdj||sdSt|t|fS)Nr z Unsupported error handling "{0}"r r)r r)rr rr )r rrrrrrs z Codec.decodeN)r )r )__name__ __module__ __qualname__rrrrrrrs rc@seZdZddZdS)IncrementalEncoderc Cs|dkrtdj||sdStj|}d}|rV|dsDd}|d =n|sV|d =|rVd}g}d}x2|D]*}|jt||r|d7}|t|7}qdWdj||}|t|7}||fS) Nr z Unsupported error handling "{0}"r rr.)r rrr)rr _unicode_dots_resplitappendrr join) r rrfinallabels trailing_dotresultsizelabelrrr_buffer_encodes0   z!IncrementalEncoder._buffer_encodeN)rrrr"rrrrrsrc@seZdZddZdS)IncrementalDecoderc Cs|dkrtdj||sdSt|tr4tj|}nt|}t|d|jd}d}|r~|d sld}|d =n|s~|d =|r~d}g}d}x2|D]*}|jt||r|d7}|t |7}qWdj ||}|t |7}||fS) Nr z Unsupported error handling "{0}"r rasciirr)r rrrr) rr isinstanceZunicoderrstrrrr r) r rrrrrrr r!rrr_buffer_decode?s8      z!IncrementalDecoder._buffer_decodeN)rrrr'rrrrr#>sr#c@s eZdZdS) StreamWriterN)rrrrrrrr(gsr(c@s eZdZdS) StreamReaderN)rrrrrrrr)jsr)c Cs tjdtjtjttttdS)NZidna)namerrincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInforrrrr#r(r)rrrr getregentrymsr1)Zcorerrrrrr/recompilerrBufferedIncrementalEncoderrBufferedIncrementalDecoderr#r(r)r1rrrrs !)idna/__pycache__/idnadata.cpython-36.opt-1.pyc000064400000057557152347724720015061 0ustar003 Pf@s0dZd d!d"d#d$dFZdGdGdGdGdGdGdGdHdGdIdIdIdIdHdIdHdIdHdHdHdHdHdIdIdIdIdHdHdHdHdHdHdHdHdHdHdHdHdHdJdHdHdHdHdHdHdHdIdHdHdHdHdIdIdIdGdIdIdIdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdIdIdIdIdIdIdIdIdIdIdIdIdIdIdIdIdIdIdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdHdIdHdHdIdIdIdIdIdIdIdIdIdHdIdHdIdHdHdIdIdIdGdIdIdHdHdHdHdIdHdHdHdIdIdIdIdIdHdHdHdHdIdHdHdHdHdHdHdHdHdHdIdHdIdHdIdH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iiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/iMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiiiiiiiiiiiiiii ii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i if ig ih ii i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqiris.:{|  $ ,4<DLT\dlt |"$&(*,.0269;=?CEGI L,N4P<RDTLVTX\Zd\l^t`|bdfhjlnprtvx{}  0HTdx8@HPX`hp|  $ ,4<DLT\dlt |"$&(*,.02:=AC H J$ L, N4 <     @ C O p@ r t x ~ @\dlt|`bdfhjlnprtvxz|~ ,4<DLT\dlt| (08DLT\dlt|  $ ,4<DLT\dlt |"$&(ZdD@@`uT|K@4. \!""#X $d %p %x % % & & <& L& & & & & ' ,' \' ' ' ( ( <() L(1 (3 (6 (: (= (C (I )N ,)R D)] p)v ) * * <* L* * * * * + ,+ @+ + + , , <,) L,1 ,4 ,: ,E ,I -N ,-X X-d |-p -r - . . 8. H. d. p. x. . . . . / (/ @/ \/ / 0 0 80) H04 0: 0E 0I 1N (1W T1Z `1d 1p 1 2 2 82 H2 2 2 2 3 (3 T3 x3 3 3 3 4 4 84; H4E 4I 5O (5X \5d 5p 5 5 6 6 h6 6 6 7 (7 <7 X7 `7 738;8O9Z@9:::(:4:P:d::::::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rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLr:rMrNr>rOrPrQr@r)r*rRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrr-r.r/)r)rrrrrr) __version__scriptsZ joining_typesZcodepoint_classesrr/usr/lib/python3.6/idnadata.pys0   idna/__pycache__/idnadata.cpython-36.pyc000064400000057557152347724720014122 0ustar003 Pf@s0dZd d!d"d#d$dFZdGdG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t x ~  08+tbtukuv|`|F|N }X@}Zd}\l}^t}~|}~~Xt'!FRH.:.l:/<0@0@*0@<0@MP8nzdzi&578]z`D@7{tl={l?{lB{mE{ mP{m0A0tB0@ rH0B1C2G2@KX3Lp}}0@ )ZGreekZHanZHebrewZHiraganaZKatakanaUDRCL(iiiiiii i i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJinioiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/iMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiiiiiiiiiiiiiii ii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqirisitiuiviwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i if ig ih ii i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminioipiqiris.:{|  $ ,4<DLT\dlt |"$&(*,.0269;=?CEGI L,N4P<RDTLVTX\Zd\l^t`|bdfhjlnprtvx{}  0HTdx8@HPX`hp|  $ ,4<DLT\dlt |"$&(*,.02:=AC H J$ L, N4 <     @ C O p@ r t x ~ @\dlt|`bdfhjlnprtvxz|~ ,4<DLT\dlt| (08DLT\dlt|  $ ,4<DLT\dlt |"$&(ZdD@@`uT|K@4. \!""#X $d %p %x % % & & <& L& & & & & ' ,' \' ' ' ( ( <() L(1 (3 (6 (: (= (C (I )N ,)R D)] p)v ) * * <* L* * * * * + ,+ @+ + + , , <,) L,1 ,4 ,: ,E ,I -N ,-X X-d |-p -r - . . 8. H. d. p. x. . . . . / (/ @/ \/ / 0 0 80) H04 0: 0E 0I 1N (1W T1Z `1d 1p 1 2 2 82 H2 2 2 2 3 (3 T3 x3 3 3 3 4 4 84; H4E 4I 5O (5X \5d 5p 5 5 6 6 h6 6 6 7 (7 <7 X7 `7 738;8O9Z@9:::(:4:P:d::::::::;; ;@;x;< ,<`<*<6<8<:<C<H=M$=R8=WL=\`=it=m=s=u==>>P>d>x>>>>>?J@@A@CCIHN(IW@IY`I^hII(J@JJJKK K`KHL[`L`tMNNmPYZZ \8\5\T]m]q]t]^^\_p__@`x`bbd,d<dneueff@gh_h}ii@jjLlZ@mtmn8pJq~4q@sPs,t0t<tO8uxuuwwx xxx $x ,x4xx@xByD yFyHyJ$yL,yN4yP'@'B'D' F'H'J'$L',N'4P'<R'DT'LV'TX'\Z'd\'l^'t`'|b'd'f'h'j'l'n'p'y'{'}'''' '''0'8'D'L'''''((t(!("(@#(#(#.)$T)$)&)<'7*(N*)Z*@)w*)|*)***l+*+*++,+$,+D,'+,/+,+/+/+/W0z8hzDhzLh z|h"zh%zh*zh{xl'~xt~y '4;>N^@   A J     6( 9 = V  $: $ & & ( ( 0( T(4 d(; (@ (} )6 ,V -s -I 0G@pAB@CC5D@DF@GZ[o# /4@ 9j Eo< o@= o<> 0@  0v j0C)ZPVALIDZCONTEXTJZCONTEXTON)!rrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!)r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0) r1r2r3r4r5r6r7r8r9)r:r;r<r=)r>r?r@rArBrCrDrE(rKrLrMrNrOrPrQr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OrPrQr@r)r*rRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrr-r.r/)r)rrrrrr) __version__scriptsZ joining_typesZcodepoint_classesrr/usr/lib/python3.6/idnadata.pys0   idna/__pycache__/intranges.cpython-36.pyc000064400000003317152347724720014330 0ustar003 Pf@s0dZddlZddZddZddZd d ZdS) a  Given a list of integers, made up of (hopefully) a small number of long runs of consecutive integers, compute a representation of the form ((start1, end1), (start2, end2) ...). Then answer the question "was x present in the original list?" in time O(log(# runs)). NcCst|}g}d}xrtt|D]b}|dt|krL||||ddkrLq||d|d}|jt|d|dd|}qWt|S)aRepresent a list of integers as a sequence of ranges: ((start_0, end_0), (start_1, end_1), ...), such that the original integers are exactly those x such that start_i <= x < end_i for some i. Ranges are encoded as single integers (start << 32 | end), not as tuples. rr)sortedrangelenappend _encode_rangetuple)Zlist_Z sorted_listrangesZ last_writeiZ current_ranger /usr/lib/python3.6/intranges.pyintranges_from_list srcCs |d>|BS)N r )startendr r r rsrcCs|d?|d@fS)Nrrllr )rr r r _decode_range"srcCszt|d}tj||}|dkrNt||d\}}||koD|knrNdS|t|krvt||\}}||krvdSdS)z=Determine if `int_` falls into one of the ranges in `ranges`.rrTF)rbisectZ bisect_leftrr)Zint_r Ztuple_posleftright_r r r intranges_contain&s   r)__doc__rrrrrr r r r s idna/__pycache__/intranges.cpython-36.opt-1.pyc000064400000003317152347724720015267 0ustar003 Pf@s0dZddlZddZddZddZd d ZdS) a  Given a list of integers, made up of (hopefully) a small number of long runs of consecutive integers, compute a representation of the form ((start1, end1), (start2, end2) ...). Then answer the question "was x present in the original list?" in time O(log(# runs)). NcCst|}g}d}xrtt|D]b}|dt|krL||||ddkrLq||d|d}|jt|d|dd|}qWt|S)aRepresent a list of integers as a sequence of ranges: ((start_0, end_0), (start_1, end_1), ...), such that the original integers are exactly those x such that start_i <= x < end_i for some i. Ranges are encoded as single integers (start << 32 | end), not as tuples. rr)sortedrangelenappend _encode_rangetuple)Zlist_Z sorted_listrangesZ last_writeiZ current_ranger /usr/lib/python3.6/intranges.pyintranges_from_list srcCs |d>|BS)N r )startendr r r rsrcCs|d?|d@fS)Nrrllr )rr r r _decode_range"srcCszt|d}tj||}|dkrNt||d\}}||koD|knrNdS|t|krvt||\}}||krvdSdS)z=Determine if `int_` falls into one of the ranges in `ranges`.rrTF)rbisectZ bisect_leftrr)Zint_r Ztuple_posleftright_r r r intranges_contain&s   r)__doc__rrrrrr r r r s idna/uts46data.py000064400000612544152347724720007701 0ustar00# This file is automatically generated by tools/idna-data # vim: set fileencoding=utf-8 : """IDNA Mapping Table from UTS46.""" __version__ = "13.0.0" def _seg_0(): return [ (0x0, '3'), (0x1, '3'), (0x2, '3'), (0x3, '3'), (0x4, '3'), (0x5, '3'), (0x6, '3'), (0x7, '3'), (0x8, '3'), (0x9, '3'), (0xA, '3'), (0xB, '3'), (0xC, '3'), (0xD, '3'), (0xE, '3'), (0xF, '3'), (0x10, '3'), (0x11, '3'), (0x12, '3'), (0x13, '3'), (0x14, '3'), (0x15, '3'), (0x16, '3'), (0x17, '3'), (0x18, '3'), (0x19, '3'), (0x1A, '3'), (0x1B, '3'), (0x1C, '3'), (0x1D, '3'), (0x1E, '3'), (0x1F, '3'), (0x20, '3'), (0x21, '3'), (0x22, '3'), (0x23, '3'), (0x24, '3'), (0x25, '3'), (0x26, '3'), (0x27, '3'), (0x28, '3'), (0x29, '3'), (0x2A, '3'), (0x2B, '3'), (0x2C, '3'), (0x2D, 'V'), (0x2E, 'V'), (0x2F, '3'), (0x30, 'V'), (0x31, 'V'), (0x32, 'V'), (0x33, 'V'), (0x34, 'V'), (0x35, 'V'), (0x36, 'V'), (0x37, 'V'), (0x38, 'V'), (0x39, 'V'), (0x3A, '3'), (0x3B, '3'), (0x3C, '3'), (0x3D, '3'), (0x3E, '3'), (0x3F, '3'), (0x40, '3'), (0x41, 'M', u'a'), (0x42, 'M', u'b'), (0x43, 'M', u'c'), (0x44, 'M', u'd'), (0x45, 'M', u'e'), (0x46, 'M', u'f'), (0x47, 'M', u'g'), (0x48, 'M', u'h'), (0x49, 'M', u'i'), (0x4A, 'M', u'j'), (0x4B, 'M', u'k'), (0x4C, 'M', u'l'), (0x4D, 'M', u'm'), (0x4E, 'M', u'n'), (0x4F, 'M', u'o'), (0x50, 'M', u'p'), (0x51, 'M', u'q'), (0x52, 'M', u'r'), (0x53, 'M', u's'), (0x54, 'M', u't'), (0x55, 'M', u'u'), (0x56, 'M', u'v'), (0x57, 'M', u'w'), (0x58, 'M', u'x'), (0x59, 'M', u'y'), (0x5A, 'M', u'z'), (0x5B, '3'), (0x5C, '3'), (0x5D, '3'), (0x5E, '3'), (0x5F, '3'), (0x60, '3'), (0x61, 'V'), (0x62, 'V'), (0x63, 'V'), ] def _seg_1(): return [ (0x64, 'V'), (0x65, 'V'), (0x66, 'V'), (0x67, 'V'), (0x68, 'V'), (0x69, 'V'), (0x6A, 'V'), (0x6B, 'V'), (0x6C, 'V'), (0x6D, 'V'), (0x6E, 'V'), (0x6F, 'V'), (0x70, 'V'), (0x71, 'V'), (0x72, 'V'), (0x73, 'V'), (0x74, 'V'), (0x75, 'V'), (0x76, 'V'), (0x77, 'V'), (0x78, 'V'), (0x79, 'V'), (0x7A, 'V'), (0x7B, '3'), (0x7C, '3'), (0x7D, '3'), (0x7E, '3'), (0x7F, '3'), (0x80, 'X'), (0x81, 'X'), (0x82, 'X'), (0x83, 'X'), (0x84, 'X'), (0x85, 'X'), (0x86, 'X'), (0x87, 'X'), (0x88, 'X'), (0x89, 'X'), (0x8A, 'X'), (0x8B, 'X'), (0x8C, 'X'), (0x8D, 'X'), (0x8E, 'X'), (0x8F, 'X'), (0x90, 'X'), (0x91, 'X'), (0x92, 'X'), (0x93, 'X'), (0x94, 'X'), (0x95, 'X'), (0x96, 'X'), (0x97, 'X'), (0x98, 'X'), (0x99, 'X'), (0x9A, 'X'), (0x9B, 'X'), (0x9C, 'X'), (0x9D, 'X'), (0x9E, 'X'), (0x9F, 'X'), (0xA0, '3', u' '), (0xA1, 'V'), (0xA2, 'V'), (0xA3, 'V'), (0xA4, 'V'), (0xA5, 'V'), (0xA6, 'V'), (0xA7, 'V'), (0xA8, '3', u' ̈'), (0xA9, 'V'), (0xAA, 'M', u'a'), (0xAB, 'V'), (0xAC, 'V'), (0xAD, 'I'), (0xAE, 'V'), (0xAF, '3', u' ̄'), (0xB0, 'V'), (0xB1, 'V'), (0xB2, 'M', u'2'), (0xB3, 'M', u'3'), (0xB4, '3', u' ́'), (0xB5, 'M', u'μ'), (0xB6, 'V'), (0xB7, 'V'), (0xB8, '3', u' ̧'), (0xB9, 'M', u'1'), (0xBA, 'M', u'o'), (0xBB, 'V'), (0xBC, 'M', u'1⁄4'), (0xBD, 'M', u'1⁄2'), (0xBE, 'M', u'3⁄4'), (0xBF, 'V'), (0xC0, 'M', u'à'), (0xC1, 'M', u'á'), (0xC2, 'M', u'â'), (0xC3, 'M', u'ã'), (0xC4, 'M', u'ä'), (0xC5, 'M', u'å'), (0xC6, 'M', u'æ'), (0xC7, 'M', u'ç'), ] def _seg_2(): return [ (0xC8, 'M', u'è'), (0xC9, 'M', u'é'), (0xCA, 'M', u'ê'), (0xCB, 'M', u'ë'), (0xCC, 'M', u'ì'), (0xCD, 'M', u'í'), (0xCE, 'M', u'î'), (0xCF, 'M', u'ï'), (0xD0, 'M', u'ð'), (0xD1, 'M', u'ñ'), (0xD2, 'M', u'ò'), (0xD3, 'M', u'ó'), (0xD4, 'M', u'ô'), (0xD5, 'M', u'õ'), (0xD6, 'M', u'ö'), (0xD7, 'V'), (0xD8, 'M', u'ø'), (0xD9, 'M', u'ù'), (0xDA, 'M', u'ú'), (0xDB, 'M', u'û'), (0xDC, 'M', u'ü'), (0xDD, 'M', u'ý'), (0xDE, 'M', u'þ'), (0xDF, 'D', u'ss'), (0xE0, 'V'), (0xE1, 'V'), (0xE2, 'V'), (0xE3, 'V'), (0xE4, 'V'), (0xE5, 'V'), (0xE6, 'V'), (0xE7, 'V'), (0xE8, 'V'), (0xE9, 'V'), (0xEA, 'V'), (0xEB, 'V'), (0xEC, 'V'), (0xED, 'V'), (0xEE, 'V'), (0xEF, 'V'), (0xF0, 'V'), (0xF1, 'V'), (0xF2, 'V'), (0xF3, 'V'), (0xF4, 'V'), (0xF5, 'V'), (0xF6, 'V'), (0xF7, 'V'), (0xF8, 'V'), (0xF9, 'V'), (0xFA, 'V'), (0xFB, 'V'), (0xFC, 'V'), (0xFD, 'V'), (0xFE, 'V'), (0xFF, 'V'), (0x100, 'M', u'ā'), (0x101, 'V'), (0x102, 'M', u'ă'), (0x103, 'V'), (0x104, 'M', u'ą'), (0x105, 'V'), (0x106, 'M', u'ć'), (0x107, 'V'), (0x108, 'M', u'ĉ'), (0x109, 'V'), (0x10A, 'M', u'ċ'), (0x10B, 'V'), (0x10C, 'M', u'č'), (0x10D, 'V'), (0x10E, 'M', u'ď'), (0x10F, 'V'), (0x110, 'M', u'đ'), (0x111, 'V'), (0x112, 'M', u'ē'), (0x113, 'V'), (0x114, 'M', u'ĕ'), (0x115, 'V'), (0x116, 'M', u'ė'), (0x117, 'V'), (0x118, 'M', u'ę'), (0x119, 'V'), (0x11A, 'M', u'ě'), (0x11B, 'V'), (0x11C, 'M', u'ĝ'), (0x11D, 'V'), (0x11E, 'M', u'ğ'), (0x11F, 'V'), (0x120, 'M', u'ġ'), (0x121, 'V'), (0x122, 'M', u'ģ'), (0x123, 'V'), (0x124, 'M', u'ĥ'), (0x125, 'V'), (0x126, 'M', u'ħ'), (0x127, 'V'), (0x128, 'M', u'ĩ'), (0x129, 'V'), (0x12A, 'M', u'ī'), (0x12B, 'V'), ] def _seg_3(): return [ (0x12C, 'M', u'ĭ'), (0x12D, 'V'), (0x12E, 'M', u'į'), (0x12F, 'V'), (0x130, 'M', u'i̇'), (0x131, 'V'), (0x132, 'M', u'ij'), (0x134, 'M', u'ĵ'), (0x135, 'V'), (0x136, 'M', u'ķ'), (0x137, 'V'), (0x139, 'M', u'ĺ'), (0x13A, 'V'), (0x13B, 'M', u'ļ'), (0x13C, 'V'), (0x13D, 'M', u'ľ'), (0x13E, 'V'), (0x13F, 'M', u'l·'), (0x141, 'M', u'ł'), (0x142, 'V'), (0x143, 'M', u'ń'), (0x144, 'V'), (0x145, 'M', u'ņ'), (0x146, 'V'), (0x147, 'M', u'ň'), (0x148, 'V'), (0x149, 'M', u'ʼn'), (0x14A, 'M', u'ŋ'), (0x14B, 'V'), (0x14C, 'M', u'ō'), (0x14D, 'V'), (0x14E, 'M', u'ŏ'), (0x14F, 'V'), (0x150, 'M', u'ő'), (0x151, 'V'), (0x152, 'M', u'œ'), (0x153, 'V'), (0x154, 'M', u'ŕ'), (0x155, 'V'), (0x156, 'M', u'ŗ'), (0x157, 'V'), (0x158, 'M', u'ř'), (0x159, 'V'), (0x15A, 'M', u'ś'), (0x15B, 'V'), (0x15C, 'M', u'ŝ'), (0x15D, 'V'), (0x15E, 'M', u'ş'), (0x15F, 'V'), (0x160, 'M', u'š'), (0x161, 'V'), (0x162, 'M', u'ţ'), (0x163, 'V'), (0x164, 'M', u'ť'), (0x165, 'V'), (0x166, 'M', u'ŧ'), (0x167, 'V'), (0x168, 'M', u'ũ'), (0x169, 'V'), (0x16A, 'M', u'ū'), (0x16B, 'V'), (0x16C, 'M', u'ŭ'), (0x16D, 'V'), (0x16E, 'M', u'ů'), (0x16F, 'V'), (0x170, 'M', u'ű'), (0x171, 'V'), (0x172, 'M', u'ų'), (0x173, 'V'), (0x174, 'M', u'ŵ'), (0x175, 'V'), (0x176, 'M', u'ŷ'), (0x177, 'V'), (0x178, 'M', u'ÿ'), (0x179, 'M', u'ź'), (0x17A, 'V'), (0x17B, 'M', u'ż'), (0x17C, 'V'), (0x17D, 'M', u'ž'), (0x17E, 'V'), (0x17F, 'M', u's'), (0x180, 'V'), (0x181, 'M', u'ɓ'), (0x182, 'M', u'ƃ'), (0x183, 'V'), (0x184, 'M', u'ƅ'), (0x185, 'V'), (0x186, 'M', u'ɔ'), (0x187, 'M', u'ƈ'), (0x188, 'V'), (0x189, 'M', u'ɖ'), (0x18A, 'M', u'ɗ'), (0x18B, 'M', u'ƌ'), (0x18C, 'V'), (0x18E, 'M', u'ǝ'), (0x18F, 'M', u'ə'), (0x190, 'M', u'ɛ'), (0x191, 'M', u'ƒ'), (0x192, 'V'), (0x193, 'M', u'ɠ'), ] def _seg_4(): return [ (0x194, 'M', u'ɣ'), (0x195, 'V'), (0x196, 'M', u'ɩ'), (0x197, 'M', u'ɨ'), (0x198, 'M', u'ƙ'), (0x199, 'V'), (0x19C, 'M', u'ɯ'), (0x19D, 'M', u'ɲ'), (0x19E, 'V'), (0x19F, 'M', u'ɵ'), (0x1A0, 'M', u'ơ'), (0x1A1, 'V'), (0x1A2, 'M', u'ƣ'), (0x1A3, 'V'), (0x1A4, 'M', u'ƥ'), (0x1A5, 'V'), (0x1A6, 'M', u'ʀ'), (0x1A7, 'M', u'ƨ'), (0x1A8, 'V'), (0x1A9, 'M', u'ʃ'), (0x1AA, 'V'), (0x1AC, 'M', u'ƭ'), (0x1AD, 'V'), (0x1AE, 'M', u'ʈ'), (0x1AF, 'M', u'ư'), (0x1B0, 'V'), (0x1B1, 'M', u'ʊ'), (0x1B2, 'M', u'ʋ'), (0x1B3, 'M', u'ƴ'), (0x1B4, 'V'), (0x1B5, 'M', u'ƶ'), (0x1B6, 'V'), (0x1B7, 'M', u'ʒ'), (0x1B8, 'M', u'ƹ'), (0x1B9, 'V'), (0x1BC, 'M', u'ƽ'), (0x1BD, 'V'), (0x1C4, 'M', u'dž'), (0x1C7, 'M', u'lj'), (0x1CA, 'M', u'nj'), (0x1CD, 'M', u'ǎ'), (0x1CE, 'V'), (0x1CF, 'M', u'ǐ'), (0x1D0, 'V'), (0x1D1, 'M', u'ǒ'), (0x1D2, 'V'), (0x1D3, 'M', u'ǔ'), (0x1D4, 'V'), (0x1D5, 'M', u'ǖ'), (0x1D6, 'V'), (0x1D7, 'M', u'ǘ'), (0x1D8, 'V'), (0x1D9, 'M', u'ǚ'), (0x1DA, 'V'), (0x1DB, 'M', u'ǜ'), (0x1DC, 'V'), (0x1DE, 'M', u'ǟ'), (0x1DF, 'V'), (0x1E0, 'M', u'ǡ'), (0x1E1, 'V'), (0x1E2, 'M', u'ǣ'), (0x1E3, 'V'), (0x1E4, 'M', u'ǥ'), (0x1E5, 'V'), (0x1E6, 'M', u'ǧ'), (0x1E7, 'V'), (0x1E8, 'M', u'ǩ'), (0x1E9, 'V'), (0x1EA, 'M', u'ǫ'), (0x1EB, 'V'), (0x1EC, 'M', u'ǭ'), (0x1ED, 'V'), (0x1EE, 'M', u'ǯ'), (0x1EF, 'V'), (0x1F1, 'M', u'dz'), (0x1F4, 'M', u'ǵ'), (0x1F5, 'V'), (0x1F6, 'M', u'ƕ'), (0x1F7, 'M', u'ƿ'), (0x1F8, 'M', u'ǹ'), (0x1F9, 'V'), (0x1FA, 'M', u'ǻ'), (0x1FB, 'V'), (0x1FC, 'M', u'ǽ'), (0x1FD, 'V'), (0x1FE, 'M', u'ǿ'), (0x1FF, 'V'), (0x200, 'M', u'ȁ'), (0x201, 'V'), (0x202, 'M', u'ȃ'), (0x203, 'V'), (0x204, 'M', u'ȅ'), (0x205, 'V'), (0x206, 'M', u'ȇ'), (0x207, 'V'), (0x208, 'M', u'ȉ'), (0x209, 'V'), (0x20A, 'M', u'ȋ'), (0x20B, 'V'), (0x20C, 'M', u'ȍ'), ] def _seg_5(): return [ (0x20D, 'V'), (0x20E, 'M', u'ȏ'), (0x20F, 'V'), (0x210, 'M', u'ȑ'), (0x211, 'V'), (0x212, 'M', u'ȓ'), (0x213, 'V'), (0x214, 'M', u'ȕ'), (0x215, 'V'), (0x216, 'M', u'ȗ'), (0x217, 'V'), (0x218, 'M', u'ș'), (0x219, 'V'), (0x21A, 'M', u'ț'), (0x21B, 'V'), (0x21C, 'M', u'ȝ'), (0x21D, 'V'), (0x21E, 'M', u'ȟ'), (0x21F, 'V'), (0x220, 'M', u'ƞ'), (0x221, 'V'), (0x222, 'M', u'ȣ'), (0x223, 'V'), (0x224, 'M', u'ȥ'), (0x225, 'V'), (0x226, 'M', u'ȧ'), (0x227, 'V'), (0x228, 'M', u'ȩ'), (0x229, 'V'), (0x22A, 'M', u'ȫ'), (0x22B, 'V'), (0x22C, 'M', u'ȭ'), (0x22D, 'V'), (0x22E, 'M', u'ȯ'), (0x22F, 'V'), (0x230, 'M', u'ȱ'), (0x231, 'V'), (0x232, 'M', u'ȳ'), (0x233, 'V'), (0x23A, 'M', u'ⱥ'), (0x23B, 'M', u'ȼ'), (0x23C, 'V'), (0x23D, 'M', u'ƚ'), (0x23E, 'M', u'ⱦ'), (0x23F, 'V'), (0x241, 'M', u'ɂ'), (0x242, 'V'), (0x243, 'M', u'ƀ'), (0x244, 'M', u'ʉ'), (0x245, 'M', u'ʌ'), (0x246, 'M', u'ɇ'), (0x247, 'V'), (0x248, 'M', u'ɉ'), (0x249, 'V'), (0x24A, 'M', u'ɋ'), (0x24B, 'V'), (0x24C, 'M', u'ɍ'), (0x24D, 'V'), (0x24E, 'M', u'ɏ'), (0x24F, 'V'), (0x2B0, 'M', u'h'), (0x2B1, 'M', u'ɦ'), (0x2B2, 'M', u'j'), (0x2B3, 'M', u'r'), (0x2B4, 'M', u'ɹ'), (0x2B5, 'M', u'ɻ'), (0x2B6, 'M', u'ʁ'), (0x2B7, 'M', u'w'), (0x2B8, 'M', u'y'), (0x2B9, 'V'), (0x2D8, '3', u' ̆'), (0x2D9, '3', u' ̇'), (0x2DA, '3', u' ̊'), (0x2DB, '3', u' ̨'), (0x2DC, '3', u' ̃'), (0x2DD, '3', u' ̋'), (0x2DE, 'V'), (0x2E0, 'M', u'ɣ'), (0x2E1, 'M', u'l'), (0x2E2, 'M', u's'), (0x2E3, 'M', u'x'), (0x2E4, 'M', u'ʕ'), (0x2E5, 'V'), (0x340, 'M', u'̀'), (0x341, 'M', u'́'), (0x342, 'V'), (0x343, 'M', u'̓'), (0x344, 'M', u'̈́'), (0x345, 'M', u'ι'), (0x346, 'V'), (0x34F, 'I'), (0x350, 'V'), (0x370, 'M', u'ͱ'), (0x371, 'V'), (0x372, 'M', u'ͳ'), (0x373, 'V'), (0x374, 'M', u'ʹ'), (0x375, 'V'), (0x376, 'M', u'ͷ'), (0x377, 'V'), ] def _seg_6(): return [ (0x378, 'X'), (0x37A, '3', u' ι'), (0x37B, 'V'), (0x37E, '3', u';'), (0x37F, 'M', u'ϳ'), (0x380, 'X'), (0x384, '3', u' ́'), (0x385, '3', u' ̈́'), (0x386, 'M', u'ά'), (0x387, 'M', u'·'), (0x388, 'M', u'έ'), (0x389, 'M', u'ή'), (0x38A, 'M', u'ί'), (0x38B, 'X'), (0x38C, 'M', u'ό'), (0x38D, 'X'), (0x38E, 'M', u'ύ'), (0x38F, 'M', u'ώ'), (0x390, 'V'), (0x391, 'M', u'α'), (0x392, 'M', u'β'), (0x393, 'M', u'γ'), (0x394, 'M', u'δ'), (0x395, 'M', u'ε'), (0x396, 'M', u'ζ'), (0x397, 'M', u'η'), (0x398, 'M', u'θ'), (0x399, 'M', u'ι'), (0x39A, 'M', u'κ'), (0x39B, 'M', u'λ'), (0x39C, 'M', u'μ'), (0x39D, 'M', u'ν'), (0x39E, 'M', u'ξ'), (0x39F, 'M', u'ο'), (0x3A0, 'M', u'π'), (0x3A1, 'M', u'ρ'), (0x3A2, 'X'), (0x3A3, 'M', u'σ'), (0x3A4, 'M', u'τ'), (0x3A5, 'M', u'υ'), (0x3A6, 'M', u'φ'), (0x3A7, 'M', u'χ'), (0x3A8, 'M', u'ψ'), (0x3A9, 'M', u'ω'), (0x3AA, 'M', u'ϊ'), (0x3AB, 'M', u'ϋ'), (0x3AC, 'V'), (0x3C2, 'D', u'σ'), (0x3C3, 'V'), (0x3CF, 'M', u'ϗ'), (0x3D0, 'M', u'β'), (0x3D1, 'M', u'θ'), (0x3D2, 'M', u'υ'), (0x3D3, 'M', u'ύ'), (0x3D4, 'M', u'ϋ'), (0x3D5, 'M', u'φ'), (0x3D6, 'M', u'π'), (0x3D7, 'V'), (0x3D8, 'M', u'ϙ'), (0x3D9, 'V'), (0x3DA, 'M', u'ϛ'), (0x3DB, 'V'), (0x3DC, 'M', u'ϝ'), (0x3DD, 'V'), (0x3DE, 'M', u'ϟ'), (0x3DF, 'V'), (0x3E0, 'M', u'ϡ'), (0x3E1, 'V'), (0x3E2, 'M', u'ϣ'), (0x3E3, 'V'), (0x3E4, 'M', u'ϥ'), (0x3E5, 'V'), (0x3E6, 'M', u'ϧ'), (0x3E7, 'V'), (0x3E8, 'M', u'ϩ'), (0x3E9, 'V'), (0x3EA, 'M', u'ϫ'), (0x3EB, 'V'), (0x3EC, 'M', u'ϭ'), (0x3ED, 'V'), (0x3EE, 'M', u'ϯ'), (0x3EF, 'V'), (0x3F0, 'M', u'κ'), (0x3F1, 'M', u'ρ'), (0x3F2, 'M', u'σ'), (0x3F3, 'V'), (0x3F4, 'M', u'θ'), (0x3F5, 'M', u'ε'), (0x3F6, 'V'), (0x3F7, 'M', u'ϸ'), (0x3F8, 'V'), (0x3F9, 'M', u'σ'), (0x3FA, 'M', u'ϻ'), (0x3FB, 'V'), (0x3FD, 'M', u'ͻ'), (0x3FE, 'M', u'ͼ'), (0x3FF, 'M', u'ͽ'), (0x400, 'M', u'ѐ'), (0x401, 'M', u'ё'), (0x402, 'M', u'ђ'), ] def _seg_7(): return [ (0x403, 'M', u'ѓ'), (0x404, 'M', u'є'), (0x405, 'M', u'ѕ'), (0x406, 'M', u'і'), (0x407, 'M', u'ї'), (0x408, 'M', u'ј'), (0x409, 'M', u'љ'), (0x40A, 'M', u'њ'), (0x40B, 'M', u'ћ'), (0x40C, 'M', u'ќ'), (0x40D, 'M', u'ѝ'), (0x40E, 'M', u'ў'), (0x40F, 'M', u'џ'), (0x410, 'M', u'а'), (0x411, 'M', u'б'), (0x412, 'M', u'в'), (0x413, 'M', u'г'), (0x414, 'M', u'д'), (0x415, 'M', u'е'), (0x416, 'M', u'ж'), (0x417, 'M', u'з'), (0x418, 'M', u'и'), (0x419, 'M', u'й'), (0x41A, 'M', u'к'), (0x41B, 'M', u'л'), (0x41C, 'M', u'м'), (0x41D, 'M', u'н'), (0x41E, 'M', u'о'), (0x41F, 'M', u'п'), (0x420, 'M', u'р'), (0x421, 'M', u'с'), (0x422, 'M', u'т'), (0x423, 'M', u'у'), (0x424, 'M', u'ф'), (0x425, 'M', u'х'), (0x426, 'M', u'ц'), (0x427, 'M', u'ч'), (0x428, 'M', u'ш'), (0x429, 'M', u'щ'), (0x42A, 'M', u'ъ'), (0x42B, 'M', u'ы'), (0x42C, 'M', u'ь'), (0x42D, 'M', u'э'), (0x42E, 'M', u'ю'), (0x42F, 'M', u'я'), (0x430, 'V'), (0x460, 'M', u'ѡ'), (0x461, 'V'), (0x462, 'M', u'ѣ'), (0x463, 'V'), (0x464, 'M', u'ѥ'), (0x465, 'V'), (0x466, 'M', u'ѧ'), (0x467, 'V'), (0x468, 'M', u'ѩ'), (0x469, 'V'), (0x46A, 'M', u'ѫ'), (0x46B, 'V'), (0x46C, 'M', u'ѭ'), (0x46D, 'V'), (0x46E, 'M', u'ѯ'), (0x46F, 'V'), (0x470, 'M', u'ѱ'), (0x471, 'V'), (0x472, 'M', u'ѳ'), (0x473, 'V'), (0x474, 'M', u'ѵ'), (0x475, 'V'), (0x476, 'M', u'ѷ'), (0x477, 'V'), (0x478, 'M', u'ѹ'), (0x479, 'V'), (0x47A, 'M', u'ѻ'), (0x47B, 'V'), (0x47C, 'M', u'ѽ'), (0x47D, 'V'), (0x47E, 'M', u'ѿ'), (0x47F, 'V'), (0x480, 'M', u'ҁ'), (0x481, 'V'), (0x48A, 'M', u'ҋ'), (0x48B, 'V'), (0x48C, 'M', u'ҍ'), (0x48D, 'V'), (0x48E, 'M', u'ҏ'), (0x48F, 'V'), (0x490, 'M', u'ґ'), (0x491, 'V'), (0x492, 'M', u'ғ'), (0x493, 'V'), (0x494, 'M', u'ҕ'), (0x495, 'V'), (0x496, 'M', u'җ'), (0x497, 'V'), (0x498, 'M', u'ҙ'), (0x499, 'V'), (0x49A, 'M', u'қ'), (0x49B, 'V'), (0x49C, 'M', u'ҝ'), (0x49D, 'V'), ] def _seg_8(): return [ (0x49E, 'M', u'ҟ'), (0x49F, 'V'), (0x4A0, 'M', u'ҡ'), (0x4A1, 'V'), (0x4A2, 'M', u'ң'), (0x4A3, 'V'), (0x4A4, 'M', u'ҥ'), (0x4A5, 'V'), (0x4A6, 'M', u'ҧ'), (0x4A7, 'V'), (0x4A8, 'M', u'ҩ'), (0x4A9, 'V'), (0x4AA, 'M', u'ҫ'), (0x4AB, 'V'), (0x4AC, 'M', u'ҭ'), (0x4AD, 'V'), (0x4AE, 'M', u'ү'), (0x4AF, 'V'), (0x4B0, 'M', u'ұ'), (0x4B1, 'V'), (0x4B2, 'M', u'ҳ'), (0x4B3, 'V'), (0x4B4, 'M', u'ҵ'), (0x4B5, 'V'), (0x4B6, 'M', u'ҷ'), (0x4B7, 'V'), (0x4B8, 'M', u'ҹ'), (0x4B9, 'V'), (0x4BA, 'M', u'һ'), (0x4BB, 'V'), (0x4BC, 'M', u'ҽ'), (0x4BD, 'V'), (0x4BE, 'M', u'ҿ'), (0x4BF, 'V'), (0x4C0, 'X'), (0x4C1, 'M', u'ӂ'), (0x4C2, 'V'), (0x4C3, 'M', u'ӄ'), (0x4C4, 'V'), (0x4C5, 'M', u'ӆ'), (0x4C6, 'V'), (0x4C7, 'M', u'ӈ'), (0x4C8, 'V'), (0x4C9, 'M', u'ӊ'), (0x4CA, 'V'), (0x4CB, 'M', u'ӌ'), (0x4CC, 'V'), (0x4CD, 'M', u'ӎ'), (0x4CE, 'V'), (0x4D0, 'M', u'ӑ'), (0x4D1, 'V'), (0x4D2, 'M', u'ӓ'), (0x4D3, 'V'), (0x4D4, 'M', u'ӕ'), (0x4D5, 'V'), (0x4D6, 'M', u'ӗ'), (0x4D7, 'V'), (0x4D8, 'M', u'ә'), (0x4D9, 'V'), (0x4DA, 'M', u'ӛ'), (0x4DB, 'V'), (0x4DC, 'M', u'ӝ'), (0x4DD, 'V'), (0x4DE, 'M', u'ӟ'), (0x4DF, 'V'), (0x4E0, 'M', u'ӡ'), (0x4E1, 'V'), (0x4E2, 'M', u'ӣ'), (0x4E3, 'V'), (0x4E4, 'M', u'ӥ'), (0x4E5, 'V'), (0x4E6, 'M', u'ӧ'), (0x4E7, 'V'), (0x4E8, 'M', u'ө'), (0x4E9, 'V'), (0x4EA, 'M', u'ӫ'), (0x4EB, 'V'), (0x4EC, 'M', u'ӭ'), (0x4ED, 'V'), (0x4EE, 'M', u'ӯ'), (0x4EF, 'V'), (0x4F0, 'M', u'ӱ'), (0x4F1, 'V'), (0x4F2, 'M', u'ӳ'), (0x4F3, 'V'), (0x4F4, 'M', u'ӵ'), (0x4F5, 'V'), (0x4F6, 'M', u'ӷ'), (0x4F7, 'V'), (0x4F8, 'M', u'ӹ'), (0x4F9, 'V'), (0x4FA, 'M', u'ӻ'), (0x4FB, 'V'), (0x4FC, 'M', u'ӽ'), (0x4FD, 'V'), (0x4FE, 'M', u'ӿ'), (0x4FF, 'V'), (0x500, 'M', u'ԁ'), (0x501, 'V'), (0x502, 'M', u'ԃ'), ] def _seg_9(): return [ (0x503, 'V'), (0x504, 'M', u'ԅ'), (0x505, 'V'), (0x506, 'M', u'ԇ'), (0x507, 'V'), (0x508, 'M', u'ԉ'), (0x509, 'V'), (0x50A, 'M', u'ԋ'), (0x50B, 'V'), (0x50C, 'M', u'ԍ'), (0x50D, 'V'), (0x50E, 'M', u'ԏ'), (0x50F, 'V'), (0x510, 'M', u'ԑ'), (0x511, 'V'), (0x512, 'M', u'ԓ'), (0x513, 'V'), (0x514, 'M', u'ԕ'), (0x515, 'V'), (0x516, 'M', u'ԗ'), (0x517, 'V'), (0x518, 'M', u'ԙ'), (0x519, 'V'), (0x51A, 'M', u'ԛ'), (0x51B, 'V'), (0x51C, 'M', u'ԝ'), (0x51D, 'V'), (0x51E, 'M', u'ԟ'), (0x51F, 'V'), (0x520, 'M', u'ԡ'), (0x521, 'V'), (0x522, 'M', u'ԣ'), (0x523, 'V'), (0x524, 'M', u'ԥ'), (0x525, 'V'), (0x526, 'M', u'ԧ'), (0x527, 'V'), (0x528, 'M', u'ԩ'), (0x529, 'V'), (0x52A, 'M', u'ԫ'), (0x52B, 'V'), (0x52C, 'M', u'ԭ'), (0x52D, 'V'), (0x52E, 'M', u'ԯ'), (0x52F, 'V'), (0x530, 'X'), (0x531, 'M', u'ա'), (0x532, 'M', u'բ'), (0x533, 'M', u'գ'), (0x534, 'M', u'դ'), (0x535, 'M', u'ե'), (0x536, 'M', u'զ'), (0x537, 'M', u'է'), (0x538, 'M', u'ը'), (0x539, 'M', u'թ'), (0x53A, 'M', u'ժ'), (0x53B, 'M', u'ի'), (0x53C, 'M', u'լ'), (0x53D, 'M', u'խ'), (0x53E, 'M', u'ծ'), (0x53F, 'M', u'կ'), (0x540, 'M', u'հ'), (0x541, 'M', u'ձ'), (0x542, 'M', u'ղ'), (0x543, 'M', u'ճ'), (0x544, 'M', u'մ'), (0x545, 'M', u'յ'), (0x546, 'M', u'ն'), (0x547, 'M', u'շ'), (0x548, 'M', u'ո'), (0x549, 'M', u'չ'), (0x54A, 'M', u'պ'), (0x54B, 'M', u'ջ'), (0x54C, 'M', u'ռ'), (0x54D, 'M', u'ս'), (0x54E, 'M', u'վ'), (0x54F, 'M', u'տ'), (0x550, 'M', u'ր'), (0x551, 'M', u'ց'), (0x552, 'M', u'ւ'), (0x553, 'M', u'փ'), (0x554, 'M', u'ք'), (0x555, 'M', u'օ'), (0x556, 'M', u'ֆ'), (0x557, 'X'), (0x559, 'V'), (0x587, 'M', u'եւ'), (0x588, 'V'), (0x58B, 'X'), (0x58D, 'V'), (0x590, 'X'), (0x591, 'V'), (0x5C8, 'X'), (0x5D0, 'V'), (0x5EB, 'X'), (0x5EF, 'V'), (0x5F5, 'X'), (0x606, 'V'), (0x61C, 'X'), (0x61E, 'V'), ] def _seg_10(): return [ (0x675, 'M', u'اٴ'), (0x676, 'M', u'وٴ'), (0x677, 'M', u'ۇٴ'), (0x678, 'M', u'يٴ'), (0x679, 'V'), (0x6DD, 'X'), (0x6DE, 'V'), (0x70E, 'X'), (0x710, 'V'), (0x74B, 'X'), (0x74D, 'V'), (0x7B2, 'X'), (0x7C0, 'V'), (0x7FB, 'X'), (0x7FD, 'V'), (0x82E, 'X'), (0x830, 'V'), (0x83F, 'X'), (0x840, 'V'), (0x85C, 'X'), (0x85E, 'V'), (0x85F, 'X'), (0x860, 'V'), (0x86B, 'X'), (0x8A0, 'V'), (0x8B5, 'X'), (0x8B6, 'V'), (0x8C8, 'X'), (0x8D3, 'V'), (0x8E2, 'X'), (0x8E3, 'V'), (0x958, 'M', u'क़'), (0x959, 'M', u'ख़'), (0x95A, 'M', u'ग़'), (0x95B, 'M', u'ज़'), (0x95C, 'M', u'ड़'), (0x95D, 'M', u'ढ़'), (0x95E, 'M', u'फ़'), (0x95F, 'M', u'य़'), (0x960, 'V'), (0x984, 'X'), (0x985, 'V'), (0x98D, 'X'), (0x98F, 'V'), (0x991, 'X'), (0x993, 'V'), (0x9A9, 'X'), (0x9AA, 'V'), (0x9B1, 'X'), (0x9B2, 'V'), (0x9B3, 'X'), (0x9B6, 'V'), (0x9BA, 'X'), (0x9BC, 'V'), (0x9C5, 'X'), (0x9C7, 'V'), (0x9C9, 'X'), (0x9CB, 'V'), (0x9CF, 'X'), (0x9D7, 'V'), (0x9D8, 'X'), (0x9DC, 'M', u'ড়'), (0x9DD, 'M', u'ঢ়'), (0x9DE, 'X'), (0x9DF, 'M', u'য়'), (0x9E0, 'V'), (0x9E4, 'X'), (0x9E6, 'V'), (0x9FF, 'X'), (0xA01, 'V'), (0xA04, 'X'), (0xA05, 'V'), (0xA0B, 'X'), (0xA0F, 'V'), (0xA11, 'X'), (0xA13, 'V'), (0xA29, 'X'), (0xA2A, 'V'), (0xA31, 'X'), (0xA32, 'V'), (0xA33, 'M', u'ਲ਼'), (0xA34, 'X'), (0xA35, 'V'), (0xA36, 'M', u'ਸ਼'), (0xA37, 'X'), (0xA38, 'V'), (0xA3A, 'X'), (0xA3C, 'V'), (0xA3D, 'X'), (0xA3E, 'V'), (0xA43, 'X'), (0xA47, 'V'), (0xA49, 'X'), (0xA4B, 'V'), (0xA4E, 'X'), (0xA51, 'V'), (0xA52, 'X'), (0xA59, 'M', u'ਖ਼'), (0xA5A, 'M', u'ਗ਼'), (0xA5B, 'M', u'ਜ਼'), ] def _seg_11(): return [ (0xA5C, 'V'), (0xA5D, 'X'), (0xA5E, 'M', u'ਫ਼'), (0xA5F, 'X'), (0xA66, 'V'), (0xA77, 'X'), (0xA81, 'V'), (0xA84, 'X'), (0xA85, 'V'), (0xA8E, 'X'), (0xA8F, 'V'), (0xA92, 'X'), (0xA93, 'V'), (0xAA9, 'X'), (0xAAA, 'V'), (0xAB1, 'X'), (0xAB2, 'V'), (0xAB4, 'X'), (0xAB5, 'V'), (0xABA, 'X'), (0xABC, 'V'), (0xAC6, 'X'), (0xAC7, 'V'), (0xACA, 'X'), (0xACB, 'V'), (0xACE, 'X'), (0xAD0, 'V'), (0xAD1, 'X'), (0xAE0, 'V'), (0xAE4, 'X'), (0xAE6, 'V'), (0xAF2, 'X'), (0xAF9, 'V'), (0xB00, 'X'), (0xB01, 'V'), (0xB04, 'X'), (0xB05, 'V'), (0xB0D, 'X'), (0xB0F, 'V'), (0xB11, 'X'), (0xB13, 'V'), (0xB29, 'X'), (0xB2A, 'V'), (0xB31, 'X'), (0xB32, 'V'), (0xB34, 'X'), (0xB35, 'V'), (0xB3A, 'X'), (0xB3C, 'V'), (0xB45, 'X'), (0xB47, 'V'), (0xB49, 'X'), (0xB4B, 'V'), (0xB4E, 'X'), (0xB55, 'V'), (0xB58, 'X'), (0xB5C, 'M', u'ଡ଼'), (0xB5D, 'M', u'ଢ଼'), (0xB5E, 'X'), (0xB5F, 'V'), (0xB64, 'X'), (0xB66, 'V'), (0xB78, 'X'), (0xB82, 'V'), (0xB84, 'X'), (0xB85, 'V'), (0xB8B, 'X'), (0xB8E, 'V'), (0xB91, 'X'), (0xB92, 'V'), (0xB96, 'X'), (0xB99, 'V'), (0xB9B, 'X'), (0xB9C, 'V'), (0xB9D, 'X'), (0xB9E, 'V'), (0xBA0, 'X'), (0xBA3, 'V'), (0xBA5, 'X'), (0xBA8, 'V'), (0xBAB, 'X'), (0xBAE, 'V'), (0xBBA, 'X'), (0xBBE, 'V'), (0xBC3, 'X'), (0xBC6, 'V'), (0xBC9, 'X'), (0xBCA, 'V'), (0xBCE, 'X'), (0xBD0, 'V'), (0xBD1, 'X'), (0xBD7, 'V'), (0xBD8, 'X'), (0xBE6, 'V'), (0xBFB, 'X'), (0xC00, 'V'), (0xC0D, 'X'), (0xC0E, 'V'), (0xC11, 'X'), (0xC12, 'V'), ] def _seg_12(): return [ (0xC29, 'X'), (0xC2A, 'V'), (0xC3A, 'X'), (0xC3D, 'V'), (0xC45, 'X'), (0xC46, 'V'), (0xC49, 'X'), (0xC4A, 'V'), (0xC4E, 'X'), (0xC55, 'V'), (0xC57, 'X'), (0xC58, 'V'), (0xC5B, 'X'), (0xC60, 'V'), (0xC64, 'X'), (0xC66, 'V'), (0xC70, 'X'), (0xC77, 'V'), (0xC8D, 'X'), (0xC8E, 'V'), (0xC91, 'X'), (0xC92, 'V'), (0xCA9, 'X'), (0xCAA, 'V'), (0xCB4, 'X'), (0xCB5, 'V'), (0xCBA, 'X'), (0xCBC, 'V'), (0xCC5, 'X'), (0xCC6, 'V'), (0xCC9, 'X'), (0xCCA, 'V'), (0xCCE, 'X'), (0xCD5, 'V'), (0xCD7, 'X'), (0xCDE, 'V'), (0xCDF, 'X'), (0xCE0, 'V'), (0xCE4, 'X'), (0xCE6, 'V'), (0xCF0, 'X'), (0xCF1, 'V'), (0xCF3, 'X'), (0xD00, 'V'), (0xD0D, 'X'), (0xD0E, 'V'), (0xD11, 'X'), (0xD12, 'V'), (0xD45, 'X'), (0xD46, 'V'), (0xD49, 'X'), (0xD4A, 'V'), (0xD50, 'X'), (0xD54, 'V'), (0xD64, 'X'), (0xD66, 'V'), (0xD80, 'X'), (0xD81, 'V'), (0xD84, 'X'), (0xD85, 'V'), (0xD97, 'X'), (0xD9A, 'V'), (0xDB2, 'X'), (0xDB3, 'V'), (0xDBC, 'X'), (0xDBD, 'V'), (0xDBE, 'X'), (0xDC0, 'V'), (0xDC7, 'X'), (0xDCA, 'V'), (0xDCB, 'X'), (0xDCF, 'V'), (0xDD5, 'X'), (0xDD6, 'V'), (0xDD7, 'X'), (0xDD8, 'V'), (0xDE0, 'X'), (0xDE6, 'V'), (0xDF0, 'X'), (0xDF2, 'V'), (0xDF5, 'X'), (0xE01, 'V'), (0xE33, 'M', u'ํา'), (0xE34, 'V'), (0xE3B, 'X'), (0xE3F, 'V'), (0xE5C, 'X'), (0xE81, 'V'), (0xE83, 'X'), (0xE84, 'V'), (0xE85, 'X'), (0xE86, 'V'), (0xE8B, 'X'), (0xE8C, 'V'), (0xEA4, 'X'), (0xEA5, 'V'), (0xEA6, 'X'), (0xEA7, 'V'), (0xEB3, 'M', u'ໍາ'), (0xEB4, 'V'), ] def _seg_13(): return [ (0xEBE, 'X'), (0xEC0, 'V'), (0xEC5, 'X'), (0xEC6, 'V'), (0xEC7, 'X'), (0xEC8, 'V'), (0xECE, 'X'), (0xED0, 'V'), (0xEDA, 'X'), (0xEDC, 'M', u'ຫນ'), (0xEDD, 'M', u'ຫມ'), (0xEDE, 'V'), (0xEE0, 'X'), (0xF00, 'V'), (0xF0C, 'M', u'་'), (0xF0D, 'V'), (0xF43, 'M', u'གྷ'), (0xF44, 'V'), (0xF48, 'X'), (0xF49, 'V'), (0xF4D, 'M', u'ཌྷ'), (0xF4E, 'V'), (0xF52, 'M', u'དྷ'), (0xF53, 'V'), (0xF57, 'M', u'བྷ'), (0xF58, 'V'), (0xF5C, 'M', u'ཛྷ'), (0xF5D, 'V'), (0xF69, 'M', u'ཀྵ'), (0xF6A, 'V'), (0xF6D, 'X'), (0xF71, 'V'), (0xF73, 'M', u'ཱི'), (0xF74, 'V'), (0xF75, 'M', u'ཱུ'), (0xF76, 'M', u'ྲྀ'), (0xF77, 'M', u'ྲཱྀ'), (0xF78, 'M', u'ླྀ'), (0xF79, 'M', u'ླཱྀ'), (0xF7A, 'V'), (0xF81, 'M', u'ཱྀ'), (0xF82, 'V'), (0xF93, 'M', u'ྒྷ'), (0xF94, 'V'), (0xF98, 'X'), (0xF99, 'V'), (0xF9D, 'M', u'ྜྷ'), (0xF9E, 'V'), (0xFA2, 'M', u'ྡྷ'), (0xFA3, 'V'), (0xFA7, 'M', u'ྦྷ'), (0xFA8, 'V'), (0xFAC, 'M', u'ྫྷ'), (0xFAD, 'V'), (0xFB9, 'M', u'ྐྵ'), (0xFBA, 'V'), (0xFBD, 'X'), (0xFBE, 'V'), (0xFCD, 'X'), (0xFCE, 'V'), (0xFDB, 'X'), (0x1000, 'V'), (0x10A0, 'X'), (0x10C7, 'M', u'ⴧ'), (0x10C8, 'X'), (0x10CD, 'M', u'ⴭ'), (0x10CE, 'X'), (0x10D0, 'V'), (0x10FC, 'M', u'ნ'), (0x10FD, 'V'), (0x115F, 'X'), (0x1161, 'V'), (0x1249, 'X'), (0x124A, 'V'), (0x124E, 'X'), (0x1250, 'V'), (0x1257, 'X'), (0x1258, 'V'), (0x1259, 'X'), (0x125A, 'V'), (0x125E, 'X'), (0x1260, 'V'), (0x1289, 'X'), (0x128A, 'V'), (0x128E, 'X'), (0x1290, 'V'), (0x12B1, 'X'), (0x12B2, 'V'), (0x12B6, 'X'), (0x12B8, 'V'), (0x12BF, 'X'), (0x12C0, 'V'), (0x12C1, 'X'), (0x12C2, 'V'), (0x12C6, 'X'), (0x12C8, 'V'), (0x12D7, 'X'), (0x12D8, 'V'), (0x1311, 'X'), (0x1312, 'V'), ] def _seg_14(): return [ (0x1316, 'X'), (0x1318, 'V'), (0x135B, 'X'), (0x135D, 'V'), (0x137D, 'X'), (0x1380, 'V'), (0x139A, 'X'), (0x13A0, 'V'), (0x13F6, 'X'), (0x13F8, 'M', u'Ᏸ'), (0x13F9, 'M', u'Ᏹ'), (0x13FA, 'M', u'Ᏺ'), (0x13FB, 'M', u'Ᏻ'), (0x13FC, 'M', u'Ᏼ'), (0x13FD, 'M', u'Ᏽ'), (0x13FE, 'X'), (0x1400, 'V'), (0x1680, 'X'), (0x1681, 'V'), (0x169D, 'X'), (0x16A0, 'V'), (0x16F9, 'X'), (0x1700, 'V'), (0x170D, 'X'), (0x170E, 'V'), (0x1715, 'X'), (0x1720, 'V'), (0x1737, 'X'), (0x1740, 'V'), (0x1754, 'X'), (0x1760, 'V'), (0x176D, 'X'), (0x176E, 'V'), (0x1771, 'X'), (0x1772, 'V'), (0x1774, 'X'), (0x1780, 'V'), (0x17B4, 'X'), (0x17B6, 'V'), (0x17DE, 'X'), (0x17E0, 'V'), (0x17EA, 'X'), (0x17F0, 'V'), (0x17FA, 'X'), (0x1800, 'V'), (0x1806, 'X'), (0x1807, 'V'), (0x180B, 'I'), (0x180E, 'X'), (0x1810, 'V'), (0x181A, 'X'), (0x1820, 'V'), (0x1879, 'X'), (0x1880, 'V'), (0x18AB, 'X'), (0x18B0, 'V'), (0x18F6, 'X'), (0x1900, 'V'), (0x191F, 'X'), (0x1920, 'V'), (0x192C, 'X'), (0x1930, 'V'), (0x193C, 'X'), (0x1940, 'V'), (0x1941, 'X'), (0x1944, 'V'), (0x196E, 'X'), (0x1970, 'V'), (0x1975, 'X'), (0x1980, 'V'), (0x19AC, 'X'), (0x19B0, 'V'), (0x19CA, 'X'), (0x19D0, 'V'), (0x19DB, 'X'), (0x19DE, 'V'), (0x1A1C, 'X'), (0x1A1E, 'V'), (0x1A5F, 'X'), (0x1A60, 'V'), (0x1A7D, 'X'), (0x1A7F, 'V'), (0x1A8A, 'X'), (0x1A90, 'V'), (0x1A9A, 'X'), (0x1AA0, 'V'), (0x1AAE, 'X'), (0x1AB0, 'V'), (0x1AC1, 'X'), (0x1B00, 'V'), (0x1B4C, 'X'), (0x1B50, 'V'), (0x1B7D, 'X'), (0x1B80, 'V'), (0x1BF4, 'X'), (0x1BFC, 'V'), (0x1C38, 'X'), (0x1C3B, 'V'), (0x1C4A, 'X'), (0x1C4D, 'V'), ] def _seg_15(): return [ (0x1C80, 'M', u'в'), (0x1C81, 'M', u'д'), (0x1C82, 'M', u'о'), (0x1C83, 'M', u'с'), (0x1C84, 'M', u'т'), (0x1C86, 'M', u'ъ'), (0x1C87, 'M', u'ѣ'), (0x1C88, 'M', u'ꙋ'), (0x1C89, 'X'), (0x1C90, 'M', u'ა'), (0x1C91, 'M', u'ბ'), (0x1C92, 'M', u'გ'), (0x1C93, 'M', u'დ'), (0x1C94, 'M', u'ე'), (0x1C95, 'M', u'ვ'), (0x1C96, 'M', u'ზ'), (0x1C97, 'M', u'თ'), (0x1C98, 'M', u'ი'), (0x1C99, 'M', u'კ'), (0x1C9A, 'M', u'ლ'), (0x1C9B, 'M', u'მ'), (0x1C9C, 'M', u'ნ'), (0x1C9D, 'M', u'ო'), (0x1C9E, 'M', u'პ'), (0x1C9F, 'M', u'ჟ'), (0x1CA0, 'M', u'რ'), (0x1CA1, 'M', u'ს'), (0x1CA2, 'M', u'ტ'), (0x1CA3, 'M', u'უ'), (0x1CA4, 'M', u'ფ'), (0x1CA5, 'M', u'ქ'), (0x1CA6, 'M', u'ღ'), (0x1CA7, 'M', u'ყ'), (0x1CA8, 'M', u'შ'), (0x1CA9, 'M', u'ჩ'), (0x1CAA, 'M', u'ც'), (0x1CAB, 'M', u'ძ'), (0x1CAC, 'M', u'წ'), (0x1CAD, 'M', u'ჭ'), (0x1CAE, 'M', u'ხ'), (0x1CAF, 'M', u'ჯ'), (0x1CB0, 'M', u'ჰ'), (0x1CB1, 'M', u'ჱ'), (0x1CB2, 'M', u'ჲ'), (0x1CB3, 'M', u'ჳ'), (0x1CB4, 'M', u'ჴ'), (0x1CB5, 'M', u'ჵ'), (0x1CB6, 'M', u'ჶ'), (0x1CB7, 'M', u'ჷ'), (0x1CB8, 'M', u'ჸ'), (0x1CB9, 'M', u'ჹ'), (0x1CBA, 'M', u'ჺ'), (0x1CBB, 'X'), (0x1CBD, 'M', u'ჽ'), (0x1CBE, 'M', u'ჾ'), (0x1CBF, 'M', u'ჿ'), (0x1CC0, 'V'), (0x1CC8, 'X'), (0x1CD0, 'V'), (0x1CFB, 'X'), (0x1D00, 'V'), (0x1D2C, 'M', u'a'), (0x1D2D, 'M', u'æ'), (0x1D2E, 'M', u'b'), (0x1D2F, 'V'), (0x1D30, 'M', u'd'), (0x1D31, 'M', u'e'), (0x1D32, 'M', u'ǝ'), (0x1D33, 'M', u'g'), (0x1D34, 'M', u'h'), (0x1D35, 'M', u'i'), (0x1D36, 'M', u'j'), (0x1D37, 'M', u'k'), (0x1D38, 'M', u'l'), (0x1D39, 'M', u'm'), (0x1D3A, 'M', u'n'), (0x1D3B, 'V'), (0x1D3C, 'M', u'o'), (0x1D3D, 'M', u'ȣ'), (0x1D3E, 'M', u'p'), (0x1D3F, 'M', u'r'), (0x1D40, 'M', u't'), (0x1D41, 'M', u'u'), (0x1D42, 'M', u'w'), (0x1D43, 'M', u'a'), (0x1D44, 'M', u'ɐ'), (0x1D45, 'M', u'ɑ'), (0x1D46, 'M', u'ᴂ'), (0x1D47, 'M', u'b'), (0x1D48, 'M', u'd'), (0x1D49, 'M', u'e'), (0x1D4A, 'M', u'ə'), (0x1D4B, 'M', u'ɛ'), (0x1D4C, 'M', u'ɜ'), (0x1D4D, 'M', u'g'), (0x1D4E, 'V'), (0x1D4F, 'M', u'k'), (0x1D50, 'M', u'm'), (0x1D51, 'M', u'ŋ'), (0x1D52, 'M', u'o'), ] def _seg_16(): return [ (0x1D53, 'M', u'ɔ'), (0x1D54, 'M', u'ᴖ'), (0x1D55, 'M', u'ᴗ'), (0x1D56, 'M', u'p'), (0x1D57, 'M', u't'), (0x1D58, 'M', u'u'), (0x1D59, 'M', u'ᴝ'), (0x1D5A, 'M', u'ɯ'), (0x1D5B, 'M', u'v'), (0x1D5C, 'M', u'ᴥ'), (0x1D5D, 'M', u'β'), (0x1D5E, 'M', u'γ'), (0x1D5F, 'M', u'δ'), (0x1D60, 'M', u'φ'), (0x1D61, 'M', u'χ'), (0x1D62, 'M', u'i'), (0x1D63, 'M', u'r'), (0x1D64, 'M', u'u'), (0x1D65, 'M', u'v'), (0x1D66, 'M', u'β'), (0x1D67, 'M', u'γ'), (0x1D68, 'M', u'ρ'), (0x1D69, 'M', u'φ'), (0x1D6A, 'M', u'χ'), (0x1D6B, 'V'), (0x1D78, 'M', u'н'), (0x1D79, 'V'), (0x1D9B, 'M', u'ɒ'), (0x1D9C, 'M', u'c'), (0x1D9D, 'M', u'ɕ'), (0x1D9E, 'M', u'ð'), (0x1D9F, 'M', u'ɜ'), (0x1DA0, 'M', u'f'), (0x1DA1, 'M', u'ɟ'), (0x1DA2, 'M', u'ɡ'), (0x1DA3, 'M', u'ɥ'), (0x1DA4, 'M', u'ɨ'), (0x1DA5, 'M', u'ɩ'), (0x1DA6, 'M', u'ɪ'), (0x1DA7, 'M', u'ᵻ'), (0x1DA8, 'M', u'ʝ'), (0x1DA9, 'M', u'ɭ'), (0x1DAA, 'M', u'ᶅ'), (0x1DAB, 'M', u'ʟ'), (0x1DAC, 'M', u'ɱ'), (0x1DAD, 'M', u'ɰ'), (0x1DAE, 'M', u'ɲ'), (0x1DAF, 'M', u'ɳ'), (0x1DB0, 'M', u'ɴ'), (0x1DB1, 'M', u'ɵ'), (0x1DB2, 'M', u'ɸ'), (0x1DB3, 'M', u'ʂ'), (0x1DB4, 'M', u'ʃ'), (0x1DB5, 'M', u'ƫ'), (0x1DB6, 'M', u'ʉ'), (0x1DB7, 'M', u'ʊ'), (0x1DB8, 'M', u'ᴜ'), (0x1DB9, 'M', u'ʋ'), (0x1DBA, 'M', u'ʌ'), (0x1DBB, 'M', u'z'), (0x1DBC, 'M', u'ʐ'), (0x1DBD, 'M', u'ʑ'), (0x1DBE, 'M', u'ʒ'), (0x1DBF, 'M', u'θ'), (0x1DC0, 'V'), (0x1DFA, 'X'), (0x1DFB, 'V'), (0x1E00, 'M', u'ḁ'), (0x1E01, 'V'), (0x1E02, 'M', u'ḃ'), (0x1E03, 'V'), (0x1E04, 'M', u'ḅ'), (0x1E05, 'V'), (0x1E06, 'M', u'ḇ'), (0x1E07, 'V'), (0x1E08, 'M', u'ḉ'), (0x1E09, 'V'), (0x1E0A, 'M', u'ḋ'), (0x1E0B, 'V'), (0x1E0C, 'M', u'ḍ'), (0x1E0D, 'V'), (0x1E0E, 'M', u'ḏ'), (0x1E0F, 'V'), (0x1E10, 'M', u'ḑ'), (0x1E11, 'V'), (0x1E12, 'M', u'ḓ'), (0x1E13, 'V'), (0x1E14, 'M', u'ḕ'), (0x1E15, 'V'), (0x1E16, 'M', u'ḗ'), (0x1E17, 'V'), (0x1E18, 'M', u'ḙ'), (0x1E19, 'V'), (0x1E1A, 'M', u'ḛ'), (0x1E1B, 'V'), (0x1E1C, 'M', u'ḝ'), (0x1E1D, 'V'), (0x1E1E, 'M', u'ḟ'), (0x1E1F, 'V'), (0x1E20, 'M', u'ḡ'), ] def _seg_17(): return [ (0x1E21, 'V'), (0x1E22, 'M', u'ḣ'), (0x1E23, 'V'), (0x1E24, 'M', u'ḥ'), (0x1E25, 'V'), (0x1E26, 'M', u'ḧ'), (0x1E27, 'V'), (0x1E28, 'M', u'ḩ'), (0x1E29, 'V'), (0x1E2A, 'M', u'ḫ'), (0x1E2B, 'V'), (0x1E2C, 'M', u'ḭ'), (0x1E2D, 'V'), (0x1E2E, 'M', u'ḯ'), (0x1E2F, 'V'), (0x1E30, 'M', u'ḱ'), (0x1E31, 'V'), (0x1E32, 'M', u'ḳ'), (0x1E33, 'V'), (0x1E34, 'M', u'ḵ'), (0x1E35, 'V'), (0x1E36, 'M', u'ḷ'), (0x1E37, 'V'), (0x1E38, 'M', u'ḹ'), (0x1E39, 'V'), (0x1E3A, 'M', u'ḻ'), (0x1E3B, 'V'), (0x1E3C, 'M', u'ḽ'), (0x1E3D, 'V'), (0x1E3E, 'M', u'ḿ'), (0x1E3F, 'V'), (0x1E40, 'M', u'ṁ'), (0x1E41, 'V'), (0x1E42, 'M', u'ṃ'), (0x1E43, 'V'), (0x1E44, 'M', u'ṅ'), (0x1E45, 'V'), (0x1E46, 'M', u'ṇ'), (0x1E47, 'V'), (0x1E48, 'M', u'ṉ'), (0x1E49, 'V'), (0x1E4A, 'M', u'ṋ'), (0x1E4B, 'V'), (0x1E4C, 'M', u'ṍ'), (0x1E4D, 'V'), (0x1E4E, 'M', u'ṏ'), (0x1E4F, 'V'), (0x1E50, 'M', u'ṑ'), (0x1E51, 'V'), (0x1E52, 'M', u'ṓ'), (0x1E53, 'V'), (0x1E54, 'M', u'ṕ'), (0x1E55, 'V'), (0x1E56, 'M', u'ṗ'), (0x1E57, 'V'), (0x1E58, 'M', u'ṙ'), (0x1E59, 'V'), (0x1E5A, 'M', u'ṛ'), (0x1E5B, 'V'), (0x1E5C, 'M', u'ṝ'), (0x1E5D, 'V'), (0x1E5E, 'M', u'ṟ'), (0x1E5F, 'V'), (0x1E60, 'M', u'ṡ'), (0x1E61, 'V'), (0x1E62, 'M', u'ṣ'), (0x1E63, 'V'), (0x1E64, 'M', u'ṥ'), (0x1E65, 'V'), (0x1E66, 'M', u'ṧ'), (0x1E67, 'V'), (0x1E68, 'M', u'ṩ'), (0x1E69, 'V'), (0x1E6A, 'M', u'ṫ'), (0x1E6B, 'V'), (0x1E6C, 'M', u'ṭ'), (0x1E6D, 'V'), (0x1E6E, 'M', u'ṯ'), (0x1E6F, 'V'), (0x1E70, 'M', u'ṱ'), (0x1E71, 'V'), (0x1E72, 'M', u'ṳ'), (0x1E73, 'V'), (0x1E74, 'M', u'ṵ'), (0x1E75, 'V'), (0x1E76, 'M', u'ṷ'), (0x1E77, 'V'), (0x1E78, 'M', u'ṹ'), (0x1E79, 'V'), (0x1E7A, 'M', u'ṻ'), (0x1E7B, 'V'), (0x1E7C, 'M', u'ṽ'), (0x1E7D, 'V'), (0x1E7E, 'M', u'ṿ'), (0x1E7F, 'V'), (0x1E80, 'M', u'ẁ'), (0x1E81, 'V'), (0x1E82, 'M', u'ẃ'), (0x1E83, 'V'), (0x1E84, 'M', u'ẅ'), ] def _seg_18(): return [ (0x1E85, 'V'), (0x1E86, 'M', u'ẇ'), (0x1E87, 'V'), (0x1E88, 'M', u'ẉ'), (0x1E89, 'V'), (0x1E8A, 'M', u'ẋ'), (0x1E8B, 'V'), (0x1E8C, 'M', u'ẍ'), (0x1E8D, 'V'), (0x1E8E, 'M', u'ẏ'), (0x1E8F, 'V'), (0x1E90, 'M', u'ẑ'), (0x1E91, 'V'), (0x1E92, 'M', u'ẓ'), (0x1E93, 'V'), (0x1E94, 'M', u'ẕ'), (0x1E95, 'V'), (0x1E9A, 'M', u'aʾ'), (0x1E9B, 'M', u'ṡ'), (0x1E9C, 'V'), (0x1E9E, 'M', u'ss'), (0x1E9F, 'V'), (0x1EA0, 'M', u'ạ'), (0x1EA1, 'V'), (0x1EA2, 'M', u'ả'), (0x1EA3, 'V'), (0x1EA4, 'M', u'ấ'), (0x1EA5, 'V'), (0x1EA6, 'M', u'ầ'), (0x1EA7, 'V'), (0x1EA8, 'M', u'ẩ'), (0x1EA9, 'V'), (0x1EAA, 'M', u'ẫ'), (0x1EAB, 'V'), (0x1EAC, 'M', u'ậ'), (0x1EAD, 'V'), (0x1EAE, 'M', u'ắ'), (0x1EAF, 'V'), (0x1EB0, 'M', u'ằ'), (0x1EB1, 'V'), (0x1EB2, 'M', u'ẳ'), (0x1EB3, 'V'), (0x1EB4, 'M', u'ẵ'), (0x1EB5, 'V'), (0x1EB6, 'M', u'ặ'), (0x1EB7, 'V'), (0x1EB8, 'M', u'ẹ'), (0x1EB9, 'V'), (0x1EBA, 'M', u'ẻ'), (0x1EBB, 'V'), (0x1EBC, 'M', u'ẽ'), (0x1EBD, 'V'), (0x1EBE, 'M', u'ế'), (0x1EBF, 'V'), (0x1EC0, 'M', u'ề'), (0x1EC1, 'V'), (0x1EC2, 'M', u'ể'), (0x1EC3, 'V'), (0x1EC4, 'M', u'ễ'), (0x1EC5, 'V'), (0x1EC6, 'M', u'ệ'), (0x1EC7, 'V'), (0x1EC8, 'M', u'ỉ'), (0x1EC9, 'V'), (0x1ECA, 'M', u'ị'), (0x1ECB, 'V'), (0x1ECC, 'M', u'ọ'), (0x1ECD, 'V'), (0x1ECE, 'M', u'ỏ'), (0x1ECF, 'V'), (0x1ED0, 'M', u'ố'), (0x1ED1, 'V'), (0x1ED2, 'M', u'ồ'), (0x1ED3, 'V'), (0x1ED4, 'M', u'ổ'), (0x1ED5, 'V'), (0x1ED6, 'M', u'ỗ'), (0x1ED7, 'V'), (0x1ED8, 'M', u'ộ'), (0x1ED9, 'V'), (0x1EDA, 'M', u'ớ'), (0x1EDB, 'V'), (0x1EDC, 'M', u'ờ'), (0x1EDD, 'V'), (0x1EDE, 'M', u'ở'), (0x1EDF, 'V'), (0x1EE0, 'M', u'ỡ'), (0x1EE1, 'V'), (0x1EE2, 'M', u'ợ'), (0x1EE3, 'V'), (0x1EE4, 'M', u'ụ'), (0x1EE5, 'V'), (0x1EE6, 'M', u'ủ'), (0x1EE7, 'V'), (0x1EE8, 'M', u'ứ'), (0x1EE9, 'V'), (0x1EEA, 'M', u'ừ'), (0x1EEB, 'V'), (0x1EEC, 'M', u'ử'), (0x1EED, 'V'), ] def _seg_19(): return [ (0x1EEE, 'M', u'ữ'), (0x1EEF, 'V'), (0x1EF0, 'M', u'ự'), (0x1EF1, 'V'), (0x1EF2, 'M', u'ỳ'), (0x1EF3, 'V'), (0x1EF4, 'M', u'ỵ'), (0x1EF5, 'V'), (0x1EF6, 'M', u'ỷ'), (0x1EF7, 'V'), (0x1EF8, 'M', u'ỹ'), (0x1EF9, 'V'), (0x1EFA, 'M', u'ỻ'), (0x1EFB, 'V'), (0x1EFC, 'M', u'ỽ'), (0x1EFD, 'V'), (0x1EFE, 'M', u'ỿ'), (0x1EFF, 'V'), (0x1F08, 'M', u'ἀ'), (0x1F09, 'M', u'ἁ'), (0x1F0A, 'M', u'ἂ'), (0x1F0B, 'M', u'ἃ'), (0x1F0C, 'M', u'ἄ'), (0x1F0D, 'M', u'ἅ'), (0x1F0E, 'M', u'ἆ'), (0x1F0F, 'M', u'ἇ'), (0x1F10, 'V'), (0x1F16, 'X'), (0x1F18, 'M', u'ἐ'), (0x1F19, 'M', u'ἑ'), (0x1F1A, 'M', u'ἒ'), (0x1F1B, 'M', u'ἓ'), (0x1F1C, 'M', u'ἔ'), (0x1F1D, 'M', u'ἕ'), (0x1F1E, 'X'), (0x1F20, 'V'), (0x1F28, 'M', u'ἠ'), (0x1F29, 'M', u'ἡ'), (0x1F2A, 'M', u'ἢ'), (0x1F2B, 'M', u'ἣ'), (0x1F2C, 'M', u'ἤ'), (0x1F2D, 'M', u'ἥ'), (0x1F2E, 'M', u'ἦ'), (0x1F2F, 'M', u'ἧ'), (0x1F30, 'V'), (0x1F38, 'M', u'ἰ'), (0x1F39, 'M', u'ἱ'), (0x1F3A, 'M', u'ἲ'), (0x1F3B, 'M', u'ἳ'), (0x1F3C, 'M', u'ἴ'), (0x1F3D, 'M', u'ἵ'), (0x1F3E, 'M', u'ἶ'), (0x1F3F, 'M', u'ἷ'), (0x1F40, 'V'), (0x1F46, 'X'), (0x1F48, 'M', u'ὀ'), (0x1F49, 'M', u'ὁ'), (0x1F4A, 'M', u'ὂ'), (0x1F4B, 'M', u'ὃ'), (0x1F4C, 'M', u'ὄ'), (0x1F4D, 'M', u'ὅ'), (0x1F4E, 'X'), (0x1F50, 'V'), (0x1F58, 'X'), (0x1F59, 'M', u'ὑ'), (0x1F5A, 'X'), (0x1F5B, 'M', u'ὓ'), (0x1F5C, 'X'), (0x1F5D, 'M', u'ὕ'), (0x1F5E, 'X'), (0x1F5F, 'M', u'ὗ'), (0x1F60, 'V'), (0x1F68, 'M', u'ὠ'), (0x1F69, 'M', u'ὡ'), (0x1F6A, 'M', u'ὢ'), (0x1F6B, 'M', u'ὣ'), (0x1F6C, 'M', u'ὤ'), (0x1F6D, 'M', u'ὥ'), (0x1F6E, 'M', u'ὦ'), (0x1F6F, 'M', u'ὧ'), (0x1F70, 'V'), (0x1F71, 'M', u'ά'), (0x1F72, 'V'), (0x1F73, 'M', u'έ'), (0x1F74, 'V'), (0x1F75, 'M', u'ή'), (0x1F76, 'V'), (0x1F77, 'M', u'ί'), (0x1F78, 'V'), (0x1F79, 'M', u'ό'), (0x1F7A, 'V'), (0x1F7B, 'M', u'ύ'), (0x1F7C, 'V'), (0x1F7D, 'M', u'ώ'), (0x1F7E, 'X'), (0x1F80, 'M', u'ἀι'), (0x1F81, 'M', u'ἁι'), (0x1F82, 'M', u'ἂι'), (0x1F83, 'M', u'ἃι'), (0x1F84, 'M', u'ἄι'), ] def _seg_20(): return [ (0x1F85, 'M', u'ἅι'), (0x1F86, 'M', u'ἆι'), (0x1F87, 'M', u'ἇι'), (0x1F88, 'M', u'ἀι'), (0x1F89, 'M', u'ἁι'), (0x1F8A, 'M', u'ἂι'), (0x1F8B, 'M', u'ἃι'), (0x1F8C, 'M', u'ἄι'), (0x1F8D, 'M', u'ἅι'), (0x1F8E, 'M', u'ἆι'), (0x1F8F, 'M', u'ἇι'), (0x1F90, 'M', u'ἠι'), (0x1F91, 'M', u'ἡι'), (0x1F92, 'M', u'ἢι'), (0x1F93, 'M', u'ἣι'), (0x1F94, 'M', u'ἤι'), (0x1F95, 'M', u'ἥι'), (0x1F96, 'M', u'ἦι'), (0x1F97, 'M', u'ἧι'), (0x1F98, 'M', u'ἠι'), (0x1F99, 'M', u'ἡι'), (0x1F9A, 'M', u'ἢι'), (0x1F9B, 'M', u'ἣι'), (0x1F9C, 'M', u'ἤι'), (0x1F9D, 'M', u'ἥι'), (0x1F9E, 'M', u'ἦι'), (0x1F9F, 'M', u'ἧι'), (0x1FA0, 'M', u'ὠι'), (0x1FA1, 'M', u'ὡι'), (0x1FA2, 'M', u'ὢι'), (0x1FA3, 'M', u'ὣι'), (0x1FA4, 'M', u'ὤι'), (0x1FA5, 'M', u'ὥι'), (0x1FA6, 'M', u'ὦι'), (0x1FA7, 'M', u'ὧι'), (0x1FA8, 'M', u'ὠι'), (0x1FA9, 'M', u'ὡι'), (0x1FAA, 'M', u'ὢι'), (0x1FAB, 'M', u'ὣι'), (0x1FAC, 'M', u'ὤι'), (0x1FAD, 'M', u'ὥι'), (0x1FAE, 'M', u'ὦι'), (0x1FAF, 'M', u'ὧι'), (0x1FB0, 'V'), (0x1FB2, 'M', u'ὰι'), (0x1FB3, 'M', u'αι'), (0x1FB4, 'M', u'άι'), (0x1FB5, 'X'), (0x1FB6, 'V'), (0x1FB7, 'M', u'ᾶι'), (0x1FB8, 'M', u'ᾰ'), (0x1FB9, 'M', u'ᾱ'), (0x1FBA, 'M', u'ὰ'), (0x1FBB, 'M', u'ά'), (0x1FBC, 'M', u'αι'), (0x1FBD, '3', u' ̓'), (0x1FBE, 'M', u'ι'), (0x1FBF, '3', u' ̓'), (0x1FC0, '3', u' ͂'), (0x1FC1, '3', u' ̈͂'), (0x1FC2, 'M', u'ὴι'), (0x1FC3, 'M', u'ηι'), (0x1FC4, 'M', u'ήι'), (0x1FC5, 'X'), (0x1FC6, 'V'), (0x1FC7, 'M', u'ῆι'), (0x1FC8, 'M', u'ὲ'), (0x1FC9, 'M', u'έ'), (0x1FCA, 'M', u'ὴ'), (0x1FCB, 'M', u'ή'), (0x1FCC, 'M', u'ηι'), (0x1FCD, '3', u' ̓̀'), (0x1FCE, '3', u' ̓́'), (0x1FCF, '3', u' ̓͂'), (0x1FD0, 'V'), (0x1FD3, 'M', u'ΐ'), (0x1FD4, 'X'), (0x1FD6, 'V'), (0x1FD8, 'M', u'ῐ'), (0x1FD9, 'M', u'ῑ'), (0x1FDA, 'M', u'ὶ'), (0x1FDB, 'M', u'ί'), (0x1FDC, 'X'), (0x1FDD, '3', u' ̔̀'), (0x1FDE, '3', u' ̔́'), (0x1FDF, '3', u' ̔͂'), (0x1FE0, 'V'), (0x1FE3, 'M', u'ΰ'), (0x1FE4, 'V'), (0x1FE8, 'M', u'ῠ'), (0x1FE9, 'M', u'ῡ'), (0x1FEA, 'M', u'ὺ'), (0x1FEB, 'M', u'ύ'), (0x1FEC, 'M', u'ῥ'), (0x1FED, '3', u' ̈̀'), (0x1FEE, '3', u' ̈́'), (0x1FEF, '3', u'`'), (0x1FF0, 'X'), (0x1FF2, 'M', u'ὼι'), (0x1FF3, 'M', u'ωι'), ] def _seg_21(): return [ (0x1FF4, 'M', u'ώι'), (0x1FF5, 'X'), (0x1FF6, 'V'), (0x1FF7, 'M', u'ῶι'), (0x1FF8, 'M', u'ὸ'), (0x1FF9, 'M', u'ό'), (0x1FFA, 'M', u'ὼ'), (0x1FFB, 'M', u'ώ'), (0x1FFC, 'M', u'ωι'), (0x1FFD, '3', u' ́'), (0x1FFE, '3', u' ̔'), (0x1FFF, 'X'), (0x2000, '3', u' '), (0x200B, 'I'), (0x200C, 'D', u''), (0x200E, 'X'), (0x2010, 'V'), (0x2011, 'M', u'‐'), (0x2012, 'V'), (0x2017, '3', u' ̳'), (0x2018, 'V'), (0x2024, 'X'), (0x2027, 'V'), (0x2028, 'X'), (0x202F, '3', u' '), (0x2030, 'V'), (0x2033, 'M', u'′′'), (0x2034, 'M', u'′′′'), (0x2035, 'V'), (0x2036, 'M', u'‵‵'), (0x2037, 'M', u'‵‵‵'), (0x2038, 'V'), (0x203C, '3', u'!!'), (0x203D, 'V'), (0x203E, '3', u' ̅'), (0x203F, 'V'), (0x2047, '3', u'??'), (0x2048, '3', u'?!'), (0x2049, '3', u'!?'), (0x204A, 'V'), (0x2057, 'M', u'′′′′'), (0x2058, 'V'), (0x205F, '3', u' '), (0x2060, 'I'), (0x2061, 'X'), (0x2064, 'I'), (0x2065, 'X'), (0x2070, 'M', u'0'), (0x2071, 'M', u'i'), (0x2072, 'X'), (0x2074, 'M', u'4'), (0x2075, 'M', u'5'), (0x2076, 'M', u'6'), (0x2077, 'M', u'7'), (0x2078, 'M', u'8'), (0x2079, 'M', u'9'), (0x207A, '3', u'+'), (0x207B, 'M', u'−'), (0x207C, '3', u'='), (0x207D, '3', u'('), (0x207E, '3', u')'), (0x207F, 'M', u'n'), (0x2080, 'M', u'0'), (0x2081, 'M', u'1'), (0x2082, 'M', u'2'), (0x2083, 'M', u'3'), (0x2084, 'M', u'4'), (0x2085, 'M', u'5'), (0x2086, 'M', u'6'), (0x2087, 'M', u'7'), (0x2088, 'M', u'8'), (0x2089, 'M', u'9'), (0x208A, '3', u'+'), (0x208B, 'M', u'−'), (0x208C, '3', u'='), (0x208D, '3', u'('), (0x208E, '3', u')'), (0x208F, 'X'), (0x2090, 'M', u'a'), (0x2091, 'M', u'e'), (0x2092, 'M', u'o'), (0x2093, 'M', u'x'), (0x2094, 'M', u'ə'), (0x2095, 'M', u'h'), (0x2096, 'M', u'k'), (0x2097, 'M', u'l'), (0x2098, 'M', u'm'), (0x2099, 'M', u'n'), (0x209A, 'M', u'p'), (0x209B, 'M', u's'), (0x209C, 'M', u't'), (0x209D, 'X'), (0x20A0, 'V'), (0x20A8, 'M', u'rs'), (0x20A9, 'V'), (0x20C0, 'X'), (0x20D0, 'V'), (0x20F1, 'X'), (0x2100, '3', u'a/c'), (0x2101, '3', u'a/s'), ] def _seg_22(): return [ (0x2102, 'M', u'c'), (0x2103, 'M', u'°c'), (0x2104, 'V'), (0x2105, '3', u'c/o'), (0x2106, '3', u'c/u'), (0x2107, 'M', u'ɛ'), (0x2108, 'V'), (0x2109, 'M', u'°f'), (0x210A, 'M', u'g'), (0x210B, 'M', u'h'), (0x210F, 'M', u'ħ'), (0x2110, 'M', u'i'), (0x2112, 'M', u'l'), (0x2114, 'V'), (0x2115, 'M', u'n'), (0x2116, 'M', u'no'), (0x2117, 'V'), (0x2119, 'M', u'p'), (0x211A, 'M', u'q'), (0x211B, 'M', u'r'), (0x211E, 'V'), (0x2120, 'M', u'sm'), (0x2121, 'M', u'tel'), (0x2122, 'M', u'tm'), (0x2123, 'V'), (0x2124, 'M', u'z'), (0x2125, 'V'), (0x2126, 'M', u'ω'), (0x2127, 'V'), (0x2128, 'M', u'z'), (0x2129, 'V'), (0x212A, 'M', u'k'), (0x212B, 'M', u'å'), (0x212C, 'M', u'b'), (0x212D, 'M', u'c'), (0x212E, 'V'), (0x212F, 'M', u'e'), (0x2131, 'M', u'f'), (0x2132, 'X'), (0x2133, 'M', u'm'), (0x2134, 'M', u'o'), (0x2135, 'M', u'א'), (0x2136, 'M', u'ב'), (0x2137, 'M', u'ג'), (0x2138, 'M', u'ד'), (0x2139, 'M', u'i'), (0x213A, 'V'), (0x213B, 'M', u'fax'), (0x213C, 'M', u'π'), (0x213D, 'M', u'γ'), (0x213F, 'M', u'π'), (0x2140, 'M', u'∑'), (0x2141, 'V'), (0x2145, 'M', u'd'), (0x2147, 'M', u'e'), (0x2148, 'M', u'i'), (0x2149, 'M', u'j'), (0x214A, 'V'), (0x2150, 'M', u'1⁄7'), (0x2151, 'M', u'1⁄9'), (0x2152, 'M', u'1⁄10'), (0x2153, 'M', u'1⁄3'), (0x2154, 'M', u'2⁄3'), (0x2155, 'M', u'1⁄5'), (0x2156, 'M', u'2⁄5'), (0x2157, 'M', u'3⁄5'), (0x2158, 'M', u'4⁄5'), (0x2159, 'M', u'1⁄6'), (0x215A, 'M', u'5⁄6'), (0x215B, 'M', u'1⁄8'), (0x215C, 'M', u'3⁄8'), (0x215D, 'M', u'5⁄8'), (0x215E, 'M', u'7⁄8'), (0x215F, 'M', u'1⁄'), (0x2160, 'M', u'i'), (0x2161, 'M', u'ii'), (0x2162, 'M', u'iii'), (0x2163, 'M', u'iv'), (0x2164, 'M', u'v'), (0x2165, 'M', u'vi'), (0x2166, 'M', u'vii'), (0x2167, 'M', u'viii'), (0x2168, 'M', u'ix'), (0x2169, 'M', u'x'), (0x216A, 'M', u'xi'), (0x216B, 'M', u'xii'), (0x216C, 'M', u'l'), (0x216D, 'M', u'c'), (0x216E, 'M', u'd'), (0x216F, 'M', u'm'), (0x2170, 'M', u'i'), (0x2171, 'M', u'ii'), (0x2172, 'M', u'iii'), (0x2173, 'M', u'iv'), (0x2174, 'M', u'v'), (0x2175, 'M', u'vi'), (0x2176, 'M', u'vii'), (0x2177, 'M', u'viii'), (0x2178, 'M', u'ix'), (0x2179, 'M', u'x'), ] def _seg_23(): return [ (0x217A, 'M', u'xi'), (0x217B, 'M', u'xii'), (0x217C, 'M', u'l'), (0x217D, 'M', u'c'), (0x217E, 'M', u'd'), (0x217F, 'M', u'm'), (0x2180, 'V'), (0x2183, 'X'), (0x2184, 'V'), (0x2189, 'M', u'0⁄3'), (0x218A, 'V'), (0x218C, 'X'), (0x2190, 'V'), (0x222C, 'M', u'∫∫'), (0x222D, 'M', u'∫∫∫'), (0x222E, 'V'), (0x222F, 'M', u'∮∮'), (0x2230, 'M', u'∮∮∮'), (0x2231, 'V'), (0x2260, '3'), (0x2261, 'V'), (0x226E, '3'), (0x2270, 'V'), (0x2329, 'M', u'〈'), (0x232A, 'M', u'〉'), (0x232B, 'V'), (0x2427, 'X'), (0x2440, 'V'), (0x244B, 'X'), (0x2460, 'M', u'1'), (0x2461, 'M', u'2'), (0x2462, 'M', u'3'), (0x2463, 'M', u'4'), (0x2464, 'M', u'5'), (0x2465, 'M', u'6'), (0x2466, 'M', u'7'), (0x2467, 'M', u'8'), (0x2468, 'M', u'9'), (0x2469, 'M', u'10'), (0x246A, 'M', u'11'), (0x246B, 'M', u'12'), (0x246C, 'M', u'13'), (0x246D, 'M', u'14'), (0x246E, 'M', u'15'), (0x246F, 'M', u'16'), (0x2470, 'M', u'17'), (0x2471, 'M', u'18'), (0x2472, 'M', u'19'), (0x2473, 'M', u'20'), (0x2474, '3', u'(1)'), (0x2475, '3', u'(2)'), (0x2476, '3', u'(3)'), (0x2477, '3', u'(4)'), (0x2478, '3', u'(5)'), (0x2479, '3', u'(6)'), (0x247A, '3', u'(7)'), (0x247B, '3', u'(8)'), (0x247C, '3', u'(9)'), (0x247D, '3', u'(10)'), (0x247E, '3', u'(11)'), (0x247F, '3', u'(12)'), (0x2480, '3', u'(13)'), (0x2481, '3', u'(14)'), (0x2482, '3', u'(15)'), (0x2483, '3', u'(16)'), (0x2484, '3', u'(17)'), (0x2485, '3', u'(18)'), (0x2486, '3', u'(19)'), (0x2487, '3', u'(20)'), (0x2488, 'X'), (0x249C, '3', u'(a)'), (0x249D, '3', u'(b)'), (0x249E, '3', u'(c)'), (0x249F, '3', u'(d)'), (0x24A0, '3', u'(e)'), (0x24A1, '3', u'(f)'), (0x24A2, '3', u'(g)'), (0x24A3, '3', u'(h)'), (0x24A4, '3', u'(i)'), (0x24A5, '3', u'(j)'), (0x24A6, '3', u'(k)'), (0x24A7, '3', u'(l)'), (0x24A8, '3', u'(m)'), (0x24A9, '3', u'(n)'), (0x24AA, '3', u'(o)'), (0x24AB, '3', u'(p)'), (0x24AC, '3', u'(q)'), (0x24AD, '3', u'(r)'), (0x24AE, '3', u'(s)'), (0x24AF, '3', u'(t)'), (0x24B0, '3', u'(u)'), (0x24B1, '3', u'(v)'), (0x24B2, '3', u'(w)'), (0x24B3, '3', u'(x)'), (0x24B4, '3', u'(y)'), (0x24B5, '3', u'(z)'), (0x24B6, 'M', u'a'), (0x24B7, 'M', u'b'), (0x24B8, 'M', u'c'), (0x24B9, 'M', u'd'), ] def _seg_24(): return [ (0x24BA, 'M', u'e'), (0x24BB, 'M', u'f'), (0x24BC, 'M', u'g'), (0x24BD, 'M', u'h'), (0x24BE, 'M', u'i'), (0x24BF, 'M', u'j'), (0x24C0, 'M', u'k'), (0x24C1, 'M', u'l'), (0x24C2, 'M', u'm'), (0x24C3, 'M', u'n'), (0x24C4, 'M', u'o'), (0x24C5, 'M', u'p'), (0x24C6, 'M', u'q'), (0x24C7, 'M', u'r'), (0x24C8, 'M', u's'), (0x24C9, 'M', u't'), (0x24CA, 'M', u'u'), (0x24CB, 'M', u'v'), (0x24CC, 'M', u'w'), (0x24CD, 'M', u'x'), (0x24CE, 'M', u'y'), (0x24CF, 'M', u'z'), (0x24D0, 'M', u'a'), (0x24D1, 'M', u'b'), (0x24D2, 'M', u'c'), (0x24D3, 'M', u'd'), (0x24D4, 'M', u'e'), (0x24D5, 'M', u'f'), (0x24D6, 'M', u'g'), (0x24D7, 'M', u'h'), (0x24D8, 'M', u'i'), (0x24D9, 'M', u'j'), (0x24DA, 'M', u'k'), (0x24DB, 'M', u'l'), (0x24DC, 'M', u'm'), (0x24DD, 'M', u'n'), (0x24DE, 'M', u'o'), (0x24DF, 'M', u'p'), (0x24E0, 'M', u'q'), (0x24E1, 'M', u'r'), (0x24E2, 'M', u's'), (0x24E3, 'M', u't'), (0x24E4, 'M', u'u'), (0x24E5, 'M', u'v'), (0x24E6, 'M', u'w'), (0x24E7, 'M', u'x'), (0x24E8, 'M', u'y'), (0x24E9, 'M', u'z'), (0x24EA, 'M', u'0'), (0x24EB, 'V'), (0x2A0C, 'M', u'∫∫∫∫'), (0x2A0D, 'V'), (0x2A74, '3', u'::='), (0x2A75, '3', u'=='), (0x2A76, '3', u'==='), (0x2A77, 'V'), (0x2ADC, 'M', u'⫝̸'), (0x2ADD, 'V'), (0x2B74, 'X'), (0x2B76, 'V'), (0x2B96, 'X'), (0x2B97, 'V'), (0x2C00, 'M', u'ⰰ'), (0x2C01, 'M', u'ⰱ'), (0x2C02, 'M', u'ⰲ'), (0x2C03, 'M', u'ⰳ'), (0x2C04, 'M', u'ⰴ'), (0x2C05, 'M', u'ⰵ'), (0x2C06, 'M', u'ⰶ'), (0x2C07, 'M', u'ⰷ'), (0x2C08, 'M', u'ⰸ'), (0x2C09, 'M', u'ⰹ'), (0x2C0A, 'M', u'ⰺ'), (0x2C0B, 'M', u'ⰻ'), (0x2C0C, 'M', u'ⰼ'), (0x2C0D, 'M', u'ⰽ'), (0x2C0E, 'M', u'ⰾ'), (0x2C0F, 'M', u'ⰿ'), (0x2C10, 'M', u'ⱀ'), (0x2C11, 'M', u'ⱁ'), (0x2C12, 'M', u'ⱂ'), (0x2C13, 'M', u'ⱃ'), (0x2C14, 'M', u'ⱄ'), (0x2C15, 'M', u'ⱅ'), (0x2C16, 'M', u'ⱆ'), (0x2C17, 'M', u'ⱇ'), (0x2C18, 'M', u'ⱈ'), (0x2C19, 'M', u'ⱉ'), (0x2C1A, 'M', u'ⱊ'), (0x2C1B, 'M', u'ⱋ'), (0x2C1C, 'M', u'ⱌ'), (0x2C1D, 'M', u'ⱍ'), (0x2C1E, 'M', u'ⱎ'), (0x2C1F, 'M', u'ⱏ'), (0x2C20, 'M', u'ⱐ'), (0x2C21, 'M', u'ⱑ'), (0x2C22, 'M', u'ⱒ'), (0x2C23, 'M', u'ⱓ'), (0x2C24, 'M', u'ⱔ'), (0x2C25, 'M', u'ⱕ'), ] def _seg_25(): return [ (0x2C26, 'M', u'ⱖ'), (0x2C27, 'M', u'ⱗ'), (0x2C28, 'M', u'ⱘ'), (0x2C29, 'M', u'ⱙ'), (0x2C2A, 'M', u'ⱚ'), (0x2C2B, 'M', u'ⱛ'), (0x2C2C, 'M', u'ⱜ'), (0x2C2D, 'M', u'ⱝ'), (0x2C2E, 'M', u'ⱞ'), (0x2C2F, 'X'), (0x2C30, 'V'), (0x2C5F, 'X'), (0x2C60, 'M', u'ⱡ'), (0x2C61, 'V'), (0x2C62, 'M', u'ɫ'), (0x2C63, 'M', u'ᵽ'), (0x2C64, 'M', u'ɽ'), (0x2C65, 'V'), (0x2C67, 'M', u'ⱨ'), (0x2C68, 'V'), (0x2C69, 'M', u'ⱪ'), (0x2C6A, 'V'), (0x2C6B, 'M', u'ⱬ'), (0x2C6C, 'V'), (0x2C6D, 'M', u'ɑ'), (0x2C6E, 'M', u'ɱ'), (0x2C6F, 'M', u'ɐ'), (0x2C70, 'M', u'ɒ'), (0x2C71, 'V'), (0x2C72, 'M', u'ⱳ'), (0x2C73, 'V'), (0x2C75, 'M', u'ⱶ'), (0x2C76, 'V'), (0x2C7C, 'M', u'j'), (0x2C7D, 'M', u'v'), (0x2C7E, 'M', u'ȿ'), (0x2C7F, 'M', u'ɀ'), (0x2C80, 'M', u'ⲁ'), (0x2C81, 'V'), (0x2C82, 'M', u'ⲃ'), (0x2C83, 'V'), (0x2C84, 'M', u'ⲅ'), (0x2C85, 'V'), (0x2C86, 'M', u'ⲇ'), (0x2C87, 'V'), (0x2C88, 'M', u'ⲉ'), (0x2C89, 'V'), (0x2C8A, 'M', u'ⲋ'), (0x2C8B, 'V'), (0x2C8C, 'M', u'ⲍ'), (0x2C8D, 'V'), (0x2C8E, 'M', u'ⲏ'), (0x2C8F, 'V'), (0x2C90, 'M', u'ⲑ'), (0x2C91, 'V'), (0x2C92, 'M', u'ⲓ'), (0x2C93, 'V'), (0x2C94, 'M', u'ⲕ'), (0x2C95, 'V'), (0x2C96, 'M', u'ⲗ'), (0x2C97, 'V'), (0x2C98, 'M', u'ⲙ'), (0x2C99, 'V'), (0x2C9A, 'M', u'ⲛ'), (0x2C9B, 'V'), (0x2C9C, 'M', u'ⲝ'), (0x2C9D, 'V'), (0x2C9E, 'M', u'ⲟ'), (0x2C9F, 'V'), (0x2CA0, 'M', u'ⲡ'), (0x2CA1, 'V'), (0x2CA2, 'M', u'ⲣ'), (0x2CA3, 'V'), (0x2CA4, 'M', u'ⲥ'), (0x2CA5, 'V'), (0x2CA6, 'M', u'ⲧ'), (0x2CA7, 'V'), (0x2CA8, 'M', u'ⲩ'), (0x2CA9, 'V'), (0x2CAA, 'M', u'ⲫ'), (0x2CAB, 'V'), (0x2CAC, 'M', u'ⲭ'), (0x2CAD, 'V'), (0x2CAE, 'M', u'ⲯ'), (0x2CAF, 'V'), (0x2CB0, 'M', u'ⲱ'), (0x2CB1, 'V'), (0x2CB2, 'M', u'ⲳ'), (0x2CB3, 'V'), (0x2CB4, 'M', u'ⲵ'), (0x2CB5, 'V'), (0x2CB6, 'M', u'ⲷ'), (0x2CB7, 'V'), (0x2CB8, 'M', u'ⲹ'), (0x2CB9, 'V'), (0x2CBA, 'M', u'ⲻ'), (0x2CBB, 'V'), (0x2CBC, 'M', u'ⲽ'), (0x2CBD, 'V'), (0x2CBE, 'M', u'ⲿ'), ] def _seg_26(): return [ (0x2CBF, 'V'), (0x2CC0, 'M', u'ⳁ'), (0x2CC1, 'V'), (0x2CC2, 'M', u'ⳃ'), (0x2CC3, 'V'), (0x2CC4, 'M', u'ⳅ'), (0x2CC5, 'V'), (0x2CC6, 'M', u'ⳇ'), (0x2CC7, 'V'), (0x2CC8, 'M', u'ⳉ'), (0x2CC9, 'V'), (0x2CCA, 'M', u'ⳋ'), (0x2CCB, 'V'), (0x2CCC, 'M', u'ⳍ'), (0x2CCD, 'V'), (0x2CCE, 'M', u'ⳏ'), (0x2CCF, 'V'), (0x2CD0, 'M', u'ⳑ'), (0x2CD1, 'V'), (0x2CD2, 'M', u'ⳓ'), (0x2CD3, 'V'), (0x2CD4, 'M', u'ⳕ'), (0x2CD5, 'V'), (0x2CD6, 'M', u'ⳗ'), (0x2CD7, 'V'), (0x2CD8, 'M', u'ⳙ'), (0x2CD9, 'V'), (0x2CDA, 'M', u'ⳛ'), (0x2CDB, 'V'), (0x2CDC, 'M', u'ⳝ'), (0x2CDD, 'V'), (0x2CDE, 'M', u'ⳟ'), (0x2CDF, 'V'), (0x2CE0, 'M', u'ⳡ'), (0x2CE1, 'V'), (0x2CE2, 'M', u'ⳣ'), (0x2CE3, 'V'), (0x2CEB, 'M', u'ⳬ'), (0x2CEC, 'V'), (0x2CED, 'M', u'ⳮ'), (0x2CEE, 'V'), (0x2CF2, 'M', u'ⳳ'), (0x2CF3, 'V'), (0x2CF4, 'X'), (0x2CF9, 'V'), (0x2D26, 'X'), (0x2D27, 'V'), (0x2D28, 'X'), (0x2D2D, 'V'), (0x2D2E, 'X'), (0x2D30, 'V'), (0x2D68, 'X'), (0x2D6F, 'M', u'ⵡ'), (0x2D70, 'V'), (0x2D71, 'X'), (0x2D7F, 'V'), (0x2D97, 'X'), (0x2DA0, 'V'), (0x2DA7, 'X'), (0x2DA8, 'V'), (0x2DAF, 'X'), (0x2DB0, 'V'), (0x2DB7, 'X'), (0x2DB8, 'V'), (0x2DBF, 'X'), (0x2DC0, 'V'), (0x2DC7, 'X'), (0x2DC8, 'V'), (0x2DCF, 'X'), (0x2DD0, 'V'), (0x2DD7, 'X'), (0x2DD8, 'V'), (0x2DDF, 'X'), (0x2DE0, 'V'), (0x2E53, 'X'), (0x2E80, 'V'), (0x2E9A, 'X'), (0x2E9B, 'V'), (0x2E9F, 'M', u'母'), (0x2EA0, 'V'), (0x2EF3, 'M', u'龟'), (0x2EF4, 'X'), (0x2F00, 'M', u'一'), (0x2F01, 'M', u'丨'), (0x2F02, 'M', u'丶'), (0x2F03, 'M', u'丿'), (0x2F04, 'M', u'乙'), (0x2F05, 'M', u'亅'), (0x2F06, 'M', u'二'), (0x2F07, 'M', u'亠'), (0x2F08, 'M', u'人'), (0x2F09, 'M', u'儿'), (0x2F0A, 'M', u'入'), (0x2F0B, 'M', u'八'), (0x2F0C, 'M', u'冂'), (0x2F0D, 'M', u'冖'), (0x2F0E, 'M', u'冫'), (0x2F0F, 'M', u'几'), (0x2F10, 'M', u'凵'), (0x2F11, 'M', u'刀'), ] def _seg_27(): return [ (0x2F12, 'M', u'力'), (0x2F13, 'M', u'勹'), (0x2F14, 'M', u'匕'), (0x2F15, 'M', u'匚'), (0x2F16, 'M', u'匸'), (0x2F17, 'M', u'十'), (0x2F18, 'M', u'卜'), (0x2F19, 'M', u'卩'), (0x2F1A, 'M', u'厂'), (0x2F1B, 'M', u'厶'), (0x2F1C, 'M', u'又'), (0x2F1D, 'M', u'口'), (0x2F1E, 'M', u'囗'), (0x2F1F, 'M', u'土'), (0x2F20, 'M', u'士'), (0x2F21, 'M', u'夂'), (0x2F22, 'M', u'夊'), (0x2F23, 'M', u'夕'), (0x2F24, 'M', u'大'), (0x2F25, 'M', u'女'), (0x2F26, 'M', u'子'), (0x2F27, 'M', u'宀'), (0x2F28, 'M', u'寸'), (0x2F29, 'M', u'小'), (0x2F2A, 'M', u'尢'), (0x2F2B, 'M', u'尸'), (0x2F2C, 'M', u'屮'), (0x2F2D, 'M', u'山'), (0x2F2E, 'M', u'巛'), (0x2F2F, 'M', u'工'), (0x2F30, 'M', u'己'), (0x2F31, 'M', u'巾'), (0x2F32, 'M', u'干'), (0x2F33, 'M', u'幺'), (0x2F34, 'M', u'广'), (0x2F35, 'M', u'廴'), (0x2F36, 'M', u'廾'), (0x2F37, 'M', u'弋'), (0x2F38, 'M', u'弓'), (0x2F39, 'M', u'彐'), (0x2F3A, 'M', u'彡'), (0x2F3B, 'M', u'彳'), (0x2F3C, 'M', u'心'), (0x2F3D, 'M', u'戈'), (0x2F3E, 'M', u'戶'), (0x2F3F, 'M', u'手'), (0x2F40, 'M', u'支'), (0x2F41, 'M', u'攴'), (0x2F42, 'M', u'文'), (0x2F43, 'M', u'斗'), (0x2F44, 'M', u'斤'), (0x2F45, 'M', u'方'), (0x2F46, 'M', u'无'), (0x2F47, 'M', u'日'), (0x2F48, 'M', u'曰'), (0x2F49, 'M', u'月'), (0x2F4A, 'M', u'木'), (0x2F4B, 'M', u'欠'), (0x2F4C, 'M', u'止'), (0x2F4D, 'M', u'歹'), (0x2F4E, 'M', u'殳'), (0x2F4F, 'M', u'毋'), (0x2F50, 'M', u'比'), (0x2F51, 'M', u'毛'), (0x2F52, 'M', u'氏'), (0x2F53, 'M', u'气'), (0x2F54, 'M', u'水'), (0x2F55, 'M', u'火'), (0x2F56, 'M', u'爪'), (0x2F57, 'M', u'父'), (0x2F58, 'M', u'爻'), (0x2F59, 'M', u'爿'), (0x2F5A, 'M', u'片'), (0x2F5B, 'M', u'牙'), (0x2F5C, 'M', u'牛'), (0x2F5D, 'M', u'犬'), (0x2F5E, 'M', u'玄'), (0x2F5F, 'M', u'玉'), (0x2F60, 'M', u'瓜'), (0x2F61, 'M', u'瓦'), (0x2F62, 'M', u'甘'), (0x2F63, 'M', u'生'), (0x2F64, 'M', u'用'), (0x2F65, 'M', u'田'), (0x2F66, 'M', u'疋'), (0x2F67, 'M', u'疒'), (0x2F68, 'M', u'癶'), (0x2F69, 'M', u'白'), (0x2F6A, 'M', u'皮'), (0x2F6B, 'M', u'皿'), (0x2F6C, 'M', u'目'), (0x2F6D, 'M', u'矛'), (0x2F6E, 'M', u'矢'), (0x2F6F, 'M', u'石'), (0x2F70, 'M', u'示'), (0x2F71, 'M', u'禸'), (0x2F72, 'M', u'禾'), (0x2F73, 'M', u'穴'), (0x2F74, 'M', u'立'), (0x2F75, 'M', u'竹'), ] def _seg_28(): return [ (0x2F76, 'M', u'米'), (0x2F77, 'M', u'糸'), (0x2F78, 'M', u'缶'), (0x2F79, 'M', u'网'), (0x2F7A, 'M', u'羊'), (0x2F7B, 'M', u'羽'), (0x2F7C, 'M', u'老'), (0x2F7D, 'M', u'而'), (0x2F7E, 'M', u'耒'), (0x2F7F, 'M', u'耳'), (0x2F80, 'M', u'聿'), (0x2F81, 'M', u'肉'), (0x2F82, 'M', u'臣'), (0x2F83, 'M', u'自'), (0x2F84, 'M', u'至'), (0x2F85, 'M', u'臼'), (0x2F86, 'M', u'舌'), (0x2F87, 'M', u'舛'), (0x2F88, 'M', u'舟'), (0x2F89, 'M', u'艮'), (0x2F8A, 'M', u'色'), (0x2F8B, 'M', u'艸'), (0x2F8C, 'M', u'虍'), (0x2F8D, 'M', u'虫'), (0x2F8E, 'M', u'血'), (0x2F8F, 'M', u'行'), (0x2F90, 'M', u'衣'), (0x2F91, 'M', u'襾'), (0x2F92, 'M', u'見'), (0x2F93, 'M', u'角'), (0x2F94, 'M', u'言'), (0x2F95, 'M', u'谷'), (0x2F96, 'M', u'豆'), (0x2F97, 'M', u'豕'), (0x2F98, 'M', u'豸'), (0x2F99, 'M', u'貝'), (0x2F9A, 'M', u'赤'), (0x2F9B, 'M', u'走'), (0x2F9C, 'M', u'足'), (0x2F9D, 'M', u'身'), (0x2F9E, 'M', u'車'), (0x2F9F, 'M', u'辛'), (0x2FA0, 'M', u'辰'), (0x2FA1, 'M', u'辵'), (0x2FA2, 'M', u'邑'), (0x2FA3, 'M', u'酉'), (0x2FA4, 'M', u'釆'), (0x2FA5, 'M', u'里'), (0x2FA6, 'M', u'金'), (0x2FA7, 'M', u'長'), (0x2FA8, 'M', u'門'), (0x2FA9, 'M', u'阜'), (0x2FAA, 'M', u'隶'), (0x2FAB, 'M', u'隹'), (0x2FAC, 'M', u'雨'), (0x2FAD, 'M', u'靑'), (0x2FAE, 'M', u'非'), (0x2FAF, 'M', u'面'), (0x2FB0, 'M', u'革'), (0x2FB1, 'M', u'韋'), (0x2FB2, 'M', u'韭'), (0x2FB3, 'M', u'音'), (0x2FB4, 'M', u'頁'), (0x2FB5, 'M', u'風'), (0x2FB6, 'M', u'飛'), (0x2FB7, 'M', u'食'), (0x2FB8, 'M', u'首'), (0x2FB9, 'M', u'香'), (0x2FBA, 'M', u'馬'), (0x2FBB, 'M', u'骨'), (0x2FBC, 'M', u'高'), (0x2FBD, 'M', u'髟'), (0x2FBE, 'M', u'鬥'), (0x2FBF, 'M', u'鬯'), (0x2FC0, 'M', u'鬲'), (0x2FC1, 'M', u'鬼'), (0x2FC2, 'M', u'魚'), (0x2FC3, 'M', u'鳥'), (0x2FC4, 'M', u'鹵'), (0x2FC5, 'M', u'鹿'), (0x2FC6, 'M', u'麥'), (0x2FC7, 'M', u'麻'), (0x2FC8, 'M', u'黃'), (0x2FC9, 'M', u'黍'), (0x2FCA, 'M', u'黑'), (0x2FCB, 'M', u'黹'), (0x2FCC, 'M', u'黽'), (0x2FCD, 'M', u'鼎'), (0x2FCE, 'M', u'鼓'), (0x2FCF, 'M', u'鼠'), (0x2FD0, 'M', u'鼻'), (0x2FD1, 'M', u'齊'), (0x2FD2, 'M', u'齒'), (0x2FD3, 'M', u'龍'), (0x2FD4, 'M', u'龜'), (0x2FD5, 'M', u'龠'), (0x2FD6, 'X'), (0x3000, '3', u' '), (0x3001, 'V'), (0x3002, 'M', u'.'), ] def _seg_29(): return [ (0x3003, 'V'), (0x3036, 'M', u'〒'), (0x3037, 'V'), (0x3038, 'M', u'十'), (0x3039, 'M', u'卄'), (0x303A, 'M', u'卅'), (0x303B, 'V'), (0x3040, 'X'), (0x3041, 'V'), (0x3097, 'X'), (0x3099, 'V'), (0x309B, '3', u' ゙'), (0x309C, '3', u' ゚'), (0x309D, 'V'), (0x309F, 'M', u'より'), (0x30A0, 'V'), (0x30FF, 'M', u'コト'), (0x3100, 'X'), (0x3105, 'V'), (0x3130, 'X'), (0x3131, 'M', u'ᄀ'), (0x3132, 'M', u'ᄁ'), (0x3133, 'M', u'ᆪ'), (0x3134, 'M', u'ᄂ'), (0x3135, 'M', u'ᆬ'), (0x3136, 'M', u'ᆭ'), (0x3137, 'M', u'ᄃ'), (0x3138, 'M', u'ᄄ'), (0x3139, 'M', u'ᄅ'), (0x313A, 'M', u'ᆰ'), (0x313B, 'M', u'ᆱ'), (0x313C, 'M', u'ᆲ'), (0x313D, 'M', u'ᆳ'), (0x313E, 'M', u'ᆴ'), (0x313F, 'M', u'ᆵ'), (0x3140, 'M', u'ᄚ'), (0x3141, 'M', u'ᄆ'), (0x3142, 'M', u'ᄇ'), (0x3143, 'M', u'ᄈ'), (0x3144, 'M', u'ᄡ'), (0x3145, 'M', u'ᄉ'), (0x3146, 'M', u'ᄊ'), (0x3147, 'M', u'ᄋ'), (0x3148, 'M', u'ᄌ'), (0x3149, 'M', u'ᄍ'), (0x314A, 'M', u'ᄎ'), (0x314B, 'M', u'ᄏ'), (0x314C, 'M', u'ᄐ'), (0x314D, 'M', u'ᄑ'), (0x314E, 'M', u'ᄒ'), (0x314F, 'M', u'ᅡ'), (0x3150, 'M', u'ᅢ'), (0x3151, 'M', u'ᅣ'), (0x3152, 'M', u'ᅤ'), (0x3153, 'M', u'ᅥ'), (0x3154, 'M', u'ᅦ'), (0x3155, 'M', u'ᅧ'), (0x3156, 'M', u'ᅨ'), (0x3157, 'M', u'ᅩ'), (0x3158, 'M', u'ᅪ'), (0x3159, 'M', u'ᅫ'), (0x315A, 'M', u'ᅬ'), (0x315B, 'M', u'ᅭ'), (0x315C, 'M', u'ᅮ'), (0x315D, 'M', u'ᅯ'), (0x315E, 'M', u'ᅰ'), (0x315F, 'M', u'ᅱ'), (0x3160, 'M', u'ᅲ'), (0x3161, 'M', u'ᅳ'), (0x3162, 'M', u'ᅴ'), (0x3163, 'M', u'ᅵ'), (0x3164, 'X'), (0x3165, 'M', u'ᄔ'), (0x3166, 'M', u'ᄕ'), (0x3167, 'M', u'ᇇ'), (0x3168, 'M', u'ᇈ'), (0x3169, 'M', u'ᇌ'), (0x316A, 'M', u'ᇎ'), (0x316B, 'M', u'ᇓ'), (0x316C, 'M', u'ᇗ'), (0x316D, 'M', u'ᇙ'), (0x316E, 'M', u'ᄜ'), (0x316F, 'M', u'ᇝ'), (0x3170, 'M', u'ᇟ'), (0x3171, 'M', u'ᄝ'), (0x3172, 'M', u'ᄞ'), (0x3173, 'M', u'ᄠ'), (0x3174, 'M', u'ᄢ'), (0x3175, 'M', u'ᄣ'), (0x3176, 'M', u'ᄧ'), (0x3177, 'M', u'ᄩ'), (0x3178, 'M', u'ᄫ'), (0x3179, 'M', u'ᄬ'), (0x317A, 'M', u'ᄭ'), (0x317B, 'M', u'ᄮ'), (0x317C, 'M', u'ᄯ'), (0x317D, 'M', u'ᄲ'), (0x317E, 'M', u'ᄶ'), (0x317F, 'M', u'ᅀ'), (0x3180, 'M', u'ᅇ'), ] def _seg_30(): return [ (0x3181, 'M', u'ᅌ'), (0x3182, 'M', u'ᇱ'), (0x3183, 'M', u'ᇲ'), (0x3184, 'M', u'ᅗ'), (0x3185, 'M', u'ᅘ'), (0x3186, 'M', u'ᅙ'), (0x3187, 'M', u'ᆄ'), (0x3188, 'M', u'ᆅ'), (0x3189, 'M', u'ᆈ'), (0x318A, 'M', u'ᆑ'), (0x318B, 'M', u'ᆒ'), (0x318C, 'M', u'ᆔ'), (0x318D, 'M', u'ᆞ'), (0x318E, 'M', u'ᆡ'), (0x318F, 'X'), (0x3190, 'V'), (0x3192, 'M', u'一'), (0x3193, 'M', u'二'), (0x3194, 'M', u'三'), (0x3195, 'M', u'四'), (0x3196, 'M', u'上'), (0x3197, 'M', u'中'), (0x3198, 'M', u'下'), (0x3199, 'M', u'甲'), (0x319A, 'M', u'乙'), (0x319B, 'M', u'丙'), (0x319C, 'M', u'丁'), (0x319D, 'M', u'天'), (0x319E, 'M', u'地'), (0x319F, 'M', u'人'), (0x31A0, 'V'), (0x31E4, 'X'), (0x31F0, 'V'), (0x3200, '3', u'(ᄀ)'), (0x3201, '3', u'(ᄂ)'), (0x3202, '3', u'(ᄃ)'), (0x3203, '3', u'(ᄅ)'), (0x3204, '3', u'(ᄆ)'), (0x3205, '3', u'(ᄇ)'), (0x3206, '3', u'(ᄉ)'), (0x3207, '3', u'(ᄋ)'), (0x3208, '3', u'(ᄌ)'), (0x3209, '3', u'(ᄎ)'), (0x320A, '3', u'(ᄏ)'), (0x320B, '3', u'(ᄐ)'), (0x320C, '3', u'(ᄑ)'), (0x320D, '3', u'(ᄒ)'), (0x320E, '3', u'(가)'), (0x320F, '3', u'(나)'), (0x3210, '3', u'(다)'), (0x3211, '3', u'(라)'), (0x3212, '3', u'(마)'), (0x3213, '3', u'(바)'), (0x3214, '3', u'(사)'), (0x3215, '3', u'(아)'), (0x3216, '3', u'(자)'), (0x3217, '3', u'(차)'), (0x3218, '3', u'(카)'), (0x3219, '3', u'(타)'), (0x321A, '3', u'(파)'), (0x321B, '3', u'(하)'), (0x321C, '3', u'(주)'), (0x321D, '3', u'(오전)'), (0x321E, '3', u'(오후)'), (0x321F, 'X'), (0x3220, '3', u'(一)'), (0x3221, '3', u'(二)'), (0x3222, '3', u'(三)'), (0x3223, '3', u'(四)'), (0x3224, '3', u'(五)'), (0x3225, '3', u'(六)'), (0x3226, '3', u'(七)'), (0x3227, '3', u'(八)'), (0x3228, '3', u'(九)'), (0x3229, '3', u'(十)'), (0x322A, '3', u'(月)'), (0x322B, '3', u'(火)'), (0x322C, '3', u'(水)'), (0x322D, '3', u'(木)'), (0x322E, '3', u'(金)'), (0x322F, '3', u'(土)'), (0x3230, '3', u'(日)'), (0x3231, '3', u'(株)'), (0x3232, '3', u'(有)'), (0x3233, '3', u'(社)'), (0x3234, '3', u'(名)'), (0x3235, '3', u'(特)'), (0x3236, '3', u'(財)'), (0x3237, '3', u'(祝)'), (0x3238, '3', u'(労)'), (0x3239, '3', u'(代)'), (0x323A, '3', u'(呼)'), (0x323B, '3', u'(学)'), (0x323C, '3', u'(監)'), (0x323D, '3', u'(企)'), (0x323E, '3', u'(資)'), (0x323F, '3', u'(協)'), (0x3240, '3', u'(祭)'), (0x3241, '3', u'(休)'), (0x3242, '3', u'(自)'), ] def _seg_31(): return [ (0x3243, '3', u'(至)'), (0x3244, 'M', u'問'), (0x3245, 'M', u'幼'), (0x3246, 'M', u'文'), (0x3247, 'M', u'箏'), (0x3248, 'V'), (0x3250, 'M', u'pte'), (0x3251, 'M', u'21'), (0x3252, 'M', u'22'), (0x3253, 'M', u'23'), (0x3254, 'M', u'24'), (0x3255, 'M', u'25'), (0x3256, 'M', u'26'), (0x3257, 'M', u'27'), (0x3258, 'M', u'28'), (0x3259, 'M', u'29'), (0x325A, 'M', u'30'), (0x325B, 'M', u'31'), (0x325C, 'M', u'32'), (0x325D, 'M', u'33'), (0x325E, 'M', u'34'), (0x325F, 'M', u'35'), (0x3260, 'M', u'ᄀ'), (0x3261, 'M', u'ᄂ'), (0x3262, 'M', u'ᄃ'), (0x3263, 'M', u'ᄅ'), (0x3264, 'M', u'ᄆ'), (0x3265, 'M', u'ᄇ'), (0x3266, 'M', u'ᄉ'), (0x3267, 'M', u'ᄋ'), (0x3268, 'M', u'ᄌ'), (0x3269, 'M', u'ᄎ'), (0x326A, 'M', u'ᄏ'), (0x326B, 'M', u'ᄐ'), (0x326C, 'M', u'ᄑ'), (0x326D, 'M', u'ᄒ'), (0x326E, 'M', u'가'), (0x326F, 'M', u'나'), (0x3270, 'M', u'다'), (0x3271, 'M', u'라'), (0x3272, 'M', u'마'), (0x3273, 'M', u'바'), (0x3274, 'M', u'사'), (0x3275, 'M', u'아'), (0x3276, 'M', u'자'), (0x3277, 'M', u'차'), (0x3278, 'M', u'카'), (0x3279, 'M', u'타'), (0x327A, 'M', u'파'), (0x327B, 'M', u'하'), (0x327C, 'M', u'참고'), (0x327D, 'M', u'주의'), (0x327E, 'M', u'우'), (0x327F, 'V'), (0x3280, 'M', u'一'), (0x3281, 'M', u'二'), (0x3282, 'M', u'三'), (0x3283, 'M', u'四'), (0x3284, 'M', u'五'), (0x3285, 'M', u'六'), (0x3286, 'M', u'七'), (0x3287, 'M', u'八'), (0x3288, 'M', u'九'), (0x3289, 'M', u'十'), (0x328A, 'M', u'月'), (0x328B, 'M', u'火'), (0x328C, 'M', u'水'), (0x328D, 'M', u'木'), (0x328E, 'M', u'金'), (0x328F, 'M', u'土'), (0x3290, 'M', u'日'), (0x3291, 'M', u'株'), (0x3292, 'M', u'有'), (0x3293, 'M', u'社'), (0x3294, 'M', u'名'), (0x3295, 'M', u'特'), (0x3296, 'M', u'財'), (0x3297, 'M', u'祝'), (0x3298, 'M', u'労'), (0x3299, 'M', u'秘'), (0x329A, 'M', u'男'), (0x329B, 'M', u'女'), (0x329C, 'M', u'適'), (0x329D, 'M', u'優'), (0x329E, 'M', u'印'), (0x329F, 'M', u'注'), (0x32A0, 'M', u'項'), (0x32A1, 'M', u'休'), (0x32A2, 'M', u'写'), (0x32A3, 'M', u'正'), (0x32A4, 'M', u'上'), (0x32A5, 'M', u'中'), (0x32A6, 'M', u'下'), (0x32A7, 'M', u'左'), (0x32A8, 'M', u'右'), (0x32A9, 'M', u'医'), (0x32AA, 'M', u'宗'), (0x32AB, 'M', u'学'), (0x32AC, 'M', u'監'), (0x32AD, 'M', u'企'), ] def _seg_32(): return [ (0x32AE, 'M', u'資'), (0x32AF, 'M', u'協'), (0x32B0, 'M', u'夜'), (0x32B1, 'M', u'36'), (0x32B2, 'M', u'37'), (0x32B3, 'M', u'38'), (0x32B4, 'M', u'39'), (0x32B5, 'M', u'40'), (0x32B6, 'M', u'41'), (0x32B7, 'M', u'42'), (0x32B8, 'M', u'43'), (0x32B9, 'M', u'44'), (0x32BA, 'M', u'45'), (0x32BB, 'M', u'46'), (0x32BC, 'M', u'47'), (0x32BD, 'M', u'48'), (0x32BE, 'M', u'49'), (0x32BF, 'M', u'50'), (0x32C0, 'M', u'1月'), (0x32C1, 'M', u'2月'), (0x32C2, 'M', u'3月'), (0x32C3, 'M', u'4月'), (0x32C4, 'M', u'5月'), (0x32C5, 'M', u'6月'), (0x32C6, 'M', u'7月'), (0x32C7, 'M', u'8月'), (0x32C8, 'M', u'9月'), (0x32C9, 'M', u'10月'), (0x32CA, 'M', u'11月'), (0x32CB, 'M', u'12月'), (0x32CC, 'M', u'hg'), (0x32CD, 'M', u'erg'), (0x32CE, 'M', u'ev'), (0x32CF, 'M', u'ltd'), (0x32D0, 'M', u'ア'), (0x32D1, 'M', u'イ'), (0x32D2, 'M', u'ウ'), (0x32D3, 'M', u'エ'), (0x32D4, 'M', u'オ'), (0x32D5, 'M', u'カ'), (0x32D6, 'M', u'キ'), (0x32D7, 'M', u'ク'), (0x32D8, 'M', u'ケ'), (0x32D9, 'M', u'コ'), (0x32DA, 'M', u'サ'), (0x32DB, 'M', u'シ'), (0x32DC, 'M', u'ス'), (0x32DD, 'M', u'セ'), (0x32DE, 'M', u'ソ'), (0x32DF, 'M', u'タ'), (0x32E0, 'M', u'チ'), (0x32E1, 'M', u'ツ'), (0x32E2, 'M', u'テ'), (0x32E3, 'M', u'ト'), (0x32E4, 'M', u'ナ'), (0x32E5, 'M', u'ニ'), (0x32E6, 'M', u'ヌ'), (0x32E7, 'M', u'ネ'), (0x32E8, 'M', u'ノ'), (0x32E9, 'M', u'ハ'), (0x32EA, 'M', u'ヒ'), (0x32EB, 'M', u'フ'), (0x32EC, 'M', u'ヘ'), (0x32ED, 'M', u'ホ'), (0x32EE, 'M', u'マ'), (0x32EF, 'M', u'ミ'), (0x32F0, 'M', u'ム'), (0x32F1, 'M', u'メ'), (0x32F2, 'M', u'モ'), (0x32F3, 'M', u'ヤ'), (0x32F4, 'M', u'ユ'), (0x32F5, 'M', u'ヨ'), (0x32F6, 'M', u'ラ'), (0x32F7, 'M', u'リ'), (0x32F8, 'M', u'ル'), (0x32F9, 'M', u'レ'), (0x32FA, 'M', u'ロ'), (0x32FB, 'M', u'ワ'), (0x32FC, 'M', u'ヰ'), (0x32FD, 'M', u'ヱ'), (0x32FE, 'M', u'ヲ'), (0x32FF, 'M', u'令和'), (0x3300, 'M', u'アパート'), (0x3301, 'M', u'アルファ'), (0x3302, 'M', u'アンペア'), (0x3303, 'M', u'アール'), (0x3304, 'M', u'イニング'), (0x3305, 'M', u'インチ'), (0x3306, 'M', u'ウォン'), (0x3307, 'M', u'エスクード'), (0x3308, 'M', u'エーカー'), (0x3309, 'M', u'オンス'), (0x330A, 'M', u'オーム'), (0x330B, 'M', u'カイリ'), (0x330C, 'M', u'カラット'), (0x330D, 'M', u'カロリー'), (0x330E, 'M', u'ガロン'), (0x330F, 'M', u'ガンマ'), (0x3310, 'M', u'ギガ'), (0x3311, 'M', u'ギニー'), ] def _seg_33(): return [ (0x3312, 'M', u'キュリー'), (0x3313, 'M', u'ギルダー'), (0x3314, 'M', u'キロ'), (0x3315, 'M', u'キログラム'), (0x3316, 'M', u'キロメートル'), (0x3317, 'M', u'キロワット'), (0x3318, 'M', u'グラム'), (0x3319, 'M', u'グラムトン'), (0x331A, 'M', u'クルゼイロ'), (0x331B, 'M', u'クローネ'), (0x331C, 'M', u'ケース'), (0x331D, 'M', u'コルナ'), (0x331E, 'M', u'コーポ'), (0x331F, 'M', u'サイクル'), (0x3320, 'M', u'サンチーム'), (0x3321, 'M', u'シリング'), (0x3322, 'M', u'センチ'), (0x3323, 'M', u'セント'), (0x3324, 'M', u'ダース'), (0x3325, 'M', u'デシ'), (0x3326, 'M', u'ドル'), (0x3327, 'M', u'トン'), (0x3328, 'M', u'ナノ'), (0x3329, 'M', u'ノット'), (0x332A, 'M', u'ハイツ'), (0x332B, 'M', u'パーセント'), (0x332C, 'M', u'パーツ'), (0x332D, 'M', u'バーレル'), (0x332E, 'M', u'ピアストル'), (0x332F, 'M', u'ピクル'), (0x3330, 'M', u'ピコ'), (0x3331, 'M', u'ビル'), (0x3332, 'M', u'ファラッド'), (0x3333, 'M', u'フィート'), (0x3334, 'M', u'ブッシェル'), (0x3335, 'M', u'フラン'), (0x3336, 'M', u'ヘクタール'), (0x3337, 'M', u'ペソ'), (0x3338, 'M', u'ペニヒ'), (0x3339, 'M', u'ヘルツ'), (0x333A, 'M', u'ペンス'), (0x333B, 'M', u'ページ'), (0x333C, 'M', u'ベータ'), (0x333D, 'M', u'ポイント'), (0x333E, 'M', u'ボルト'), (0x333F, 'M', u'ホン'), (0x3340, 'M', u'ポンド'), (0x3341, 'M', u'ホール'), (0x3342, 'M', u'ホーン'), (0x3343, 'M', u'マイクロ'), (0x3344, 'M', u'マイル'), (0x3345, 'M', u'マッハ'), (0x3346, 'M', u'マルク'), (0x3347, 'M', u'マンション'), (0x3348, 'M', u'ミクロン'), (0x3349, 'M', u'ミリ'), (0x334A, 'M', u'ミリバール'), (0x334B, 'M', u'メガ'), (0x334C, 'M', u'メガトン'), (0x334D, 'M', u'メートル'), (0x334E, 'M', u'ヤード'), (0x334F, 'M', u'ヤール'), (0x3350, 'M', u'ユアン'), (0x3351, 'M', u'リットル'), (0x3352, 'M', u'リラ'), (0x3353, 'M', u'ルピー'), (0x3354, 'M', u'ルーブル'), (0x3355, 'M', u'レム'), (0x3356, 'M', u'レントゲン'), (0x3357, 'M', u'ワット'), (0x3358, 'M', u'0点'), (0x3359, 'M', u'1点'), (0x335A, 'M', u'2点'), (0x335B, 'M', u'3点'), (0x335C, 'M', u'4点'), (0x335D, 'M', u'5点'), (0x335E, 'M', u'6点'), (0x335F, 'M', u'7点'), (0x3360, 'M', u'8点'), (0x3361, 'M', u'9点'), (0x3362, 'M', u'10点'), (0x3363, 'M', u'11点'), (0x3364, 'M', u'12点'), (0x3365, 'M', u'13点'), (0x3366, 'M', u'14点'), (0x3367, 'M', u'15点'), (0x3368, 'M', u'16点'), (0x3369, 'M', u'17点'), (0x336A, 'M', u'18点'), (0x336B, 'M', u'19点'), (0x336C, 'M', u'20点'), (0x336D, 'M', u'21点'), (0x336E, 'M', u'22点'), (0x336F, 'M', u'23点'), (0x3370, 'M', u'24点'), (0x3371, 'M', u'hpa'), (0x3372, 'M', u'da'), (0x3373, 'M', u'au'), (0x3374, 'M', u'bar'), (0x3375, 'M', u'ov'), ] def _seg_34(): return [ (0x3376, 'M', u'pc'), (0x3377, 'M', u'dm'), (0x3378, 'M', u'dm2'), (0x3379, 'M', u'dm3'), (0x337A, 'M', u'iu'), (0x337B, 'M', u'平成'), (0x337C, 'M', u'昭和'), (0x337D, 'M', u'大正'), (0x337E, 'M', u'明治'), (0x337F, 'M', u'株式会社'), (0x3380, 'M', u'pa'), (0x3381, 'M', u'na'), (0x3382, 'M', u'μa'), (0x3383, 'M', u'ma'), (0x3384, 'M', u'ka'), (0x3385, 'M', u'kb'), (0x3386, 'M', u'mb'), (0x3387, 'M', u'gb'), (0x3388, 'M', u'cal'), (0x3389, 'M', u'kcal'), (0x338A, 'M', u'pf'), (0x338B, 'M', u'nf'), (0x338C, 'M', u'μf'), (0x338D, 'M', u'μg'), (0x338E, 'M', u'mg'), (0x338F, 'M', u'kg'), (0x3390, 'M', u'hz'), (0x3391, 'M', u'khz'), (0x3392, 'M', u'mhz'), (0x3393, 'M', u'ghz'), (0x3394, 'M', u'thz'), (0x3395, 'M', u'μl'), (0x3396, 'M', u'ml'), (0x3397, 'M', u'dl'), (0x3398, 'M', u'kl'), (0x3399, 'M', u'fm'), (0x339A, 'M', u'nm'), (0x339B, 'M', u'μm'), (0x339C, 'M', u'mm'), (0x339D, 'M', u'cm'), (0x339E, 'M', u'km'), (0x339F, 'M', u'mm2'), (0x33A0, 'M', u'cm2'), (0x33A1, 'M', u'm2'), (0x33A2, 'M', u'km2'), (0x33A3, 'M', u'mm3'), (0x33A4, 'M', u'cm3'), (0x33A5, 'M', u'm3'), (0x33A6, 'M', u'km3'), (0x33A7, 'M', u'm∕s'), (0x33A8, 'M', u'm∕s2'), (0x33A9, 'M', u'pa'), (0x33AA, 'M', u'kpa'), (0x33AB, 'M', u'mpa'), (0x33AC, 'M', u'gpa'), (0x33AD, 'M', u'rad'), (0x33AE, 'M', u'rad∕s'), (0x33AF, 'M', u'rad∕s2'), (0x33B0, 'M', u'ps'), (0x33B1, 'M', u'ns'), (0x33B2, 'M', u'μs'), (0x33B3, 'M', u'ms'), (0x33B4, 'M', u'pv'), (0x33B5, 'M', u'nv'), (0x33B6, 'M', u'μv'), (0x33B7, 'M', u'mv'), (0x33B8, 'M', u'kv'), (0x33B9, 'M', u'mv'), (0x33BA, 'M', u'pw'), (0x33BB, 'M', u'nw'), (0x33BC, 'M', u'μw'), (0x33BD, 'M', u'mw'), (0x33BE, 'M', u'kw'), (0x33BF, 'M', u'mw'), (0x33C0, 'M', u'kω'), (0x33C1, 'M', u'mω'), (0x33C2, 'X'), (0x33C3, 'M', u'bq'), (0x33C4, 'M', u'cc'), (0x33C5, 'M', u'cd'), (0x33C6, 'M', u'c∕kg'), (0x33C7, 'X'), (0x33C8, 'M', u'db'), (0x33C9, 'M', u'gy'), (0x33CA, 'M', u'ha'), (0x33CB, 'M', u'hp'), (0x33CC, 'M', u'in'), (0x33CD, 'M', u'kk'), (0x33CE, 'M', u'km'), (0x33CF, 'M', u'kt'), (0x33D0, 'M', u'lm'), (0x33D1, 'M', u'ln'), (0x33D2, 'M', u'log'), (0x33D3, 'M', u'lx'), (0x33D4, 'M', u'mb'), (0x33D5, 'M', u'mil'), (0x33D6, 'M', u'mol'), (0x33D7, 'M', u'ph'), (0x33D8, 'X'), (0x33D9, 'M', u'ppm'), ] def _seg_35(): return [ (0x33DA, 'M', u'pr'), (0x33DB, 'M', u'sr'), (0x33DC, 'M', u'sv'), (0x33DD, 'M', u'wb'), (0x33DE, 'M', u'v∕m'), (0x33DF, 'M', u'a∕m'), (0x33E0, 'M', u'1日'), (0x33E1, 'M', u'2日'), (0x33E2, 'M', u'3日'), (0x33E3, 'M', u'4日'), (0x33E4, 'M', u'5日'), (0x33E5, 'M', u'6日'), (0x33E6, 'M', u'7日'), (0x33E7, 'M', u'8日'), (0x33E8, 'M', u'9日'), (0x33E9, 'M', u'10日'), (0x33EA, 'M', u'11日'), (0x33EB, 'M', u'12日'), (0x33EC, 'M', u'13日'), (0x33ED, 'M', u'14日'), (0x33EE, 'M', u'15日'), (0x33EF, 'M', u'16日'), (0x33F0, 'M', u'17日'), (0x33F1, 'M', u'18日'), (0x33F2, 'M', u'19日'), (0x33F3, 'M', u'20日'), (0x33F4, 'M', u'21日'), (0x33F5, 'M', u'22日'), (0x33F6, 'M', u'23日'), (0x33F7, 'M', u'24日'), (0x33F8, 'M', u'25日'), (0x33F9, 'M', u'26日'), (0x33FA, 'M', u'27日'), (0x33FB, 'M', u'28日'), (0x33FC, 'M', u'29日'), (0x33FD, 'M', u'30日'), (0x33FE, 'M', u'31日'), (0x33FF, 'M', u'gal'), (0x3400, 'V'), (0x9FFD, 'X'), (0xA000, 'V'), (0xA48D, 'X'), (0xA490, 'V'), (0xA4C7, 'X'), (0xA4D0, 'V'), (0xA62C, 'X'), (0xA640, 'M', u'ꙁ'), (0xA641, 'V'), (0xA642, 'M', u'ꙃ'), (0xA643, 'V'), (0xA644, 'M', u'ꙅ'), (0xA645, 'V'), (0xA646, 'M', u'ꙇ'), (0xA647, 'V'), (0xA648, 'M', u'ꙉ'), (0xA649, 'V'), (0xA64A, 'M', u'ꙋ'), (0xA64B, 'V'), (0xA64C, 'M', u'ꙍ'), (0xA64D, 'V'), (0xA64E, 'M', u'ꙏ'), (0xA64F, 'V'), (0xA650, 'M', u'ꙑ'), (0xA651, 'V'), (0xA652, 'M', u'ꙓ'), (0xA653, 'V'), (0xA654, 'M', u'ꙕ'), (0xA655, 'V'), (0xA656, 'M', u'ꙗ'), (0xA657, 'V'), (0xA658, 'M', u'ꙙ'), (0xA659, 'V'), (0xA65A, 'M', u'ꙛ'), (0xA65B, 'V'), (0xA65C, 'M', u'ꙝ'), (0xA65D, 'V'), (0xA65E, 'M', u'ꙟ'), (0xA65F, 'V'), (0xA660, 'M', u'ꙡ'), (0xA661, 'V'), (0xA662, 'M', u'ꙣ'), (0xA663, 'V'), (0xA664, 'M', u'ꙥ'), (0xA665, 'V'), (0xA666, 'M', u'ꙧ'), (0xA667, 'V'), (0xA668, 'M', u'ꙩ'), (0xA669, 'V'), (0xA66A, 'M', u'ꙫ'), (0xA66B, 'V'), (0xA66C, 'M', u'ꙭ'), (0xA66D, 'V'), (0xA680, 'M', u'ꚁ'), (0xA681, 'V'), (0xA682, 'M', u'ꚃ'), (0xA683, 'V'), (0xA684, 'M', u'ꚅ'), (0xA685, 'V'), (0xA686, 'M', u'ꚇ'), (0xA687, 'V'), ] def _seg_36(): return [ (0xA688, 'M', u'ꚉ'), (0xA689, 'V'), (0xA68A, 'M', u'ꚋ'), (0xA68B, 'V'), (0xA68C, 'M', u'ꚍ'), (0xA68D, 'V'), (0xA68E, 'M', u'ꚏ'), (0xA68F, 'V'), (0xA690, 'M', u'ꚑ'), (0xA691, 'V'), (0xA692, 'M', u'ꚓ'), (0xA693, 'V'), (0xA694, 'M', u'ꚕ'), (0xA695, 'V'), (0xA696, 'M', u'ꚗ'), (0xA697, 'V'), (0xA698, 'M', u'ꚙ'), (0xA699, 'V'), (0xA69A, 'M', u'ꚛ'), (0xA69B, 'V'), (0xA69C, 'M', u'ъ'), (0xA69D, 'M', u'ь'), (0xA69E, 'V'), (0xA6F8, 'X'), (0xA700, 'V'), (0xA722, 'M', u'ꜣ'), (0xA723, 'V'), (0xA724, 'M', u'ꜥ'), (0xA725, 'V'), (0xA726, 'M', u'ꜧ'), (0xA727, 'V'), (0xA728, 'M', u'ꜩ'), (0xA729, 'V'), (0xA72A, 'M', u'ꜫ'), (0xA72B, 'V'), (0xA72C, 'M', u'ꜭ'), (0xA72D, 'V'), (0xA72E, 'M', u'ꜯ'), (0xA72F, 'V'), (0xA732, 'M', u'ꜳ'), (0xA733, 'V'), (0xA734, 'M', u'ꜵ'), (0xA735, 'V'), (0xA736, 'M', u'ꜷ'), (0xA737, 'V'), (0xA738, 'M', u'ꜹ'), (0xA739, 'V'), (0xA73A, 'M', u'ꜻ'), (0xA73B, 'V'), (0xA73C, 'M', u'ꜽ'), (0xA73D, 'V'), (0xA73E, 'M', u'ꜿ'), (0xA73F, 'V'), (0xA740, 'M', u'ꝁ'), (0xA741, 'V'), (0xA742, 'M', u'ꝃ'), (0xA743, 'V'), (0xA744, 'M', u'ꝅ'), (0xA745, 'V'), (0xA746, 'M', u'ꝇ'), (0xA747, 'V'), (0xA748, 'M', u'ꝉ'), (0xA749, 'V'), (0xA74A, 'M', u'ꝋ'), (0xA74B, 'V'), (0xA74C, 'M', u'ꝍ'), (0xA74D, 'V'), (0xA74E, 'M', u'ꝏ'), (0xA74F, 'V'), (0xA750, 'M', u'ꝑ'), (0xA751, 'V'), (0xA752, 'M', u'ꝓ'), (0xA753, 'V'), (0xA754, 'M', u'ꝕ'), (0xA755, 'V'), (0xA756, 'M', u'ꝗ'), (0xA757, 'V'), (0xA758, 'M', u'ꝙ'), (0xA759, 'V'), (0xA75A, 'M', u'ꝛ'), (0xA75B, 'V'), (0xA75C, 'M', u'ꝝ'), (0xA75D, 'V'), (0xA75E, 'M', u'ꝟ'), (0xA75F, 'V'), (0xA760, 'M', u'ꝡ'), (0xA761, 'V'), (0xA762, 'M', u'ꝣ'), (0xA763, 'V'), (0xA764, 'M', u'ꝥ'), (0xA765, 'V'), (0xA766, 'M', u'ꝧ'), (0xA767, 'V'), (0xA768, 'M', u'ꝩ'), (0xA769, 'V'), (0xA76A, 'M', u'ꝫ'), (0xA76B, 'V'), (0xA76C, 'M', u'ꝭ'), (0xA76D, 'V'), (0xA76E, 'M', u'ꝯ'), ] def _seg_37(): return [ (0xA76F, 'V'), (0xA770, 'M', u'ꝯ'), (0xA771, 'V'), (0xA779, 'M', u'ꝺ'), (0xA77A, 'V'), (0xA77B, 'M', u'ꝼ'), (0xA77C, 'V'), (0xA77D, 'M', u'ᵹ'), (0xA77E, 'M', u'ꝿ'), (0xA77F, 'V'), (0xA780, 'M', u'ꞁ'), (0xA781, 'V'), (0xA782, 'M', u'ꞃ'), (0xA783, 'V'), (0xA784, 'M', u'ꞅ'), (0xA785, 'V'), (0xA786, 'M', u'ꞇ'), (0xA787, 'V'), (0xA78B, 'M', u'ꞌ'), (0xA78C, 'V'), (0xA78D, 'M', u'ɥ'), (0xA78E, 'V'), (0xA790, 'M', u'ꞑ'), (0xA791, 'V'), (0xA792, 'M', u'ꞓ'), (0xA793, 'V'), (0xA796, 'M', u'ꞗ'), (0xA797, 'V'), (0xA798, 'M', u'ꞙ'), (0xA799, 'V'), (0xA79A, 'M', u'ꞛ'), (0xA79B, 'V'), (0xA79C, 'M', u'ꞝ'), (0xA79D, 'V'), (0xA79E, 'M', u'ꞟ'), (0xA79F, 'V'), (0xA7A0, 'M', u'ꞡ'), (0xA7A1, 'V'), (0xA7A2, 'M', u'ꞣ'), (0xA7A3, 'V'), (0xA7A4, 'M', u'ꞥ'), (0xA7A5, 'V'), (0xA7A6, 'M', u'ꞧ'), (0xA7A7, 'V'), (0xA7A8, 'M', u'ꞩ'), (0xA7A9, 'V'), (0xA7AA, 'M', u'ɦ'), (0xA7AB, 'M', u'ɜ'), (0xA7AC, 'M', u'ɡ'), (0xA7AD, 'M', u'ɬ'), (0xA7AE, 'M', u'ɪ'), (0xA7AF, 'V'), (0xA7B0, 'M', u'ʞ'), (0xA7B1, 'M', u'ʇ'), (0xA7B2, 'M', u'ʝ'), (0xA7B3, 'M', u'ꭓ'), (0xA7B4, 'M', u'ꞵ'), (0xA7B5, 'V'), (0xA7B6, 'M', u'ꞷ'), (0xA7B7, 'V'), (0xA7B8, 'M', u'ꞹ'), (0xA7B9, 'V'), (0xA7BA, 'M', u'ꞻ'), (0xA7BB, 'V'), (0xA7BC, 'M', u'ꞽ'), (0xA7BD, 'V'), (0xA7BE, 'M', u'ꞿ'), (0xA7BF, 'V'), (0xA7C0, 'X'), (0xA7C2, 'M', u'ꟃ'), (0xA7C3, 'V'), (0xA7C4, 'M', u'ꞔ'), (0xA7C5, 'M', u'ʂ'), (0xA7C6, 'M', u'ᶎ'), (0xA7C7, 'M', u'ꟈ'), (0xA7C8, 'V'), (0xA7C9, 'M', u'ꟊ'), (0xA7CA, 'V'), (0xA7CB, 'X'), (0xA7F5, 'M', u'ꟶ'), (0xA7F6, 'V'), (0xA7F8, 'M', u'ħ'), (0xA7F9, 'M', u'œ'), (0xA7FA, 'V'), (0xA82D, 'X'), (0xA830, 'V'), (0xA83A, 'X'), (0xA840, 'V'), (0xA878, 'X'), (0xA880, 'V'), (0xA8C6, 'X'), (0xA8CE, 'V'), (0xA8DA, 'X'), (0xA8E0, 'V'), (0xA954, 'X'), (0xA95F, 'V'), (0xA97D, 'X'), (0xA980, 'V'), (0xA9CE, 'X'), (0xA9CF, 'V'), ] def _seg_38(): return [ (0xA9DA, 'X'), (0xA9DE, 'V'), (0xA9FF, 'X'), (0xAA00, 'V'), (0xAA37, 'X'), (0xAA40, 'V'), (0xAA4E, 'X'), (0xAA50, 'V'), (0xAA5A, 'X'), (0xAA5C, 'V'), (0xAAC3, 'X'), (0xAADB, 'V'), (0xAAF7, 'X'), (0xAB01, 'V'), (0xAB07, 'X'), (0xAB09, 'V'), (0xAB0F, 'X'), (0xAB11, 'V'), (0xAB17, 'X'), (0xAB20, 'V'), (0xAB27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', u'Ꮗ'), (0xAB98, 'M', u'Ꮘ'), (0xAB99, 'M', u'Ꮙ'), (0xAB9A, 'M', u'Ꮚ'), (0xAB9B, 'M', u'Ꮛ'), (0xAB9C, 'M', u'Ꮜ'), (0xAB9D, 'M', u'Ꮝ'), (0xAB9E, 'M', u'Ꮞ'), (0xAB9F, 'M', u'Ꮟ'), (0xABA0, 'M', u'Ꮠ'), (0xABA1, 'M', u'Ꮡ'), (0xABA2, 'M', u'Ꮢ'), (0xABA3, 'M', u'Ꮣ'), (0xABA4, 'M', u'Ꮤ'), (0xABA5, 'M', u'Ꮥ'), (0xABA6, 'M', u'Ꮦ'), (0xABA7, 'M', u'Ꮧ'), (0xABA8, 'M', u'Ꮨ'), (0xABA9, 'M', u'Ꮩ'), (0xABAA, 'M', u'Ꮪ'), (0xABAB, 'M', u'Ꮫ'), (0xABAC, 'M', u'Ꮬ'), (0xABAD, 'M', u'Ꮭ'), (0xABAE, 'M', u'Ꮮ'), (0xABAF, 'M', u'Ꮯ'), (0xABB0, 'M', u'Ꮰ'), (0xABB1, 'M', u'Ꮱ'), (0xABB2, 'M', u'Ꮲ'), (0xABB3, 'M', u'Ꮳ'), ] def _seg_39(): return [ (0xABB4, 'M', u'Ꮴ'), (0xABB5, 'M', u'Ꮵ'), (0xABB6, 'M', u'Ꮶ'), (0xABB7, 'M', u'Ꮷ'), (0xABB8, 'M', u'Ꮸ'), (0xABB9, 'M', u'Ꮹ'), (0xABBA, 'M', u'Ꮺ'), (0xABBB, 'M', u'Ꮻ'), (0xABBC, 'M', u'Ꮼ'), (0xABBD, 'M', u'Ꮽ'), (0xABBE, 'M', u'Ꮾ'), (0xABBF, 'M', u'Ꮿ'), (0xABC0, 'V'), (0xABEE, 'X'), (0xABF0, 'V'), (0xABFA, 'X'), (0xAC00, 'V'), (0xD7A4, 'X'), (0xD7B0, 'V'), (0xD7C7, 'X'), (0xD7CB, 'V'), (0xD7FC, 'X'), (0xF900, 'M', u'豈'), (0xF901, 'M', u'更'), (0xF902, 'M', u'車'), (0xF903, 'M', u'賈'), (0xF904, 'M', u'滑'), (0xF905, 'M', u'串'), (0xF906, 'M', u'句'), (0xF907, 'M', u'龜'), (0xF909, 'M', u'契'), (0xF90A, 'M', u'金'), (0xF90B, 'M', u'喇'), (0xF90C, 'M', u'奈'), (0xF90D, 'M', u'懶'), (0xF90E, 'M', u'癩'), (0xF90F, 'M', u'羅'), (0xF910, 'M', u'蘿'), (0xF911, 'M', u'螺'), (0xF912, 'M', u'裸'), (0xF913, 'M', u'邏'), (0xF914, 'M', u'樂'), (0xF915, 'M', u'洛'), (0xF916, 'M', u'烙'), (0xF917, 'M', u'珞'), (0xF918, 'M', u'落'), (0xF919, 'M', u'酪'), (0xF91A, 'M', u'駱'), (0xF91B, 'M', u'亂'), (0xF91C, 'M', u'卵'), (0xF91D, 'M', u'欄'), (0xF91E, 'M', u'爛'), (0xF91F, 'M', u'蘭'), (0xF920, 'M', u'鸞'), (0xF921, 'M', u'嵐'), (0xF922, 'M', u'濫'), (0xF923, 'M', u'藍'), (0xF924, 'M', u'襤'), (0xF925, 'M', u'拉'), (0xF926, 'M', u'臘'), (0xF927, 'M', u'蠟'), (0xF928, 'M', u'廊'), (0xF929, 'M', u'朗'), (0xF92A, 'M', u'浪'), (0xF92B, 'M', u'狼'), (0xF92C, 'M', u'郎'), (0xF92D, 'M', u'來'), (0xF92E, 'M', u'冷'), (0xF92F, 'M', u'勞'), (0xF930, 'M', u'擄'), (0xF931, 'M', u'櫓'), (0xF932, 'M', u'爐'), (0xF933, 'M', u'盧'), (0xF934, 'M', u'老'), (0xF935, 'M', u'蘆'), (0xF936, 'M', u'虜'), (0xF937, 'M', u'路'), (0xF938, 'M', u'露'), (0xF939, 'M', u'魯'), (0xF93A, 'M', u'鷺'), (0xF93B, 'M', u'碌'), (0xF93C, 'M', u'祿'), (0xF93D, 'M', u'綠'), (0xF93E, 'M', u'菉'), (0xF93F, 'M', u'錄'), (0xF940, 'M', u'鹿'), (0xF941, 'M', u'論'), (0xF942, 'M', u'壟'), (0xF943, 'M', u'弄'), (0xF944, 'M', u'籠'), (0xF945, 'M', u'聾'), (0xF946, 'M', u'牢'), (0xF947, 'M', u'磊'), (0xF948, 'M', u'賂'), (0xF949, 'M', u'雷'), (0xF94A, 'M', u'壘'), (0xF94B, 'M', u'屢'), (0xF94C, 'M', u'樓'), (0xF94D, 'M', u'淚'), (0xF94E, 'M', u'漏'), ] def _seg_40(): return [ (0xF94F, 'M', u'累'), (0xF950, 'M', u'縷'), (0xF951, 'M', u'陋'), (0xF952, 'M', u'勒'), (0xF953, 'M', u'肋'), (0xF954, 'M', u'凜'), (0xF955, 'M', u'凌'), (0xF956, 'M', u'稜'), (0xF957, 'M', u'綾'), (0xF958, 'M', u'菱'), (0xF959, 'M', u'陵'), (0xF95A, 'M', u'讀'), (0xF95B, 'M', u'拏'), (0xF95C, 'M', u'樂'), (0xF95D, 'M', u'諾'), (0xF95E, 'M', u'丹'), (0xF95F, 'M', u'寧'), (0xF960, 'M', u'怒'), (0xF961, 'M', u'率'), (0xF962, 'M', u'異'), (0xF963, 'M', u'北'), (0xF964, 'M', u'磻'), (0xF965, 'M', u'便'), (0xF966, 'M', u'復'), (0xF967, 'M', u'不'), (0xF968, 'M', u'泌'), (0xF969, 'M', u'數'), (0xF96A, 'M', u'索'), (0xF96B, 'M', u'參'), (0xF96C, 'M', u'塞'), (0xF96D, 'M', u'省'), (0xF96E, 'M', u'葉'), (0xF96F, 'M', u'說'), (0xF970, 'M', u'殺'), (0xF971, 'M', u'辰'), (0xF972, 'M', u'沈'), (0xF973, 'M', u'拾'), (0xF974, 'M', u'若'), (0xF975, 'M', u'掠'), (0xF976, 'M', u'略'), (0xF977, 'M', u'亮'), (0xF978, 'M', u'兩'), (0xF979, 'M', u'凉'), (0xF97A, 'M', u'梁'), (0xF97B, 'M', u'糧'), (0xF97C, 'M', u'良'), (0xF97D, 'M', u'諒'), (0xF97E, 'M', u'量'), (0xF97F, 'M', u'勵'), (0xF980, 'M', u'呂'), (0xF981, 'M', u'女'), (0xF982, 'M', u'廬'), (0xF983, 'M', u'旅'), (0xF984, 'M', u'濾'), (0xF985, 'M', u'礪'), (0xF986, 'M', u'閭'), (0xF987, 'M', u'驪'), (0xF988, 'M', u'麗'), (0xF989, 'M', u'黎'), (0xF98A, 'M', u'力'), (0xF98B, 'M', u'曆'), (0xF98C, 'M', u'歷'), (0xF98D, 'M', u'轢'), (0xF98E, 'M', u'年'), (0xF98F, 'M', u'憐'), (0xF990, 'M', u'戀'), (0xF991, 'M', u'撚'), (0xF992, 'M', u'漣'), (0xF993, 'M', u'煉'), (0xF994, 'M', u'璉'), (0xF995, 'M', u'秊'), (0xF996, 'M', u'練'), (0xF997, 'M', u'聯'), (0xF998, 'M', u'輦'), (0xF999, 'M', u'蓮'), (0xF99A, 'M', u'連'), (0xF99B, 'M', u'鍊'), (0xF99C, 'M', u'列'), (0xF99D, 'M', u'劣'), (0xF99E, 'M', u'咽'), (0xF99F, 'M', u'烈'), (0xF9A0, 'M', u'裂'), (0xF9A1, 'M', u'說'), (0xF9A2, 'M', u'廉'), (0xF9A3, 'M', u'念'), (0xF9A4, 'M', u'捻'), (0xF9A5, 'M', u'殮'), (0xF9A6, 'M', u'簾'), (0xF9A7, 'M', u'獵'), (0xF9A8, 'M', u'令'), (0xF9A9, 'M', u'囹'), (0xF9AA, 'M', u'寧'), (0xF9AB, 'M', u'嶺'), (0xF9AC, 'M', u'怜'), (0xF9AD, 'M', u'玲'), (0xF9AE, 'M', u'瑩'), (0xF9AF, 'M', u'羚'), (0xF9B0, 'M', u'聆'), (0xF9B1, 'M', u'鈴'), (0xF9B2, 'M', u'零'), ] def _seg_41(): return [ (0xF9B3, 'M', u'靈'), (0xF9B4, 'M', u'領'), (0xF9B5, 'M', u'例'), (0xF9B6, 'M', u'禮'), (0xF9B7, 'M', u'醴'), (0xF9B8, 'M', u'隸'), (0xF9B9, 'M', u'惡'), (0xF9BA, 'M', u'了'), (0xF9BB, 'M', u'僚'), (0xF9BC, 'M', u'寮'), (0xF9BD, 'M', u'尿'), (0xF9BE, 'M', u'料'), (0xF9BF, 'M', u'樂'), (0xF9C0, 'M', u'燎'), (0xF9C1, 'M', u'療'), (0xF9C2, 'M', u'蓼'), (0xF9C3, 'M', u'遼'), (0xF9C4, 'M', u'龍'), (0xF9C5, 'M', u'暈'), (0xF9C6, 'M', u'阮'), (0xF9C7, 'M', u'劉'), (0xF9C8, 'M', u'杻'), (0xF9C9, 'M', u'柳'), (0xF9CA, 'M', u'流'), (0xF9CB, 'M', u'溜'), (0xF9CC, 'M', u'琉'), (0xF9CD, 'M', u'留'), (0xF9CE, 'M', u'硫'), (0xF9CF, 'M', u'紐'), (0xF9D0, 'M', u'類'), (0xF9D1, 'M', u'六'), (0xF9D2, 'M', u'戮'), (0xF9D3, 'M', u'陸'), (0xF9D4, 'M', u'倫'), (0xF9D5, 'M', u'崙'), (0xF9D6, 'M', u'淪'), (0xF9D7, 'M', u'輪'), (0xF9D8, 'M', u'律'), (0xF9D9, 'M', u'慄'), (0xF9DA, 'M', u'栗'), (0xF9DB, 'M', u'率'), (0xF9DC, 'M', u'隆'), (0xF9DD, 'M', u'利'), (0xF9DE, 'M', u'吏'), (0xF9DF, 'M', u'履'), (0xF9E0, 'M', u'易'), (0xF9E1, 'M', u'李'), (0xF9E2, 'M', u'梨'), (0xF9E3, 'M', u'泥'), (0xF9E4, 'M', u'理'), (0xF9E5, 'M', u'痢'), (0xF9E6, 'M', u'罹'), (0xF9E7, 'M', u'裏'), (0xF9E8, 'M', u'裡'), (0xF9E9, 'M', u'里'), (0xF9EA, 'M', u'離'), (0xF9EB, 'M', u'匿'), (0xF9EC, 'M', u'溺'), (0xF9ED, 'M', u'吝'), (0xF9EE, 'M', u'燐'), (0xF9EF, 'M', u'璘'), (0xF9F0, 'M', u'藺'), (0xF9F1, 'M', u'隣'), (0xF9F2, 'M', u'鱗'), (0xF9F3, 'M', u'麟'), (0xF9F4, 'M', u'林'), (0xF9F5, 'M', u'淋'), (0xF9F6, 'M', u'臨'), (0xF9F7, 'M', u'立'), (0xF9F8, 'M', u'笠'), (0xF9F9, 'M', u'粒'), (0xF9FA, 'M', u'狀'), (0xF9FB, 'M', u'炙'), (0xF9FC, 'M', u'識'), (0xF9FD, 'M', u'什'), (0xF9FE, 'M', u'茶'), (0xF9FF, 'M', u'刺'), (0xFA00, 'M', u'切'), (0xFA01, 'M', u'度'), (0xFA02, 'M', u'拓'), (0xFA03, 'M', u'糖'), (0xFA04, 'M', u'宅'), (0xFA05, 'M', u'洞'), (0xFA06, 'M', u'暴'), (0xFA07, 'M', u'輻'), (0xFA08, 'M', u'行'), (0xFA09, 'M', u'降'), (0xFA0A, 'M', u'見'), (0xFA0B, 'M', u'廓'), (0xFA0C, 'M', u'兀'), (0xFA0D, 'M', u'嗀'), (0xFA0E, 'V'), (0xFA10, 'M', u'塚'), (0xFA11, 'V'), (0xFA12, 'M', u'晴'), (0xFA13, 'V'), (0xFA15, 'M', u'凞'), (0xFA16, 'M', u'猪'), (0xFA17, 'M', u'益'), (0xFA18, 'M', u'礼'), ] def _seg_42(): return [ (0xFA19, 'M', u'神'), (0xFA1A, 'M', u'祥'), (0xFA1B, 'M', u'福'), (0xFA1C, 'M', u'靖'), (0xFA1D, 'M', u'精'), (0xFA1E, 'M', u'羽'), (0xFA1F, 'V'), (0xFA20, 'M', u'蘒'), (0xFA21, 'V'), (0xFA22, 'M', u'諸'), (0xFA23, 'V'), (0xFA25, 'M', u'逸'), (0xFA26, 'M', u'都'), (0xFA27, 'V'), (0xFA2A, 'M', u'飯'), (0xFA2B, 'M', u'飼'), (0xFA2C, 'M', u'館'), (0xFA2D, 'M', u'鶴'), (0xFA2E, 'M', u'郞'), (0xFA2F, 'M', u'隷'), (0xFA30, 'M', u'侮'), (0xFA31, 'M', u'僧'), (0xFA32, 'M', u'免'), (0xFA33, 'M', u'勉'), (0xFA34, 'M', u'勤'), (0xFA35, 'M', u'卑'), (0xFA36, 'M', u'喝'), (0xFA37, 'M', u'嘆'), (0xFA38, 'M', u'器'), (0xFA39, 'M', u'塀'), (0xFA3A, 'M', u'墨'), (0xFA3B, 'M', u'層'), (0xFA3C, 'M', u'屮'), (0xFA3D, 'M', u'悔'), (0xFA3E, 'M', u'慨'), (0xFA3F, 'M', u'憎'), (0xFA40, 'M', u'懲'), (0xFA41, 'M', u'敏'), (0xFA42, 'M', u'既'), (0xFA43, 'M', u'暑'), (0xFA44, 'M', u'梅'), (0xFA45, 'M', u'海'), (0xFA46, 'M', u'渚'), (0xFA47, 'M', u'漢'), (0xFA48, 'M', u'煮'), (0xFA49, 'M', u'爫'), (0xFA4A, 'M', u'琢'), (0xFA4B, 'M', u'碑'), (0xFA4C, 'M', u'社'), (0xFA4D, 'M', u'祉'), (0xFA4E, 'M', u'祈'), (0xFA4F, 'M', u'祐'), (0xFA50, 'M', u'祖'), (0xFA51, 'M', u'祝'), (0xFA52, 'M', u'禍'), (0xFA53, 'M', u'禎'), (0xFA54, 'M', u'穀'), (0xFA55, 'M', u'突'), (0xFA56, 'M', u'節'), (0xFA57, 'M', u'練'), (0xFA58, 'M', u'縉'), (0xFA59, 'M', u'繁'), (0xFA5A, 'M', u'署'), (0xFA5B, 'M', u'者'), (0xFA5C, 'M', u'臭'), (0xFA5D, 'M', u'艹'), (0xFA5F, 'M', u'著'), (0xFA60, 'M', u'褐'), (0xFA61, 'M', u'視'), (0xFA62, 'M', u'謁'), (0xFA63, 'M', u'謹'), (0xFA64, 'M', u'賓'), (0xFA65, 'M', u'贈'), (0xFA66, 'M', u'辶'), (0xFA67, 'M', u'逸'), (0xFA68, 'M', u'難'), (0xFA69, 'M', u'響'), (0xFA6A, 'M', u'頻'), (0xFA6B, 'M', u'恵'), (0xFA6C, 'M', u'𤋮'), (0xFA6D, 'M', u'舘'), (0xFA6E, 'X'), (0xFA70, 'M', u'並'), (0xFA71, 'M', u'况'), (0xFA72, 'M', u'全'), (0xFA73, 'M', u'侀'), (0xFA74, 'M', u'充'), (0xFA75, 'M', u'冀'), (0xFA76, 'M', u'勇'), (0xFA77, 'M', u'勺'), (0xFA78, 'M', u'喝'), (0xFA79, 'M', u'啕'), (0xFA7A, 'M', u'喙'), (0xFA7B, 'M', u'嗢'), (0xFA7C, 'M', u'塚'), (0xFA7D, 'M', u'墳'), (0xFA7E, 'M', u'奄'), (0xFA7F, 'M', u'奔'), (0xFA80, 'M', u'婢'), (0xFA81, 'M', u'嬨'), ] def _seg_43(): return [ (0xFA82, 'M', u'廒'), (0xFA83, 'M', u'廙'), (0xFA84, 'M', u'彩'), (0xFA85, 'M', u'徭'), (0xFA86, 'M', u'惘'), (0xFA87, 'M', u'慎'), (0xFA88, 'M', u'愈'), (0xFA89, 'M', u'憎'), (0xFA8A, 'M', u'慠'), (0xFA8B, 'M', u'懲'), (0xFA8C, 'M', u'戴'), (0xFA8D, 'M', u'揄'), (0xFA8E, 'M', u'搜'), (0xFA8F, 'M', u'摒'), (0xFA90, 'M', u'敖'), (0xFA91, 'M', u'晴'), (0xFA92, 'M', u'朗'), (0xFA93, 'M', u'望'), (0xFA94, 'M', u'杖'), (0xFA95, 'M', u'歹'), (0xFA96, 'M', u'殺'), (0xFA97, 'M', u'流'), (0xFA98, 'M', u'滛'), (0xFA99, 'M', u'滋'), (0xFA9A, 'M', u'漢'), (0xFA9B, 'M', u'瀞'), (0xFA9C, 'M', u'煮'), (0xFA9D, 'M', u'瞧'), (0xFA9E, 'M', u'爵'), (0xFA9F, 'M', u'犯'), (0xFAA0, 'M', u'猪'), (0xFAA1, 'M', u'瑱'), (0xFAA2, 'M', u'甆'), (0xFAA3, 'M', u'画'), (0xFAA4, 'M', u'瘝'), (0xFAA5, 'M', u'瘟'), (0xFAA6, 'M', u'益'), (0xFAA7, 'M', u'盛'), (0xFAA8, 'M', u'直'), (0xFAA9, 'M', u'睊'), (0xFAAA, 'M', u'着'), (0xFAAB, 'M', u'磌'), (0xFAAC, 'M', u'窱'), (0xFAAD, 'M', u'節'), (0xFAAE, 'M', u'类'), (0xFAAF, 'M', u'絛'), (0xFAB0, 'M', u'練'), (0xFAB1, 'M', u'缾'), (0xFAB2, 'M', u'者'), (0xFAB3, 'M', u'荒'), (0xFAB4, 'M', u'華'), (0xFAB5, 'M', u'蝹'), (0xFAB6, 'M', u'襁'), (0xFAB7, 'M', u'覆'), (0xFAB8, 'M', u'視'), (0xFAB9, 'M', u'調'), (0xFABA, 'M', u'諸'), (0xFABB, 'M', u'請'), (0xFABC, 'M', u'謁'), (0xFABD, 'M', u'諾'), (0xFABE, 'M', u'諭'), (0xFABF, 'M', u'謹'), (0xFAC0, 'M', u'變'), (0xFAC1, 'M', u'贈'), (0xFAC2, 'M', u'輸'), (0xFAC3, 'M', u'遲'), (0xFAC4, 'M', u'醙'), (0xFAC5, 'M', u'鉶'), (0xFAC6, 'M', u'陼'), (0xFAC7, 'M', u'難'), (0xFAC8, 'M', u'靖'), (0xFAC9, 'M', u'韛'), (0xFACA, 'M', u'響'), (0xFACB, 'M', u'頋'), (0xFACC, 'M', u'頻'), (0xFACD, 'M', u'鬒'), (0xFACE, 'M', u'龜'), (0xFACF, 'M', u'𢡊'), (0xFAD0, 'M', u'𢡄'), (0xFAD1, 'M', u'𣏕'), (0xFAD2, 'M', u'㮝'), (0xFAD3, 'M', u'䀘'), (0xFAD4, 'M', u'䀹'), (0xFAD5, 'M', u'𥉉'), (0xFAD6, 'M', u'𥳐'), (0xFAD7, 'M', u'𧻓'), (0xFAD8, 'M', u'齃'), (0xFAD9, 'M', u'龎'), (0xFADA, 'X'), (0xFB00, 'M', u'ff'), (0xFB01, 'M', u'fi'), (0xFB02, 'M', u'fl'), (0xFB03, 'M', u'ffi'), (0xFB04, 'M', u'ffl'), (0xFB05, 'M', u'st'), (0xFB07, 'X'), (0xFB13, 'M', u'մն'), (0xFB14, 'M', u'մե'), (0xFB15, 'M', u'մի'), (0xFB16, 'M', u'վն'), ] def _seg_44(): return [ (0xFB17, 'M', u'մխ'), (0xFB18, 'X'), (0xFB1D, 'M', u'יִ'), (0xFB1E, 'V'), (0xFB1F, 'M', u'ײַ'), (0xFB20, 'M', u'ע'), (0xFB21, 'M', u'א'), (0xFB22, 'M', u'ד'), (0xFB23, 'M', u'ה'), (0xFB24, 'M', u'כ'), (0xFB25, 'M', u'ל'), (0xFB26, 'M', u'ם'), (0xFB27, 'M', u'ר'), (0xFB28, 'M', u'ת'), (0xFB29, '3', u'+'), (0xFB2A, 'M', u'שׁ'), (0xFB2B, 'M', u'שׂ'), (0xFB2C, 'M', u'שּׁ'), (0xFB2D, 'M', u'שּׂ'), (0xFB2E, 'M', u'אַ'), (0xFB2F, 'M', u'אָ'), (0xFB30, 'M', u'אּ'), (0xFB31, 'M', u'בּ'), (0xFB32, 'M', u'גּ'), (0xFB33, 'M', u'דּ'), (0xFB34, 'M', u'הּ'), (0xFB35, 'M', u'וּ'), (0xFB36, 'M', u'זּ'), (0xFB37, 'X'), (0xFB38, 'M', u'טּ'), (0xFB39, 'M', u'יּ'), (0xFB3A, 'M', u'ךּ'), (0xFB3B, 'M', u'כּ'), (0xFB3C, 'M', u'לּ'), (0xFB3D, 'X'), (0xFB3E, 'M', u'מּ'), (0xFB3F, 'X'), (0xFB40, 'M', u'נּ'), (0xFB41, 'M', u'סּ'), (0xFB42, 'X'), (0xFB43, 'M', u'ףּ'), (0xFB44, 'M', u'פּ'), (0xFB45, 'X'), (0xFB46, 'M', u'צּ'), (0xFB47, 'M', u'קּ'), (0xFB48, 'M', u'רּ'), (0xFB49, 'M', u'שּ'), (0xFB4A, 'M', u'תּ'), (0xFB4B, 'M', u'וֹ'), (0xFB4C, 'M', u'בֿ'), (0xFB4D, 'M', u'כֿ'), (0xFB4E, 'M', u'פֿ'), (0xFB4F, 'M', u'אל'), (0xFB50, 'M', u'ٱ'), (0xFB52, 'M', u'ٻ'), (0xFB56, 'M', u'پ'), (0xFB5A, 'M', u'ڀ'), (0xFB5E, 'M', u'ٺ'), (0xFB62, 'M', u'ٿ'), (0xFB66, 'M', u'ٹ'), (0xFB6A, 'M', u'ڤ'), (0xFB6E, 'M', u'ڦ'), (0xFB72, 'M', u'ڄ'), (0xFB76, 'M', u'ڃ'), (0xFB7A, 'M', u'چ'), (0xFB7E, 'M', u'ڇ'), (0xFB82, 'M', u'ڍ'), (0xFB84, 'M', u'ڌ'), (0xFB86, 'M', u'ڎ'), (0xFB88, 'M', u'ڈ'), (0xFB8A, 'M', u'ژ'), (0xFB8C, 'M', u'ڑ'), (0xFB8E, 'M', u'ک'), (0xFB92, 'M', u'گ'), (0xFB96, 'M', u'ڳ'), (0xFB9A, 'M', u'ڱ'), (0xFB9E, 'M', u'ں'), (0xFBA0, 'M', u'ڻ'), (0xFBA4, 'M', u'ۀ'), (0xFBA6, 'M', u'ہ'), (0xFBAA, 'M', u'ھ'), (0xFBAE, 'M', u'ے'), (0xFBB0, 'M', u'ۓ'), (0xFBB2, 'V'), (0xFBC2, 'X'), (0xFBD3, 'M', u'ڭ'), (0xFBD7, 'M', u'ۇ'), (0xFBD9, 'M', u'ۆ'), (0xFBDB, 'M', u'ۈ'), (0xFBDD, 'M', u'ۇٴ'), (0xFBDE, 'M', u'ۋ'), (0xFBE0, 'M', u'ۅ'), (0xFBE2, 'M', u'ۉ'), (0xFBE4, 'M', u'ې'), (0xFBE8, 'M', u'ى'), (0xFBEA, 'M', u'ئا'), (0xFBEC, 'M', u'ئە'), (0xFBEE, 'M', u'ئو'), (0xFBF0, 'M', u'ئۇ'), (0xFBF2, 'M', u'ئۆ'), ] def _seg_45(): return [ (0xFBF4, 'M', u'ئۈ'), (0xFBF6, 'M', u'ئې'), (0xFBF9, 'M', u'ئى'), (0xFBFC, 'M', u'ی'), (0xFC00, 'M', u'ئج'), (0xFC01, 'M', u'ئح'), (0xFC02, 'M', u'ئم'), (0xFC03, 'M', u'ئى'), (0xFC04, 'M', u'ئي'), (0xFC05, 'M', u'بج'), (0xFC06, 'M', u'بح'), (0xFC07, 'M', u'بخ'), (0xFC08, 'M', u'بم'), (0xFC09, 'M', u'بى'), (0xFC0A, 'M', u'بي'), (0xFC0B, 'M', u'تج'), (0xFC0C, 'M', u'تح'), (0xFC0D, 'M', u'تخ'), (0xFC0E, 'M', u'تم'), (0xFC0F, 'M', u'تى'), (0xFC10, 'M', u'تي'), (0xFC11, 'M', u'ثج'), (0xFC12, 'M', u'ثم'), (0xFC13, 'M', u'ثى'), (0xFC14, 'M', u'ثي'), (0xFC15, 'M', u'جح'), (0xFC16, 'M', u'جم'), (0xFC17, 'M', u'حج'), (0xFC18, 'M', u'حم'), (0xFC19, 'M', u'خج'), (0xFC1A, 'M', u'خح'), (0xFC1B, 'M', u'خم'), (0xFC1C, 'M', u'سج'), (0xFC1D, 'M', u'سح'), (0xFC1E, 'M', u'سخ'), (0xFC1F, 'M', u'سم'), (0xFC20, 'M', u'صح'), (0xFC21, 'M', u'صم'), (0xFC22, 'M', u'ضج'), (0xFC23, 'M', u'ضح'), (0xFC24, 'M', u'ضخ'), (0xFC25, 'M', u'ضم'), (0xFC26, 'M', u'طح'), (0xFC27, 'M', u'طم'), (0xFC28, 'M', u'ظم'), (0xFC29, 'M', u'عج'), (0xFC2A, 'M', u'عم'), (0xFC2B, 'M', u'غج'), (0xFC2C, 'M', u'غم'), (0xFC2D, 'M', u'فج'), (0xFC2E, 'M', u'فح'), (0xFC2F, 'M', u'فخ'), (0xFC30, 'M', u'فم'), (0xFC31, 'M', u'فى'), (0xFC32, 'M', u'في'), (0xFC33, 'M', u'قح'), (0xFC34, 'M', u'قم'), (0xFC35, 'M', u'قى'), (0xFC36, 'M', u'قي'), (0xFC37, 'M', u'كا'), (0xFC38, 'M', u'كج'), (0xFC39, 'M', u'كح'), (0xFC3A, 'M', u'كخ'), (0xFC3B, 'M', u'كل'), (0xFC3C, 'M', u'كم'), (0xFC3D, 'M', u'كى'), (0xFC3E, 'M', u'كي'), (0xFC3F, 'M', u'لج'), (0xFC40, 'M', u'لح'), (0xFC41, 'M', u'لخ'), (0xFC42, 'M', u'لم'), (0xFC43, 'M', u'لى'), (0xFC44, 'M', u'لي'), (0xFC45, 'M', u'مج'), (0xFC46, 'M', u'مح'), (0xFC47, 'M', u'مخ'), (0xFC48, 'M', u'مم'), (0xFC49, 'M', u'مى'), (0xFC4A, 'M', u'مي'), (0xFC4B, 'M', u'نج'), (0xFC4C, 'M', u'نح'), (0xFC4D, 'M', u'نخ'), (0xFC4E, 'M', u'نم'), (0xFC4F, 'M', u'نى'), (0xFC50, 'M', u'ني'), (0xFC51, 'M', u'هج'), (0xFC52, 'M', u'هم'), (0xFC53, 'M', u'هى'), (0xFC54, 'M', u'هي'), (0xFC55, 'M', u'يج'), (0xFC56, 'M', u'يح'), (0xFC57, 'M', u'يخ'), (0xFC58, 'M', u'يم'), (0xFC59, 'M', u'يى'), (0xFC5A, 'M', u'يي'), (0xFC5B, 'M', u'ذٰ'), (0xFC5C, 'M', u'رٰ'), (0xFC5D, 'M', u'ىٰ'), (0xFC5E, '3', u' ٌّ'), (0xFC5F, '3', u' ٍّ'), ] def _seg_46(): return [ (0xFC60, '3', u' َّ'), (0xFC61, '3', u' ُّ'), (0xFC62, '3', u' ِّ'), (0xFC63, '3', u' ّٰ'), (0xFC64, 'M', u'ئر'), (0xFC65, 'M', u'ئز'), (0xFC66, 'M', u'ئم'), (0xFC67, 'M', u'ئن'), (0xFC68, 'M', u'ئى'), (0xFC69, 'M', u'ئي'), (0xFC6A, 'M', u'بر'), (0xFC6B, 'M', u'بز'), (0xFC6C, 'M', u'بم'), (0xFC6D, 'M', u'بن'), (0xFC6E, 'M', u'بى'), (0xFC6F, 'M', u'بي'), (0xFC70, 'M', u'تر'), (0xFC71, 'M', u'تز'), (0xFC72, 'M', u'تم'), (0xFC73, 'M', u'تن'), (0xFC74, 'M', u'تى'), (0xFC75, 'M', u'تي'), (0xFC76, 'M', u'ثر'), (0xFC77, 'M', u'ثز'), (0xFC78, 'M', u'ثم'), (0xFC79, 'M', u'ثن'), (0xFC7A, 'M', u'ثى'), (0xFC7B, 'M', u'ثي'), (0xFC7C, 'M', u'فى'), (0xFC7D, 'M', u'في'), (0xFC7E, 'M', u'قى'), (0xFC7F, 'M', u'قي'), (0xFC80, 'M', u'كا'), (0xFC81, 'M', u'كل'), (0xFC82, 'M', u'كم'), (0xFC83, 'M', u'كى'), (0xFC84, 'M', u'كي'), (0xFC85, 'M', u'لم'), (0xFC86, 'M', u'لى'), (0xFC87, 'M', u'لي'), (0xFC88, 'M', u'ما'), (0xFC89, 'M', u'مم'), (0xFC8A, 'M', u'نر'), (0xFC8B, 'M', u'نز'), (0xFC8C, 'M', u'نم'), (0xFC8D, 'M', u'نن'), (0xFC8E, 'M', u'نى'), (0xFC8F, 'M', u'ني'), (0xFC90, 'M', u'ىٰ'), (0xFC91, 'M', u'ير'), (0xFC92, 'M', u'يز'), (0xFC93, 'M', u'يم'), (0xFC94, 'M', u'ين'), (0xFC95, 'M', u'يى'), (0xFC96, 'M', u'يي'), (0xFC97, 'M', u'ئج'), (0xFC98, 'M', u'ئح'), (0xFC99, 'M', u'ئخ'), (0xFC9A, 'M', u'ئم'), (0xFC9B, 'M', u'ئه'), (0xFC9C, 'M', u'بج'), (0xFC9D, 'M', u'بح'), (0xFC9E, 'M', u'بخ'), (0xFC9F, 'M', u'بم'), (0xFCA0, 'M', u'به'), (0xFCA1, 'M', u'تج'), (0xFCA2, 'M', u'تح'), (0xFCA3, 'M', u'تخ'), (0xFCA4, 'M', u'تم'), (0xFCA5, 'M', u'ته'), (0xFCA6, 'M', u'ثم'), (0xFCA7, 'M', u'جح'), (0xFCA8, 'M', u'جم'), (0xFCA9, 'M', u'حج'), (0xFCAA, 'M', u'حم'), (0xFCAB, 'M', u'خج'), (0xFCAC, 'M', u'خم'), (0xFCAD, 'M', u'سج'), (0xFCAE, 'M', u'سح'), (0xFCAF, 'M', u'سخ'), (0xFCB0, 'M', u'سم'), (0xFCB1, 'M', u'صح'), (0xFCB2, 'M', u'صخ'), (0xFCB3, 'M', u'صم'), (0xFCB4, 'M', u'ضج'), (0xFCB5, 'M', u'ضح'), (0xFCB6, 'M', u'ضخ'), (0xFCB7, 'M', u'ضم'), (0xFCB8, 'M', u'طح'), (0xFCB9, 'M', u'ظم'), (0xFCBA, 'M', u'عج'), (0xFCBB, 'M', u'عم'), (0xFCBC, 'M', u'غج'), (0xFCBD, 'M', u'غم'), (0xFCBE, 'M', u'فج'), (0xFCBF, 'M', u'فح'), (0xFCC0, 'M', u'فخ'), (0xFCC1, 'M', u'فم'), (0xFCC2, 'M', u'قح'), (0xFCC3, 'M', u'قم'), ] def _seg_47(): return [ (0xFCC4, 'M', u'كج'), (0xFCC5, 'M', u'كح'), (0xFCC6, 'M', u'كخ'), (0xFCC7, 'M', u'كل'), (0xFCC8, 'M', u'كم'), (0xFCC9, 'M', u'لج'), (0xFCCA, 'M', u'لح'), (0xFCCB, 'M', u'لخ'), (0xFCCC, 'M', u'لم'), (0xFCCD, 'M', u'له'), (0xFCCE, 'M', u'مج'), (0xFCCF, 'M', u'مح'), (0xFCD0, 'M', u'مخ'), (0xFCD1, 'M', u'مم'), (0xFCD2, 'M', u'نج'), (0xFCD3, 'M', u'نح'), (0xFCD4, 'M', u'نخ'), (0xFCD5, 'M', u'نم'), (0xFCD6, 'M', u'نه'), (0xFCD7, 'M', u'هج'), (0xFCD8, 'M', u'هم'), (0xFCD9, 'M', u'هٰ'), (0xFCDA, 'M', u'يج'), (0xFCDB, 'M', u'يح'), (0xFCDC, 'M', u'يخ'), (0xFCDD, 'M', u'يم'), (0xFCDE, 'M', u'يه'), (0xFCDF, 'M', u'ئم'), (0xFCE0, 'M', u'ئه'), (0xFCE1, 'M', u'بم'), (0xFCE2, 'M', u'به'), (0xFCE3, 'M', u'تم'), (0xFCE4, 'M', u'ته'), (0xFCE5, 'M', u'ثم'), (0xFCE6, 'M', u'ثه'), (0xFCE7, 'M', u'سم'), (0xFCE8, 'M', u'سه'), (0xFCE9, 'M', u'شم'), (0xFCEA, 'M', u'شه'), (0xFCEB, 'M', u'كل'), (0xFCEC, 'M', u'كم'), (0xFCED, 'M', u'لم'), (0xFCEE, 'M', u'نم'), (0xFCEF, 'M', u'نه'), (0xFCF0, 'M', u'يم'), (0xFCF1, 'M', u'يه'), (0xFCF2, 'M', u'ـَّ'), (0xFCF3, 'M', u'ـُّ'), (0xFCF4, 'M', u'ـِّ'), (0xFCF5, 'M', u'طى'), (0xFCF6, 'M', u'طي'), (0xFCF7, 'M', u'عى'), (0xFCF8, 'M', u'عي'), (0xFCF9, 'M', u'غى'), (0xFCFA, 'M', u'غي'), (0xFCFB, 'M', u'سى'), (0xFCFC, 'M', u'سي'), (0xFCFD, 'M', u'شى'), (0xFCFE, 'M', u'شي'), (0xFCFF, 'M', u'حى'), (0xFD00, 'M', u'حي'), (0xFD01, 'M', u'جى'), (0xFD02, 'M', u'جي'), (0xFD03, 'M', u'خى'), (0xFD04, 'M', u'خي'), (0xFD05, 'M', u'صى'), (0xFD06, 'M', u'صي'), (0xFD07, 'M', u'ضى'), (0xFD08, 'M', u'ضي'), (0xFD09, 'M', u'شج'), (0xFD0A, 'M', u'شح'), (0xFD0B, 'M', u'شخ'), (0xFD0C, 'M', u'شم'), (0xFD0D, 'M', u'شر'), (0xFD0E, 'M', u'سر'), (0xFD0F, 'M', u'صر'), (0xFD10, 'M', u'ضر'), (0xFD11, 'M', u'طى'), (0xFD12, 'M', u'طي'), (0xFD13, 'M', u'عى'), (0xFD14, 'M', u'عي'), (0xFD15, 'M', u'غى'), (0xFD16, 'M', u'غي'), (0xFD17, 'M', u'سى'), (0xFD18, 'M', u'سي'), (0xFD19, 'M', u'شى'), (0xFD1A, 'M', u'شي'), (0xFD1B, 'M', u'حى'), (0xFD1C, 'M', u'حي'), (0xFD1D, 'M', u'جى'), (0xFD1E, 'M', u'جي'), (0xFD1F, 'M', u'خى'), (0xFD20, 'M', u'خي'), (0xFD21, 'M', u'صى'), (0xFD22, 'M', u'صي'), (0xFD23, 'M', u'ضى'), (0xFD24, 'M', u'ضي'), (0xFD25, 'M', u'شج'), (0xFD26, 'M', u'شح'), (0xFD27, 'M', u'شخ'), ] def _seg_48(): return [ (0xFD28, 'M', u'شم'), (0xFD29, 'M', u'شر'), (0xFD2A, 'M', u'سر'), (0xFD2B, 'M', u'صر'), (0xFD2C, 'M', u'ضر'), (0xFD2D, 'M', u'شج'), (0xFD2E, 'M', u'شح'), (0xFD2F, 'M', u'شخ'), (0xFD30, 'M', u'شم'), (0xFD31, 'M', u'سه'), (0xFD32, 'M', u'شه'), (0xFD33, 'M', u'طم'), (0xFD34, 'M', u'سج'), (0xFD35, 'M', u'سح'), (0xFD36, 'M', u'سخ'), (0xFD37, 'M', u'شج'), (0xFD38, 'M', u'شح'), (0xFD39, 'M', u'شخ'), (0xFD3A, 'M', u'طم'), (0xFD3B, 'M', u'ظم'), (0xFD3C, 'M', u'اً'), (0xFD3E, 'V'), (0xFD40, 'X'), (0xFD50, 'M', u'تجم'), (0xFD51, 'M', u'تحج'), (0xFD53, 'M', u'تحم'), (0xFD54, 'M', u'تخم'), (0xFD55, 'M', u'تمج'), (0xFD56, 'M', u'تمح'), (0xFD57, 'M', u'تمخ'), (0xFD58, 'M', u'جمح'), (0xFD5A, 'M', u'حمي'), (0xFD5B, 'M', u'حمى'), (0xFD5C, 'M', u'سحج'), (0xFD5D, 'M', u'سجح'), (0xFD5E, 'M', u'سجى'), (0xFD5F, 'M', u'سمح'), (0xFD61, 'M', u'سمج'), (0xFD62, 'M', u'سمم'), (0xFD64, 'M', u'صحح'), (0xFD66, 'M', u'صمم'), (0xFD67, 'M', u'شحم'), (0xFD69, 'M', u'شجي'), (0xFD6A, 'M', u'شمخ'), (0xFD6C, 'M', u'شمم'), (0xFD6E, 'M', u'ضحى'), (0xFD6F, 'M', u'ضخم'), (0xFD71, 'M', u'طمح'), (0xFD73, 'M', u'طمم'), (0xFD74, 'M', u'طمي'), (0xFD75, 'M', u'عجم'), (0xFD76, 'M', u'عمم'), (0xFD78, 'M', u'عمى'), (0xFD79, 'M', u'غمم'), (0xFD7A, 'M', u'غمي'), (0xFD7B, 'M', u'غمى'), (0xFD7C, 'M', u'فخم'), (0xFD7E, 'M', u'قمح'), (0xFD7F, 'M', u'قمم'), (0xFD80, 'M', u'لحم'), (0xFD81, 'M', u'لحي'), (0xFD82, 'M', u'لحى'), (0xFD83, 'M', u'لجج'), (0xFD85, 'M', u'لخم'), (0xFD87, 'M', u'لمح'), (0xFD89, 'M', u'محج'), (0xFD8A, 'M', u'محم'), (0xFD8B, 'M', u'محي'), (0xFD8C, 'M', u'مجح'), (0xFD8D, 'M', u'مجم'), (0xFD8E, 'M', u'مخج'), (0xFD8F, 'M', u'مخم'), (0xFD90, 'X'), (0xFD92, 'M', u'مجخ'), (0xFD93, 'M', u'همج'), (0xFD94, 'M', u'همم'), (0xFD95, 'M', u'نحم'), (0xFD96, 'M', u'نحى'), (0xFD97, 'M', u'نجم'), (0xFD99, 'M', u'نجى'), (0xFD9A, 'M', u'نمي'), (0xFD9B, 'M', u'نمى'), (0xFD9C, 'M', u'يمم'), (0xFD9E, 'M', u'بخي'), (0xFD9F, 'M', u'تجي'), (0xFDA0, 'M', u'تجى'), (0xFDA1, 'M', u'تخي'), (0xFDA2, 'M', u'تخى'), (0xFDA3, 'M', u'تمي'), (0xFDA4, 'M', u'تمى'), (0xFDA5, 'M', u'جمي'), (0xFDA6, 'M', u'جحى'), (0xFDA7, 'M', u'جمى'), (0xFDA8, 'M', u'سخى'), (0xFDA9, 'M', u'صحي'), (0xFDAA, 'M', u'شحي'), (0xFDAB, 'M', u'ضحي'), (0xFDAC, 'M', u'لجي'), (0xFDAD, 'M', u'لمي'), (0xFDAE, 'M', u'يحي'), ] def _seg_49(): return [ (0xFDAF, 'M', u'يجي'), (0xFDB0, 'M', u'يمي'), (0xFDB1, 'M', u'ممي'), (0xFDB2, 'M', u'قمي'), (0xFDB3, 'M', u'نحي'), (0xFDB4, 'M', u'قمح'), (0xFDB5, 'M', u'لحم'), (0xFDB6, 'M', u'عمي'), (0xFDB7, 'M', u'كمي'), (0xFDB8, 'M', u'نجح'), (0xFDB9, 'M', u'مخي'), (0xFDBA, 'M', u'لجم'), (0xFDBB, 'M', u'كمم'), (0xFDBC, 'M', u'لجم'), (0xFDBD, 'M', u'نجح'), (0xFDBE, 'M', u'جحي'), (0xFDBF, 'M', u'حجي'), (0xFDC0, 'M', u'مجي'), (0xFDC1, 'M', u'فمي'), (0xFDC2, 'M', u'بحي'), (0xFDC3, 'M', u'كمم'), (0xFDC4, 'M', u'عجم'), (0xFDC5, 'M', u'صمم'), (0xFDC6, 'M', u'سخي'), (0xFDC7, 'M', u'نجي'), (0xFDC8, 'X'), (0xFDF0, 'M', u'صلے'), (0xFDF1, 'M', u'قلے'), (0xFDF2, 'M', u'الله'), (0xFDF3, 'M', u'اكبر'), (0xFDF4, 'M', u'محمد'), (0xFDF5, 'M', u'صلعم'), (0xFDF6, 'M', u'رسول'), (0xFDF7, 'M', u'عليه'), (0xFDF8, 'M', u'وسلم'), (0xFDF9, 'M', u'صلى'), (0xFDFA, '3', u'صلى الله عليه وسلم'), (0xFDFB, '3', u'جل جلاله'), (0xFDFC, 'M', u'ریال'), (0xFDFD, 'V'), (0xFDFE, 'X'), (0xFE00, 'I'), (0xFE10, '3', u','), (0xFE11, 'M', u'、'), (0xFE12, 'X'), (0xFE13, '3', u':'), (0xFE14, '3', u';'), (0xFE15, '3', u'!'), (0xFE16, '3', u'?'), (0xFE17, 'M', u'〖'), (0xFE18, 'M', u'〗'), (0xFE19, 'X'), (0xFE20, 'V'), (0xFE30, 'X'), (0xFE31, 'M', u'—'), (0xFE32, 'M', u'–'), (0xFE33, '3', u'_'), (0xFE35, '3', u'('), (0xFE36, '3', u')'), (0xFE37, '3', u'{'), (0xFE38, '3', u'}'), (0xFE39, 'M', u'〔'), (0xFE3A, 'M', u'〕'), (0xFE3B, 'M', u'【'), (0xFE3C, 'M', u'】'), (0xFE3D, 'M', u'《'), (0xFE3E, 'M', u'》'), (0xFE3F, 'M', u'〈'), (0xFE40, 'M', u'〉'), (0xFE41, 'M', u'「'), (0xFE42, 'M', u'」'), (0xFE43, 'M', u'『'), (0xFE44, 'M', u'』'), (0xFE45, 'V'), (0xFE47, '3', u'['), (0xFE48, '3', u']'), (0xFE49, '3', u' ̅'), (0xFE4D, '3', u'_'), (0xFE50, '3', u','), (0xFE51, 'M', u'、'), (0xFE52, 'X'), (0xFE54, '3', u';'), (0xFE55, '3', u':'), (0xFE56, '3', u'?'), (0xFE57, '3', u'!'), (0xFE58, 'M', u'—'), (0xFE59, '3', u'('), (0xFE5A, '3', u')'), (0xFE5B, '3', u'{'), (0xFE5C, '3', u'}'), (0xFE5D, 'M', u'〔'), (0xFE5E, 'M', u'〕'), (0xFE5F, '3', u'#'), (0xFE60, '3', u'&'), (0xFE61, '3', u'*'), (0xFE62, '3', u'+'), (0xFE63, 'M', u'-'), (0xFE64, '3', u'<'), (0xFE65, '3', u'>'), (0xFE66, '3', u'='), ] def _seg_50(): return [ (0xFE67, 'X'), (0xFE68, '3', u'\\'), (0xFE69, '3', u'$'), (0xFE6A, '3', u'%'), (0xFE6B, '3', u'@'), (0xFE6C, 'X'), (0xFE70, '3', u' ً'), (0xFE71, 'M', u'ـً'), (0xFE72, '3', u' ٌ'), (0xFE73, 'V'), (0xFE74, '3', u' ٍ'), (0xFE75, 'X'), (0xFE76, '3', u' َ'), (0xFE77, 'M', u'ـَ'), (0xFE78, '3', u' ُ'), (0xFE79, 'M', u'ـُ'), (0xFE7A, '3', u' ِ'), (0xFE7B, 'M', u'ـِ'), (0xFE7C, '3', u' ّ'), (0xFE7D, 'M', u'ـّ'), (0xFE7E, '3', u' ْ'), (0xFE7F, 'M', u'ـْ'), (0xFE80, 'M', u'ء'), (0xFE81, 'M', u'آ'), (0xFE83, 'M', u'أ'), (0xFE85, 'M', u'ؤ'), (0xFE87, 'M', u'إ'), (0xFE89, 'M', u'ئ'), (0xFE8D, 'M', u'ا'), (0xFE8F, 'M', u'ب'), (0xFE93, 'M', u'ة'), (0xFE95, 'M', u'ت'), (0xFE99, 'M', u'ث'), (0xFE9D, 'M', u'ج'), (0xFEA1, 'M', u'ح'), (0xFEA5, 'M', u'خ'), (0xFEA9, 'M', u'د'), (0xFEAB, 'M', u'ذ'), (0xFEAD, 'M', u'ر'), (0xFEAF, 'M', u'ز'), (0xFEB1, 'M', u'س'), (0xFEB5, 'M', u'ش'), (0xFEB9, 'M', u'ص'), (0xFEBD, 'M', u'ض'), (0xFEC1, 'M', u'ط'), (0xFEC5, 'M', u'ظ'), (0xFEC9, 'M', u'ع'), (0xFECD, 'M', u'غ'), (0xFED1, 'M', u'ف'), (0xFED5, 'M', u'ق'), (0xFED9, 'M', u'ك'), (0xFEDD, 'M', u'ل'), (0xFEE1, 'M', u'م'), (0xFEE5, 'M', u'ن'), (0xFEE9, 'M', u'ه'), (0xFEED, 'M', u'و'), (0xFEEF, 'M', u'ى'), (0xFEF1, 'M', u'ي'), (0xFEF5, 'M', u'لآ'), (0xFEF7, 'M', u'لأ'), (0xFEF9, 'M', u'لإ'), (0xFEFB, 'M', u'لا'), (0xFEFD, 'X'), (0xFEFF, 'I'), (0xFF00, 'X'), (0xFF01, '3', u'!'), (0xFF02, '3', u'"'), (0xFF03, '3', u'#'), (0xFF04, '3', u'$'), (0xFF05, '3', u'%'), (0xFF06, '3', u'&'), (0xFF07, '3', u'\''), (0xFF08, '3', u'('), (0xFF09, '3', u')'), (0xFF0A, '3', u'*'), (0xFF0B, '3', u'+'), (0xFF0C, '3', u','), (0xFF0D, 'M', u'-'), (0xFF0E, 'M', u'.'), (0xFF0F, '3', u'/'), (0xFF10, 'M', u'0'), (0xFF11, 'M', u'1'), (0xFF12, 'M', u'2'), (0xFF13, 'M', u'3'), (0xFF14, 'M', u'4'), (0xFF15, 'M', u'5'), (0xFF16, 'M', u'6'), (0xFF17, 'M', u'7'), (0xFF18, 'M', u'8'), (0xFF19, 'M', u'9'), (0xFF1A, '3', u':'), (0xFF1B, '3', u';'), (0xFF1C, '3', u'<'), (0xFF1D, '3', u'='), (0xFF1E, '3', u'>'), (0xFF1F, '3', u'?'), (0xFF20, '3', u'@'), (0xFF21, 'M', u'a'), (0xFF22, 'M', u'b'), (0xFF23, 'M', u'c'), ] def _seg_51(): return [ (0xFF24, 'M', u'd'), (0xFF25, 'M', u'e'), (0xFF26, 'M', u'f'), (0xFF27, 'M', u'g'), (0xFF28, 'M', u'h'), (0xFF29, 'M', u'i'), (0xFF2A, 'M', u'j'), (0xFF2B, 'M', u'k'), (0xFF2C, 'M', u'l'), (0xFF2D, 'M', u'm'), (0xFF2E, 'M', u'n'), (0xFF2F, 'M', u'o'), (0xFF30, 'M', u'p'), (0xFF31, 'M', u'q'), (0xFF32, 'M', u'r'), (0xFF33, 'M', u's'), (0xFF34, 'M', u't'), (0xFF35, 'M', u'u'), (0xFF36, 'M', u'v'), (0xFF37, 'M', u'w'), (0xFF38, 'M', u'x'), (0xFF39, 'M', u'y'), (0xFF3A, 'M', u'z'), (0xFF3B, '3', u'['), (0xFF3C, '3', u'\\'), (0xFF3D, '3', u']'), (0xFF3E, '3', u'^'), (0xFF3F, '3', u'_'), (0xFF40, '3', u'`'), (0xFF41, 'M', u'a'), (0xFF42, 'M', u'b'), (0xFF43, 'M', u'c'), (0xFF44, 'M', u'd'), (0xFF45, 'M', u'e'), (0xFF46, 'M', u'f'), (0xFF47, 'M', u'g'), (0xFF48, 'M', u'h'), (0xFF49, 'M', u'i'), (0xFF4A, 'M', u'j'), (0xFF4B, 'M', u'k'), (0xFF4C, 'M', u'l'), (0xFF4D, 'M', u'm'), (0xFF4E, 'M', u'n'), (0xFF4F, 'M', u'o'), (0xFF50, 'M', u'p'), (0xFF51, 'M', u'q'), (0xFF52, 'M', u'r'), (0xFF53, 'M', u's'), (0xFF54, 'M', u't'), (0xFF55, 'M', u'u'), (0xFF56, 'M', u'v'), (0xFF57, 'M', u'w'), (0xFF58, 'M', u'x'), (0xFF59, 'M', u'y'), (0xFF5A, 'M', u'z'), (0xFF5B, '3', u'{'), (0xFF5C, '3', u'|'), (0xFF5D, '3', u'}'), (0xFF5E, '3', u'~'), (0xFF5F, 'M', u'⦅'), (0xFF60, 'M', u'⦆'), (0xFF61, 'M', u'.'), (0xFF62, 'M', u'「'), (0xFF63, 'M', u'」'), (0xFF64, 'M', u'、'), (0xFF65, 'M', u'・'), (0xFF66, 'M', u'ヲ'), (0xFF67, 'M', u'ァ'), (0xFF68, 'M', u'ィ'), (0xFF69, 'M', u'ゥ'), (0xFF6A, 'M', u'ェ'), (0xFF6B, 'M', u'ォ'), (0xFF6C, 'M', u'ャ'), (0xFF6D, 'M', u'ュ'), (0xFF6E, 'M', u'ョ'), (0xFF6F, 'M', u'ッ'), (0xFF70, 'M', u'ー'), (0xFF71, 'M', u'ア'), (0xFF72, 'M', u'イ'), (0xFF73, 'M', u'ウ'), (0xFF74, 'M', u'エ'), (0xFF75, 'M', u'オ'), (0xFF76, 'M', u'カ'), (0xFF77, 'M', u'キ'), (0xFF78, 'M', u'ク'), (0xFF79, 'M', u'ケ'), (0xFF7A, 'M', u'コ'), (0xFF7B, 'M', u'サ'), (0xFF7C, 'M', u'シ'), (0xFF7D, 'M', u'ス'), (0xFF7E, 'M', u'セ'), (0xFF7F, 'M', u'ソ'), (0xFF80, 'M', u'タ'), (0xFF81, 'M', u'チ'), (0xFF82, 'M', u'ツ'), (0xFF83, 'M', u'テ'), (0xFF84, 'M', u'ト'), (0xFF85, 'M', u'ナ'), (0xFF86, 'M', u'ニ'), (0xFF87, 'M', u'ヌ'), ] def _seg_52(): return [ (0xFF88, 'M', u'ネ'), (0xFF89, 'M', u'ノ'), (0xFF8A, 'M', u'ハ'), (0xFF8B, 'M', u'ヒ'), (0xFF8C, 'M', u'フ'), (0xFF8D, 'M', u'ヘ'), (0xFF8E, 'M', u'ホ'), (0xFF8F, 'M', u'マ'), (0xFF90, 'M', u'ミ'), (0xFF91, 'M', u'ム'), (0xFF92, 'M', u'メ'), (0xFF93, 'M', u'モ'), (0xFF94, 'M', u'ヤ'), (0xFF95, 'M', u'ユ'), (0xFF96, 'M', u'ヨ'), (0xFF97, 'M', u'ラ'), (0xFF98, 'M', u'リ'), (0xFF99, 'M', u'ル'), (0xFF9A, 'M', u'レ'), (0xFF9B, 'M', u'ロ'), (0xFF9C, 'M', u'ワ'), (0xFF9D, 'M', u'ン'), (0xFF9E, 'M', u'゙'), (0xFF9F, 'M', u'゚'), (0xFFA0, 'X'), (0xFFA1, 'M', u'ᄀ'), (0xFFA2, 'M', u'ᄁ'), (0xFFA3, 'M', u'ᆪ'), (0xFFA4, 'M', u'ᄂ'), (0xFFA5, 'M', u'ᆬ'), (0xFFA6, 'M', u'ᆭ'), (0xFFA7, 'M', u'ᄃ'), (0xFFA8, 'M', u'ᄄ'), (0xFFA9, 'M', u'ᄅ'), (0xFFAA, 'M', u'ᆰ'), (0xFFAB, 'M', u'ᆱ'), (0xFFAC, 'M', u'ᆲ'), (0xFFAD, 'M', u'ᆳ'), (0xFFAE, 'M', u'ᆴ'), (0xFFAF, 'M', u'ᆵ'), (0xFFB0, 'M', u'ᄚ'), (0xFFB1, 'M', u'ᄆ'), (0xFFB2, 'M', u'ᄇ'), (0xFFB3, 'M', u'ᄈ'), (0xFFB4, 'M', u'ᄡ'), (0xFFB5, 'M', u'ᄉ'), (0xFFB6, 'M', u'ᄊ'), (0xFFB7, 'M', u'ᄋ'), (0xFFB8, 'M', u'ᄌ'), (0xFFB9, 'M', u'ᄍ'), (0xFFBA, 'M', u'ᄎ'), (0xFFBB, 'M', u'ᄏ'), (0xFFBC, 'M', u'ᄐ'), (0xFFBD, 'M', u'ᄑ'), (0xFFBE, 'M', u'ᄒ'), (0xFFBF, 'X'), (0xFFC2, 'M', u'ᅡ'), (0xFFC3, 'M', u'ᅢ'), (0xFFC4, 'M', u'ᅣ'), (0xFFC5, 'M', u'ᅤ'), (0xFFC6, 'M', u'ᅥ'), (0xFFC7, 'M', u'ᅦ'), (0xFFC8, 'X'), (0xFFCA, 'M', u'ᅧ'), (0xFFCB, 'M', u'ᅨ'), (0xFFCC, 'M', u'ᅩ'), (0xFFCD, 'M', u'ᅪ'), (0xFFCE, 'M', u'ᅫ'), (0xFFCF, 'M', u'ᅬ'), (0xFFD0, 'X'), (0xFFD2, 'M', u'ᅭ'), (0xFFD3, 'M', u'ᅮ'), (0xFFD4, 'M', u'ᅯ'), (0xFFD5, 'M', u'ᅰ'), (0xFFD6, 'M', u'ᅱ'), (0xFFD7, 'M', u'ᅲ'), (0xFFD8, 'X'), (0xFFDA, 'M', u'ᅳ'), (0xFFDB, 'M', u'ᅴ'), (0xFFDC, 'M', u'ᅵ'), (0xFFDD, 'X'), (0xFFE0, 'M', u'¢'), (0xFFE1, 'M', u'£'), (0xFFE2, 'M', u'¬'), (0xFFE3, '3', u' ̄'), (0xFFE4, 'M', u'¦'), (0xFFE5, 'M', u'¥'), (0xFFE6, 'M', u'₩'), (0xFFE7, 'X'), (0xFFE8, 'M', u'│'), (0xFFE9, 'M', u'←'), (0xFFEA, 'M', u'↑'), (0xFFEB, 'M', u'→'), (0xFFEC, 'M', u'↓'), (0xFFED, 'M', u'■'), (0xFFEE, 'M', u'○'), (0xFFEF, 'X'), (0x10000, 'V'), (0x1000C, 'X'), (0x1000D, 'V'), ] def _seg_53(): return [ (0x10027, 'X'), (0x10028, 'V'), (0x1003B, 'X'), (0x1003C, 'V'), (0x1003E, 'X'), (0x1003F, 'V'), (0x1004E, 'X'), (0x10050, 'V'), (0x1005E, 'X'), (0x10080, 'V'), (0x100FB, 'X'), (0x10100, 'V'), (0x10103, 'X'), (0x10107, 'V'), (0x10134, 'X'), (0x10137, 'V'), (0x1018F, 'X'), (0x10190, 'V'), (0x1019D, 'X'), (0x101A0, 'V'), (0x101A1, 'X'), (0x101D0, 'V'), (0x101FE, 'X'), (0x10280, 'V'), (0x1029D, 'X'), (0x102A0, 'V'), (0x102D1, 'X'), (0x102E0, 'V'), (0x102FC, 'X'), (0x10300, 'V'), (0x10324, 'X'), (0x1032D, 'V'), (0x1034B, 'X'), (0x10350, 'V'), (0x1037B, 'X'), (0x10380, 'V'), (0x1039E, 'X'), (0x1039F, 'V'), (0x103C4, 'X'), (0x103C8, 'V'), (0x103D6, 'X'), (0x10400, 'M', u'𐐨'), (0x10401, 'M', u'𐐩'), (0x10402, 'M', u'𐐪'), (0x10403, 'M', u'𐐫'), (0x10404, 'M', u'𐐬'), (0x10405, 'M', u'𐐭'), (0x10406, 'M', u'𐐮'), (0x10407, 'M', u'𐐯'), (0x10408, 'M', u'𐐰'), (0x10409, 'M', u'𐐱'), (0x1040A, 'M', u'𐐲'), (0x1040B, 'M', u'𐐳'), (0x1040C, 'M', u'𐐴'), (0x1040D, 'M', u'𐐵'), (0x1040E, 'M', u'𐐶'), (0x1040F, 'M', u'𐐷'), (0x10410, 'M', u'𐐸'), (0x10411, 'M', u'𐐹'), (0x10412, 'M', u'𐐺'), (0x10413, 'M', u'𐐻'), (0x10414, 'M', u'𐐼'), (0x10415, 'M', u'𐐽'), (0x10416, 'M', u'𐐾'), (0x10417, 'M', u'𐐿'), (0x10418, 'M', u'𐑀'), (0x10419, 'M', u'𐑁'), (0x1041A, 'M', u'𐑂'), (0x1041B, 'M', u'𐑃'), (0x1041C, 'M', u'𐑄'), (0x1041D, 'M', u'𐑅'), (0x1041E, 'M', u'𐑆'), (0x1041F, 'M', u'𐑇'), (0x10420, 'M', u'𐑈'), (0x10421, 'M', u'𐑉'), (0x10422, 'M', u'𐑊'), (0x10423, 'M', u'𐑋'), (0x10424, 'M', u'𐑌'), (0x10425, 'M', u'𐑍'), (0x10426, 'M', u'𐑎'), (0x10427, 'M', u'𐑏'), (0x10428, 'V'), (0x1049E, 'X'), (0x104A0, 'V'), (0x104AA, 'X'), (0x104B0, 'M', u'𐓘'), (0x104B1, 'M', u'𐓙'), (0x104B2, 'M', u'𐓚'), (0x104B3, 'M', u'𐓛'), (0x104B4, 'M', u'𐓜'), (0x104B5, 'M', u'𐓝'), (0x104B6, 'M', u'𐓞'), (0x104B7, 'M', u'𐓟'), (0x104B8, 'M', u'𐓠'), (0x104B9, 'M', u'𐓡'), (0x104BA, 'M', u'𐓢'), (0x104BB, 'M', u'𐓣'), (0x104BC, 'M', u'𐓤'), (0x104BD, 'M', u'𐓥'), (0x104BE, 'M', u'𐓦'), ] def _seg_54(): return [ (0x104BF, 'M', u'𐓧'), (0x104C0, 'M', u'𐓨'), (0x104C1, 'M', u'𐓩'), (0x104C2, 'M', u'𐓪'), (0x104C3, 'M', u'𐓫'), (0x104C4, 'M', u'𐓬'), (0x104C5, 'M', u'𐓭'), (0x104C6, 'M', u'𐓮'), (0x104C7, 'M', u'𐓯'), (0x104C8, 'M', u'𐓰'), (0x104C9, 'M', u'𐓱'), (0x104CA, 'M', u'𐓲'), (0x104CB, 'M', u'𐓳'), (0x104CC, 'M', u'𐓴'), (0x104CD, 'M', u'𐓵'), (0x104CE, 'M', u'𐓶'), (0x104CF, 'M', u'𐓷'), (0x104D0, 'M', u'𐓸'), (0x104D1, 'M', u'𐓹'), (0x104D2, 'M', u'𐓺'), (0x104D3, 'M', u'𐓻'), (0x104D4, 'X'), (0x104D8, 'V'), (0x104FC, 'X'), (0x10500, 'V'), (0x10528, 'X'), (0x10530, 'V'), (0x10564, 'X'), (0x1056F, 'V'), (0x10570, 'X'), (0x10600, 'V'), (0x10737, 'X'), (0x10740, 'V'), (0x10756, 'X'), (0x10760, 'V'), (0x10768, 'X'), (0x10800, 'V'), (0x10806, 'X'), (0x10808, 'V'), (0x10809, 'X'), (0x1080A, 'V'), (0x10836, 'X'), (0x10837, 'V'), (0x10839, 'X'), (0x1083C, 'V'), (0x1083D, 'X'), (0x1083F, 'V'), (0x10856, 'X'), (0x10857, 'V'), (0x1089F, 'X'), (0x108A7, 'V'), (0x108B0, 'X'), (0x108E0, 'V'), (0x108F3, 'X'), (0x108F4, 'V'), (0x108F6, 'X'), (0x108FB, 'V'), (0x1091C, 'X'), (0x1091F, 'V'), (0x1093A, 'X'), (0x1093F, 'V'), (0x10940, 'X'), (0x10980, 'V'), (0x109B8, 'X'), (0x109BC, 'V'), (0x109D0, 'X'), (0x109D2, 'V'), (0x10A04, 'X'), (0x10A05, 'V'), (0x10A07, 'X'), (0x10A0C, 'V'), (0x10A14, 'X'), (0x10A15, 'V'), (0x10A18, 'X'), (0x10A19, 'V'), (0x10A36, 'X'), (0x10A38, 'V'), (0x10A3B, 'X'), (0x10A3F, 'V'), (0x10A49, 'X'), (0x10A50, 'V'), (0x10A59, 'X'), (0x10A60, 'V'), (0x10AA0, 'X'), (0x10AC0, 'V'), (0x10AE7, 'X'), (0x10AEB, 'V'), (0x10AF7, 'X'), (0x10B00, 'V'), (0x10B36, 'X'), (0x10B39, 'V'), (0x10B56, 'X'), (0x10B58, 'V'), (0x10B73, 'X'), (0x10B78, 'V'), (0x10B92, 'X'), (0x10B99, 'V'), (0x10B9D, 'X'), (0x10BA9, 'V'), (0x10BB0, 'X'), ] def _seg_55(): return [ (0x10C00, 'V'), (0x10C49, 'X'), (0x10C80, 'M', u'𐳀'), (0x10C81, 'M', u'𐳁'), (0x10C82, 'M', u'𐳂'), (0x10C83, 'M', u'𐳃'), (0x10C84, 'M', u'𐳄'), (0x10C85, 'M', u'𐳅'), (0x10C86, 'M', u'𐳆'), (0x10C87, 'M', u'𐳇'), (0x10C88, 'M', u'𐳈'), (0x10C89, 'M', u'𐳉'), (0x10C8A, 'M', u'𐳊'), (0x10C8B, 'M', u'𐳋'), (0x10C8C, 'M', u'𐳌'), (0x10C8D, 'M', u'𐳍'), (0x10C8E, 'M', u'𐳎'), (0x10C8F, 'M', u'𐳏'), (0x10C90, 'M', u'𐳐'), (0x10C91, 'M', u'𐳑'), (0x10C92, 'M', u'𐳒'), (0x10C93, 'M', u'𐳓'), (0x10C94, 'M', u'𐳔'), (0x10C95, 'M', u'𐳕'), (0x10C96, 'M', u'𐳖'), (0x10C97, 'M', u'𐳗'), (0x10C98, 'M', u'𐳘'), (0x10C99, 'M', u'𐳙'), (0x10C9A, 'M', u'𐳚'), (0x10C9B, 'M', u'𐳛'), (0x10C9C, 'M', u'𐳜'), (0x10C9D, 'M', u'𐳝'), (0x10C9E, 'M', u'𐳞'), (0x10C9F, 'M', u'𐳟'), (0x10CA0, 'M', u'𐳠'), (0x10CA1, 'M', u'𐳡'), (0x10CA2, 'M', u'𐳢'), (0x10CA3, 'M', u'𐳣'), (0x10CA4, 'M', u'𐳤'), (0x10CA5, 'M', u'𐳥'), (0x10CA6, 'M', u'𐳦'), (0x10CA7, 'M', u'𐳧'), (0x10CA8, 'M', u'𐳨'), (0x10CA9, 'M', u'𐳩'), (0x10CAA, 'M', u'𐳪'), (0x10CAB, 'M', u'𐳫'), (0x10CAC, 'M', u'𐳬'), (0x10CAD, 'M', u'𐳭'), (0x10CAE, 'M', u'𐳮'), (0x10CAF, 'M', u'𐳯'), (0x10CB0, 'M', u'𐳰'), (0x10CB1, 'M', u'𐳱'), (0x10CB2, 'M', u'𐳲'), (0x10CB3, 'X'), (0x10CC0, 'V'), (0x10CF3, 'X'), (0x10CFA, 'V'), (0x10D28, 'X'), (0x10D30, 'V'), (0x10D3A, 'X'), (0x10E60, 'V'), (0x10E7F, 'X'), (0x10E80, 'V'), (0x10EAA, 'X'), (0x10EAB, 'V'), (0x10EAE, 'X'), (0x10EB0, 'V'), (0x10EB2, 'X'), (0x10F00, 'V'), (0x10F28, 'X'), (0x10F30, 'V'), (0x10F5A, 'X'), (0x10FB0, 'V'), (0x10FCC, 'X'), (0x10FE0, 'V'), (0x10FF7, 'X'), (0x11000, 'V'), (0x1104E, 'X'), (0x11052, 'V'), (0x11070, 'X'), (0x1107F, 'V'), (0x110BD, 'X'), (0x110BE, 'V'), (0x110C2, 'X'), (0x110D0, 'V'), (0x110E9, 'X'), (0x110F0, 'V'), (0x110FA, 'X'), (0x11100, 'V'), (0x11135, 'X'), (0x11136, 'V'), (0x11148, 'X'), (0x11150, 'V'), (0x11177, 'X'), (0x11180, 'V'), (0x111E0, 'X'), (0x111E1, 'V'), (0x111F5, 'X'), (0x11200, 'V'), (0x11212, 'X'), ] def _seg_56(): return [ (0x11213, 'V'), (0x1123F, 'X'), (0x11280, 'V'), (0x11287, 'X'), (0x11288, 'V'), (0x11289, 'X'), (0x1128A, 'V'), (0x1128E, 'X'), (0x1128F, 'V'), (0x1129E, 'X'), (0x1129F, 'V'), (0x112AA, 'X'), (0x112B0, 'V'), (0x112EB, 'X'), (0x112F0, 'V'), (0x112FA, 'X'), (0x11300, 'V'), (0x11304, 'X'), (0x11305, 'V'), (0x1130D, 'X'), (0x1130F, 'V'), (0x11311, 'X'), (0x11313, 'V'), (0x11329, 'X'), (0x1132A, 'V'), (0x11331, 'X'), (0x11332, 'V'), (0x11334, 'X'), (0x11335, 'V'), (0x1133A, 'X'), (0x1133B, 'V'), (0x11345, 'X'), (0x11347, 'V'), (0x11349, 'X'), (0x1134B, 'V'), (0x1134E, 'X'), (0x11350, 'V'), (0x11351, 'X'), (0x11357, 'V'), (0x11358, 'X'), (0x1135D, 'V'), (0x11364, 'X'), (0x11366, 'V'), (0x1136D, 'X'), (0x11370, 'V'), (0x11375, 'X'), (0x11400, 'V'), (0x1145C, 'X'), (0x1145D, 'V'), (0x11462, 'X'), (0x11480, 'V'), (0x114C8, 'X'), (0x114D0, 'V'), (0x114DA, 'X'), (0x11580, 'V'), (0x115B6, 'X'), (0x115B8, 'V'), (0x115DE, 'X'), (0x11600, 'V'), (0x11645, 'X'), (0x11650, 'V'), (0x1165A, 'X'), (0x11660, 'V'), (0x1166D, 'X'), (0x11680, 'V'), (0x116B9, 'X'), (0x116C0, 'V'), (0x116CA, 'X'), (0x11700, 'V'), (0x1171B, 'X'), (0x1171D, 'V'), (0x1172C, 'X'), (0x11730, 'V'), (0x11740, 'X'), (0x11800, 'V'), (0x1183C, 'X'), (0x118A0, 'M', u'𑣀'), (0x118A1, 'M', u'𑣁'), (0x118A2, 'M', u'𑣂'), (0x118A3, 'M', u'𑣃'), (0x118A4, 'M', u'𑣄'), (0x118A5, 'M', u'𑣅'), (0x118A6, 'M', u'𑣆'), (0x118A7, 'M', u'𑣇'), (0x118A8, 'M', u'𑣈'), (0x118A9, 'M', u'𑣉'), (0x118AA, 'M', u'𑣊'), (0x118AB, 'M', u'𑣋'), (0x118AC, 'M', u'𑣌'), (0x118AD, 'M', u'𑣍'), (0x118AE, 'M', u'𑣎'), (0x118AF, 'M', u'𑣏'), (0x118B0, 'M', u'𑣐'), (0x118B1, 'M', u'𑣑'), (0x118B2, 'M', u'𑣒'), (0x118B3, 'M', u'𑣓'), (0x118B4, 'M', u'𑣔'), (0x118B5, 'M', u'𑣕'), (0x118B6, 'M', u'𑣖'), (0x118B7, 'M', u'𑣗'), ] def _seg_57(): return [ (0x118B8, 'M', u'𑣘'), (0x118B9, 'M', u'𑣙'), (0x118BA, 'M', u'𑣚'), (0x118BB, 'M', u'𑣛'), (0x118BC, 'M', u'𑣜'), (0x118BD, 'M', u'𑣝'), (0x118BE, 'M', u'𑣞'), (0x118BF, 'M', u'𑣟'), (0x118C0, 'V'), (0x118F3, 'X'), (0x118FF, 'V'), (0x11907, 'X'), (0x11909, 'V'), (0x1190A, 'X'), (0x1190C, 'V'), (0x11914, 'X'), (0x11915, 'V'), (0x11917, 'X'), (0x11918, 'V'), (0x11936, 'X'), (0x11937, 'V'), (0x11939, 'X'), (0x1193B, 'V'), (0x11947, 'X'), (0x11950, 'V'), (0x1195A, 'X'), (0x119A0, 'V'), (0x119A8, 'X'), (0x119AA, 'V'), (0x119D8, 'X'), (0x119DA, 'V'), (0x119E5, 'X'), (0x11A00, 'V'), (0x11A48, 'X'), (0x11A50, 'V'), (0x11AA3, 'X'), (0x11AC0, 'V'), (0x11AF9, 'X'), (0x11C00, 'V'), (0x11C09, 'X'), (0x11C0A, 'V'), (0x11C37, 'X'), (0x11C38, 'V'), (0x11C46, 'X'), (0x11C50, 'V'), (0x11C6D, 'X'), (0x11C70, 'V'), (0x11C90, 'X'), (0x11C92, 'V'), (0x11CA8, 'X'), (0x11CA9, 'V'), (0x11CB7, 'X'), (0x11D00, 'V'), (0x11D07, 'X'), (0x11D08, 'V'), (0x11D0A, 'X'), (0x11D0B, 'V'), (0x11D37, 'X'), (0x11D3A, 'V'), (0x11D3B, 'X'), (0x11D3C, 'V'), (0x11D3E, 'X'), (0x11D3F, 'V'), (0x11D48, 'X'), (0x11D50, 'V'), (0x11D5A, 'X'), (0x11D60, 'V'), (0x11D66, 'X'), (0x11D67, 'V'), (0x11D69, 'X'), (0x11D6A, 'V'), (0x11D8F, 'X'), (0x11D90, 'V'), (0x11D92, 'X'), (0x11D93, 'V'), (0x11D99, 'X'), (0x11DA0, 'V'), (0x11DAA, 'X'), (0x11EE0, 'V'), (0x11EF9, 'X'), (0x11FB0, 'V'), (0x11FB1, 'X'), (0x11FC0, 'V'), (0x11FF2, 'X'), (0x11FFF, 'V'), (0x1239A, 'X'), (0x12400, 'V'), (0x1246F, 'X'), (0x12470, 'V'), (0x12475, 'X'), (0x12480, 'V'), (0x12544, 'X'), (0x13000, 'V'), (0x1342F, 'X'), (0x14400, 'V'), (0x14647, 'X'), (0x16800, 'V'), (0x16A39, 'X'), (0x16A40, 'V'), (0x16A5F, 'X'), ] def _seg_58(): return [ (0x16A60, 'V'), (0x16A6A, 'X'), (0x16A6E, 'V'), (0x16A70, 'X'), (0x16AD0, 'V'), (0x16AEE, 'X'), (0x16AF0, 'V'), (0x16AF6, 'X'), (0x16B00, 'V'), (0x16B46, 'X'), (0x16B50, 'V'), (0x16B5A, 'X'), (0x16B5B, 'V'), (0x16B62, 'X'), (0x16B63, 'V'), (0x16B78, 'X'), (0x16B7D, 'V'), (0x16B90, 'X'), (0x16E40, 'M', u'𖹠'), (0x16E41, 'M', u'𖹡'), (0x16E42, 'M', u'𖹢'), (0x16E43, 'M', u'𖹣'), (0x16E44, 'M', u'𖹤'), (0x16E45, 'M', u'𖹥'), (0x16E46, 'M', u'𖹦'), (0x16E47, 'M', u'𖹧'), (0x16E48, 'M', u'𖹨'), (0x16E49, 'M', u'𖹩'), (0x16E4A, 'M', u'𖹪'), (0x16E4B, 'M', u'𖹫'), (0x16E4C, 'M', u'𖹬'), (0x16E4D, 'M', u'𖹭'), (0x16E4E, 'M', u'𖹮'), (0x16E4F, 'M', u'𖹯'), (0x16E50, 'M', u'𖹰'), (0x16E51, 'M', u'𖹱'), (0x16E52, 'M', u'𖹲'), (0x16E53, 'M', u'𖹳'), (0x16E54, 'M', u'𖹴'), (0x16E55, 'M', u'𖹵'), (0x16E56, 'M', u'𖹶'), (0x16E57, 'M', u'𖹷'), (0x16E58, 'M', u'𖹸'), (0x16E59, 'M', u'𖹹'), (0x16E5A, 'M', u'𖹺'), (0x16E5B, 'M', u'𖹻'), (0x16E5C, 'M', u'𖹼'), (0x16E5D, 'M', u'𖹽'), (0x16E5E, 'M', u'𖹾'), (0x16E5F, 'M', u'𖹿'), (0x16E60, 'V'), (0x16E9B, 'X'), (0x16F00, 'V'), (0x16F4B, 'X'), (0x16F4F, 'V'), (0x16F88, 'X'), (0x16F8F, 'V'), (0x16FA0, 'X'), (0x16FE0, 'V'), (0x16FE5, 'X'), (0x16FF0, 'V'), (0x16FF2, 'X'), (0x17000, 'V'), (0x187F8, 'X'), (0x18800, 'V'), (0x18CD6, 'X'), (0x18D00, 'V'), (0x18D09, 'X'), (0x1B000, 'V'), (0x1B11F, 'X'), (0x1B150, 'V'), (0x1B153, 'X'), (0x1B164, 'V'), (0x1B168, 'X'), (0x1B170, 'V'), (0x1B2FC, 'X'), (0x1BC00, 'V'), (0x1BC6B, 'X'), (0x1BC70, 'V'), (0x1BC7D, 'X'), (0x1BC80, 'V'), (0x1BC89, 'X'), (0x1BC90, 'V'), (0x1BC9A, 'X'), (0x1BC9C, 'V'), (0x1BCA0, 'I'), (0x1BCA4, 'X'), (0x1D000, 'V'), (0x1D0F6, 'X'), (0x1D100, 'V'), (0x1D127, 'X'), (0x1D129, 'V'), (0x1D15E, 'M', u'𝅗𝅥'), (0x1D15F, 'M', u'𝅘𝅥'), (0x1D160, 'M', u'𝅘𝅥𝅮'), (0x1D161, 'M', u'𝅘𝅥𝅯'), (0x1D162, 'M', u'𝅘𝅥𝅰'), (0x1D163, 'M', u'𝅘𝅥𝅱'), (0x1D164, 'M', u'𝅘𝅥𝅲'), (0x1D165, 'V'), ] def _seg_59(): return [ (0x1D173, 'X'), (0x1D17B, 'V'), (0x1D1BB, 'M', u'𝆹𝅥'), (0x1D1BC, 'M', u'𝆺𝅥'), (0x1D1BD, 'M', u'𝆹𝅥𝅮'), (0x1D1BE, 'M', u'𝆺𝅥𝅮'), (0x1D1BF, 'M', u'𝆹𝅥𝅯'), (0x1D1C0, 'M', u'𝆺𝅥𝅯'), (0x1D1C1, 'V'), (0x1D1E9, 'X'), (0x1D200, 'V'), (0x1D246, 'X'), (0x1D2E0, 'V'), (0x1D2F4, 'X'), (0x1D300, 'V'), (0x1D357, 'X'), (0x1D360, 'V'), (0x1D379, 'X'), (0x1D400, 'M', u'a'), (0x1D401, 'M', u'b'), (0x1D402, 'M', u'c'), (0x1D403, 'M', u'd'), (0x1D404, 'M', u'e'), (0x1D405, 'M', u'f'), (0x1D406, 'M', u'g'), (0x1D407, 'M', u'h'), (0x1D408, 'M', u'i'), (0x1D409, 'M', u'j'), (0x1D40A, 'M', u'k'), (0x1D40B, 'M', u'l'), (0x1D40C, 'M', u'm'), (0x1D40D, 'M', u'n'), (0x1D40E, 'M', u'o'), (0x1D40F, 'M', u'p'), (0x1D410, 'M', u'q'), (0x1D411, 'M', u'r'), (0x1D412, 'M', u's'), (0x1D413, 'M', u't'), (0x1D414, 'M', u'u'), (0x1D415, 'M', u'v'), (0x1D416, 'M', u'w'), (0x1D417, 'M', u'x'), (0x1D418, 'M', u'y'), (0x1D419, 'M', u'z'), (0x1D41A, 'M', u'a'), (0x1D41B, 'M', u'b'), (0x1D41C, 'M', u'c'), (0x1D41D, 'M', u'd'), (0x1D41E, 'M', u'e'), (0x1D41F, 'M', u'f'), (0x1D420, 'M', u'g'), (0x1D421, 'M', u'h'), (0x1D422, 'M', u'i'), (0x1D423, 'M', u'j'), (0x1D424, 'M', u'k'), (0x1D425, 'M', u'l'), (0x1D426, 'M', u'm'), (0x1D427, 'M', u'n'), (0x1D428, 'M', u'o'), (0x1D429, 'M', u'p'), (0x1D42A, 'M', u'q'), (0x1D42B, 'M', u'r'), (0x1D42C, 'M', u's'), (0x1D42D, 'M', u't'), (0x1D42E, 'M', u'u'), (0x1D42F, 'M', u'v'), (0x1D430, 'M', u'w'), (0x1D431, 'M', u'x'), (0x1D432, 'M', u'y'), (0x1D433, 'M', u'z'), (0x1D434, 'M', u'a'), (0x1D435, 'M', u'b'), (0x1D436, 'M', u'c'), (0x1D437, 'M', u'd'), (0x1D438, 'M', u'e'), (0x1D439, 'M', u'f'), (0x1D43A, 'M', u'g'), (0x1D43B, 'M', u'h'), (0x1D43C, 'M', u'i'), (0x1D43D, 'M', u'j'), (0x1D43E, 'M', u'k'), (0x1D43F, 'M', u'l'), (0x1D440, 'M', u'm'), (0x1D441, 'M', u'n'), (0x1D442, 'M', u'o'), (0x1D443, 'M', u'p'), (0x1D444, 'M', u'q'), (0x1D445, 'M', u'r'), (0x1D446, 'M', u's'), (0x1D447, 'M', u't'), (0x1D448, 'M', u'u'), (0x1D449, 'M', u'v'), (0x1D44A, 'M', u'w'), (0x1D44B, 'M', u'x'), (0x1D44C, 'M', u'y'), (0x1D44D, 'M', u'z'), (0x1D44E, 'M', u'a'), (0x1D44F, 'M', u'b'), (0x1D450, 'M', u'c'), (0x1D451, 'M', u'd'), ] def _seg_60(): return [ (0x1D452, 'M', u'e'), (0x1D453, 'M', u'f'), (0x1D454, 'M', u'g'), (0x1D455, 'X'), (0x1D456, 'M', u'i'), (0x1D457, 'M', u'j'), (0x1D458, 'M', u'k'), (0x1D459, 'M', u'l'), (0x1D45A, 'M', u'm'), (0x1D45B, 'M', u'n'), (0x1D45C, 'M', u'o'), (0x1D45D, 'M', u'p'), (0x1D45E, 'M', u'q'), (0x1D45F, 'M', u'r'), (0x1D460, 'M', u's'), (0x1D461, 'M', u't'), (0x1D462, 'M', u'u'), (0x1D463, 'M', u'v'), (0x1D464, 'M', u'w'), (0x1D465, 'M', u'x'), (0x1D466, 'M', u'y'), (0x1D467, 'M', u'z'), (0x1D468, 'M', u'a'), (0x1D469, 'M', u'b'), (0x1D46A, 'M', u'c'), (0x1D46B, 'M', u'd'), (0x1D46C, 'M', u'e'), (0x1D46D, 'M', u'f'), (0x1D46E, 'M', u'g'), (0x1D46F, 'M', u'h'), (0x1D470, 'M', u'i'), (0x1D471, 'M', u'j'), (0x1D472, 'M', u'k'), (0x1D473, 'M', u'l'), (0x1D474, 'M', u'm'), (0x1D475, 'M', u'n'), (0x1D476, 'M', u'o'), (0x1D477, 'M', u'p'), (0x1D478, 'M', u'q'), (0x1D479, 'M', u'r'), (0x1D47A, 'M', u's'), (0x1D47B, 'M', u't'), (0x1D47C, 'M', u'u'), (0x1D47D, 'M', u'v'), (0x1D47E, 'M', u'w'), (0x1D47F, 'M', u'x'), (0x1D480, 'M', u'y'), (0x1D481, 'M', u'z'), (0x1D482, 'M', u'a'), (0x1D483, 'M', u'b'), (0x1D484, 'M', u'c'), (0x1D485, 'M', u'd'), (0x1D486, 'M', u'e'), (0x1D487, 'M', u'f'), (0x1D488, 'M', u'g'), (0x1D489, 'M', u'h'), (0x1D48A, 'M', u'i'), (0x1D48B, 'M', u'j'), (0x1D48C, 'M', u'k'), (0x1D48D, 'M', u'l'), (0x1D48E, 'M', u'm'), (0x1D48F, 'M', u'n'), (0x1D490, 'M', u'o'), (0x1D491, 'M', u'p'), (0x1D492, 'M', u'q'), (0x1D493, 'M', u'r'), (0x1D494, 'M', u's'), (0x1D495, 'M', u't'), (0x1D496, 'M', u'u'), (0x1D497, 'M', u'v'), (0x1D498, 'M', u'w'), (0x1D499, 'M', u'x'), (0x1D49A, 'M', u'y'), (0x1D49B, 'M', u'z'), (0x1D49C, 'M', u'a'), (0x1D49D, 'X'), (0x1D49E, 'M', u'c'), (0x1D49F, 'M', u'd'), (0x1D4A0, 'X'), (0x1D4A2, 'M', u'g'), (0x1D4A3, 'X'), (0x1D4A5, 'M', u'j'), (0x1D4A6, 'M', u'k'), (0x1D4A7, 'X'), (0x1D4A9, 'M', u'n'), (0x1D4AA, 'M', u'o'), (0x1D4AB, 'M', u'p'), (0x1D4AC, 'M', u'q'), (0x1D4AD, 'X'), (0x1D4AE, 'M', u's'), (0x1D4AF, 'M', u't'), (0x1D4B0, 'M', u'u'), (0x1D4B1, 'M', u'v'), (0x1D4B2, 'M', u'w'), (0x1D4B3, 'M', u'x'), (0x1D4B4, 'M', u'y'), (0x1D4B5, 'M', u'z'), (0x1D4B6, 'M', u'a'), (0x1D4B7, 'M', u'b'), (0x1D4B8, 'M', u'c'), ] def _seg_61(): return [ (0x1D4B9, 'M', u'd'), (0x1D4BA, 'X'), (0x1D4BB, 'M', u'f'), (0x1D4BC, 'X'), (0x1D4BD, 'M', u'h'), (0x1D4BE, 'M', u'i'), (0x1D4BF, 'M', u'j'), (0x1D4C0, 'M', u'k'), (0x1D4C1, 'M', u'l'), (0x1D4C2, 'M', u'm'), (0x1D4C3, 'M', u'n'), (0x1D4C4, 'X'), (0x1D4C5, 'M', u'p'), (0x1D4C6, 'M', u'q'), (0x1D4C7, 'M', u'r'), (0x1D4C8, 'M', u's'), (0x1D4C9, 'M', u't'), (0x1D4CA, 'M', u'u'), (0x1D4CB, 'M', u'v'), (0x1D4CC, 'M', u'w'), (0x1D4CD, 'M', u'x'), (0x1D4CE, 'M', u'y'), (0x1D4CF, 'M', u'z'), (0x1D4D0, 'M', u'a'), (0x1D4D1, 'M', u'b'), (0x1D4D2, 'M', u'c'), (0x1D4D3, 'M', u'd'), (0x1D4D4, 'M', u'e'), (0x1D4D5, 'M', u'f'), (0x1D4D6, 'M', u'g'), (0x1D4D7, 'M', u'h'), (0x1D4D8, 'M', u'i'), (0x1D4D9, 'M', u'j'), (0x1D4DA, 'M', u'k'), (0x1D4DB, 'M', u'l'), (0x1D4DC, 'M', u'm'), (0x1D4DD, 'M', u'n'), (0x1D4DE, 'M', u'o'), (0x1D4DF, 'M', u'p'), (0x1D4E0, 'M', u'q'), (0x1D4E1, 'M', u'r'), (0x1D4E2, 'M', u's'), (0x1D4E3, 'M', u't'), (0x1D4E4, 'M', u'u'), (0x1D4E5, 'M', u'v'), (0x1D4E6, 'M', u'w'), (0x1D4E7, 'M', u'x'), (0x1D4E8, 'M', u'y'), (0x1D4E9, 'M', u'z'), (0x1D4EA, 'M', u'a'), (0x1D4EB, 'M', u'b'), (0x1D4EC, 'M', u'c'), (0x1D4ED, 'M', u'd'), (0x1D4EE, 'M', u'e'), (0x1D4EF, 'M', u'f'), (0x1D4F0, 'M', u'g'), (0x1D4F1, 'M', u'h'), (0x1D4F2, 'M', u'i'), (0x1D4F3, 'M', u'j'), (0x1D4F4, 'M', u'k'), (0x1D4F5, 'M', u'l'), (0x1D4F6, 'M', u'm'), (0x1D4F7, 'M', u'n'), (0x1D4F8, 'M', u'o'), (0x1D4F9, 'M', u'p'), (0x1D4FA, 'M', u'q'), (0x1D4FB, 'M', u'r'), (0x1D4FC, 'M', u's'), (0x1D4FD, 'M', u't'), (0x1D4FE, 'M', u'u'), (0x1D4FF, 'M', u'v'), (0x1D500, 'M', u'w'), (0x1D501, 'M', u'x'), (0x1D502, 'M', u'y'), (0x1D503, 'M', u'z'), (0x1D504, 'M', u'a'), (0x1D505, 'M', u'b'), (0x1D506, 'X'), (0x1D507, 'M', u'd'), (0x1D508, 'M', u'e'), (0x1D509, 'M', u'f'), (0x1D50A, 'M', u'g'), (0x1D50B, 'X'), (0x1D50D, 'M', u'j'), (0x1D50E, 'M', u'k'), (0x1D50F, 'M', u'l'), (0x1D510, 'M', u'm'), (0x1D511, 'M', u'n'), (0x1D512, 'M', u'o'), (0x1D513, 'M', u'p'), (0x1D514, 'M', u'q'), (0x1D515, 'X'), (0x1D516, 'M', u's'), (0x1D517, 'M', u't'), (0x1D518, 'M', u'u'), (0x1D519, 'M', u'v'), (0x1D51A, 'M', u'w'), (0x1D51B, 'M', u'x'), (0x1D51C, 'M', u'y'), (0x1D51D, 'X'), ] def _seg_62(): return [ (0x1D51E, 'M', u'a'), (0x1D51F, 'M', u'b'), (0x1D520, 'M', u'c'), (0x1D521, 'M', u'd'), (0x1D522, 'M', u'e'), (0x1D523, 'M', u'f'), (0x1D524, 'M', u'g'), (0x1D525, 'M', u'h'), (0x1D526, 'M', u'i'), (0x1D527, 'M', u'j'), (0x1D528, 'M', u'k'), (0x1D529, 'M', u'l'), (0x1D52A, 'M', u'm'), (0x1D52B, 'M', u'n'), (0x1D52C, 'M', u'o'), (0x1D52D, 'M', u'p'), (0x1D52E, 'M', u'q'), (0x1D52F, 'M', u'r'), (0x1D530, 'M', u's'), (0x1D531, 'M', u't'), (0x1D532, 'M', u'u'), (0x1D533, 'M', u'v'), (0x1D534, 'M', u'w'), (0x1D535, 'M', u'x'), (0x1D536, 'M', u'y'), (0x1D537, 'M', u'z'), (0x1D538, 'M', u'a'), (0x1D539, 'M', u'b'), (0x1D53A, 'X'), (0x1D53B, 'M', u'd'), (0x1D53C, 'M', u'e'), (0x1D53D, 'M', u'f'), (0x1D53E, 'M', u'g'), (0x1D53F, 'X'), (0x1D540, 'M', u'i'), (0x1D541, 'M', u'j'), (0x1D542, 'M', u'k'), (0x1D543, 'M', u'l'), (0x1D544, 'M', u'm'), (0x1D545, 'X'), (0x1D546, 'M', u'o'), (0x1D547, 'X'), (0x1D54A, 'M', u's'), (0x1D54B, 'M', u't'), (0x1D54C, 'M', u'u'), (0x1D54D, 'M', u'v'), (0x1D54E, 'M', u'w'), (0x1D54F, 'M', u'x'), (0x1D550, 'M', u'y'), (0x1D551, 'X'), (0x1D552, 'M', u'a'), (0x1D553, 'M', u'b'), (0x1D554, 'M', u'c'), (0x1D555, 'M', u'd'), (0x1D556, 'M', u'e'), (0x1D557, 'M', u'f'), (0x1D558, 'M', u'g'), (0x1D559, 'M', u'h'), (0x1D55A, 'M', u'i'), (0x1D55B, 'M', u'j'), (0x1D55C, 'M', u'k'), (0x1D55D, 'M', u'l'), (0x1D55E, 'M', u'm'), (0x1D55F, 'M', u'n'), (0x1D560, 'M', u'o'), (0x1D561, 'M', u'p'), (0x1D562, 'M', u'q'), (0x1D563, 'M', u'r'), (0x1D564, 'M', u's'), (0x1D565, 'M', u't'), (0x1D566, 'M', u'u'), (0x1D567, 'M', u'v'), (0x1D568, 'M', u'w'), (0x1D569, 'M', u'x'), (0x1D56A, 'M', u'y'), (0x1D56B, 'M', u'z'), (0x1D56C, 'M', u'a'), (0x1D56D, 'M', u'b'), (0x1D56E, 'M', u'c'), (0x1D56F, 'M', u'd'), (0x1D570, 'M', u'e'), (0x1D571, 'M', u'f'), (0x1D572, 'M', u'g'), (0x1D573, 'M', u'h'), (0x1D574, 'M', u'i'), (0x1D575, 'M', u'j'), (0x1D576, 'M', u'k'), (0x1D577, 'M', u'l'), (0x1D578, 'M', u'm'), (0x1D579, 'M', u'n'), (0x1D57A, 'M', u'o'), (0x1D57B, 'M', u'p'), (0x1D57C, 'M', u'q'), (0x1D57D, 'M', u'r'), (0x1D57E, 'M', u's'), (0x1D57F, 'M', u't'), (0x1D580, 'M', u'u'), (0x1D581, 'M', u'v'), (0x1D582, 'M', u'w'), (0x1D583, 'M', u'x'), ] def _seg_63(): return [ (0x1D584, 'M', u'y'), (0x1D585, 'M', u'z'), (0x1D586, 'M', u'a'), (0x1D587, 'M', u'b'), (0x1D588, 'M', u'c'), (0x1D589, 'M', u'd'), (0x1D58A, 'M', u'e'), (0x1D58B, 'M', u'f'), (0x1D58C, 'M', u'g'), (0x1D58D, 'M', u'h'), (0x1D58E, 'M', u'i'), (0x1D58F, 'M', u'j'), (0x1D590, 'M', u'k'), (0x1D591, 'M', u'l'), (0x1D592, 'M', u'm'), (0x1D593, 'M', u'n'), (0x1D594, 'M', u'o'), (0x1D595, 'M', u'p'), (0x1D596, 'M', u'q'), (0x1D597, 'M', u'r'), (0x1D598, 'M', u's'), (0x1D599, 'M', u't'), (0x1D59A, 'M', u'u'), (0x1D59B, 'M', u'v'), (0x1D59C, 'M', u'w'), (0x1D59D, 'M', u'x'), (0x1D59E, 'M', u'y'), (0x1D59F, 'M', u'z'), (0x1D5A0, 'M', u'a'), (0x1D5A1, 'M', u'b'), (0x1D5A2, 'M', u'c'), (0x1D5A3, 'M', u'd'), (0x1D5A4, 'M', u'e'), (0x1D5A5, 'M', u'f'), (0x1D5A6, 'M', u'g'), (0x1D5A7, 'M', u'h'), (0x1D5A8, 'M', u'i'), (0x1D5A9, 'M', u'j'), (0x1D5AA, 'M', u'k'), (0x1D5AB, 'M', u'l'), (0x1D5AC, 'M', u'm'), (0x1D5AD, 'M', u'n'), (0x1D5AE, 'M', u'o'), (0x1D5AF, 'M', u'p'), (0x1D5B0, 'M', u'q'), (0x1D5B1, 'M', u'r'), (0x1D5B2, 'M', u's'), (0x1D5B3, 'M', u't'), (0x1D5B4, 'M', u'u'), (0x1D5B5, 'M', u'v'), (0x1D5B6, 'M', u'w'), (0x1D5B7, 'M', u'x'), (0x1D5B8, 'M', u'y'), (0x1D5B9, 'M', u'z'), (0x1D5BA, 'M', u'a'), (0x1D5BB, 'M', u'b'), (0x1D5BC, 'M', u'c'), (0x1D5BD, 'M', u'd'), (0x1D5BE, 'M', u'e'), (0x1D5BF, 'M', u'f'), (0x1D5C0, 'M', u'g'), (0x1D5C1, 'M', u'h'), (0x1D5C2, 'M', u'i'), (0x1D5C3, 'M', u'j'), (0x1D5C4, 'M', u'k'), (0x1D5C5, 'M', u'l'), (0x1D5C6, 'M', u'm'), (0x1D5C7, 'M', u'n'), (0x1D5C8, 'M', u'o'), (0x1D5C9, 'M', u'p'), (0x1D5CA, 'M', u'q'), (0x1D5CB, 'M', u'r'), (0x1D5CC, 'M', u's'), (0x1D5CD, 'M', u't'), (0x1D5CE, 'M', u'u'), (0x1D5CF, 'M', u'v'), (0x1D5D0, 'M', u'w'), (0x1D5D1, 'M', u'x'), (0x1D5D2, 'M', u'y'), (0x1D5D3, 'M', u'z'), (0x1D5D4, 'M', u'a'), (0x1D5D5, 'M', u'b'), (0x1D5D6, 'M', u'c'), (0x1D5D7, 'M', u'd'), (0x1D5D8, 'M', u'e'), (0x1D5D9, 'M', u'f'), (0x1D5DA, 'M', u'g'), (0x1D5DB, 'M', u'h'), (0x1D5DC, 'M', u'i'), (0x1D5DD, 'M', u'j'), (0x1D5DE, 'M', u'k'), (0x1D5DF, 'M', u'l'), (0x1D5E0, 'M', u'm'), (0x1D5E1, 'M', u'n'), (0x1D5E2, 'M', u'o'), (0x1D5E3, 'M', u'p'), (0x1D5E4, 'M', u'q'), (0x1D5E5, 'M', u'r'), (0x1D5E6, 'M', u's'), (0x1D5E7, 'M', u't'), ] def _seg_64(): return [ (0x1D5E8, 'M', u'u'), (0x1D5E9, 'M', u'v'), (0x1D5EA, 'M', u'w'), (0x1D5EB, 'M', u'x'), (0x1D5EC, 'M', u'y'), (0x1D5ED, 'M', u'z'), (0x1D5EE, 'M', u'a'), (0x1D5EF, 'M', u'b'), (0x1D5F0, 'M', u'c'), (0x1D5F1, 'M', u'd'), (0x1D5F2, 'M', u'e'), (0x1D5F3, 'M', u'f'), (0x1D5F4, 'M', u'g'), (0x1D5F5, 'M', u'h'), (0x1D5F6, 'M', u'i'), (0x1D5F7, 'M', u'j'), (0x1D5F8, 'M', u'k'), (0x1D5F9, 'M', u'l'), (0x1D5FA, 'M', u'm'), (0x1D5FB, 'M', u'n'), (0x1D5FC, 'M', u'o'), (0x1D5FD, 'M', u'p'), (0x1D5FE, 'M', u'q'), (0x1D5FF, 'M', u'r'), (0x1D600, 'M', u's'), (0x1D601, 'M', u't'), (0x1D602, 'M', u'u'), (0x1D603, 'M', u'v'), (0x1D604, 'M', u'w'), (0x1D605, 'M', u'x'), (0x1D606, 'M', u'y'), (0x1D607, 'M', u'z'), (0x1D608, 'M', u'a'), (0x1D609, 'M', u'b'), (0x1D60A, 'M', u'c'), (0x1D60B, 'M', u'd'), (0x1D60C, 'M', u'e'), (0x1D60D, 'M', u'f'), (0x1D60E, 'M', u'g'), (0x1D60F, 'M', u'h'), (0x1D610, 'M', u'i'), (0x1D611, 'M', u'j'), (0x1D612, 'M', u'k'), (0x1D613, 'M', u'l'), (0x1D614, 'M', u'm'), (0x1D615, 'M', u'n'), (0x1D616, 'M', u'o'), (0x1D617, 'M', u'p'), (0x1D618, 'M', u'q'), (0x1D619, 'M', u'r'), (0x1D61A, 'M', u's'), (0x1D61B, 'M', u't'), (0x1D61C, 'M', u'u'), (0x1D61D, 'M', u'v'), (0x1D61E, 'M', u'w'), (0x1D61F, 'M', u'x'), (0x1D620, 'M', u'y'), (0x1D621, 'M', u'z'), (0x1D622, 'M', u'a'), (0x1D623, 'M', u'b'), (0x1D624, 'M', u'c'), (0x1D625, 'M', u'd'), (0x1D626, 'M', u'e'), (0x1D627, 'M', u'f'), (0x1D628, 'M', u'g'), (0x1D629, 'M', u'h'), (0x1D62A, 'M', u'i'), (0x1D62B, 'M', u'j'), (0x1D62C, 'M', u'k'), (0x1D62D, 'M', u'l'), (0x1D62E, 'M', u'm'), (0x1D62F, 'M', u'n'), (0x1D630, 'M', u'o'), (0x1D631, 'M', u'p'), (0x1D632, 'M', u'q'), (0x1D633, 'M', u'r'), (0x1D634, 'M', u's'), (0x1D635, 'M', u't'), (0x1D636, 'M', u'u'), (0x1D637, 'M', u'v'), (0x1D638, 'M', u'w'), (0x1D639, 'M', u'x'), (0x1D63A, 'M', u'y'), (0x1D63B, 'M', u'z'), (0x1D63C, 'M', u'a'), (0x1D63D, 'M', u'b'), (0x1D63E, 'M', u'c'), (0x1D63F, 'M', u'd'), (0x1D640, 'M', u'e'), (0x1D641, 'M', u'f'), (0x1D642, 'M', u'g'), (0x1D643, 'M', u'h'), (0x1D644, 'M', u'i'), (0x1D645, 'M', u'j'), (0x1D646, 'M', u'k'), (0x1D647, 'M', u'l'), (0x1D648, 'M', u'm'), (0x1D649, 'M', u'n'), (0x1D64A, 'M', u'o'), (0x1D64B, 'M', u'p'), ] def _seg_65(): return [ (0x1D64C, 'M', u'q'), (0x1D64D, 'M', u'r'), (0x1D64E, 'M', u's'), (0x1D64F, 'M', u't'), (0x1D650, 'M', u'u'), (0x1D651, 'M', u'v'), (0x1D652, 'M', u'w'), (0x1D653, 'M', u'x'), (0x1D654, 'M', u'y'), (0x1D655, 'M', u'z'), (0x1D656, 'M', u'a'), (0x1D657, 'M', u'b'), (0x1D658, 'M', u'c'), (0x1D659, 'M', u'd'), (0x1D65A, 'M', u'e'), (0x1D65B, 'M', u'f'), (0x1D65C, 'M', u'g'), (0x1D65D, 'M', u'h'), (0x1D65E, 'M', u'i'), (0x1D65F, 'M', u'j'), (0x1D660, 'M', u'k'), (0x1D661, 'M', u'l'), (0x1D662, 'M', u'm'), (0x1D663, 'M', u'n'), (0x1D664, 'M', u'o'), (0x1D665, 'M', u'p'), (0x1D666, 'M', u'q'), (0x1D667, 'M', u'r'), (0x1D668, 'M', u's'), (0x1D669, 'M', u't'), (0x1D66A, 'M', u'u'), (0x1D66B, 'M', u'v'), (0x1D66C, 'M', u'w'), (0x1D66D, 'M', u'x'), (0x1D66E, 'M', u'y'), (0x1D66F, 'M', u'z'), (0x1D670, 'M', u'a'), (0x1D671, 'M', u'b'), (0x1D672, 'M', u'c'), (0x1D673, 'M', u'd'), (0x1D674, 'M', u'e'), (0x1D675, 'M', u'f'), (0x1D676, 'M', u'g'), (0x1D677, 'M', u'h'), (0x1D678, 'M', u'i'), (0x1D679, 'M', u'j'), (0x1D67A, 'M', u'k'), (0x1D67B, 'M', u'l'), (0x1D67C, 'M', u'm'), (0x1D67D, 'M', u'n'), (0x1D67E, 'M', u'o'), (0x1D67F, 'M', u'p'), (0x1D680, 'M', u'q'), (0x1D681, 'M', u'r'), (0x1D682, 'M', u's'), (0x1D683, 'M', u't'), (0x1D684, 'M', u'u'), (0x1D685, 'M', u'v'), (0x1D686, 'M', u'w'), (0x1D687, 'M', u'x'), (0x1D688, 'M', u'y'), (0x1D689, 'M', u'z'), (0x1D68A, 'M', u'a'), (0x1D68B, 'M', u'b'), (0x1D68C, 'M', u'c'), (0x1D68D, 'M', u'd'), (0x1D68E, 'M', u'e'), (0x1D68F, 'M', u'f'), (0x1D690, 'M', u'g'), (0x1D691, 'M', u'h'), (0x1D692, 'M', u'i'), (0x1D693, 'M', u'j'), (0x1D694, 'M', u'k'), (0x1D695, 'M', u'l'), (0x1D696, 'M', u'm'), (0x1D697, 'M', u'n'), (0x1D698, 'M', u'o'), (0x1D699, 'M', u'p'), (0x1D69A, 'M', u'q'), (0x1D69B, 'M', u'r'), (0x1D69C, 'M', u's'), (0x1D69D, 'M', u't'), (0x1D69E, 'M', u'u'), (0x1D69F, 'M', u'v'), (0x1D6A0, 'M', u'w'), (0x1D6A1, 'M', u'x'), (0x1D6A2, 'M', u'y'), (0x1D6A3, 'M', u'z'), (0x1D6A4, 'M', u'ı'), (0x1D6A5, 'M', u'ȷ'), (0x1D6A6, 'X'), (0x1D6A8, 'M', u'α'), (0x1D6A9, 'M', u'β'), (0x1D6AA, 'M', u'γ'), (0x1D6AB, 'M', u'δ'), (0x1D6AC, 'M', u'ε'), (0x1D6AD, 'M', u'ζ'), (0x1D6AE, 'M', u'η'), (0x1D6AF, 'M', u'θ'), (0x1D6B0, 'M', u'ι'), ] def _seg_66(): return [ (0x1D6B1, 'M', u'κ'), (0x1D6B2, 'M', u'λ'), (0x1D6B3, 'M', u'μ'), (0x1D6B4, 'M', u'ν'), (0x1D6B5, 'M', u'ξ'), (0x1D6B6, 'M', u'ο'), (0x1D6B7, 'M', u'π'), (0x1D6B8, 'M', u'ρ'), (0x1D6B9, 'M', u'θ'), (0x1D6BA, 'M', u'σ'), (0x1D6BB, 'M', u'τ'), (0x1D6BC, 'M', u'υ'), (0x1D6BD, 'M', u'φ'), (0x1D6BE, 'M', u'χ'), (0x1D6BF, 'M', u'ψ'), (0x1D6C0, 'M', u'ω'), (0x1D6C1, 'M', u'∇'), (0x1D6C2, 'M', u'α'), (0x1D6C3, 'M', u'β'), (0x1D6C4, 'M', u'γ'), (0x1D6C5, 'M', u'δ'), (0x1D6C6, 'M', u'ε'), (0x1D6C7, 'M', u'ζ'), (0x1D6C8, 'M', u'η'), (0x1D6C9, 'M', u'θ'), (0x1D6CA, 'M', u'ι'), (0x1D6CB, 'M', u'κ'), (0x1D6CC, 'M', u'λ'), (0x1D6CD, 'M', u'μ'), (0x1D6CE, 'M', u'ν'), (0x1D6CF, 'M', u'ξ'), (0x1D6D0, 'M', u'ο'), (0x1D6D1, 'M', u'π'), (0x1D6D2, 'M', u'ρ'), (0x1D6D3, 'M', u'σ'), (0x1D6D5, 'M', u'τ'), (0x1D6D6, 'M', u'υ'), (0x1D6D7, 'M', u'φ'), (0x1D6D8, 'M', u'χ'), (0x1D6D9, 'M', u'ψ'), (0x1D6DA, 'M', u'ω'), (0x1D6DB, 'M', u'∂'), (0x1D6DC, 'M', u'ε'), (0x1D6DD, 'M', u'θ'), (0x1D6DE, 'M', u'κ'), (0x1D6DF, 'M', u'φ'), (0x1D6E0, 'M', u'ρ'), (0x1D6E1, 'M', u'π'), (0x1D6E2, 'M', u'α'), (0x1D6E3, 'M', u'β'), (0x1D6E4, 'M', u'γ'), (0x1D6E5, 'M', u'δ'), (0x1D6E6, 'M', u'ε'), (0x1D6E7, 'M', u'ζ'), (0x1D6E8, 'M', u'η'), (0x1D6E9, 'M', u'θ'), (0x1D6EA, 'M', u'ι'), (0x1D6EB, 'M', u'κ'), (0x1D6EC, 'M', u'λ'), (0x1D6ED, 'M', u'μ'), (0x1D6EE, 'M', u'ν'), (0x1D6EF, 'M', u'ξ'), (0x1D6F0, 'M', u'ο'), (0x1D6F1, 'M', u'π'), (0x1D6F2, 'M', u'ρ'), (0x1D6F3, 'M', u'θ'), (0x1D6F4, 'M', u'σ'), (0x1D6F5, 'M', u'τ'), (0x1D6F6, 'M', u'υ'), (0x1D6F7, 'M', u'φ'), (0x1D6F8, 'M', u'χ'), (0x1D6F9, 'M', u'ψ'), (0x1D6FA, 'M', u'ω'), (0x1D6FB, 'M', u'∇'), (0x1D6FC, 'M', u'α'), (0x1D6FD, 'M', u'β'), (0x1D6FE, 'M', u'γ'), (0x1D6FF, 'M', u'δ'), (0x1D700, 'M', u'ε'), (0x1D701, 'M', u'ζ'), (0x1D702, 'M', u'η'), (0x1D703, 'M', u'θ'), (0x1D704, 'M', u'ι'), (0x1D705, 'M', u'κ'), (0x1D706, 'M', u'λ'), (0x1D707, 'M', u'μ'), (0x1D708, 'M', u'ν'), (0x1D709, 'M', u'ξ'), (0x1D70A, 'M', u'ο'), (0x1D70B, 'M', u'π'), (0x1D70C, 'M', u'ρ'), (0x1D70D, 'M', u'σ'), (0x1D70F, 'M', u'τ'), (0x1D710, 'M', u'υ'), (0x1D711, 'M', u'φ'), (0x1D712, 'M', u'χ'), (0x1D713, 'M', u'ψ'), (0x1D714, 'M', u'ω'), (0x1D715, 'M', u'∂'), (0x1D716, 'M', u'ε'), ] def _seg_67(): return [ (0x1D717, 'M', u'θ'), (0x1D718, 'M', u'κ'), (0x1D719, 'M', u'φ'), (0x1D71A, 'M', u'ρ'), (0x1D71B, 'M', u'π'), (0x1D71C, 'M', u'α'), (0x1D71D, 'M', u'β'), (0x1D71E, 'M', u'γ'), (0x1D71F, 'M', u'δ'), (0x1D720, 'M', u'ε'), (0x1D721, 'M', u'ζ'), (0x1D722, 'M', u'η'), (0x1D723, 'M', u'θ'), (0x1D724, 'M', u'ι'), (0x1D725, 'M', u'κ'), (0x1D726, 'M', u'λ'), (0x1D727, 'M', u'μ'), (0x1D728, 'M', u'ν'), (0x1D729, 'M', u'ξ'), (0x1D72A, 'M', u'ο'), (0x1D72B, 'M', u'π'), (0x1D72C, 'M', u'ρ'), (0x1D72D, 'M', u'θ'), (0x1D72E, 'M', u'σ'), (0x1D72F, 'M', u'τ'), (0x1D730, 'M', u'υ'), (0x1D731, 'M', u'φ'), (0x1D732, 'M', u'χ'), (0x1D733, 'M', u'ψ'), (0x1D734, 'M', u'ω'), (0x1D735, 'M', u'∇'), (0x1D736, 'M', u'α'), (0x1D737, 'M', u'β'), (0x1D738, 'M', u'γ'), (0x1D739, 'M', u'δ'), (0x1D73A, 'M', u'ε'), (0x1D73B, 'M', u'ζ'), (0x1D73C, 'M', u'η'), (0x1D73D, 'M', u'θ'), (0x1D73E, 'M', u'ι'), (0x1D73F, 'M', u'κ'), (0x1D740, 'M', u'λ'), (0x1D741, 'M', u'μ'), (0x1D742, 'M', u'ν'), (0x1D743, 'M', u'ξ'), (0x1D744, 'M', u'ο'), (0x1D745, 'M', u'π'), (0x1D746, 'M', u'ρ'), (0x1D747, 'M', u'σ'), (0x1D749, 'M', u'τ'), (0x1D74A, 'M', u'υ'), (0x1D74B, 'M', u'φ'), (0x1D74C, 'M', u'χ'), (0x1D74D, 'M', u'ψ'), (0x1D74E, 'M', u'ω'), (0x1D74F, 'M', u'∂'), (0x1D750, 'M', u'ε'), (0x1D751, 'M', u'θ'), (0x1D752, 'M', u'κ'), (0x1D753, 'M', u'φ'), (0x1D754, 'M', u'ρ'), (0x1D755, 'M', u'π'), (0x1D756, 'M', u'α'), (0x1D757, 'M', u'β'), (0x1D758, 'M', u'γ'), (0x1D759, 'M', u'δ'), (0x1D75A, 'M', u'ε'), (0x1D75B, 'M', u'ζ'), (0x1D75C, 'M', u'η'), (0x1D75D, 'M', u'θ'), (0x1D75E, 'M', u'ι'), (0x1D75F, 'M', u'κ'), (0x1D760, 'M', u'λ'), (0x1D761, 'M', u'μ'), (0x1D762, 'M', u'ν'), (0x1D763, 'M', u'ξ'), (0x1D764, 'M', u'ο'), (0x1D765, 'M', u'π'), (0x1D766, 'M', u'ρ'), (0x1D767, 'M', u'θ'), (0x1D768, 'M', u'σ'), (0x1D769, 'M', u'τ'), (0x1D76A, 'M', u'υ'), (0x1D76B, 'M', u'φ'), (0x1D76C, 'M', u'χ'), (0x1D76D, 'M', u'ψ'), (0x1D76E, 'M', u'ω'), (0x1D76F, 'M', u'∇'), (0x1D770, 'M', u'α'), (0x1D771, 'M', u'β'), (0x1D772, 'M', u'γ'), (0x1D773, 'M', u'δ'), (0x1D774, 'M', u'ε'), (0x1D775, 'M', u'ζ'), (0x1D776, 'M', u'η'), (0x1D777, 'M', u'θ'), (0x1D778, 'M', u'ι'), (0x1D779, 'M', u'κ'), (0x1D77A, 'M', u'λ'), (0x1D77B, 'M', u'μ'), ] def _seg_68(): return [ (0x1D77C, 'M', u'ν'), (0x1D77D, 'M', u'ξ'), (0x1D77E, 'M', u'ο'), (0x1D77F, 'M', u'π'), (0x1D780, 'M', u'ρ'), (0x1D781, 'M', u'σ'), (0x1D783, 'M', u'τ'), (0x1D784, 'M', u'υ'), (0x1D785, 'M', u'φ'), (0x1D786, 'M', u'χ'), (0x1D787, 'M', u'ψ'), (0x1D788, 'M', u'ω'), (0x1D789, 'M', u'∂'), (0x1D78A, 'M', u'ε'), (0x1D78B, 'M', u'θ'), (0x1D78C, 'M', u'κ'), (0x1D78D, 'M', u'φ'), (0x1D78E, 'M', u'ρ'), (0x1D78F, 'M', u'π'), (0x1D790, 'M', u'α'), (0x1D791, 'M', u'β'), (0x1D792, 'M', u'γ'), (0x1D793, 'M', u'δ'), (0x1D794, 'M', u'ε'), (0x1D795, 'M', u'ζ'), (0x1D796, 'M', u'η'), (0x1D797, 'M', u'θ'), (0x1D798, 'M', u'ι'), (0x1D799, 'M', u'κ'), (0x1D79A, 'M', u'λ'), (0x1D79B, 'M', u'μ'), (0x1D79C, 'M', u'ν'), (0x1D79D, 'M', u'ξ'), (0x1D79E, 'M', u'ο'), (0x1D79F, 'M', u'π'), (0x1D7A0, 'M', u'ρ'), (0x1D7A1, 'M', u'θ'), (0x1D7A2, 'M', u'σ'), (0x1D7A3, 'M', u'τ'), (0x1D7A4, 'M', u'υ'), (0x1D7A5, 'M', u'φ'), (0x1D7A6, 'M', u'χ'), (0x1D7A7, 'M', u'ψ'), (0x1D7A8, 'M', u'ω'), (0x1D7A9, 'M', u'∇'), (0x1D7AA, 'M', u'α'), (0x1D7AB, 'M', u'β'), (0x1D7AC, 'M', u'γ'), (0x1D7AD, 'M', u'δ'), (0x1D7AE, 'M', u'ε'), (0x1D7AF, 'M', u'ζ'), (0x1D7B0, 'M', u'η'), (0x1D7B1, 'M', u'θ'), (0x1D7B2, 'M', u'ι'), (0x1D7B3, 'M', u'κ'), (0x1D7B4, 'M', u'λ'), (0x1D7B5, 'M', u'μ'), (0x1D7B6, 'M', u'ν'), (0x1D7B7, 'M', u'ξ'), (0x1D7B8, 'M', u'ο'), (0x1D7B9, 'M', u'π'), (0x1D7BA, 'M', u'ρ'), (0x1D7BB, 'M', u'σ'), (0x1D7BD, 'M', u'τ'), (0x1D7BE, 'M', u'υ'), (0x1D7BF, 'M', u'φ'), (0x1D7C0, 'M', u'χ'), (0x1D7C1, 'M', u'ψ'), (0x1D7C2, 'M', u'ω'), (0x1D7C3, 'M', u'∂'), (0x1D7C4, 'M', u'ε'), (0x1D7C5, 'M', u'θ'), (0x1D7C6, 'M', u'κ'), (0x1D7C7, 'M', u'φ'), (0x1D7C8, 'M', u'ρ'), (0x1D7C9, 'M', u'π'), (0x1D7CA, 'M', u'ϝ'), (0x1D7CC, 'X'), (0x1D7CE, 'M', u'0'), (0x1D7CF, 'M', u'1'), (0x1D7D0, 'M', u'2'), (0x1D7D1, 'M', u'3'), (0x1D7D2, 'M', u'4'), (0x1D7D3, 'M', u'5'), (0x1D7D4, 'M', u'6'), (0x1D7D5, 'M', u'7'), (0x1D7D6, 'M', u'8'), (0x1D7D7, 'M', u'9'), (0x1D7D8, 'M', u'0'), (0x1D7D9, 'M', u'1'), (0x1D7DA, 'M', u'2'), (0x1D7DB, 'M', u'3'), (0x1D7DC, 'M', u'4'), (0x1D7DD, 'M', u'5'), (0x1D7DE, 'M', u'6'), (0x1D7DF, 'M', u'7'), (0x1D7E0, 'M', u'8'), (0x1D7E1, 'M', u'9'), (0x1D7E2, 'M', u'0'), (0x1D7E3, 'M', u'1'), ] def _seg_69(): return [ (0x1D7E4, 'M', u'2'), (0x1D7E5, 'M', u'3'), (0x1D7E6, 'M', u'4'), (0x1D7E7, 'M', u'5'), (0x1D7E8, 'M', u'6'), (0x1D7E9, 'M', u'7'), (0x1D7EA, 'M', u'8'), (0x1D7EB, 'M', u'9'), (0x1D7EC, 'M', u'0'), (0x1D7ED, 'M', u'1'), (0x1D7EE, 'M', u'2'), (0x1D7EF, 'M', u'3'), (0x1D7F0, 'M', u'4'), (0x1D7F1, 'M', u'5'), (0x1D7F2, 'M', u'6'), (0x1D7F3, 'M', u'7'), (0x1D7F4, 'M', u'8'), (0x1D7F5, 'M', u'9'), (0x1D7F6, 'M', u'0'), (0x1D7F7, 'M', u'1'), (0x1D7F8, 'M', u'2'), (0x1D7F9, 'M', u'3'), (0x1D7FA, 'M', u'4'), (0x1D7FB, 'M', u'5'), (0x1D7FC, 'M', u'6'), (0x1D7FD, 'M', u'7'), (0x1D7FE, 'M', u'8'), (0x1D7FF, 'M', u'9'), (0x1D800, 'V'), (0x1DA8C, 'X'), (0x1DA9B, 'V'), (0x1DAA0, 'X'), (0x1DAA1, 'V'), (0x1DAB0, 'X'), (0x1E000, 'V'), (0x1E007, 'X'), (0x1E008, 'V'), (0x1E019, 'X'), (0x1E01B, 'V'), (0x1E022, 'X'), (0x1E023, 'V'), (0x1E025, 'X'), (0x1E026, 'V'), (0x1E02B, 'X'), (0x1E100, 'V'), (0x1E12D, 'X'), (0x1E130, 'V'), (0x1E13E, 'X'), (0x1E140, 'V'), (0x1E14A, 'X'), (0x1E14E, 'V'), (0x1E150, 'X'), (0x1E2C0, 'V'), (0x1E2FA, 'X'), (0x1E2FF, 'V'), (0x1E300, 'X'), (0x1E800, 'V'), (0x1E8C5, 'X'), (0x1E8C7, 'V'), (0x1E8D7, 'X'), (0x1E900, 'M', u'𞤢'), (0x1E901, 'M', u'𞤣'), (0x1E902, 'M', u'𞤤'), (0x1E903, 'M', u'𞤥'), (0x1E904, 'M', u'𞤦'), (0x1E905, 'M', u'𞤧'), (0x1E906, 'M', u'𞤨'), (0x1E907, 'M', u'𞤩'), (0x1E908, 'M', u'𞤪'), (0x1E909, 'M', u'𞤫'), (0x1E90A, 'M', u'𞤬'), (0x1E90B, 'M', u'𞤭'), (0x1E90C, 'M', u'𞤮'), (0x1E90D, 'M', u'𞤯'), (0x1E90E, 'M', u'𞤰'), (0x1E90F, 'M', u'𞤱'), (0x1E910, 'M', u'𞤲'), (0x1E911, 'M', u'𞤳'), (0x1E912, 'M', u'𞤴'), (0x1E913, 'M', u'𞤵'), (0x1E914, 'M', u'𞤶'), (0x1E915, 'M', u'𞤷'), (0x1E916, 'M', u'𞤸'), (0x1E917, 'M', u'𞤹'), (0x1E918, 'M', u'𞤺'), (0x1E919, 'M', u'𞤻'), (0x1E91A, 'M', u'𞤼'), (0x1E91B, 'M', u'𞤽'), (0x1E91C, 'M', u'𞤾'), (0x1E91D, 'M', u'𞤿'), (0x1E91E, 'M', u'𞥀'), (0x1E91F, 'M', u'𞥁'), (0x1E920, 'M', u'𞥂'), (0x1E921, 'M', u'𞥃'), (0x1E922, 'V'), (0x1E94C, 'X'), (0x1E950, 'V'), (0x1E95A, 'X'), (0x1E95E, 'V'), (0x1E960, 'X'), ] def _seg_70(): return [ (0x1EC71, 'V'), (0x1ECB5, 'X'), (0x1ED01, 'V'), (0x1ED3E, 'X'), (0x1EE00, 'M', u'ا'), (0x1EE01, 'M', u'ب'), (0x1EE02, 'M', u'ج'), (0x1EE03, 'M', u'د'), (0x1EE04, 'X'), (0x1EE05, 'M', u'و'), (0x1EE06, 'M', u'ز'), (0x1EE07, 'M', u'ح'), (0x1EE08, 'M', u'ط'), (0x1EE09, 'M', u'ي'), (0x1EE0A, 'M', u'ك'), (0x1EE0B, 'M', u'ل'), (0x1EE0C, 'M', u'م'), (0x1EE0D, 'M', u'ن'), (0x1EE0E, 'M', u'س'), (0x1EE0F, 'M', u'ع'), (0x1EE10, 'M', u'ف'), (0x1EE11, 'M', u'ص'), (0x1EE12, 'M', u'ق'), (0x1EE13, 'M', u'ر'), (0x1EE14, 'M', u'ش'), (0x1EE15, 'M', u'ت'), (0x1EE16, 'M', u'ث'), (0x1EE17, 'M', u'خ'), (0x1EE18, 'M', u'ذ'), (0x1EE19, 'M', u'ض'), (0x1EE1A, 'M', u'ظ'), (0x1EE1B, 'M', u'غ'), (0x1EE1C, 'M', u'ٮ'), (0x1EE1D, 'M', u'ں'), (0x1EE1E, 'M', u'ڡ'), (0x1EE1F, 'M', u'ٯ'), (0x1EE20, 'X'), (0x1EE21, 'M', u'ب'), (0x1EE22, 'M', u'ج'), (0x1EE23, 'X'), (0x1EE24, 'M', u'ه'), (0x1EE25, 'X'), (0x1EE27, 'M', u'ح'), (0x1EE28, 'X'), (0x1EE29, 'M', u'ي'), (0x1EE2A, 'M', u'ك'), (0x1EE2B, 'M', u'ل'), (0x1EE2C, 'M', u'م'), (0x1EE2D, 'M', u'ن'), (0x1EE2E, 'M', u'س'), (0x1EE2F, 'M', u'ع'), (0x1EE30, 'M', u'ف'), (0x1EE31, 'M', u'ص'), (0x1EE32, 'M', u'ق'), (0x1EE33, 'X'), (0x1EE34, 'M', u'ش'), (0x1EE35, 'M', u'ت'), (0x1EE36, 'M', u'ث'), (0x1EE37, 'M', u'خ'), (0x1EE38, 'X'), (0x1EE39, 'M', u'ض'), (0x1EE3A, 'X'), (0x1EE3B, 'M', u'غ'), (0x1EE3C, 'X'), (0x1EE42, 'M', u'ج'), (0x1EE43, 'X'), (0x1EE47, 'M', u'ح'), (0x1EE48, 'X'), (0x1EE49, 'M', u'ي'), (0x1EE4A, 'X'), (0x1EE4B, 'M', u'ل'), (0x1EE4C, 'X'), (0x1EE4D, 'M', u'ن'), (0x1EE4E, 'M', u'س'), (0x1EE4F, 'M', u'ع'), (0x1EE50, 'X'), (0x1EE51, 'M', u'ص'), (0x1EE52, 'M', u'ق'), (0x1EE53, 'X'), (0x1EE54, 'M', u'ش'), (0x1EE55, 'X'), (0x1EE57, 'M', u'خ'), (0x1EE58, 'X'), (0x1EE59, 'M', u'ض'), (0x1EE5A, 'X'), (0x1EE5B, 'M', u'غ'), (0x1EE5C, 'X'), (0x1EE5D, 'M', u'ں'), (0x1EE5E, 'X'), (0x1EE5F, 'M', u'ٯ'), (0x1EE60, 'X'), (0x1EE61, 'M', u'ب'), (0x1EE62, 'M', u'ج'), (0x1EE63, 'X'), (0x1EE64, 'M', u'ه'), (0x1EE65, 'X'), (0x1EE67, 'M', u'ح'), (0x1EE68, 'M', u'ط'), (0x1EE69, 'M', u'ي'), (0x1EE6A, 'M', u'ك'), ] def _seg_71(): return [ (0x1EE6B, 'X'), (0x1EE6C, 'M', u'م'), (0x1EE6D, 'M', u'ن'), (0x1EE6E, 'M', u'س'), (0x1EE6F, 'M', u'ع'), (0x1EE70, 'M', u'ف'), (0x1EE71, 'M', u'ص'), (0x1EE72, 'M', u'ق'), (0x1EE73, 'X'), (0x1EE74, 'M', u'ش'), (0x1EE75, 'M', u'ت'), (0x1EE76, 'M', u'ث'), (0x1EE77, 'M', u'خ'), (0x1EE78, 'X'), (0x1EE79, 'M', u'ض'), (0x1EE7A, 'M', u'ظ'), (0x1EE7B, 'M', u'غ'), (0x1EE7C, 'M', u'ٮ'), (0x1EE7D, 'X'), (0x1EE7E, 'M', u'ڡ'), (0x1EE7F, 'X'), (0x1EE80, 'M', u'ا'), (0x1EE81, 'M', u'ب'), (0x1EE82, 'M', u'ج'), (0x1EE83, 'M', u'د'), (0x1EE84, 'M', u'ه'), (0x1EE85, 'M', u'و'), (0x1EE86, 'M', u'ز'), (0x1EE87, 'M', u'ح'), (0x1EE88, 'M', u'ط'), (0x1EE89, 'M', u'ي'), (0x1EE8A, 'X'), (0x1EE8B, 'M', u'ل'), (0x1EE8C, 'M', u'م'), (0x1EE8D, 'M', u'ن'), (0x1EE8E, 'M', u'س'), (0x1EE8F, 'M', u'ع'), (0x1EE90, 'M', u'ف'), (0x1EE91, 'M', u'ص'), (0x1EE92, 'M', u'ق'), (0x1EE93, 'M', u'ر'), (0x1EE94, 'M', u'ش'), (0x1EE95, 'M', u'ت'), (0x1EE96, 'M', u'ث'), (0x1EE97, 'M', u'خ'), (0x1EE98, 'M', u'ذ'), (0x1EE99, 'M', u'ض'), (0x1EE9A, 'M', u'ظ'), (0x1EE9B, 'M', u'غ'), (0x1EE9C, 'X'), (0x1EEA1, 'M', u'ب'), (0x1EEA2, 'M', u'ج'), (0x1EEA3, 'M', u'د'), (0x1EEA4, 'X'), (0x1EEA5, 'M', u'و'), (0x1EEA6, 'M', u'ز'), (0x1EEA7, 'M', u'ح'), (0x1EEA8, 'M', u'ط'), (0x1EEA9, 'M', u'ي'), (0x1EEAA, 'X'), (0x1EEAB, 'M', u'ل'), (0x1EEAC, 'M', u'م'), (0x1EEAD, 'M', u'ن'), (0x1EEAE, 'M', u'س'), (0x1EEAF, 'M', u'ع'), (0x1EEB0, 'M', u'ف'), (0x1EEB1, 'M', u'ص'), (0x1EEB2, 'M', u'ق'), (0x1EEB3, 'M', u'ر'), (0x1EEB4, 'M', u'ش'), (0x1EEB5, 'M', u'ت'), (0x1EEB6, 'M', u'ث'), (0x1EEB7, 'M', u'خ'), (0x1EEB8, 'M', u'ذ'), (0x1EEB9, 'M', u'ض'), (0x1EEBA, 'M', u'ظ'), (0x1EEBB, 'M', u'غ'), (0x1EEBC, 'X'), (0x1EEF0, 'V'), (0x1EEF2, 'X'), (0x1F000, 'V'), (0x1F02C, 'X'), (0x1F030, 'V'), (0x1F094, 'X'), (0x1F0A0, 'V'), (0x1F0AF, 'X'), (0x1F0B1, 'V'), (0x1F0C0, 'X'), (0x1F0C1, 'V'), (0x1F0D0, 'X'), (0x1F0D1, 'V'), (0x1F0F6, 'X'), (0x1F101, '3', u'0,'), (0x1F102, '3', u'1,'), (0x1F103, '3', u'2,'), (0x1F104, '3', u'3,'), (0x1F105, '3', u'4,'), (0x1F106, '3', u'5,'), (0x1F107, '3', u'6,'), (0x1F108, '3', u'7,'), ] def _seg_72(): return [ (0x1F109, '3', u'8,'), (0x1F10A, '3', u'9,'), (0x1F10B, 'V'), (0x1F110, '3', u'(a)'), (0x1F111, '3', u'(b)'), (0x1F112, '3', u'(c)'), (0x1F113, '3', u'(d)'), (0x1F114, '3', u'(e)'), (0x1F115, '3', u'(f)'), (0x1F116, '3', u'(g)'), (0x1F117, '3', u'(h)'), (0x1F118, '3', u'(i)'), (0x1F119, '3', u'(j)'), (0x1F11A, '3', u'(k)'), (0x1F11B, '3', u'(l)'), (0x1F11C, '3', u'(m)'), (0x1F11D, '3', u'(n)'), (0x1F11E, '3', u'(o)'), (0x1F11F, '3', u'(p)'), (0x1F120, '3', u'(q)'), (0x1F121, '3', u'(r)'), (0x1F122, '3', u'(s)'), (0x1F123, '3', u'(t)'), (0x1F124, '3', u'(u)'), (0x1F125, '3', u'(v)'), (0x1F126, '3', u'(w)'), (0x1F127, '3', u'(x)'), (0x1F128, '3', u'(y)'), (0x1F129, '3', u'(z)'), (0x1F12A, 'M', u'〔s〕'), (0x1F12B, 'M', u'c'), (0x1F12C, 'M', u'r'), (0x1F12D, 'M', u'cd'), (0x1F12E, 'M', u'wz'), (0x1F12F, 'V'), (0x1F130, 'M', u'a'), (0x1F131, 'M', u'b'), (0x1F132, 'M', u'c'), (0x1F133, 'M', u'd'), (0x1F134, 'M', u'e'), (0x1F135, 'M', u'f'), (0x1F136, 'M', u'g'), (0x1F137, 'M', u'h'), (0x1F138, 'M', u'i'), (0x1F139, 'M', u'j'), (0x1F13A, 'M', u'k'), (0x1F13B, 'M', u'l'), (0x1F13C, 'M', u'm'), (0x1F13D, 'M', u'n'), (0x1F13E, 'M', u'o'), (0x1F13F, 'M', u'p'), (0x1F140, 'M', u'q'), (0x1F141, 'M', u'r'), (0x1F142, 'M', u's'), (0x1F143, 'M', u't'), (0x1F144, 'M', u'u'), (0x1F145, 'M', u'v'), (0x1F146, 'M', u'w'), (0x1F147, 'M', u'x'), (0x1F148, 'M', u'y'), (0x1F149, 'M', u'z'), (0x1F14A, 'M', u'hv'), (0x1F14B, 'M', u'mv'), (0x1F14C, 'M', u'sd'), (0x1F14D, 'M', u'ss'), (0x1F14E, 'M', u'ppv'), (0x1F14F, 'M', u'wc'), (0x1F150, 'V'), (0x1F16A, 'M', u'mc'), (0x1F16B, 'M', u'md'), (0x1F16C, 'M', u'mr'), (0x1F16D, 'V'), (0x1F190, 'M', u'dj'), (0x1F191, 'V'), (0x1F1AE, 'X'), (0x1F1E6, 'V'), (0x1F200, 'M', u'ほか'), (0x1F201, 'M', u'ココ'), (0x1F202, 'M', u'サ'), (0x1F203, 'X'), (0x1F210, 'M', u'手'), (0x1F211, 'M', u'字'), (0x1F212, 'M', u'双'), (0x1F213, 'M', u'デ'), (0x1F214, 'M', u'二'), (0x1F215, 'M', u'多'), (0x1F216, 'M', u'解'), (0x1F217, 'M', u'天'), (0x1F218, 'M', u'交'), (0x1F219, 'M', u'映'), (0x1F21A, 'M', u'無'), (0x1F21B, 'M', u'料'), (0x1F21C, 'M', u'前'), (0x1F21D, 'M', u'後'), (0x1F21E, 'M', u'再'), (0x1F21F, 'M', u'新'), (0x1F220, 'M', u'初'), (0x1F221, 'M', u'終'), (0x1F222, 'M', u'生'), (0x1F223, 'M', u'販'), ] def _seg_73(): return [ (0x1F224, 'M', u'声'), (0x1F225, 'M', u'吹'), (0x1F226, 'M', u'演'), (0x1F227, 'M', u'投'), (0x1F228, 'M', u'捕'), (0x1F229, 'M', u'一'), (0x1F22A, 'M', u'三'), (0x1F22B, 'M', u'遊'), (0x1F22C, 'M', u'左'), (0x1F22D, 'M', u'中'), (0x1F22E, 'M', u'右'), (0x1F22F, 'M', u'指'), (0x1F230, 'M', u'走'), (0x1F231, 'M', u'打'), (0x1F232, 'M', u'禁'), (0x1F233, 'M', u'空'), (0x1F234, 'M', u'合'), (0x1F235, 'M', u'満'), (0x1F236, 'M', u'有'), (0x1F237, 'M', u'月'), (0x1F238, 'M', u'申'), (0x1F239, 'M', u'割'), (0x1F23A, 'M', u'営'), (0x1F23B, 'M', u'配'), (0x1F23C, 'X'), (0x1F240, 'M', u'〔本〕'), (0x1F241, 'M', u'〔三〕'), (0x1F242, 'M', u'〔二〕'), (0x1F243, 'M', u'〔安〕'), (0x1F244, 'M', u'〔点〕'), (0x1F245, 'M', u'〔打〕'), (0x1F246, 'M', u'〔盗〕'), (0x1F247, 'M', u'〔勝〕'), (0x1F248, 'M', u'〔敗〕'), (0x1F249, 'X'), (0x1F250, 'M', u'得'), (0x1F251, 'M', u'可'), (0x1F252, 'X'), (0x1F260, 'V'), (0x1F266, 'X'), (0x1F300, 'V'), (0x1F6D8, 'X'), (0x1F6E0, 'V'), (0x1F6ED, 'X'), (0x1F6F0, 'V'), (0x1F6FD, 'X'), (0x1F700, 'V'), (0x1F774, 'X'), (0x1F780, 'V'), (0x1F7D9, 'X'), (0x1F7E0, 'V'), (0x1F7EC, 'X'), (0x1F800, 'V'), (0x1F80C, 'X'), (0x1F810, 'V'), (0x1F848, 'X'), (0x1F850, 'V'), (0x1F85A, 'X'), (0x1F860, 'V'), (0x1F888, 'X'), (0x1F890, 'V'), (0x1F8AE, 'X'), (0x1F8B0, 'V'), (0x1F8B2, 'X'), (0x1F900, 'V'), (0x1F979, 'X'), (0x1F97A, 'V'), (0x1F9CC, 'X'), (0x1F9CD, 'V'), (0x1FA54, 'X'), (0x1FA60, 'V'), (0x1FA6E, 'X'), (0x1FA70, 'V'), (0x1FA75, 'X'), (0x1FA78, 'V'), (0x1FA7B, 'X'), (0x1FA80, 'V'), (0x1FA87, 'X'), (0x1FA90, 'V'), (0x1FAA9, 'X'), (0x1FAB0, 'V'), (0x1FAB7, 'X'), (0x1FAC0, 'V'), (0x1FAC3, 'X'), (0x1FAD0, 'V'), (0x1FAD7, 'X'), (0x1FB00, 'V'), (0x1FB93, 'X'), (0x1FB94, 'V'), (0x1FBCB, 'X'), (0x1FBF0, 'M', u'0'), (0x1FBF1, 'M', u'1'), (0x1FBF2, 'M', u'2'), (0x1FBF3, 'M', u'3'), (0x1FBF4, 'M', u'4'), (0x1FBF5, 'M', u'5'), (0x1FBF6, 'M', u'6'), (0x1FBF7, 'M', u'7'), (0x1FBF8, 'M', u'8'), (0x1FBF9, 'M', u'9'), ] def _seg_74(): return [ (0x1FBFA, 'X'), (0x20000, 'V'), (0x2A6DE, 'X'), (0x2A700, 'V'), (0x2B735, 'X'), (0x2B740, 'V'), (0x2B81E, 'X'), (0x2B820, 'V'), (0x2CEA2, 'X'), (0x2CEB0, 'V'), (0x2EBE1, 'X'), (0x2F800, 'M', u'丽'), (0x2F801, 'M', u'丸'), (0x2F802, 'M', u'乁'), (0x2F803, 'M', u'𠄢'), (0x2F804, 'M', u'你'), (0x2F805, 'M', u'侮'), (0x2F806, 'M', u'侻'), (0x2F807, 'M', u'倂'), (0x2F808, 'M', u'偺'), (0x2F809, 'M', u'備'), (0x2F80A, 'M', u'僧'), (0x2F80B, 'M', u'像'), (0x2F80C, 'M', u'㒞'), (0x2F80D, 'M', u'𠘺'), (0x2F80E, 'M', u'免'), (0x2F80F, 'M', u'兔'), (0x2F810, 'M', u'兤'), (0x2F811, 'M', u'具'), (0x2F812, 'M', u'𠔜'), (0x2F813, 'M', u'㒹'), (0x2F814, 'M', u'內'), (0x2F815, 'M', u'再'), (0x2F816, 'M', u'𠕋'), (0x2F817, 'M', u'冗'), (0x2F818, 'M', u'冤'), (0x2F819, 'M', u'仌'), (0x2F81A, 'M', u'冬'), (0x2F81B, 'M', u'况'), (0x2F81C, 'M', u'𩇟'), (0x2F81D, 'M', u'凵'), (0x2F81E, 'M', u'刃'), (0x2F81F, 'M', u'㓟'), (0x2F820, 'M', u'刻'), (0x2F821, 'M', u'剆'), (0x2F822, 'M', u'割'), (0x2F823, 'M', u'剷'), (0x2F824, 'M', u'㔕'), (0x2F825, 'M', u'勇'), (0x2F826, 'M', u'勉'), (0x2F827, 'M', u'勤'), (0x2F828, 'M', u'勺'), (0x2F829, 'M', u'包'), (0x2F82A, 'M', u'匆'), (0x2F82B, 'M', u'北'), (0x2F82C, 'M', u'卉'), (0x2F82D, 'M', u'卑'), (0x2F82E, 'M', u'博'), (0x2F82F, 'M', u'即'), (0x2F830, 'M', u'卽'), (0x2F831, 'M', u'卿'), (0x2F834, 'M', u'𠨬'), (0x2F835, 'M', u'灰'), (0x2F836, 'M', u'及'), (0x2F837, 'M', u'叟'), (0x2F838, 'M', u'𠭣'), (0x2F839, 'M', u'叫'), (0x2F83A, 'M', u'叱'), (0x2F83B, 'M', u'吆'), (0x2F83C, 'M', u'咞'), (0x2F83D, 'M', u'吸'), (0x2F83E, 'M', u'呈'), (0x2F83F, 'M', u'周'), (0x2F840, 'M', u'咢'), (0x2F841, 'M', u'哶'), (0x2F842, 'M', u'唐'), (0x2F843, 'M', u'啓'), (0x2F844, 'M', u'啣'), (0x2F845, 'M', u'善'), (0x2F847, 'M', u'喙'), (0x2F848, 'M', u'喫'), (0x2F849, 'M', u'喳'), (0x2F84A, 'M', u'嗂'), (0x2F84B, 'M', u'圖'), (0x2F84C, 'M', u'嘆'), (0x2F84D, 'M', u'圗'), (0x2F84E, 'M', u'噑'), (0x2F84F, 'M', u'噴'), (0x2F850, 'M', u'切'), (0x2F851, 'M', u'壮'), (0x2F852, 'M', u'城'), (0x2F853, 'M', u'埴'), (0x2F854, 'M', u'堍'), (0x2F855, 'M', u'型'), (0x2F856, 'M', u'堲'), (0x2F857, 'M', u'報'), (0x2F858, 'M', u'墬'), (0x2F859, 'M', u'𡓤'), (0x2F85A, 'M', u'売'), (0x2F85B, 'M', u'壷'), ] def _seg_75(): return [ (0x2F85C, 'M', u'夆'), (0x2F85D, 'M', u'多'), (0x2F85E, 'M', u'夢'), (0x2F85F, 'M', u'奢'), (0x2F860, 'M', u'𡚨'), (0x2F861, 'M', u'𡛪'), (0x2F862, 'M', u'姬'), (0x2F863, 'M', u'娛'), (0x2F864, 'M', u'娧'), (0x2F865, 'M', u'姘'), (0x2F866, 'M', u'婦'), (0x2F867, 'M', u'㛮'), (0x2F868, 'X'), (0x2F869, 'M', u'嬈'), (0x2F86A, 'M', u'嬾'), (0x2F86C, 'M', u'𡧈'), (0x2F86D, 'M', u'寃'), (0x2F86E, 'M', u'寘'), (0x2F86F, 'M', u'寧'), (0x2F870, 'M', u'寳'), (0x2F871, 'M', u'𡬘'), (0x2F872, 'M', u'寿'), (0x2F873, 'M', u'将'), (0x2F874, 'X'), (0x2F875, 'M', u'尢'), (0x2F876, 'M', u'㞁'), (0x2F877, 'M', u'屠'), (0x2F878, 'M', u'屮'), (0x2F879, 'M', u'峀'), (0x2F87A, 'M', u'岍'), (0x2F87B, 'M', u'𡷤'), (0x2F87C, 'M', u'嵃'), (0x2F87D, 'M', u'𡷦'), (0x2F87E, 'M', u'嵮'), (0x2F87F, 'M', u'嵫'), (0x2F880, 'M', u'嵼'), (0x2F881, 'M', u'巡'), (0x2F882, 'M', u'巢'), (0x2F883, 'M', u'㠯'), (0x2F884, 'M', u'巽'), (0x2F885, 'M', u'帨'), (0x2F886, 'M', u'帽'), (0x2F887, 'M', u'幩'), (0x2F888, 'M', u'㡢'), (0x2F889, 'M', u'𢆃'), (0x2F88A, 'M', u'㡼'), (0x2F88B, 'M', u'庰'), (0x2F88C, 'M', u'庳'), (0x2F88D, 'M', u'庶'), (0x2F88E, 'M', u'廊'), (0x2F88F, 'M', u'𪎒'), (0x2F890, 'M', u'廾'), (0x2F891, 'M', u'𢌱'), (0x2F893, 'M', u'舁'), (0x2F894, 'M', u'弢'), (0x2F896, 'M', u'㣇'), (0x2F897, 'M', u'𣊸'), (0x2F898, 'M', u'𦇚'), (0x2F899, 'M', u'形'), (0x2F89A, 'M', u'彫'), (0x2F89B, 'M', u'㣣'), (0x2F89C, 'M', u'徚'), (0x2F89D, 'M', u'忍'), (0x2F89E, 'M', u'志'), (0x2F89F, 'M', u'忹'), (0x2F8A0, 'M', u'悁'), (0x2F8A1, 'M', u'㤺'), (0x2F8A2, 'M', u'㤜'), (0x2F8A3, 'M', u'悔'), (0x2F8A4, 'M', u'𢛔'), (0x2F8A5, 'M', u'惇'), (0x2F8A6, 'M', u'慈'), (0x2F8A7, 'M', u'慌'), (0x2F8A8, 'M', u'慎'), (0x2F8A9, 'M', u'慌'), (0x2F8AA, 'M', u'慺'), (0x2F8AB, 'M', u'憎'), (0x2F8AC, 'M', u'憲'), (0x2F8AD, 'M', u'憤'), (0x2F8AE, 'M', u'憯'), (0x2F8AF, 'M', u'懞'), (0x2F8B0, 'M', u'懲'), (0x2F8B1, 'M', u'懶'), (0x2F8B2, 'M', u'成'), (0x2F8B3, 'M', u'戛'), (0x2F8B4, 'M', u'扝'), (0x2F8B5, 'M', u'抱'), (0x2F8B6, 'M', u'拔'), (0x2F8B7, 'M', u'捐'), (0x2F8B8, 'M', u'𢬌'), (0x2F8B9, 'M', u'挽'), (0x2F8BA, 'M', u'拼'), (0x2F8BB, 'M', u'捨'), (0x2F8BC, 'M', u'掃'), (0x2F8BD, 'M', u'揤'), (0x2F8BE, 'M', u'𢯱'), (0x2F8BF, 'M', u'搢'), (0x2F8C0, 'M', u'揅'), (0x2F8C1, 'M', u'掩'), (0x2F8C2, 'M', u'㨮'), ] def _seg_76(): return [ (0x2F8C3, 'M', u'摩'), (0x2F8C4, 'M', u'摾'), (0x2F8C5, 'M', u'撝'), (0x2F8C6, 'M', u'摷'), (0x2F8C7, 'M', u'㩬'), (0x2F8C8, 'M', u'敏'), (0x2F8C9, 'M', u'敬'), (0x2F8CA, 'M', u'𣀊'), (0x2F8CB, 'M', u'旣'), (0x2F8CC, 'M', u'書'), (0x2F8CD, 'M', u'晉'), (0x2F8CE, 'M', u'㬙'), (0x2F8CF, 'M', u'暑'), (0x2F8D0, 'M', u'㬈'), (0x2F8D1, 'M', u'㫤'), (0x2F8D2, 'M', u'冒'), (0x2F8D3, 'M', u'冕'), (0x2F8D4, 'M', u'最'), (0x2F8D5, 'M', u'暜'), (0x2F8D6, 'M', u'肭'), (0x2F8D7, 'M', u'䏙'), (0x2F8D8, 'M', u'朗'), (0x2F8D9, 'M', u'望'), (0x2F8DA, 'M', u'朡'), (0x2F8DB, 'M', u'杞'), (0x2F8DC, 'M', u'杓'), (0x2F8DD, 'M', u'𣏃'), (0x2F8DE, 'M', u'㭉'), (0x2F8DF, 'M', u'柺'), (0x2F8E0, 'M', u'枅'), (0x2F8E1, 'M', u'桒'), (0x2F8E2, 'M', u'梅'), (0x2F8E3, 'M', u'𣑭'), (0x2F8E4, 'M', u'梎'), (0x2F8E5, 'M', u'栟'), (0x2F8E6, 'M', u'椔'), (0x2F8E7, 'M', u'㮝'), (0x2F8E8, 'M', u'楂'), (0x2F8E9, 'M', u'榣'), (0x2F8EA, 'M', u'槪'), (0x2F8EB, 'M', u'檨'), (0x2F8EC, 'M', u'𣚣'), (0x2F8ED, 'M', u'櫛'), (0x2F8EE, 'M', u'㰘'), (0x2F8EF, 'M', u'次'), (0x2F8F0, 'M', u'𣢧'), (0x2F8F1, 'M', u'歔'), (0x2F8F2, 'M', u'㱎'), (0x2F8F3, 'M', u'歲'), (0x2F8F4, 'M', u'殟'), (0x2F8F5, 'M', u'殺'), (0x2F8F6, 'M', u'殻'), (0x2F8F7, 'M', u'𣪍'), (0x2F8F8, 'M', u'𡴋'), (0x2F8F9, 'M', u'𣫺'), (0x2F8FA, 'M', u'汎'), (0x2F8FB, 'M', u'𣲼'), (0x2F8FC, 'M', u'沿'), (0x2F8FD, 'M', u'泍'), (0x2F8FE, 'M', u'汧'), (0x2F8FF, 'M', u'洖'), (0x2F900, 'M', u'派'), (0x2F901, 'M', u'海'), (0x2F902, 'M', u'流'), (0x2F903, 'M', u'浩'), (0x2F904, 'M', u'浸'), (0x2F905, 'M', u'涅'), (0x2F906, 'M', u'𣴞'), (0x2F907, 'M', u'洴'), (0x2F908, 'M', u'港'), (0x2F909, 'M', u'湮'), (0x2F90A, 'M', u'㴳'), (0x2F90B, 'M', u'滋'), (0x2F90C, 'M', u'滇'), (0x2F90D, 'M', u'𣻑'), (0x2F90E, 'M', u'淹'), (0x2F90F, 'M', u'潮'), (0x2F910, 'M', u'𣽞'), (0x2F911, 'M', u'𣾎'), (0x2F912, 'M', u'濆'), (0x2F913, 'M', u'瀹'), (0x2F914, 'M', u'瀞'), (0x2F915, 'M', u'瀛'), (0x2F916, 'M', u'㶖'), (0x2F917, 'M', u'灊'), (0x2F918, 'M', u'災'), (0x2F919, 'M', u'灷'), (0x2F91A, 'M', u'炭'), (0x2F91B, 'M', u'𠔥'), (0x2F91C, 'M', u'煅'), (0x2F91D, 'M', u'𤉣'), (0x2F91E, 'M', u'熜'), (0x2F91F, 'X'), (0x2F920, 'M', u'爨'), (0x2F921, 'M', u'爵'), (0x2F922, 'M', u'牐'), (0x2F923, 'M', u'𤘈'), (0x2F924, 'M', u'犀'), (0x2F925, 'M', u'犕'), (0x2F926, 'M', u'𤜵'), ] def _seg_77(): return [ (0x2F927, 'M', u'𤠔'), (0x2F928, 'M', u'獺'), (0x2F929, 'M', u'王'), (0x2F92A, 'M', u'㺬'), (0x2F92B, 'M', u'玥'), (0x2F92C, 'M', u'㺸'), (0x2F92E, 'M', u'瑇'), (0x2F92F, 'M', u'瑜'), (0x2F930, 'M', u'瑱'), (0x2F931, 'M', u'璅'), (0x2F932, 'M', u'瓊'), (0x2F933, 'M', u'㼛'), (0x2F934, 'M', u'甤'), (0x2F935, 'M', u'𤰶'), (0x2F936, 'M', u'甾'), (0x2F937, 'M', u'𤲒'), (0x2F938, 'M', u'異'), (0x2F939, 'M', u'𢆟'), (0x2F93A, 'M', u'瘐'), (0x2F93B, 'M', u'𤾡'), (0x2F93C, 'M', u'𤾸'), (0x2F93D, 'M', u'𥁄'), (0x2F93E, 'M', u'㿼'), (0x2F93F, 'M', u'䀈'), (0x2F940, 'M', u'直'), (0x2F941, 'M', u'𥃳'), (0x2F942, 'M', u'𥃲'), (0x2F943, 'M', u'𥄙'), (0x2F944, 'M', u'𥄳'), (0x2F945, 'M', u'眞'), (0x2F946, 'M', u'真'), (0x2F948, 'M', u'睊'), (0x2F949, 'M', u'䀹'), (0x2F94A, 'M', u'瞋'), (0x2F94B, 'M', u'䁆'), (0x2F94C, 'M', u'䂖'), (0x2F94D, 'M', u'𥐝'), (0x2F94E, 'M', u'硎'), (0x2F94F, 'M', u'碌'), (0x2F950, 'M', u'磌'), (0x2F951, 'M', u'䃣'), (0x2F952, 'M', u'𥘦'), (0x2F953, 'M', u'祖'), (0x2F954, 'M', u'𥚚'), (0x2F955, 'M', u'𥛅'), (0x2F956, 'M', u'福'), (0x2F957, 'M', u'秫'), (0x2F958, 'M', u'䄯'), (0x2F959, 'M', u'穀'), (0x2F95A, 'M', u'穊'), (0x2F95B, 'M', u'穏'), (0x2F95C, 'M', u'𥥼'), (0x2F95D, 'M', u'𥪧'), (0x2F95F, 'X'), (0x2F960, 'M', u'䈂'), (0x2F961, 'M', u'𥮫'), (0x2F962, 'M', u'篆'), (0x2F963, 'M', u'築'), (0x2F964, 'M', u'䈧'), (0x2F965, 'M', u'𥲀'), (0x2F966, 'M', u'糒'), (0x2F967, 'M', u'䊠'), (0x2F968, 'M', u'糨'), (0x2F969, 'M', u'糣'), (0x2F96A, 'M', u'紀'), (0x2F96B, 'M', u'𥾆'), (0x2F96C, 'M', u'絣'), (0x2F96D, 'M', u'䌁'), (0x2F96E, 'M', u'緇'), (0x2F96F, 'M', u'縂'), (0x2F970, 'M', u'繅'), (0x2F971, 'M', u'䌴'), (0x2F972, 'M', u'𦈨'), (0x2F973, 'M', u'𦉇'), (0x2F974, 'M', u'䍙'), (0x2F975, 'M', u'𦋙'), (0x2F976, 'M', u'罺'), (0x2F977, 'M', u'𦌾'), (0x2F978, 'M', u'羕'), (0x2F979, 'M', u'翺'), (0x2F97A, 'M', u'者'), (0x2F97B, 'M', u'𦓚'), (0x2F97C, 'M', u'𦔣'), (0x2F97D, 'M', u'聠'), (0x2F97E, 'M', u'𦖨'), (0x2F97F, 'M', u'聰'), (0x2F980, 'M', u'𣍟'), (0x2F981, 'M', u'䏕'), (0x2F982, 'M', u'育'), (0x2F983, 'M', u'脃'), (0x2F984, 'M', u'䐋'), (0x2F985, 'M', u'脾'), (0x2F986, 'M', u'媵'), (0x2F987, 'M', u'𦞧'), (0x2F988, 'M', u'𦞵'), (0x2F989, 'M', u'𣎓'), (0x2F98A, 'M', u'𣎜'), (0x2F98B, 'M', u'舁'), (0x2F98C, 'M', u'舄'), (0x2F98D, 'M', u'辞'), ] def _seg_78(): return [ (0x2F98E, 'M', u'䑫'), (0x2F98F, 'M', u'芑'), (0x2F990, 'M', u'芋'), (0x2F991, 'M', u'芝'), (0x2F992, 'M', u'劳'), (0x2F993, 'M', u'花'), (0x2F994, 'M', u'芳'), (0x2F995, 'M', u'芽'), (0x2F996, 'M', u'苦'), (0x2F997, 'M', u'𦬼'), (0x2F998, 'M', u'若'), (0x2F999, 'M', u'茝'), (0x2F99A, 'M', u'荣'), (0x2F99B, 'M', u'莭'), (0x2F99C, 'M', u'茣'), (0x2F99D, 'M', u'莽'), (0x2F99E, 'M', u'菧'), (0x2F99F, 'M', u'著'), (0x2F9A0, 'M', u'荓'), (0x2F9A1, 'M', u'菊'), (0x2F9A2, 'M', u'菌'), (0x2F9A3, 'M', u'菜'), (0x2F9A4, 'M', u'𦰶'), (0x2F9A5, 'M', u'𦵫'), (0x2F9A6, 'M', u'𦳕'), (0x2F9A7, 'M', u'䔫'), (0x2F9A8, 'M', u'蓱'), (0x2F9A9, 'M', u'蓳'), (0x2F9AA, 'M', u'蔖'), (0x2F9AB, 'M', u'𧏊'), (0x2F9AC, 'M', u'蕤'), (0x2F9AD, 'M', u'𦼬'), (0x2F9AE, 'M', u'䕝'), (0x2F9AF, 'M', u'䕡'), (0x2F9B0, 'M', u'𦾱'), (0x2F9B1, 'M', u'𧃒'), (0x2F9B2, 'M', u'䕫'), (0x2F9B3, 'M', u'虐'), (0x2F9B4, 'M', u'虜'), (0x2F9B5, 'M', u'虧'), (0x2F9B6, 'M', u'虩'), (0x2F9B7, 'M', u'蚩'), (0x2F9B8, 'M', u'蚈'), (0x2F9B9, 'M', u'蜎'), (0x2F9BA, 'M', u'蛢'), (0x2F9BB, 'M', u'蝹'), (0x2F9BC, 'M', u'蜨'), (0x2F9BD, 'M', u'蝫'), (0x2F9BE, 'M', u'螆'), (0x2F9BF, 'X'), (0x2F9C0, 'M', u'蟡'), (0x2F9C1, 'M', u'蠁'), (0x2F9C2, 'M', u'䗹'), (0x2F9C3, 'M', u'衠'), (0x2F9C4, 'M', u'衣'), (0x2F9C5, 'M', u'𧙧'), (0x2F9C6, 'M', u'裗'), (0x2F9C7, 'M', u'裞'), (0x2F9C8, 'M', u'䘵'), (0x2F9C9, 'M', u'裺'), (0x2F9CA, 'M', u'㒻'), (0x2F9CB, 'M', u'𧢮'), (0x2F9CC, 'M', u'𧥦'), (0x2F9CD, 'M', u'䚾'), (0x2F9CE, 'M', u'䛇'), (0x2F9CF, 'M', u'誠'), (0x2F9D0, 'M', u'諭'), (0x2F9D1, 'M', u'變'), (0x2F9D2, 'M', u'豕'), (0x2F9D3, 'M', u'𧲨'), (0x2F9D4, 'M', u'貫'), (0x2F9D5, 'M', u'賁'), (0x2F9D6, 'M', u'贛'), (0x2F9D7, 'M', u'起'), (0x2F9D8, 'M', u'𧼯'), (0x2F9D9, 'M', u'𠠄'), (0x2F9DA, 'M', u'跋'), (0x2F9DB, 'M', u'趼'), (0x2F9DC, 'M', u'跰'), (0x2F9DD, 'M', u'𠣞'), (0x2F9DE, 'M', u'軔'), (0x2F9DF, 'M', u'輸'), (0x2F9E0, 'M', u'𨗒'), (0x2F9E1, 'M', u'𨗭'), (0x2F9E2, 'M', u'邔'), (0x2F9E3, 'M', u'郱'), (0x2F9E4, 'M', u'鄑'), (0x2F9E5, 'M', u'𨜮'), (0x2F9E6, 'M', u'鄛'), (0x2F9E7, 'M', u'鈸'), (0x2F9E8, 'M', u'鋗'), (0x2F9E9, 'M', u'鋘'), (0x2F9EA, 'M', u'鉼'), (0x2F9EB, 'M', u'鏹'), (0x2F9EC, 'M', u'鐕'), (0x2F9ED, 'M', u'𨯺'), (0x2F9EE, 'M', u'開'), (0x2F9EF, 'M', u'䦕'), (0x2F9F0, 'M', u'閷'), (0x2F9F1, 'M', u'𨵷'), ] def _seg_79(): return [ (0x2F9F2, 'M', u'䧦'), (0x2F9F3, 'M', u'雃'), (0x2F9F4, 'M', u'嶲'), (0x2F9F5, 'M', u'霣'), (0x2F9F6, 'M', u'𩅅'), (0x2F9F7, 'M', u'𩈚'), (0x2F9F8, 'M', u'䩮'), (0x2F9F9, 'M', u'䩶'), (0x2F9FA, 'M', u'韠'), (0x2F9FB, 'M', u'𩐊'), (0x2F9FC, 'M', u'䪲'), (0x2F9FD, 'M', u'𩒖'), (0x2F9FE, 'M', u'頋'), (0x2FA00, 'M', u'頩'), (0x2FA01, 'M', u'𩖶'), (0x2FA02, 'M', u'飢'), (0x2FA03, 'M', u'䬳'), (0x2FA04, 'M', u'餩'), (0x2FA05, 'M', u'馧'), (0x2FA06, 'M', u'駂'), (0x2FA07, 'M', u'駾'), (0x2FA08, 'M', u'䯎'), (0x2FA09, 'M', u'𩬰'), (0x2FA0A, 'M', u'鬒'), (0x2FA0B, 'M', u'鱀'), (0x2FA0C, 'M', u'鳽'), (0x2FA0D, 'M', u'䳎'), (0x2FA0E, 'M', u'䳭'), (0x2FA0F, 'M', u'鵧'), (0x2FA10, 'M', u'𪃎'), (0x2FA11, 'M', u'䳸'), (0x2FA12, 'M', u'𪄅'), (0x2FA13, 'M', u'𪈎'), (0x2FA14, 'M', u'𪊑'), (0x2FA15, 'M', u'麻'), (0x2FA16, 'M', u'䵖'), (0x2FA17, 'M', u'黹'), (0x2FA18, 'M', u'黾'), (0x2FA19, 'M', u'鼅'), (0x2FA1A, 'M', u'鼏'), (0x2FA1B, 'M', u'鼖'), (0x2FA1C, 'M', u'鼻'), (0x2FA1D, 'M', u'𪘀'), (0x2FA1E, 'X'), (0x30000, 'V'), (0x3134B, 'X'), (0xE0100, 'I'), (0xE01F0, 'X'), ] uts46data = tuple( _seg_0() + _seg_1() + _seg_2() + _seg_3() + _seg_4() + _seg_5() + _seg_6() + _seg_7() + _seg_8() + _seg_9() + _seg_10() + _seg_11() + _seg_12() + _seg_13() + _seg_14() + _seg_15() + _seg_16() + _seg_17() + _seg_18() + _seg_19() + _seg_20() + _seg_21() + _seg_22() + _seg_23() + _seg_24() + _seg_25() + _seg_26() + _seg_27() + _seg_28() + _seg_29() + _seg_30() + _seg_31() + _seg_32() + _seg_33() + _seg_34() + _seg_35() + _seg_36() + _seg_37() + _seg_38() + _seg_39() + _seg_40() + _seg_41() + _seg_42() + _seg_43() + _seg_44() + _seg_45() + _seg_46() + _seg_47() + _seg_48() + _seg_49() + _seg_50() + _seg_51() + _seg_52() + _seg_53() + _seg_54() + _seg_55() + _seg_56() + _seg_57() + _seg_58() + _seg_59() + _seg_60() + _seg_61() + _seg_62() + _seg_63() + _seg_64() + _seg_65() + _seg_66() + _seg_67() + _seg_68() + _seg_69() + _seg_70() + _seg_71() + _seg_72() + _seg_73() + _seg_74() + _seg_75() + _seg_76() + _seg_77() + _seg_78() + _seg_79() ) idna/intranges.py000064400000003325152347724720010043 0ustar00""" Given a list of integers, made up of (hopefully) a small number of long runs of consecutive integers, compute a representation of the form ((start1, end1), (start2, end2) ...). Then answer the question "was x present in the original list?" in time O(log(# runs)). """ import bisect def intranges_from_list(list_): """Represent a list of integers as a sequence of ranges: ((start_0, end_0), (start_1, end_1), ...), such that the original integers are exactly those x such that start_i <= x < end_i for some i. Ranges are encoded as single integers (start << 32 | end), not as tuples. """ sorted_list = sorted(list_) ranges = [] last_write = -1 for i in range(len(sorted_list)): if i+1 < len(sorted_list): if sorted_list[i] == sorted_list[i+1]-1: continue current_range = sorted_list[last_write+1:i+1] ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) last_write = i return tuple(ranges) def _encode_range(start, end): return (start << 32) | end def _decode_range(r): return (r >> 32), (r & ((1 << 32) - 1)) def intranges_contain(int_, ranges): """Determine if `int_` falls into one of the ranges in `ranges`.""" tuple_ = _encode_range(int_, 0) pos = bisect.bisect_left(ranges, tuple_) # we could be immediately ahead of a tuple (start, end) # with start < int_ <= end if pos > 0: left, right = _decode_range(ranges[pos-1]) if left <= int_ < right: return True # or we could be immediately behind a tuple (int_, end) if pos < len(ranges): left, _ = _decode_range(ranges[pos]) if left == int_: return True return False idna/idnadata.py000064400000122556152347724720007626 0ustar00# This file is automatically generated by tools/idna-data __version__ = "13.0.0" scripts = { 'Greek': ( 0x37000000374, 0x37500000378, 0x37a0000037e, 0x37f00000380, 0x38400000385, 0x38600000387, 0x3880000038b, 0x38c0000038d, 0x38e000003a2, 0x3a3000003e2, 0x3f000000400, 0x1d2600001d2b, 0x1d5d00001d62, 0x1d6600001d6b, 0x1dbf00001dc0, 0x1f0000001f16, 0x1f1800001f1e, 0x1f2000001f46, 0x1f4800001f4e, 0x1f5000001f58, 0x1f5900001f5a, 0x1f5b00001f5c, 0x1f5d00001f5e, 0x1f5f00001f7e, 0x1f8000001fb5, 0x1fb600001fc5, 0x1fc600001fd4, 0x1fd600001fdc, 0x1fdd00001ff0, 0x1ff200001ff5, 0x1ff600001fff, 0x212600002127, 0xab650000ab66, 0x101400001018f, 0x101a0000101a1, 0x1d2000001d246, ), 'Han': ( 0x2e8000002e9a, 0x2e9b00002ef4, 0x2f0000002fd6, 0x300500003006, 0x300700003008, 0x30210000302a, 0x30380000303c, 0x340000004dc0, 0x4e0000009ffd, 0xf9000000fa6e, 0xfa700000fada, 0x16ff000016ff2, 0x200000002a6de, 0x2a7000002b735, 0x2b7400002b81e, 0x2b8200002cea2, 0x2ceb00002ebe1, 0x2f8000002fa1e, 0x300000003134b, ), 'Hebrew': ( 0x591000005c8, 0x5d0000005eb, 0x5ef000005f5, 0xfb1d0000fb37, 0xfb380000fb3d, 0xfb3e0000fb3f, 0xfb400000fb42, 0xfb430000fb45, 0xfb460000fb50, ), 'Hiragana': ( 0x304100003097, 0x309d000030a0, 0x1b0010001b11f, 0x1b1500001b153, 0x1f2000001f201, ), 'Katakana': ( 0x30a1000030fb, 0x30fd00003100, 0x31f000003200, 0x32d0000032ff, 0x330000003358, 0xff660000ff70, 0xff710000ff9e, 0x1b0000001b001, 0x1b1640001b168, ), } joining_types = { 0x600: 85, 0x601: 85, 0x602: 85, 0x603: 85, 0x604: 85, 0x605: 85, 0x608: 85, 0x60b: 85, 0x620: 68, 0x621: 85, 0x622: 82, 0x623: 82, 0x624: 82, 0x625: 82, 0x626: 68, 0x627: 82, 0x628: 68, 0x629: 82, 0x62a: 68, 0x62b: 68, 0x62c: 68, 0x62d: 68, 0x62e: 68, 0x62f: 82, 0x630: 82, 0x631: 82, 0x632: 82, 0x633: 68, 0x634: 68, 0x635: 68, 0x636: 68, 0x637: 68, 0x638: 68, 0x639: 68, 0x63a: 68, 0x63b: 68, 0x63c: 68, 0x63d: 68, 0x63e: 68, 0x63f: 68, 0x640: 67, 0x641: 68, 0x642: 68, 0x643: 68, 0x644: 68, 0x645: 68, 0x646: 68, 0x647: 68, 0x648: 82, 0x649: 68, 0x64a: 68, 0x66e: 68, 0x66f: 68, 0x671: 82, 0x672: 82, 0x673: 82, 0x674: 85, 0x675: 82, 0x676: 82, 0x677: 82, 0x678: 68, 0x679: 68, 0x67a: 68, 0x67b: 68, 0x67c: 68, 0x67d: 68, 0x67e: 68, 0x67f: 68, 0x680: 68, 0x681: 68, 0x682: 68, 0x683: 68, 0x684: 68, 0x685: 68, 0x686: 68, 0x687: 68, 0x688: 82, 0x689: 82, 0x68a: 82, 0x68b: 82, 0x68c: 82, 0x68d: 82, 0x68e: 82, 0x68f: 82, 0x690: 82, 0x691: 82, 0x692: 82, 0x693: 82, 0x694: 82, 0x695: 82, 0x696: 82, 0x697: 82, 0x698: 82, 0x699: 82, 0x69a: 68, 0x69b: 68, 0x69c: 68, 0x69d: 68, 0x69e: 68, 0x69f: 68, 0x6a0: 68, 0x6a1: 68, 0x6a2: 68, 0x6a3: 68, 0x6a4: 68, 0x6a5: 68, 0x6a6: 68, 0x6a7: 68, 0x6a8: 68, 0x6a9: 68, 0x6aa: 68, 0x6ab: 68, 0x6ac: 68, 0x6ad: 68, 0x6ae: 68, 0x6af: 68, 0x6b0: 68, 0x6b1: 68, 0x6b2: 68, 0x6b3: 68, 0x6b4: 68, 0x6b5: 68, 0x6b6: 68, 0x6b7: 68, 0x6b8: 68, 0x6b9: 68, 0x6ba: 68, 0x6bb: 68, 0x6bc: 68, 0x6bd: 68, 0x6be: 68, 0x6bf: 68, 0x6c0: 82, 0x6c1: 68, 0x6c2: 68, 0x6c3: 82, 0x6c4: 82, 0x6c5: 82, 0x6c6: 82, 0x6c7: 82, 0x6c8: 82, 0x6c9: 82, 0x6ca: 82, 0x6cb: 82, 0x6cc: 68, 0x6cd: 82, 0x6ce: 68, 0x6cf: 82, 0x6d0: 68, 0x6d1: 68, 0x6d2: 82, 0x6d3: 82, 0x6d5: 82, 0x6dd: 85, 0x6ee: 82, 0x6ef: 82, 0x6fa: 68, 0x6fb: 68, 0x6fc: 68, 0x6ff: 68, 0x70f: 84, 0x710: 82, 0x712: 68, 0x713: 68, 0x714: 68, 0x715: 82, 0x716: 82, 0x717: 82, 0x718: 82, 0x719: 82, 0x71a: 68, 0x71b: 68, 0x71c: 68, 0x71d: 68, 0x71e: 82, 0x71f: 68, 0x720: 68, 0x721: 68, 0x722: 68, 0x723: 68, 0x724: 68, 0x725: 68, 0x726: 68, 0x727: 68, 0x728: 82, 0x729: 68, 0x72a: 82, 0x72b: 68, 0x72c: 82, 0x72d: 68, 0x72e: 68, 0x72f: 82, 0x74d: 82, 0x74e: 68, 0x74f: 68, 0x750: 68, 0x751: 68, 0x752: 68, 0x753: 68, 0x754: 68, 0x755: 68, 0x756: 68, 0x757: 68, 0x758: 68, 0x759: 82, 0x75a: 82, 0x75b: 82, 0x75c: 68, 0x75d: 68, 0x75e: 68, 0x75f: 68, 0x760: 68, 0x761: 68, 0x762: 68, 0x763: 68, 0x764: 68, 0x765: 68, 0x766: 68, 0x767: 68, 0x768: 68, 0x769: 68, 0x76a: 68, 0x76b: 82, 0x76c: 82, 0x76d: 68, 0x76e: 68, 0x76f: 68, 0x770: 68, 0x771: 82, 0x772: 68, 0x773: 82, 0x774: 82, 0x775: 68, 0x776: 68, 0x777: 68, 0x778: 82, 0x779: 82, 0x77a: 68, 0x77b: 68, 0x77c: 68, 0x77d: 68, 0x77e: 68, 0x77f: 68, 0x7ca: 68, 0x7cb: 68, 0x7cc: 68, 0x7cd: 68, 0x7ce: 68, 0x7cf: 68, 0x7d0: 68, 0x7d1: 68, 0x7d2: 68, 0x7d3: 68, 0x7d4: 68, 0x7d5: 68, 0x7d6: 68, 0x7d7: 68, 0x7d8: 68, 0x7d9: 68, 0x7da: 68, 0x7db: 68, 0x7dc: 68, 0x7dd: 68, 0x7de: 68, 0x7df: 68, 0x7e0: 68, 0x7e1: 68, 0x7e2: 68, 0x7e3: 68, 0x7e4: 68, 0x7e5: 68, 0x7e6: 68, 0x7e7: 68, 0x7e8: 68, 0x7e9: 68, 0x7ea: 68, 0x7fa: 67, 0x840: 82, 0x841: 68, 0x842: 68, 0x843: 68, 0x844: 68, 0x845: 68, 0x846: 82, 0x847: 82, 0x848: 68, 0x849: 82, 0x84a: 68, 0x84b: 68, 0x84c: 68, 0x84d: 68, 0x84e: 68, 0x84f: 68, 0x850: 68, 0x851: 68, 0x852: 68, 0x853: 68, 0x854: 82, 0x855: 68, 0x856: 82, 0x857: 82, 0x858: 82, 0x860: 68, 0x861: 85, 0x862: 68, 0x863: 68, 0x864: 68, 0x865: 68, 0x866: 85, 0x867: 82, 0x868: 68, 0x869: 82, 0x86a: 82, 0x8a0: 68, 0x8a1: 68, 0x8a2: 68, 0x8a3: 68, 0x8a4: 68, 0x8a5: 68, 0x8a6: 68, 0x8a7: 68, 0x8a8: 68, 0x8a9: 68, 0x8aa: 82, 0x8ab: 82, 0x8ac: 82, 0x8ad: 85, 0x8ae: 82, 0x8af: 68, 0x8b0: 68, 0x8b1: 82, 0x8b2: 82, 0x8b3: 68, 0x8b4: 68, 0x8b6: 68, 0x8b7: 68, 0x8b8: 68, 0x8b9: 82, 0x8ba: 68, 0x8bb: 68, 0x8bc: 68, 0x8bd: 68, 0x8be: 68, 0x8bf: 68, 0x8c0: 68, 0x8c1: 68, 0x8c2: 68, 0x8c3: 68, 0x8c4: 68, 0x8c5: 68, 0x8c6: 68, 0x8c7: 68, 0x8e2: 85, 0x1806: 85, 0x1807: 68, 0x180a: 67, 0x180e: 85, 0x1820: 68, 0x1821: 68, 0x1822: 68, 0x1823: 68, 0x1824: 68, 0x1825: 68, 0x1826: 68, 0x1827: 68, 0x1828: 68, 0x1829: 68, 0x182a: 68, 0x182b: 68, 0x182c: 68, 0x182d: 68, 0x182e: 68, 0x182f: 68, 0x1830: 68, 0x1831: 68, 0x1832: 68, 0x1833: 68, 0x1834: 68, 0x1835: 68, 0x1836: 68, 0x1837: 68, 0x1838: 68, 0x1839: 68, 0x183a: 68, 0x183b: 68, 0x183c: 68, 0x183d: 68, 0x183e: 68, 0x183f: 68, 0x1840: 68, 0x1841: 68, 0x1842: 68, 0x1843: 68, 0x1844: 68, 0x1845: 68, 0x1846: 68, 0x1847: 68, 0x1848: 68, 0x1849: 68, 0x184a: 68, 0x184b: 68, 0x184c: 68, 0x184d: 68, 0x184e: 68, 0x184f: 68, 0x1850: 68, 0x1851: 68, 0x1852: 68, 0x1853: 68, 0x1854: 68, 0x1855: 68, 0x1856: 68, 0x1857: 68, 0x1858: 68, 0x1859: 68, 0x185a: 68, 0x185b: 68, 0x185c: 68, 0x185d: 68, 0x185e: 68, 0x185f: 68, 0x1860: 68, 0x1861: 68, 0x1862: 68, 0x1863: 68, 0x1864: 68, 0x1865: 68, 0x1866: 68, 0x1867: 68, 0x1868: 68, 0x1869: 68, 0x186a: 68, 0x186b: 68, 0x186c: 68, 0x186d: 68, 0x186e: 68, 0x186f: 68, 0x1870: 68, 0x1871: 68, 0x1872: 68, 0x1873: 68, 0x1874: 68, 0x1875: 68, 0x1876: 68, 0x1877: 68, 0x1878: 68, 0x1880: 85, 0x1881: 85, 0x1882: 85, 0x1883: 85, 0x1884: 85, 0x1885: 84, 0x1886: 84, 0x1887: 68, 0x1888: 68, 0x1889: 68, 0x188a: 68, 0x188b: 68, 0x188c: 68, 0x188d: 68, 0x188e: 68, 0x188f: 68, 0x1890: 68, 0x1891: 68, 0x1892: 68, 0x1893: 68, 0x1894: 68, 0x1895: 68, 0x1896: 68, 0x1897: 68, 0x1898: 68, 0x1899: 68, 0x189a: 68, 0x189b: 68, 0x189c: 68, 0x189d: 68, 0x189e: 68, 0x189f: 68, 0x18a0: 68, 0x18a1: 68, 0x18a2: 68, 0x18a3: 68, 0x18a4: 68, 0x18a5: 68, 0x18a6: 68, 0x18a7: 68, 0x18a8: 68, 0x18aa: 68, 0x200c: 85, 0x200d: 67, 0x202f: 85, 0x2066: 85, 0x2067: 85, 0x2068: 85, 0x2069: 85, 0xa840: 68, 0xa841: 68, 0xa842: 68, 0xa843: 68, 0xa844: 68, 0xa845: 68, 0xa846: 68, 0xa847: 68, 0xa848: 68, 0xa849: 68, 0xa84a: 68, 0xa84b: 68, 0xa84c: 68, 0xa84d: 68, 0xa84e: 68, 0xa84f: 68, 0xa850: 68, 0xa851: 68, 0xa852: 68, 0xa853: 68, 0xa854: 68, 0xa855: 68, 0xa856: 68, 0xa857: 68, 0xa858: 68, 0xa859: 68, 0xa85a: 68, 0xa85b: 68, 0xa85c: 68, 0xa85d: 68, 0xa85e: 68, 0xa85f: 68, 0xa860: 68, 0xa861: 68, 0xa862: 68, 0xa863: 68, 0xa864: 68, 0xa865: 68, 0xa866: 68, 0xa867: 68, 0xa868: 68, 0xa869: 68, 0xa86a: 68, 0xa86b: 68, 0xa86c: 68, 0xa86d: 68, 0xa86e: 68, 0xa86f: 68, 0xa870: 68, 0xa871: 68, 0xa872: 76, 0xa873: 85, 0x10ac0: 68, 0x10ac1: 68, 0x10ac2: 68, 0x10ac3: 68, 0x10ac4: 68, 0x10ac5: 82, 0x10ac6: 85, 0x10ac7: 82, 0x10ac8: 85, 0x10ac9: 82, 0x10aca: 82, 0x10acb: 85, 0x10acc: 85, 0x10acd: 76, 0x10ace: 82, 0x10acf: 82, 0x10ad0: 82, 0x10ad1: 82, 0x10ad2: 82, 0x10ad3: 68, 0x10ad4: 68, 0x10ad5: 68, 0x10ad6: 68, 0x10ad7: 76, 0x10ad8: 68, 0x10ad9: 68, 0x10ada: 68, 0x10adb: 68, 0x10adc: 68, 0x10add: 82, 0x10ade: 68, 0x10adf: 68, 0x10ae0: 68, 0x10ae1: 82, 0x10ae2: 85, 0x10ae3: 85, 0x10ae4: 82, 0x10aeb: 68, 0x10aec: 68, 0x10aed: 68, 0x10aee: 68, 0x10aef: 82, 0x10b80: 68, 0x10b81: 82, 0x10b82: 68, 0x10b83: 82, 0x10b84: 82, 0x10b85: 82, 0x10b86: 68, 0x10b87: 68, 0x10b88: 68, 0x10b89: 82, 0x10b8a: 68, 0x10b8b: 68, 0x10b8c: 82, 0x10b8d: 68, 0x10b8e: 82, 0x10b8f: 82, 0x10b90: 68, 0x10b91: 82, 0x10ba9: 82, 0x10baa: 82, 0x10bab: 82, 0x10bac: 82, 0x10bad: 68, 0x10bae: 68, 0x10baf: 85, 0x10d00: 76, 0x10d01: 68, 0x10d02: 68, 0x10d03: 68, 0x10d04: 68, 0x10d05: 68, 0x10d06: 68, 0x10d07: 68, 0x10d08: 68, 0x10d09: 68, 0x10d0a: 68, 0x10d0b: 68, 0x10d0c: 68, 0x10d0d: 68, 0x10d0e: 68, 0x10d0f: 68, 0x10d10: 68, 0x10d11: 68, 0x10d12: 68, 0x10d13: 68, 0x10d14: 68, 0x10d15: 68, 0x10d16: 68, 0x10d17: 68, 0x10d18: 68, 0x10d19: 68, 0x10d1a: 68, 0x10d1b: 68, 0x10d1c: 68, 0x10d1d: 68, 0x10d1e: 68, 0x10d1f: 68, 0x10d20: 68, 0x10d21: 68, 0x10d22: 82, 0x10d23: 68, 0x10f30: 68, 0x10f31: 68, 0x10f32: 68, 0x10f33: 82, 0x10f34: 68, 0x10f35: 68, 0x10f36: 68, 0x10f37: 68, 0x10f38: 68, 0x10f39: 68, 0x10f3a: 68, 0x10f3b: 68, 0x10f3c: 68, 0x10f3d: 68, 0x10f3e: 68, 0x10f3f: 68, 0x10f40: 68, 0x10f41: 68, 0x10f42: 68, 0x10f43: 68, 0x10f44: 68, 0x10f45: 85, 0x10f51: 68, 0x10f52: 68, 0x10f53: 68, 0x10f54: 82, 0x10fb0: 68, 0x10fb1: 85, 0x10fb2: 68, 0x10fb3: 68, 0x10fb4: 82, 0x10fb5: 82, 0x10fb6: 82, 0x10fb7: 85, 0x10fb8: 68, 0x10fb9: 82, 0x10fba: 82, 0x10fbb: 68, 0x10fbc: 68, 0x10fbd: 82, 0x10fbe: 68, 0x10fbf: 68, 0x10fc0: 85, 0x10fc1: 68, 0x10fc2: 82, 0x10fc3: 82, 0x10fc4: 68, 0x10fc5: 85, 0x10fc6: 85, 0x10fc7: 85, 0x10fc8: 85, 0x10fc9: 82, 0x10fca: 68, 0x10fcb: 76, 0x110bd: 85, 0x110cd: 85, 0x1e900: 68, 0x1e901: 68, 0x1e902: 68, 0x1e903: 68, 0x1e904: 68, 0x1e905: 68, 0x1e906: 68, 0x1e907: 68, 0x1e908: 68, 0x1e909: 68, 0x1e90a: 68, 0x1e90b: 68, 0x1e90c: 68, 0x1e90d: 68, 0x1e90e: 68, 0x1e90f: 68, 0x1e910: 68, 0x1e911: 68, 0x1e912: 68, 0x1e913: 68, 0x1e914: 68, 0x1e915: 68, 0x1e916: 68, 0x1e917: 68, 0x1e918: 68, 0x1e919: 68, 0x1e91a: 68, 0x1e91b: 68, 0x1e91c: 68, 0x1e91d: 68, 0x1e91e: 68, 0x1e91f: 68, 0x1e920: 68, 0x1e921: 68, 0x1e922: 68, 0x1e923: 68, 0x1e924: 68, 0x1e925: 68, 0x1e926: 68, 0x1e927: 68, 0x1e928: 68, 0x1e929: 68, 0x1e92a: 68, 0x1e92b: 68, 0x1e92c: 68, 0x1e92d: 68, 0x1e92e: 68, 0x1e92f: 68, 0x1e930: 68, 0x1e931: 68, 0x1e932: 68, 0x1e933: 68, 0x1e934: 68, 0x1e935: 68, 0x1e936: 68, 0x1e937: 68, 0x1e938: 68, 0x1e939: 68, 0x1e93a: 68, 0x1e93b: 68, 0x1e93c: 68, 0x1e93d: 68, 0x1e93e: 68, 0x1e93f: 68, 0x1e940: 68, 0x1e941: 68, 0x1e942: 68, 0x1e943: 68, 0x1e94b: 84, } codepoint_classes = { 'PVALID': ( 0x2d0000002e, 0x300000003a, 0x610000007b, 0xdf000000f7, 0xf800000100, 0x10100000102, 0x10300000104, 0x10500000106, 0x10700000108, 0x1090000010a, 0x10b0000010c, 0x10d0000010e, 0x10f00000110, 0x11100000112, 0x11300000114, 0x11500000116, 0x11700000118, 0x1190000011a, 0x11b0000011c, 0x11d0000011e, 0x11f00000120, 0x12100000122, 0x12300000124, 0x12500000126, 0x12700000128, 0x1290000012a, 0x12b0000012c, 0x12d0000012e, 0x12f00000130, 0x13100000132, 0x13500000136, 0x13700000139, 0x13a0000013b, 0x13c0000013d, 0x13e0000013f, 0x14200000143, 0x14400000145, 0x14600000147, 0x14800000149, 0x14b0000014c, 0x14d0000014e, 0x14f00000150, 0x15100000152, 0x15300000154, 0x15500000156, 0x15700000158, 0x1590000015a, 0x15b0000015c, 0x15d0000015e, 0x15f00000160, 0x16100000162, 0x16300000164, 0x16500000166, 0x16700000168, 0x1690000016a, 0x16b0000016c, 0x16d0000016e, 0x16f00000170, 0x17100000172, 0x17300000174, 0x17500000176, 0x17700000178, 0x17a0000017b, 0x17c0000017d, 0x17e0000017f, 0x18000000181, 0x18300000184, 0x18500000186, 0x18800000189, 0x18c0000018e, 0x19200000193, 0x19500000196, 0x1990000019c, 0x19e0000019f, 0x1a1000001a2, 0x1a3000001a4, 0x1a5000001a6, 0x1a8000001a9, 0x1aa000001ac, 0x1ad000001ae, 0x1b0000001b1, 0x1b4000001b5, 0x1b6000001b7, 0x1b9000001bc, 0x1bd000001c4, 0x1ce000001cf, 0x1d0000001d1, 0x1d2000001d3, 0x1d4000001d5, 0x1d6000001d7, 0x1d8000001d9, 0x1da000001db, 0x1dc000001de, 0x1df000001e0, 0x1e1000001e2, 0x1e3000001e4, 0x1e5000001e6, 0x1e7000001e8, 0x1e9000001ea, 0x1eb000001ec, 0x1ed000001ee, 0x1ef000001f1, 0x1f5000001f6, 0x1f9000001fa, 0x1fb000001fc, 0x1fd000001fe, 0x1ff00000200, 0x20100000202, 0x20300000204, 0x20500000206, 0x20700000208, 0x2090000020a, 0x20b0000020c, 0x20d0000020e, 0x20f00000210, 0x21100000212, 0x21300000214, 0x21500000216, 0x21700000218, 0x2190000021a, 0x21b0000021c, 0x21d0000021e, 0x21f00000220, 0x22100000222, 0x22300000224, 0x22500000226, 0x22700000228, 0x2290000022a, 0x22b0000022c, 0x22d0000022e, 0x22f00000230, 0x23100000232, 0x2330000023a, 0x23c0000023d, 0x23f00000241, 0x24200000243, 0x24700000248, 0x2490000024a, 0x24b0000024c, 0x24d0000024e, 0x24f000002b0, 0x2b9000002c2, 0x2c6000002d2, 0x2ec000002ed, 0x2ee000002ef, 0x30000000340, 0x34200000343, 0x3460000034f, 0x35000000370, 0x37100000372, 0x37300000374, 0x37700000378, 0x37b0000037e, 0x39000000391, 0x3ac000003cf, 0x3d7000003d8, 0x3d9000003da, 0x3db000003dc, 0x3dd000003de, 0x3df000003e0, 0x3e1000003e2, 0x3e3000003e4, 0x3e5000003e6, 0x3e7000003e8, 0x3e9000003ea, 0x3eb000003ec, 0x3ed000003ee, 0x3ef000003f0, 0x3f3000003f4, 0x3f8000003f9, 0x3fb000003fd, 0x43000000460, 0x46100000462, 0x46300000464, 0x46500000466, 0x46700000468, 0x4690000046a, 0x46b0000046c, 0x46d0000046e, 0x46f00000470, 0x47100000472, 0x47300000474, 0x47500000476, 0x47700000478, 0x4790000047a, 0x47b0000047c, 0x47d0000047e, 0x47f00000480, 0x48100000482, 0x48300000488, 0x48b0000048c, 0x48d0000048e, 0x48f00000490, 0x49100000492, 0x49300000494, 0x49500000496, 0x49700000498, 0x4990000049a, 0x49b0000049c, 0x49d0000049e, 0x49f000004a0, 0x4a1000004a2, 0x4a3000004a4, 0x4a5000004a6, 0x4a7000004a8, 0x4a9000004aa, 0x4ab000004ac, 0x4ad000004ae, 0x4af000004b0, 0x4b1000004b2, 0x4b3000004b4, 0x4b5000004b6, 0x4b7000004b8, 0x4b9000004ba, 0x4bb000004bc, 0x4bd000004be, 0x4bf000004c0, 0x4c2000004c3, 0x4c4000004c5, 0x4c6000004c7, 0x4c8000004c9, 0x4ca000004cb, 0x4cc000004cd, 0x4ce000004d0, 0x4d1000004d2, 0x4d3000004d4, 0x4d5000004d6, 0x4d7000004d8, 0x4d9000004da, 0x4db000004dc, 0x4dd000004de, 0x4df000004e0, 0x4e1000004e2, 0x4e3000004e4, 0x4e5000004e6, 0x4e7000004e8, 0x4e9000004ea, 0x4eb000004ec, 0x4ed000004ee, 0x4ef000004f0, 0x4f1000004f2, 0x4f3000004f4, 0x4f5000004f6, 0x4f7000004f8, 0x4f9000004fa, 0x4fb000004fc, 0x4fd000004fe, 0x4ff00000500, 0x50100000502, 0x50300000504, 0x50500000506, 0x50700000508, 0x5090000050a, 0x50b0000050c, 0x50d0000050e, 0x50f00000510, 0x51100000512, 0x51300000514, 0x51500000516, 0x51700000518, 0x5190000051a, 0x51b0000051c, 0x51d0000051e, 0x51f00000520, 0x52100000522, 0x52300000524, 0x52500000526, 0x52700000528, 0x5290000052a, 0x52b0000052c, 0x52d0000052e, 0x52f00000530, 0x5590000055a, 0x56000000587, 0x58800000589, 0x591000005be, 0x5bf000005c0, 0x5c1000005c3, 0x5c4000005c6, 0x5c7000005c8, 0x5d0000005eb, 0x5ef000005f3, 0x6100000061b, 0x62000000640, 0x64100000660, 0x66e00000675, 0x679000006d4, 0x6d5000006dd, 0x6df000006e9, 0x6ea000006f0, 0x6fa00000700, 0x7100000074b, 0x74d000007b2, 0x7c0000007f6, 0x7fd000007fe, 0x8000000082e, 0x8400000085c, 0x8600000086b, 0x8a0000008b5, 0x8b6000008c8, 0x8d3000008e2, 0x8e300000958, 0x96000000964, 0x96600000970, 0x97100000984, 0x9850000098d, 0x98f00000991, 0x993000009a9, 0x9aa000009b1, 0x9b2000009b3, 0x9b6000009ba, 0x9bc000009c5, 0x9c7000009c9, 0x9cb000009cf, 0x9d7000009d8, 0x9e0000009e4, 0x9e6000009f2, 0x9fc000009fd, 0x9fe000009ff, 0xa0100000a04, 0xa0500000a0b, 0xa0f00000a11, 0xa1300000a29, 0xa2a00000a31, 0xa3200000a33, 0xa3500000a36, 0xa3800000a3a, 0xa3c00000a3d, 0xa3e00000a43, 0xa4700000a49, 0xa4b00000a4e, 0xa5100000a52, 0xa5c00000a5d, 0xa6600000a76, 0xa8100000a84, 0xa8500000a8e, 0xa8f00000a92, 0xa9300000aa9, 0xaaa00000ab1, 0xab200000ab4, 0xab500000aba, 0xabc00000ac6, 0xac700000aca, 0xacb00000ace, 0xad000000ad1, 0xae000000ae4, 0xae600000af0, 0xaf900000b00, 0xb0100000b04, 0xb0500000b0d, 0xb0f00000b11, 0xb1300000b29, 0xb2a00000b31, 0xb3200000b34, 0xb3500000b3a, 0xb3c00000b45, 0xb4700000b49, 0xb4b00000b4e, 0xb5500000b58, 0xb5f00000b64, 0xb6600000b70, 0xb7100000b72, 0xb8200000b84, 0xb8500000b8b, 0xb8e00000b91, 0xb9200000b96, 0xb9900000b9b, 0xb9c00000b9d, 0xb9e00000ba0, 0xba300000ba5, 0xba800000bab, 0xbae00000bba, 0xbbe00000bc3, 0xbc600000bc9, 0xbca00000bce, 0xbd000000bd1, 0xbd700000bd8, 0xbe600000bf0, 0xc0000000c0d, 0xc0e00000c11, 0xc1200000c29, 0xc2a00000c3a, 0xc3d00000c45, 0xc4600000c49, 0xc4a00000c4e, 0xc5500000c57, 0xc5800000c5b, 0xc6000000c64, 0xc6600000c70, 0xc8000000c84, 0xc8500000c8d, 0xc8e00000c91, 0xc9200000ca9, 0xcaa00000cb4, 0xcb500000cba, 0xcbc00000cc5, 0xcc600000cc9, 0xcca00000cce, 0xcd500000cd7, 0xcde00000cdf, 0xce000000ce4, 0xce600000cf0, 0xcf100000cf3, 0xd0000000d0d, 0xd0e00000d11, 0xd1200000d45, 0xd4600000d49, 0xd4a00000d4f, 0xd5400000d58, 0xd5f00000d64, 0xd6600000d70, 0xd7a00000d80, 0xd8100000d84, 0xd8500000d97, 0xd9a00000db2, 0xdb300000dbc, 0xdbd00000dbe, 0xdc000000dc7, 0xdca00000dcb, 0xdcf00000dd5, 0xdd600000dd7, 0xdd800000de0, 0xde600000df0, 0xdf200000df4, 0xe0100000e33, 0xe3400000e3b, 0xe4000000e4f, 0xe5000000e5a, 0xe8100000e83, 0xe8400000e85, 0xe8600000e8b, 0xe8c00000ea4, 0xea500000ea6, 0xea700000eb3, 0xeb400000ebe, 0xec000000ec5, 0xec600000ec7, 0xec800000ece, 0xed000000eda, 0xede00000ee0, 0xf0000000f01, 0xf0b00000f0c, 0xf1800000f1a, 0xf2000000f2a, 0xf3500000f36, 0xf3700000f38, 0xf3900000f3a, 0xf3e00000f43, 0xf4400000f48, 0xf4900000f4d, 0xf4e00000f52, 0xf5300000f57, 0xf5800000f5c, 0xf5d00000f69, 0xf6a00000f6d, 0xf7100000f73, 0xf7400000f75, 0xf7a00000f81, 0xf8200000f85, 0xf8600000f93, 0xf9400000f98, 0xf9900000f9d, 0xf9e00000fa2, 0xfa300000fa7, 0xfa800000fac, 0xfad00000fb9, 0xfba00000fbd, 0xfc600000fc7, 0x10000000104a, 0x10500000109e, 0x10d0000010fb, 0x10fd00001100, 0x120000001249, 0x124a0000124e, 0x125000001257, 0x125800001259, 0x125a0000125e, 0x126000001289, 0x128a0000128e, 0x1290000012b1, 0x12b2000012b6, 0x12b8000012bf, 0x12c0000012c1, 0x12c2000012c6, 0x12c8000012d7, 0x12d800001311, 0x131200001316, 0x13180000135b, 0x135d00001360, 0x138000001390, 0x13a0000013f6, 0x14010000166d, 0x166f00001680, 0x16810000169b, 0x16a0000016eb, 0x16f1000016f9, 0x17000000170d, 0x170e00001715, 0x172000001735, 0x174000001754, 0x17600000176d, 0x176e00001771, 0x177200001774, 0x1780000017b4, 0x17b6000017d4, 0x17d7000017d8, 0x17dc000017de, 0x17e0000017ea, 0x18100000181a, 0x182000001879, 0x1880000018ab, 0x18b0000018f6, 0x19000000191f, 0x19200000192c, 0x19300000193c, 0x19460000196e, 0x197000001975, 0x1980000019ac, 0x19b0000019ca, 0x19d0000019da, 0x1a0000001a1c, 0x1a2000001a5f, 0x1a6000001a7d, 0x1a7f00001a8a, 0x1a9000001a9a, 0x1aa700001aa8, 0x1ab000001abe, 0x1abf00001ac1, 0x1b0000001b4c, 0x1b5000001b5a, 0x1b6b00001b74, 0x1b8000001bf4, 0x1c0000001c38, 0x1c4000001c4a, 0x1c4d00001c7e, 0x1cd000001cd3, 0x1cd400001cfb, 0x1d0000001d2c, 0x1d2f00001d30, 0x1d3b00001d3c, 0x1d4e00001d4f, 0x1d6b00001d78, 0x1d7900001d9b, 0x1dc000001dfa, 0x1dfb00001e00, 0x1e0100001e02, 0x1e0300001e04, 0x1e0500001e06, 0x1e0700001e08, 0x1e0900001e0a, 0x1e0b00001e0c, 0x1e0d00001e0e, 0x1e0f00001e10, 0x1e1100001e12, 0x1e1300001e14, 0x1e1500001e16, 0x1e1700001e18, 0x1e1900001e1a, 0x1e1b00001e1c, 0x1e1d00001e1e, 0x1e1f00001e20, 0x1e2100001e22, 0x1e2300001e24, 0x1e2500001e26, 0x1e2700001e28, 0x1e2900001e2a, 0x1e2b00001e2c, 0x1e2d00001e2e, 0x1e2f00001e30, 0x1e3100001e32, 0x1e3300001e34, 0x1e3500001e36, 0x1e3700001e38, 0x1e3900001e3a, 0x1e3b00001e3c, 0x1e3d00001e3e, 0x1e3f00001e40, 0x1e4100001e42, 0x1e4300001e44, 0x1e4500001e46, 0x1e4700001e48, 0x1e4900001e4a, 0x1e4b00001e4c, 0x1e4d00001e4e, 0x1e4f00001e50, 0x1e5100001e52, 0x1e5300001e54, 0x1e5500001e56, 0x1e5700001e58, 0x1e5900001e5a, 0x1e5b00001e5c, 0x1e5d00001e5e, 0x1e5f00001e60, 0x1e6100001e62, 0x1e6300001e64, 0x1e6500001e66, 0x1e6700001e68, 0x1e6900001e6a, 0x1e6b00001e6c, 0x1e6d00001e6e, 0x1e6f00001e70, 0x1e7100001e72, 0x1e7300001e74, 0x1e7500001e76, 0x1e7700001e78, 0x1e7900001e7a, 0x1e7b00001e7c, 0x1e7d00001e7e, 0x1e7f00001e80, 0x1e8100001e82, 0x1e8300001e84, 0x1e8500001e86, 0x1e8700001e88, 0x1e8900001e8a, 0x1e8b00001e8c, 0x1e8d00001e8e, 0x1e8f00001e90, 0x1e9100001e92, 0x1e9300001e94, 0x1e9500001e9a, 0x1e9c00001e9e, 0x1e9f00001ea0, 0x1ea100001ea2, 0x1ea300001ea4, 0x1ea500001ea6, 0x1ea700001ea8, 0x1ea900001eaa, 0x1eab00001eac, 0x1ead00001eae, 0x1eaf00001eb0, 0x1eb100001eb2, 0x1eb300001eb4, 0x1eb500001eb6, 0x1eb700001eb8, 0x1eb900001eba, 0x1ebb00001ebc, 0x1ebd00001ebe, 0x1ebf00001ec0, 0x1ec100001ec2, 0x1ec300001ec4, 0x1ec500001ec6, 0x1ec700001ec8, 0x1ec900001eca, 0x1ecb00001ecc, 0x1ecd00001ece, 0x1ecf00001ed0, 0x1ed100001ed2, 0x1ed300001ed4, 0x1ed500001ed6, 0x1ed700001ed8, 0x1ed900001eda, 0x1edb00001edc, 0x1edd00001ede, 0x1edf00001ee0, 0x1ee100001ee2, 0x1ee300001ee4, 0x1ee500001ee6, 0x1ee700001ee8, 0x1ee900001eea, 0x1eeb00001eec, 0x1eed00001eee, 0x1eef00001ef0, 0x1ef100001ef2, 0x1ef300001ef4, 0x1ef500001ef6, 0x1ef700001ef8, 0x1ef900001efa, 0x1efb00001efc, 0x1efd00001efe, 0x1eff00001f08, 0x1f1000001f16, 0x1f2000001f28, 0x1f3000001f38, 0x1f4000001f46, 0x1f5000001f58, 0x1f6000001f68, 0x1f7000001f71, 0x1f7200001f73, 0x1f7400001f75, 0x1f7600001f77, 0x1f7800001f79, 0x1f7a00001f7b, 0x1f7c00001f7d, 0x1fb000001fb2, 0x1fb600001fb7, 0x1fc600001fc7, 0x1fd000001fd3, 0x1fd600001fd8, 0x1fe000001fe3, 0x1fe400001fe8, 0x1ff600001ff7, 0x214e0000214f, 0x218400002185, 0x2c3000002c5f, 0x2c6100002c62, 0x2c6500002c67, 0x2c6800002c69, 0x2c6a00002c6b, 0x2c6c00002c6d, 0x2c7100002c72, 0x2c7300002c75, 0x2c7600002c7c, 0x2c8100002c82, 0x2c8300002c84, 0x2c8500002c86, 0x2c8700002c88, 0x2c8900002c8a, 0x2c8b00002c8c, 0x2c8d00002c8e, 0x2c8f00002c90, 0x2c9100002c92, 0x2c9300002c94, 0x2c9500002c96, 0x2c9700002c98, 0x2c9900002c9a, 0x2c9b00002c9c, 0x2c9d00002c9e, 0x2c9f00002ca0, 0x2ca100002ca2, 0x2ca300002ca4, 0x2ca500002ca6, 0x2ca700002ca8, 0x2ca900002caa, 0x2cab00002cac, 0x2cad00002cae, 0x2caf00002cb0, 0x2cb100002cb2, 0x2cb300002cb4, 0x2cb500002cb6, 0x2cb700002cb8, 0x2cb900002cba, 0x2cbb00002cbc, 0x2cbd00002cbe, 0x2cbf00002cc0, 0x2cc100002cc2, 0x2cc300002cc4, 0x2cc500002cc6, 0x2cc700002cc8, 0x2cc900002cca, 0x2ccb00002ccc, 0x2ccd00002cce, 0x2ccf00002cd0, 0x2cd100002cd2, 0x2cd300002cd4, 0x2cd500002cd6, 0x2cd700002cd8, 0x2cd900002cda, 0x2cdb00002cdc, 0x2cdd00002cde, 0x2cdf00002ce0, 0x2ce100002ce2, 0x2ce300002ce5, 0x2cec00002ced, 0x2cee00002cf2, 0x2cf300002cf4, 0x2d0000002d26, 0x2d2700002d28, 0x2d2d00002d2e, 0x2d3000002d68, 0x2d7f00002d97, 0x2da000002da7, 0x2da800002daf, 0x2db000002db7, 0x2db800002dbf, 0x2dc000002dc7, 0x2dc800002dcf, 0x2dd000002dd7, 0x2dd800002ddf, 0x2de000002e00, 0x2e2f00002e30, 0x300500003008, 0x302a0000302e, 0x303c0000303d, 0x304100003097, 0x30990000309b, 0x309d0000309f, 0x30a1000030fb, 0x30fc000030ff, 0x310500003130, 0x31a0000031c0, 0x31f000003200, 0x340000004dc0, 0x4e0000009ffd, 0xa0000000a48d, 0xa4d00000a4fe, 0xa5000000a60d, 0xa6100000a62c, 0xa6410000a642, 0xa6430000a644, 0xa6450000a646, 0xa6470000a648, 0xa6490000a64a, 0xa64b0000a64c, 0xa64d0000a64e, 0xa64f0000a650, 0xa6510000a652, 0xa6530000a654, 0xa6550000a656, 0xa6570000a658, 0xa6590000a65a, 0xa65b0000a65c, 0xa65d0000a65e, 0xa65f0000a660, 0xa6610000a662, 0xa6630000a664, 0xa6650000a666, 0xa6670000a668, 0xa6690000a66a, 0xa66b0000a66c, 0xa66d0000a670, 0xa6740000a67e, 0xa67f0000a680, 0xa6810000a682, 0xa6830000a684, 0xa6850000a686, 0xa6870000a688, 0xa6890000a68a, 0xa68b0000a68c, 0xa68d0000a68e, 0xa68f0000a690, 0xa6910000a692, 0xa6930000a694, 0xa6950000a696, 0xa6970000a698, 0xa6990000a69a, 0xa69b0000a69c, 0xa69e0000a6e6, 0xa6f00000a6f2, 0xa7170000a720, 0xa7230000a724, 0xa7250000a726, 0xa7270000a728, 0xa7290000a72a, 0xa72b0000a72c, 0xa72d0000a72e, 0xa72f0000a732, 0xa7330000a734, 0xa7350000a736, 0xa7370000a738, 0xa7390000a73a, 0xa73b0000a73c, 0xa73d0000a73e, 0xa73f0000a740, 0xa7410000a742, 0xa7430000a744, 0xa7450000a746, 0xa7470000a748, 0xa7490000a74a, 0xa74b0000a74c, 0xa74d0000a74e, 0xa74f0000a750, 0xa7510000a752, 0xa7530000a754, 0xa7550000a756, 0xa7570000a758, 0xa7590000a75a, 0xa75b0000a75c, 0xa75d0000a75e, 0xa75f0000a760, 0xa7610000a762, 0xa7630000a764, 0xa7650000a766, 0xa7670000a768, 0xa7690000a76a, 0xa76b0000a76c, 0xa76d0000a76e, 0xa76f0000a770, 0xa7710000a779, 0xa77a0000a77b, 0xa77c0000a77d, 0xa77f0000a780, 0xa7810000a782, 0xa7830000a784, 0xa7850000a786, 0xa7870000a789, 0xa78c0000a78d, 0xa78e0000a790, 0xa7910000a792, 0xa7930000a796, 0xa7970000a798, 0xa7990000a79a, 0xa79b0000a79c, 0xa79d0000a79e, 0xa79f0000a7a0, 0xa7a10000a7a2, 0xa7a30000a7a4, 0xa7a50000a7a6, 0xa7a70000a7a8, 0xa7a90000a7aa, 0xa7af0000a7b0, 0xa7b50000a7b6, 0xa7b70000a7b8, 0xa7b90000a7ba, 0xa7bb0000a7bc, 0xa7bd0000a7be, 0xa7bf0000a7c0, 0xa7c30000a7c4, 0xa7c80000a7c9, 0xa7ca0000a7cb, 0xa7f60000a7f8, 0xa7fa0000a828, 0xa82c0000a82d, 0xa8400000a874, 0xa8800000a8c6, 0xa8d00000a8da, 0xa8e00000a8f8, 0xa8fb0000a8fc, 0xa8fd0000a92e, 0xa9300000a954, 0xa9800000a9c1, 0xa9cf0000a9da, 0xa9e00000a9ff, 0xaa000000aa37, 0xaa400000aa4e, 0xaa500000aa5a, 0xaa600000aa77, 0xaa7a0000aac3, 0xaadb0000aade, 0xaae00000aaf0, 0xaaf20000aaf7, 0xab010000ab07, 0xab090000ab0f, 0xab110000ab17, 0xab200000ab27, 0xab280000ab2f, 0xab300000ab5b, 0xab600000ab6a, 0xabc00000abeb, 0xabec0000abee, 0xabf00000abfa, 0xac000000d7a4, 0xfa0e0000fa10, 0xfa110000fa12, 0xfa130000fa15, 0xfa1f0000fa20, 0xfa210000fa22, 0xfa230000fa25, 0xfa270000fa2a, 0xfb1e0000fb1f, 0xfe200000fe30, 0xfe730000fe74, 0x100000001000c, 0x1000d00010027, 0x100280001003b, 0x1003c0001003e, 0x1003f0001004e, 0x100500001005e, 0x10080000100fb, 0x101fd000101fe, 0x102800001029d, 0x102a0000102d1, 0x102e0000102e1, 0x1030000010320, 0x1032d00010341, 0x103420001034a, 0x103500001037b, 0x103800001039e, 0x103a0000103c4, 0x103c8000103d0, 0x104280001049e, 0x104a0000104aa, 0x104d8000104fc, 0x1050000010528, 0x1053000010564, 0x1060000010737, 0x1074000010756, 0x1076000010768, 0x1080000010806, 0x1080800010809, 0x1080a00010836, 0x1083700010839, 0x1083c0001083d, 0x1083f00010856, 0x1086000010877, 0x108800001089f, 0x108e0000108f3, 0x108f4000108f6, 0x1090000010916, 0x109200001093a, 0x10980000109b8, 0x109be000109c0, 0x10a0000010a04, 0x10a0500010a07, 0x10a0c00010a14, 0x10a1500010a18, 0x10a1900010a36, 0x10a3800010a3b, 0x10a3f00010a40, 0x10a6000010a7d, 0x10a8000010a9d, 0x10ac000010ac8, 0x10ac900010ae7, 0x10b0000010b36, 0x10b4000010b56, 0x10b6000010b73, 0x10b8000010b92, 0x10c0000010c49, 0x10cc000010cf3, 0x10d0000010d28, 0x10d3000010d3a, 0x10e8000010eaa, 0x10eab00010ead, 0x10eb000010eb2, 0x10f0000010f1d, 0x10f2700010f28, 0x10f3000010f51, 0x10fb000010fc5, 0x10fe000010ff7, 0x1100000011047, 0x1106600011070, 0x1107f000110bb, 0x110d0000110e9, 0x110f0000110fa, 0x1110000011135, 0x1113600011140, 0x1114400011148, 0x1115000011174, 0x1117600011177, 0x11180000111c5, 0x111c9000111cd, 0x111ce000111db, 0x111dc000111dd, 0x1120000011212, 0x1121300011238, 0x1123e0001123f, 0x1128000011287, 0x1128800011289, 0x1128a0001128e, 0x1128f0001129e, 0x1129f000112a9, 0x112b0000112eb, 0x112f0000112fa, 0x1130000011304, 0x113050001130d, 0x1130f00011311, 0x1131300011329, 0x1132a00011331, 0x1133200011334, 0x113350001133a, 0x1133b00011345, 0x1134700011349, 0x1134b0001134e, 0x1135000011351, 0x1135700011358, 0x1135d00011364, 0x113660001136d, 0x1137000011375, 0x114000001144b, 0x114500001145a, 0x1145e00011462, 0x11480000114c6, 0x114c7000114c8, 0x114d0000114da, 0x11580000115b6, 0x115b8000115c1, 0x115d8000115de, 0x1160000011641, 0x1164400011645, 0x116500001165a, 0x11680000116b9, 0x116c0000116ca, 0x117000001171b, 0x1171d0001172c, 0x117300001173a, 0x118000001183b, 0x118c0000118ea, 0x118ff00011907, 0x119090001190a, 0x1190c00011914, 0x1191500011917, 0x1191800011936, 0x1193700011939, 0x1193b00011944, 0x119500001195a, 0x119a0000119a8, 0x119aa000119d8, 0x119da000119e2, 0x119e3000119e5, 0x11a0000011a3f, 0x11a4700011a48, 0x11a5000011a9a, 0x11a9d00011a9e, 0x11ac000011af9, 0x11c0000011c09, 0x11c0a00011c37, 0x11c3800011c41, 0x11c5000011c5a, 0x11c7200011c90, 0x11c9200011ca8, 0x11ca900011cb7, 0x11d0000011d07, 0x11d0800011d0a, 0x11d0b00011d37, 0x11d3a00011d3b, 0x11d3c00011d3e, 0x11d3f00011d48, 0x11d5000011d5a, 0x11d6000011d66, 0x11d6700011d69, 0x11d6a00011d8f, 0x11d9000011d92, 0x11d9300011d99, 0x11da000011daa, 0x11ee000011ef7, 0x11fb000011fb1, 0x120000001239a, 0x1248000012544, 0x130000001342f, 0x1440000014647, 0x1680000016a39, 0x16a4000016a5f, 0x16a6000016a6a, 0x16ad000016aee, 0x16af000016af5, 0x16b0000016b37, 0x16b4000016b44, 0x16b5000016b5a, 0x16b6300016b78, 0x16b7d00016b90, 0x16e6000016e80, 0x16f0000016f4b, 0x16f4f00016f88, 0x16f8f00016fa0, 0x16fe000016fe2, 0x16fe300016fe5, 0x16ff000016ff2, 0x17000000187f8, 0x1880000018cd6, 0x18d0000018d09, 0x1b0000001b11f, 0x1b1500001b153, 0x1b1640001b168, 0x1b1700001b2fc, 0x1bc000001bc6b, 0x1bc700001bc7d, 0x1bc800001bc89, 0x1bc900001bc9a, 0x1bc9d0001bc9f, 0x1da000001da37, 0x1da3b0001da6d, 0x1da750001da76, 0x1da840001da85, 0x1da9b0001daa0, 0x1daa10001dab0, 0x1e0000001e007, 0x1e0080001e019, 0x1e01b0001e022, 0x1e0230001e025, 0x1e0260001e02b, 0x1e1000001e12d, 0x1e1300001e13e, 0x1e1400001e14a, 0x1e14e0001e14f, 0x1e2c00001e2fa, 0x1e8000001e8c5, 0x1e8d00001e8d7, 0x1e9220001e94c, 0x1e9500001e95a, 0x1fbf00001fbfa, 0x200000002a6de, 0x2a7000002b735, 0x2b7400002b81e, 0x2b8200002cea2, 0x2ceb00002ebe1, 0x300000003134b, ), 'CONTEXTJ': ( 0x200c0000200e, ), 'CONTEXTO': ( 0xb7000000b8, 0x37500000376, 0x5f3000005f5, 0x6600000066a, 0x6f0000006fa, 0x30fb000030fc, ), } idna/compat.py000064400000000350152347724720007327 0ustar00from .core import * from .codec import * def ToASCII(label): return encode(label) def ToUnicode(label): return decode(label) def nameprep(s): raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol") idna/core.py000064400000027257152347724720007013 0ustar00from . import idnadata import bisect import unicodedata import re import sys from .intranges import intranges_contain _virama_combining_class = 9 _alabel_prefix = b'xn--' _unicode_dots_re = re.compile(u'[\u002e\u3002\uff0e\uff61]') if sys.version_info[0] >= 3: unicode = str unichr = chr class IDNAError(UnicodeError): """ Base exception for all IDNA-encoding related problems """ pass class IDNABidiError(IDNAError): """ Exception when bidirectional requirements are not satisfied """ pass class InvalidCodepoint(IDNAError): """ Exception when a disallowed or unallocated codepoint is used """ pass class InvalidCodepointContext(IDNAError): """ Exception when the codepoint is not valid in the context it is used """ pass def _combining_class(cp): v = unicodedata.combining(unichr(cp)) if v == 0: if not unicodedata.name(unichr(cp)): raise ValueError("Unknown character in unicodedata") return v def _is_script(cp, script): return intranges_contain(ord(cp), idnadata.scripts[script]) def _punycode(s): return s.encode('punycode') def _unot(s): return 'U+{0:04X}'.format(s) def valid_label_length(label): if len(label) > 63: return False return True def valid_string_length(label, trailing_dot): if len(label) > (254 if trailing_dot else 253): return False return True def check_bidi(label, check_ltr=False): # Bidi rules should only be applied if string contains RTL characters bidi_label = False for (idx, cp) in enumerate(label, 1): direction = unicodedata.bidirectional(cp) if direction == '': # String likely comes from a newer version of Unicode raise IDNABidiError('Unknown directionality in label {0} at position {1}'.format(repr(label), idx)) if direction in ['R', 'AL', 'AN']: bidi_label = True if not bidi_label and not check_ltr: return True # Bidi rule 1 direction = unicodedata.bidirectional(label[0]) if direction in ['R', 'AL']: rtl = True elif direction == 'L': rtl = False else: raise IDNABidiError('First codepoint in label {0} must be directionality L, R or AL'.format(repr(label))) valid_ending = False number_type = False for (idx, cp) in enumerate(label, 1): direction = unicodedata.bidirectional(cp) if rtl: # Bidi rule 2 if not direction in ['R', 'AL', 'AN', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: raise IDNABidiError('Invalid direction for codepoint at position {0} in a right-to-left label'.format(idx)) # Bidi rule 3 if direction in ['R', 'AL', 'EN', 'AN']: valid_ending = True elif direction != 'NSM': valid_ending = False # Bidi rule 4 if direction in ['AN', 'EN']: if not number_type: number_type = direction else: if number_type != direction: raise IDNABidiError('Can not mix numeral types in a right-to-left label') else: # Bidi rule 5 if not direction in ['L', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: raise IDNABidiError('Invalid direction for codepoint at position {0} in a left-to-right label'.format(idx)) # Bidi rule 6 if direction in ['L', 'EN']: valid_ending = True elif direction != 'NSM': valid_ending = False if not valid_ending: raise IDNABidiError('Label ends with illegal codepoint directionality') return True def check_initial_combiner(label): if unicodedata.category(label[0])[0] == 'M': raise IDNAError('Label begins with an illegal combining character') return True def check_hyphen_ok(label): if label[2:4] == '--': raise IDNAError('Label has disallowed hyphens in 3rd and 4th position') if label[0] == '-' or label[-1] == '-': raise IDNAError('Label must not start or end with a hyphen') return True def check_nfc(label): if unicodedata.normalize('NFC', label) != label: raise IDNAError('Label must be in Normalization Form C') def valid_contextj(label, pos): cp_value = ord(label[pos]) if cp_value == 0x200c: if pos > 0: if _combining_class(ord(label[pos - 1])) == _virama_combining_class: return True ok = False for i in range(pos-1, -1, -1): joining_type = idnadata.joining_types.get(ord(label[i])) if joining_type == ord('T'): continue if joining_type in [ord('L'), ord('D')]: ok = True break if not ok: return False ok = False for i in range(pos+1, len(label)): joining_type = idnadata.joining_types.get(ord(label[i])) if joining_type == ord('T'): continue if joining_type in [ord('R'), ord('D')]: ok = True break return ok if cp_value == 0x200d: if pos > 0: if _combining_class(ord(label[pos - 1])) == _virama_combining_class: return True return False else: return False def valid_contexto(label, pos, exception=False): cp_value = ord(label[pos]) if cp_value == 0x00b7: if 0 < pos < len(label)-1: if ord(label[pos - 1]) == 0x006c and ord(label[pos + 1]) == 0x006c: return True return False elif cp_value == 0x0375: if pos < len(label)-1 and len(label) > 1: return _is_script(label[pos + 1], 'Greek') return False elif cp_value == 0x05f3 or cp_value == 0x05f4: if pos > 0: return _is_script(label[pos - 1], 'Hebrew') return False elif cp_value == 0x30fb: for cp in label: if cp == u'\u30fb': continue if _is_script(cp, 'Hiragana') or _is_script(cp, 'Katakana') or _is_script(cp, 'Han'): return True return False elif 0x660 <= cp_value <= 0x669: for cp in label: if 0x6f0 <= ord(cp) <= 0x06f9: return False return True elif 0x6f0 <= cp_value <= 0x6f9: for cp in label: if 0x660 <= ord(cp) <= 0x0669: return False return True def check_label(label): if isinstance(label, (bytes, bytearray)): label = label.decode('utf-8') if len(label) == 0: raise IDNAError('Empty Label') check_nfc(label) check_hyphen_ok(label) check_initial_combiner(label) for (pos, cp) in enumerate(label): cp_value = ord(cp) if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']): continue elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']): try: if not valid_contextj(label, pos): raise InvalidCodepointContext('Joiner {0} not allowed at position {1} in {2}'.format( _unot(cp_value), pos+1, repr(label))) except ValueError: raise IDNAError('Unknown codepoint adjacent to joiner {0} at position {1} in {2}'.format( _unot(cp_value), pos+1, repr(label))) elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']): if not valid_contexto(label, pos): raise InvalidCodepointContext('Codepoint {0} not allowed at position {1} in {2}'.format(_unot(cp_value), pos+1, repr(label))) else: raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label))) check_bidi(label) def alabel(label): try: label = label.encode('ascii') ulabel(label) if not valid_label_length(label): raise IDNAError('Label too long') return label except UnicodeEncodeError: pass if not label: raise IDNAError('No Input') label = unicode(label) check_label(label) label = _punycode(label) label = _alabel_prefix + label if not valid_label_length(label): raise IDNAError('Label too long') return label def ulabel(label): if not isinstance(label, (bytes, bytearray)): try: label = label.encode('ascii') except UnicodeEncodeError: check_label(label) return label label = label.lower() if label.startswith(_alabel_prefix): label = label[len(_alabel_prefix):] if not label: raise IDNAError('Malformed A-label, no Punycode eligible content found') if label.decode('ascii')[-1] == '-': raise IDNAError('A-label must not end with a hyphen') else: check_label(label) return label.decode('ascii') label = label.decode('punycode') check_label(label) return label def uts46_remap(domain, std3_rules=True, transitional=False): """Re-map the characters in the string according to UTS46 processing.""" from .uts46data import uts46data output = u"" try: for pos, char in enumerate(domain): code_point = ord(char) uts46row = uts46data[code_point if code_point < 256 else bisect.bisect_left(uts46data, (code_point, "Z")) - 1] status = uts46row[1] replacement = uts46row[2] if len(uts46row) == 3 else None if (status == "V" or (status == "D" and not transitional) or (status == "3" and not std3_rules and replacement is None)): output += char elif replacement is not None and (status == "M" or (status == "3" and not std3_rules) or (status == "D" and transitional)): output += replacement elif status != "I": raise IndexError() return unicodedata.normalize("NFC", output) except IndexError: raise InvalidCodepoint( "Codepoint {0} not allowed at position {1} in {2}".format( _unot(code_point), pos + 1, repr(domain))) def encode(s, strict=False, uts46=False, std3_rules=False, transitional=False): if isinstance(s, (bytes, bytearray)): s = s.decode("ascii") if uts46: s = uts46_remap(s, std3_rules, transitional) trailing_dot = False result = [] if strict: labels = s.split('.') else: labels = _unicode_dots_re.split(s) if not labels or labels == ['']: raise IDNAError('Empty domain') if labels[-1] == '': del labels[-1] trailing_dot = True for label in labels: s = alabel(label) if s: result.append(s) else: raise IDNAError('Empty label') if trailing_dot: result.append(b'') s = b'.'.join(result) if not valid_string_length(s, trailing_dot): raise IDNAError('Domain too long') return s def decode(s, strict=False, uts46=False, std3_rules=False): if isinstance(s, (bytes, bytearray)): s = s.decode("ascii") if uts46: s = uts46_remap(s, std3_rules, False) trailing_dot = False result = [] if not strict: labels = _unicode_dots_re.split(s) else: labels = s.split(u'.') if not labels or labels == ['']: raise IDNAError('Empty domain') if not labels[-1]: del labels[-1] trailing_dot = True for label in labels: s = ulabel(label) if s: result.append(s) else: raise IDNAError('Empty label') if trailing_dot: result.append(u'') return u'.'.join(result) idna/__init__.py000064400000000072152347724720007604 0ustar00from .package_data import __version__ from .core import * idna/package_data.py000064400000000026152347724720010430 0ustar00__version__ = '2.10' idna/codec.py000064400000006343152347724720007131 0ustar00from .core import encode, decode, alabel, ulabel, IDNAError import codecs import re _unicode_dots_re = re.compile(u'[\u002e\u3002\uff0e\uff61]') class Codec(codecs.Codec): def encode(self, data, errors='strict'): if errors != 'strict': raise IDNAError("Unsupported error handling \"{0}\"".format(errors)) if not data: return "", 0 return encode(data), len(data) def decode(self, data, errors='strict'): if errors != 'strict': raise IDNAError("Unsupported error handling \"{0}\"".format(errors)) if not data: return u"", 0 return decode(data), len(data) class IncrementalEncoder(codecs.BufferedIncrementalEncoder): def _buffer_encode(self, data, errors, final): if errors != 'strict': raise IDNAError("Unsupported error handling \"{0}\"".format(errors)) if not data: return ("", 0) labels = _unicode_dots_re.split(data) trailing_dot = u'' if labels: if not labels[-1]: trailing_dot = '.' del labels[-1] elif not final: # Keep potentially unfinished label until the next call del labels[-1] if labels: trailing_dot = '.' result = [] size = 0 for label in labels: result.append(alabel(label)) if size: size += 1 size += len(label) # Join with U+002E result = ".".join(result) + trailing_dot size += len(trailing_dot) return (result, size) class IncrementalDecoder(codecs.BufferedIncrementalDecoder): def _buffer_decode(self, data, errors, final): if errors != 'strict': raise IDNAError("Unsupported error handling \"{0}\"".format(errors)) if not data: return (u"", 0) # IDNA allows decoding to operate on Unicode strings, too. if isinstance(data, unicode): labels = _unicode_dots_re.split(data) else: # Must be ASCII string data = str(data) unicode(data, "ascii") labels = data.split(".") trailing_dot = u'' if labels: if not labels[-1]: trailing_dot = u'.' del labels[-1] elif not final: # Keep potentially unfinished label until the next call del labels[-1] if labels: trailing_dot = u'.' result = [] size = 0 for label in labels: result.append(ulabel(label)) if size: size += 1 size += len(label) result = u".".join(result) + trailing_dot size += len(trailing_dot) return (result, size) class StreamWriter(Codec, codecs.StreamWriter): pass class StreamReader(Codec, codecs.StreamReader): pass def getregentry(): return codecs.CodecInfo( name='idna', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamwriter=StreamWriter, streamreader=StreamReader, ) __pycache__/appdirs.cpython-36.opt-1.pyc000064400000044153152347724720014027 0ustar003 Pf`W@sdZd1ZdjeeeZddlZddlZejddkZ e r>eZ ej j drddl Z e j ddZej drrd Zqej d rd Zqd Znej Zd2ddZd3ddZd4ddZd5ddZd6ddZd7ddZGdddeZddZdd Zd!d"Zd#d$Zed kryddlZeZWnnek rydd%l m!Z!eZWnBek r|yddl"Z#eZWnek rveZYnXYnXYnXe$d&kr~d'Z%d(Z&d8Z'e(d)ee%e&d*d+Z)x$e'D]Z*e(d,e*e+e)e*fqWe(d-ee%e&Z)x$e'D]Z*e(d,e*e+e)e*fqWe(d.ee%Z)x$e'D]Z*e(d,e*e+e)e*fq$We(d/ee%d d0Z)x$e'D]Z*e(d,e*e+e)e*fq^WdS)9zyUtilities for determining application-specific dirs. See for details and usage. .NjavaZWindowswin32ZMacdarwinZlinux2FcCstdkr^|dkr|}|rdpd}tjjt|}|r|dk rNtjj|||}qtjj||}nNtdkrtjjd}|rtjj||}n&tjdtjjd }|rtjj||}|r|rtjj||}|S) aJReturn full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: macOS: ~/Library/Application Support/ Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined Win XP (not roaming): C:\Documents and Settings\\Application Data\\ Win XP (roaming): C:\Documents and Settings\\Local Settings\Application Data\\ Win 7 (not roaming): C:\Users\\AppData\Local\\ Win 7 (roaming): C:\Users\\AppData\Roaming\\ For Unix, we follow the XDG spec and support $XDG_DATA_HOME. That means, by default "~/.local/share/". rN CSIDL_APPDATACSIDL_LOCAL_APPDATAFrz~/Library/Application Support/Z XDG_DATA_HOMEz~/.local/share)systemospathnormpath_get_win_folderjoin expandusergetenv)appname appauthorversionroamingconstr r/usr/lib/python3.6/appdirs.py user_data_dir-s&   rcs tdkrR|dkr}tjjtd}r|dk rBtjj||}qtjj|}ntdkrztjjd}rtjj|}nttjdtjjdd g}d d |j tjD}r|rtjj|fd d |D}|rtjj|}n|d }|So|rtjj||}|S)aiReturn full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of data dirs should be returned. By default, the first item from XDG_DATA_DIRS is returned, or '/usr/local/share/', if XDG_DATA_DIRS is not set Typical user data directories are: macOS: /Library/Application Support/ Unix: /usr/local/share/ or /usr/share/ Win XP: C:\Documents and Settings\All Users\Application Data\\ Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) Win 7: C:\ProgramData\\ # Hidden, but writeable on Win 7. For Unix, this is using the $XDG_DATA_DIRS[0] default. WARNING: Do not use this on Windows. See the Vista-Fail note above for why. rNCSIDL_COMMON_APPDATAFrz/Library/Application SupportZ XDG_DATA_DIRSz/usr/local/sharez /usr/sharecSs g|]}tjj|jtjqSr)r r rrstripsep).0xrrr sz!site_data_dir..csg|]}tjj|gqSr)r rr)rr)rrrr sr) r r r rrrrrpathsepsplit)rrr multipathr pathlistr)rr site_data_dirds4  r%cCsXtdkrt||d|}n&tjdtjjd}|r>tjj||}|rT|rTtjj||}|S)aReturn full path to the user-specific config dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: macOS: same as user_data_dir Unix: ~/.config/ # or in $XDG_CONFIG_HOME, if defined Win *: same as user_data_dir For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. That means, by deafult "~/.config/". rrNZXDG_CONFIG_HOMEz ~/.config)rr)r rr rr rr)rrrrr rrruser_config_dirsr&cstd kr*t|}r|rtjj||}ndtjdd}dd|jtjD}rt|rbtjj|fdd|D}|rtjj|}n|d}|S) aReturn full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of config dirs should be returned. By default, the first item from XDG_CONFIG_DIRS is returned, or '/etc/xdg/', if XDG_CONFIG_DIRS is not set Typical user data directories are: macOS: same as site_data_dir Unix: /etc/xdg/ or $XDG_CONFIG_DIRS[i]/ for each value in $XDG_CONFIG_DIRS Win *: same as site_data_dir Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False WARNING: Do not use this on Windows. See the Vista-Fail note above for why. rrZXDG_CONFIG_DIRSz/etc/xdgcSs g|]}tjj|jtjqSr)r r rrr)rrrrrr sz#site_config_dir..csg|]}tjj|gqSr)r rr)rr)rrrr sr)rr)r r%r r rrr"r!)rrrr#r r$r)rrsite_config_dirs  r'TcCstdkrd|dkr|}tjjtd}|r|dk rBtjj|||}ntjj||}|rtjj|d}nNtdkrtjjd}|rtjj||}n&tjdtjjd }|rtjj||}|r|rtjj||}|S) aReturn full path to the user-specific cache dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Cache" to the base app data dir for Windows. See discussion below. Typical user cache directories are: macOS: ~/Library/Caches/ Unix: ~/.cache/ (XDG default) Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Cache Vista: C:\Users\\AppData\Local\\\Cache On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming app data dir (the default returned by `user_data_dir` above). Apps typically put cache data somewhere *under* the given dir here. Some examples: ...\Mozilla\Firefox\Profiles\\Cache ...\Acme\SuperApp\Cache\1.0 OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value. This can be disabled with the `opinion=False` option. rNr FZCacherz~/Library/CachesZXDG_CACHE_HOMEz~/.cache)r r r rrrrr)rrropinionr rrruser_cache_dirs(! r)cCstdkr tjjtjjd|}nNtdkrLt|||}d}|rntjj|d}n"t|||}d}|rntjj|d}|r|rtjj||}|S)aReturn full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Logs" to the base app data dir for Windows, and "log" to the base cache dir for Unix. See discussion below. Typical user cache directories are: macOS: ~/Library/Logs/ Unix: ~/.cache//log # or under $XDG_CACHE_HOME if defined Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Logs Vista: C:\Users\\AppData\Local\\\Logs On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in examples of what some windows apps use for a logs dir.) OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA` value for Windows and appends "log" to the user cache dir for Unix. This can be disabled with the `opinion=False` option. rz~/Library/LogsrFZLogslog)r r r rrrr))rrrr(r rrr user_log_dir:s    r+c@sbeZdZdZdddZeddZedd Zed d Zed d Z eddZ eddZ dS)AppDirsz1Convenience wrapper for getting application dirs.NFcCs"||_||_||_||_||_dS)N)rrrrr#)selfrrrrr#rrr__init__os zAppDirs.__init__cCst|j|j|j|jdS)N)rr)rrrrr)r-rrrrws zAppDirs.user_data_dircCst|j|j|j|jdS)N)rr#)r%rrrr#)r-rrrr%|s zAppDirs.site_data_dircCst|j|j|j|jdS)N)rr)r&rrrr)r-rrrr&s zAppDirs.user_config_dircCst|j|j|j|jdS)N)rr#)r'rrrr#)r-rrrr's zAppDirs.site_config_dircCst|j|j|jdS)N)r)r)rrr)r-rrrr)s zAppDirs.user_cache_dircCst|j|j|jdS)N)r)r+rrr)r-rrrr+s zAppDirs.user_log_dir)NNFF) __name__ __module__ __qualname____doc__r.propertyrr%r&r'r)r+rrrrr,ms      r,cCs:ddl}dddd|}|j|jd}|j||\}}|S)zThis is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. rNZAppDatazCommon AppDataz Local AppData)r rr z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)_winregOpenKeyHKEY_CURRENT_USERZ QueryValueEx) csidl_namer4Zshell_folder_namekeydirtyperrr_get_win_folder_from_registrysr;cCsddlm}m}|jdt||dd}y`t|}d}x|D]}t|dkr:d}Pq:W|ryddl}|j|}Wnt k rYnXWnt k rYnX|S)Nr)shellconshellFT) win32com.shellr<r=SHGetFolderPathgetattrunicodeordwin32apiGetShortPathName ImportError UnicodeError)r7r<r=r9 has_high_charcrDrrr_get_win_folder_with_pywin32s$   rJcCsddl}dddd|}|jd}|jjjd|dd|d}x|D]}t|dkrBd }PqBW|r|jd}|jjj|j|dr|}|jS) Nr#)r rr iFr>T) ctypesZcreate_unicode_bufferwindllZshell32ZSHGetFolderPathWrCZkernel32ZGetShortPathNameWvalue)r7rNZ csidl_constbufrHrIZbuf2rrr_get_win_folder_with_ctypess"    rRc Csddl}ddlm}ddlm}|jjd}|jd|}|jj }|j dt |j |d|j j ||jj|jjd}d}x|D]} t| dkr~d }Pq~W|r|jd|}|jj } tj|||r|jj|jjd}|S) Nr)jna)rrIFr>T)arrayZcom.sunrSZcom.sun.jna.platformrZWinDefZMAX_PATHZzerosZShell32ZINSTANCEr@rAZShlObjZSHGFP_TYPE_CURRENTZNativeZtoStringZtostringrrCZKernel32ZkernalrE) r7rVrSrZbuf_sizerQr=r9rHrIZkernelrrr_get_win_folder_with_jnas&       rW)rO__main__ZMyAppZ MyCompanyz%-- app dirs (with optional 'version')z1.0)rz%s: %sz) -- app dirs (without optional 'version')z+ -- app dirs (without optional 'appauthor')z( -- app dirs (with disabled 'appauthor'))r)rrr)NNNF)NNNF)NNNF)NNNF)NNNT)NNNT)rr%r&r'r)r+),r2Z__version_info__rmapstr __version__sysr version_infoZPY3rBplatform startswithZjava_verZos_namer rr%r&r'r)r+objectr,r;rJrRrWr?Zwin32comrrFrNrOZ com.sun.jnaZcomr/rrZpropsprintdirsZproprArrrr s~    7 B ( 3 9 3+         __pycache__/retrying.cpython-36.opt-1.pyc000064400000017525152347724720014233 0ustar003 Pf&@slddlZddlmZddlZddlZddlZdZddZGdddeZ Gdd d eZ Gd d d e Z dS) N)sixi?csBtdkr,tdr,dd}|dSfdd}|SdS)z Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object rcstjfdd}|S)Ncstjf||S)N)Retryingcall)argskw)f/usr/lib/python3.6/retrying.py wrapped_f$sz-retry..wrap_simple..wrapped_f)rwraps)rr r )rr wrap_simple"szretry..wrap_simplecstjfdd}|S)Ncstjf||S)N)rr)rr)dargsdkwrr r r /sz&retry..wrap..wrapped_f)rr )rr )rr)rr wrap-szretry..wrapN)lencallable)rrr rr )rrr retrys  rc@sneZdZdddZddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ ddZ ddZdS)rNFcs |dkr dn||_|dkrdn||_|dkr0dn||_|dkrBdn||_|dkrTdn||_|dkrfdn||_| dkrxdn| |_| dkrdn| |_| dkrtn| |_ |dkrdn||_ g|dk r̈j |j |dk rj |j |dk r||_n&|dkr fdd|_n t|||_ddg|dk r6j |j|dk sJ|dk rVj |j|dk sj| dk rvj |j| dk s| dk rj |j|dk r||_n&|dkr‡fd d|_n t|||_| dkr|j|_n| |_| dkr|j|_n| |_||_dS) NdirrcstfddDS)Nc3s|]}|VqdS)Nr ).0r)attemptsdelayr r asz6Retrying.__init__....)any)rr) stop_funcs)rrr asz#Retrying.__init__..c_sdS)Nrr )rkwargsr r r rhscstfddDS)Nc3s|]}|VqdS)Nr )rr)rrr r rysz6Retrying.__init__....)max)rr) wait_funcs)rrr rys)_stop_max_attempt_number_stop_max_delay _wait_fixed_wait_random_min_wait_random_max_wait_incrementing_start_wait_incrementing_increment_wait_exponential_multiplierMAX_WAIT_wait_exponential_max_wait_jitter_maxappendstop_after_attemptstop_after_delaystopgetattr fixed_sleep random_sleepincrementing_sleepexponential_sleepwait always_reject_retry_on_exception never_reject_retry_on_result_wrap_exception)selfr.r4Zstop_max_attempt_numberZstop_max_delayZ wait_fixedZwait_random_minZwait_random_maxZwait_incrementing_startZwait_incrementing_incrementZwait_exponential_multiplierZwait_exponential_maxZretry_on_exceptionZretry_on_resultwrap_exceptionZ stop_funcZ wait_funcZwait_jitter_maxr )rrr __init__:sR                 zRetrying.__init__cCs ||jkS)z;Stop after the previous attempt >= stop_max_attempt_number.)r )r:previous_attempt_numberdelay_since_first_attempt_msr r r r,szRetrying.stop_after_attemptcCs ||jkS)z=Stop after the time from the first attempt >= stop_max_delay.)r!)r:r=r>r r r r-szRetrying.stop_after_delaycCsdS)z#Don't sleep at all before retrying.rr )r:r=r>r r r no_sleepszRetrying.no_sleepcCs|jS)z0Sleep a fixed amount of time between each retry.)r")r:r=r>r r r r0szRetrying.fixed_sleepcCstj|j|jS)zISleep a random amount of time between wait_random_min and wait_random_max)randomZrandintr#r$)r:r=r>r r r r1szRetrying.random_sleepcCs$|j|j|d}|dkr d}|S)z Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment rr)r%r&)r:r=r>resultr r r r2szRetrying.incrementing_sleepcCs2d|}|j|}||jkr"|j}|dkr.d}|S)Nr)r'r))r:r=r>ZexprAr r r r3s  zRetrying.exponential_sleepcCsdS)NFr )r:rAr r r r7szRetrying.never_rejectcCsdS)NTr )r:rAr r r r5szRetrying.always_rejectcCs4d}|jr ||j|jdO}n||j|jO}|S)NFr) has_exceptionr6valuer8)r:attemptZrejectr r r should_rejects zRetrying.should_rejectc Ostttjd}d}xyt||||d}Wn tj}t||d}YnX|j|sh|j|jStttjd|}|j ||r|j r|j r|jqt |n<|j ||} |j rtj|j } | td| } tj| d|d7}qWdS)NirFTrg@@)introundtimeAttemptsysexc_inforFgetr9r.rC RetryErrorr4r*r@rsleep) r:fnrrZ start_timeattempt_numberrEtbr>rOZjitterr r r rs*      z Retrying.call)NNNNNNNNNNNNNFNNN)__name__ __module__ __qualname__r<r,r-r?r0r1r2r3r7r5rFrr r r r r8s0 F   rc@s*eZdZdZddZd ddZddZd S) rJz An Attempt encapsulates a call to a target function that may end as a normal return value from the function or an Exception depending on what occurred during the execution. cCs||_||_||_dS)N)rDrQrC)r:rDrQrCr r r r<szAttempt.__init__FcCs@|jr6|rt|qs *!__pycache__/six.cpython-36.pyc000064400000057532152347724720012236 0ustar003 PfuI@srdZddlmZddlZddlZddlZddlZddlZdZdZ ej ddkZ ej ddkZ ej dddzkZ e refZefZefZeZeZejZnefZeefZeejfZeZeZejjd red|ZnLGd d d eZ ye!e Wn e"k r ed~ZYn XedZ[ ddZ#ddZ$GdddeZ%Gddde%Z&Gdddej'Z(Gddde%Z)GdddeZ*e*e+Z,Gddde(Z-e)ddd d!e)d"d#d$d%d"e)d&d#d#d'd&e)d(d)d$d*d(e)d+d)d,e)d-d#d$d.d-e)d/d0d0d1d/e)d2d0d0d/d2e)d3d)d$d4d3e)d5d)e rd6nd7d8e)d9d)d:e)d;de)d!d!d e)d?d?d@e)dAdAd@e)dBdBd@e)d4d)d$d4d3e)dCd#d$dDdCe)dEd#d#dFdEe&d$d)e&dGdHe&dIdJe&dKdLdMe&dNdOdNe&dPdQdRe&dSdTdUe&dVdWdXe&dYdZd[e&d\d]d^e&d_d`dae&dbdcdde&dedfdge&dhdidje&dkdkdle&dmdmdle&dndndle&dododpe&dqdre&dsdte&dudve&dwdxdwe&dydze&d{d|d}e&d~dde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&ddde&de+dde&de+dde&de+de+de&ddde&ddde&dddg>Z.ejdkrZe.e&ddg7Z.x:e.D]2Z/e0e-e/j1e/e2e/e&r`e,j3e/de/j1q`W[/e.e-_.e-e+dZ4e,j3e4dGddde(Z5e)ddde)ddde)ddde)ddde)ddde)ddde)ddde)ddde)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mdnZej dddk reZdodnZe#e}dpej dddk rejejfdqdrZnejZdsdtZdudvZdwdxZgZe+Zejdydk rge_ejrbx>eejD]0\ZZeej+dkr*ej1e+kr*eje=Pq*W[[ejje,dS(z6Utilities for writing code that runs on Python 2 and 3)absolute_importNz'Benjamin Peterson z1.10.0javac@seZdZddZdS)XcCsdS)Nrrl)selfr r /usr/lib/python3.6/six.py__len__>sz X.__len__N)__name__ __module__ __qualname__r r r r r r <sr ?cCs ||_dS)z Add documentation to a function.N)__doc__)funcdocr r r _add_docKsrcCst|tj|S)z7Import module, returning the module after the last dot.) __import__sysmodules)namer r r _import_modulePsrc@seZdZddZddZdS) _LazyDescrcCs ||_dS)N)r)r rr r r __init__Xsz_LazyDescr.__init__c CsB|j}t||j|yt|j|jWntk r<YnX|S)N)_resolvesetattrrdelattr __class__AttributeError)r objtpresultr r r __get__[sz_LazyDescr.__get__N)rrrrr%r r r r rVsrcs.eZdZdfdd ZddZddZZS) MovedModuleNcs2tt|j|tr(|dkr |}||_n||_dS)N)superr&rPY3mod)r roldnew)r r r ris zMovedModule.__init__cCs t|jS)N)rr))r r r r rrszMovedModule._resolvecCs"|j}t||}t||||S)N)rgetattrr)r attr_modulevaluer r r __getattr__us  zMovedModule.__getattr__)N)rrrrrr0 __classcell__r r )r r r&gs r&cs(eZdZfddZddZgZZS) _LazyModulecstt|j||jj|_dS)N)r'r2rr r)r r)r r r r~sz_LazyModule.__init__cCs ddg}|dd|jD7}|S)NrrcSsg|] }|jqSr )r).0r-r r r sz'_LazyModule.__dir__..)_moved_attributes)r Zattrsr r r __dir__sz_LazyModule.__dir__)rrrrr6r5r1r r )r r r2|s r2cs&eZdZdfdd ZddZZS)MovedAttributeNcsdtt|j|trH|dkr |}||_|dkr@|dkr<|}n|}||_n||_|dkrZ|}||_dS)N)r'r7rr(r)r-)r rZold_modZnew_modZold_attrZnew_attr)r r r rszMovedAttribute.__init__cCst|j}t||jS)N)rr)r,r-)r moduler r r rs zMovedAttribute._resolve)NN)rrrrrr1r r )r r r7sr7c@sVeZdZdZddZddZddZdd d Zd d Zd dZ ddZ ddZ e Z dS)_SixMetaPathImporterz A meta path importer to import six.moves and its submodules. This class implements a PEP302 finder and loader. It should be compatible with Python 2.5 and all existing versions of Python3 cCs||_i|_dS)N)r known_modules)r Zsix_module_namer r r rsz_SixMetaPathImporter.__init__cGs&x |D]}||j|jd|<qWdS)N.)r:r)r r)Z fullnamesfullnamer r r _add_modules z _SixMetaPathImporter._add_modulecCs|j|jd|S)Nr;)r:r)r r<r r r _get_modulesz _SixMetaPathImporter._get_moduleNcCs||jkr|SdS)N)r:)r r<pathr r r find_modules z _SixMetaPathImporter.find_modulec Cs0y |j|Stk r*td|YnXdS)Nz!This loader does not know module )r:KeyError ImportError)r r<r r r Z __get_modules z!_SixMetaPathImporter.__get_modulec CsRy tj|Stk rYnX|j|}t|tr>|j}n||_|tj|<|S)N)rrrA _SixMetaPathImporter__get_module isinstancer&r __loader__)r r<r)r r r load_modules     z _SixMetaPathImporter.load_modulecCst|j|dS)z Return true, if the named module is a package. We need this method to get correct spec objects with Python 3.4 (see PEP451) __path__)hasattrrC)r r<r r r is_packagesz_SixMetaPathImporter.is_packagecCs|j|dS)z;Return None Required, if is_package is implementedN)rC)r r<r r r get_codes z_SixMetaPathImporter.get_code)N) rrrrrr=r>r@rCrFrIrJ get_sourcer r r r r9s  r9c@seZdZdZgZdS) _MovedItemszLazy loading of moved objectsN)rrrrrGr r r r rLsrLZ cStringIOioStringIOfilter itertoolsbuiltinsZifilter filterfalseZ ifilterfalseinputZ __builtin__Z raw_inputinternrmapimapgetcwdosZgetcwdugetcwdbrangeZxrangeZ reload_module importlibZimpreloadreduce functoolsZ shlex_quoteZpipesZshlexZquoteUserDict collectionsUserList UserStringzipZizip zip_longestZ izip_longestZ configparserZ ConfigParsercopyregZcopy_regZdbm_gnuZgdbmzdbm.gnuZ _dummy_threadZ dummy_threadZhttp_cookiejarZ cookielibzhttp.cookiejarZ http_cookiesZCookiez http.cookiesZ html_entitiesZhtmlentitydefsz html.entitiesZ html_parserZ HTMLParserz html.parserZ http_clientZhttplibz http.clientZemail_mime_multipartzemail.MIMEMultipartzemail.mime.multipartZemail_mime_nonmultipartzemail.MIMENonMultipartzemail.mime.nonmultipartZemail_mime_textzemail.MIMETextzemail.mime.textZemail_mime_basezemail.MIMEBasezemail.mime.baseZBaseHTTPServerz http.serverZ CGIHTTPServerZSimpleHTTPServerZcPicklepickleZqueueZQueuereprlibreprZ socketserverZ SocketServer_threadZthreadZtkinterZTkinterZtkinter_dialogZDialogztkinter.dialogZtkinter_filedialogZ FileDialogztkinter.filedialogZtkinter_scrolledtextZ ScrolledTextztkinter.scrolledtextZtkinter_simpledialogZ SimpleDialogztkinter.simpledialogZ tkinter_tixZTixz tkinter.tixZ tkinter_ttkZttkz tkinter.ttkZtkinter_constantsZ Tkconstantsztkinter.constantsZ tkinter_dndZTkdndz tkinter.dndZtkinter_colorchooserZtkColorChooserztkinter.colorchooserZtkinter_commondialogZtkCommonDialogztkinter.commondialogZtkinter_tkfiledialogZ tkFileDialogZ tkinter_fontZtkFontz tkinter.fontZtkinter_messageboxZ tkMessageBoxztkinter.messageboxZtkinter_tksimpledialogZtkSimpleDialogZ urllib_parsez.moves.urllib_parsez urllib.parseZ urllib_errorz.moves.urllib_errorz urllib.errorZurllibz .moves.urllibZurllib_robotparser robotparserzurllib.robotparserZ xmlrpc_clientZ xmlrpclibz xmlrpc.clientZ xmlrpc_serverZSimpleXMLRPCServerz xmlrpc.serverZwin32winreg_winregzmoves.z.movesmovesc@seZdZdZdS)Module_six_moves_urllib_parsez7Lazy loading of moved objects in six.moves.urllib_parseN)rrrrr r r r rn@srnZ ParseResultZurlparseZ SplitResultZparse_qsZ parse_qslZ urldefragZurljoinZurlsplitZ urlunparseZ urlunsplitZ quote_plusZunquoteZ unquote_plusZ urlencodeZ splitqueryZsplittagZ splituserZ uses_fragmentZ uses_netlocZ uses_paramsZ uses_queryZ uses_relativezmoves.urllib_parsezmoves.urllib.parsec@seZdZdZdS)Module_six_moves_urllib_errorz7Lazy loading of moved objects in six.moves.urllib_errorN)rrrrr r r r rohsroZURLErrorZurllib2Z HTTPErrorZContentTooShortErrorz.moves.urllib.errorzmoves.urllib_errorzmoves.urllib.errorc@seZdZdZdS)Module_six_moves_urllib_requestz9Lazy loading of moved objects in six.moves.urllib_requestN)rrrrr r r r rp|srpZurlopenzurllib.requestZinstall_openerZ build_openerZ pathname2urlZ url2pathnameZ getproxiesZRequestZOpenerDirectorZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZ ProxyHandlerZ BaseHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZ HTTPHandlerZ HTTPSHandlerZ FileHandlerZ FTPHandlerZCacheFTPHandlerZUnknownHandlerZHTTPErrorProcessorZ urlretrieveZ urlcleanupZ URLopenerZFancyURLopenerZ proxy_bypassz.moves.urllib.requestzmoves.urllib_requestzmoves.urllib.requestc@seZdZdZdS) Module_six_moves_urllib_responsez:Lazy loading of moved objects in six.moves.urllib_responseN)rrrrr r r r rqsrqZaddbasezurllib.responseZ addclosehookZaddinfoZ addinfourlz.moves.urllib.responsezmoves.urllib_responsezmoves.urllib.responsec@seZdZdZdS)#Module_six_moves_urllib_robotparserz=Lazy loading of moved objects in six.moves.urllib_robotparserN)rrrrr r r r rrsrrZRobotFileParserz.moves.urllib.robotparserzmoves.urllib_robotparserzmoves.urllib.robotparserc@sNeZdZdZgZejdZejdZejdZ ejdZ ejdZ ddZ d S) Module_six_moves_urllibzICreate a six.moves.urllib namespace that resembles the Python 3 namespacezmoves.urllib_parsezmoves.urllib_errorzmoves.urllib_requestzmoves.urllib_responsezmoves.urllib_robotparsercCsdddddgS)Nparseerrorrequestresponserjr )r r r r r6szModule_six_moves_urllib.__dir__N) rrrrrG _importerr>rtrurvrwrjr6r r r r rss     rsz moves.urllibcCstt|j|dS)zAdd an item to six.moves.N)rrLr)Zmover r r add_movesrycCsXytt|WnDtk rRy tj|=Wn"tk rLtd|fYnXYnXdS)zRemove item from six.moves.zno such move, %rN)rrLr!rm__dict__rA)rr r r remove_moves r{__func____self__ __closure____code__ __defaults__ __globals__im_funcZim_selfZ func_closureZ func_codeZ func_defaultsZ func_globalscCs|jS)N)next)itr r r advance_iterator srcCstddt|jDS)Ncss|]}d|jkVqdS)__call__N)rz)r3klassr r r szcallable..)anytype__mro__)r"r r r callablesrcCs|S)Nr )unboundr r r get_unbound_functionsrcCs|S)Nr )rclsr r r create_unbound_methodsrcCs|jS)N)r)rr r r r"scCstj|||jS)N)types MethodTyper )rr"r r r create_bound_method%srcCstj|d|S)N)rr)rrr r r r(sc@seZdZddZdS)IteratorcCst|j|S)N)r__next__)r r r r r-sz Iterator.nextN)rrrrr r r r r+srz3Get the function out of a possibly unbound functioncKst|jf|S)N)iterkeys)dkwr r r iterkeys>srcKst|jf|S)N)rvalues)rrr r r itervaluesAsrcKst|jf|S)N)ritems)rrr r r iteritemsDsrcKst|jf|S)N)rZlists)rrr r r iterlistsGsrrrrcKs |jf|S)N)r)rrr r r rPscKs |jf|S)N)r)rrr r r rSscKs |jf|S)N)r)rrr r r rVscKs |jf|S)N)r)rrr r r rYsviewkeys viewvalues viewitemsz1Return an iterator over the keys of a dictionary.z3Return an iterator over the values of a dictionary.z?Return an iterator over the (key, value) pairs of a dictionary.zBReturn an iterator over the (key, [values]) pairs of a dictionary.cCs |jdS)Nzlatin-1)encode)sr r r bksrcCs|S)Nr )rr r r unsrz>BassertCountEqualZassertRaisesRegexpZassertRegexpMatchesassertRaisesRegex assertRegexcCs|S)Nr )rr r r rscCst|jdddS)Nz\\z\\\\Zunicode_escape)unicodereplace)rr r r rscCs t|dS)Nr)ord)Zbsr r r byte2intsrcCs t||S)N)r)Zbufir r r indexbytessrZassertItemsEqualz Byte literalz Text literalcOst|t||S)N)r,_assertCountEqual)r argskwargsr r r rscOst|t||S)N)r,_assertRaisesRegex)r rrr r r rscOst|t||S)N)r, _assertRegex)r rrr r r rsexeccCs*|dkr|}|j|k r"|j||dS)N) __traceback__with_traceback)r#r/tbr r r reraises   rcCsB|dkr*tjd}|j}|dkr&|j}~n |dkr6|}tddS)zExecute code in a namespace.Nrzexec _code_ in _globs_, _locs_)r _getframe f_globalsf_localsr)Z_code_Z_globs_Z_locs_framer r r exec_s rz9def reraise(tp, value, tb=None): raise tp, value, tb zrdef raise_from(value, from_value): if from_value is None: raise value raise value from from_value zCdef raise_from(value, from_value): raise value from from_value cCs|dS)Nr )r/Z from_valuer r r raise_fromsrprintc s6|jdtjdkrdSfdd}d}|jdd}|dk r`t|trNd}nt|ts`td|jd d}|dk rt|trd}nt|tstd |rtd |sx|D]}t|trd}PqW|rtd }td }nd }d }|dkr|}|dkr|}x,t|D] \} }| r||||qW||dS)z4The new-style print function for Python 2.4 and 2.5.fileNcsdt|tst|}ttrVt|trVjdk rVtdd}|dkrHd}|jj|}j|dS)Nerrorsstrict) rD basestringstrrrencodingr,rwrite)datar)fpr r rs     zprint_..writeFsepTzsep must be None or a stringendzend must be None or a stringz$invalid keyword arguments to print()  )poprstdoutrDrr TypeError enumerate) rrrZ want_unicoderrargnewlineZspacerr )rr print_sL           rcOs<|jdtj}|jdd}t|||r8|dk r8|jdS)NrflushF)getrrr_printr)rrrrr r r r s    zReraise an exception.csfdd}|S)Ncstj|}|_|S)N)r^wraps __wrapped__)f)assignedupdatedwrappedr r wrapperszwraps..wrapperr )rrrrr )rrrr rsrcs&Gfddd}tj|dfiS)z%Create a base class with a metaclass.cseZdZfddZdS)z!with_metaclass..metaclasscs ||S)Nr )rrZ this_basesr)basesmetar r __new__'sz)with_metaclass..metaclass.__new__N)rrrrr )rrr r metaclass%srZtemporary_class)rr)rrrr )rrr with_metaclass srcsfdd}|S)z6Class decorator for creating a class with a metaclass.csl|jj}|jd}|dk rDt|tr,|g}x|D]}|j|q2W|jdd|jdd|j|j|S)N __slots__rz __weakref__)rzcopyrrDrrr __bases__)rZ orig_varsslotsZ slots_var)rr r r.s      zadd_metaclass..wrapperr )rrr )rr add_metaclass,s rcCs2tr.d|jkrtd|j|j|_dd|_|S)a A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing. To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class. __str__zY@python_2_unicode_compatible cannot be applied to %s because it doesn't define __str__().cSs|jjdS)Nzutf-8) __unicode__r)r r r r Jsz-python_2_unicode_compatible..)PY2rz ValueErrorrrr)rr r r python_2_unicode_compatible<s   r__spec__)rrlilill)N)NN)rr)rr)rr)rr)rZ __future__rr^rPoperatorrr __author__ __version__ version_inforr(ZPY34rZ string_typesintZ integer_typesrZ class_typesZ text_typebytesZ binary_typemaxsizeZMAXSIZErZlongZ ClassTyperplatform startswithobjectr len OverflowErrorrrrr& ModuleTyper2r7r9rrxrLr5r-rrrDr=rmrnZ_urllib_parse_moved_attributesroZ_urllib_error_moved_attributesrpZ _urllib_request_moved_attributesrqZ!_urllib_response_moved_attributesrrZ$_urllib_robotparser_moved_attributesrsryr{Z _meth_funcZ _meth_selfZ _func_closureZ _func_codeZ_func_defaultsZ _func_globalsrr NameErrorrrrrrr attrgetterZget_method_functionZget_method_selfZget_function_closureZget_function_codeZget_function_defaultsZget_function_globalsrrrr methodcallerrrrrrchrZunichrstructStructpackZint2byte itemgetterrgetitemrrZ iterbytesrMrNBytesIOrrrpartialrVrrrrr,rQrrrrrWRAPPER_ASSIGNMENTSWRAPPER_UPDATESrrrrrG __package__globalsrrsubmodule_search_locations meta_pathrrZimporterappendr r r r s     >                                                                                                                                                          5     __pycache__/distro.cpython-36.opt-1.pyc000064400000077377152347724720013707 0ustar003 Pf͕@sbdZddlZddlZddlZddlZddlZddlZddlZejj dsXe dj ejdZ dZ iZddd Zd diZejd Zejd Zd dde dfZd:ddZddZd;ddZdddZd?dd Zd@d!d"Zd#d$Zd%d&ZdAd'd(Zd)d*Z d+d,Z!d-d.Z"d/d0Z#d1d2Z$d3d4Z%Gd5d6d6e&Z'e'Z(d7d8Z)e*d9kr^e)dS)Ba, The ``distro`` package (``distro`` stands for Linux Distribution) provides information about the Linux distribution it runs on, such as a reliable machine-readable distro ID, or version information. It is a renewed alternative implementation for Python's original :py:func:`platform.linux_distribution` function, but it provides much more functionality. An alternative implementation became necessary because Python 3.5 deprecated this function, and Python 3.7 is expected to remove it altogether. Its predecessor function :py:func:`platform.dist` was already deprecated since Python 2.6 and is also expected to be removed in Python 3.7. Still, there are many cases in which access to Linux distribution information is needed. See `Python issue 1322 `_ for more information. NlinuxzUnsupported platform: {0}z/etcz os-releaseZoracleZrhel)ZenterpriseenterpriseZredhatenterpriseworkstationZredhatzA(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)z(\w+)[-_](release|version)$Zdebian_versionz lsb-releasez oem-releasezsystem-releaseTcCs tj|S)a$ Return information about the current Linux distribution as a tuple ``(id_name, version, codename)`` with items as follows: * ``id_name``: If *full_distribution_name* is false, the result of :func:`distro.id`. Otherwise, the result of :func:`distro.name`. * ``version``: The result of :func:`distro.version`. * ``codename``: The result of :func:`distro.codename`. The interface of this function is compatible with the original :py:func:`platform.linux_distribution` function, supporting a subset of its parameters. The data it returns may not exactly be the same, because it uses more data sources than the original function, and that may lead to different data if the Linux distribution is not consistent across multiple data sources it provides (there are indeed such distributions ...). Another reason for differences is the fact that the :func:`distro.id` method normalizes the distro ID string to a reliable machine-readable value for a number of popular Linux distributions. )_distrolinux_distribution)full_distribution_namer/usr/lib/python3.6/distro.pyr`srcCstjS)a Return the distro ID of the current Linux distribution, as a machine-readable string. For a number of Linux distributions, the returned distro ID value is *reliable*, in the sense that it is documented and that it does not change across releases of the distribution. This package maintains the following reliable distro ID values: ============== ========================================= Distro ID Distribution ============== ========================================= "ubuntu" Ubuntu "debian" Debian "rhel" RedHat Enterprise Linux "centos" CentOS "fedora" Fedora "sles" SUSE Linux Enterprise Server "opensuse" openSUSE "amazon" Amazon Linux "arch" Arch Linux "cloudlinux" CloudLinux OS "exherbo" Exherbo Linux "gentoo" GenToo Linux "ibm_powerkvm" IBM PowerKVM "kvmibm" KVM for IBM z Systems "linuxmint" Linux Mint "mageia" Mageia "mandriva" Mandriva Linux "parallels" Parallels "pidora" Pidora "raspbian" Raspbian "oracle" Oracle Linux (and Oracle Enterprise Linux) "scientific" Scientific Linux "slackware" Slackware "xenserver" XenServer ============== ========================================= If you have a need to get distros for reliable IDs added into this set, or if you find that the :func:`distro.id` function returns a different distro ID for one of the listed distros, please create an issue in the `distro issue tracker`_. **Lookup hierarchy and transformations:** First, the ID is obtained from the following sources, in the specified order. The first available and non-empty value is used: * the value of the "ID" attribute of the os-release file, * the value of the "Distributor ID" attribute returned by the lsb_release command, * the first part of the file name of the distro release file, The so determined ID value then passes the following transformations, before it is returned by this method: * it is translated to lower case, * blanks (which should not be there anyway) are translated to underscores, * a normalization of the ID is performed, based upon `normalization tables`_. The purpose of this normalization is to ensure that the ID is as reliable as possible, even across incompatible changes in the Linux distributions. A common reason for an incompatible change is the addition of an os-release file, or the addition of the lsb_release command, with ID values that differ from what was previously determined from the distro release file name. )ridrrrrr|sHrFcCs tj|S)an Return the name of the current Linux distribution, as a human-readable string. If *pretty* is false, the name is returned without version or codename. (e.g. "CentOS Linux") If *pretty* is true, the version and codename are appended. (e.g. "CentOS Linux 7.1.1503 (Core)") **Lookup hierarchy:** The name is obtained from the following sources, in the specified order. The first available and non-empty value is used: * If *pretty* is false: - the value of the "NAME" attribute of the os-release file, - the value of the "Distributor ID" attribute returned by the lsb_release command, - the value of the "" field of the distro release file. * If *pretty* is true: - the value of the "PRETTY_NAME" attribute of the os-release file, - the value of the "Description" attribute returned by the lsb_release command, - the value of the "" field of the distro release file, appended with the value of the pretty version ("" and "" fields) of the distro release file, if available. )rname)prettyrrrr s$r cCs tj||S)ay Return the version of the current Linux distribution, as a human-readable string. If *pretty* is false, the version is returned without codename (e.g. "7.0"). If *pretty* is true, the codename in parenthesis is appended, if the codename is non-empty (e.g. "7.0 (Maipo)"). Some distributions provide version numbers with different precisions in the different sources of distribution information. Examining the different sources in a fixed priority order does not always yield the most precise version (e.g. for Debian 8.2, or CentOS 7.1). The *best* parameter can be used to control the approach for the returned version: If *best* is false, the first non-empty version number in priority order of the examined sources is returned. If *best* is true, the most precise version number out of all examined sources is returned. **Lookup hierarchy:** In all cases, the version number is obtained from the following sources. If *best* is false, this order represents the priority order: * the value of the "VERSION_ID" attribute of the os-release file, * the value of the "Release" attribute returned by the lsb_release command, * the version number parsed from the "" field of the first line of the distro release file, * the version number parsed from the "PRETTY_NAME" attribute of the os-release file, if it follows the format of the distro release files. * the version number parsed from the "Description" attribute returned by the lsb_release command, if it follows the format of the distro release files. )rversion)r bestrrrr s)r cCs tj|S)a Return the version of the current Linux distribution as a tuple ``(major, minor, build_number)`` with items as follows: * ``major``: The result of :func:`distro.major_version`. * ``minor``: The result of :func:`distro.minor_version`. * ``build_number``: The result of :func:`distro.build_number`. For a description of the *best* parameter, see the :func:`distro.version` method. )r version_parts)r rrrr sr cCs tj|S)a8 Return the major version of the current Linux distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. )r major_version)r rrrr+s rcCs tj|S)a9 Return the minor version of the current Linux distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. )r minor_version)r rrrr8s rcCs tj|S)a6 Return the build number of the current Linux distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. )r build_number)r rrrrEs rcCstjS)a Return a space-separated list of distro IDs of distributions that are closely related to the current Linux distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from. **Lookup hierarchy:** This information item is only provided by the os-release file. For details, see the description of the "ID_LIKE" attribute in the `os-release man page `_. )rlikerrrrrRsrcCstjS)a Return the codename for the release of the current Linux distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function does not handle such cases in any special way and just returns the string it finds, if any. **Lookup hierarchy:** * the codename within the "VERSION" attribute of the os-release file, if provided, * the value of the "Codename" attribute returned by the lsb_release command, * the value of the "" field of the distro release file. )rcodenamerrrrrcsrcCs tj||S)a Return certain machine-readable information items about the current Linux distribution in a dictionary, as shown in the following example: .. sourcecode:: python { 'id': 'rhel', 'version': '7.0', 'version_parts': { 'major': '7', 'minor': '0', 'build_number': '' }, 'like': 'fedora', 'codename': 'Maipo' } The dictionary structure and keys are always the same, regardless of which information items are available in the underlying data sources. The values for the various keys are as follows: * ``id``: The result of :func:`distro.id`. * ``version``: The result of :func:`distro.version`. * ``version_parts -> major``: The result of :func:`distro.major_version`. * ``version_parts -> minor``: The result of :func:`distro.minor_version`. * ``version_parts -> build_number``: The result of :func:`distro.build_number`. * ``like``: The result of :func:`distro.like`. * ``codename``: The result of :func:`distro.codename`. For a description of the *pretty* and *best* parameters, see the :func:`distro.version` method. )rinfo)r r rrrr{s)rcCstjS)z Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current Linux distribution. See `os-release file`_ for details about these information items. )ros_release_inforrrrrsrcCstjS)z Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current Linux distribution. See `lsb_release command output`_ for details about these information items. )rlsb_release_inforrrrrsrcCstjS)z Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current Linux distribution. See `distro release file`_ for details about these information items. )rdistro_release_inforrrrrsrcCs tj|S)a Return a single named information item from the os-release file data source of the current Linux distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `os-release file`_ for details about these information items. )ros_release_attr) attributerrrrsrcCs tj|S)a Return a single named information item from the lsb_release command output data source of the current Linux distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `lsb_release command output`_ for details about these information items. )rlsb_release_attr)rrrrrsrcCs tj|S)a Return a single named information item from the distro release file data source of the current Linux distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `distro release file`_ for details about these information items. )rdistro_release_attr)rrrrrsrc@seZdZdZd:ddZddZd;dd Zd d ZdddZ d?ddZ d@ddZ dAddZ ddZddZdBddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zed-d.Zd/d0Zed1d2Zd3d4Zd5d6Zed7d8Zd9S)CLinuxDistributiona Provides information about a Linux distribution. This package creates a private module-global instance of this class with default initialization arguments, that is used by the `consolidated accessor functions`_ and `single source accessor functions`_. By using default initialization arguments, that module-global instance returns data about the current Linux distribution (i.e. the distro this package runs on). Normally, it is not necessary to create additional instances of this class. However, in situations where control is needed over the exact data sources that are used, instances of this class can be created with a specific distro release file, or a specific os-release file, or without invoking the lsb_release command. TcCsH|ptjjtt|_|pd|_|j|_|r4|j ni|_ |j |_ dS)a8 The initialization method of this class gathers information from the available data sources, and stores that in private instance attributes. Subsequent access to the information items uses these private instance attributes, so that the data sources are read only once. Parameters: * ``include_lsb`` (bool): Controls whether the `lsb_release command output`_ is included as a data source. If the lsb_release command is not available in the program execution path, the data source for the lsb_release command will be empty. * ``os_release_file`` (string): The path name of the `os-release file`_ that is to be used as a data source. An empty string (the default) will cause the default path name to be used (see `os-release file`_ for details). If the specified or defaulted os-release file does not exist, the data source for the os-release file will be empty. * ``distro_release_file`` (string): The path name of the `distro release file`_ that is to be used as a data source. An empty string (the default) will cause a default search algorithm to be used (see `distro release file`_ for details). If the specified distro release file does not exist, or if no default distro release file can be found, the data source for the distro release file will be empty. Public instance attributes: * ``os_release_file`` (string): The path name of the `os-release file`_ that is actually used as a data source. The empty string if no distro release file is used as a data source. * ``distro_release_file`` (string): The path name of the `distro release file`_ that is actually used as a data source. The empty string if no distro release file is used as a data source. Raises: * :py:exc:`IOError`: Some I/O issue with an os-release file or distro release file. * :py:exc:`subprocess.CalledProcessError`: The lsb_release command had some issue (other than not being available in the program execution path). * :py:exc:`UnicodeError`: A data source has unexpected characters or uses an unexpected encoding. rN) ospathjoin _UNIXCONFDIR_OS_RELEASE_BASENAMEos_release_filedistro_release_file_get_os_release_info_os_release_info_get_lsb_release_info_lsb_release_info_get_distro_release_info_distro_release_info)selfZ include_lsbr"r#rrr__init__s ;  zLinuxDistribution.__init__cCsdj|j|j|j|j|jS)z Return repr of all info zLinuxDistribution(os_release_file={0!r}, distro_release_file={1!r}, _os_release_info={2!r}, _lsb_release_info={3!r}, _distro_release_info={4!r}))formatr"r#r%r'r))r*rrr__repr__Us zLinuxDistribution.__repr__cCs"|r |jn|j|j|jfS)z Return information about the Linux distribution that is compatible with Python's :func:`platform.linux_distribution`, supporting a subset of its parameters. For details, see :func:`distro.linux_distribution`. )r rr r)r*rrrrres z$LinuxDistribution.linux_distributioncCsTdd}|jd}|r ||tS|jd}|r8||tS|jd}|rP||tSdS)zrReturn the distro ID of the Linux distribution, as a string. For details, see :func:`distro.id`. cSs|jjdd}|j||S)N _)lowerreplaceget) distro_idtablerrr normalizexsz'LinuxDistribution.id..normalizerdistributor_idr)rNORMALIZED_OS_IDrNORMALIZED_LSB_IDrNORMALIZED_DISTRO_ID)r*r5r3rrrrss      zLinuxDistribution.idFcCsh|jdp|jdp|jd}|r`|jdp4|jd}|s`|jd}|jdd}|r`|d|}|pfdS) zx Return the name of the Linux distribution, as a string. For details, see :func:`distro.name`. r r6 pretty_name descriptionT)r r.r)rrrr )r*r r r rrrr s        zLinuxDistribution.namecCs|jd|jd|jd|j|jdjdd|j|jdjddg}d}|rxJ|D]$}|jd|jdksv|dkrV|}qVWnx|D]}|dkr|}PqW|r|r|jrdj||j}|S)z~ Return the version of the Linux distribution, as a string. For details, see :func:`distro.version`. version_idreleaser:rr;.z {0} ({1}))rrr_parse_distro_release_contentr2countrr,)r*r r Zversionsr vrrrr s&   zLinuxDistribution.versioncCsL|j|d}|rHtjd}|j|}|rH|j\}}}||p>d|pDdfSdS)z Return the version of the Linux distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. )r z(\d+)\.?(\d+)?\.?(\d+)?r)rrr)r recompilematchgroups)r*r Z version_strZ version_regexmatchesmajorminorrrrrr s   zLinuxDistribution.version_partscCs|j|dS)z Return the major version number of the current distribution. For details, see :func:`distro.major_version`. r)r )r*r rrrrszLinuxDistribution.major_versioncCs|j|dS)z Return the minor version number of the Linux distribution. For details, see :func:`distro.minor_version`. )r )r*r rrrrszLinuxDistribution.minor_versioncCs|j|dS)z{ Return the build number of the Linux distribution. For details, see :func:`distro.build_number`. )r )r*r rrrrszLinuxDistribution.build_numbercCs|jdp dS)z Return the IDs of distributions that are like the Linux distribution. For details, see :func:`distro.like`. Zid_liker)r)r*rrrrszLinuxDistribution.likecCs"|jdp |jdp |jdp dS)zs Return the codename of the Linux distribution. For details, see :func:`distro.codename`. rr)rrr)r*rrrrs   zLinuxDistribution.codenamecCsBt|j|j||t|j||j||j|d|j|jdS)z Return certain machine-readable information about the Linux distribution. For details, see :func:`distro.info`. )rGrHr)rr r rr)dictrr rrrrr)r*r r rrrrs  zLinuxDistribution.infocCs|jS)z Return a dictionary containing key-value pairs for the information items from the os-release file data source of the Linux distribution. For details, see :func:`distro.os_release_info`. )r%)r*rrrr sz!LinuxDistribution.os_release_infocCs|jS)z Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the Linux distribution. For details, see :func:`distro.lsb_release_info`. )r')r*rrrrsz"LinuxDistribution.lsb_release_infocCs|jS)z Return a dictionary containing key-value pairs for the information items from the distro release file data source of the Linux distribution. For details, see :func:`distro.distro_release_info`. )r))r*rrrrsz%LinuxDistribution.distro_release_infocCs|jj|dS)z Return a single named information item from the os-release file data source of the Linux distribution. For details, see :func:`distro.os_release_attr`. r)r%r2)r*rrrrr)sz!LinuxDistribution.os_release_attrcCs|jj|dS)z Return a single named information item from the lsb_release command output data source of the Linux distribution. For details, see :func:`distro.lsb_release_attr`. r)r'r2)r*rrrrr2sz"LinuxDistribution.lsb_release_attrcCs|jj|dS)z Return a single named information item from the distro release file data source of the Linux distribution. For details, see :func:`distro.distro_release_attr`. r)r)r2)r*rrrrr;sz%LinuxDistribution.distro_release_attrc Cs.tjj|jr*t|j }|j|SQRXiS)z Get the information items from the specified os-release file. Returns: A dictionary containing all information items. N)rrisfiler"open_parse_os_release_content)r*Z release_filerrrr$Ds z&LinuxDistribution._get_os_release_infocCsi}tj|dd}d|_tjddkr@t|jtr@|jjd|_t|}x|D]}d|krN|j dd\}}t|tr~|jd}|||j <|d krt j d |}|r|j }|jd }|jd }|j}||d <qd|d <qNqNW|S)aD Parse the lines of an os-release file. Parameters: * lines: Iterable through the lines in the os-release file. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. T)posixrrJz iso-8859-1=rIzutf-8VERSIONz(\(\D+\))|,(\s+)?\D+z(),rr)shlexZwhitespace_splitsys version_info isinstanceZ wordcharsbytesdecodelistsplitr0rBsearchgroupstrip)linespropsZlexertokenstokenkrArrrrrNPs.          z+LinuxDistribution._parse_os_release_contentcCsd}tj|dtjtjd}|j\}}|jd|jd}}|j}|dkr\|j}|j|S|dkrhiStj ddd krtj ||||n@tj dddkrtj |||ntj dddkrtj ||dS)z Get the information items from the lsb_release command output. Returns: A dictionary containing all information items. zlsb_release -aT)shellstdoutstderrzutf-8rNrJ)rgrh)rJri)rJrj) subprocessPopenPIPEZ communicaterX returncode splitlines_parse_lsb_release_contentrTrUZCalledProcessError)r*cmdZprocessrdrecodeZcontentrrrr&s(   z'LinuxDistribution._get_lsb_release_infocCsti}xj|D]b}t|tr"|jdn|}|jdjdd}t|dkrFq |\}}|j|jddj|jiq W|S)aM Parse the output of the lsb_release command. Parameters: * lines: Iterable through the lines of the lsb_release output. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. zutf-8 :rIrJr.r/) rVrWrXr]rZlenupdater1r0)r^r_lineZkvrbrArrrrps  "z,LinuxDistribution._parse_lsb_release_contentcCs|jr@|j|j}tjj|j}tj|}|r<|jd|d<|Stjt }|j x\|D]T}|t krfqXtj|}|rXtjj t |}|j|}d|krX||_|jd|d<|SqXWiSdS)z Get the information items from the specified distro release file. Returns: A dictionary containing all information items. rIrr N) r#_parse_distro_release_filerrbasename _DISTRO_RELEASE_BASENAME_PATTERNrDr\listdirr sort _DISTRO_RELEASE_IGNORE_BASENAMESr)r* distro_inforyrDZ basenamesfilepathrrrr(s,     z*LinuxDistribution._get_distro_release_infoc Cs.tjj|r*t|}|j|jSQRXiS)z Parse a distro release file. Parameters: * filepath: Path name of the distro release file. Returns: A dictionary containing all information items. N)rrrLrMr?readline)r*rfprrrrxs  z,LinuxDistribution._parse_distro_release_filecCst|tr|jd}tj|jddd }i}|r|jdddd |d<|jdrn|jdddd |d<|jdr|jdddd |d<n|r|j|d<|S) a Parse a line from a distro release file. Parameters: * line: Line from the distro release file. Must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. zutf-8NrIrgr rJr<rrrr)rVrWrX(_DISTRO_RELEASE_CONTENT_REVERSED_PATTERNrDr]r\)rwrFr~rrrr?s     z/LinuxDistribution._parse_distro_release_contentN)Trr)T)F)FF)F)F)F)F)FF)__name__ __module__ __qualname____doc__r+r-rrr r r rrrrrrrrrrrrr$ staticmethodrNr&rpr(rxr?rrrrrs: @   !            < )rcCsddl}tjt}|jtj|jtjtj |j dd}|j ddddd|j }|j rv|jt jtd d d nB|jd td d td d }|r|jd|t}|r|jd|dS)NrzLinux distro info tool)r;z--jsonz-jz!Output in machine readable format store_true)helpactionT)indentZ sort_keyszName: %s)r z Version: %sz Codename: %s)argparseloggingZ getLoggerrZsetLevelDEBUGZ addHandlerZ StreamHandlerrTrdArgumentParser add_argument parse_argsjsonrdumpsr r r)rZloggerparserargsZdistribution_versionZdistribution_codenamerrrmains(     r__main__)T)F)FF)F)F)F)F)FF)+rrrBrTrrSrrkplatform startswith ImportErrorr,r r!r7r8r9rCrrzr}rrr r r rrrrrrrrrrrrobjectrrrrrrrrsd     K ' ,   ,    __pycache__/pyparsing.cpython-36.pyc000064400000610513152347724720013441 0ustar003 Pfk@s dZdZdZdZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZyddlmZWn ek rddlmZYnXydd l mZWn>ek rydd lmZWnek rdZYnXYnXd d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrgiZee jddsZeddskZer"e jZe Z!e"Z#e Z$e%e&e'e(e)ee*e+e,e-e.g Z/nbe j0Ze1Z2dtduZ$gZ/ddl3Z3xBdvj4D]6Z5ye/j6e7e3e5Wne8k r|wJYnXqJWe9dwdxe2dyDZ:dzd{Z;Gd|d}d}e<Z=ej>ej?Z@d~ZAeAdZBe@eAZCe"dZDdjEddxejFDZGGdd!d!eHZIGdd#d#eIZJGdd%d%eIZKGdd'd'eKZLGdd*d*eHZMGddde<ZNGdd&d&e<ZOe jPjQeOdd=ZRddNZSddKZTddZUddZVddZWddUZXd/ddZYGdd(d(e<ZZGdd0d0eZZ[Gddde[Z\Gddde[Z]Gddde[Z^e^Z_e^eZ_`Gddde[ZaGdd d e^ZbGdd d eaZcGddpdpe[ZdGdd3d3e[ZeGdd+d+e[ZfGdd)d)e[ZgGdd d e[ZhGdd2d2e[ZiGddde[ZjGdddejZkGdddejZlGdddejZmGdd.d.ejZnGdd-d-ejZoGdd5d5ejZpGdd4d4ejZqGdd$d$eZZrGdd d erZsGdd d erZtGddderZuGddderZvGdd"d"eZZwGdddewZxGdddewZyGdddewZzGdddezZ{Gdd6d6ezZ|Gddde<Z}e}Z~GdddewZGdd,d,ewZGdddewZGdddeZGdd1d1ewZGdddeZGdddeZGdddeZGdd/d/eZGddde<ZddfZd0ddDZd1dd@Zdd΄ZddSZddRZdd҄Zd2ddWZddEZd3ddkZddlZddnZe\jdGZeljdMZemjdLZenjdeZeojddZeeeDdddڍjdd܄Zefd݃jdd܄Zefd߃jdd܄ZeeBeBeeeGddydBefde jBZeeedeZe^dedjdee{eeBjddZddcZddQZdd`Zdd^ZddqZedd܄Zedd܄ZddZddOZddPZddiZe<e_d4ddoZe=Ze<e_e<e_ededfddmZeZeefddjdZeefddjdZeefddefddBjdZee_dejjdZdddejfddTZd5ddjZedZedZeeee@eCdjd\ZZeed j4d Zefd d jEejÃd jdZĐdd_ZeefddjdZefdjdZefdjȃjdZefdjdZeefddeBjdZeZefdjdZee{eeeGdɐdeeede^dɃemj΃jdZeeejeBddjd>ZGd drdrZeҐd!k rebd"Zebd#Zeee@eCd$ZeeՐd%dӐd&jeZeeeփjd'Zאd(eBZeeՐd%dӐd&jeZeeeكjd)ZeӐd*eؐd'eeڐd)Zejܐd+ejjܐd,ejjܐd,ejjܐd-ddlZejjeejejjܐd.dS(6aS pyparsing module - Classes and methods to define and execute parsing grammars The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions. With pyparsing, you don't need to learn a new syntax for defining grammars or matching expressions - the parsing module provides a library of classes that you use to construct the grammar directly in Python. Here is a program to parse "Hello, World!" (or any greeting of the form C{", !"}), built up using L{Word}, L{Literal}, and L{And} elements (L{'+'} operator gives L{And} expressions, strings are auto-converted to L{Literal} expressions):: from pyparsing import Word, alphas # define grammar of a greeting greet = Word(alphas) + "," + Word(alphas) + "!" hello = "Hello, World!" print (hello, "->", greet.parseString(hello)) The program outputs the following:: Hello, World! -> ['Hello', ',', 'World', '!'] The Python representation of the grammar is quite readable, owing to the self-explanatory class names, and the use of '+', '|' and '^' operators. The L{ParseResults} object returned from L{ParserElement.parseString} can be accessed as a nested list, a dictionary, or an object with named attributes. The pyparsing module handles some of the problems that are typically vexing when writing text parsers: - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello , World !", etc.) - quoted strings - embedded comments z2.1.10z07 Oct 2016 01:31 UTCz*Paul McGuire N)ref)datetime)RLock) OrderedDictAndCaselessKeywordCaselessLiteral CharsNotInCombineDictEachEmpty FollowedByForward GoToColumnGroupKeywordLineEnd LineStartLiteral MatchFirstNoMatchNotAny OneOrMoreOnlyOnceOptionalOrParseBaseExceptionParseElementEnhanceParseExceptionParseExpressionParseFatalException ParseResultsParseSyntaxException ParserElement QuotedStringRecursiveGrammarExceptionRegexSkipTo StringEnd StringStartSuppressTokenTokenConverterWhiteWordWordEnd WordStart ZeroOrMore alphanumsalphas alphas8bit anyCloseTag anyOpenTag cStyleCommentcolcommaSeparatedListcommonHTMLEntity countedArraycppStyleCommentdblQuotedStringdblSlashComment delimitedListdictOfdowncaseTokensemptyhexnums htmlCommentjavaStyleCommentlinelineEnd lineStartlineno makeHTMLTags makeXMLTagsmatchOnlyAtColmatchPreviousExprmatchPreviousLiteral nestedExprnullDebugActionnumsoneOfopAssocoperatorPrecedence printablespunc8bitpythonStyleComment quotedString removeQuotesreplaceHTMLEntity replaceWith restOfLinesglQuotedStringsrange stringEnd stringStarttraceParseAction unicodeString upcaseTokens withAttribute indentedBlockoriginalTextForungroup infixNotation locatedExpr withClass CloseMatchtokenMappyparsing_commonc Cs`t|tr|Syt|Stk rZt|jtjd}td}|jdd|j |SXdS)aDrop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. xmlcharrefreplacez&#\d+;cSs$dtt|dddddS)Nz\ur)hexint)trw/usr/lib/python3.6/pyparsing.pysz_ustr..N) isinstanceZunicodestrUnicodeEncodeErrorencodesysgetdefaultencodingr'setParseActiontransformString)objretZ xmlcharrefrwrwrx_ustrs rz6sum len sorted reversed list tuple set any all min maxccs|] }|VqdS)Nrw).0yrwrwrx srrrcCs>d}dddjD}x"t||D]\}}|j||}q"W|S)z/Escape &, <, >, ", ', etc. in a string of data.z&><"'css|]}d|dVqdS)&;Nrw)rsrwrwrxrsz_xml_escape..zamp gt lt quot apos)splitzipreplace)dataZ from_symbolsZ to_symbolsZfrom_Zto_rwrwrx _xml_escapes rc@s eZdZdS) _ConstantsN)__name__ __module__ __qualname__rwrwrwrxrsr 0123456789Z ABCDEFabcdef\ccs|]}|tjkr|VqdS)N)stringZ whitespace)rcrwrwrxrsc@sPeZdZdZdddZeddZdd Zd d Zd d Z dddZ ddZ dS)rz7base exception class for all parsing runtime exceptionsrNcCs>||_|dkr||_d|_n ||_||_||_|||f|_dS)Nr)locmsgpstr parserElementargs)selfrrrelemrwrwrx__init__szParseBaseException.__init__cCs||j|j|j|jS)z internal factory method to simplify creating one type of ParseException from another - avoids having __init__ signature conflicts among subclasses )rrrr)clsperwrwrx_from_exceptionsz"ParseBaseException._from_exceptioncCsN|dkrt|j|jS|dkr,t|j|jS|dkrBt|j|jSt|dS)zsupported attributes by name are: - lineno - returns the line number of the exception text - col - returns the column number of the exception text - line - returns the line containing the exception text rJr9columnrGN)r9r)rJrrr9rGAttributeError)rZanamerwrwrx __getattr__szParseBaseException.__getattr__cCsd|j|j|j|jfS)Nz"%s (at char %d), (line:%d, col:%d))rrrJr)rrwrwrx__str__szParseBaseException.__str__cCst|S)N)r)rrwrwrx__repr__szParseBaseException.__repr__>!} ('-' operator) indicates that parsing is to stop immediately because an unbacktrackable syntax error has been foundN)rrrrrwrwrwrxr#sc@s eZdZdZddZddZdS)r&zZexception thrown by L{ParserElement.validate} if the grammar could be improperly recursivecCs ||_dS)N)parseElementTrace)rparseElementListrwrwrxrsz"RecursiveGrammarException.__init__cCs d|jS)NzRecursiveGrammarException: %s)r)rrwrwrxr sz!RecursiveGrammarException.__str__N)rrrrrrrwrwrwrxr&sc@s,eZdZddZddZddZddZd S) _ParseResultsWithOffsetcCs||f|_dS)N)tup)rZp1Zp2rwrwrxr$sz _ParseResultsWithOffset.__init__cCs |j|S)N)r)rirwrwrx __getitem__&sz#_ParseResultsWithOffset.__getitem__cCst|jdS)Nr)reprr)rrwrwrxr(sz _ParseResultsWithOffset.__repr__cCs|jd|f|_dS)Nr)r)rrrwrwrx setOffset*sz!_ParseResultsWithOffset.setOffsetN)rrrrrrrrwrwrwrxr#src@seZdZdZd[ddZddddefddZdd Zefd d Zd d Z ddZ ddZ ddZ e Z ddZddZddZddZddZereZeZeZn$eZeZeZddZd d!Zd"d#Zd$d%Zd&d'Zd\d(d)Zd*d+Zd,d-Zd.d/Zd0d1Z d2d3Z!d4d5Z"d6d7Z#d8d9Z$d:d;Z%d} - see L{ParserElement.setResultsName}) Example:: integer = Word(nums) date_str = (integer.setResultsName("year") + '/' + integer.setResultsName("month") + '/' + integer.setResultsName("day")) # equivalent form: # date_str = integer("year") + '/' + integer("month") + '/' + integer("day") # parseString returns a ParseResults object result = date_str.parseString("1999/12/31") def test(s, fn=repr): print("%s -> %s" % (s, fn(eval(s)))) test("list(result)") test("result[0]") test("result['month']") test("result.day") test("'month' in result") test("'minutes' in result") test("result.dump()", str) prints:: list(result) -> ['1999', '/', '12', '/', '31'] result[0] -> '1999' result['month'] -> '12' result.day -> '31' 'month' in result -> True 'minutes' in result -> False result.dump() -> ['1999', '/', '12', '/', '31'] - day: 31 - month: 12 - year: 1999 NTcCs"t||r|Stj|}d|_|S)NT)rzobject__new___ParseResults__doinit)rtoklistnameasListmodalZretobjrwrwrxrTs   zParseResults.__new__c Cs`|jrvd|_d|_d|_i|_||_||_|dkr6g}||trP|dd|_n||trft||_n|g|_t |_ |dk o|r\|sd|j|<||t rt |}||_||t dttfo|ddgfks\||tr|g}|r&||trt|jd||<ntt|dd||<|||_n6y|d||<Wn$tttfk rZ|||<YnXdS)NFrr)r_ParseResults__name_ParseResults__parent_ParseResults__accumNames_ParseResults__asList_ParseResults__modallist_ParseResults__toklist_generatorTypedict_ParseResults__tokdictrurr basestringr"rcopyKeyError TypeError IndexError)rrrrrrzrwrwrxr]sB     $   zParseResults.__init__cCsPt|ttfr|j|S||jkr4|j|ddStdd|j|DSdS)NrrrcSsg|] }|dqS)rrw)rvrwrwrx sz,ParseResults.__getitem__..rs)rzruslicerrrr")rrrwrwrxrs   zParseResults.__getitem__cCs||tr0|jj|t|g|j|<|d}nD||ttfrN||j|<|}n&|jj|tt|dg|j|<|}||trt||_ dS)Nr) rrgetrrurrr"wkrefr)rkrrzsubrwrwrx __setitem__s   " zParseResults.__setitem__c Cst|ttfrt|j}|j|=t|trH|dkr:||7}t||d}tt|j|}|jx^|j j D]F\}}x<|D]4}x.t |D]"\}\}} t || | |k||<qWq|WqnWn|j |=dS)Nrrr) rzrurlenrrrangeindicesreverseritems enumerater) rrZmylenZremovedr occurrencesjrvaluepositionrwrwrx __delitem__s   $zParseResults.__delitem__cCs ||jkS)N)r)rrrwrwrx __contains__szParseResults.__contains__cCs t|jS)N)rr)rrwrwrx__len__szParseResults.__len__cCs |j S)N)r)rrwrwrx__bool__szParseResults.__bool__cCs t|jS)N)iterr)rrwrwrx__iter__szParseResults.__iter__cCst|jdddS)Nrrrs)rr)rrwrwrx __reversed__szParseResults.__reversed__cCs$t|jdr|jjSt|jSdS)Niterkeys)hasattrrrr)rrwrwrx _iterkeyss  zParseResults._iterkeyscsfddjDS)Nc3s|]}|VqdS)Nrw)rr)rrwrxrsz+ParseResults._itervalues..)r)rrw)rrx _itervaluesszParseResults._itervaluescsfddjDS)Nc3s|]}||fVqdS)Nrw)rr)rrwrxrsz*ParseResults._iteritems..)r)rrw)rrx _iteritemsszParseResults._iteritemscCs t|jS)zVReturns all named result keys (as a list in Python 2.x, as an iterator in Python 3.x).)rr)rrwrwrxkeysszParseResults.keyscCs t|jS)zXReturns all named result values (as a list in Python 2.x, as an iterator in Python 3.x).)r itervalues)rrwrwrxvaluesszParseResults.valuescCs t|jS)zfReturns all named result key-values (as a list of tuples in Python 2.x, as an iterator in Python 3.x).)r iteritems)rrwrwrxrszParseResults.itemscCs t|jS)zSince keys() returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.)boolr)rrwrwrxhaskeysszParseResults.haskeyscOs|s dg}x6|jD]*\}}|dkr2|d|f}qtd|qWt|dtsht|dksh|d|kr|d}||}||=|S|d}|SdS)a Removes and returns item at specified index (default=C{last}). Supports both C{list} and C{dict} semantics for C{pop()}. If passed no argument or an integer argument, it will use C{list} semantics and pop tokens from the list of parsed tokens. If passed a non-integer argument (most likely a string), it will use C{dict} semantics and pop the corresponding value from any defined results names. A second default return value argument is supported, just as in C{dict.pop()}. Example:: def remove_first(tokens): tokens.pop(0) print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321'] print(OneOrMore(Word(nums)).addParseAction(remove_first).parseString("0 123 321")) # -> ['123', '321'] label = Word(alphas) patt = label("LABEL") + OneOrMore(Word(nums)) print(patt.parseString("AAB 123 321").dump()) # Use pop() in a parse action to remove named result (note that corresponding value is not # removed from list form of results) def remove_LABEL(tokens): tokens.pop("LABEL") return tokens patt.addParseAction(remove_LABEL) print(patt.parseString("AAB 123 321").dump()) prints:: ['AAB', '123', '321'] - LABEL: AAB ['AAB', '123', '321'] rrdefaultrz-pop() got an unexpected keyword argument '%s'Nrs)rrrzrur)rrkwargsrrindexrZ defaultvaluerwrwrxpops"  zParseResults.popcCs||kr||S|SdS)ai Returns named result matching the given key, or if there is no such name, then returns the given C{defaultValue} or C{None} if no C{defaultValue} is specified. Similar to C{dict.get()}. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString("1999/12/31") print(result.get("year")) # -> '1999' print(result.get("hour", "not specified")) # -> 'not specified' print(result.get("hour")) # -> None Nrw)rkey defaultValuerwrwrxrszParseResults.getcCsZ|jj||xF|jjD]8\}}x.t|D]"\}\}}t||||k||<q,WqWdS)a Inserts new element at location index in the list of parsed tokens. Similar to C{list.insert()}. Example:: print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321'] # use a parse action to insert the parse location in the front of the parsed results def insert_locn(locn, tokens): tokens.insert(0, locn) print(OneOrMore(Word(nums)).addParseAction(insert_locn).parseString("0 123 321")) # -> [0, '0', '123', '321'] N)rinsertrrrr)rrZinsStrrrrrrrwrwrxr2szParseResults.insertcCs|jj|dS)a Add single element to end of ParseResults list of elements. Example:: print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321'] # use a parse action to compute the sum of the parsed integers, and add it to the end def append_sum(tokens): tokens.append(sum(map(int, tokens))) print(OneOrMore(Word(nums)).addParseAction(append_sum).parseString("0 123 321")) # -> ['0', '123', '321', 444] N)rappend)ritemrwrwrxrFs zParseResults.appendcCs$t|tr||7}n |jj|dS)a Add sequence of elements to end of ParseResults list of elements. Example:: patt = OneOrMore(Word(alphas)) # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): tokens.extend(reversed([t[::-1] for t in tokens])) return ''.join(tokens) print(patt.addParseAction(make_palindrome).parseString("lskdj sdlkjf lksd")) # -> 'lskdjsdlkjflksddsklfjkldsjdksl' N)rzr"rextend)rZitemseqrwrwrxrTs  zParseResults.extendcCs|jdd=|jjdS)z7 Clear all elements and results names. N)rrclear)rrwrwrxrfs zParseResults.clearc Csfy||Stk rdSX||jkr^||jkrD|j|ddStdd|j|DSndSdS)NrrrrcSsg|] }|dqS)rrw)rrrwrwrxrwsz,ParseResults.__getattr__..rs)rrrr")rrrwrwrxrms  zParseResults.__getattr__cCs|j}||7}|S)N)r)rotherrrwrwrx__add__{szParseResults.__add__cs|jrnt|jfdd|jj}fdd|D}x4|D],\}}|||<t|dtr>t||d_q>W|j|j7_|jj |j|S)Ncs|dkr S|S)Nrrw)a)offsetrwrxrysz'ParseResults.__iadd__..c s4g|],\}}|D]}|t|d|dfqqS)rrr)r)rrvlistr) addoffsetrwrxrsz)ParseResults.__iadd__..r) rrrrrzr"rrrupdate)rrZ otheritemsZotherdictitemsrrrw)rrrx__iadd__s    zParseResults.__iadd__cCs&t|tr|dkr|jS||SdS)Nr)rzrur)rrrwrwrx__radd__szParseResults.__radd__cCsdt|jt|jfS)Nz(%s, %s))rrr)rrwrwrxrszParseResults.__repr__cCsddjdd|jDdS)N[z, css(|] }t|trt|nt|VqdS)N)rzr"rr)rrrwrwrxrsz'ParseResults.__str__..])rr)rrwrwrxrszParseResults.__str__rcCsPg}xF|jD]<}|r"|r"|j|t|tr:||j7}q |jt|q W|S)N)rrrzr" _asStringListr)rsepoutrrwrwrxr s   zParseResults._asStringListcCsdd|jDS)a Returns the parse results as a nested list of matching tokens, all converted to strings. Example:: patt = OneOrMore(Word(alphas)) result = patt.parseString("sldkj lsdkj sldkj") # even though the result prints in string-like form, it is actually a pyparsing ParseResults print(type(result), result) # -> ['sldkj', 'lsdkj', 'sldkj'] # Use asList() to create an actual list result_list = result.asList() print(type(result_list), result_list) # -> ['sldkj', 'lsdkj', 'sldkj'] cSs"g|]}t|tr|jn|qSrw)rzr"r)rresrwrwrxrsz'ParseResults.asList..)r)rrwrwrxrszParseResults.asListcs6tr |j}n|j}fddtfdd|DS)a Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString('12/31/1999') print(type(result), repr(result)) # -> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]}) result_dict = result.asDict() print(type(result_dict), repr(result_dict)) # -> {'day': '1999', 'year': '12', 'month': '31'} # even though a ParseResults supports dict-like access, sometime you just need to have a dict import json print(json.dumps(result)) # -> Exception: TypeError: ... is not JSON serializable print(json.dumps(result.asDict())) # -> {"month": "31", "day": "1999", "year": "12"} cs6t|tr.|jr|jSfdd|DSn|SdS)Ncsg|] }|qSrwrw)rr)toItemrwrxrsz7ParseResults.asDict..toItem..)rzr"rasDict)r)rrwrxrs  z#ParseResults.asDict..toItemc3s|]\}}||fVqdS)Nrw)rrr)rrwrxrsz&ParseResults.asDict..)PY_3rrr)rZitem_fnrw)rrxrs  zParseResults.asDictcCs8t|j}|jj|_|j|_|jj|j|j|_|S)zA Returns a new copy of a C{ParseResults} object. )r"rrrrrrr)rrrwrwrxrs   zParseResults.copyFc CsPd}g}tdd|jjD}|d}|s8d}d}d}d} |dk rJ|} n |jrV|j} | sf|rbdSd} |||d| d g7}xt|jD]\} } t| tr| |kr|| j|| |o|dk||g7}n|| jd|o|dk||g7}qd} | |kr|| } | s |rqnd} t t | } |||d| d | d | d g 7}qW|||d | d g7}dj |S) z (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.  css(|] \}}|D]}|d|fVqqdS)rrNrw)rrrrrwrwrxrsz%ParseResults.asXML..z rNZITEM<>z.z %s%s- %s: z rrcss|]}t|tVqdS)N)rzr")rvvrwrwrxrssz %s%s[%d]: %s%s%sr) rrrrsortedrrzr"dumpranyrr) rrdepthfullr NLrrrrrrwrwrxrPs,   4.zParseResults.dumpcOstj|jf||dS)a Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint}) Example:: ident = Word(alphas, alphanums) num = Word(nums) func = Forward() term = ident | num | Group('(' + func + ')') func <<= ident + Group(Optional(delimitedList(term))) result = func.parseString("fna a,b,(fnb c,d,200),100") result.pprint(width=40) prints:: ['fna', ['a', 'b', ['(', 'fnb', ['c', 'd', '200'], ')'], '100']] N)pprintr)rrrrwrwrxr"}szParseResults.pprintcCs.|j|jj|jdk r|jp d|j|jffS)N)rrrrrr)rrwrwrx __getstate__s zParseResults.__getstate__cCsN|d|_|d\|_}}|_i|_|jj||dk rDt||_nd|_dS)Nrrr)rrrrrrr)rstaterZ inAccumNamesrwrwrx __setstate__s   zParseResults.__setstate__cCs|j|j|j|jfS)N)rrrr)rrwrwrx__getnewargs__szParseResults.__getnewargs__cCstt|t|jS)N)rrrr)rrwrwrxrszParseResults.__dir__)NNTT)N)r)NFrT)rrT)4rrrrrrzrrrrrrr __nonzero__rrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrr"r#r%r&rrwrwrwrxr"-sh& ' 4  # =% - cCsF|}d|kot|knr4||ddkr4dS||jdd|S)aReturns current column within a string, counting newlines as line separators. The first column is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}} for more information on parsing strings containing C{}s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. rrrr)rrfind)rstrgrrwrwrxr9s cCs|jdd|dS)aReturns current line number within a string, counting newlines as line separators. The first line is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}} for more information on parsing strings containing C{}s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. rrrr)count)rr)rwrwrxrJs cCsF|jdd|}|jd|}|dkr2||d|S||ddSdS)zfReturns the line of text containing loc within a string, counting newlines as line separators. rrrrN)r(find)rr)ZlastCRZnextCRrwrwrxrGs  cCs8tdt|dt|dt||t||fdS)NzMatch z at loc z(%d,%d))printrrJr9)instringrexprrwrwrx_defaultStartDebugActionsr/cCs$tdt|dt|jdS)NzMatched z -> )r,rr{r)r-startlocZendlocr.toksrwrwrx_defaultSuccessDebugActionsr2cCstdt|dS)NzException raised:)r,r)r-rr.excrwrwrx_defaultExceptionDebugActionsr4cGsdS)zG'Do-nothing' debug action, to suppress debugging output during parsing.Nrw)rrwrwrxrQsrqc stkrfddSdgdgtdddkrFddd }dd d n tj}tjd }|dd d}|d|d|ffdd}d}ytdtdj}Wntk rt}YnX||_|S)Ncs|S)Nrw)rlrv)funcrwrxrysz_trim_arity..rFrqrocSs8tdkr dnd }tj| |dd|}|j|jfgS) Nror7rrqrr)limit)ror7r)system_version traceback extract_stackfilenamerJ)r8r frame_summaryrwrwrxr=sz"_trim_arity..extract_stackcSs$tj||d}|d}|j|jfgS)N)r8rrrs)r< extract_tbr>rJ)tbr8Zframesr?rwrwrxr@sz_trim_arity..extract_tb)r8rrcsxy |dd}dd<|Stk rdr>n4z.tjd}|dddddksjWd~Xdkrdd7<wYqXqWdS)NrTrrrq)r8rsrs)rr~exc_info)rrrA)r@ foundArityr6r8maxargspa_call_line_synthrwrxwrappers"  z_trim_arity..wrapperzr __class__)ror7)r)rrs) singleArgBuiltinsr;r<r=r@getattrr Exceptionr{)r6rEr=Z LINE_DIFFZ this_linerG func_namerw)r@rDr6r8rErFrx _trim_aritys*   rMcseZdZdZdZdZeddZeddZddd Z d d Z d d Z dddZ dddZ ddZddZddZddZddZddZddd Zd!d"Zdd#d$Zd%d&Zd'd(ZGd)d*d*eZed+k rGd,d-d-eZnGd.d-d-eZiZeZd/d/gZ dd0d1Z!eZ"ed2d3Z#dZ$edd5d6Z%dd7d8Z&e'dfd9d:Z(d;d<Z)e'fd=d>Z*e'dfd?d@Z+dAdBZ,dCdDZ-dEdFZ.dGdHZ/dIdJZ0dKdLZ1dMdNZ2dOdPZ3dQdRZ4dSdTZ5dUdVZ6dWdXZ7dYdZZ8dd[d\Z9d]d^Z:d_d`Z;dadbZdgdhZ?ddidjZ@dkdlZAdmdnZBdodpZCdqdrZDgfdsdtZEddudvZFfdwdxZGdydzZHd{d|ZId}d~ZJddZKdddZLdddZMZNS)r$z)Abstract base level parser element class.z FcCs |t_dS)a Overrides the default whitespace chars Example:: # default whitespace chars are space, and newline OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl'] # change to just treat newline as significant ParserElement.setDefaultWhitespaceChars(" \t") OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def'] N)r$DEFAULT_WHITE_CHARS)charsrwrwrxsetDefaultWhitespaceChars=s z'ParserElement.setDefaultWhitespaceCharscCs |t_dS)a Set class to be used for inclusion of string literals into a parser. Example:: # default literal class used is Literal integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parseString("1999/12/31") # -> ['1999', '/', '12', '/', '31'] # change to Suppress ParserElement.inlineLiteralsUsing(Suppress) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parseString("1999/12/31") # -> ['1999', '12', '31'] N)r$_literalStringClass)rrwrwrxinlineLiteralsUsingLsz!ParserElement.inlineLiteralsUsingcCst|_d|_d|_d|_||_d|_tj|_ d|_ d|_ d|_ t|_ d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)NTFr)NNN)r parseAction failActionstrRepr resultsName saveAsListskipWhitespacer$rN whiteCharscopyDefaultWhiteCharsmayReturnEmptykeepTabs ignoreExprsdebug streamlined mayIndexErrorerrmsg modalResults debugActionsre callPreparse callDuringTry)rsavelistrwrwrxras(zParserElement.__init__cCs<tj|}|jdd|_|jdd|_|jr8tj|_|S)a$ Make a copy of this C{ParserElement}. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element. Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) integerK = integer.copy().addParseAction(lambda toks: toks[0]*1024) + Suppress("K") integerM = integer.copy().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M") print(OneOrMore(integerK | integerM | integer).parseString("5K 100 640K 256M")) prints:: [5120, 100, 655360, 268435456] Equivalent form of C{expr.copy()} is just C{expr()}:: integerM = integer().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M") N)rrSr]rZr$rNrY)rZcpyrwrwrxrxs  zParserElement.copycCs*||_d|j|_t|dr&|j|j_|S)af Define name for this expression, makes debugging and exception messages clearer. Example:: Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1) Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char 0), (line:1, col:1) z Expected exception)rrarrhr)rrrwrwrxsetNames    zParserElement.setNamecCs4|j}|jdr"|dd}d}||_| |_|S)aP Define name for referencing matching tokens as a nested attribute of the returned parse results. NOTE: this returns a *copy* of the original C{ParserElement} object; this is so that the client can define a basic element, such as an integer, and reference it in multiple places with different names. You can also set results names using the abbreviated syntax, C{expr("name")} in place of C{expr.setResultsName("name")} - see L{I{__call__}<__call__>}. Example:: date_str = (integer.setResultsName("year") + '/' + integer.setResultsName("month") + '/' + integer.setResultsName("day")) # equivalent form: date_str = integer("year") + '/' + integer("month") + '/' + integer("day") *NrrTrs)rendswithrVrb)rrlistAllMatchesZnewselfrwrwrxsetResultsNames  zParserElement.setResultsNameTcs@|r&|jdfdd }|_||_nt|jdr<|jj|_|S)zMethod to invoke the Python pdb debugger when this element is about to be parsed. Set C{breakFlag} to True to enable, False to disable. Tcsddl}|j||||S)Nr)pdbZ set_trace)r-r doActions callPreParsern) _parseMethodrwrxbreakersz'ParserElement.setBreak..breaker_originalParseMethod)TT)_parsersr)rZ breakFlagrrrw)rqrxsetBreaks  zParserElement.setBreakcOs&tttt||_|jdd|_|S)a  Define action to perform when successfully matching parse element definition. Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)}, C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where: - s = the original string being parsed (see note below) - loc = the location of the matching substring - toks = a list of the matched tokens, packaged as a C{L{ParseResults}} object If the functions in fns modify the tokens, they can return them as the return value from fn, and the modified list of tokens will replace the original. Otherwise, fn does not need to return any value. Optional keyword arguments: - callDuringTry = (default=C{False}) indicate if parse action should be run during lookaheads and alternate testing Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{parseString}} for more information on parsing strings containing C{}s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. Example:: integer = Word(nums) date_str = integer + '/' + integer + '/' + integer date_str.parseString("1999/12/31") # -> ['1999', '/', '12', '/', '31'] # use parse action to convert to ints at parse time integer = Word(nums).setParseAction(lambda toks: int(toks[0])) date_str = integer + '/' + integer + '/' + integer # note that integer fields are now ints, not strings date_str.parseString("1999/12/31") # -> [1999, '/', 12, '/', 31] rfF)rmaprMrSrrf)rfnsrrwrwrxrs"zParserElement.setParseActioncOs4|jtttt|7_|jp,|jdd|_|S)z Add parse action to expression's list of parse actions. See L{I{setParseAction}}. See examples in L{I{copy}}. rfF)rSrrvrMrfr)rrwrrwrwrxaddParseActionszParserElement.addParseActioncsb|jdd|jddrtntx(|D] fdd}|jj|q&W|jpZ|jdd|_|S)aAdd a boolean predicate function to expression's list of parse actions. See L{I{setParseAction}} for function call signatures. Unlike C{setParseAction}, functions passed to C{addCondition} need to return boolean success/fail of the condition. Optional keyword arguments: - message = define a custom message to be used in the raised exception - fatal = if True, will raise ParseFatalException to stop parsing immediately; otherwise will raise ParseException Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) year_int = integer.copy() year_int.addCondition(lambda toks: toks[0] >= 2000, message="Only support years 2000 and later") date_str = year_int + '/' + integer + '/' + integer result = date_str.parseString("1999/12/31") # -> Exception: Only support years 2000 and later (at char 0), (line:1, col:1) messagezfailed user-defined conditionfatalFcs$tt|||s ||dS)N)rrM)rr5rv)exc_typefnrrwrxpasz&ParserElement.addCondition..parf)rr!rrSrrf)rrwrr}rw)r{r|rrx addConditions  zParserElement.addConditioncCs ||_|S)a Define action to perform if parsing fails at this expression. Fail acton fn is a callable function that takes the arguments C{fn(s,loc,expr,err)} where: - s = string being parsed - loc = location where expression match was attempted and failed - expr = the parse expression that failed - err = the exception thrown The function returns no value. It may throw C{L{ParseFatalException}} if it is desired to stop parsing immediately.)rT)rr|rwrwrx setFailActions zParserElement.setFailActionc CsZd}xP|rTd}xB|jD]8}yx|j||\}}d}qWWqtk rLYqXqWqW|S)NTF)r]rtr)rr-rZ exprsFoundeZdummyrwrwrx_skipIgnorables#s  zParserElement._skipIgnorablescCsL|jr|j||}|jrH|j}t|}x ||krF|||krF|d7}q(W|S)Nrr)r]rrXrYr)rr-rZwtinstrlenrwrwrxpreParse0s  zParserElement.preParsecCs|gfS)Nrw)rr-rrorwrwrx parseImpl<szParserElement.parseImplcCs|S)Nrw)rr-r tokenlistrwrwrx postParse?szParserElement.postParsec "Cs|j}|s|jr|jdr,|jd||||rD|jrD|j||}n|}|}yDy|j|||\}}Wn(tk rt|t||j |YnXWnXt k r} z<|jdr|jd|||| |jr|j|||| WYdd} ~ XnXn|o|jr|j||}n|}|}|j s$|t|krhy|j|||\}}Wn*tk rdt|t||j |YnXn|j|||\}}|j |||}t ||j|j|jd} |jr|s|jr|rVyRxL|jD]B} | ||| }|dk rt ||j|jot|t tf|jd} qWWnFt k rR} z(|jdr@|jd|||| WYdd} ~ XnXnNxL|jD]B} | ||| }|dk r^t ||j|jot|t tf|jd} q^W|r|jdr|jd||||| || fS)Nrrq)rrrr)r^rTrcrerrrrrrarr`rr"rVrWrbrSrfrzr) rr-rrorpZ debuggingprelocZ tokensStarttokenserrZ retTokensr|rwrwrx _parseNoCacheCsp             zParserElement._parseNoCachec Cs>y|j||dddStk r8t|||j|YnXdS)NF)ror)rtr!rra)rr-rrwrwrxtryParseszParserElement.tryParsec Cs2y|j||Wnttfk r(dSXdSdS)NFT)rrr)rr-rrwrwrx canParseNexts zParserElement.canParseNextc@seZdZddZdS)zParserElement._UnboundedCachecsdit|_fdd}fdd}fdd}tj|||_tj|||_tj|||_dS)Ncs j|S)N)r)rr)cache not_in_cacherwrxrsz3ParserElement._UnboundedCache.__init__..getcs ||<dS)Nrw)rrr)rrwrxsetsz3ParserElement._UnboundedCache.__init__..setcs jdS)N)r)r)rrwrxrsz5ParserElement._UnboundedCache.__init__..clear)rrtypes MethodTyperrr)rrrrrw)rrrxrs   z&ParserElement._UnboundedCache.__init__N)rrrrrwrwrwrx_UnboundedCachesrNc@seZdZddZdS)zParserElement._FifoCachecsht|_tfdd}fdd}fdd}tj|||_tj|||_tj|||_dS)Ncs j|S)N)r)rr)rrrwrxrsz.ParserElement._FifoCache.__init__..getcs"||<tkrjddS)NF)rpopitem)rrr)rsizerwrxrs z.ParserElement._FifoCache.__init__..setcs jdS)N)r)r)rrwrxrsz0ParserElement._FifoCache.__init__..clear)rr _OrderedDictrrrrr)rrrrrrw)rrrrxrs  z!ParserElement._FifoCache.__init__N)rrrrrwrwrwrx _FifoCachesrc@seZdZddZdS)zParserElement._FifoCachecsvt|_itjgfdd}fdd}fdd}tj|||_tj|||_tj|||_dS)Ncs j|S)N)r)rr)rrrwrxrsz.ParserElement._FifoCache.__init__..getcs2||<tkr$jjdj|dS)N)rrpopleftr)rrr)rkey_fiforrwrxrs z.ParserElement._FifoCache.__init__..setcsjjdS)N)r)r)rrrwrxrsz0ParserElement._FifoCache.__init__..clear) rr collectionsdequerrrrr)rrrrrrw)rrrrrxrs  z!ParserElement._FifoCache.__init__N)rrrrrwrwrwrxrsrc Csd\}}|||||f}tjtj}|j|} | |jkrtj|d7<y|j||||} Wn8tk r} z|j|| j | j WYdd} ~ XqX|j|| d| dj f| Sn4tj|d7<t | t r| | d| dj fSWdQRXdS)Nrrr)rrr)r$packrat_cache_lock packrat_cacherrpackrat_cache_statsrrrrHrrrzrK) rr-rrorpZHITZMISSlookuprrrrwrwrx _parseCaches$   zParserElement._parseCachecCs(tjjdgttjtjdd<dS)Nr)r$rrrrrwrwrwrx resetCaches zParserElement.resetCachecCs8tjs4dt_|dkr tjt_n tj|t_tjt_dS)aEnables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing parsing/validating code. Memoizing is done of both valid results and parsing exceptions. Parameters: - cache_size_limit - (default=C{128}) - if an integer value is provided will limit the size of the packrat cache; if None is passed, then the cache size will be unbounded; if 0 is passed, the cache will be effectively disabled. This speedup may break existing programs that use parse actions that have side-effects. For this reason, packrat parsing is disabled when you first import pyparsing. To activate the packrat feature, your program must call the class method C{ParserElement.enablePackrat()}. If your program uses C{psyco} to "compile as you go", you must call C{enablePackrat} before calling C{psyco.full()}. If you do not do this, Python will crash. For best results, call C{enablePackrat()} immediately after importing pyparsing. Example:: import pyparsing pyparsing.ParserElement.enablePackrat() TN)r$_packratEnabledrrrrrt)Zcache_size_limitrwrwrx enablePackrats   zParserElement.enablePackratcCstj|js|jx|jD] }|jqW|js<|j}y<|j|d\}}|rv|j||}t t }|j||Wn0t k r}ztj rn|WYdd}~XnX|SdS)aB Execute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built. If you want the grammar to require that the entire input string be successfully parsed, then set C{parseAll} to True (equivalent to ending the grammar with C{L{StringEnd()}}). Note: C{parseString} implicitly calls C{expandtabs()} on the input string, in order to report proper column numbers in parse actions. If the input string contains tabs and the grammar uses parse actions that use the C{loc} argument to index into the string being parsed, you can ensure you have a consistent view of the input string by: - calling C{parseWithTabs} on your grammar before calling C{parseString} (see L{I{parseWithTabs}}) - define your parse action using the full C{(s,loc,toks)} signature, and reference the input string using the parse action's C{s} argument - explictly expand the tabs in your input string before calling C{parseString} Example:: Word('a').parseString('aaaaabaaa') # -> ['aaaaa'] Word('a').parseString('aaaaabaaa', parseAll=True) # -> Exception: Expected end of text rN) r$rr_ streamliner]r\ expandtabsrtrr r)rverbose_stacktrace)rr-parseAllrrrZser3rwrwrx parseString#s$    zParserElement.parseStringccs@|js|jx|jD] }|jqW|js8t|j}t|}d}|j}|j}t j d} yx||kon| |kry |||} ||| dd\} } Wnt k r| d}Yq`X| |kr| d7} | | | fV|r|||} | |kr| }q|d7}n| }q`| d}q`WWn4t k r:}zt j r&n|WYdd}~XnXdS)a Scan the input string for expression matches. Each match will return the matching tokens, start location, and end location. May be called with optional C{maxMatches} argument, to clip scanning after 'n' matches are found. If C{overlap} is specified, then overlapping matches will be reported. Note that the start and end locations are reported relative to the string being parsed. See L{I{parseString}} for more information on parsing strings with embedded tabs. Example:: source = "sldjf123lsdjjkf345sldkjf879lkjsfd987" print(source) for tokens,start,end in Word(alphas).scanString(source): print(' '*start + '^'*(end-start)) print(' '*start + tokens[0]) prints:: sldjf123lsdjjkf345sldkjf879lkjsfd987 ^^^^^ sldjf ^^^^^^^ lsdjjkf ^^^^^^ sldkjf ^^^^^^ lkjsfd rF)rprrN)r_rr]r\rrrrrtr$rrrr)rr- maxMatchesZoverlaprrrZ preparseFnZparseFnmatchesrZnextLocrZnextlocr3rwrwrx scanStringUsB       zParserElement.scanStringcCsg}d}d|_yxh|j|D]Z\}}}|j||||rrt|trT||j7}nt|trh||7}n |j||}qW|j||ddd|D}djtt t |St k r}zt j rȂn|WYdd}~XnXdS)af Extension to C{L{scanString}}, to modify matching text with modified tokens that may be returned from a parse action. To use C{transformString}, define a grammar and attach a parse action to it that modifies the returned token list. Invoking C{transformString()} on a target string will then scan for matches, and replace the matched text patterns according to the logic in the parse action. C{transformString()} returns the resulting transformed string. Example:: wd = Word(alphas) wd.setParseAction(lambda toks: toks[0].title()) print(wd.transformString("now is the winter of our discontent made glorious summer by this sun of york.")) Prints:: Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York. rTNcSsg|] }|r|qSrwrw)rorwrwrxrsz1ParserElement.transformString..r)r\rrrzr"rrrrvr_flattenrr$r)rr-r ZlastErvrrr3rwrwrxrs(    zParserElement.transformStringcCsPytdd|j||DStk rJ}ztjr6n|WYdd}~XnXdS)a~ Another extension to C{L{scanString}}, simplifying the access to the tokens found to match the given parse expression. May be called with optional C{maxMatches} argument, to clip searching after 'n' matches are found. Example:: # a capitalized word starts with an uppercase letter, followed by zero or more lowercase letters cap_word = Word(alphas.upper(), alphas.lower()) print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")) prints:: ['More', 'Iron', 'Lead', 'Gold', 'I'] cSsg|]\}}}|qSrwrw)rrvrrrwrwrxrsz.ParserElement.searchString..N)r"rrr$r)rr-rr3rwrwrx searchStrings zParserElement.searchStringc csXd}d}x<|j||dD]*\}}}|||V|r>|dV|}qW||dVdS)a[ Generator method to split a string using the given expression as a separator. May be called with optional C{maxsplit} argument, to limit the number of splits; and the optional C{includeSeparators} argument (default=C{False}), if the separating matching text should be included in the split results. Example:: punc = oneOf(list(".,;:/-!?")) print(list(punc.split("This, this?, this sentence, is badly punctuated!"))) prints:: ['This', ' this', '', ' this sentence', ' is badly punctuated', ''] r)rN)r) rr-maxsplitZincludeSeparatorsZsplitsZlastrvrrrwrwrxrs  zParserElement.splitcCsFt|trtj|}t|ts:tjdt|tdddSt||gS)a Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement converts them to L{Literal}s by default. Example:: greet = Word(alphas) + "," + Word(alphas) + "!" hello = "Hello, World!" print (hello, "->", greet.parseString(hello)) Prints:: Hello, World! -> ['Hello', ',', 'World', '!'] z4Cannot combine element of type %s with ParserElementrq) stacklevelN) rzrr$rQwarningswarnr SyntaxWarningr)rrrwrwrxrs    zParserElement.__add__cCsBt|trtj|}t|ts:tjdt|tdddS||S)z] Implementation of + operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrxrs    zParserElement.__radd__cCsLt|trtj|}t|ts:tjdt|tdddSt|tj |gS)zQ Implementation of - operator, returns C{L{And}} with error stop z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr _ErrorStop)rrrwrwrx__sub__s    zParserElement.__sub__cCsBt|trtj|}t|ts:tjdt|tdddS||S)z] Implementation of - operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__rsub__ s    zParserElement.__rsub__cst|tr|d}}nt|tr|d dd}|ddkrHd|df}t|dtr|ddkr|ddkrvtS|ddkrtS|dtSnJt|dtrt|dtr|\}}||8}ntdt|dt|dntdt||dkr td|dkrtd||ko2dknrBtd |rfd d |r|dkrt|}ntg||}n|}n|dkr}ntg|}|S) a Implementation of * operator, allows use of C{expr * 3} in place of C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples may also include C{None} as in: - C{expr*(n,None)} or C{expr*(n,)} is equivalent to C{expr*n + L{ZeroOrMore}(expr)} (read as "at least n instances of C{expr}") - C{expr*(None,n)} is equivalent to C{expr*(0,n)} (read as "0 to n instances of C{expr}") - C{expr*(None,None)} is equivalent to C{L{ZeroOrMore}(expr)} - C{expr*(1,None)} is equivalent to C{L{OneOrMore}(expr)} Note that C{expr*(None,n)} does not raise an exception if more than n exprs exist in the input stream; that is, C{expr*(None,n)} does not enforce a maximum number of expr occurrences. If this behavior is desired, then write C{expr*(None,n) + ~expr} rNrqrrz7cannot multiply 'ParserElement' and ('%s','%s') objectsz0cannot multiply 'ParserElement' and '%s' objectsz/cannot multiply ParserElement by negative valuez@second tuple value must be greater or equal to first tuple valuez+cannot multiply ParserElement by 0 or (0,0)cs(|dkrt|dStSdS)Nrr)r)n)makeOptionalListrrwrxr]sz/ParserElement.__mul__..makeOptionalList)NN) rzrutupler2rrr ValueErrorr)rrZ minElementsZ optElementsrrw)rrrx__mul__,sD             zParserElement.__mul__cCs |j|S)N)r)rrrwrwrx__rmul__pszParserElement.__rmul__cCsFt|trtj|}t|ts:tjdt|tdddSt||gS)zI Implementation of | operator - returns C{L{MatchFirst}} z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr)rrrwrwrx__or__ss    zParserElement.__or__cCsBt|trtj|}t|ts:tjdt|tdddS||BS)z] Implementation of | operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__ror__s    zParserElement.__ror__cCsFt|trtj|}t|ts:tjdt|tdddSt||gS)zA Implementation of ^ operator - returns C{L{Or}} z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr)rrrwrwrx__xor__s    zParserElement.__xor__cCsBt|trtj|}t|ts:tjdt|tdddS||AS)z] Implementation of ^ operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__rxor__s    zParserElement.__rxor__cCsFt|trtj|}t|ts:tjdt|tdddSt||gS)zC Implementation of & operator - returns C{L{Each}} z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr )rrrwrwrx__and__s    zParserElement.__and__cCsBt|trtj|}t|ts:tjdt|tdddS||@S)z] Implementation of & operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__rand__s    zParserElement.__rand__cCst|S)zE Implementation of ~ operator - returns C{L{NotAny}} )r)rrwrwrx __invert__szParserElement.__invert__cCs|dk r|j|S|jSdS)a  Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}. If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be passed as C{True}. If C{name} is omitted, same as calling C{L{copy}}. Example:: # these are equivalent userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno") userdata = Word(alphas)("name") + Word(nums+"-")("socsecno") N)rmr)rrrwrwrx__call__s zParserElement.__call__cCst|S)z Suppresses the output of this C{ParserElement}; useful to keep punctuation from cluttering up returned output. )r+)rrwrwrxsuppressszParserElement.suppresscCs d|_|S)a Disables the skipping of whitespace before matching the characters in the C{ParserElement}'s defined pattern. This is normally only used internally by the pyparsing module, but may be needed in some whitespace-sensitive grammars. F)rX)rrwrwrxleaveWhitespaceszParserElement.leaveWhitespacecCsd|_||_d|_|S)z8 Overrides the default whitespace chars TF)rXrYrZ)rrOrwrwrxsetWhitespaceCharssz ParserElement.setWhitespaceCharscCs d|_|S)z Overrides default behavior to expand C{}s to spaces before parsing the input string. Must be called before C{parseString} when the input grammar contains elements that match C{} characters. T)r\)rrwrwrx parseWithTabsszParserElement.parseWithTabscCsLt|trt|}t|tr4||jkrH|jj|n|jjt|j|S)a Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:: patt = OneOrMore(Word(alphas)) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj'] patt.ignore(cStyleComment) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj', 'lskjd'] )rzrr+r]rr)rrrwrwrxignores   zParserElement.ignorecCs"|pt|p t|ptf|_d|_|S)zT Enable display of debugging messages while doing pattern matching. T)r/r2r4rcr^)rZ startActionZ successActionZexceptionActionrwrwrxsetDebugActions s  zParserElement.setDebugActionscCs|r|jtttnd|_|S)a Enable display of debugging messages while doing pattern matching. Set C{flag} to True to enable, False to disable. Example:: wd = Word(alphas).setName("alphaword") integer = Word(nums).setName("numword") term = wd | integer # turn on debugging for wd wd.setDebug() OneOrMore(term).parseString("abc 123 xyz 890") prints:: Match alphaword at loc 0(1,1) Matched alphaword -> ['abc'] Match alphaword at loc 3(1,4) Exception raised:Expected alphaword (at char 4), (line:1, col:5) Match alphaword at loc 7(1,8) Matched alphaword -> ['xyz'] Match alphaword at loc 11(1,12) Exception raised:Expected alphaword (at char 12), (line:1, col:13) Match alphaword at loc 15(1,16) Exception raised:Expected alphaword (at char 15), (line:1, col:16) The output shown is that produced by the default debug actions - custom debug actions can be specified using L{setDebugActions}. Prior to attempting to match the C{wd} expression, the debugging message C{"Match at loc (,)"} is shown. Then if the parse succeeds, a C{"Matched"} message is shown, or an C{"Exception raised"} message is shown. Also note the use of L{setName} to assign a human-readable name to the expression, which makes debugging and exception messages easier to understand - for instance, the default name created for the C{Word} expression without calling C{setName} is C{"W:(ABCD...)"}. F)rr/r2r4r^)rflagrwrwrxsetDebugs#zParserElement.setDebugcCs|jS)N)r)rrwrwrxr@szParserElement.__str__cCst|S)N)r)rrwrwrxrCszParserElement.__repr__cCsd|_d|_|S)NT)r_rU)rrwrwrxrFszParserElement.streamlinecCsdS)Nrw)rrrwrwrxcheckRecursionKszParserElement.checkRecursioncCs|jgdS)zj Check defined expressions for valid structure, check for infinite recursive definitions. N)r)r validateTracerwrwrxvalidateNszParserElement.validatecCsy |j}Wn2tk r>t|d}|j}WdQRXYnXy |j||Stk r|}ztjrhn|WYdd}~XnXdS)z Execute the parse expression on the given file or filename. If a filename is specified (instead of a file object), the entire file is opened, read, and closed before parsing. rN)readropenrrr$r)rZfile_or_filenamerZ file_contentsfr3rwrwrx parseFileTs   zParserElement.parseFilecsHt|tr"||kp t|t|kSt|tr6|j|Stt||kSdS)N)rzr$varsrrsuper)rr)rHrwrx__eq__hs    zParserElement.__eq__cCs ||k S)Nrw)rrrwrwrx__ne__pszParserElement.__ne__cCs tt|S)N)hashid)rrwrwrx__hash__sszParserElement.__hash__cCs||kS)Nrw)rrrwrwrx__req__vszParserElement.__req__cCs ||k S)Nrw)rrrwrwrx__rne__yszParserElement.__rne__c Cs0y|jt||ddStk r*dSXdS)a Method for quick testing of a parser against a test string. Good for simple inline microtests of sub expressions while building up larger parser. Parameters: - testString - to test against this expression for a match - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests Example:: expr = Word(nums) assert expr.matches("100") )rTFN)rrr)rZ testStringrrwrwrxr|s zParserElement.matches#cCst|tr"tttj|jj}t|tr4t|}g}g}d} x|D]} |dk rb|j | dsl|rx| rx|j | qH| s~qHdj || g} g}y:| j dd} |j | |d} | j | j|d| o| } Wntk rx} zt| trdnd }d| kr0| j t| j| | j d t| j| d d |n| j d | jd || j d t| | ob|} | } WYdd} ~ XnDtk r}z&| j dt|| o|} |} WYdd}~XnX|r|r| j d tdj | |j | | fqHW| |fS)a3 Execute the parse expression on a series of test strings, showing each test, the parsed results or where the parse failed. Quick and easy way to run a parse expression against a list of sample strings. Parameters: - tests - a list of separate test strings, or a multiline string of test strings - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests - comment - (default=C{'#'}) - expression for indicating embedded comments in the test string; pass None to disable comment filtering - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline; if False, only dump nested list - printResults - (default=C{True}) prints test output to stdout - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing Returns: a (success, results) tuple, where success indicates that all tests succeeded (or failed if C{failureTests} is True), and the results contain a list of lines of each test's output Example:: number_expr = pyparsing_common.number.copy() result = number_expr.runTests(''' # unsigned integer 100 # negative integer -100 # float with scientific notation 6.02e23 # integer with scientific notation 1e-12 ''') print("Success" if result[0] else "Failed!") result = number_expr.runTests(''' # stray character 100Z # missing leading digit before '.' -.100 # too many '.' 3.14.159 ''', failureTests=True) print("Success" if result[0] else "Failed!") prints:: # unsigned integer 100 [100] # negative integer -100 [-100] # float with scientific notation 6.02e23 [6.02e+23] # integer with scientific notation 1e-12 [1e-12] Success # stray character 100Z ^ FAIL: Expected end of text (at char 3), (line:1, col:4) # missing leading digit before '.' -.100 ^ FAIL: Expected {real number with scientific notation | real number | signed integer} (at char 0), (line:1, col:1) # too many '.' 3.14.159 ^ FAIL: Expected end of text (at char 4), (line:1, col:5) Success Each test string must be on a single line. If you want to test a string that spans multiple lines, create a test like this:: expr.runTest(r"this is a test\n of strings that spans \n 3 lines") (Note that this is a raw string literal, you must include the leading 'r'.) TNFrz\n)r)r z(FATAL)r rr^zFAIL: zFAIL-EXCEPTION: )rzrrrvr{rrstrip splitlinesrrrrrrrrr!rGrr9rKr,)rZtestsrZcommentZfullDumpZ printResultsZ failureTestsZ allResultsZcommentssuccessrvr resultrrzr3rwrwrxrunTestssNW     $   zParserElement.runTests)F)F)T)T)TT)TT)r)F)N)T)F)T)TrTTF)OrrrrrNr staticmethodrPrRrrrirmrurrxr~rrrrrrrrrrrrrrrrrrtrrrr_MAX_INTrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr __classcell__rwrw)rHrxr$8s     &     H   " 2G+    D           )    cs eZdZdZfddZZS)r,zT Abstract C{ParserElement} subclass, for defining atomic matching patterns. cstt|jdddS)NF)rg)rr,r)r)rHrwrxr szToken.__init__)rrrrrrrwrw)rHrxr, scs eZdZdZfddZZS)r z, An empty token, will always match. cs$tt|jd|_d|_d|_dS)Nr TF)rr rrr[r`)r)rHrwrxr szEmpty.__init__)rrrrrrrwrw)rHrxr  scs*eZdZdZfddZdddZZS)rz( A token that will never match. cs*tt|jd|_d|_d|_d|_dS)NrTFzUnmatchable token)rrrrr[r`ra)r)rHrwrxr* s zNoMatch.__init__TcCst|||j|dS)N)rra)rr-rrorwrwrxr1 szNoMatch.parseImpl)T)rrrrrrrrwrw)rHrxr& s cs*eZdZdZfddZdddZZS)ra Token to exactly match a specified string. Example:: Literal('blah').parseString('blah') # -> ['blah'] Literal('blah').parseString('blahfooblah') # -> ['blah'] Literal('blah').parseString('bla') # -> Exception: Expected "blah" For case-insensitive matching, use L{CaselessLiteral}. For keyword matching (force word break before and after the matched string), use L{Keyword} or L{CaselessKeyword}. c stt|j||_t||_y|d|_Wn*tk rVtj dt ddt |_ YnXdt |j|_d|j|_d|_d|_dS)Nrz2null string passed to Literal; use Empty() insteadrq)rz"%s"z Expected F)rrrmatchrmatchLenfirstMatchCharrrrrr rHrrrar[r`)r matchString)rHrwrxrC s    zLiteral.__init__TcCsJ|||jkr6|jdks&|j|j|r6||j|jfSt|||j|dS)Nrr)rr startswithrrra)rr-rrorwrwrxrV szLiteral.parseImpl)T)rrrrrrrrwrw)rHrxr5 s  csLeZdZdZedZdfdd Zddd Zfd d Ze d d Z Z S)ra\ Token to exactly match a specified string as a keyword, that is, it must be immediately followed by a non-keyword character. Compare with C{L{Literal}}: - C{Literal("if")} will match the leading C{'if'} in C{'ifAndOnlyIf'}. - C{Keyword("if")} will not; it will only match the leading C{'if'} in C{'if x=1'}, or C{'if(y==2)'} Accepts two optional constructor arguments in addition to the keyword string: - C{identChars} is a string of characters that would be valid identifier characters, defaulting to all alphanumerics + "_" and "$" - C{caseless} allows case-insensitive matching, default is C{False}. Example:: Keyword("start").parseString("start") # -> ['start'] Keyword("start").parseString("starting") # -> Exception For case-insensitive matching, use L{CaselessKeyword}. z_$NFc stt|j|dkrtj}||_t||_y|d|_Wn$tk r^t j dt ddYnXd|j|_ d|j |_ d|_d|_||_|r|j|_|j}t||_dS)Nrz2null string passed to Keyword; use Empty() insteadrq)rz"%s"z Expected F)rrrDEFAULT_KEYWORD_CHARSrrrrrrrrrrar[r`caselessupper caselessmatchr identChars)rrrr)rHrwrxrq s&    zKeyword.__init__TcCs|jr|||||jj|jkr|t||jksL|||jj|jkr|dksj||dj|jkr||j|jfSnv|||jkr|jdks|j|j|r|t||jks|||j|jkr|dks||d|jkr||j|jfSt |||j |dS)Nrrr) rrrrrrrrrrra)rr-rrorwrwrxr s*&zKeyword.parseImplcstt|j}tj|_|S)N)rrrrr)rr)rHrwrxr sz Keyword.copycCs |t_dS)z,Overrides the default Keyword chars N)rr)rOrwrwrxsetDefaultKeywordChars szKeyword.setDefaultKeywordChars)NF)T) rrrrr3rrrrrrrrwrw)rHrxr^ s   cs*eZdZdZfddZdddZZS)ral Token to match a specified string, ignoring case of letters. Note: the matched results will always be in the case of the given match string, NOT the case of the input text. Example:: OneOrMore(CaselessLiteral("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD', 'CMD'] (Contrast with example for L{CaselessKeyword}.) cs6tt|j|j||_d|j|_d|j|_dS)Nz'%s'z Expected )rrrr returnStringrra)rr)rHrwrxr s zCaselessLiteral.__init__TcCs@||||jj|jkr,||j|jfSt|||j|dS)N)rrrrrra)rr-rrorwrwrxr szCaselessLiteral.parseImpl)T)rrrrrrrrwrw)rHrxr s  cs,eZdZdZdfdd Zd ddZZS) rz Caseless version of L{Keyword}. Example:: OneOrMore(CaselessKeyword("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD'] (Contrast with example for L{CaselessLiteral}.) Ncstt|j||dddS)NT)r)rrr)rrr)rHrwrxr szCaselessKeyword.__init__TcCsj||||jj|jkrV|t||jksF|||jj|jkrV||j|jfSt|||j|dS)N)rrrrrrrra)rr-rrorwrwrxr s*zCaselessKeyword.parseImpl)N)T)rrrrrrrrwrw)rHrxr scs,eZdZdZdfdd Zd ddZZS) rlax A variation on L{Literal} which matches "close" matches, that is, strings with at most 'n' mismatching characters. C{CloseMatch} takes parameters: - C{match_string} - string to be matched - C{maxMismatches} - (C{default=1}) maximum number of mismatches allowed to count as a match The results from a successful parse will contain the matched text from the input string and the following named results: - C{mismatches} - a list of the positions within the match_string where mismatches were found - C{original} - the original match_string used to compare against the input string If C{mismatches} is an empty list, then the match was an exact match. Example:: patt = CloseMatch("ATCATCGAATGGA") patt.parseString("ATCATCGAAXGGA") # -> (['ATCATCGAAXGGA'], {'mismatches': [[9]], 'original': ['ATCATCGAATGGA']}) patt.parseString("ATCAXCGAAXGGA") # -> Exception: Expected 'ATCATCGAATGGA' (with up to 1 mismatches) (at char 0), (line:1, col:1) # exact match patt.parseString("ATCATCGAATGGA") # -> (['ATCATCGAATGGA'], {'mismatches': [[]], 'original': ['ATCATCGAATGGA']}) # close match allowing up to 2 mismatches patt = CloseMatch("ATCATCGAATGGA", maxMismatches=2) patt.parseString("ATCAXCGAAXGGA") # -> (['ATCAXCGAAXGGA'], {'mismatches': [[4, 9]], 'original': ['ATCATCGAATGGA']}) rrcsBtt|j||_||_||_d|j|jf|_d|_d|_dS)Nz&Expected %r (with up to %d mismatches)F) rrlrr match_string maxMismatchesrar`r[)rrr)rHrwrxr szCloseMatch.__init__TcCs|}t|}|t|j}||kr|j}d}g} |j} xtt||||jD]0\}} | \} } | | krP| j|t| | krPPqPW|d}t|||g}|j|d<| |d<||fSt|||j|dS)Nrrroriginal mismatches) rrrrrrr"rra)rr-rrostartrmaxlocrZmatch_stringlocrrZs_msrcmatresultsrwrwrxr s("   zCloseMatch.parseImpl)rr)T)rrrrrrrrwrw)rHrxrl s cs8eZdZdZd fdd Zdd d Zfd d ZZS)r/a Token for matching words composed of allowed character sets. Defined with string containing all allowed initial characters, an optional string containing allowed body characters (if omitted, defaults to the initial character set), and an optional minimum, maximum, and/or exact length. The default value for C{min} is 1 (a minimum value < 1 is not valid); the default values for C{max} and C{exact} are 0, meaning no maximum or exact length restriction. An optional C{excludeChars} parameter can list characters that might be found in the input C{bodyChars} string; useful to define a word of all printables except for one or two characters, for instance. L{srange} is useful for defining custom character set strings for defining C{Word} expressions, using range notation from regular expression character sets. A common mistake is to use C{Word} to match a specific literal string, as in C{Word("Address")}. Remember that C{Word} uses the string argument to define I{sets} of matchable characters. This expression would match "Add", "AAA", "dAred", or any other word made up of the characters 'A', 'd', 'r', 'e', and 's'. To match an exact literal string, use L{Literal} or L{Keyword}. pyparsing includes helper strings for building Words: - L{alphas} - L{nums} - L{alphanums} - L{hexnums} - L{alphas8bit} (alphabetic characters in ASCII range 128-255 - accented, tilded, umlauted, etc.) - L{punc8bit} (non-alphabetic characters in ASCII range 128-255 - currency, symbols, superscripts, diacriticals, etc.) - L{printables} (any non-whitespace character) Example:: # a word composed of digits integer = Word(nums) # equivalent to Word("0123456789") or Word(srange("0-9")) # a word with a leading capital, and zero or more lowercase capital_word = Word(alphas.upper(), alphas.lower()) # hostnames are alphanumeric, with leading alpha, and '-' hostname = Word(alphas, alphanums+'-') # roman numeral (not a strict parser, accepts invalid mix of characters) roman = Word("IVXLCDM") # any string of non-whitespace characters, except for ',' csv_value = Word(printables, excludeChars=",") NrrrFc stt|jrFdjfdd|D}|rFdjfdd|D}||_t||_|rl||_t||_n||_t||_|dk|_ |dkrt d||_ |dkr||_ nt |_ |dkr||_ ||_ t||_d|j|_d |_||_d |j|jkr|dkr|dkr|dkr|j|jkr8d t|j|_nHt|jdkrfd tj|jt|jf|_nd t|jt|jf|_|jrd|jd|_ytj|j|_Wntk rd|_YnXdS)Nrc3s|]}|kr|VqdS)Nrw)rr) excludeCharsrwrxr7 sz Word.__init__..c3s|]}|kr|VqdS)Nrw)rr)rrwrxr9 srrrzZcannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permittedz Expected Frz[%s]+z%s[%s]*z [%s][%s]*z\b)rr/rr initCharsOrigr initChars bodyCharsOrig bodyChars maxSpecifiedrminLenmaxLenrrrrar` asKeyword_escapeRegexRangeCharsreStringrrdescapecompilerK)rrrminmaxexactrr)rH)rrxr4 sT      0 z Word.__init__Tc CsD|jr<|jj||}|s(t|||j||j}||jfS|||jkrZt|||j||}|d7}t|}|j}||j }t ||}x ||kr|||kr|d7}qWd} |||j krd} |j r||kr|||krd} |j r|dkr||d|ks||kr|||krd} | r4t|||j|||||fS)NrrFTr)rdrrraendgrouprrrrr rrr) rr-rrorrrZ bodycharsrZthrowExceptionrwrwrxrj s6    4zWord.parseImplc stytt|jStk r"YnX|jdkrndd}|j|jkr^d||j||jf|_nd||j|_|jS)NcSs$t|dkr|dddS|SdS)Nz...)r)rrwrwrx charsAsStr s z Word.__str__..charsAsStrz W:(%s,%s)zW:(%s))rr/rrKrUrr)rr)rHrwrxr s  z Word.__str__)NrrrrFN)T)rrrrrrrrrwrw)rHrxr/ s.6 #csFeZdZdZeejdZd fdd Zd ddZ fd d Z Z S) r'a Token for matching strings that match a given regular expression. Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. If the given regex contains named groups (defined using C{(?P...)}), these will be preserved as named parse results. Example:: realnum = Regex(r"[+-]?\d+\.\d*") date = Regex(r'(?P\d{4})-(?P\d\d?)-(?P\d\d?)') # ref: http://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression roman = Regex(r"M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})") z[A-Z]rc stt|jt|tr|s,tjdtdd||_||_ yt j |j|j |_ |j|_ Wqt jk rtjd|tddYqXn2t|tjr||_ t||_|_ ||_ ntdt||_d|j|_d|_d|_d S) zThe parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags.z0null string passed to Regex; use Empty() insteadrq)rz$invalid pattern (%s) passed to RegexzCRegex may only be constructed with a string or a compiled RE objectz Expected FTN)rr'rrzrrrrpatternflagsrdr r sre_constantserrorcompiledREtyper{rrrrar`r[)rrr)rHrwrxr s.         zRegex.__init__TcCsd|jj||}|s"t|||j||j}|j}t|j}|r\x|D]}||||<qHW||fS)N)rdrrrar groupdictr"r)rr-rrordrrrwrwrxr s  zRegex.parseImplc sDytt|jStk r"YnX|jdkr>dt|j|_|jS)NzRe:(%s))rr'rrKrUrr)r)rHrwrxr s z Regex.__str__)r)T) rrrrrrdr rrrrrrwrw)rHrxr' s  " cs8eZdZdZd fdd Zd ddZfd d ZZS) r%a Token for matching strings that are delimited by quoting characters. Defined with the following parameters: - quoteChar - string of one or more characters defining the quote delimiting string - escChar - character to escape quotes, typically backslash (default=C{None}) - escQuote - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=C{None}) - multiline - boolean indicating whether quotes can span multiple lines (default=C{False}) - unquoteResults - boolean indicating whether the matched text should be unquoted (default=C{True}) - endQuoteChar - string of one or more characters defining the end of the quote delimited string (default=C{None} => same as quoteChar) - convertWhitespaceEscapes - convert escaped whitespace (C{'\t'}, C{'\n'}, etc.) to actual whitespace (default=C{True}) Example:: qs = QuotedString('"') print(qs.searchString('lsjdf "This is the quote" sldjf')) complex_qs = QuotedString('{{', endQuoteChar='}}') print(complex_qs.searchString('lsjdf {{This is the "quote"}} sldjf')) sql_qs = QuotedString('"', escQuote='""') print(sql_qs.searchString('lsjdf "This is the quote with ""embedded"" quotes" sldjf')) prints:: [['This is the quote']] [['This is the "quote"']] [['This is the quote with "embedded" quotes']] NFTc sNttj|j}|s0tjdtddt|dkr>|}n"|j}|s`tjdtddt|_t |_ |d_ |_ t |_ |_|_|_|_|rtjtjB_dtjjtj d|dk rt|pdf_n.)z|(?:%s)z|(?:%s.)z(.)z)*%sz$invalid pattern (%s) passed to Regexz Expected FTrs)%rr%rrrrr SyntaxError quoteCharr quoteCharLenfirstQuoteCharrendQuoteCharLenescCharescQuoteunquoteResultsconvertWhitespaceEscapesrd MULTILINEDOTALLrr rrrrescCharReplacePatternr rrrrrrar`r[)rrr r!Z multiliner"rr#)rH)rrxr sf       6     zQuotedString.__init__c Cs|||jkr|jj||pd}|s4t|||j||j}|j}|jr||j|j }t |t rd|kr|j rddddd}x |j D]\}}|j||}qW|jrtj|jd|}|jr|j|j|j}||fS)N\ r  )z\tz\nz\fz\rz\g<1>)rrdrrrarrr"rrrzrr#rrr rr&r!r) rr-rrorrZws_mapZwslitZwscharrwrwrxrG s(  zQuotedString.parseImplc sFytt|jStk r"YnX|jdkr@d|j|jf|_|jS)Nz.quoted string, starting with %s ending with %s)rr%rrKrUrr)r)rHrwrxrj s zQuotedString.__str__)NNFTNT)T)rrrrrrrrrwrw)rHrxr% sA #cs8eZdZdZd fdd Zd ddZfd d ZZS) r a Token for matching words composed of characters I{not} in a given set (will include whitespace in matched characters if not listed in the provided exclusion set - see example). Defined with string containing all disallowed characters, and an optional minimum, maximum, and/or exact length. The default value for C{min} is 1 (a minimum value < 1 is not valid); the default values for C{max} and C{exact} are 0, meaning no maximum or exact length restriction. Example:: # define a comma-separated-value as anything that is not a ',' csv_value = CharsNotIn(',') print(delimitedList(csv_value).parseString("dkls,lsdkjf,s12 34,@!#,213")) prints:: ['dkls', 'lsdkjf', 's12 34', '@!#', '213'] rrrcstt|jd|_||_|dkr*td||_|dkr@||_nt|_|dkrZ||_||_t ||_ d|j |_ |jdk|_ d|_ dS)NFrrzfcannot specify a minimum length < 1; use Optional(CharsNotIn()) if zero-length char group is permittedrz Expected )rr rrXnotCharsrrrrrrrar[r`)rr+r r r )rHrwrxr s    zCharsNotIn.__init__TcCs|||jkrt|||j||}|d7}|j}t||jt|}x ||krd|||krd|d7}qFW|||jkrt|||j|||||fS)Nrr)r+rrar rrr)rr-rrorZnotcharsmaxlenrwrwrxr s   zCharsNotIn.parseImplc sdytt|jStk r"YnX|jdkr^t|jdkrRd|jdd|_n d|j|_|jS)Nrz !W:(%s...)z!W:(%s))rr rrKrUrr+)r)rHrwrxr s  zCharsNotIn.__str__)rrrr)T)rrrrrrrrrwrw)rHrxr v s cs<eZdZdZddddddZdfd d ZdddZZS)r.a Special matching class for matching whitespace. Normally, whitespace is ignored by pyparsing grammars. This class is included when some whitespace structures are significant. Define with a string containing the whitespace characters to be matched; default is C{" \t\r\n"}. Also takes optional C{min}, C{max}, and C{exact} arguments, as defined for the C{L{Word}} class. zzzzz)rr(rr*r) rrrcsttj|_jdjfddjDdjddjD_d_dj_ |_ |dkrt|_ nt _ |dkr|_ |_ dS)Nrc3s|]}|jkr|VqdS)N) matchWhite)rr)rrwrxr sz!White.__init__..css|]}tj|VqdS)N)r. whiteStrs)rrrwrwrxr sTz Expected r) rr.rr.rrrYrr[rarrr)rZwsr r r )rH)rrxr s  zWhite.__init__TcCs|||jkrt|||j||}|d7}||j}t|t|}x"||krd|||jkrd|d7}qDW|||jkrt|||j|||||fS)Nrr)r.rrarr rr)rr-rrorrrwrwrxr s  zWhite.parseImpl)r-rrrr)T)rrrrr/rrrrwrw)rHrxr. scseZdZfddZZS)_PositionTokencs(tt|j|jj|_d|_d|_dS)NTF)rr0rrHrrr[r`)r)rHrwrxr s z_PositionToken.__init__)rrrrrrwrw)rHrxr0 sr0cs2eZdZdZfddZddZd ddZZS) rzb Token to advance to a specific column of input text; useful for tabular report scraping. cstt|j||_dS)N)rrrr9)rcolno)rHrwrxr szGoToColumn.__init__cCs`t|||jkr\t|}|jr*|j||}x0||krZ||jrZt|||jkrZ|d7}q,W|S)Nrr)r9rr]risspace)rr-rrrwrwrxr s & zGoToColumn.preParseTcCsDt||}||jkr"t||d|||j|}|||}||fS)NzText not in expected column)r9r)rr-rroZthiscolZnewlocrrwrwrxr s    zGoToColumn.parseImpl)T)rrrrrrrrrwrw)rHrxr s  cs*eZdZdZfddZdddZZS)ra Matches if current position is at the beginning of a line within the parse string Example:: test = ''' AAA this line AAA and this line AAA but not this one B AAA and definitely not this one ''' for t in (LineStart() + 'AAA' + restOfLine).searchString(test): print(t) Prints:: ['AAA', ' this line'] ['AAA', ' and this line'] cstt|jd|_dS)NzExpected start of line)rrrra)r)rHrwrxr& szLineStart.__init__TcCs*t||dkr|gfSt|||j|dS)Nrr)r9rra)rr-rrorwrwrxr* szLineStart.parseImpl)T)rrrrrrrrwrw)rHrxr s cs*eZdZdZfddZdddZZS)rzU Matches if current position is at the end of a line within the parse string cs,tt|j|jtjjddd|_dS)NrrzExpected end of line)rrrrr$rNrra)r)rHrwrxr3 szLineEnd.__init__TcCsb|t|kr6||dkr$|ddfSt|||j|n(|t|krN|dgfSt|||j|dS)Nrrr)rrra)rr-rrorwrwrxr8 s     zLineEnd.parseImpl)T)rrrrrrrrwrw)rHrxr/ s cs*eZdZdZfddZdddZZS)r*zM Matches if current position is at the beginning of the parse string cstt|jd|_dS)NzExpected start of text)rr*rra)r)rHrwrxrG szStringStart.__init__TcCs0|dkr(||j|dkr(t|||j||gfS)Nr)rrra)rr-rrorwrwrxrK szStringStart.parseImpl)T)rrrrrrrrwrw)rHrxr*C s cs*eZdZdZfddZdddZZS)r)zG Matches if current position is at the end of the parse string cstt|jd|_dS)NzExpected end of text)rr)rra)r)rHrwrxrV szStringEnd.__init__TcCs^|t|krt|||j|n<|t|kr6|dgfS|t|krJ|gfSt|||j|dS)Nrr)rrra)rr-rrorwrwrxrZ s    zStringEnd.parseImpl)T)rrrrrrrrwrw)rHrxr)R s cs.eZdZdZeffdd ZdddZZS)r1ap Matches if the current position is at the beginning of a Word, and is not preceded by any character in a given set of C{wordChars} (default=C{printables}). To emulate the C{} behavior of regular expressions, use C{WordStart(alphanums)}. C{WordStart} will also match at the beginning of the string being parsed, or at the beginning of a line. cs"tt|jt||_d|_dS)NzNot at the start of a word)rr1rr wordCharsra)rr3)rHrwrxrl s zWordStart.__init__TcCs@|dkr8||d|jks(|||jkr8t|||j||gfS)Nrrr)r3rra)rr-rrorwrwrxrq s zWordStart.parseImpl)T)rrrrrVrrrrwrw)rHrxr1d scs.eZdZdZeffdd ZdddZZS)r0aZ Matches if the current position is at the end of a Word, and is not followed by any character in a given set of C{wordChars} (default=C{printables}). To emulate the C{} behavior of regular expressions, use C{WordEnd(alphanums)}. C{WordEnd} will also match at the end of the string being parsed, or at the end of a line. cs(tt|jt||_d|_d|_dS)NFzNot at the end of a word)rr0rrr3rXra)rr3)rHrwrxr s zWordEnd.__init__TcCsPt|}|dkrH||krH|||jks8||d|jkrHt|||j||gfS)Nrrr)rr3rra)rr-rrorrwrwrxr s zWordEnd.parseImpl)T)rrrrrVrrrrwrw)rHrxr0x scseZdZdZdfdd ZddZddZd d Zfd d Zfd dZ fddZ dfdd Z gfddZ fddZ ZS)r z^ Abstract subclass of ParserElement, for combining and post-processing parsed tokens. Fc stt|j|t|tr"t|}t|tr.F)rr rrzrrrr$rQexprsrIterableallrvrre)rr4rg)rHrwrxr s     zParseExpression.__init__cCs |j|S)N)r4)rrrwrwrxr szParseExpression.__getitem__cCs|jj|d|_|S)N)r4rrU)rrrwrwrxr s zParseExpression.appendcCs4d|_dd|jD|_x|jD] }|jq W|S)z~Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on all contained expressions.FcSsg|] }|jqSrw)r)rrrwrwrxr sz3ParseExpression.leaveWhitespace..)rXr4r)rrrwrwrxr s   zParseExpression.leaveWhitespacecszt|trF||jkrvtt|j|xP|jD]}|j|jdq,Wn0tt|j|x|jD]}|j|jdq^W|S)Nrrrsrs)rzr+r]rr rr4)rrr)rHrwrxr s    zParseExpression.ignorec sLytt|jStk r"YnX|jdkrFd|jjt|jf|_|jS)Nz%s:(%s)) rr rrKrUrHrrr4)r)rHrwrxr s zParseExpression.__str__cs0tt|jx|jD] }|jqWt|jdkr|jd}t||jr|j r|jdkr|j r|jdd|jdg|_d|_ |j |j O_ |j |j O_ |jd}t||jo|j o|jdko|j r|jdd|jdd|_d|_ |j |j O_ |j |j O_ dt ||_|S)Nrqrrrz Expected rsrs)rr rr4rrzrHrSrVr^rUr[r`rra)rrr)rHrwrxr s0         zParseExpression.streamlinecstt|j||}|S)N)rr rm)rrrlr)rHrwrxrm szParseExpression.setResultsNamecCs:|dd|g}x|jD]}|j|qW|jgdS)N)r4rr)rrtmprrwrwrxr s zParseExpression.validatecs$tt|j}dd|jD|_|S)NcSsg|] }|jqSrw)r)rrrwrwrxr sz(ParseExpression.copy..)rr rr4)rr)rHrwrxr szParseExpression.copy)F)F)rrrrrrrrrrrrmrrrrwrw)rHrxr s " csTeZdZdZGdddeZdfdd ZdddZd d Zd d Z d dZ Z S)ra  Requires all given C{ParseExpression}s to be found in the given order. Expressions may be separated by whitespace. May be constructed using the C{'+'} operator. May also be constructed using the C{'-'} operator, which will suppress backtracking. Example:: integer = Word(nums) name_expr = OneOrMore(Word(alphas)) expr = And([integer("id"),name_expr("name"),integer("age")]) # more easily written as: expr = integer("id") + name_expr("name") + integer("age") cseZdZfddZZS)zAnd._ErrorStopcs&ttj|j||d|_|jdS)N-)rrrrrr)rrr)rHrwrxr szAnd._ErrorStop.__init__)rrrrrrwrw)rHrxr srTcsRtt|j||tdd|jD|_|j|jdj|jdj|_d|_ dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxr szAnd.__init__..rT) rrrr6r4r[rrYrXre)rr4rg)rHrwrxr s z And.__init__c Cs|jdj|||dd\}}d}x|jddD]}t|tjrFd}q0|ry|j|||\}}Wqtk rvYqtk r}zd|_tj|WYdd}~Xqt k rt|t ||j |YqXn|j|||\}}|s|j r0||7}q0W||fS)NrF)rprrT) r4rtrzrrr#r __traceback__rrrrar) rr-rro resultlistZ errorStoprZ exprtokensrrwrwrxr s(   z And.parseImplcCst|trtj|}|j|S)N)rzrr$rQr)rrrwrwrxr5 s  z And.__iadd__cCs8|dd|g}x |jD]}|j||jsPqWdS)N)r4rr[)rrsubRecCheckListrrwrwrxr: s   zAnd.checkRecursioncCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nr{rcss|]}t|VqdS)N)r)rrrwrwrxrF szAnd.__str__..})rrrUrr4)rrwrwrxrA s    z And.__str__)T)T) rrrrr rrrrrrrrwrw)rHrxr s csDeZdZdZdfdd ZdddZdd Zd d Zd d ZZ S)ra Requires that at least one C{ParseExpression} is found. If two expressions match, the expression that matches the longest string will be used. May be constructed using the C{'^'} operator. Example:: # construct Or using '^' operator number = Word(nums) ^ Combine(Word(nums) + '.' + Word(nums)) print(number.searchString("123 3.1416 789")) prints:: [['123'], ['3.1416'], ['789']] Fcs:tt|j|||jr0tdd|jD|_nd|_dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxr\ szOr.__init__..T)rrrr4rr[)rr4rg)rHrwrxrY sz Or.__init__Tc CsTd}d}g}x|jD]}y|j||}Wnvtk rd} z d| _| j|krT| }| j}WYdd} ~ Xqtk rt||krt|t||j|}t|}YqX|j||fqW|r*|j dddx`|D]X\} }y|j |||Stk r$} z"d| _| j|kr| }| j}WYdd} ~ XqXqW|dk rB|j|_ |nt||d|dS)NrrcSs |d S)Nrrw)xrwrwrxryu szOr.parseImpl..)rz no defined alternatives to matchrs) r4rrr9rrrrarsortrtr) rr-rro maxExcLoc maxExceptionrrZloc2r_rwrwrxr` s<     z Or.parseImplcCst|trtj|}|j|S)N)rzrr$rQr)rrrwrwrx__ixor__ s  z Or.__ixor__cCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nrr<z ^ css|]}t|VqdS)N)r)rrrwrwrxr szOr.__str__..r=)rrrUrr4)rrwrwrxr s    z Or.__str__cCs0|dd|g}x|jD]}|j|qWdS)N)r4r)rrr;rrwrwrxr s zOr.checkRecursion)F)T) rrrrrrrCrrrrwrw)rHrxrK s   & csDeZdZdZdfdd ZdddZdd Zd d Zd d ZZ S)ra Requires that at least one C{ParseExpression} is found. If two expressions match, the first one listed is the one that will match. May be constructed using the C{'|'} operator. Example:: # construct MatchFirst using '|' operator # watch the order of expressions to match number = Word(nums) | Combine(Word(nums) + '.' + Word(nums)) print(number.searchString("123 3.1416 789")) # Fail! -> [['123'], ['3'], ['1416'], ['789']] # put more selective expression first number = Combine(Word(nums) + '.' + Word(nums)) | Word(nums) print(number.searchString("123 3.1416 789")) # Better -> [['123'], ['3.1416'], ['789']] Fcs:tt|j|||jr0tdd|jD|_nd|_dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxr sz&MatchFirst.__init__..T)rrrr4rr[)rr4rg)rHrwrxr szMatchFirst.__init__Tc Csd}d}x|jD]}y|j|||}|Stk r\}z|j|krL|}|j}WYdd}~Xqtk rt||krt|t||j|}t|}YqXqW|dk r|j|_|nt||d|dS)Nrrz no defined alternatives to matchrs)r4rtrrrrrar) rr-rror@rArrrrwrwrxr s$   zMatchFirst.parseImplcCst|trtj|}|j|S)N)rzrr$rQr)rrrwrwrx__ior__ s  zMatchFirst.__ior__cCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nrr<z | css|]}t|VqdS)N)r)rrrwrwrxr sz%MatchFirst.__str__..r=)rrrUrr4)rrwrwrxr s    zMatchFirst.__str__cCs0|dd|g}x|jD]}|j|qWdS)N)r4r)rrr;rrwrwrxr s zMatchFirst.checkRecursion)F)T) rrrrrrrDrrrrwrw)rHrxr s   cs<eZdZdZd fdd Zd ddZddZd d ZZS) r am Requires all given C{ParseExpression}s to be found, but in any order. Expressions may be separated by whitespace. May be constructed using the C{'&'} operator. Example:: color = oneOf("RED ORANGE YELLOW GREEN BLUE PURPLE BLACK WHITE BROWN") shape_type = oneOf("SQUARE CIRCLE TRIANGLE STAR HEXAGON OCTAGON") integer = Word(nums) shape_attr = "shape:" + shape_type("shape") posn_attr = "posn:" + Group(integer("x") + ',' + integer("y"))("posn") color_attr = "color:" + color("color") size_attr = "size:" + integer("size") # use Each (using operator '&') to accept attributes in any order # (shape and posn are required, color and size are optional) shape_spec = shape_attr & posn_attr & Optional(color_attr) & Optional(size_attr) shape_spec.runTests(''' shape: SQUARE color: BLACK posn: 100, 120 shape: CIRCLE size: 50 color: BLUE posn: 50,80 color:GREEN size:20 shape:TRIANGLE posn:20,40 ''' ) prints:: shape: SQUARE color: BLACK posn: 100, 120 ['shape:', 'SQUARE', 'color:', 'BLACK', 'posn:', ['100', ',', '120']] - color: BLACK - posn: ['100', ',', '120'] - x: 100 - y: 120 - shape: SQUARE shape: CIRCLE size: 50 color: BLUE posn: 50,80 ['shape:', 'CIRCLE', 'size:', '50', 'color:', 'BLUE', 'posn:', ['50', ',', '80']] - color: BLUE - posn: ['50', ',', '80'] - x: 50 - y: 80 - shape: CIRCLE - size: 50 color: GREEN size: 20 shape: TRIANGLE posn: 20,40 ['color:', 'GREEN', 'size:', '20', 'shape:', 'TRIANGLE', 'posn:', ['20', ',', '40']] - color: GREEN - posn: ['20', ',', '40'] - x: 20 - y: 40 - shape: TRIANGLE - size: 20 Tcs8tt|j||tdd|jD|_d|_d|_dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxrsz Each.__init__..T)rr rr6r4r[rXinitExprGroups)rr4rg)rHrwrxrsz Each.__init__c s|jrtdd|jD|_dd|jD}dd|jD}|||_dd|jD|_dd|jD|_dd|jD|_|j|j7_d |_|}|jdd}|jddg}d } x| rp||j|j} g} x~| D]v} y| j||}Wn t k r| j | YqX|j |jj t | | | |krD|j | q| krj | qWt| t| krd } qW|rd jd d|D} t ||d | |fdd|jD7}g}x*|D]"} | j|||\}}|j |qWt|tg}||fS)Ncss&|]}t|trt|j|fVqdS)N)rzrrr.)rrrwrwrxrsz!Each.parseImpl..cSsg|]}t|tr|jqSrw)rzrr.)rrrwrwrxrsz"Each.parseImpl..cSs"g|]}|jrt|t r|qSrw)r[rzr)rrrwrwrxrscSsg|]}t|tr|jqSrw)rzr2r.)rrrwrwrxr scSsg|]}t|tr|jqSrw)rzrr.)rrrwrwrxr!scSs g|]}t|tttfs|qSrw)rzrr2r)rrrwrwrxr"sFTz, css|]}t|VqdS)N)r)rrrwrwrxr=sz*Missing one or more required elements (%s)cs$g|]}t|tr|jkr|qSrw)rzrr.)rr)tmpOptrwrxrAs)rErr4Zopt1mapZ optionalsZmultioptionalsZ multirequiredZrequiredrrrrrremoverrrtsumr")rr-rroZopt1Zopt2ZtmpLocZtmpReqdZ matchOrderZ keepMatchingZtmpExprsZfailedrZmissingr:rZ finalResultsrw)rFrxrsP     zEach.parseImplcCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nrr<z & css|]}t|VqdS)N)r)rrrwrwrxrPszEach.__str__..r=)rrrUrr4)rrwrwrxrKs    z Each.__str__cCs0|dd|g}x|jD]}|j|qWdS)N)r4r)rrr;rrwrwrxrTs zEach.checkRecursion)T)T) rrrrrrrrrrwrw)rHrxr s 5 1 csleZdZdZdfdd ZdddZdd Zfd d Zfd d ZddZ gfddZ fddZ Z S)rza Abstract subclass of C{ParserElement}, for combining and post-processing parsed tokens. Fcstt|j|t|tr@ttjtr2tj|}ntjt |}||_ d|_ |dk r|j |_ |j |_ |j|j|j|_|j|_|j|_|jj|jdS)N)rrrrzr issubclassr$rQr,rr.rUr`r[rrYrXrWrer]r)rr.rg)rHrwrxr^s    zParseElementEnhance.__init__TcCs2|jdk r|jj|||ddStd||j|dS)NF)rpr)r.rtrra)rr-rrorwrwrxrps zParseElementEnhance.parseImplcCs*d|_|jj|_|jdk r&|jj|S)NF)rXr.rr)rrwrwrxrvs    z#ParseElementEnhance.leaveWhitespacecsrt|trB||jkrntt|j||jdk rn|jj|jdn,tt|j||jdk rn|jj|jd|S)Nrrrsrs)rzr+r]rrrr.)rr)rHrwrxr}s    zParseElementEnhance.ignorecs&tt|j|jdk r"|jj|S)N)rrrr.)r)rHrwrxrs  zParseElementEnhance.streamlinecCsB||krt||g|dd|g}|jdk r>|jj|dS)N)r&r.r)rrr;rwrwrxrs  z"ParseElementEnhance.checkRecursioncCs6|dd|g}|jdk r(|jj||jgdS)N)r.rr)rrr7rwrwrxrs  zParseElementEnhance.validatec sVytt|jStk r"YnX|jdkrP|jdk rPd|jjt|jf|_|jS)Nz%s:(%s)) rrrrKrUr.rHrr)r)rHrwrxrszParseElementEnhance.__str__)F)T) rrrrrrrrrrrrrrwrw)rHrxrZs   cs*eZdZdZfddZdddZZS)ra Lookahead matching of the given parse expression. C{FollowedBy} does I{not} advance the parsing position within the input string, it only verifies that the specified parse expression matches at the current position. C{FollowedBy} always returns a null token list. Example:: # use FollowedBy to match a label only if it is followed by a ':' data_word = Word(alphas) label = data_word + FollowedBy(':') attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) OneOrMore(attr_expr).parseString("shape: SQUARE color: BLACK posn: upper left").pprint() prints:: [['shape', 'SQUARE'], ['color', 'BLACK'], ['posn', 'upper left']] cstt|j|d|_dS)NT)rrrr[)rr.)rHrwrxrszFollowedBy.__init__TcCs|jj|||gfS)N)r.r)rr-rrorwrwrxrszFollowedBy.parseImpl)T)rrrrrrrrwrw)rHrxrs cs2eZdZdZfddZd ddZddZZS) ra Lookahead to disallow matching with the given parse expression. C{NotAny} does I{not} advance the parsing position within the input string, it only verifies that the specified parse expression does I{not} match at the current position. Also, C{NotAny} does I{not} skip over leading whitespace. C{NotAny} always returns a null token list. May be constructed using the '~' operator. Example:: cs0tt|j|d|_d|_dt|j|_dS)NFTzFound unwanted token, )rrrrXr[rr.ra)rr.)rHrwrxrszNotAny.__init__TcCs&|jj||rt|||j||gfS)N)r.rrra)rr-rrorwrwrxrszNotAny.parseImplcCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrz~{r=)rrrUrr.)rrwrwrxrs   zNotAny.__str__)T)rrrrrrrrrwrw)rHrxrs   cs(eZdZdfdd ZdddZZS) _MultipleMatchNcsFtt|j|d|_|}t|tr.tj|}|dk r<|nd|_dS)NT) rrJrrWrzrr$rQ not_ender)rr.stopOnZender)rHrwrxrs   z_MultipleMatch.__init__Tc Cs|jj}|j}|jdk }|r$|jj}|r2|||||||dd\}}yZ|j } xJ|rb|||| rr|||} n|} ||| |\}} | s| jrT|| 7}qTWWnttfk rYnX||fS)NF)rp) r.rtrrKrr]rrr) rr-rroZself_expr_parseZself_skip_ignorablesZ check_enderZ try_not_enderrZhasIgnoreExprsrZ tmptokensrwrwrxrs,      z_MultipleMatch.parseImpl)N)T)rrrrrrrwrw)rHrxrJsrJc@seZdZdZddZdS)ra Repetition of one or more of the given expression. Parameters: - expr - expression that must match one or more times - stopOn - (default=C{None}) - expression for a terminating sentinel (only required if the sentinel would ordinarily match the repetition expression) Example:: data_word = Word(alphas) label = data_word + FollowedBy(':') attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join)) text = "shape: SQUARE posn: upper left color: BLACK" OneOrMore(attr_expr).parseString(text).pprint() # Fail! read 'color' as data instead of next label -> [['shape', 'SQUARE color']] # use stopOn attribute for OneOrMore to avoid reading label string as part of the data attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) OneOrMore(attr_expr).parseString(text).pprint() # Better -> [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'BLACK']] # could also be written as (attr_expr * (1,)).parseString(text).pprint() cCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrr<z}...)rrrUrr.)rrwrwrxr!s   zOneOrMore.__str__N)rrrrrrwrwrwrxrscs8eZdZdZd fdd Zd fdd Zdd ZZS) r2aw Optional repetition of zero or more of the given expression. Parameters: - expr - expression that must match zero or more times - stopOn - (default=C{None}) - expression for a terminating sentinel (only required if the sentinel would ordinarily match the repetition expression) Example: similar to L{OneOrMore} Ncstt|j||dd|_dS)N)rLT)rr2rr[)rr.rL)rHrwrxr6szZeroOrMore.__init__Tc s6ytt|j|||Sttfk r0|gfSXdS)N)rr2rrr)rr-rro)rHrwrxr:szZeroOrMore.parseImplcCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrrz]...)rrrUrr.)rrwrwrxr@s   zZeroOrMore.__str__)N)T)rrrrrrrrrwrw)rHrxr2*s c@s eZdZddZeZddZdS) _NullTokencCsdS)NFrw)rrwrwrxrJsz_NullToken.__bool__cCsdS)Nrrw)rrwrwrxrMsz_NullToken.__str__N)rrrrr'rrwrwrwrxrMIsrMcs6eZdZdZeffdd Zd ddZddZZS) raa Optional matching of the given expression. Parameters: - expr - expression that must match zero or more times - default (optional) - value to be returned if the optional expression is not found. Example:: # US postal code can be a 5-digit zip, plus optional 4-digit qualifier zip = Combine(Word(nums, exact=5) + Optional('-' + Word(nums, exact=4))) zip.runTests(''' # traditional ZIP code 12345 # ZIP+4 form 12101-0001 # invalid ZIP 98765- ''') prints:: # traditional ZIP code 12345 ['12345'] # ZIP+4 form 12101-0001 ['12101-0001'] # invalid ZIP 98765- ^ FAIL: Expected end of text (at char 5), (line:1, col:6) cs.tt|j|dd|jj|_||_d|_dS)NF)rgT)rrrr.rWrr[)rr.r)rHrwrxrts zOptional.__init__Tc Cszy|jj|||dd\}}WnTttfk rp|jtk rh|jjr^t|jg}|j||jj<ql|jg}ng}YnX||fS)NF)rp)r.rtrrr_optionalNotMatchedrVr")rr-rrorrwrwrxrzs    zOptional.parseImplcCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrrr )rrrUrr.)rrwrwrxrs   zOptional.__str__)T) rrrrrNrrrrrwrw)rHrxrQs" cs,eZdZdZd fdd Zd ddZZS) r(a Token for skipping over all undefined text until the matched expression is found. Parameters: - expr - target expression marking the end of the data to be skipped - include - (default=C{False}) if True, the target expression is also parsed (the skipped text and target expression are returned as a 2-element list). - ignore - (default=C{None}) used to define grammars (typically quoted strings and comments) that might contain false matches to the target expression - failOn - (default=C{None}) define expressions that are not allowed to be included in the skipped test; if found before the target expression is found, the SkipTo is not a match Example:: report = ''' Outstanding Issues Report - 1 Jan 2000 # | Severity | Description | Days Open -----+----------+-------------------------------------------+----------- 101 | Critical | Intermittent system crash | 6 94 | Cosmetic | Spelling error on Login ('log|n') | 14 79 | Minor | System slow when running too many reports | 47 ''' integer = Word(nums) SEP = Suppress('|') # use SkipTo to simply match everything up until the next SEP # - ignore quoted strings, so that a '|' character inside a quoted string does not match # - parse action will call token.strip() for each matched token, i.e., the description body string_data = SkipTo(SEP, ignore=quotedString) string_data.setParseAction(tokenMap(str.strip)) ticket_expr = (integer("issue_num") + SEP + string_data("sev") + SEP + string_data("desc") + SEP + integer("days_open")) for tkt in ticket_expr.searchString(report): print tkt.dump() prints:: ['101', 'Critical', 'Intermittent system crash', '6'] - days_open: 6 - desc: Intermittent system crash - issue_num: 101 - sev: Critical ['94', 'Cosmetic', "Spelling error on Login ('log|n')", '14'] - days_open: 14 - desc: Spelling error on Login ('log|n') - issue_num: 94 - sev: Cosmetic ['79', 'Minor', 'System slow when running too many reports', '47'] - days_open: 47 - desc: System slow when running too many reports - issue_num: 79 - sev: Minor FNcs`tt|j|||_d|_d|_||_d|_t|t rFt j ||_ n||_ dt |j|_dS)NTFzNo match found for )rr(r ignoreExprr[r` includeMatchrrzrr$rQfailOnrr.ra)rrincluderrQ)rHrwrxrs zSkipTo.__init__Tc Cs,|}t|}|j}|jj}|jdk r,|jjnd}|jdk rB|jjnd} |} x| |kr|dk rh||| rhP| dk rx*y| || } Wqrtk rPYqrXqrWy||| dddWn tt fk r| d7} YqLXPqLWt|||j || }|||} t | } |j r$||||dd\}} | | 7} || fS)NF)rorprr)rp) rr.rtrQrrOrrrrrar"rP)rr-rror0rr.Z expr_parseZself_failOn_canParseNextZself_ignoreExpr_tryParseZtmplocZskiptextZ skipresultrrwrwrxrs<    zSkipTo.parseImpl)FNN)T)rrrrrrrrwrw)rHrxr(s6 csbeZdZdZdfdd ZddZddZd d Zd d Zgfd dZ ddZ fddZ Z S)raK Forward declaration of an expression to be defined later - used for recursive grammars, such as algebraic infix notation. When the expression is known, it is assigned to the C{Forward} variable using the '<<' operator. Note: take care when assigning to C{Forward} not to overlook precedence of operators. Specifically, '|' has a lower precedence than '<<', so that:: fwdExpr << a | b | c will actually be evaluated as:: (fwdExpr << a) | b | c thereby leaving b and c out as parseable alternatives. It is recommended that you explicitly group the values inserted into the C{Forward}:: fwdExpr << (a | b | c) Converting to use the '<<=' operator instead will avoid this problem. See L{ParseResults.pprint} for an example of a recursive parser created using C{Forward}. Ncstt|j|dddS)NF)rg)rrr)rr)rHrwrxrszForward.__init__cCsjt|trtj|}||_d|_|jj|_|jj|_|j|jj |jj |_ |jj |_ |j j |jj |S)N)rzrr$rQr.rUr`r[rrYrXrWr]r)rrrwrwrx __lshift__s      zForward.__lshift__cCs||>S)Nrw)rrrwrwrx __ilshift__'szForward.__ilshift__cCs d|_|S)NF)rX)rrwrwrxr*szForward.leaveWhitespacecCs$|js d|_|jdk r |jj|S)NT)r_r.r)rrwrwrxr.s   zForward.streamlinecCs>||kr0|dd|g}|jdk r0|jj||jgdS)N)r.rr)rrr7rwrwrxr5s   zForward.validatec Cs>t|dr|jS|jjdSd}Wd|j|_X|jjd|S)Nrz: ...Nonez: )rrrHrZ _revertClass_ForwardNoRecurser.r)rZ retStringrwrwrxr<s   zForward.__str__cs.|jdk rtt|jSt}||K}|SdS)N)r.rrr)rr)rHrwrxrMs  z Forward.copy)N) rrrrrrSrTrrrrrrrwrw)rHrxrs  c@seZdZddZdS)rVcCsdS)Nz...rw)rrwrwrxrVsz_ForwardNoRecurse.__str__N)rrrrrwrwrwrxrVUsrVcs"eZdZdZdfdd ZZS)r-zQ Abstract subclass of C{ParseExpression}, for converting parsed results. Fcstt|j|d|_dS)NF)rr-rrW)rr.rg)rHrwrxr]szTokenConverter.__init__)F)rrrrrrrwrw)rHrxr-Yscs6eZdZdZd fdd ZfddZdd ZZS) r a Converter to concatenate all matching tokens to a single string. By default, the matching patterns must also be contiguous in the input string; this can be disabled by specifying C{'adjacent=False'} in the constructor. Example:: real = Word(nums) + '.' + Word(nums) print(real.parseString('3.1416')) # -> ['3', '.', '1416'] # will also erroneously match the following print(real.parseString('3. 1416')) # -> ['3', '.', '1416'] real = Combine(Word(nums) + '.' + Word(nums)) print(real.parseString('3.1416')) # -> ['3.1416'] # no match when there are internal spaces print(real.parseString('3. 1416')) # -> Exception: Expected W:(0123...) rTcs8tt|j||r|j||_d|_||_d|_dS)NT)rr rradjacentrX joinStringre)rr.rXrW)rHrwrxrrszCombine.__init__cs(|jrtj||ntt|j||S)N)rWr$rrr )rr)rHrwrxr|szCombine.ignorecCsP|j}|dd=|tdj|j|jg|jd7}|jrH|jrH|gS|SdS)Nr)r)rr"rr rXrbrVr)rr-rrZretToksrwrwrxrs  "zCombine.postParse)rT)rrrrrrrrrwrw)rHrxr as cs(eZdZdZfddZddZZS)ra Converter to return the matched tokens as a list - useful for returning tokens of C{L{ZeroOrMore}} and C{L{OneOrMore}} expressions. Example:: ident = Word(alphas) num = Word(nums) term = ident | num func = ident + Optional(delimitedList(term)) print(func.parseString("fn a,b,100")) # -> ['fn', 'a', 'b', '100'] func = ident + Group(Optional(delimitedList(term))) print(func.parseString("fn a,b,100")) # -> ['fn', ['a', 'b', '100']] cstt|j|d|_dS)NT)rrrrW)rr.)rHrwrxrszGroup.__init__cCs|gS)Nrw)rr-rrrwrwrxrszGroup.postParse)rrrrrrrrwrw)rHrxrs  cs(eZdZdZfddZddZZS)r aW Converter to return a repetitive expression as a list, but also as a dictionary. Each element can also be referenced using the first token in the expression as its key. Useful for tabular report scraping when the first column can be used as a item key. Example:: data_word = Word(alphas) label = data_word + FollowedBy(':') attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join)) text = "shape: SQUARE posn: upper left color: light blue texture: burlap" attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) # print attributes as plain groups print(OneOrMore(attr_expr).parseString(text).dump()) # instead of OneOrMore(expr), parse using Dict(OneOrMore(Group(expr))) - Dict will auto-assign names result = Dict(OneOrMore(Group(attr_expr))).parseString(text) print(result.dump()) # access named fields as dict entries, or output as dict print(result['shape']) print(result.asDict()) prints:: ['shape', 'SQUARE', 'posn', 'upper left', 'color', 'light blue', 'texture', 'burlap'] [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']] - color: light blue - posn: upper left - shape: SQUARE - texture: burlap SQUARE {'color': 'light blue', 'posn': 'upper left', 'texture': 'burlap', 'shape': 'SQUARE'} See more examples at L{ParseResults} of accessing fields by results name. cstt|j|d|_dS)NT)rr rrW)rr.)rHrwrxrsz Dict.__init__cCsxt|D]\}}t|dkr q |d}t|trBt|dj}t|dkr^td|||<q t|dkrt|dt rt|d|||<q |j}|d=t|dkst|tr|j rt||||<q t|d|||<q W|j r|gS|SdS)Nrrrrrq) rrrzrurrrr"rrrV)rr-rrrtokZikeyZ dictvaluerwrwrxrs$   zDict.postParse)rrrrrrrrwrw)rHrxr s# c@s eZdZdZddZddZdS)r+aV Converter for ignoring the results of a parsed expression. Example:: source = "a, b, c,d" wd = Word(alphas) wd_list1 = wd + ZeroOrMore(',' + wd) print(wd_list1.parseString(source)) # often, delimiters that are useful during parsing are just in the # way afterward - use Suppress to keep them out of the parsed output wd_list2 = wd + ZeroOrMore(Suppress(',') + wd) print(wd_list2.parseString(source)) prints:: ['a', ',', 'b', ',', 'c', ',', 'd'] ['a', 'b', 'c', 'd'] (See also L{delimitedList}.) cCsgS)Nrw)rr-rrrwrwrxrszSuppress.postParsecCs|S)Nrw)rrwrwrxrszSuppress.suppressN)rrrrrrrwrwrwrxr+sc@s(eZdZdZddZddZddZdS) rzI Wrapper for parse actions, to ensure they are only called once. cCst||_d|_dS)NF)rMcallablecalled)rZ methodCallrwrwrxrs zOnlyOnce.__init__cCs.|js|j|||}d|_|St||ddS)NTr)r[rZr)rrr5rvrrwrwrxrs zOnlyOnce.__call__cCs d|_dS)NF)r[)rrwrwrxreset szOnlyOnce.resetN)rrrrrrr\rwrwrwrxrsc s:tfdd}y j|_Wntk r4YnX|S)as Decorator for debugging parse actions. When the parse action is called, this decorator will print C{">> entering I{method-name}(line:I{current_source_line}, I{parse_location}, I{matched_tokens})".} When the parse action completes, the decorator will print C{"<<"} followed by the returned value, or any exception that the parse action raised. Example:: wd = Word(alphas) @traceParseAction def remove_duplicate_chars(tokens): return ''.join(sorted(set(''.join(tokens))) wds = OneOrMore(wd).setParseAction(remove_duplicate_chars) print(wds.parseString("slkdjs sld sldd sdlf sdljf")) prints:: >>entering remove_duplicate_chars(line: 'slkdjs sld sldd sdlf sdljf', 0, (['slkdjs', 'sld', 'sldd', 'sdlf', 'sdljf'], {})) <>entering %s(line: '%s', %d, %r) z<.z)rMrr)rr`rw)rrxrb s  ,FcCs`t|dt|dt|d}|rBt|t||j|S|tt||j|SdS)a Helper to define a delimited list of expressions - the delimiter defaults to ','. By default, the list elements and delimiters can have intervening whitespace, and comments, but this can be overridden by passing C{combine=True} in the constructor. If C{combine} is set to C{True}, the matching tokens are returned as a single token string, with the delimiters included; otherwise, the matching tokens are returned as a list of tokens, with the delimiters suppressed. Example:: delimitedList(Word(alphas)).parseString("aa,bb,cc") # -> ['aa', 'bb', 'cc'] delimitedList(Word(hexnums), delim=':', combine=True).parseString("AA:BB:CC:DD:EE") # -> ['AA:BB:CC:DD:EE'] z [rz]...N)rr r2rir+)r.ZdelimcombineZdlNamerwrwrxr@9s $csjtfdd}|dkr0ttjdd}n|j}|jd|j|dd|jd td S) a: Helper to define a counted list of expressions. This helper defines a pattern of the form:: integer expr expr expr... where the leading integer tells how many expr expressions follow. The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed. If C{intExpr} is specified, it should be a pyparsing expression that produces an integer value. Example:: countedArray(Word(alphas)).parseString('2 ab cd ef') # -> ['ab', 'cd'] # in this parser, the leading integer value is given in binary, # '10' indicating that 2 values are in the array binaryConstant = Word('01').setParseAction(lambda t: int(t[0], 2)) countedArray(Word(alphas), intExpr=binaryConstant).parseString('10 ab cd ef') # -> ['ab', 'cd'] cs.|d}|r ttg|p&tt>gS)Nr)rrrC)rr5rvr) arrayExprr.rwrxcountFieldParseAction_s"z+countedArray..countFieldParseActionNcSs t|dS)Nr)ru)rvrwrwrxrydszcountedArray..ZarrayLenT)rfz(len) z...)rr/rRrrrirxr)r.ZintExprrdrw)rcr.rxr<Ls cCs:g}x0|D](}t|tr(|jt|q |j|q W|S)N)rzrrrr)Lrrrwrwrxrks   rcs6tfdd}|j|ddjdt|S)a* Helper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = matchPreviousLiteral(first) matchExpr = first + ":" + second will match C{"1:1"}, but not C{"1:2"}. Because this matches a previous literal, will also match the leading C{"1:1"} in C{"1:10"}. If this is not desired, use C{matchPreviousExpr}. Do I{not} use with packrat parsing enabled. csP|rBt|dkr|d>qLt|j}tdd|D>n t>dS)Nrrrcss|]}t|VqdS)N)r)rttrwrwrxrszDmatchPreviousLiteral..copyTokenToRepeater..)rrrrr )rr5rvZtflat)reprwrxcopyTokenToRepeaters   z1matchPreviousLiteral..copyTokenToRepeaterT)rfz(prev) )rrxrir)r.rhrw)rgrxrOts  csFt|j}|Kfdd}|j|ddjdt|S)aS Helper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = matchPreviousExpr(first) matchExpr = first + ":" + second will match C{"1:1"}, but not C{"1:2"}. Because this matches by expressions, will I{not} match the leading C{"1:1"} in C{"1:10"}; the expressions are evaluated first, and then compared, so C{"1"} is compared with C{"10"}. Do I{not} use with packrat parsing enabled. cs*t|jfdd}j|dddS)Ncs$t|j}|kr tddddS)Nrr)rrr)rr5rvZ theseTokens) matchTokensrwrxmustMatchTheseTokenss zLmatchPreviousExpr..copyTokenToRepeater..mustMatchTheseTokensT)rf)rrr)rr5rvrj)rg)rirxrhs  z.matchPreviousExpr..copyTokenToRepeaterT)rfz(prev) )rrrxrir)r.Ze2rhrw)rgrxrNs cCs>xdD]}|j|t|}qW|jdd}|jdd}t|S)Nz\^-]rz\nr(z\t)r_bslashr)rrrwrwrxrs    rTc s|rdd}dd}tndd}dd}tg}t|trF|j}n&t|tjr\t|}ntj dt dd|svt Sd }x|t |d kr||}xnt ||d d D]N\}} || |r|||d =Pq||| r|||d =|j|| | }PqW|d 7}q|W| r|ryht |t d j|krZtd d jdd|Djdj|Stdjdd|Djdj|SWn&tk rtj dt ddYnXtfdd|Djdj|S)a Helper to quickly define a set of alternative Literals, and makes sure to do longest-first testing when there is a conflict, regardless of the input order, but returns a C{L{MatchFirst}} for best performance. Parameters: - strs - a string of space-delimited literals, or a collection of string literals - caseless - (default=C{False}) - treat all literals as caseless - useRegex - (default=C{True}) - as an optimization, will generate a Regex object; otherwise, will generate a C{MatchFirst} object (if C{caseless=True}, or if creating a C{Regex} raises an exception) Example:: comp_oper = oneOf("< = > <= >= !=") var = Word(alphas) number = Word(nums) term = var | number comparison_expr = term + comp_oper + term print(comparison_expr.searchString("B = 12 AA=23 B<=AA AA>12")) prints:: [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']] cSs|j|jkS)N)r)rbrwrwrxryszoneOf..cSs|jj|jS)N)rr)rrlrwrwrxryscSs||kS)Nrw)rrlrwrwrxryscSs |j|S)N)r)rrlrwrwrxrysz6Invalid argument to oneOf, expected string or iterablerq)rrrrNrz[%s]css|]}t|VqdS)N)r)rsymrwrwrxrszoneOf..z | |css|]}tj|VqdS)N)rdr )rrmrwrwrxrsz7Exception creating Regex for oneOf, building MatchFirstc3s|]}|VqdS)Nrw)rrm)parseElementClassrwrxrs)rrrzrrrr5rrrrrrrrrr'rirKr) ZstrsrZuseRegexZisequalZmasksZsymbolsrZcurrrrw)rorxrSsL         ((cCsttt||S)a Helper to easily and clearly define a dictionary by specifying the respective patterns for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens in the proper order. The key pattern can include delimiting markers or punctuation, as long as they are suppressed, thereby leaving the significant key text. The value pattern can include named results, so that the C{Dict} results can include named token fields. Example:: text = "shape: SQUARE posn: upper left color: light blue texture: burlap" attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) print(OneOrMore(attr_expr).parseString(text).dump()) attr_label = label attr_value = Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join) # similar to Dict, but simpler call format result = dictOf(attr_label, attr_value).parseString(text) print(result.dump()) print(result['shape']) print(result.shape) # object attribute access works too print(result.asDict()) prints:: [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']] - color: light blue - posn: upper left - shape: SQUARE - texture: burlap SQUARE SQUARE {'color': 'light blue', 'shape': 'SQUARE', 'posn': 'upper left', 'texture': 'burlap'} )r r2r)rrrwrwrxrAs!cCs^tjdd}|j}d|_|d||d}|r@dd}ndd}|j||j|_|S) a Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the original parsed text. If the optional C{asString} argument is passed as C{False}, then the return value is a C{L{ParseResults}} containing any results names that were originally matched, and a single token containing the original matched text from the input string. So if the expression passed to C{L{originalTextFor}} contains expressions with defined results names, you must set C{asString} to C{False} if you want to preserve those results name values. Example:: src = "this is test bold text normal text " for tag in ("b","i"): opener,closer = makeHTMLTags(tag) patt = originalTextFor(opener + SkipTo(closer) + closer) print(patt.searchString(src)[0]) prints:: [' bold text '] ['text'] cSs|S)Nrw)rrrvrwrwrxry8sz!originalTextFor..F_original_start _original_endcSs||j|jS)N)rprq)rr5rvrwrwrxry=scSs&||jd|jdg|dd<dS)Nrprq)r)rr5rvrwrwrx extractText?sz$originalTextFor..extractText)r rrrer])r.ZasStringZ locMarkerZ endlocMarker matchExprrrrwrwrxrg s  cCst|jddS)zp Helper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty. cSs|dS)Nrrw)rvrwrwrxryJszungroup..)r-r)r.rwrwrxrhEscCs4tjdd}t|d|d|jjdS)a Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - locn_start = location where matched expression begins - locn_end = location where matched expression ends - value = the actual parsed results Be careful if the input text contains C{} characters, you may want to call C{L{ParserElement.parseWithTabs}} Example:: wd = Word(alphas) for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"): print(match) prints:: [[0, 'ljsdf', 5]] [[8, 'lksdjjf', 15]] [[18, 'lkkjj', 23]] cSs|S)Nrw)rr5rvrwrwrxry`szlocatedExpr..Z locn_startrZlocn_end)r rrrr)r.ZlocatorrwrwrxrjLsz\[]-*.$+^?()~ )r cCs |ddS)Nrrrrw)rr5rvrwrwrxryksryz\\0?[xX][0-9a-fA-F]+cCstt|djddS)Nrz\0x)unichrrulstrip)rr5rvrwrwrxrylsz \\0[0-7]+cCstt|ddddS)Nrrr)ruru)rr5rvrwrwrxrymsz\])rr z\wr8rrZnegatebodyr c sBddy djfddtj|jDStk r<dSXdS)a Helper to easily define string ranges for use in Word construction. Borrows syntax from regexp '[]' string range definitions:: srange("[0-9]") -> "0123456789" srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz" srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_" The input string must be enclosed in []'s, and the returned string is the expanded character set joined into a single string. The values enclosed in the []'s may be: - a single character - an escaped character with a leading backslash (such as C{\-} or C{\]}) - an escaped hex character with a leading C{'\x'} (C{\x21}, which is a C{'!'} character) (C{\0x##} is also supported for backwards compatibility) - an escaped octal character with a leading C{'\0'} (C{\041}, which is a C{'!'} character) - a range of any of the above, separated by a dash (C{'a-z'}, etc.) - any combination of the above (C{'aeiouy'}, C{'a-zA-Z0-9_$'}, etc.) cSs<t|ts|Sdjddtt|dt|ddDS)Nrcss|]}t|VqdS)N)ru)rrrwrwrxrsz+srange....rrr)rzr"rrord)prwrwrxryszsrange..rc3s|]}|VqdS)Nrw)rpart) _expandedrwrxrszsrange..N)r_reBracketExprrrxrK)rrw)r|rxr_rs  csfdd}|S)zt Helper method for defining parse actions that require matching at a specific column in the input text. cs"t||krt||ddS)Nzmatched token not at column %d)r9r)r)Zlocnr1)rrwrx verifyColsz!matchOnlyAtCol..verifyColrw)rr~rw)rrxrMs cs fddS)a Helper method for common parse actions that simply return a literal value. Especially useful when used with C{L{transformString}()}. Example:: num = Word(nums).setParseAction(lambda toks: int(toks[0])) na = oneOf("N/A NA").setParseAction(replaceWith(math.nan)) term = na | num OneOrMore(term).parseString("324 234 N/A 234") # -> [324, 234, nan, 234] csgS)Nrw)rr5rv)replStrrwrxryszreplaceWith..rw)rrw)rrxr\s cCs|dddS)a Helper parse action for removing quotation marks from parsed quoted strings. Example:: # by default, quotation marks are included in parsed results quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"] # use removeQuotes to strip quotation marks from parsed results quotedString.setParseAction(removeQuotes) quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["Now is the Winter of our Discontent"] rrrrsrw)rr5rvrwrwrxrZs c sNfdd}ytdtdj}Wntk rBt}YnX||_|S)aG Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional args are passed, they are forwarded to the given function as additional arguments after the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))}, which will convert the parsed data to an integer using base 16. Example (compare the last to example in L{ParserElement.transformString}:: hex_ints = OneOrMore(Word(hexnums)).setParseAction(tokenMap(int, 16)) hex_ints.runTests(''' 00 11 22 aa FF 0a 0d 1a ''') upperword = Word(alphas).setParseAction(tokenMap(str.upper)) OneOrMore(upperword).runTests(''' my kingdom for a horse ''') wd = Word(alphas).setParseAction(tokenMap(str.title)) OneOrMore(wd).setParseAction(' '.join).runTests(''' now is the winter of our discontent made glorious summer by this sun of york ''') prints:: 00 11 22 aa FF 0a 0d 1a [0, 17, 34, 170, 255, 10, 13, 26] my kingdom for a horse ['MY', 'KINGDOM', 'FOR', 'A', 'HORSE'] now is the winter of our discontent made glorious summer by this sun of york ['Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York'] csfdd|DS)Ncsg|]}|fqSrwrw)rZtokn)rr6rwrxrsz(tokenMap..pa..rw)rr5rv)rr6rwrxr}sztokenMap..parrH)rJrrKr{)r6rr}rLrw)rr6rxrms cCs t|jS)N)rr)rvrwrwrxryscCs t|jS)N)rlower)rvrwrwrxryscCst|tr|}t|| d}n|j}tttd}|rtjj t }t d|dt t t|t d|tddgdjd j d d t d }nd jddtD}tjj t t|B}t d|dt t t|j ttt d|tddgdjd j dd t d }ttd|d }|jdd j|jddjjjd|}|jdd j|jddjjjd|}||_||_||fS)zRInternal helper to construct opening and closing tag expressions, given a tag name)rz_-:rtag=/F)rrCcSs |ddkS)Nrrrw)rr5rvrwrwrxrysz_makeTags..rrcss|]}|dkr|VqdS)rNrw)rrrwrwrxrsz_makeTags..cSs |ddkS)Nrrrw)rr5rvrwrwrxryszrz)rzrrrr/r4r3r>rrrZr+r r2rrrmrrVrYrBr _Lrtitlerrir)tagStrZxmlZresnameZ tagAttrNameZ tagAttrValueZopenTagZprintablesLessRAbrackZcloseTagrwrwrx _makeTagss" T\..rcCs t|dS)a  Helper to construct opening and closing tag expressions for HTML, given a tag name. Matches tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values. Example:: text = 'More info at the pyparsing wiki page' # makeHTMLTags returns pyparsing expressions for the opening and closing tags as a 2-tuple a,a_end = makeHTMLTags("A") link_expr = a + SkipTo(a_end)("link_text") + a_end for link in link_expr.searchString(text): # attributes in the tag (like "href" shown here) are also accessible as named results print(link.link_text, '->', link.href) prints:: pyparsing -> http://pyparsing.wikispaces.com F)r)rrwrwrxrKscCs t|dS)z Helper to construct opening and closing tag expressions for XML, given a tag name. Matches tags only in the given upper/lower case. Example: similar to L{makeHTMLTags} T)r)rrwrwrxrLscs8|r|ddn|jddDfdd}|S)a< Helper to create a validating parse action to be used with start tags created with C{L{makeXMLTags}} or C{L{makeHTMLTags}}. Use C{withAttribute} to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as C{} or C{
}. Call C{withAttribute} with a series of attribute names and values. Specify the list of filter attributes names and values as: - keyword arguments, as in C{(align="right")}, or - as an explicit dict with C{**} operator, when an attribute name is also a Python reserved word, as in C{**{"class":"Customer", "align":"right"}} - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") ) For attribute names with a namespace prefix, you must use the second form. Attribute names are matched insensitive to upper/lower case. If just testing for C{class} (with or without a namespace), use C{L{withClass}}. To verify that the attribute exists, but without specifying a value, pass C{withAttribute.ANY_VALUE} as the value. Example:: html = '''
Some text
1 4 0 1 0
1,3 2,3 1,1
this has no type
''' div,div_end = makeHTMLTags("div") # only match div tag having a type attribute with value "grid" div_grid = div().setParseAction(withAttribute(type="grid")) grid_expr = div_grid + SkipTo(div | div_end)("body") for grid_header in grid_expr.searchString(html): print(grid_header.body) # construct a match with any div tag having a type attribute, regardless of the value div_any_type = div().setParseAction(withAttribute(type=withAttribute.ANY_VALUE)) div_expr = div_any_type + SkipTo(div | div_end)("body") for div_header in div_expr.searchString(html): print(div_header.body) prints:: 1 4 0 1 0 1 4 0 1 0 1,3 2,3 1,1 NcSsg|]\}}||fqSrwrw)rrrrwrwrxrQsz!withAttribute..cs^xXD]P\}}||kr&t||d||tjkr|||krt||d||||fqWdS)Nzno matching attribute z+attribute '%s' has value '%s', must be '%s')rre ANY_VALUE)rr5rZattrNameZ attrValue)attrsrwrxr}Rs zwithAttribute..pa)r)rZattrDictr}rw)rrxres 2 cCs|r d|nd}tf||iS)a Simplified version of C{L{withAttribute}} when matching on a div class - made difficult because C{class} is a reserved word in Python. Example:: html = '''
Some text
1 4 0 1 0
1,3 2,3 1,1
this <div> has no class
''' div,div_end = makeHTMLTags("div") div_grid = div().setParseAction(withClass("grid")) grid_expr = div_grid + SkipTo(div | div_end)("body") for grid_header in grid_expr.searchString(html): print(grid_header.body) div_any_type = div().setParseAction(withClass(withAttribute.ANY_VALUE)) div_expr = div_any_type + SkipTo(div | div_end)("body") for div_header in div_expr.searchString(html): print(div_header.body) prints:: 1 4 0 1 0 1 4 0 1 0 1,3 2,3 1,1 z%s:classclass)re)Z classname namespaceZ classattrrwrwrxrk\s (rcCst}||||B}x`t|D]R\}}|d dd\}} } } | dkrTd|nd|} | dkr|dksxt|dkrtd|\} }tj| }| tjkrd| dkrt||t|t |}n| dkr|dk rt|||t|t ||}nt||t|t |}nD| dkrZt|| |||t|| |||}ntd n| tj krH| dkrt |t st |}t|j |t||}n| dkr|dk rt|||t|t ||}nt||t|t |}nD| dkr>t|| |||t|| |||}ntd ntd | r`|j| ||j| |BK}|}q"W||K}|S) a Helper method for constructing grammars of expressions made up of operators working in a precedence hierarchy. Operators may be unary or binary, left- or right-associative. Parse actions can also be attached to operator expressions. The generated parser will also recognize the use of parentheses to override operator precedences (see example below). Note: if you define a deep operator list, you may see performance issues when using infixNotation. See L{ParserElement.enablePackrat} for a mechanism to potentially improve your parser performance. Parameters: - baseExpr - expression representing the most basic element for the nested - opList - list of tuples, one for each operator precedence level in the expression grammar; each tuple is of the form (opExpr, numTerms, rightLeftAssoc, parseAction), where: - opExpr is the pyparsing expression for the operator; may also be a string, which will be converted to a Literal; if numTerms is 3, opExpr is a tuple of two expressions, for the two operators separating the 3 terms - numTerms is the number of terms for this operator (must be 1, 2, or 3) - rightLeftAssoc is the indicator whether the operator is right or left associative, using the pyparsing-defined constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. - parseAction is the parse action to be associated with expressions matching this operator expression (the parse action tuple member may be omitted) - lpar - expression for matching left-parentheses (default=C{Suppress('(')}) - rpar - expression for matching right-parentheses (default=C{Suppress(')')}) Example:: # simple example of four-function arithmetic with ints and variable names integer = pyparsing_common.signed_integer varname = pyparsing_common.identifier arith_expr = infixNotation(integer | varname, [ ('-', 1, opAssoc.RIGHT), (oneOf('* /'), 2, opAssoc.LEFT), (oneOf('+ -'), 2, opAssoc.LEFT), ]) arith_expr.runTests(''' 5+3*6 (5+3)*6 -2--11 ''', fullDump=False) prints:: 5+3*6 [[5, '+', [3, '*', 6]]] (5+3)*6 [[[5, '+', 3], '*', 6]] -2--11 [[['-', 2], '-', ['-', 11]]] Nrroz%s termz %s%s termrqz@if numterms=3, opExpr must be a tuple or list of two expressionsrrz6operator must be unary (1), binary (2), or ternary (3)z2operator must indicate right or left associativity)N)rrrrrirTLEFTrrrRIGHTrzrr.r)ZbaseExprZopListZlparZrparrZlastExprrZoperDefZopExprZarityZrightLeftAssocr}ZtermNameZopExpr1ZopExpr2ZthisExprrsrwrwrxrisR;    &       &   z4"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*"z string enclosed in double quotesz4'(?:[^'\n\r\\]|(?:'')|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*'z string enclosed in single quotesz*quotedString using single or double quotesuzunicode string literalcCs||krtd|dkr(t|to,t|tr t|dkrt|dkr|dk rtt|t||tjddj dd}n$t j t||tjj dd}nx|dk rtt|t |t |ttjddj dd}n4ttt |t |ttjddj d d}ntd t }|dk rb|tt|t||B|Bt|K}n$|tt|t||Bt|K}|jd ||f|S) a~ Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default=C{"("}); can also be a pyparsing expression - closer - closing character for a nested list (default=C{")"}); can also be a pyparsing expression - content - expression for items within the nested lists (default=C{None}) - ignoreExpr - expression for ignoring opening and closing delimiters (default=C{quotedString}) If an expression is not provided for the content argument, the nested expression will capture all whitespace-delimited content between delimiters as a list of separate values. Use the C{ignoreExpr} argument to define expressions that may contain opening or closing characters that should not be treated as opening or closing characters for nesting, such as quotedString or a comment expression. Specify multiple expressions using an C{L{Or}} or C{L{MatchFirst}}. The default is L{quotedString}, but if no expressions are to be ignored, then pass C{None} for this argument. Example:: data_type = oneOf("void int short long char float double") decl_data_type = Combine(data_type + Optional(Word('*'))) ident = Word(alphas+'_', alphanums+'_') number = pyparsing_common.number arg = Group(decl_data_type + ident) LPAR,RPAR = map(Suppress, "()") code_body = nestedExpr('{', '}', ignoreExpr=(quotedString | cStyleComment)) c_function = (decl_data_type("type") + ident("name") + LPAR + Optional(delimitedList(arg), [])("args") + RPAR + code_body("body")) c_function.ignore(cStyleComment) source_code = ''' int is_odd(int x) { return (x%2); } int dec_to_hex(char hchar) { if (hchar >= '0' && hchar <= '9') { return (ord(hchar)-ord('0')); } else { return (10+ord(hchar)-ord('A')); } } ''' for func in c_function.searchString(source_code): print("%(name)s (%(type)s) args: %(args)s" % func) prints:: is_odd (int) args: [['int', 'x']] dec_to_hex (int) args: [['char', 'hchar']] z.opening and closing strings cannot be the sameNrr)r cSs |djS)Nr)r)rvrwrwrxry9sznestedExpr..cSs |djS)Nr)r)rvrwrwrxry<scSs |djS)Nr)r)rvrwrwrxryBscSs |djS)Nr)r)rvrwrwrxryFszOopening and closing arguments must be strings if no content expression is givenznested %s%s expression)rrzrrr rr r$rNrrCrrrrr+r2ri)openerZcloserZcontentrOrrwrwrxrPs4:     *$c sfdd}fdd}fdd}ttjdj}ttj|jd}tj|jd }tj|jd } |rtt||t|t|t|| } n$tt|t|t|t|} |j t t| jd S) a Helper method for defining space-delimited indentation blocks, such as those used to define block statements in Python source code. Parameters: - blockStatementExpr - expression defining syntax of statement that is repeated within the indented block - indentStack - list created by caller to manage indentation stack (multiple statementWithIndentedBlock expressions within a single grammar should share a common indentStack) - indent - boolean indicating whether block must be indented beyond the the current level; set to False for block of left-most statements (default=C{True}) A valid block must contain at least one C{blockStatement}. Example:: data = ''' def A(z): A1 B = 100 G = A2 A2 A3 B def BB(a,b,c): BB1 def BBA(): bba1 bba2 bba3 C D def spam(x,y): def eggs(z): pass ''' indentStack = [1] stmt = Forward() identifier = Word(alphas, alphanums) funcDecl = ("def" + identifier + Group( "(" + Optional( delimitedList(identifier) ) + ")" ) + ":") func_body = indentedBlock(stmt, indentStack) funcDef = Group( funcDecl + func_body ) rvalue = Forward() funcCall = Group(identifier + "(" + Optional(delimitedList(rvalue)) + ")") rvalue << (funcCall | identifier | Word(nums)) assignment = Group(identifier + "=" + rvalue) stmt << ( funcDef | assignment | identifier ) module_body = OneOrMore(stmt) parseTree = module_body.parseString(data) parseTree.pprint() prints:: [['def', 'A', ['(', 'z', ')'], ':', [['A1'], [['B', '=', '100']], [['G', '=', 'A2']], ['A2'], ['A3']]], 'B', ['def', 'BB', ['(', 'a', 'b', 'c', ')'], ':', [['BB1'], [['def', 'BBA', ['(', ')'], ':', [['bba1'], ['bba2'], ['bba3']]]]]], 'C', 'D', ['def', 'spam', ['(', 'x', 'y', ')'], ':', [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]] csN|t|krdSt||}|dkrJ|dkr>t||dt||ddS)Nrrzillegal nestingznot a peer entryrsrs)rr9r!r)rr5rvcurCol) indentStackrwrxcheckPeerIndents     z&indentedBlock..checkPeerIndentcs2t||}|dkr"j|n t||ddS)Nrrznot a subentryrs)r9rr)rr5rvr)rrwrxcheckSubIndents   z%indentedBlock..checkSubIndentcsN|t|krdSt||}o4|dko4|dksBt||djdS)Nrrrqznot an unindentrsr:)rr9rr)rr5rvr)rrwrx checkUnindents    z$indentedBlock..checkUnindentz INDENTrZUNINDENTzindented block) rrrrr rrirrrrk) ZblockStatementExprrrrrrr!rZPEERZUNDENTZsmExprrw)rrxrfQsN   ,z#[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]z[\0xa1-\0xbf\0xd7\0xf7]z_:zany tagzgt lt amp nbsp quot aposz><& "'z &(?Prnz);zcommon HTML entitycCs tj|jS)zRHelper parser action to replace common HTML entities with their special characters)_htmlEntityMaprZentity)rvrwrwrxr[sz/\*(?:[^*]|\*(?!/))*z*/zC style commentzz HTML commentz.*z rest of linez//(?:\\\n|[^\n])*z // commentzC++ style commentz#.*zPython style comment)rz commaItem)rc@seZdZdZeeZeeZe e j dj eZ e ej dj eedZedj dj eZej edej ej dZejd d eeeed jeBj d Zejeed j dj eZedj dj eZeeBeBjZedj dj eZe ededj dZedj dZ edj dZ!e!de!dj dZ"ee!de!d>dee!de!d?j dZ#e#j$d d d!e j d"Z%e&e"e%Be#Bj d#j d#Z'ed$j d%Z(e)d@d'd(Z*e)dAd*d+Z+ed,j d-Z,ed.j d/Z-ed0j d1Z.e/je0jBZ1e)d2d3Z2e&e3e4d4e5e e6d4d5ee7d6jj d7Z8e9ee:j;e8Bd8d9j d:Zd=S)Brna Here are some common low-level expressions that may be useful in jump-starting parser development: - numeric forms (L{integers}, L{reals}, L{scientific notation}) - common L{programming identifiers} - network addresses (L{MAC}, L{IPv4}, L{IPv6}) - ISO8601 L{dates} and L{datetime} - L{UUID} - L{comma-separated list} Parse actions: - C{L{convertToInteger}} - C{L{convertToFloat}} - C{L{convertToDate}} - C{L{convertToDatetime}} - C{L{stripHTMLTags}} - C{L{upcaseTokens}} - C{L{downcaseTokens}} Example:: pyparsing_common.number.runTests(''' # any int or real number, returned as the appropriate type 100 -100 +100 3.14159 6.02e23 1e-12 ''') pyparsing_common.fnumber.runTests(''' # any int or real number, returned as float 100 -100 +100 3.14159 6.02e23 1e-12 ''') pyparsing_common.hex_integer.runTests(''' # hex numbers 100 FF ''') pyparsing_common.fraction.runTests(''' # fractions 1/2 -3/4 ''') pyparsing_common.mixed_integer.runTests(''' # mixed fractions 1 1/2 -3/4 1-3/4 ''') import uuid pyparsing_common.uuid.setParseAction(tokenMap(uuid.UUID)) pyparsing_common.uuid.runTests(''' # uuid 12345678-1234-5678-1234-567812345678 ''') prints:: # any int or real number, returned as the appropriate type 100 [100] -100 [-100] +100 [100] 3.14159 [3.14159] 6.02e23 [6.02e+23] 1e-12 [1e-12] # any int or real number, returned as float 100 [100.0] -100 [-100.0] +100 [100.0] 3.14159 [3.14159] 6.02e23 [6.02e+23] 1e-12 [1e-12] # hex numbers 100 [256] FF [255] # fractions 1/2 [0.5] -3/4 [-0.75] # mixed fractions 1 [1] 1/2 [0.5] -3/4 [-0.75] 1-3/4 [1.75] # uuid 12345678-1234-5678-1234-567812345678 [UUID('12345678-1234-5678-1234-567812345678')] integerz hex integerrtz[+-]?\d+zsigned integerrfractioncCs|d|dS)Nrrrrsrw)rvrwrwrxryszpyparsing_common.r8z"fraction or mixed integer-fractionz [+-]?\d+\.\d*z real numberz+[+-]?\d+([eE][+-]?\d+|\.\d*([eE][+-]?\d+)?)z$real number with scientific notationz[+-]?\d+\.?\d*([eE][+-]?\d+)?fnumberrB identifierzK(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}z IPv4 addressz[0-9a-fA-F]{1,4} hex_integerrzfull IPv6 addressrrBz::zshort IPv6 addresscCstdd|DdkS)Ncss|]}tjj|rdVqdS)rrN)rn _ipv6_partr)rrfrwrwrxrsz,pyparsing_common...rw)rH)rvrwrwrxrysz::ffff:zmixed IPv6 addressz IPv6 addressz:[0-9a-fA-F]{2}([:.-])[0-9a-fA-F]{2}(?:\1[0-9a-fA-F]{2}){4}z MAC address%Y-%m-%dcsfdd}|S)a Helper to create a parse action for converting parsed date string to Python datetime.date Params - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%d"}) Example:: date_expr = pyparsing_common.iso8601_date.copy() date_expr.setParseAction(pyparsing_common.convertToDate()) print(date_expr.parseString("1999-12-31")) prints:: [datetime.date(1999, 12, 31)] csLytj|djStk rF}zt||t|WYdd}~XnXdS)Nr)rstrptimeZdaterrr{)rr5rvve)fmtrwrxcvt_fnsz.pyparsing_common.convertToDate..cvt_fnrw)rrrw)rrx convertToDates zpyparsing_common.convertToDate%Y-%m-%dT%H:%M:%S.%fcsfdd}|S)a Helper to create a parse action for converting parsed datetime string to Python datetime.datetime Params - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%dT%H:%M:%S.%f"}) Example:: dt_expr = pyparsing_common.iso8601_datetime.copy() dt_expr.setParseAction(pyparsing_common.convertToDatetime()) print(dt_expr.parseString("1999-12-31T23:59:59.999")) prints:: [datetime.datetime(1999, 12, 31, 23, 59, 59, 999000)] csHytj|dStk rB}zt||t|WYdd}~XnXdS)Nr)rrrrr{)rr5rvr)rrwrxrsz2pyparsing_common.convertToDatetime..cvt_fnrw)rrrw)rrxconvertToDatetimes z"pyparsing_common.convertToDatetimez7(?P\d{4})(?:-(?P\d\d)(?:-(?P\d\d))?)?z ISO8601 datez(?P\d{4})-(?P\d\d)-(?P\d\d)[T ](?P\d\d):(?P\d\d)(:(?P\d\d(\.\d*)?)?)?(?PZ|[+-]\d\d:?\d\d)?zISO8601 datetimez2[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}UUIDcCstjj|dS)a Parse action to remove HTML tags from web page HTML source Example:: # strip HTML links from normal text text = 'More info at the
pyparsing wiki page' td,td_end = makeHTMLTags("TD") table_text = td + SkipTo(td_end).setParseAction(pyparsing_common.stripHTMLTags)("body") + td_end print(table_text.parseString(text).body) # -> 'More info at the pyparsing wiki page' r)rn_html_stripperr)rr5rrwrwrx stripHTMLTagss zpyparsing_common.stripHTMLTagsra)rz rr)rzcomma separated listcCs t|jS)N)rr)rvrwrwrxryscCs t|jS)N)rr)rvrwrwrxrysN)rrB)rrB)r)r)?rrrrrmruZconvertToIntegerfloatZconvertToFloatr/rRrirrrDrr'Zsigned_integerrrxrrZ mixed_integerrHrealZsci_realrnumberrr4r3rZ ipv4_addressrZ_full_ipv6_addressZ_short_ipv6_addressr~Z_mixed_ipv6_addressr Z ipv6_addressZ mac_addressrrrZ iso8601_dateZiso8601_datetimeuuidr7r6rrrrrrVr. _commasepitemr@rYrZcomma_separated_listrdrBrwrwrwrxrnsN"" 2   8__main__Zselectfromz_$r])rbcolumnsrjZtablesZcommandaK # '*' as column list and dotted table name select * from SYS.XYZZY # caseless match on "SELECT", and casts back to "select" SELECT * from XYZZY, ABC # list of column names, and mixed case SELECT keyword Select AA,BB,CC from Sys.dual # multiple tables Select A, B, C from Sys.dual, Table2 # invalid SELECT keyword - should fail Xelect A, B, C from Sys.dual # incomplete command - should fail Select # invalid column name - should fail Select ^^^ frox Sys.dual z] 100 -100 +100 3.14159 6.02e23 1e-12 z 100 FF z6 12345678-1234-5678-1234-567812345678 )rq)raF)N)FT)T)r)T)r __version__Z__versionTime__ __author__rweakrefrrrr~rrdrrr"r<rr_threadr ImportErrorZ threadingrrZ ordereddict__all__r version_infor;rmaxsizerr{rchrrurrHrrreversedrrrr6r r rIZmaxintZxrangerZ __builtin__rZfnamerrJrrrrrrZascii_uppercaseZascii_lowercaser4rRrDr3rkrZ printablerVrKrrr!r#r&rr"MutableMappingregisterr9rJrGr/r2r4rQrMr$r,r rrrrQrrrrlr/r'r%r r.r0rrrr*r)r1r0r rrrr rrrrJrr2rMrNrr(rrVr-r rr r+rrbr@r<rrOrNrrSrArgrhrjrirCrIrHrar`rZ _escapedPuncZ_escapedHexCharZ_escapedOctCharUNICODEZ _singleCharZ _charRangermr}r_rMr\rZrmrdrBrrKrLrerrkrTrrrirUr>r^rYrcrPrfr5rWr7r6rrrrr;r[r8rErr]r?r=rFrXrrr:rnrZ selectTokenZ fromTokenZidentZ columnNameZcolumnNameListZ columnSpecZ tableNameZ tableNameListZ simpleSQLrrrrrrrwrwrwrx=s                 8      @d &A= I G3pLOD|M &#@sQ,A,    I# %     &0 ,   ? #k Zr   (  0     "__pycache__/__init__.cpython-36.pyc000064400000005240152347724720013157 0ustar003 Pf>@sdZddlmZddlZddlZddlZdZejj ejj e Z ddZ erejejje dejejdd<e de d e d e d e d e d e de de de de de de de de de de de de de de de de de de d e d!e d"e d#e d$e d%e d&e d'e d(e d)e d*e d+e d,e d-e d.e d/e d0e d1e d2dS)3z pip._vendor is for vendoring dependencies of pip to prevent needing pip to depend on something external. Files inside of pip._vendor should be considered immutable and should only be updated to versions from upstream. )absolute_importNFcCsdjt|}yt|ttddWnztk ryt|ttddWntk r`Yn:Xtj|tj|<|jdd\}}t tj||tj|YnXdS)Nz{0}.{1}r)level.) format__name__ __import__globalslocals ImportErrorsysmodulesrsplitsetattr)Z modulenameZ vendored_namebaseheadr/usr/lib/python3.6/__init__.pyvendoreds  rz*.whlZ cachecontrolZcoloramaZdistlibZdistroZhtml5libZlockfileZsixz six.moveszsix.moves.urllibZ packagingzpackaging.versionzpackaging.specifiersZ pkg_resourcesZprogressZretryingZrequestszrequests.packageszrequests.packages.urllib3z&requests.packages.urllib3._collectionsz$requests.packages.urllib3.connectionz(requests.packages.urllib3.connectionpoolz!requests.packages.urllib3.contribz*requests.packages.urllib3.contrib.ntlmpoolz+requests.packages.urllib3.contrib.pyopensslz$requests.packages.urllib3.exceptionsz requests.packages.urllib3.fieldsz"requests.packages.urllib3.filepostz"requests.packages.urllib3.packagesz/requests.packages.urllib3.packages.ordered_dictz&requests.packages.urllib3.packages.sixz5requests.packages.urllib3.packages.ssl_match_hostnamezErequests.packages.urllib3.packages.ssl_match_hostname._implementationz%requests.packages.urllib3.poolmanagerz!requests.packages.urllib3.requestz"requests.packages.urllib3.responsezrequests.packages.urllib3.utilz)requests.packages.urllib3.util.connectionz&requests.packages.urllib3.util.requestz'requests.packages.urllib3.util.responsez$requests.packages.urllib3.util.retryz#requests.packages.urllib3.util.ssl_z&requests.packages.urllib3.util.timeoutz"requests.packages.urllib3.util.url)__doc__Z __future__rZglobZos.pathosr Z DEBUNDLEDpathabspathdirname__file__Z WHEEL_DIRrjoinrrrrsh $__pycache__/re-vendor.cpython-36.opt-1.pyc000064400000002010152347724720014250 0ustar003 Pf@sddlZddlZddlZddlZddlZejjejjeZ ddZ ddZ ddZ e dkreejd krpe ejd dkre nejd dkre ne dS) NcCstdtjddS)Nz"Usage: re-vendor.py [clean|vendor])printsysexitrr/usr/lib/python3.6/re-vendor.pyusage srcCsPx6tjtD](}tjjt|}tjj|r tj|q WtjtjjtddS)Nzsix.py) oslistdirherepathjoinisdirshutilrmtreeunlink)fndirnamerrrclean s  rcCs6tjddtddgxtjdD]}tj|q WdS)NZinstallz-tz-rz vendor.txtz *.egg-info)pipmainr globrr)rrrrvendorsr__main__r)r rrrrr abspathr__file__r rrr__name__lenargvrrrrs __pycache__/ipaddress.cpython-36.pyc000064400000201427152347724720013403 0ustar003 Pf09@sldZddlmZddlZddlZdZefZy eefZWne k rJYnXye Z Wn$e k rxe Z e e ksttYnXdOdkrddZnddZy ejZWnek rd d ZYnXd d Zeed rddZnddZdPddZGdddeZdZdZGdddeZGdddeZddZdQdd Zd!d"Z d#d$Z!d%d&Z"d'd(Z#d)d*Z$d+d,Z%d-d.Z&d/d0Z'd1d2Z(d3d4Z)Gd5d6d6eZ*Gd7d8d8e*Z+Gd9d:d:e*Z,Gd;d<dd>e-e+Z.Gd?d@d@e.Z/GdAdBdBe-e,Z0GdCdDdDeZ1e1e._2GdEdFdFeZ3GdGdHdHe3e+Z4GdIdJdJe4Z5GdKdLdLe3e,Z6GdMdNdNeZ7e7e4_2dS)RzA fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. )unicode_literalsNz1.0.17cCs|S)N)bytrr/usr/lib/python3.6/ipaddress.py_compat_bytes_to_byte_valssrcCsdd|DS)NcSsg|]}tjd|dqS)s!Br)structunpack).0brrr #sz._compat_bytes_to_byte_vals..r)rrrrr"scCs<|dks td}x&|D]}t|ts(t|d>|}qW|S)Nbigr)AssertionError isinstance_compat_int_types)Zbytvals endianessresZbvrrr_compat_int_from_byte_vals's   rcCst|tst|dkst|dkrH|dks2|dkrr?)r@strictrrr ip_networks   rEcCsTyt|Sttfk r YnXyt|Sttfk rBYnXtd|dS)agTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Notes: The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. z2%r does not appear to be an IPv4 or IPv6 interfaceN) IPv4Interfacer9r; IPv6Interfacer?)r@rrr ip_interfacesrHc Cs4y t|ddStjtfk r.tdYnXdS)a`Represent an address as 4 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv4 IP address. Returns: The integer address packed as 4 bytes in network (big-endian) order. Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. rr z&Address negative or too large for IPv4N)rrr OverflowErrorr?)r@rrrv4_int_to_packeds rJc Cs4y t|ddStjtfk r.tdYnXdS)zRepresent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. rr z&Address negative or too large for IPv6N)rrrrIr?)r@rrrv6_int_to_packeds  rKcCs*t|jd}t|dkr&td||S)zAHelper to split the netmask and raise AddressValueError if needed/rzOnly one '/' permitted in %r) _compat_strsplitlenr9)r@addrrrr_split_optional_netmasks  rQccsRt|}t|}}x.|D]&}|j|jdkr<||fV|}|}qW||fVdS)zFind a sequence of sorted deduplicated IPv#Address. Args: addresses: a list of IPv#Address objects. Yields: A tuple containing the first and last IP addresses in the sequence. r$N)iternext_ip) addressesitfirstlastiprrr_find_address_ranges    rZcCs$|dkr |St|t||d@S)zCount the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. rr$)minr!)Znumberbitsrrr_count_righthand_zero_bits0s r]ccst|tot|tstd|j|jkr8td||f||krHtd|jdkrXt}n|jdkrht}ntd|j}|j}|j}x^||krt t ||t ||dd}||||f}|V|d|>7}|d|j krPqWdS) aSummarize a network range given the first and last IP addresses. Example: >>> list(summarize_address_range(IPv4Address('192.0.2.0'), ... IPv4Address('192.0.2.130'))) ... #doctest: +NORMALIZE_WHITESPACE [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: An iterator of the summarized IPv(4|6) network objects. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version of the first address is not 4 or 6. z1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstrzunknown IP versionr$N) r _BaseAddress TypeErrorversionr?rBrC_max_prefixlenrTr[r]r! _ALL_ONES)rWrXrYZip_bitsZ first_intZlast_intZnbitsnetrrrsummarize_address_range@s0         reccst|}i}xL|rX|j}|j}|j|}|dkr>|||<q||kr||=|j|qWd}x4t|jD]$}|dk r|j|jkrql|V|}qlWdS)auLoops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network('192.0.2.0/26') ip2 = IPv4Network('192.0.2.64/26') ip3 = IPv4Network('192.0.2.128/26') ip4 = IPv4Network('192.0.2.192/26') _collapse_addresses_internal([ip1, ip2, ip3, ip4]) -> [IPv4Network('192.0.2.0/24')] This shouldn't be called directly; it is called via collapse_addresses([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed. N)listpopsupernetgetappendsortedvaluesbroadcast_address)rUZto_mergesubnetsrdrhZexistingrXrrr_collapse_addresses_internalws$   roc Cs8g}g}g}x|D]}t|trT|rH|dj|jkrHtd||df|j|q|j|jkr|r|dj|jkrtd||dfy|j|jWqtk r|j|j YqXq|r|dj|jkrtd||df|j|qWt t |}|r,x&t |D]\}}|j t||qWt||S) aCollapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network or IPv6Network objects. Returns: An iterator of the collapsed IPv(4|6)Network objects. Raises: TypeError: If passed a list of mixed version objects. r$z%%s and %s are not of the same versionrprprprprp)rr__versionr`rj _prefixlenrbrYAttributeErrornetwork_addressrksetrZextendrero)rUZaddrsZipsZnetsrYrWrXrrrcollapse_addressess4     rwcCs(t|tr|jSt|tr$|jStS)a2Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There are some times however, where you may wish to have ipaddress sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key. )r _BaseNetwork_get_networks_keyr__get_address_keyr-)objrrrget_mixed_type_keys   r|c@seZdZdZfZeddZeddZeddZedd Z d d Z d d Z e ddZ e ddZe ddZe ddZe ddZddZdS)_IPAddressBasezThe mother class.cCs|jS)z:Return the longhand version of the IP address as a string.)_explode_shorthand_ip_string)r*rrrexplodedsz_IPAddressBase.explodedcCst|S)z;Return the shorthand version of the IP address as a string.)rM)r*rrr compressedsz_IPAddressBase.compressedcCs|jS)aIThe name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa' )_reverse_pointer)r*rrrreverse_pointers z_IPAddressBase.reverse_pointercCsdt|f}t|dS)Nz%200s has no version specified)typer)r*msgrrrrasz_IPAddressBase.versioncCsF|dkrd}t|||jf||jkrBd}t|||j|jfdS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)r9rqrcrb)r*r@rrrr_check_int_addresss  z!_IPAddressBase._check_int_addresscCs.t|}||kr*d}t|||||jfdS)Nz~%r (len %d != %d) is not permitted as an IPv%d address. Did you pass in a bytes (str in Python 2) instead of a unicode object?)rOr9rq)r*r@Z expected_lenZ address_lenrrrr_check_packed_address s z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)zTurn the prefix length into a bitwise netmask Args: prefixlen: An integer, the prefix length. Returns: An integer. )rc)cls prefixlenrrr_ip_int_from_prefix+s z"_IPAddressBase._ip_int_from_prefixc Cs\t||j}|j|}||?}d|>d}||krX|jd}t||d}d}t|||S)aReturn prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in expanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & ones r$rr z&Netmask pattern %r mixes zeroes & ones)r]rbrr?) rip_intZtrailing_zeroesrZ leading_onesZall_onesZbyteslenZdetailsrrrr_prefix_from_ip_int8s      z"_IPAddressBase._prefix_from_ip_intcCsd|}t|dS)Nz%r is not a valid netmask)r;)rZ netmask_strrrrr_report_invalid_netmaskQsz&_IPAddressBase._report_invalid_netmaskc Csjtjj|s|j|y t|}Wntk r@|j|YnXd|koV|jknsf|j||S)a Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask r)_BaseV4_DECIMAL_DIGITS issupersetrintr?rb)rZ prefixlen_strrrrr_prefix_from_prefix_stringVs    z)_IPAddressBase._prefix_from_prefix_stringcCsy|j|}Wntk r,|j|YnXy |j|Stk rLYnX||jN}y |j|Stk r|j|YnXdS)aTurn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask/hostmask N)_ip_int_from_stringr9rrr?rc)rip_strrrrr_prefix_from_ip_stringos   z%_IPAddressBase._prefix_from_ip_stringcCs|jt|ffS)N) __class__rM)r*rrr __reduce__sz_IPAddressBase.__reduce__N)r5r6r7r:r8propertyrrrrarr classmethodrrrrrrrrrrr}s        "r}c@sdeZdZdZfZddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdS)r_zA generic IP object. This IP class contains the version independent methods which are used by single IP addresses. cCs|jS)N)rT)r*rrr__int__sz_BaseAddress.__int__c Cs2y|j|jko|j|jkStk r,tSXdS)N)rTrqrsr-)r*r+rrrr,s   z_BaseAddress.__eq__cCs`t|tstSt|ts(td||f|j|jkrDtd||f|j|jkr\|j|jkSdS)Nz"%s and %s are not of the same typez%%s and %s are not of the same versionF)rr}r-r_r`rqrT)r*r+rrrr0s       z_BaseAddress.__lt__cCs t|tstS|jt||S)N)rrr-rr)r*r+rrr__add__s z_BaseAddress.__add__cCs t|tstS|jt||S)N)rrr-rr)r*r+rrr__sub__s z_BaseAddress.__sub__cCsd|jjt|fS)Nz%s(%r))rr5rM)r*rrr__repr__sz_BaseAddress.__repr__cCst|j|jS)N)rM_string_from_ip_intrT)r*rrr__str__sz_BaseAddress.__str__cCsttt|jS)N)hashhexrrT)r*rrr__hash__sz_BaseAddress.__hash__cCs |j|fS)N)rq)r*rrrrzsz_BaseAddress._get_address_keycCs|j|jffS)N)rrT)r*rrrrsz_BaseAddress.__reduce__N)r5r6r7r:r8rr,r0rrrrrrzrrrrrr_sr_c@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZeddZeddZeddZeddZed d!Zed"d#Zed$d%Zed&d'Zd(d)Zd*d+Zd,d-ZdFd0d1ZdGd2d3Zed4d5Zd6d7Zd8d9Zed:d;Z edd?Z"ed@dAZ#edBdCZ$edDdEZ%d/S)Hrxz~A generic IP network object. This IP class contains the version independent methods which are used by networks. cCs i|_dS)N)_cache)r*r@rrr__init__sz_BaseNetwork.__init__cCsd|jjt|fS)Nz%s(%r))rr5rM)r*rrrrsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rtr)r*rrrrsz_BaseNetwork.__str__ccs<t|j}t|j}x"t|d|D]}|j|Vq$WdS)zGenerate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the network or broadcast addresses. r$N)rrtrmr(_address_class)r*network broadcastxrrrhostss  z_BaseNetwork.hostsccs<t|j}t|j}x"t||dD]}|j|Vq$WdS)Nr$)rrtrmr(r)r*rrrrrr__iter__s  z_BaseNetwork.__iter__cCslt|j}t|j}|dkr>|||kr0td|j||S|d7}|||krZtd|j||SdS)Nrzaddress out of ranger$)rrtrm IndexErrorr)r*nrrrrr __getitem__s    z_BaseNetwork.__getitem__cCsxt|tstSt|ts(td||f|j|jkrDtd||f|j|jkr\|j|jkS|j|jkrt|j|jkSdS)Nz"%s and %s are not of the same typez%%s and %s are not of the same versionF)rr}r-rxr`rqrtnetmask)r*r+rrrr0s         z_BaseNetwork.__lt__c CsFy,|j|jko,|j|jko,t|jt|jkStk r@tSXdS)N)rqrtrrrsr-)r*r+rrrr,s   z_BaseNetwork.__eq__cCstt|jt|jAS)N)rrrtr)r*rrrrsz_BaseNetwork.__hash__cCsL|j|jkrdSt|trdSt|jt|jkoBt|jkSSdS)NF)rqrrxrrtrTrm)r*r+rrr __contains__s   z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)z*Tell if self is partly contained in other.)rtrm)r*r+rrroverlaps)s   z_BaseNetwork.overlapscCs<|jjd}|dkr8|jt|jt|jB}||jd<|S)Nrm)rrirrrthostmask)r*rrrrrm0s    z_BaseNetwork.broadcast_addresscCs8|jjd}|dkr4|jt|j|jA}||jd<|S)Nr)rrirrrrc)r*rrrrr9s   z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rtrr)r*rrrwith_prefixlenAsz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rtr)r*rrr with_netmaskEsz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rtr)r*rrr with_hostmaskIsz_BaseNetwork.with_hostmaskcCst|jt|jdS)z&Number of hosts in the current subnet.r$)rrmrt)r*rrr num_addressesMsz_BaseNetwork.num_addressescCsdt|f}t|dS)Nz%%200s has no associated address class)rr)r*rrrrrRsz_BaseNetwork._address_classcCs|jS)N)rr)r*rrrrZsz_BaseNetwork.prefixlenccs|j|jkstd||ft|ts2td||j|sLtd||f||krXdS|jd|j|jf}|j \}}xb||kr||kr|j|r|V|j \}}q||j|r|V|j \}}q|t d|||fq|W||kr|Vn$||kr|Vnt d|||fdS)aRemove an address from a larger block. For example: addr1 = ip_network('192.0.2.0/28') addr2 = ip_network('192.0.2.1/32') list(addr1.address_exclude(addr2)) = [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'), IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')] or IPv6: addr1 = ip_network('2001:db8::1/32') addr2 = ip_network('2001:db8::1/128') list(addr1.address_exclude(addr2)) = [ip_network('2001:db8::1/128'), ip_network('2001:db8::2/127'), ip_network('2001:db8::4/126'), ip_network('2001:db8::8/125'), ... ip_network('2001:db8:8000::/33')] Args: other: An IPv4Network or IPv6Network object of the same type. Returns: An iterator of the IPv(4|6)Network objects which is self minus other. Raises: TypeError: If self and other are of differing address versions, or if other is not a network object. ValueError: If other is not completely contained by self. z%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sNz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s) rqr`rrx subnet_ofr?rrtrrnr)r*r+s1s2rrraddress_exclude^s6$           z_BaseNetwork.address_excludecCs`|j|jkrtd||f|j|jkr,dS|j|jkr other eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25') IPv6Network('2001:db8::2000/124') > IPv6Network('2001:db8::1000/124') Raises: TypeError if the IP versions are different. z"%s and %s are not of the same typer$rrprp)rqr`rtr)r*r+rrrcompare_networkss!      z_BaseNetwork.compare_networkscCs|j|j|jfS)zNetwork-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). )rqrtr)r*rrrrysz_BaseNetwork._get_networks_keyr$Nc cs|j|jkr|VdS|dk rJ||jkr0td|dkr@td||j}|dkrZtd|j|}||jkr~td||ft|j}t|jd}t|jd|?}x(t|||D]}|j||f}|VqWdS)aThe subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length should be increased by. This should not be set if new_prefix is also set. new_prefix: The desired new prefix length. This must be a larger number (smaller prefix) than the existing prefix. This should not be set if prefixlen_diff is also set. Returns: An iterator of IPv(4|6) objects. Raises: ValueError: The prefixlen_diff is too small or too large. OR prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) Nznew prefix must be longerr$z(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s) rrrbr?rrtrmrr(r) r*prefixlen_diff new_prefix new_prefixlenr%r&r'Znew_addrZcurrentrrrrns,       z_BaseNetwork.subnetscCs|jdkr|S|dk rB||jkr(td|dkr8td|j|}|j|}|dkrftd|j|f|jt|jt|j|>@|fS)aThe supernet containing the current network. Args: prefixlen_diff: An integer, the amount the prefix length of the network should be decreased by. For example, given a /24 network and a prefixlen_diff of 3, a supernet with a /21 netmask is returned. Returns: An IPv4 network object. Raises: ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a negative prefix length. OR If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) rNznew prefix must be shorterr$z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rrr?rrrrtr)r*rrrrrrrhs     z_BaseNetwork.supernetcCs|jjo|jjS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. )rt is_multicastrm)r*rrrrAs z_BaseNetwork.is_multicastcCsP|j|jkrdSt|dr 255) not permitted)r?rrrOr)rZ octet_strrZ octet_intrrrrs       z_BaseV4._parse_octetcCsdjddt|ddDS)zTurns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. rcss0|](}tt|tr"tjd|dn|VqdS)s!BrN)rMrr>rr )r r rrr -sz._BaseV4._string_from_ip_int..rr )joinr)rrrrrr"s z_BaseV4._string_from_ip_intc sh|jd}yfddtt|D}Wntk r:dSXt|t|krPdS|d|dkrddSdS) zTest if the IP string is a hostmask (rather than a netmask). Args: ip_str: A string, the potential hostmask. Returns: A boolean, True if the IP string is a hostmask. rcsg|]}|jkr|qSr)_valid_mask_octets)r r)r*rrr >sz(_BaseV4._is_hostmask..Frr$Trp)rNrrr?rO)r*rr\partsr)r*r _is_hostmask2s z_BaseV4._is_hostmaskcCs&t|jdddd}dj|dS)zReturn the reverse DNS pointer name for the IPv4 address. This implements the method described in RFC1035 3.5. rNr$z .in-addr.arparp)rMrNr)r*Zreverse_octetsrrrrGsz_BaseV4._reverse_pointercCs|jS)N)rb)r*rrr max_prefixlenPsz_BaseV4.max_prefixlencCs|jS)N)rq)r*rrrraTsz_BaseV4.versionN)r5r6r7r:r8rq IPV4LENGTHrc frozensetrrrbrr~rrrrrrrrrrarrrrrs"    %  rc@s|eZdZdZdZddZeddZedd Zed d Z ed d Z eddZ eddZ eddZ eddZdS)r<z/Represent and manipulate single IPv4 Addresses.rT __weakref__cCsxt|tr|j|||_dSt|trL|j|dt|}t|d|_dSt|}d|krht d||j ||_dS)a Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv4Address('192.0.2.1') == IPv4Address(3221225985). or, more generally IPv4Address(int(IPv4Address('192.0.2.1'))) == IPv4Address('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. Nrr rLzUnexpected '/' in %r) rrrrTr>rrrrMr9r)r*r@bvsaddr_strrrrr_s      zIPv4Address.__init__cCs t|jS)z*The binary representation of this address.)rJrT)r*rrrpackedszIPv4Address.packedcCs ||jjkS)zTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. ) _constants_reserved_network)r*rrrrs zIPv4Address.is_reservedcstfddjjDS)zTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv4-special-registry. c3s|]}|kVqdS)Nr)r rd)r*rrrsz)IPv4Address.is_private..)anyr_private_networks)r*r)r*rrs zIPv4Address.is_privatecCs||jjko|j S)N)r_public_networkr)r*rrrrs zIPv4Address.is_globalcCs ||jjkS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. )r_multicast_network)r*rrrrs zIPv4Address.is_multicastcCs ||jjkS)zTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. )r_unspecified_address)r*rrrrs zIPv4Address.is_unspecifiedcCs ||jjkS)zTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. )r_loopback_network)r*rrrrszIPv4Address.is_loopbackcCs ||jjkS)zTest if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. )r_linklocal_network)r*rrrrszIPv4Address.is_link_localN)rTr)r5r6r7r:r8rrrrrrrrrrrrrrr<Ys$   r<c@sjeZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZdS)rFcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht |d|_ n|j|_ t|dd|_|jj |_ |jj|_dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj|_dS)Nrr$F)rD)rr>rr<rrBrTrrbrrtuplerOrrrrQ)r*r@rPrrrrs(        zIPv4Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)rrTrr)r*rrrrs zIPv4Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r<r,r-rrs)r*r+ address_equalrrrr,s  zIPv4Interface.__eq__c Cs>tj||}|tkrtSy |j|jkStk r8dSXdS)NF)r<r0r-rrs)r*r+ address_lessrrrr0s  zIPv4Interface.__lt__cCs|j|jAt|jjAS)N)rTrrrrrt)r*rrrrszIPv4Interface.__hash__cCs t|jS)N)r<rT)r*rrrrY szIPv4Interface.ipcCsd|j|j|jfS)Nz%s/%s)rrTrr)r*rrrrs zIPv4Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)rrTr)r*rrrrs zIPv4Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)rrTr)r*rrrrs zIPv4Interface.with_hostmaskN)r5r6r7rrr,r0rr}rrrYrrrrrrrrFs     rFc@s*eZdZdZeZdddZeddZdS) rBaeThis class represents and manipulates 32-bit IPv4 network + addresses.. Attributes: [examples for IPv4Network('192.0.2.0/27')] .network_address: IPv4Address('192.0.2.0') .hostmask: IPv4Address('0.0.0.31') .broadcast_address: IPv4Address('192.0.2.32') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 TcCs|tj||t|ttfrr<rtrrbrrrrrOrr?rQrrr)r*r@rDrrrPrrrr0sB%           zIPv4Network.__init__cCs&|jtdko|jtdk o$|j S)zTest if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry. z 100.64.0.0/10)rtrBrmr)r*rrrrs zIPv4Network.is_globalN)T) r5r6r7r:r<rrrrrrrrrB!s  UrBc@seZdZedZedZedZedZededededededed ed ed ed ed edededgZedZ e dZ dS)_IPv4Constantsz169.254.0.0/16z 127.0.0.0/8z 224.0.0.0/4z 100.64.0.0/10z 0.0.0.0/8z 10.0.0.0/8z 172.16.0.0/12z 192.0.0.0/29z192.0.0.170/31z 192.0.2.0/24z192.168.0.0/16z 198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z 240.0.0.0/4z255.255.255.255/32z0.0.0.0N) r5r6r7rBrrrrrrr<rrrrrrs( rc@seZdZdZfZdZdedZdZe dZ eZ iZ e ddZe d d Ze d d Ze d dZe dddZddZddZeddZeddZdS)_BaseV6zyBase IPv6 object. The following methods are used by IPv6 objects in both single IP addresses and networks. r^rr$rZ0123456789ABCDEFabcdefcCsJ||jkr@t|tr|}n |j|}t|j|}||f|j|<|j|S)aMake a (netmask, prefix_len) tuple from the given argument. Argument can be: - an integer (the prefix length) - a string representing the prefix length (e.g. "24") - a string representing the prefix netmask (e.g. "255.255.255.0") )rrrrr=r)rrrrrrrrs   z_BaseV6._make_netmaskcCs|s td|jd}d}t||kr:d||f}t|d|dkryt|jj}Wn2tk r}ztd||fWYdd}~XnX|jd |d ?d @|jd |d @|jd}t||krd |d|f}t|d}x@tdt|dD]*} || s|dk r d |}t|| }qW|dk r|} t||d} |dsn| d8} | rnd}t|||ds| d8} | rd}t|||j| | } | dkr4d}t||jd|fnjt||jkrd}t||j|f|ds d}t|||ds$d}t||t|} d} d} ytd} x,t | D] } | d K} | |j || O} qDW| d | K} x0t | dD] } | d K} | |j || O} qW| St k r}ztd||fWYdd}~XnXdS)zTurn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: An int, the IPv6 address Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. zAddress cannot be empty:rz At least %d parts expected in %rrr$z%s in %rNz%xriz!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %rrprprp) r9rNrOr<rgrTrj _HEXTET_COUNTr(range _parse_hextetr?)rrrZ _min_partsrZipv4_intrZ _max_partsZ skip_indexr Zparts_hiZparts_loZ parts_skippedrrrrrs    "              z_BaseV6._ip_int_from_stringcCs>|jj|std|t|dkr4d}t||t|dS)a&Convert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from [0..FFFF]. zOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr) _HEX_DIGITSrr?rOr)rZ hextet_strrrrrrEs     z_BaseV6._parse_hextetc Csd}d}d}d}xJt|D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr||}|t|kr|dg7}dg|||<|dkrdg|}|S) aCompresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. r$rrrprprprp) enumeraterO) rhextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_lenindexZhextetZbest_doublecolon_endrrr_compress_hextets_s.   z_BaseV6._compress_hextetsNcsZ|dkrt|j}||jkr$tdd|fddtdddD}|j|}d j|S) a,Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. NzIPv6 address is too largez%032xcs&g|]}dt||ddqS)z%xrr)r)r r)hex_strrrr sz/_BaseV6._string_from_ip_int..rrrr)rrTrcr?rrr)rrrr)rrrs   z_BaseV6._string_from_ip_intcst|trt|j}nt|tr,t|j}nt|}|j|}d|fddtdddD}t|ttfrddj ||j fSdj |S) zExpand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. z%032xcsg|]}||dqS)rr)r r)rrrr sz8_BaseV6._explode_shorthand_ip_string..rrrz%s/%dr) rrCrMrtrGrYrrrxrrr)r*rrrr)rrr~s     z$_BaseV6._explode_shorthand_ip_stringcCs&|jdddjdd}dj|dS)zReturn the reverse DNS pointer name for the IPv6 address. This implements the method described in RFC3596 2.5. Nr$rrrz .ip6.arparp)rreplacer)r*Z reverse_charsrrrrsz_BaseV6._reverse_pointercCs|jS)N)rb)r*rrrrsz_BaseV6.max_prefixlencCs|jS)N)rq)r*rrrrasz_BaseV6.version)N)r5r6r7r:r8rq IPV6LENGTHrcrrrrbrrrrrrrr~rrrrarrrrrs$   i  0  rc@seZdZdZdZddZeddZedd Zed d Z ed d Z eddZ eddZ eddZ eddZeddZeddZeddZeddZdS) r=z/Represent and manipulate single IPv6 Addresses.rTrcCsxt|tr|j|||_dSt|trL|j|dt|}t|d|_dSt|}d|krht d||j ||_dS)aInstantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:db8::') == IPv6Address(42540766411282592856903984951653826560) or, more generally IPv6Address(int(IPv6Address('2001:db8::'))) == IPv6Address('2001:db8::') Raises: AddressValueError: If address isn't a valid IPv6 address. Nrr rLzUnexpected '/' in %r) rrrrTr>rrrrMr9r)r*r@rrrrrrs      zIPv6Address.__init__cCs t|jS)z*The binary representation of this address.)rKrT)r*rrrrszIPv6Address.packedcCs ||jjkS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. )rr)r*rrrrs zIPv6Address.is_multicastcstfddjjDS)zTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. c3s|]}|kVqdS)Nr)r r)r*rrrsz*IPv6Address.is_reserved..)rr_reserved_networks)r*r)r*rrs zIPv6Address.is_reservedcCs ||jjkS)zTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. )rr)r*rrrrszIPv6Address.is_link_localcCs ||jjkS)a`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. )r_sitelocal_network)r*rrr is_site_local#s zIPv6Address.is_site_localcstfddjjDS)zTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv6-special-registry. c3s|]}|kVqdS)Nr)r rd)r*rrr:sz)IPv6Address.is_private..)rrr)r*r)r*rr1s zIPv6Address.is_privatecCs|j S)zTest if this address is allocated for public networks. Returns: A boolean, true if the address is not reserved per iana-ipv6-special-registry. )r)r*rrrr<s zIPv6Address.is_globalcCs |jdkS)zTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. r)rT)r*rrrrGs zIPv6Address.is_unspecifiedcCs |jdkS)zTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. r$)rT)r*rrrrRs zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@S)zReturn the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. riNl)rTr<)r*rrr ipv4_mapped]s zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@t|jd@fS)zTuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) `i Nrl)rTr<)r*rrrteredojs zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@S)zReturn the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. pi NPl)rTr<)r*rrr sixtofourys zIPv6Address.sixtofourN)rTr)r5r6r7r:r8rrrrrrrrrrrrrrrrrrr=s%   r=c@seZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZe ddZe ddZdS)rGcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht |d|_ n|j|_ t|dd|_|jj |_ |jj|_dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj|_dS)Nrr$F)rD)rr>rr=rrCrTrrbrrrrOrrrrQ)r*r@rPrrrrs(        zIPv6Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)rrTrr)r*rrrrs zIPv6Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r=r,r-rrs)r*r+rrrrr,s  zIPv6Interface.__eq__c Cs>tj||}|tkrtSy |j|jkStk r8dSXdS)NF)r=r0r-rrs)r*r+rrrrr0s  zIPv6Interface.__lt__cCs|j|jAt|jjAS)N)rTrrrrrt)r*rrrrszIPv6Interface.__hash__cCs t|jS)N)r=rT)r*rrrrYszIPv6Interface.ipcCsd|j|j|jfS)Nz%s/%s)rrTrr)r*rrrrs zIPv6Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)rrTr)r*rrrrs zIPv6Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)rrTr)r*rrrrs zIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)rTrr)r*rrrrszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr$)rTrr)r*rrrrszIPv6Interface.is_loopbackN)r5r6r7rrr,r0rr}rrrYrrrrrrrrrrGs       rGc@s2eZdZdZeZd ddZddZeddZ d S) rCavThis class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:db8::1000/124')] .network_address: IPv6Address('2001:db8::1000') .hostmask: IPv6Address('::f') .broadcast_address: IPv6Address('2001:db8::100f') .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') .prefixlen: 124 TcCs|tj||t|ttfrrr=rtrrbrrrrrOrr?rQrrr)r*r@rDrrrPrrrrsB           zIPv6Network.__init__ccs@t|j}t|j}x&t|d|dD]}|j|Vq(WdS)zGenerate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the Subnet-Router anycast address. r$N)rrtrmr(r)r*rrrrrrr< s  zIPv6Network.hostscCs|jjo|jjS)a`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. )rtrrm)r*rrrrH s zIPv6Network.is_site_localN)T) r5r6r7r:r=rrrrrrrrrrCs   O rCc@seZdZedZedZededededededed ed ed edg Zed ed edededededededededededededgZedZdS)_IPv6Constantsz fe80::/10zff00::/8z::1/128z::/128z ::ffff:0:0/96z100::/64z 2001::/23z 2001:2::/48z 2001:db8::/32z 2001:10::/28zfc00::/7z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z fec0::/10N) r5r6r7rCrrrrrrrrrr X s*         r r)r$)T)8r:Z __future__rr"r __version__rrZlong NameErrorZunicoderMstrr>rr from_bytesrrsrrr!r(objectr)rrr?r9r;rArErHrJrKrQrZr]rerorwr|r}r_rxrr<rFrBrrrr=rGrCr rrrr s        )$ $#716=a*vRr 5V{!__pycache__/__init__.cpython-36.opt-1.pyc000064400000005240152347724720014116 0ustar003 Pf>@sdZddlmZddlZddlZddlZdZejj ejj e Z ddZ erejejje dejejdd<e de d e d e d e d e d e de de de de de de de de de de de de de de de de de de d e d!e d"e d#e d$e d%e d&e d'e d(e d)e d*e d+e d,e d-e d.e d/e d0e d1e d2dS)3z pip._vendor is for vendoring dependencies of pip to prevent needing pip to depend on something external. Files inside of pip._vendor should be considered immutable and should only be updated to versions from upstream. )absolute_importNFcCsdjt|}yt|ttddWnztk ryt|ttddWntk r`Yn:Xtj|tj|<|jdd\}}t tj||tj|YnXdS)Nz{0}.{1}r)level.) format__name__ __import__globalslocals ImportErrorsysmodulesrsplitsetattr)Z modulenameZ vendored_namebaseheadr/usr/lib/python3.6/__init__.pyvendoreds  rz*.whlZ cachecontrolZcoloramaZdistlibZdistroZhtml5libZlockfileZsixz six.moveszsix.moves.urllibZ packagingzpackaging.versionzpackaging.specifiersZ pkg_resourcesZprogressZretryingZrequestszrequests.packageszrequests.packages.urllib3z&requests.packages.urllib3._collectionsz$requests.packages.urllib3.connectionz(requests.packages.urllib3.connectionpoolz!requests.packages.urllib3.contribz*requests.packages.urllib3.contrib.ntlmpoolz+requests.packages.urllib3.contrib.pyopensslz$requests.packages.urllib3.exceptionsz requests.packages.urllib3.fieldsz"requests.packages.urllib3.filepostz"requests.packages.urllib3.packagesz/requests.packages.urllib3.packages.ordered_dictz&requests.packages.urllib3.packages.sixz5requests.packages.urllib3.packages.ssl_match_hostnamezErequests.packages.urllib3.packages.ssl_match_hostname._implementationz%requests.packages.urllib3.poolmanagerz!requests.packages.urllib3.requestz"requests.packages.urllib3.responsezrequests.packages.urllib3.utilz)requests.packages.urllib3.util.connectionz&requests.packages.urllib3.util.requestz'requests.packages.urllib3.util.responsez$requests.packages.urllib3.util.retryz#requests.packages.urllib3.util.ssl_z&requests.packages.urllib3.util.timeoutz"requests.packages.urllib3.util.url)__doc__Z __future__rZglobZos.pathosr Z DEBUNDLEDpathabspathdirname__file__Z WHEEL_DIRrjoinrrrrsh $__pycache__/re-vendor.cpython-36.pyc000064400000002010152347724720013311 0ustar003 Pf@sddlZddlZddlZddlZddlZejjejjeZ ddZ ddZ ddZ e dkreejd krpe ejd dkre nejd dkre ne dS) NcCstdtjddS)Nz"Usage: re-vendor.py [clean|vendor])printsysexitrr/usr/lib/python3.6/re-vendor.pyusage srcCsPx6tjtD](}tjjt|}tjj|r tj|q WtjtjjtddS)Nzsix.py) oslistdirherepathjoinisdirshutilrmtreeunlink)fndirnamerrrclean s  rcCs6tjddtddgxtjdD]}tj|q WdS)NZinstallz-tz-rz vendor.txtz *.egg-info)pipmainr globrr)rrrrvendorsr__main__r)r rrrrr abspathr__file__r rrr__name__lenargvrrrrs __pycache__/pyparsing.cpython-36.opt-1.pyc000064400000610513152347724720014400 0ustar003 Pfk@s dZdZdZdZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZyddlmZWn ek rddlmZYnXydd l mZWn>ek rydd lmZWnek rdZYnXYnXd d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrgiZee jddsZeddskZer"e jZe Z!e"Z#e Z$e%e&e'e(e)ee*e+e,e-e.g Z/nbe j0Ze1Z2dtduZ$gZ/ddl3Z3xBdvj4D]6Z5ye/j6e7e3e5Wne8k r|wJYnXqJWe9dwdxe2dyDZ:dzd{Z;Gd|d}d}e<Z=ej>ej?Z@d~ZAeAdZBe@eAZCe"dZDdjEddxejFDZGGdd!d!eHZIGdd#d#eIZJGdd%d%eIZKGdd'd'eKZLGdd*d*eHZMGddde<ZNGdd&d&e<ZOe jPjQeOdd=ZRddNZSddKZTddZUddZVddZWddUZXd/ddZYGdd(d(e<ZZGdd0d0eZZ[Gddde[Z\Gddde[Z]Gddde[Z^e^Z_e^eZ_`Gddde[ZaGdd d e^ZbGdd d eaZcGddpdpe[ZdGdd3d3e[ZeGdd+d+e[ZfGdd)d)e[ZgGdd d e[ZhGdd2d2e[ZiGddde[ZjGdddejZkGdddejZlGdddejZmGdd.d.ejZnGdd-d-ejZoGdd5d5ejZpGdd4d4ejZqGdd$d$eZZrGdd d erZsGdd d erZtGddderZuGddderZvGdd"d"eZZwGdddewZxGdddewZyGdddewZzGdddezZ{Gdd6d6ezZ|Gddde<Z}e}Z~GdddewZGdd,d,ewZGdddewZGdddeZGdd1d1ewZGdddeZGdddeZGdddeZGdd/d/eZGddde<ZddfZd0ddDZd1dd@Zdd΄ZddSZddRZdd҄Zd2ddWZddEZd3ddkZddlZddnZe\jdGZeljdMZemjdLZenjdeZeojddZeeeDdddڍjdd܄Zefd݃jdd܄Zefd߃jdd܄ZeeBeBeeeGddydBefde jBZeeedeZe^dedjdee{eeBjddZddcZddQZdd`Zdd^ZddqZedd܄Zedd܄ZddZddOZddPZddiZe<e_d4ddoZe=Ze<e_e<e_ededfddmZeZeefddjdZeefddjdZeefddefddBjdZee_dejjdZdddejfddTZd5ddjZedZedZeeee@eCdjd\ZZeed j4d Zefd d jEejÃd jdZĐdd_ZeefddjdZefdjdZefdjȃjdZefdjdZeefddeBjdZeZefdjdZee{eeeGdɐdeeede^dɃemj΃jdZeeejeBddjd>ZGd drdrZeҐd!k rebd"Zebd#Zeee@eCd$ZeeՐd%dӐd&jeZeeeփjd'Zאd(eBZeeՐd%dӐd&jeZeeeكjd)ZeӐd*eؐd'eeڐd)Zejܐd+ejjܐd,ejjܐd,ejjܐd-ddlZejjeejejjܐd.dS(6aS pyparsing module - Classes and methods to define and execute parsing grammars The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions. With pyparsing, you don't need to learn a new syntax for defining grammars or matching expressions - the parsing module provides a library of classes that you use to construct the grammar directly in Python. Here is a program to parse "Hello, World!" (or any greeting of the form C{", !"}), built up using L{Word}, L{Literal}, and L{And} elements (L{'+'} operator gives L{And} expressions, strings are auto-converted to L{Literal} expressions):: from pyparsing import Word, alphas # define grammar of a greeting greet = Word(alphas) + "," + Word(alphas) + "!" hello = "Hello, World!" print (hello, "->", greet.parseString(hello)) The program outputs the following:: Hello, World! -> ['Hello', ',', 'World', '!'] The Python representation of the grammar is quite readable, owing to the self-explanatory class names, and the use of '+', '|' and '^' operators. The L{ParseResults} object returned from L{ParserElement.parseString} can be accessed as a nested list, a dictionary, or an object with named attributes. The pyparsing module handles some of the problems that are typically vexing when writing text parsers: - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello , World !", etc.) - quoted strings - embedded comments z2.1.10z07 Oct 2016 01:31 UTCz*Paul McGuire N)ref)datetime)RLock) OrderedDictAndCaselessKeywordCaselessLiteral CharsNotInCombineDictEachEmpty FollowedByForward GoToColumnGroupKeywordLineEnd LineStartLiteral MatchFirstNoMatchNotAny OneOrMoreOnlyOnceOptionalOrParseBaseExceptionParseElementEnhanceParseExceptionParseExpressionParseFatalException ParseResultsParseSyntaxException ParserElement QuotedStringRecursiveGrammarExceptionRegexSkipTo StringEnd StringStartSuppressTokenTokenConverterWhiteWordWordEnd WordStart ZeroOrMore alphanumsalphas alphas8bit anyCloseTag anyOpenTag cStyleCommentcolcommaSeparatedListcommonHTMLEntity countedArraycppStyleCommentdblQuotedStringdblSlashComment delimitedListdictOfdowncaseTokensemptyhexnums htmlCommentjavaStyleCommentlinelineEnd lineStartlineno makeHTMLTags makeXMLTagsmatchOnlyAtColmatchPreviousExprmatchPreviousLiteral nestedExprnullDebugActionnumsoneOfopAssocoperatorPrecedence printablespunc8bitpythonStyleComment quotedString removeQuotesreplaceHTMLEntity replaceWith restOfLinesglQuotedStringsrange stringEnd stringStarttraceParseAction unicodeString upcaseTokens withAttribute indentedBlockoriginalTextForungroup infixNotation locatedExpr withClass CloseMatchtokenMappyparsing_commonc Cs`t|tr|Syt|Stk rZt|jtjd}td}|jdd|j |SXdS)aDrop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. xmlcharrefreplacez&#\d+;cSs$dtt|dddddS)Nz\ur)hexint)trw/usr/lib/python3.6/pyparsing.pysz_ustr..N) isinstanceZunicodestrUnicodeEncodeErrorencodesysgetdefaultencodingr'setParseActiontransformString)objretZ xmlcharrefrwrwrx_ustrs rz6sum len sorted reversed list tuple set any all min maxccs|] }|VqdS)Nrw).0yrwrwrx srrrcCs>d}dddjD}x"t||D]\}}|j||}q"W|S)z/Escape &, <, >, ", ', etc. in a string of data.z&><"'css|]}d|dVqdS)&;Nrw)rsrwrwrxrsz_xml_escape..zamp gt lt quot apos)splitzipreplace)dataZ from_symbolsZ to_symbolsZfrom_Zto_rwrwrx _xml_escapes rc@s eZdZdS) _ConstantsN)__name__ __module__ __qualname__rwrwrwrxrsr 0123456789Z ABCDEFabcdef\ccs|]}|tjkr|VqdS)N)stringZ whitespace)rcrwrwrxrsc@sPeZdZdZdddZeddZdd Zd d Zd d Z dddZ ddZ dS)rz7base exception class for all parsing runtime exceptionsrNcCs>||_|dkr||_d|_n ||_||_||_|||f|_dS)Nr)locmsgpstr parserElementargs)selfrrrelemrwrwrx__init__szParseBaseException.__init__cCs||j|j|j|jS)z internal factory method to simplify creating one type of ParseException from another - avoids having __init__ signature conflicts among subclasses )rrrr)clsperwrwrx_from_exceptionsz"ParseBaseException._from_exceptioncCsN|dkrt|j|jS|dkr,t|j|jS|dkrBt|j|jSt|dS)zsupported attributes by name are: - lineno - returns the line number of the exception text - col - returns the column number of the exception text - line - returns the line containing the exception text rJr9columnrGN)r9r)rJrrr9rGAttributeError)rZanamerwrwrx __getattr__szParseBaseException.__getattr__cCsd|j|j|j|jfS)Nz"%s (at char %d), (line:%d, col:%d))rrrJr)rrwrwrx__str__szParseBaseException.__str__cCst|S)N)r)rrwrwrx__repr__szParseBaseException.__repr__>!} ('-' operator) indicates that parsing is to stop immediately because an unbacktrackable syntax error has been foundN)rrrrrwrwrwrxr#sc@s eZdZdZddZddZdS)r&zZexception thrown by L{ParserElement.validate} if the grammar could be improperly recursivecCs ||_dS)N)parseElementTrace)rparseElementListrwrwrxrsz"RecursiveGrammarException.__init__cCs d|jS)NzRecursiveGrammarException: %s)r)rrwrwrxr sz!RecursiveGrammarException.__str__N)rrrrrrrwrwrwrxr&sc@s,eZdZddZddZddZddZd S) _ParseResultsWithOffsetcCs||f|_dS)N)tup)rZp1Zp2rwrwrxr$sz _ParseResultsWithOffset.__init__cCs |j|S)N)r)rirwrwrx __getitem__&sz#_ParseResultsWithOffset.__getitem__cCst|jdS)Nr)reprr)rrwrwrxr(sz _ParseResultsWithOffset.__repr__cCs|jd|f|_dS)Nr)r)rrrwrwrx setOffset*sz!_ParseResultsWithOffset.setOffsetN)rrrrrrrrwrwrwrxr#src@seZdZdZd[ddZddddefddZdd Zefd d Zd d Z ddZ ddZ ddZ e Z ddZddZddZddZddZereZeZeZn$eZeZeZddZd d!Zd"d#Zd$d%Zd&d'Zd\d(d)Zd*d+Zd,d-Zd.d/Zd0d1Z d2d3Z!d4d5Z"d6d7Z#d8d9Z$d:d;Z%d} - see L{ParserElement.setResultsName}) Example:: integer = Word(nums) date_str = (integer.setResultsName("year") + '/' + integer.setResultsName("month") + '/' + integer.setResultsName("day")) # equivalent form: # date_str = integer("year") + '/' + integer("month") + '/' + integer("day") # parseString returns a ParseResults object result = date_str.parseString("1999/12/31") def test(s, fn=repr): print("%s -> %s" % (s, fn(eval(s)))) test("list(result)") test("result[0]") test("result['month']") test("result.day") test("'month' in result") test("'minutes' in result") test("result.dump()", str) prints:: list(result) -> ['1999', '/', '12', '/', '31'] result[0] -> '1999' result['month'] -> '12' result.day -> '31' 'month' in result -> True 'minutes' in result -> False result.dump() -> ['1999', '/', '12', '/', '31'] - day: 31 - month: 12 - year: 1999 NTcCs"t||r|Stj|}d|_|S)NT)rzobject__new___ParseResults__doinit)rtoklistnameasListmodalZretobjrwrwrxrTs   zParseResults.__new__c Cs`|jrvd|_d|_d|_i|_||_||_|dkr6g}||trP|dd|_n||trft||_n|g|_t |_ |dk o|r\|sd|j|<||t rt |}||_||t dttfo|ddgfks\||tr|g}|r&||trt|jd||<ntt|dd||<|||_n6y|d||<Wn$tttfk rZ|||<YnXdS)NFrr)r_ParseResults__name_ParseResults__parent_ParseResults__accumNames_ParseResults__asList_ParseResults__modallist_ParseResults__toklist_generatorTypedict_ParseResults__tokdictrurr basestringr"rcopyKeyError TypeError IndexError)rrrrrrzrwrwrxr]sB     $   zParseResults.__init__cCsPt|ttfr|j|S||jkr4|j|ddStdd|j|DSdS)NrrrcSsg|] }|dqS)rrw)rvrwrwrx sz,ParseResults.__getitem__..rs)rzruslicerrrr")rrrwrwrxrs   zParseResults.__getitem__cCs||tr0|jj|t|g|j|<|d}nD||ttfrN||j|<|}n&|jj|tt|dg|j|<|}||trt||_ dS)Nr) rrgetrrurrr"wkrefr)rkrrzsubrwrwrx __setitem__s   " zParseResults.__setitem__c Cst|ttfrt|j}|j|=t|trH|dkr:||7}t||d}tt|j|}|jx^|j j D]F\}}x<|D]4}x.t |D]"\}\}} t || | |k||<qWq|WqnWn|j |=dS)Nrrr) rzrurlenrrrangeindicesreverseritems enumerater) rrZmylenZremovedr occurrencesjrvaluepositionrwrwrx __delitem__s   $zParseResults.__delitem__cCs ||jkS)N)r)rrrwrwrx __contains__szParseResults.__contains__cCs t|jS)N)rr)rrwrwrx__len__szParseResults.__len__cCs |j S)N)r)rrwrwrx__bool__szParseResults.__bool__cCs t|jS)N)iterr)rrwrwrx__iter__szParseResults.__iter__cCst|jdddS)Nrrrs)rr)rrwrwrx __reversed__szParseResults.__reversed__cCs$t|jdr|jjSt|jSdS)Niterkeys)hasattrrrr)rrwrwrx _iterkeyss  zParseResults._iterkeyscsfddjDS)Nc3s|]}|VqdS)Nrw)rr)rrwrxrsz+ParseResults._itervalues..)r)rrw)rrx _itervaluesszParseResults._itervaluescsfddjDS)Nc3s|]}||fVqdS)Nrw)rr)rrwrxrsz*ParseResults._iteritems..)r)rrw)rrx _iteritemsszParseResults._iteritemscCs t|jS)zVReturns all named result keys (as a list in Python 2.x, as an iterator in Python 3.x).)rr)rrwrwrxkeysszParseResults.keyscCs t|jS)zXReturns all named result values (as a list in Python 2.x, as an iterator in Python 3.x).)r itervalues)rrwrwrxvaluesszParseResults.valuescCs t|jS)zfReturns all named result key-values (as a list of tuples in Python 2.x, as an iterator in Python 3.x).)r iteritems)rrwrwrxrszParseResults.itemscCs t|jS)zSince keys() returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.)boolr)rrwrwrxhaskeysszParseResults.haskeyscOs|s dg}x6|jD]*\}}|dkr2|d|f}qtd|qWt|dtsht|dksh|d|kr|d}||}||=|S|d}|SdS)a Removes and returns item at specified index (default=C{last}). Supports both C{list} and C{dict} semantics for C{pop()}. If passed no argument or an integer argument, it will use C{list} semantics and pop tokens from the list of parsed tokens. If passed a non-integer argument (most likely a string), it will use C{dict} semantics and pop the corresponding value from any defined results names. A second default return value argument is supported, just as in C{dict.pop()}. Example:: def remove_first(tokens): tokens.pop(0) print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321'] print(OneOrMore(Word(nums)).addParseAction(remove_first).parseString("0 123 321")) # -> ['123', '321'] label = Word(alphas) patt = label("LABEL") + OneOrMore(Word(nums)) print(patt.parseString("AAB 123 321").dump()) # Use pop() in a parse action to remove named result (note that corresponding value is not # removed from list form of results) def remove_LABEL(tokens): tokens.pop("LABEL") return tokens patt.addParseAction(remove_LABEL) print(patt.parseString("AAB 123 321").dump()) prints:: ['AAB', '123', '321'] - LABEL: AAB ['AAB', '123', '321'] rrdefaultrz-pop() got an unexpected keyword argument '%s'Nrs)rrrzrur)rrkwargsrrindexrZ defaultvaluerwrwrxpops"  zParseResults.popcCs||kr||S|SdS)ai Returns named result matching the given key, or if there is no such name, then returns the given C{defaultValue} or C{None} if no C{defaultValue} is specified. Similar to C{dict.get()}. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString("1999/12/31") print(result.get("year")) # -> '1999' print(result.get("hour", "not specified")) # -> 'not specified' print(result.get("hour")) # -> None Nrw)rkey defaultValuerwrwrxrszParseResults.getcCsZ|jj||xF|jjD]8\}}x.t|D]"\}\}}t||||k||<q,WqWdS)a Inserts new element at location index in the list of parsed tokens. Similar to C{list.insert()}. Example:: print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321'] # use a parse action to insert the parse location in the front of the parsed results def insert_locn(locn, tokens): tokens.insert(0, locn) print(OneOrMore(Word(nums)).addParseAction(insert_locn).parseString("0 123 321")) # -> [0, '0', '123', '321'] N)rinsertrrrr)rrZinsStrrrrrrrwrwrxr2szParseResults.insertcCs|jj|dS)a Add single element to end of ParseResults list of elements. Example:: print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321'] # use a parse action to compute the sum of the parsed integers, and add it to the end def append_sum(tokens): tokens.append(sum(map(int, tokens))) print(OneOrMore(Word(nums)).addParseAction(append_sum).parseString("0 123 321")) # -> ['0', '123', '321', 444] N)rappend)ritemrwrwrxrFs zParseResults.appendcCs$t|tr||7}n |jj|dS)a Add sequence of elements to end of ParseResults list of elements. Example:: patt = OneOrMore(Word(alphas)) # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): tokens.extend(reversed([t[::-1] for t in tokens])) return ''.join(tokens) print(patt.addParseAction(make_palindrome).parseString("lskdj sdlkjf lksd")) # -> 'lskdjsdlkjflksddsklfjkldsjdksl' N)rzr"rextend)rZitemseqrwrwrxrTs  zParseResults.extendcCs|jdd=|jjdS)z7 Clear all elements and results names. N)rrclear)rrwrwrxrfs zParseResults.clearc Csfy||Stk rdSX||jkr^||jkrD|j|ddStdd|j|DSndSdS)NrrrrcSsg|] }|dqS)rrw)rrrwrwrxrwsz,ParseResults.__getattr__..rs)rrrr")rrrwrwrxrms  zParseResults.__getattr__cCs|j}||7}|S)N)r)rotherrrwrwrx__add__{szParseResults.__add__cs|jrnt|jfdd|jj}fdd|D}x4|D],\}}|||<t|dtr>t||d_q>W|j|j7_|jj |j|S)Ncs|dkr S|S)Nrrw)a)offsetrwrxrysz'ParseResults.__iadd__..c s4g|],\}}|D]}|t|d|dfqqS)rrr)r)rrvlistr) addoffsetrwrxrsz)ParseResults.__iadd__..r) rrrrrzr"rrrupdate)rrZ otheritemsZotherdictitemsrrrw)rrrx__iadd__s    zParseResults.__iadd__cCs&t|tr|dkr|jS||SdS)Nr)rzrur)rrrwrwrx__radd__szParseResults.__radd__cCsdt|jt|jfS)Nz(%s, %s))rrr)rrwrwrxrszParseResults.__repr__cCsddjdd|jDdS)N[z, css(|] }t|trt|nt|VqdS)N)rzr"rr)rrrwrwrxrsz'ParseResults.__str__..])rr)rrwrwrxrszParseResults.__str__rcCsPg}xF|jD]<}|r"|r"|j|t|tr:||j7}q |jt|q W|S)N)rrrzr" _asStringListr)rsepoutrrwrwrxr s   zParseResults._asStringListcCsdd|jDS)a Returns the parse results as a nested list of matching tokens, all converted to strings. Example:: patt = OneOrMore(Word(alphas)) result = patt.parseString("sldkj lsdkj sldkj") # even though the result prints in string-like form, it is actually a pyparsing ParseResults print(type(result), result) # -> ['sldkj', 'lsdkj', 'sldkj'] # Use asList() to create an actual list result_list = result.asList() print(type(result_list), result_list) # -> ['sldkj', 'lsdkj', 'sldkj'] cSs"g|]}t|tr|jn|qSrw)rzr"r)rresrwrwrxrsz'ParseResults.asList..)r)rrwrwrxrszParseResults.asListcs6tr |j}n|j}fddtfdd|DS)a Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString('12/31/1999') print(type(result), repr(result)) # -> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]}) result_dict = result.asDict() print(type(result_dict), repr(result_dict)) # -> {'day': '1999', 'year': '12', 'month': '31'} # even though a ParseResults supports dict-like access, sometime you just need to have a dict import json print(json.dumps(result)) # -> Exception: TypeError: ... is not JSON serializable print(json.dumps(result.asDict())) # -> {"month": "31", "day": "1999", "year": "12"} cs6t|tr.|jr|jSfdd|DSn|SdS)Ncsg|] }|qSrwrw)rr)toItemrwrxrsz7ParseResults.asDict..toItem..)rzr"rasDict)r)rrwrxrs  z#ParseResults.asDict..toItemc3s|]\}}||fVqdS)Nrw)rrr)rrwrxrsz&ParseResults.asDict..)PY_3rrr)rZitem_fnrw)rrxrs  zParseResults.asDictcCs8t|j}|jj|_|j|_|jj|j|j|_|S)zA Returns a new copy of a C{ParseResults} object. )r"rrrrrrr)rrrwrwrxrs   zParseResults.copyFc CsPd}g}tdd|jjD}|d}|s8d}d}d}d} |dk rJ|} n |jrV|j} | sf|rbdSd} |||d| d g7}xt|jD]\} } t| tr| |kr|| j|| |o|dk||g7}n|| jd|o|dk||g7}qd} | |kr|| } | s |rqnd} t t | } |||d| d | d | d g 7}qW|||d | d g7}dj |S) z (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.  css(|] \}}|D]}|d|fVqqdS)rrNrw)rrrrrwrwrxrsz%ParseResults.asXML..z rNZITEM<>z.z %s%s- %s: z rrcss|]}t|tVqdS)N)rzr")rvvrwrwrxrssz %s%s[%d]: %s%s%sr) rrrrsortedrrzr"dumpranyrr) rrdepthfullr NLrrrrrrwrwrxrPs,   4.zParseResults.dumpcOstj|jf||dS)a Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint}) Example:: ident = Word(alphas, alphanums) num = Word(nums) func = Forward() term = ident | num | Group('(' + func + ')') func <<= ident + Group(Optional(delimitedList(term))) result = func.parseString("fna a,b,(fnb c,d,200),100") result.pprint(width=40) prints:: ['fna', ['a', 'b', ['(', 'fnb', ['c', 'd', '200'], ')'], '100']] N)pprintr)rrrrwrwrxr"}szParseResults.pprintcCs.|j|jj|jdk r|jp d|j|jffS)N)rrrrrr)rrwrwrx __getstate__s zParseResults.__getstate__cCsN|d|_|d\|_}}|_i|_|jj||dk rDt||_nd|_dS)Nrrr)rrrrrrr)rstaterZ inAccumNamesrwrwrx __setstate__s   zParseResults.__setstate__cCs|j|j|j|jfS)N)rrrr)rrwrwrx__getnewargs__szParseResults.__getnewargs__cCstt|t|jS)N)rrrr)rrwrwrxrszParseResults.__dir__)NNTT)N)r)NFrT)rrT)4rrrrrrzrrrrrrr __nonzero__rrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrr"r#r%r&rrwrwrwrxr"-sh& ' 4  # =% - cCsF|}d|kot|knr4||ddkr4dS||jdd|S)aReturns current column within a string, counting newlines as line separators. The first column is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}} for more information on parsing strings containing C{}s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. rrrr)rrfind)rstrgrrwrwrxr9s cCs|jdd|dS)aReturns current line number within a string, counting newlines as line separators. The first line is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}} for more information on parsing strings containing C{}s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. rrrr)count)rr)rwrwrxrJs cCsF|jdd|}|jd|}|dkr2||d|S||ddSdS)zfReturns the line of text containing loc within a string, counting newlines as line separators. rrrrN)r(find)rr)ZlastCRZnextCRrwrwrxrGs  cCs8tdt|dt|dt||t||fdS)NzMatch z at loc z(%d,%d))printrrJr9)instringrexprrwrwrx_defaultStartDebugActionsr/cCs$tdt|dt|jdS)NzMatched z -> )r,rr{r)r-startlocZendlocr.toksrwrwrx_defaultSuccessDebugActionsr2cCstdt|dS)NzException raised:)r,r)r-rr.excrwrwrx_defaultExceptionDebugActionsr4cGsdS)zG'Do-nothing' debug action, to suppress debugging output during parsing.Nrw)rrwrwrxrQsrqc stkrfddSdgdgtdddkrFddd }dd d n tj}tjd }|dd d}|d|d|ffdd}d}ytdtdj}Wntk rt}YnX||_|S)Ncs|S)Nrw)rlrv)funcrwrxrysz_trim_arity..rFrqrocSs8tdkr dnd }tj| |dd|}|j|jfgS) Nror7rrqrr)limit)ror7r)system_version traceback extract_stackfilenamerJ)r8r frame_summaryrwrwrxr=sz"_trim_arity..extract_stackcSs$tj||d}|d}|j|jfgS)N)r8rrrs)r< extract_tbr>rJ)tbr8Zframesr?rwrwrxr@sz_trim_arity..extract_tb)r8rrcsxy |dd}dd<|Stk rdr>n4z.tjd}|dddddksjWd~Xdkrdd7<wYqXqWdS)NrTrrrq)r8rsrs)rr~exc_info)rrrA)r@ foundArityr6r8maxargspa_call_line_synthrwrxwrappers"  z_trim_arity..wrapperzr __class__)ror7)r)rrs) singleArgBuiltinsr;r<r=r@getattrr Exceptionr{)r6rEr=Z LINE_DIFFZ this_linerG func_namerw)r@rDr6r8rErFrx _trim_aritys*   rMcseZdZdZdZdZeddZeddZddd Z d d Z d d Z dddZ dddZ ddZddZddZddZddZddZddd Zd!d"Zdd#d$Zd%d&Zd'd(ZGd)d*d*eZed+k rGd,d-d-eZnGd.d-d-eZiZeZd/d/gZ dd0d1Z!eZ"ed2d3Z#dZ$edd5d6Z%dd7d8Z&e'dfd9d:Z(d;d<Z)e'fd=d>Z*e'dfd?d@Z+dAdBZ,dCdDZ-dEdFZ.dGdHZ/dIdJZ0dKdLZ1dMdNZ2dOdPZ3dQdRZ4dSdTZ5dUdVZ6dWdXZ7dYdZZ8dd[d\Z9d]d^Z:d_d`Z;dadbZdgdhZ?ddidjZ@dkdlZAdmdnZBdodpZCdqdrZDgfdsdtZEddudvZFfdwdxZGdydzZHd{d|ZId}d~ZJddZKdddZLdddZMZNS)r$z)Abstract base level parser element class.z FcCs |t_dS)a Overrides the default whitespace chars Example:: # default whitespace chars are space, and newline OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl'] # change to just treat newline as significant ParserElement.setDefaultWhitespaceChars(" \t") OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def'] N)r$DEFAULT_WHITE_CHARS)charsrwrwrxsetDefaultWhitespaceChars=s z'ParserElement.setDefaultWhitespaceCharscCs |t_dS)a Set class to be used for inclusion of string literals into a parser. Example:: # default literal class used is Literal integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parseString("1999/12/31") # -> ['1999', '/', '12', '/', '31'] # change to Suppress ParserElement.inlineLiteralsUsing(Suppress) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parseString("1999/12/31") # -> ['1999', '12', '31'] N)r$_literalStringClass)rrwrwrxinlineLiteralsUsingLsz!ParserElement.inlineLiteralsUsingcCst|_d|_d|_d|_||_d|_tj|_ d|_ d|_ d|_ t|_ d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)NTFr)NNN)r parseAction failActionstrRepr resultsName saveAsListskipWhitespacer$rN whiteCharscopyDefaultWhiteCharsmayReturnEmptykeepTabs ignoreExprsdebug streamlined mayIndexErrorerrmsg modalResults debugActionsre callPreparse callDuringTry)rsavelistrwrwrxras(zParserElement.__init__cCs<tj|}|jdd|_|jdd|_|jr8tj|_|S)a$ Make a copy of this C{ParserElement}. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element. Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) integerK = integer.copy().addParseAction(lambda toks: toks[0]*1024) + Suppress("K") integerM = integer.copy().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M") print(OneOrMore(integerK | integerM | integer).parseString("5K 100 640K 256M")) prints:: [5120, 100, 655360, 268435456] Equivalent form of C{expr.copy()} is just C{expr()}:: integerM = integer().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M") N)rrSr]rZr$rNrY)rZcpyrwrwrxrxs  zParserElement.copycCs*||_d|j|_t|dr&|j|j_|S)af Define name for this expression, makes debugging and exception messages clearer. Example:: Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1) Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char 0), (line:1, col:1) z Expected exception)rrarrhr)rrrwrwrxsetNames    zParserElement.setNamecCs4|j}|jdr"|dd}d}||_| |_|S)aP Define name for referencing matching tokens as a nested attribute of the returned parse results. NOTE: this returns a *copy* of the original C{ParserElement} object; this is so that the client can define a basic element, such as an integer, and reference it in multiple places with different names. You can also set results names using the abbreviated syntax, C{expr("name")} in place of C{expr.setResultsName("name")} - see L{I{__call__}<__call__>}. Example:: date_str = (integer.setResultsName("year") + '/' + integer.setResultsName("month") + '/' + integer.setResultsName("day")) # equivalent form: date_str = integer("year") + '/' + integer("month") + '/' + integer("day") *NrrTrs)rendswithrVrb)rrlistAllMatchesZnewselfrwrwrxsetResultsNames  zParserElement.setResultsNameTcs@|r&|jdfdd }|_||_nt|jdr<|jj|_|S)zMethod to invoke the Python pdb debugger when this element is about to be parsed. Set C{breakFlag} to True to enable, False to disable. Tcsddl}|j||||S)Nr)pdbZ set_trace)r-r doActions callPreParsern) _parseMethodrwrxbreakersz'ParserElement.setBreak..breaker_originalParseMethod)TT)_parsersr)rZ breakFlagrrrw)rqrxsetBreaks  zParserElement.setBreakcOs&tttt||_|jdd|_|S)a  Define action to perform when successfully matching parse element definition. Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)}, C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where: - s = the original string being parsed (see note below) - loc = the location of the matching substring - toks = a list of the matched tokens, packaged as a C{L{ParseResults}} object If the functions in fns modify the tokens, they can return them as the return value from fn, and the modified list of tokens will replace the original. Otherwise, fn does not need to return any value. Optional keyword arguments: - callDuringTry = (default=C{False}) indicate if parse action should be run during lookaheads and alternate testing Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{parseString}} for more information on parsing strings containing C{}s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. Example:: integer = Word(nums) date_str = integer + '/' + integer + '/' + integer date_str.parseString("1999/12/31") # -> ['1999', '/', '12', '/', '31'] # use parse action to convert to ints at parse time integer = Word(nums).setParseAction(lambda toks: int(toks[0])) date_str = integer + '/' + integer + '/' + integer # note that integer fields are now ints, not strings date_str.parseString("1999/12/31") # -> [1999, '/', 12, '/', 31] rfF)rmaprMrSrrf)rfnsrrwrwrxrs"zParserElement.setParseActioncOs4|jtttt|7_|jp,|jdd|_|S)z Add parse action to expression's list of parse actions. See L{I{setParseAction}}. See examples in L{I{copy}}. rfF)rSrrvrMrfr)rrwrrwrwrxaddParseActionszParserElement.addParseActioncsb|jdd|jddrtntx(|D] fdd}|jj|q&W|jpZ|jdd|_|S)aAdd a boolean predicate function to expression's list of parse actions. See L{I{setParseAction}} for function call signatures. Unlike C{setParseAction}, functions passed to C{addCondition} need to return boolean success/fail of the condition. Optional keyword arguments: - message = define a custom message to be used in the raised exception - fatal = if True, will raise ParseFatalException to stop parsing immediately; otherwise will raise ParseException Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) year_int = integer.copy() year_int.addCondition(lambda toks: toks[0] >= 2000, message="Only support years 2000 and later") date_str = year_int + '/' + integer + '/' + integer result = date_str.parseString("1999/12/31") # -> Exception: Only support years 2000 and later (at char 0), (line:1, col:1) messagezfailed user-defined conditionfatalFcs$tt|||s ||dS)N)rrM)rr5rv)exc_typefnrrwrxpasz&ParserElement.addCondition..parf)rr!rrSrrf)rrwrr}rw)r{r|rrx addConditions  zParserElement.addConditioncCs ||_|S)a Define action to perform if parsing fails at this expression. Fail acton fn is a callable function that takes the arguments C{fn(s,loc,expr,err)} where: - s = string being parsed - loc = location where expression match was attempted and failed - expr = the parse expression that failed - err = the exception thrown The function returns no value. It may throw C{L{ParseFatalException}} if it is desired to stop parsing immediately.)rT)rr|rwrwrx setFailActions zParserElement.setFailActionc CsZd}xP|rTd}xB|jD]8}yx|j||\}}d}qWWqtk rLYqXqWqW|S)NTF)r]rtr)rr-rZ exprsFoundeZdummyrwrwrx_skipIgnorables#s  zParserElement._skipIgnorablescCsL|jr|j||}|jrH|j}t|}x ||krF|||krF|d7}q(W|S)Nrr)r]rrXrYr)rr-rZwtinstrlenrwrwrxpreParse0s  zParserElement.preParsecCs|gfS)Nrw)rr-rrorwrwrx parseImpl<szParserElement.parseImplcCs|S)Nrw)rr-r tokenlistrwrwrx postParse?szParserElement.postParsec "Cs|j}|s|jr|jdr,|jd||||rD|jrD|j||}n|}|}yDy|j|||\}}Wn(tk rt|t||j |YnXWnXt k r} z<|jdr|jd|||| |jr|j|||| WYdd} ~ XnXn|o|jr|j||}n|}|}|j s$|t|krhy|j|||\}}Wn*tk rdt|t||j |YnXn|j|||\}}|j |||}t ||j|j|jd} |jr|s|jr|rVyRxL|jD]B} | ||| }|dk rt ||j|jot|t tf|jd} qWWnFt k rR} z(|jdr@|jd|||| WYdd} ~ XnXnNxL|jD]B} | ||| }|dk r^t ||j|jot|t tf|jd} q^W|r|jdr|jd||||| || fS)Nrrq)rrrr)r^rTrcrerrrrrrarr`rr"rVrWrbrSrfrzr) rr-rrorpZ debuggingprelocZ tokensStarttokenserrZ retTokensr|rwrwrx _parseNoCacheCsp             zParserElement._parseNoCachec Cs>y|j||dddStk r8t|||j|YnXdS)NF)ror)rtr!rra)rr-rrwrwrxtryParseszParserElement.tryParsec Cs2y|j||Wnttfk r(dSXdSdS)NFT)rrr)rr-rrwrwrx canParseNexts zParserElement.canParseNextc@seZdZddZdS)zParserElement._UnboundedCachecsdit|_fdd}fdd}fdd}tj|||_tj|||_tj|||_dS)Ncs j|S)N)r)rr)cache not_in_cacherwrxrsz3ParserElement._UnboundedCache.__init__..getcs ||<dS)Nrw)rrr)rrwrxsetsz3ParserElement._UnboundedCache.__init__..setcs jdS)N)r)r)rrwrxrsz5ParserElement._UnboundedCache.__init__..clear)rrtypes MethodTyperrr)rrrrrw)rrrxrs   z&ParserElement._UnboundedCache.__init__N)rrrrrwrwrwrx_UnboundedCachesrNc@seZdZddZdS)zParserElement._FifoCachecsht|_tfdd}fdd}fdd}tj|||_tj|||_tj|||_dS)Ncs j|S)N)r)rr)rrrwrxrsz.ParserElement._FifoCache.__init__..getcs"||<tkrjddS)NF)rpopitem)rrr)rsizerwrxrs z.ParserElement._FifoCache.__init__..setcs jdS)N)r)r)rrwrxrsz0ParserElement._FifoCache.__init__..clear)rr _OrderedDictrrrrr)rrrrrrw)rrrrxrs  z!ParserElement._FifoCache.__init__N)rrrrrwrwrwrx _FifoCachesrc@seZdZddZdS)zParserElement._FifoCachecsvt|_itjgfdd}fdd}fdd}tj|||_tj|||_tj|||_dS)Ncs j|S)N)r)rr)rrrwrxrsz.ParserElement._FifoCache.__init__..getcs2||<tkr$jjdj|dS)N)rrpopleftr)rrr)rkey_fiforrwrxrs z.ParserElement._FifoCache.__init__..setcsjjdS)N)r)r)rrrwrxrsz0ParserElement._FifoCache.__init__..clear) rr collectionsdequerrrrr)rrrrrrw)rrrrrxrs  z!ParserElement._FifoCache.__init__N)rrrrrwrwrwrxrsrc Csd\}}|||||f}tjtj}|j|} | |jkrtj|d7<y|j||||} Wn8tk r} z|j|| j | j WYdd} ~ XqX|j|| d| dj f| Sn4tj|d7<t | t r| | d| dj fSWdQRXdS)Nrrr)rrr)r$packrat_cache_lock packrat_cacherrpackrat_cache_statsrrrrHrrrzrK) rr-rrorpZHITZMISSlookuprrrrwrwrx _parseCaches$   zParserElement._parseCachecCs(tjjdgttjtjdd<dS)Nr)r$rrrrrwrwrwrx resetCaches zParserElement.resetCachecCs8tjs4dt_|dkr tjt_n tj|t_tjt_dS)aEnables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing parsing/validating code. Memoizing is done of both valid results and parsing exceptions. Parameters: - cache_size_limit - (default=C{128}) - if an integer value is provided will limit the size of the packrat cache; if None is passed, then the cache size will be unbounded; if 0 is passed, the cache will be effectively disabled. This speedup may break existing programs that use parse actions that have side-effects. For this reason, packrat parsing is disabled when you first import pyparsing. To activate the packrat feature, your program must call the class method C{ParserElement.enablePackrat()}. If your program uses C{psyco} to "compile as you go", you must call C{enablePackrat} before calling C{psyco.full()}. If you do not do this, Python will crash. For best results, call C{enablePackrat()} immediately after importing pyparsing. Example:: import pyparsing pyparsing.ParserElement.enablePackrat() TN)r$_packratEnabledrrrrrt)Zcache_size_limitrwrwrx enablePackrats   zParserElement.enablePackratcCstj|js|jx|jD] }|jqW|js<|j}y<|j|d\}}|rv|j||}t t }|j||Wn0t k r}ztj rn|WYdd}~XnX|SdS)aB Execute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built. If you want the grammar to require that the entire input string be successfully parsed, then set C{parseAll} to True (equivalent to ending the grammar with C{L{StringEnd()}}). Note: C{parseString} implicitly calls C{expandtabs()} on the input string, in order to report proper column numbers in parse actions. If the input string contains tabs and the grammar uses parse actions that use the C{loc} argument to index into the string being parsed, you can ensure you have a consistent view of the input string by: - calling C{parseWithTabs} on your grammar before calling C{parseString} (see L{I{parseWithTabs}}) - define your parse action using the full C{(s,loc,toks)} signature, and reference the input string using the parse action's C{s} argument - explictly expand the tabs in your input string before calling C{parseString} Example:: Word('a').parseString('aaaaabaaa') # -> ['aaaaa'] Word('a').parseString('aaaaabaaa', parseAll=True) # -> Exception: Expected end of text rN) r$rr_ streamliner]r\ expandtabsrtrr r)rverbose_stacktrace)rr-parseAllrrrZser3rwrwrx parseString#s$    zParserElement.parseStringccs@|js|jx|jD] }|jqW|js8t|j}t|}d}|j}|j}t j d} yx||kon| |kry |||} ||| dd\} } Wnt k r| d}Yq`X| |kr| d7} | | | fV|r|||} | |kr| }q|d7}n| }q`| d}q`WWn4t k r:}zt j r&n|WYdd}~XnXdS)a Scan the input string for expression matches. Each match will return the matching tokens, start location, and end location. May be called with optional C{maxMatches} argument, to clip scanning after 'n' matches are found. If C{overlap} is specified, then overlapping matches will be reported. Note that the start and end locations are reported relative to the string being parsed. See L{I{parseString}} for more information on parsing strings with embedded tabs. Example:: source = "sldjf123lsdjjkf345sldkjf879lkjsfd987" print(source) for tokens,start,end in Word(alphas).scanString(source): print(' '*start + '^'*(end-start)) print(' '*start + tokens[0]) prints:: sldjf123lsdjjkf345sldkjf879lkjsfd987 ^^^^^ sldjf ^^^^^^^ lsdjjkf ^^^^^^ sldkjf ^^^^^^ lkjsfd rF)rprrN)r_rr]r\rrrrrtr$rrrr)rr- maxMatchesZoverlaprrrZ preparseFnZparseFnmatchesrZnextLocrZnextlocr3rwrwrx scanStringUsB       zParserElement.scanStringcCsg}d}d|_yxh|j|D]Z\}}}|j||||rrt|trT||j7}nt|trh||7}n |j||}qW|j||ddd|D}djtt t |St k r}zt j rȂn|WYdd}~XnXdS)af Extension to C{L{scanString}}, to modify matching text with modified tokens that may be returned from a parse action. To use C{transformString}, define a grammar and attach a parse action to it that modifies the returned token list. Invoking C{transformString()} on a target string will then scan for matches, and replace the matched text patterns according to the logic in the parse action. C{transformString()} returns the resulting transformed string. Example:: wd = Word(alphas) wd.setParseAction(lambda toks: toks[0].title()) print(wd.transformString("now is the winter of our discontent made glorious summer by this sun of york.")) Prints:: Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York. rTNcSsg|] }|r|qSrwrw)rorwrwrxrsz1ParserElement.transformString..r)r\rrrzr"rrrrvr_flattenrr$r)rr-r ZlastErvrrr3rwrwrxrs(    zParserElement.transformStringcCsPytdd|j||DStk rJ}ztjr6n|WYdd}~XnXdS)a~ Another extension to C{L{scanString}}, simplifying the access to the tokens found to match the given parse expression. May be called with optional C{maxMatches} argument, to clip searching after 'n' matches are found. Example:: # a capitalized word starts with an uppercase letter, followed by zero or more lowercase letters cap_word = Word(alphas.upper(), alphas.lower()) print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")) prints:: ['More', 'Iron', 'Lead', 'Gold', 'I'] cSsg|]\}}}|qSrwrw)rrvrrrwrwrxrsz.ParserElement.searchString..N)r"rrr$r)rr-rr3rwrwrx searchStrings zParserElement.searchStringc csXd}d}x<|j||dD]*\}}}|||V|r>|dV|}qW||dVdS)a[ Generator method to split a string using the given expression as a separator. May be called with optional C{maxsplit} argument, to limit the number of splits; and the optional C{includeSeparators} argument (default=C{False}), if the separating matching text should be included in the split results. Example:: punc = oneOf(list(".,;:/-!?")) print(list(punc.split("This, this?, this sentence, is badly punctuated!"))) prints:: ['This', ' this', '', ' this sentence', ' is badly punctuated', ''] r)rN)r) rr-maxsplitZincludeSeparatorsZsplitsZlastrvrrrwrwrxrs  zParserElement.splitcCsFt|trtj|}t|ts:tjdt|tdddSt||gS)a Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement converts them to L{Literal}s by default. Example:: greet = Word(alphas) + "," + Word(alphas) + "!" hello = "Hello, World!" print (hello, "->", greet.parseString(hello)) Prints:: Hello, World! -> ['Hello', ',', 'World', '!'] z4Cannot combine element of type %s with ParserElementrq) stacklevelN) rzrr$rQwarningswarnr SyntaxWarningr)rrrwrwrxrs    zParserElement.__add__cCsBt|trtj|}t|ts:tjdt|tdddS||S)z] Implementation of + operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrxrs    zParserElement.__radd__cCsLt|trtj|}t|ts:tjdt|tdddSt|tj |gS)zQ Implementation of - operator, returns C{L{And}} with error stop z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr _ErrorStop)rrrwrwrx__sub__s    zParserElement.__sub__cCsBt|trtj|}t|ts:tjdt|tdddS||S)z] Implementation of - operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__rsub__ s    zParserElement.__rsub__cst|tr|d}}nt|tr|d dd}|ddkrHd|df}t|dtr|ddkr|ddkrvtS|ddkrtS|dtSnJt|dtrt|dtr|\}}||8}ntdt|dt|dntdt||dkr td|dkrtd||ko2dknrBtd |rfd d |r|dkrt|}ntg||}n|}n|dkr}ntg|}|S) a Implementation of * operator, allows use of C{expr * 3} in place of C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples may also include C{None} as in: - C{expr*(n,None)} or C{expr*(n,)} is equivalent to C{expr*n + L{ZeroOrMore}(expr)} (read as "at least n instances of C{expr}") - C{expr*(None,n)} is equivalent to C{expr*(0,n)} (read as "0 to n instances of C{expr}") - C{expr*(None,None)} is equivalent to C{L{ZeroOrMore}(expr)} - C{expr*(1,None)} is equivalent to C{L{OneOrMore}(expr)} Note that C{expr*(None,n)} does not raise an exception if more than n exprs exist in the input stream; that is, C{expr*(None,n)} does not enforce a maximum number of expr occurrences. If this behavior is desired, then write C{expr*(None,n) + ~expr} rNrqrrz7cannot multiply 'ParserElement' and ('%s','%s') objectsz0cannot multiply 'ParserElement' and '%s' objectsz/cannot multiply ParserElement by negative valuez@second tuple value must be greater or equal to first tuple valuez+cannot multiply ParserElement by 0 or (0,0)cs(|dkrt|dStSdS)Nrr)r)n)makeOptionalListrrwrxr]sz/ParserElement.__mul__..makeOptionalList)NN) rzrutupler2rrr ValueErrorr)rrZ minElementsZ optElementsrrw)rrrx__mul__,sD             zParserElement.__mul__cCs |j|S)N)r)rrrwrwrx__rmul__pszParserElement.__rmul__cCsFt|trtj|}t|ts:tjdt|tdddSt||gS)zI Implementation of | operator - returns C{L{MatchFirst}} z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr)rrrwrwrx__or__ss    zParserElement.__or__cCsBt|trtj|}t|ts:tjdt|tdddS||BS)z] Implementation of | operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__ror__s    zParserElement.__ror__cCsFt|trtj|}t|ts:tjdt|tdddSt||gS)zA Implementation of ^ operator - returns C{L{Or}} z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr)rrrwrwrx__xor__s    zParserElement.__xor__cCsBt|trtj|}t|ts:tjdt|tdddS||AS)z] Implementation of ^ operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__rxor__s    zParserElement.__rxor__cCsFt|trtj|}t|ts:tjdt|tdddSt||gS)zC Implementation of & operator - returns C{L{Each}} z4Cannot combine element of type %s with ParserElementrq)rN) rzrr$rQrrrrr )rrrwrwrx__and__s    zParserElement.__and__cCsBt|trtj|}t|ts:tjdt|tdddS||@S)z] Implementation of & operator when left operand is not a C{L{ParserElement}} z4Cannot combine element of type %s with ParserElementrq)rN)rzrr$rQrrrr)rrrwrwrx__rand__s    zParserElement.__rand__cCst|S)zE Implementation of ~ operator - returns C{L{NotAny}} )r)rrwrwrx __invert__szParserElement.__invert__cCs|dk r|j|S|jSdS)a  Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}. If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be passed as C{True}. If C{name} is omitted, same as calling C{L{copy}}. Example:: # these are equivalent userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno") userdata = Word(alphas)("name") + Word(nums+"-")("socsecno") N)rmr)rrrwrwrx__call__s zParserElement.__call__cCst|S)z Suppresses the output of this C{ParserElement}; useful to keep punctuation from cluttering up returned output. )r+)rrwrwrxsuppressszParserElement.suppresscCs d|_|S)a Disables the skipping of whitespace before matching the characters in the C{ParserElement}'s defined pattern. This is normally only used internally by the pyparsing module, but may be needed in some whitespace-sensitive grammars. F)rX)rrwrwrxleaveWhitespaceszParserElement.leaveWhitespacecCsd|_||_d|_|S)z8 Overrides the default whitespace chars TF)rXrYrZ)rrOrwrwrxsetWhitespaceCharssz ParserElement.setWhitespaceCharscCs d|_|S)z Overrides default behavior to expand C{}s to spaces before parsing the input string. Must be called before C{parseString} when the input grammar contains elements that match C{} characters. T)r\)rrwrwrx parseWithTabsszParserElement.parseWithTabscCsLt|trt|}t|tr4||jkrH|jj|n|jjt|j|S)a Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:: patt = OneOrMore(Word(alphas)) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj'] patt.ignore(cStyleComment) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj', 'lskjd'] )rzrr+r]rr)rrrwrwrxignores   zParserElement.ignorecCs"|pt|p t|ptf|_d|_|S)zT Enable display of debugging messages while doing pattern matching. T)r/r2r4rcr^)rZ startActionZ successActionZexceptionActionrwrwrxsetDebugActions s  zParserElement.setDebugActionscCs|r|jtttnd|_|S)a Enable display of debugging messages while doing pattern matching. Set C{flag} to True to enable, False to disable. Example:: wd = Word(alphas).setName("alphaword") integer = Word(nums).setName("numword") term = wd | integer # turn on debugging for wd wd.setDebug() OneOrMore(term).parseString("abc 123 xyz 890") prints:: Match alphaword at loc 0(1,1) Matched alphaword -> ['abc'] Match alphaword at loc 3(1,4) Exception raised:Expected alphaword (at char 4), (line:1, col:5) Match alphaword at loc 7(1,8) Matched alphaword -> ['xyz'] Match alphaword at loc 11(1,12) Exception raised:Expected alphaword (at char 12), (line:1, col:13) Match alphaword at loc 15(1,16) Exception raised:Expected alphaword (at char 15), (line:1, col:16) The output shown is that produced by the default debug actions - custom debug actions can be specified using L{setDebugActions}. Prior to attempting to match the C{wd} expression, the debugging message C{"Match at loc (,)"} is shown. Then if the parse succeeds, a C{"Matched"} message is shown, or an C{"Exception raised"} message is shown. Also note the use of L{setName} to assign a human-readable name to the expression, which makes debugging and exception messages easier to understand - for instance, the default name created for the C{Word} expression without calling C{setName} is C{"W:(ABCD...)"}. F)rr/r2r4r^)rflagrwrwrxsetDebugs#zParserElement.setDebugcCs|jS)N)r)rrwrwrxr@szParserElement.__str__cCst|S)N)r)rrwrwrxrCszParserElement.__repr__cCsd|_d|_|S)NT)r_rU)rrwrwrxrFszParserElement.streamlinecCsdS)Nrw)rrrwrwrxcheckRecursionKszParserElement.checkRecursioncCs|jgdS)zj Check defined expressions for valid structure, check for infinite recursive definitions. N)r)r validateTracerwrwrxvalidateNszParserElement.validatecCsy |j}Wn2tk r>t|d}|j}WdQRXYnXy |j||Stk r|}ztjrhn|WYdd}~XnXdS)z Execute the parse expression on the given file or filename. If a filename is specified (instead of a file object), the entire file is opened, read, and closed before parsing. rN)readropenrrr$r)rZfile_or_filenamerZ file_contentsfr3rwrwrx parseFileTs   zParserElement.parseFilecsHt|tr"||kp t|t|kSt|tr6|j|Stt||kSdS)N)rzr$varsrrsuper)rr)rHrwrx__eq__hs    zParserElement.__eq__cCs ||k S)Nrw)rrrwrwrx__ne__pszParserElement.__ne__cCs tt|S)N)hashid)rrwrwrx__hash__sszParserElement.__hash__cCs||kS)Nrw)rrrwrwrx__req__vszParserElement.__req__cCs ||k S)Nrw)rrrwrwrx__rne__yszParserElement.__rne__c Cs0y|jt||ddStk r*dSXdS)a Method for quick testing of a parser against a test string. Good for simple inline microtests of sub expressions while building up larger parser. Parameters: - testString - to test against this expression for a match - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests Example:: expr = Word(nums) assert expr.matches("100") )rTFN)rrr)rZ testStringrrwrwrxr|s zParserElement.matches#cCst|tr"tttj|jj}t|tr4t|}g}g}d} x|D]} |dk rb|j | dsl|rx| rx|j | qH| s~qHdj || g} g}y:| j dd} |j | |d} | j | j|d| o| } Wntk rx} zt| trdnd }d| kr0| j t| j| | j d t| j| d d |n| j d | jd || j d t| | ob|} | } WYdd} ~ XnDtk r}z&| j dt|| o|} |} WYdd}~XnX|r|r| j d tdj | |j | | fqHW| |fS)a3 Execute the parse expression on a series of test strings, showing each test, the parsed results or where the parse failed. Quick and easy way to run a parse expression against a list of sample strings. Parameters: - tests - a list of separate test strings, or a multiline string of test strings - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests - comment - (default=C{'#'}) - expression for indicating embedded comments in the test string; pass None to disable comment filtering - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline; if False, only dump nested list - printResults - (default=C{True}) prints test output to stdout - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing Returns: a (success, results) tuple, where success indicates that all tests succeeded (or failed if C{failureTests} is True), and the results contain a list of lines of each test's output Example:: number_expr = pyparsing_common.number.copy() result = number_expr.runTests(''' # unsigned integer 100 # negative integer -100 # float with scientific notation 6.02e23 # integer with scientific notation 1e-12 ''') print("Success" if result[0] else "Failed!") result = number_expr.runTests(''' # stray character 100Z # missing leading digit before '.' -.100 # too many '.' 3.14.159 ''', failureTests=True) print("Success" if result[0] else "Failed!") prints:: # unsigned integer 100 [100] # negative integer -100 [-100] # float with scientific notation 6.02e23 [6.02e+23] # integer with scientific notation 1e-12 [1e-12] Success # stray character 100Z ^ FAIL: Expected end of text (at char 3), (line:1, col:4) # missing leading digit before '.' -.100 ^ FAIL: Expected {real number with scientific notation | real number | signed integer} (at char 0), (line:1, col:1) # too many '.' 3.14.159 ^ FAIL: Expected end of text (at char 4), (line:1, col:5) Success Each test string must be on a single line. If you want to test a string that spans multiple lines, create a test like this:: expr.runTest(r"this is a test\n of strings that spans \n 3 lines") (Note that this is a raw string literal, you must include the leading 'r'.) TNFrz\n)r)r z(FATAL)r rr^zFAIL: zFAIL-EXCEPTION: )rzrrrvr{rrstrip splitlinesrrrrrrrrr!rGrr9rKr,)rZtestsrZcommentZfullDumpZ printResultsZ failureTestsZ allResultsZcommentssuccessrvr resultrrzr3rwrwrxrunTestssNW     $   zParserElement.runTests)F)F)T)T)TT)TT)r)F)N)T)F)T)TrTTF)OrrrrrNr staticmethodrPrRrrrirmrurrxr~rrrrrrrrrrrrrrrrrrtrrrr_MAX_INTrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr __classcell__rwrw)rHrxr$8s     &     H   " 2G+    D           )    cs eZdZdZfddZZS)r,zT Abstract C{ParserElement} subclass, for defining atomic matching patterns. cstt|jdddS)NF)rg)rr,r)r)rHrwrxr szToken.__init__)rrrrrrrwrw)rHrxr, scs eZdZdZfddZZS)r z, An empty token, will always match. cs$tt|jd|_d|_d|_dS)Nr TF)rr rrr[r`)r)rHrwrxr szEmpty.__init__)rrrrrrrwrw)rHrxr  scs*eZdZdZfddZdddZZS)rz( A token that will never match. cs*tt|jd|_d|_d|_d|_dS)NrTFzUnmatchable token)rrrrr[r`ra)r)rHrwrxr* s zNoMatch.__init__TcCst|||j|dS)N)rra)rr-rrorwrwrxr1 szNoMatch.parseImpl)T)rrrrrrrrwrw)rHrxr& s cs*eZdZdZfddZdddZZS)ra Token to exactly match a specified string. Example:: Literal('blah').parseString('blah') # -> ['blah'] Literal('blah').parseString('blahfooblah') # -> ['blah'] Literal('blah').parseString('bla') # -> Exception: Expected "blah" For case-insensitive matching, use L{CaselessLiteral}. For keyword matching (force word break before and after the matched string), use L{Keyword} or L{CaselessKeyword}. c stt|j||_t||_y|d|_Wn*tk rVtj dt ddt |_ YnXdt |j|_d|j|_d|_d|_dS)Nrz2null string passed to Literal; use Empty() insteadrq)rz"%s"z Expected F)rrrmatchrmatchLenfirstMatchCharrrrrr rHrrrar[r`)r matchString)rHrwrxrC s    zLiteral.__init__TcCsJ|||jkr6|jdks&|j|j|r6||j|jfSt|||j|dS)Nrr)rr startswithrrra)rr-rrorwrwrxrV szLiteral.parseImpl)T)rrrrrrrrwrw)rHrxr5 s  csLeZdZdZedZdfdd Zddd Zfd d Ze d d Z Z S)ra\ Token to exactly match a specified string as a keyword, that is, it must be immediately followed by a non-keyword character. Compare with C{L{Literal}}: - C{Literal("if")} will match the leading C{'if'} in C{'ifAndOnlyIf'}. - C{Keyword("if")} will not; it will only match the leading C{'if'} in C{'if x=1'}, or C{'if(y==2)'} Accepts two optional constructor arguments in addition to the keyword string: - C{identChars} is a string of characters that would be valid identifier characters, defaulting to all alphanumerics + "_" and "$" - C{caseless} allows case-insensitive matching, default is C{False}. Example:: Keyword("start").parseString("start") # -> ['start'] Keyword("start").parseString("starting") # -> Exception For case-insensitive matching, use L{CaselessKeyword}. z_$NFc stt|j|dkrtj}||_t||_y|d|_Wn$tk r^t j dt ddYnXd|j|_ d|j |_ d|_d|_||_|r|j|_|j}t||_dS)Nrz2null string passed to Keyword; use Empty() insteadrq)rz"%s"z Expected F)rrrDEFAULT_KEYWORD_CHARSrrrrrrrrrrar[r`caselessupper caselessmatchr identChars)rrrr)rHrwrxrq s&    zKeyword.__init__TcCs|jr|||||jj|jkr|t||jksL|||jj|jkr|dksj||dj|jkr||j|jfSnv|||jkr|jdks|j|j|r|t||jks|||j|jkr|dks||d|jkr||j|jfSt |||j |dS)Nrrr) rrrrrrrrrrra)rr-rrorwrwrxr s*&zKeyword.parseImplcstt|j}tj|_|S)N)rrrrr)rr)rHrwrxr sz Keyword.copycCs |t_dS)z,Overrides the default Keyword chars N)rr)rOrwrwrxsetDefaultKeywordChars szKeyword.setDefaultKeywordChars)NF)T) rrrrr3rrrrrrrrwrw)rHrxr^ s   cs*eZdZdZfddZdddZZS)ral Token to match a specified string, ignoring case of letters. Note: the matched results will always be in the case of the given match string, NOT the case of the input text. Example:: OneOrMore(CaselessLiteral("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD', 'CMD'] (Contrast with example for L{CaselessKeyword}.) cs6tt|j|j||_d|j|_d|j|_dS)Nz'%s'z Expected )rrrr returnStringrra)rr)rHrwrxr s zCaselessLiteral.__init__TcCs@||||jj|jkr,||j|jfSt|||j|dS)N)rrrrrra)rr-rrorwrwrxr szCaselessLiteral.parseImpl)T)rrrrrrrrwrw)rHrxr s  cs,eZdZdZdfdd Zd ddZZS) rz Caseless version of L{Keyword}. Example:: OneOrMore(CaselessKeyword("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD'] (Contrast with example for L{CaselessLiteral}.) Ncstt|j||dddS)NT)r)rrr)rrr)rHrwrxr szCaselessKeyword.__init__TcCsj||||jj|jkrV|t||jksF|||jj|jkrV||j|jfSt|||j|dS)N)rrrrrrrra)rr-rrorwrwrxr s*zCaselessKeyword.parseImpl)N)T)rrrrrrrrwrw)rHrxr scs,eZdZdZdfdd Zd ddZZS) rlax A variation on L{Literal} which matches "close" matches, that is, strings with at most 'n' mismatching characters. C{CloseMatch} takes parameters: - C{match_string} - string to be matched - C{maxMismatches} - (C{default=1}) maximum number of mismatches allowed to count as a match The results from a successful parse will contain the matched text from the input string and the following named results: - C{mismatches} - a list of the positions within the match_string where mismatches were found - C{original} - the original match_string used to compare against the input string If C{mismatches} is an empty list, then the match was an exact match. Example:: patt = CloseMatch("ATCATCGAATGGA") patt.parseString("ATCATCGAAXGGA") # -> (['ATCATCGAAXGGA'], {'mismatches': [[9]], 'original': ['ATCATCGAATGGA']}) patt.parseString("ATCAXCGAAXGGA") # -> Exception: Expected 'ATCATCGAATGGA' (with up to 1 mismatches) (at char 0), (line:1, col:1) # exact match patt.parseString("ATCATCGAATGGA") # -> (['ATCATCGAATGGA'], {'mismatches': [[]], 'original': ['ATCATCGAATGGA']}) # close match allowing up to 2 mismatches patt = CloseMatch("ATCATCGAATGGA", maxMismatches=2) patt.parseString("ATCAXCGAAXGGA") # -> (['ATCAXCGAAXGGA'], {'mismatches': [[4, 9]], 'original': ['ATCATCGAATGGA']}) rrcsBtt|j||_||_||_d|j|jf|_d|_d|_dS)Nz&Expected %r (with up to %d mismatches)F) rrlrr match_string maxMismatchesrar`r[)rrr)rHrwrxr szCloseMatch.__init__TcCs|}t|}|t|j}||kr|j}d}g} |j} xtt||||jD]0\}} | \} } | | krP| j|t| | krPPqPW|d}t|||g}|j|d<| |d<||fSt|||j|dS)Nrrroriginal mismatches) rrrrrrr"rra)rr-rrostartrmaxlocrZmatch_stringlocrrZs_msrcmatresultsrwrwrxr s("   zCloseMatch.parseImpl)rr)T)rrrrrrrrwrw)rHrxrl s cs8eZdZdZd fdd Zdd d Zfd d ZZS)r/a Token for matching words composed of allowed character sets. Defined with string containing all allowed initial characters, an optional string containing allowed body characters (if omitted, defaults to the initial character set), and an optional minimum, maximum, and/or exact length. The default value for C{min} is 1 (a minimum value < 1 is not valid); the default values for C{max} and C{exact} are 0, meaning no maximum or exact length restriction. An optional C{excludeChars} parameter can list characters that might be found in the input C{bodyChars} string; useful to define a word of all printables except for one or two characters, for instance. L{srange} is useful for defining custom character set strings for defining C{Word} expressions, using range notation from regular expression character sets. A common mistake is to use C{Word} to match a specific literal string, as in C{Word("Address")}. Remember that C{Word} uses the string argument to define I{sets} of matchable characters. This expression would match "Add", "AAA", "dAred", or any other word made up of the characters 'A', 'd', 'r', 'e', and 's'. To match an exact literal string, use L{Literal} or L{Keyword}. pyparsing includes helper strings for building Words: - L{alphas} - L{nums} - L{alphanums} - L{hexnums} - L{alphas8bit} (alphabetic characters in ASCII range 128-255 - accented, tilded, umlauted, etc.) - L{punc8bit} (non-alphabetic characters in ASCII range 128-255 - currency, symbols, superscripts, diacriticals, etc.) - L{printables} (any non-whitespace character) Example:: # a word composed of digits integer = Word(nums) # equivalent to Word("0123456789") or Word(srange("0-9")) # a word with a leading capital, and zero or more lowercase capital_word = Word(alphas.upper(), alphas.lower()) # hostnames are alphanumeric, with leading alpha, and '-' hostname = Word(alphas, alphanums+'-') # roman numeral (not a strict parser, accepts invalid mix of characters) roman = Word("IVXLCDM") # any string of non-whitespace characters, except for ',' csv_value = Word(printables, excludeChars=",") NrrrFc stt|jrFdjfdd|D}|rFdjfdd|D}||_t||_|rl||_t||_n||_t||_|dk|_ |dkrt d||_ |dkr||_ nt |_ |dkr||_ ||_ t||_d|j|_d |_||_d |j|jkr|dkr|dkr|dkr|j|jkr8d t|j|_nHt|jdkrfd tj|jt|jf|_nd t|jt|jf|_|jrd|jd|_ytj|j|_Wntk rd|_YnXdS)Nrc3s|]}|kr|VqdS)Nrw)rr) excludeCharsrwrxr7 sz Word.__init__..c3s|]}|kr|VqdS)Nrw)rr)rrwrxr9 srrrzZcannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permittedz Expected Frz[%s]+z%s[%s]*z [%s][%s]*z\b)rr/rr initCharsOrigr initChars bodyCharsOrig bodyChars maxSpecifiedrminLenmaxLenrrrrar` asKeyword_escapeRegexRangeCharsreStringrrdescapecompilerK)rrrminmaxexactrr)rH)rrxr4 sT      0 z Word.__init__Tc CsD|jr<|jj||}|s(t|||j||j}||jfS|||jkrZt|||j||}|d7}t|}|j}||j }t ||}x ||kr|||kr|d7}qWd} |||j krd} |j r||kr|||krd} |j r|dkr||d|ks||kr|||krd} | r4t|||j|||||fS)NrrFTr)rdrrraendgrouprrrrr rrr) rr-rrorrrZ bodycharsrZthrowExceptionrwrwrxrj s6    4zWord.parseImplc stytt|jStk r"YnX|jdkrndd}|j|jkr^d||j||jf|_nd||j|_|jS)NcSs$t|dkr|dddS|SdS)Nz...)r)rrwrwrx charsAsStr s z Word.__str__..charsAsStrz W:(%s,%s)zW:(%s))rr/rrKrUrr)rr)rHrwrxr s  z Word.__str__)NrrrrFN)T)rrrrrrrrrwrw)rHrxr/ s.6 #csFeZdZdZeejdZd fdd Zd ddZ fd d Z Z S) r'a Token for matching strings that match a given regular expression. Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. If the given regex contains named groups (defined using C{(?P...)}), these will be preserved as named parse results. Example:: realnum = Regex(r"[+-]?\d+\.\d*") date = Regex(r'(?P\d{4})-(?P\d\d?)-(?P\d\d?)') # ref: http://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression roman = Regex(r"M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})") z[A-Z]rc stt|jt|tr|s,tjdtdd||_||_ yt j |j|j |_ |j|_ Wqt jk rtjd|tddYqXn2t|tjr||_ t||_|_ ||_ ntdt||_d|j|_d|_d|_d S) zThe parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags.z0null string passed to Regex; use Empty() insteadrq)rz$invalid pattern (%s) passed to RegexzCRegex may only be constructed with a string or a compiled RE objectz Expected FTN)rr'rrzrrrrpatternflagsrdr r sre_constantserrorcompiledREtyper{rrrrar`r[)rrr)rHrwrxr s.         zRegex.__init__TcCsd|jj||}|s"t|||j||j}|j}t|j}|r\x|D]}||||<qHW||fS)N)rdrrrar groupdictr"r)rr-rrordrrrwrwrxr s  zRegex.parseImplc sDytt|jStk r"YnX|jdkr>dt|j|_|jS)NzRe:(%s))rr'rrKrUrr)r)rHrwrxr s z Regex.__str__)r)T) rrrrrrdr rrrrrrwrw)rHrxr' s  " cs8eZdZdZd fdd Zd ddZfd d ZZS) r%a Token for matching strings that are delimited by quoting characters. Defined with the following parameters: - quoteChar - string of one or more characters defining the quote delimiting string - escChar - character to escape quotes, typically backslash (default=C{None}) - escQuote - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=C{None}) - multiline - boolean indicating whether quotes can span multiple lines (default=C{False}) - unquoteResults - boolean indicating whether the matched text should be unquoted (default=C{True}) - endQuoteChar - string of one or more characters defining the end of the quote delimited string (default=C{None} => same as quoteChar) - convertWhitespaceEscapes - convert escaped whitespace (C{'\t'}, C{'\n'}, etc.) to actual whitespace (default=C{True}) Example:: qs = QuotedString('"') print(qs.searchString('lsjdf "This is the quote" sldjf')) complex_qs = QuotedString('{{', endQuoteChar='}}') print(complex_qs.searchString('lsjdf {{This is the "quote"}} sldjf')) sql_qs = QuotedString('"', escQuote='""') print(sql_qs.searchString('lsjdf "This is the quote with ""embedded"" quotes" sldjf')) prints:: [['This is the quote']] [['This is the "quote"']] [['This is the quote with "embedded" quotes']] NFTc sNttj|j}|s0tjdtddt|dkr>|}n"|j}|s`tjdtddt|_t |_ |d_ |_ t |_ |_|_|_|_|rtjtjB_dtjjtj d|dk rt|pdf_n.)z|(?:%s)z|(?:%s.)z(.)z)*%sz$invalid pattern (%s) passed to Regexz Expected FTrs)%rr%rrrrr SyntaxError quoteCharr quoteCharLenfirstQuoteCharrendQuoteCharLenescCharescQuoteunquoteResultsconvertWhitespaceEscapesrd MULTILINEDOTALLrr rrrrescCharReplacePatternr rrrrrrar`r[)rrr r!Z multiliner"rr#)rH)rrxr sf       6     zQuotedString.__init__c Cs|||jkr|jj||pd}|s4t|||j||j}|j}|jr||j|j }t |t rd|kr|j rddddd}x |j D]\}}|j||}qW|jrtj|jd|}|jr|j|j|j}||fS)N\ r  )z\tz\nz\fz\rz\g<1>)rrdrrrarrr"rrrzrr#rrr rr&r!r) rr-rrorrZws_mapZwslitZwscharrwrwrxrG s(  zQuotedString.parseImplc sFytt|jStk r"YnX|jdkr@d|j|jf|_|jS)Nz.quoted string, starting with %s ending with %s)rr%rrKrUrr)r)rHrwrxrj s zQuotedString.__str__)NNFTNT)T)rrrrrrrrrwrw)rHrxr% sA #cs8eZdZdZd fdd Zd ddZfd d ZZS) r a Token for matching words composed of characters I{not} in a given set (will include whitespace in matched characters if not listed in the provided exclusion set - see example). Defined with string containing all disallowed characters, and an optional minimum, maximum, and/or exact length. The default value for C{min} is 1 (a minimum value < 1 is not valid); the default values for C{max} and C{exact} are 0, meaning no maximum or exact length restriction. Example:: # define a comma-separated-value as anything that is not a ',' csv_value = CharsNotIn(',') print(delimitedList(csv_value).parseString("dkls,lsdkjf,s12 34,@!#,213")) prints:: ['dkls', 'lsdkjf', 's12 34', '@!#', '213'] rrrcstt|jd|_||_|dkr*td||_|dkr@||_nt|_|dkrZ||_||_t ||_ d|j |_ |jdk|_ d|_ dS)NFrrzfcannot specify a minimum length < 1; use Optional(CharsNotIn()) if zero-length char group is permittedrz Expected )rr rrXnotCharsrrrrrrrar[r`)rr+r r r )rHrwrxr s    zCharsNotIn.__init__TcCs|||jkrt|||j||}|d7}|j}t||jt|}x ||krd|||krd|d7}qFW|||jkrt|||j|||||fS)Nrr)r+rrar rrr)rr-rrorZnotcharsmaxlenrwrwrxr s   zCharsNotIn.parseImplc sdytt|jStk r"YnX|jdkr^t|jdkrRd|jdd|_n d|j|_|jS)Nrz !W:(%s...)z!W:(%s))rr rrKrUrr+)r)rHrwrxr s  zCharsNotIn.__str__)rrrr)T)rrrrrrrrrwrw)rHrxr v s cs<eZdZdZddddddZdfd d ZdddZZS)r.a Special matching class for matching whitespace. Normally, whitespace is ignored by pyparsing grammars. This class is included when some whitespace structures are significant. Define with a string containing the whitespace characters to be matched; default is C{" \t\r\n"}. Also takes optional C{min}, C{max}, and C{exact} arguments, as defined for the C{L{Word}} class. zzzzz)rr(rr*r) rrrcsttj|_jdjfddjDdjddjD_d_dj_ |_ |dkrt|_ nt _ |dkr|_ |_ dS)Nrc3s|]}|jkr|VqdS)N) matchWhite)rr)rrwrxr sz!White.__init__..css|]}tj|VqdS)N)r. whiteStrs)rrrwrwrxr sTz Expected r) rr.rr.rrrYrr[rarrr)rZwsr r r )rH)rrxr s  zWhite.__init__TcCs|||jkrt|||j||}|d7}||j}t|t|}x"||krd|||jkrd|d7}qDW|||jkrt|||j|||||fS)Nrr)r.rrarr rr)rr-rrorrrwrwrxr s  zWhite.parseImpl)r-rrrr)T)rrrrr/rrrrwrw)rHrxr. scseZdZfddZZS)_PositionTokencs(tt|j|jj|_d|_d|_dS)NTF)rr0rrHrrr[r`)r)rHrwrxr s z_PositionToken.__init__)rrrrrrwrw)rHrxr0 sr0cs2eZdZdZfddZddZd ddZZS) rzb Token to advance to a specific column of input text; useful for tabular report scraping. cstt|j||_dS)N)rrrr9)rcolno)rHrwrxr szGoToColumn.__init__cCs`t|||jkr\t|}|jr*|j||}x0||krZ||jrZt|||jkrZ|d7}q,W|S)Nrr)r9rr]risspace)rr-rrrwrwrxr s & zGoToColumn.preParseTcCsDt||}||jkr"t||d|||j|}|||}||fS)NzText not in expected column)r9r)rr-rroZthiscolZnewlocrrwrwrxr s    zGoToColumn.parseImpl)T)rrrrrrrrrwrw)rHrxr s  cs*eZdZdZfddZdddZZS)ra Matches if current position is at the beginning of a line within the parse string Example:: test = ''' AAA this line AAA and this line AAA but not this one B AAA and definitely not this one ''' for t in (LineStart() + 'AAA' + restOfLine).searchString(test): print(t) Prints:: ['AAA', ' this line'] ['AAA', ' and this line'] cstt|jd|_dS)NzExpected start of line)rrrra)r)rHrwrxr& szLineStart.__init__TcCs*t||dkr|gfSt|||j|dS)Nrr)r9rra)rr-rrorwrwrxr* szLineStart.parseImpl)T)rrrrrrrrwrw)rHrxr s cs*eZdZdZfddZdddZZS)rzU Matches if current position is at the end of a line within the parse string cs,tt|j|jtjjddd|_dS)NrrzExpected end of line)rrrrr$rNrra)r)rHrwrxr3 szLineEnd.__init__TcCsb|t|kr6||dkr$|ddfSt|||j|n(|t|krN|dgfSt|||j|dS)Nrrr)rrra)rr-rrorwrwrxr8 s     zLineEnd.parseImpl)T)rrrrrrrrwrw)rHrxr/ s cs*eZdZdZfddZdddZZS)r*zM Matches if current position is at the beginning of the parse string cstt|jd|_dS)NzExpected start of text)rr*rra)r)rHrwrxrG szStringStart.__init__TcCs0|dkr(||j|dkr(t|||j||gfS)Nr)rrra)rr-rrorwrwrxrK szStringStart.parseImpl)T)rrrrrrrrwrw)rHrxr*C s cs*eZdZdZfddZdddZZS)r)zG Matches if current position is at the end of the parse string cstt|jd|_dS)NzExpected end of text)rr)rra)r)rHrwrxrV szStringEnd.__init__TcCs^|t|krt|||j|n<|t|kr6|dgfS|t|krJ|gfSt|||j|dS)Nrr)rrra)rr-rrorwrwrxrZ s    zStringEnd.parseImpl)T)rrrrrrrrwrw)rHrxr)R s cs.eZdZdZeffdd ZdddZZS)r1ap Matches if the current position is at the beginning of a Word, and is not preceded by any character in a given set of C{wordChars} (default=C{printables}). To emulate the C{} behavior of regular expressions, use C{WordStart(alphanums)}. C{WordStart} will also match at the beginning of the string being parsed, or at the beginning of a line. cs"tt|jt||_d|_dS)NzNot at the start of a word)rr1rr wordCharsra)rr3)rHrwrxrl s zWordStart.__init__TcCs@|dkr8||d|jks(|||jkr8t|||j||gfS)Nrrr)r3rra)rr-rrorwrwrxrq s zWordStart.parseImpl)T)rrrrrVrrrrwrw)rHrxr1d scs.eZdZdZeffdd ZdddZZS)r0aZ Matches if the current position is at the end of a Word, and is not followed by any character in a given set of C{wordChars} (default=C{printables}). To emulate the C{} behavior of regular expressions, use C{WordEnd(alphanums)}. C{WordEnd} will also match at the end of the string being parsed, or at the end of a line. cs(tt|jt||_d|_d|_dS)NFzNot at the end of a word)rr0rrr3rXra)rr3)rHrwrxr s zWordEnd.__init__TcCsPt|}|dkrH||krH|||jks8||d|jkrHt|||j||gfS)Nrrr)rr3rra)rr-rrorrwrwrxr s zWordEnd.parseImpl)T)rrrrrVrrrrwrw)rHrxr0x scseZdZdZdfdd ZddZddZd d Zfd d Zfd dZ fddZ dfdd Z gfddZ fddZ ZS)r z^ Abstract subclass of ParserElement, for combining and post-processing parsed tokens. Fc stt|j|t|tr"t|}t|tr.F)rr rrzrrrr$rQexprsrIterableallrvrre)rr4rg)rHrwrxr s     zParseExpression.__init__cCs |j|S)N)r4)rrrwrwrxr szParseExpression.__getitem__cCs|jj|d|_|S)N)r4rrU)rrrwrwrxr s zParseExpression.appendcCs4d|_dd|jD|_x|jD] }|jq W|S)z~Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on all contained expressions.FcSsg|] }|jqSrw)r)rrrwrwrxr sz3ParseExpression.leaveWhitespace..)rXr4r)rrrwrwrxr s   zParseExpression.leaveWhitespacecszt|trF||jkrvtt|j|xP|jD]}|j|jdq,Wn0tt|j|x|jD]}|j|jdq^W|S)Nrrrsrs)rzr+r]rr rr4)rrr)rHrwrxr s    zParseExpression.ignorec sLytt|jStk r"YnX|jdkrFd|jjt|jf|_|jS)Nz%s:(%s)) rr rrKrUrHrrr4)r)rHrwrxr s zParseExpression.__str__cs0tt|jx|jD] }|jqWt|jdkr|jd}t||jr|j r|jdkr|j r|jdd|jdg|_d|_ |j |j O_ |j |j O_ |jd}t||jo|j o|jdko|j r|jdd|jdd|_d|_ |j |j O_ |j |j O_ dt ||_|S)Nrqrrrz Expected rsrs)rr rr4rrzrHrSrVr^rUr[r`rra)rrr)rHrwrxr s0         zParseExpression.streamlinecstt|j||}|S)N)rr rm)rrrlr)rHrwrxrm szParseExpression.setResultsNamecCs:|dd|g}x|jD]}|j|qW|jgdS)N)r4rr)rrtmprrwrwrxr s zParseExpression.validatecs$tt|j}dd|jD|_|S)NcSsg|] }|jqSrw)r)rrrwrwrxr sz(ParseExpression.copy..)rr rr4)rr)rHrwrxr szParseExpression.copy)F)F)rrrrrrrrrrrrmrrrrwrw)rHrxr s " csTeZdZdZGdddeZdfdd ZdddZd d Zd d Z d dZ Z S)ra  Requires all given C{ParseExpression}s to be found in the given order. Expressions may be separated by whitespace. May be constructed using the C{'+'} operator. May also be constructed using the C{'-'} operator, which will suppress backtracking. Example:: integer = Word(nums) name_expr = OneOrMore(Word(alphas)) expr = And([integer("id"),name_expr("name"),integer("age")]) # more easily written as: expr = integer("id") + name_expr("name") + integer("age") cseZdZfddZZS)zAnd._ErrorStopcs&ttj|j||d|_|jdS)N-)rrrrrr)rrr)rHrwrxr szAnd._ErrorStop.__init__)rrrrrrwrw)rHrxr srTcsRtt|j||tdd|jD|_|j|jdj|jdj|_d|_ dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxr szAnd.__init__..rT) rrrr6r4r[rrYrXre)rr4rg)rHrwrxr s z And.__init__c Cs|jdj|||dd\}}d}x|jddD]}t|tjrFd}q0|ry|j|||\}}Wqtk rvYqtk r}zd|_tj|WYdd}~Xqt k rt|t ||j |YqXn|j|||\}}|s|j r0||7}q0W||fS)NrF)rprrT) r4rtrzrrr#r __traceback__rrrrar) rr-rro resultlistZ errorStoprZ exprtokensrrwrwrxr s(   z And.parseImplcCst|trtj|}|j|S)N)rzrr$rQr)rrrwrwrxr5 s  z And.__iadd__cCs8|dd|g}x |jD]}|j||jsPqWdS)N)r4rr[)rrsubRecCheckListrrwrwrxr: s   zAnd.checkRecursioncCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nr{rcss|]}t|VqdS)N)r)rrrwrwrxrF szAnd.__str__..})rrrUrr4)rrwrwrxrA s    z And.__str__)T)T) rrrrr rrrrrrrrwrw)rHrxr s csDeZdZdZdfdd ZdddZdd Zd d Zd d ZZ S)ra Requires that at least one C{ParseExpression} is found. If two expressions match, the expression that matches the longest string will be used. May be constructed using the C{'^'} operator. Example:: # construct Or using '^' operator number = Word(nums) ^ Combine(Word(nums) + '.' + Word(nums)) print(number.searchString("123 3.1416 789")) prints:: [['123'], ['3.1416'], ['789']] Fcs:tt|j|||jr0tdd|jD|_nd|_dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxr\ szOr.__init__..T)rrrr4rr[)rr4rg)rHrwrxrY sz Or.__init__Tc CsTd}d}g}x|jD]}y|j||}Wnvtk rd} z d| _| j|krT| }| j}WYdd} ~ Xqtk rt||krt|t||j|}t|}YqX|j||fqW|r*|j dddx`|D]X\} }y|j |||Stk r$} z"d| _| j|kr| }| j}WYdd} ~ XqXqW|dk rB|j|_ |nt||d|dS)NrrcSs |d S)Nrrw)xrwrwrxryu szOr.parseImpl..)rz no defined alternatives to matchrs) r4rrr9rrrrarsortrtr) rr-rro maxExcLoc maxExceptionrrZloc2r_rwrwrxr` s<     z Or.parseImplcCst|trtj|}|j|S)N)rzrr$rQr)rrrwrwrx__ixor__ s  z Or.__ixor__cCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nrr<z ^ css|]}t|VqdS)N)r)rrrwrwrxr szOr.__str__..r=)rrrUrr4)rrwrwrxr s    z Or.__str__cCs0|dd|g}x|jD]}|j|qWdS)N)r4r)rrr;rrwrwrxr s zOr.checkRecursion)F)T) rrrrrrrCrrrrwrw)rHrxrK s   & csDeZdZdZdfdd ZdddZdd Zd d Zd d ZZ S)ra Requires that at least one C{ParseExpression} is found. If two expressions match, the first one listed is the one that will match. May be constructed using the C{'|'} operator. Example:: # construct MatchFirst using '|' operator # watch the order of expressions to match number = Word(nums) | Combine(Word(nums) + '.' + Word(nums)) print(number.searchString("123 3.1416 789")) # Fail! -> [['123'], ['3'], ['1416'], ['789']] # put more selective expression first number = Combine(Word(nums) + '.' + Word(nums)) | Word(nums) print(number.searchString("123 3.1416 789")) # Better -> [['123'], ['3.1416'], ['789']] Fcs:tt|j|||jr0tdd|jD|_nd|_dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxr sz&MatchFirst.__init__..T)rrrr4rr[)rr4rg)rHrwrxr szMatchFirst.__init__Tc Csd}d}x|jD]}y|j|||}|Stk r\}z|j|krL|}|j}WYdd}~Xqtk rt||krt|t||j|}t|}YqXqW|dk r|j|_|nt||d|dS)Nrrz no defined alternatives to matchrs)r4rtrrrrrar) rr-rror@rArrrrwrwrxr s$   zMatchFirst.parseImplcCst|trtj|}|j|S)N)rzrr$rQr)rrrwrwrx__ior__ s  zMatchFirst.__ior__cCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nrr<z | css|]}t|VqdS)N)r)rrrwrwrxr sz%MatchFirst.__str__..r=)rrrUrr4)rrwrwrxr s    zMatchFirst.__str__cCs0|dd|g}x|jD]}|j|qWdS)N)r4r)rrr;rrwrwrxr s zMatchFirst.checkRecursion)F)T) rrrrrrrDrrrrwrw)rHrxr s   cs<eZdZdZd fdd Zd ddZddZd d ZZS) r am Requires all given C{ParseExpression}s to be found, but in any order. Expressions may be separated by whitespace. May be constructed using the C{'&'} operator. Example:: color = oneOf("RED ORANGE YELLOW GREEN BLUE PURPLE BLACK WHITE BROWN") shape_type = oneOf("SQUARE CIRCLE TRIANGLE STAR HEXAGON OCTAGON") integer = Word(nums) shape_attr = "shape:" + shape_type("shape") posn_attr = "posn:" + Group(integer("x") + ',' + integer("y"))("posn") color_attr = "color:" + color("color") size_attr = "size:" + integer("size") # use Each (using operator '&') to accept attributes in any order # (shape and posn are required, color and size are optional) shape_spec = shape_attr & posn_attr & Optional(color_attr) & Optional(size_attr) shape_spec.runTests(''' shape: SQUARE color: BLACK posn: 100, 120 shape: CIRCLE size: 50 color: BLUE posn: 50,80 color:GREEN size:20 shape:TRIANGLE posn:20,40 ''' ) prints:: shape: SQUARE color: BLACK posn: 100, 120 ['shape:', 'SQUARE', 'color:', 'BLACK', 'posn:', ['100', ',', '120']] - color: BLACK - posn: ['100', ',', '120'] - x: 100 - y: 120 - shape: SQUARE shape: CIRCLE size: 50 color: BLUE posn: 50,80 ['shape:', 'CIRCLE', 'size:', '50', 'color:', 'BLUE', 'posn:', ['50', ',', '80']] - color: BLUE - posn: ['50', ',', '80'] - x: 50 - y: 80 - shape: CIRCLE - size: 50 color: GREEN size: 20 shape: TRIANGLE posn: 20,40 ['color:', 'GREEN', 'size:', '20', 'shape:', 'TRIANGLE', 'posn:', ['20', ',', '40']] - color: GREEN - posn: ['20', ',', '40'] - x: 20 - y: 40 - shape: TRIANGLE - size: 20 Tcs8tt|j||tdd|jD|_d|_d|_dS)Ncss|] }|jVqdS)N)r[)rrrwrwrxrsz Each.__init__..T)rr rr6r4r[rXinitExprGroups)rr4rg)rHrwrxrsz Each.__init__c s|jrtdd|jD|_dd|jD}dd|jD}|||_dd|jD|_dd|jD|_dd|jD|_|j|j7_d |_|}|jdd}|jddg}d } x| rp||j|j} g} x~| D]v} y| j||}Wn t k r| j | YqX|j |jj t | | | |krD|j | q| krj | qWt| t| krd } qW|rd jd d|D} t ||d | |fdd|jD7}g}x*|D]"} | j|||\}}|j |qWt|tg}||fS)Ncss&|]}t|trt|j|fVqdS)N)rzrrr.)rrrwrwrxrsz!Each.parseImpl..cSsg|]}t|tr|jqSrw)rzrr.)rrrwrwrxrsz"Each.parseImpl..cSs"g|]}|jrt|t r|qSrw)r[rzr)rrrwrwrxrscSsg|]}t|tr|jqSrw)rzr2r.)rrrwrwrxr scSsg|]}t|tr|jqSrw)rzrr.)rrrwrwrxr!scSs g|]}t|tttfs|qSrw)rzrr2r)rrrwrwrxr"sFTz, css|]}t|VqdS)N)r)rrrwrwrxr=sz*Missing one or more required elements (%s)cs$g|]}t|tr|jkr|qSrw)rzrr.)rr)tmpOptrwrxrAs)rErr4Zopt1mapZ optionalsZmultioptionalsZ multirequiredZrequiredrrrrrremoverrrtsumr")rr-rroZopt1Zopt2ZtmpLocZtmpReqdZ matchOrderZ keepMatchingZtmpExprsZfailedrZmissingr:rZ finalResultsrw)rFrxrsP     zEach.parseImplcCs@t|dr|jS|jdkr:ddjdd|jDd|_|jS)Nrr<z & css|]}t|VqdS)N)r)rrrwrwrxrPszEach.__str__..r=)rrrUrr4)rrwrwrxrKs    z Each.__str__cCs0|dd|g}x|jD]}|j|qWdS)N)r4r)rrr;rrwrwrxrTs zEach.checkRecursion)T)T) rrrrrrrrrrwrw)rHrxr s 5 1 csleZdZdZdfdd ZdddZdd Zfd d Zfd d ZddZ gfddZ fddZ Z S)rza Abstract subclass of C{ParserElement}, for combining and post-processing parsed tokens. Fcstt|j|t|tr@ttjtr2tj|}ntjt |}||_ d|_ |dk r|j |_ |j |_ |j|j|j|_|j|_|j|_|jj|jdS)N)rrrrzr issubclassr$rQr,rr.rUr`r[rrYrXrWrer]r)rr.rg)rHrwrxr^s    zParseElementEnhance.__init__TcCs2|jdk r|jj|||ddStd||j|dS)NF)rpr)r.rtrra)rr-rrorwrwrxrps zParseElementEnhance.parseImplcCs*d|_|jj|_|jdk r&|jj|S)NF)rXr.rr)rrwrwrxrvs    z#ParseElementEnhance.leaveWhitespacecsrt|trB||jkrntt|j||jdk rn|jj|jdn,tt|j||jdk rn|jj|jd|S)Nrrrsrs)rzr+r]rrrr.)rr)rHrwrxr}s    zParseElementEnhance.ignorecs&tt|j|jdk r"|jj|S)N)rrrr.)r)rHrwrxrs  zParseElementEnhance.streamlinecCsB||krt||g|dd|g}|jdk r>|jj|dS)N)r&r.r)rrr;rwrwrxrs  z"ParseElementEnhance.checkRecursioncCs6|dd|g}|jdk r(|jj||jgdS)N)r.rr)rrr7rwrwrxrs  zParseElementEnhance.validatec sVytt|jStk r"YnX|jdkrP|jdk rPd|jjt|jf|_|jS)Nz%s:(%s)) rrrrKrUr.rHrr)r)rHrwrxrszParseElementEnhance.__str__)F)T) rrrrrrrrrrrrrrwrw)rHrxrZs   cs*eZdZdZfddZdddZZS)ra Lookahead matching of the given parse expression. C{FollowedBy} does I{not} advance the parsing position within the input string, it only verifies that the specified parse expression matches at the current position. C{FollowedBy} always returns a null token list. Example:: # use FollowedBy to match a label only if it is followed by a ':' data_word = Word(alphas) label = data_word + FollowedBy(':') attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) OneOrMore(attr_expr).parseString("shape: SQUARE color: BLACK posn: upper left").pprint() prints:: [['shape', 'SQUARE'], ['color', 'BLACK'], ['posn', 'upper left']] cstt|j|d|_dS)NT)rrrr[)rr.)rHrwrxrszFollowedBy.__init__TcCs|jj|||gfS)N)r.r)rr-rrorwrwrxrszFollowedBy.parseImpl)T)rrrrrrrrwrw)rHrxrs cs2eZdZdZfddZd ddZddZZS) ra Lookahead to disallow matching with the given parse expression. C{NotAny} does I{not} advance the parsing position within the input string, it only verifies that the specified parse expression does I{not} match at the current position. Also, C{NotAny} does I{not} skip over leading whitespace. C{NotAny} always returns a null token list. May be constructed using the '~' operator. Example:: cs0tt|j|d|_d|_dt|j|_dS)NFTzFound unwanted token, )rrrrXr[rr.ra)rr.)rHrwrxrszNotAny.__init__TcCs&|jj||rt|||j||gfS)N)r.rrra)rr-rrorwrwrxrszNotAny.parseImplcCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrz~{r=)rrrUrr.)rrwrwrxrs   zNotAny.__str__)T)rrrrrrrrrwrw)rHrxrs   cs(eZdZdfdd ZdddZZS) _MultipleMatchNcsFtt|j|d|_|}t|tr.tj|}|dk r<|nd|_dS)NT) rrJrrWrzrr$rQ not_ender)rr.stopOnZender)rHrwrxrs   z_MultipleMatch.__init__Tc Cs|jj}|j}|jdk }|r$|jj}|r2|||||||dd\}}yZ|j } xJ|rb|||| rr|||} n|} ||| |\}} | s| jrT|| 7}qTWWnttfk rYnX||fS)NF)rp) r.rtrrKrr]rrr) rr-rroZself_expr_parseZself_skip_ignorablesZ check_enderZ try_not_enderrZhasIgnoreExprsrZ tmptokensrwrwrxrs,      z_MultipleMatch.parseImpl)N)T)rrrrrrrwrw)rHrxrJsrJc@seZdZdZddZdS)ra Repetition of one or more of the given expression. Parameters: - expr - expression that must match one or more times - stopOn - (default=C{None}) - expression for a terminating sentinel (only required if the sentinel would ordinarily match the repetition expression) Example:: data_word = Word(alphas) label = data_word + FollowedBy(':') attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join)) text = "shape: SQUARE posn: upper left color: BLACK" OneOrMore(attr_expr).parseString(text).pprint() # Fail! read 'color' as data instead of next label -> [['shape', 'SQUARE color']] # use stopOn attribute for OneOrMore to avoid reading label string as part of the data attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) OneOrMore(attr_expr).parseString(text).pprint() # Better -> [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'BLACK']] # could also be written as (attr_expr * (1,)).parseString(text).pprint() cCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrr<z}...)rrrUrr.)rrwrwrxr!s   zOneOrMore.__str__N)rrrrrrwrwrwrxrscs8eZdZdZd fdd Zd fdd Zdd ZZS) r2aw Optional repetition of zero or more of the given expression. Parameters: - expr - expression that must match zero or more times - stopOn - (default=C{None}) - expression for a terminating sentinel (only required if the sentinel would ordinarily match the repetition expression) Example: similar to L{OneOrMore} Ncstt|j||dd|_dS)N)rLT)rr2rr[)rr.rL)rHrwrxr6szZeroOrMore.__init__Tc s6ytt|j|||Sttfk r0|gfSXdS)N)rr2rrr)rr-rro)rHrwrxr:szZeroOrMore.parseImplcCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrrz]...)rrrUrr.)rrwrwrxr@s   zZeroOrMore.__str__)N)T)rrrrrrrrrwrw)rHrxr2*s c@s eZdZddZeZddZdS) _NullTokencCsdS)NFrw)rrwrwrxrJsz_NullToken.__bool__cCsdS)Nrrw)rrwrwrxrMsz_NullToken.__str__N)rrrrr'rrwrwrwrxrMIsrMcs6eZdZdZeffdd Zd ddZddZZS) raa Optional matching of the given expression. Parameters: - expr - expression that must match zero or more times - default (optional) - value to be returned if the optional expression is not found. Example:: # US postal code can be a 5-digit zip, plus optional 4-digit qualifier zip = Combine(Word(nums, exact=5) + Optional('-' + Word(nums, exact=4))) zip.runTests(''' # traditional ZIP code 12345 # ZIP+4 form 12101-0001 # invalid ZIP 98765- ''') prints:: # traditional ZIP code 12345 ['12345'] # ZIP+4 form 12101-0001 ['12101-0001'] # invalid ZIP 98765- ^ FAIL: Expected end of text (at char 5), (line:1, col:6) cs.tt|j|dd|jj|_||_d|_dS)NF)rgT)rrrr.rWrr[)rr.r)rHrwrxrts zOptional.__init__Tc Cszy|jj|||dd\}}WnTttfk rp|jtk rh|jjr^t|jg}|j||jj<ql|jg}ng}YnX||fS)NF)rp)r.rtrrr_optionalNotMatchedrVr")rr-rrorrwrwrxrzs    zOptional.parseImplcCs4t|dr|jS|jdkr.dt|jd|_|jS)Nrrr )rrrUrr.)rrwrwrxrs   zOptional.__str__)T) rrrrrNrrrrrwrw)rHrxrQs" cs,eZdZdZd fdd Zd ddZZS) r(a Token for skipping over all undefined text until the matched expression is found. Parameters: - expr - target expression marking the end of the data to be skipped - include - (default=C{False}) if True, the target expression is also parsed (the skipped text and target expression are returned as a 2-element list). - ignore - (default=C{None}) used to define grammars (typically quoted strings and comments) that might contain false matches to the target expression - failOn - (default=C{None}) define expressions that are not allowed to be included in the skipped test; if found before the target expression is found, the SkipTo is not a match Example:: report = ''' Outstanding Issues Report - 1 Jan 2000 # | Severity | Description | Days Open -----+----------+-------------------------------------------+----------- 101 | Critical | Intermittent system crash | 6 94 | Cosmetic | Spelling error on Login ('log|n') | 14 79 | Minor | System slow when running too many reports | 47 ''' integer = Word(nums) SEP = Suppress('|') # use SkipTo to simply match everything up until the next SEP # - ignore quoted strings, so that a '|' character inside a quoted string does not match # - parse action will call token.strip() for each matched token, i.e., the description body string_data = SkipTo(SEP, ignore=quotedString) string_data.setParseAction(tokenMap(str.strip)) ticket_expr = (integer("issue_num") + SEP + string_data("sev") + SEP + string_data("desc") + SEP + integer("days_open")) for tkt in ticket_expr.searchString(report): print tkt.dump() prints:: ['101', 'Critical', 'Intermittent system crash', '6'] - days_open: 6 - desc: Intermittent system crash - issue_num: 101 - sev: Critical ['94', 'Cosmetic', "Spelling error on Login ('log|n')", '14'] - days_open: 14 - desc: Spelling error on Login ('log|n') - issue_num: 94 - sev: Cosmetic ['79', 'Minor', 'System slow when running too many reports', '47'] - days_open: 47 - desc: System slow when running too many reports - issue_num: 79 - sev: Minor FNcs`tt|j|||_d|_d|_||_d|_t|t rFt j ||_ n||_ dt |j|_dS)NTFzNo match found for )rr(r ignoreExprr[r` includeMatchrrzrr$rQfailOnrr.ra)rrincluderrQ)rHrwrxrs zSkipTo.__init__Tc Cs,|}t|}|j}|jj}|jdk r,|jjnd}|jdk rB|jjnd} |} x| |kr|dk rh||| rhP| dk rx*y| || } Wqrtk rPYqrXqrWy||| dddWn tt fk r| d7} YqLXPqLWt|||j || }|||} t | } |j r$||||dd\}} | | 7} || fS)NF)rorprr)rp) rr.rtrQrrOrrrrrar"rP)rr-rror0rr.Z expr_parseZself_failOn_canParseNextZself_ignoreExpr_tryParseZtmplocZskiptextZ skipresultrrwrwrxrs<    zSkipTo.parseImpl)FNN)T)rrrrrrrrwrw)rHrxr(s6 csbeZdZdZdfdd ZddZddZd d Zd d Zgfd dZ ddZ fddZ Z S)raK Forward declaration of an expression to be defined later - used for recursive grammars, such as algebraic infix notation. When the expression is known, it is assigned to the C{Forward} variable using the '<<' operator. Note: take care when assigning to C{Forward} not to overlook precedence of operators. Specifically, '|' has a lower precedence than '<<', so that:: fwdExpr << a | b | c will actually be evaluated as:: (fwdExpr << a) | b | c thereby leaving b and c out as parseable alternatives. It is recommended that you explicitly group the values inserted into the C{Forward}:: fwdExpr << (a | b | c) Converting to use the '<<=' operator instead will avoid this problem. See L{ParseResults.pprint} for an example of a recursive parser created using C{Forward}. Ncstt|j|dddS)NF)rg)rrr)rr)rHrwrxrszForward.__init__cCsjt|trtj|}||_d|_|jj|_|jj|_|j|jj |jj |_ |jj |_ |j j |jj |S)N)rzrr$rQr.rUr`r[rrYrXrWr]r)rrrwrwrx __lshift__s      zForward.__lshift__cCs||>S)Nrw)rrrwrwrx __ilshift__'szForward.__ilshift__cCs d|_|S)NF)rX)rrwrwrxr*szForward.leaveWhitespacecCs$|js d|_|jdk r |jj|S)NT)r_r.r)rrwrwrxr.s   zForward.streamlinecCs>||kr0|dd|g}|jdk r0|jj||jgdS)N)r.rr)rrr7rwrwrxr5s   zForward.validatec Cs>t|dr|jS|jjdSd}Wd|j|_X|jjd|S)Nrz: ...Nonez: )rrrHrZ _revertClass_ForwardNoRecurser.r)rZ retStringrwrwrxr<s   zForward.__str__cs.|jdk rtt|jSt}||K}|SdS)N)r.rrr)rr)rHrwrxrMs  z Forward.copy)N) rrrrrrSrTrrrrrrrwrw)rHrxrs  c@seZdZddZdS)rVcCsdS)Nz...rw)rrwrwrxrVsz_ForwardNoRecurse.__str__N)rrrrrwrwrwrxrVUsrVcs"eZdZdZdfdd ZZS)r-zQ Abstract subclass of C{ParseExpression}, for converting parsed results. Fcstt|j|d|_dS)NF)rr-rrW)rr.rg)rHrwrxr]szTokenConverter.__init__)F)rrrrrrrwrw)rHrxr-Yscs6eZdZdZd fdd ZfddZdd ZZS) r a Converter to concatenate all matching tokens to a single string. By default, the matching patterns must also be contiguous in the input string; this can be disabled by specifying C{'adjacent=False'} in the constructor. Example:: real = Word(nums) + '.' + Word(nums) print(real.parseString('3.1416')) # -> ['3', '.', '1416'] # will also erroneously match the following print(real.parseString('3. 1416')) # -> ['3', '.', '1416'] real = Combine(Word(nums) + '.' + Word(nums)) print(real.parseString('3.1416')) # -> ['3.1416'] # no match when there are internal spaces print(real.parseString('3. 1416')) # -> Exception: Expected W:(0123...) rTcs8tt|j||r|j||_d|_||_d|_dS)NT)rr rradjacentrX joinStringre)rr.rXrW)rHrwrxrrszCombine.__init__cs(|jrtj||ntt|j||S)N)rWr$rrr )rr)rHrwrxr|szCombine.ignorecCsP|j}|dd=|tdj|j|jg|jd7}|jrH|jrH|gS|SdS)Nr)r)rr"rr rXrbrVr)rr-rrZretToksrwrwrxrs  "zCombine.postParse)rT)rrrrrrrrrwrw)rHrxr as cs(eZdZdZfddZddZZS)ra Converter to return the matched tokens as a list - useful for returning tokens of C{L{ZeroOrMore}} and C{L{OneOrMore}} expressions. Example:: ident = Word(alphas) num = Word(nums) term = ident | num func = ident + Optional(delimitedList(term)) print(func.parseString("fn a,b,100")) # -> ['fn', 'a', 'b', '100'] func = ident + Group(Optional(delimitedList(term))) print(func.parseString("fn a,b,100")) # -> ['fn', ['a', 'b', '100']] cstt|j|d|_dS)NT)rrrrW)rr.)rHrwrxrszGroup.__init__cCs|gS)Nrw)rr-rrrwrwrxrszGroup.postParse)rrrrrrrrwrw)rHrxrs  cs(eZdZdZfddZddZZS)r aW Converter to return a repetitive expression as a list, but also as a dictionary. Each element can also be referenced using the first token in the expression as its key. Useful for tabular report scraping when the first column can be used as a item key. Example:: data_word = Word(alphas) label = data_word + FollowedBy(':') attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join)) text = "shape: SQUARE posn: upper left color: light blue texture: burlap" attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) # print attributes as plain groups print(OneOrMore(attr_expr).parseString(text).dump()) # instead of OneOrMore(expr), parse using Dict(OneOrMore(Group(expr))) - Dict will auto-assign names result = Dict(OneOrMore(Group(attr_expr))).parseString(text) print(result.dump()) # access named fields as dict entries, or output as dict print(result['shape']) print(result.asDict()) prints:: ['shape', 'SQUARE', 'posn', 'upper left', 'color', 'light blue', 'texture', 'burlap'] [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']] - color: light blue - posn: upper left - shape: SQUARE - texture: burlap SQUARE {'color': 'light blue', 'posn': 'upper left', 'texture': 'burlap', 'shape': 'SQUARE'} See more examples at L{ParseResults} of accessing fields by results name. cstt|j|d|_dS)NT)rr rrW)rr.)rHrwrxrsz Dict.__init__cCsxt|D]\}}t|dkr q |d}t|trBt|dj}t|dkr^td|||<q t|dkrt|dt rt|d|||<q |j}|d=t|dkst|tr|j rt||||<q t|d|||<q W|j r|gS|SdS)Nrrrrrq) rrrzrurrrr"rrrV)rr-rrrtokZikeyZ dictvaluerwrwrxrs$   zDict.postParse)rrrrrrrrwrw)rHrxr s# c@s eZdZdZddZddZdS)r+aV Converter for ignoring the results of a parsed expression. Example:: source = "a, b, c,d" wd = Word(alphas) wd_list1 = wd + ZeroOrMore(',' + wd) print(wd_list1.parseString(source)) # often, delimiters that are useful during parsing are just in the # way afterward - use Suppress to keep them out of the parsed output wd_list2 = wd + ZeroOrMore(Suppress(',') + wd) print(wd_list2.parseString(source)) prints:: ['a', ',', 'b', ',', 'c', ',', 'd'] ['a', 'b', 'c', 'd'] (See also L{delimitedList}.) cCsgS)Nrw)rr-rrrwrwrxrszSuppress.postParsecCs|S)Nrw)rrwrwrxrszSuppress.suppressN)rrrrrrrwrwrwrxr+sc@s(eZdZdZddZddZddZdS) rzI Wrapper for parse actions, to ensure they are only called once. cCst||_d|_dS)NF)rMcallablecalled)rZ methodCallrwrwrxrs zOnlyOnce.__init__cCs.|js|j|||}d|_|St||ddS)NTr)r[rZr)rrr5rvrrwrwrxrs zOnlyOnce.__call__cCs d|_dS)NF)r[)rrwrwrxreset szOnlyOnce.resetN)rrrrrrr\rwrwrwrxrsc s:tfdd}y j|_Wntk r4YnX|S)as Decorator for debugging parse actions. When the parse action is called, this decorator will print C{">> entering I{method-name}(line:I{current_source_line}, I{parse_location}, I{matched_tokens})".} When the parse action completes, the decorator will print C{"<<"} followed by the returned value, or any exception that the parse action raised. Example:: wd = Word(alphas) @traceParseAction def remove_duplicate_chars(tokens): return ''.join(sorted(set(''.join(tokens))) wds = OneOrMore(wd).setParseAction(remove_duplicate_chars) print(wds.parseString("slkdjs sld sldd sdlf sdljf")) prints:: >>entering remove_duplicate_chars(line: 'slkdjs sld sldd sdlf sdljf', 0, (['slkdjs', 'sld', 'sldd', 'sdlf', 'sdljf'], {})) <>entering %s(line: '%s', %d, %r) z<.z)rMrr)rr`rw)rrxrb s  ,FcCs`t|dt|dt|d}|rBt|t||j|S|tt||j|SdS)a Helper to define a delimited list of expressions - the delimiter defaults to ','. By default, the list elements and delimiters can have intervening whitespace, and comments, but this can be overridden by passing C{combine=True} in the constructor. If C{combine} is set to C{True}, the matching tokens are returned as a single token string, with the delimiters included; otherwise, the matching tokens are returned as a list of tokens, with the delimiters suppressed. Example:: delimitedList(Word(alphas)).parseString("aa,bb,cc") # -> ['aa', 'bb', 'cc'] delimitedList(Word(hexnums), delim=':', combine=True).parseString("AA:BB:CC:DD:EE") # -> ['AA:BB:CC:DD:EE'] z [rz]...N)rr r2rir+)r.ZdelimcombineZdlNamerwrwrxr@9s $csjtfdd}|dkr0ttjdd}n|j}|jd|j|dd|jd td S) a: Helper to define a counted list of expressions. This helper defines a pattern of the form:: integer expr expr expr... where the leading integer tells how many expr expressions follow. The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed. If C{intExpr} is specified, it should be a pyparsing expression that produces an integer value. Example:: countedArray(Word(alphas)).parseString('2 ab cd ef') # -> ['ab', 'cd'] # in this parser, the leading integer value is given in binary, # '10' indicating that 2 values are in the array binaryConstant = Word('01').setParseAction(lambda t: int(t[0], 2)) countedArray(Word(alphas), intExpr=binaryConstant).parseString('10 ab cd ef') # -> ['ab', 'cd'] cs.|d}|r ttg|p&tt>gS)Nr)rrrC)rr5rvr) arrayExprr.rwrxcountFieldParseAction_s"z+countedArray..countFieldParseActionNcSs t|dS)Nr)ru)rvrwrwrxrydszcountedArray..ZarrayLenT)rfz(len) z...)rr/rRrrrirxr)r.ZintExprrdrw)rcr.rxr<Ls cCs:g}x0|D](}t|tr(|jt|q |j|q W|S)N)rzrrrr)Lrrrwrwrxrks   rcs6tfdd}|j|ddjdt|S)a* Helper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = matchPreviousLiteral(first) matchExpr = first + ":" + second will match C{"1:1"}, but not C{"1:2"}. Because this matches a previous literal, will also match the leading C{"1:1"} in C{"1:10"}. If this is not desired, use C{matchPreviousExpr}. Do I{not} use with packrat parsing enabled. csP|rBt|dkr|d>qLt|j}tdd|D>n t>dS)Nrrrcss|]}t|VqdS)N)r)rttrwrwrxrszDmatchPreviousLiteral..copyTokenToRepeater..)rrrrr )rr5rvZtflat)reprwrxcopyTokenToRepeaters   z1matchPreviousLiteral..copyTokenToRepeaterT)rfz(prev) )rrxrir)r.rhrw)rgrxrOts  csFt|j}|Kfdd}|j|ddjdt|S)aS Helper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = matchPreviousExpr(first) matchExpr = first + ":" + second will match C{"1:1"}, but not C{"1:2"}. Because this matches by expressions, will I{not} match the leading C{"1:1"} in C{"1:10"}; the expressions are evaluated first, and then compared, so C{"1"} is compared with C{"10"}. Do I{not} use with packrat parsing enabled. cs*t|jfdd}j|dddS)Ncs$t|j}|kr tddddS)Nrr)rrr)rr5rvZ theseTokens) matchTokensrwrxmustMatchTheseTokenss zLmatchPreviousExpr..copyTokenToRepeater..mustMatchTheseTokensT)rf)rrr)rr5rvrj)rg)rirxrhs  z.matchPreviousExpr..copyTokenToRepeaterT)rfz(prev) )rrrxrir)r.Ze2rhrw)rgrxrNs cCs>xdD]}|j|t|}qW|jdd}|jdd}t|S)Nz\^-]rz\nr(z\t)r_bslashr)rrrwrwrxrs    rTc s|rdd}dd}tndd}dd}tg}t|trF|j}n&t|tjr\t|}ntj dt dd|svt Sd }x|t |d kr||}xnt ||d d D]N\}} || |r|||d =Pq||| r|||d =|j|| | }PqW|d 7}q|W| r|ryht |t d j|krZtd d jdd|Djdj|Stdjdd|Djdj|SWn&tk rtj dt ddYnXtfdd|Djdj|S)a Helper to quickly define a set of alternative Literals, and makes sure to do longest-first testing when there is a conflict, regardless of the input order, but returns a C{L{MatchFirst}} for best performance. Parameters: - strs - a string of space-delimited literals, or a collection of string literals - caseless - (default=C{False}) - treat all literals as caseless - useRegex - (default=C{True}) - as an optimization, will generate a Regex object; otherwise, will generate a C{MatchFirst} object (if C{caseless=True}, or if creating a C{Regex} raises an exception) Example:: comp_oper = oneOf("< = > <= >= !=") var = Word(alphas) number = Word(nums) term = var | number comparison_expr = term + comp_oper + term print(comparison_expr.searchString("B = 12 AA=23 B<=AA AA>12")) prints:: [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']] cSs|j|jkS)N)r)rbrwrwrxryszoneOf..cSs|jj|jS)N)rr)rrlrwrwrxryscSs||kS)Nrw)rrlrwrwrxryscSs |j|S)N)r)rrlrwrwrxrysz6Invalid argument to oneOf, expected string or iterablerq)rrrrNrz[%s]css|]}t|VqdS)N)r)rsymrwrwrxrszoneOf..z | |css|]}tj|VqdS)N)rdr )rrmrwrwrxrsz7Exception creating Regex for oneOf, building MatchFirstc3s|]}|VqdS)Nrw)rrm)parseElementClassrwrxrs)rrrzrrrr5rrrrrrrrrr'rirKr) ZstrsrZuseRegexZisequalZmasksZsymbolsrZcurrrrw)rorxrSsL         ((cCsttt||S)a Helper to easily and clearly define a dictionary by specifying the respective patterns for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens in the proper order. The key pattern can include delimiting markers or punctuation, as long as they are suppressed, thereby leaving the significant key text. The value pattern can include named results, so that the C{Dict} results can include named token fields. Example:: text = "shape: SQUARE posn: upper left color: light blue texture: burlap" attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) print(OneOrMore(attr_expr).parseString(text).dump()) attr_label = label attr_value = Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join) # similar to Dict, but simpler call format result = dictOf(attr_label, attr_value).parseString(text) print(result.dump()) print(result['shape']) print(result.shape) # object attribute access works too print(result.asDict()) prints:: [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']] - color: light blue - posn: upper left - shape: SQUARE - texture: burlap SQUARE SQUARE {'color': 'light blue', 'shape': 'SQUARE', 'posn': 'upper left', 'texture': 'burlap'} )r r2r)rrrwrwrxrAs!cCs^tjdd}|j}d|_|d||d}|r@dd}ndd}|j||j|_|S) a Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the original parsed text. If the optional C{asString} argument is passed as C{False}, then the return value is a C{L{ParseResults}} containing any results names that were originally matched, and a single token containing the original matched text from the input string. So if the expression passed to C{L{originalTextFor}} contains expressions with defined results names, you must set C{asString} to C{False} if you want to preserve those results name values. Example:: src = "this is test bold text normal text " for tag in ("b","i"): opener,closer = makeHTMLTags(tag) patt = originalTextFor(opener + SkipTo(closer) + closer) print(patt.searchString(src)[0]) prints:: [' bold text '] ['text'] cSs|S)Nrw)rrrvrwrwrxry8sz!originalTextFor..F_original_start _original_endcSs||j|jS)N)rprq)rr5rvrwrwrxry=scSs&||jd|jdg|dd<dS)Nrprq)r)rr5rvrwrwrx extractText?sz$originalTextFor..extractText)r rrrer])r.ZasStringZ locMarkerZ endlocMarker matchExprrrrwrwrxrg s  cCst|jddS)zp Helper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty. cSs|dS)Nrrw)rvrwrwrxryJszungroup..)r-r)r.rwrwrxrhEscCs4tjdd}t|d|d|jjdS)a Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - locn_start = location where matched expression begins - locn_end = location where matched expression ends - value = the actual parsed results Be careful if the input text contains C{} characters, you may want to call C{L{ParserElement.parseWithTabs}} Example:: wd = Word(alphas) for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"): print(match) prints:: [[0, 'ljsdf', 5]] [[8, 'lksdjjf', 15]] [[18, 'lkkjj', 23]] cSs|S)Nrw)rr5rvrwrwrxry`szlocatedExpr..Z locn_startrZlocn_end)r rrrr)r.ZlocatorrwrwrxrjLsz\[]-*.$+^?()~ )r cCs |ddS)Nrrrrw)rr5rvrwrwrxryksryz\\0?[xX][0-9a-fA-F]+cCstt|djddS)Nrz\0x)unichrrulstrip)rr5rvrwrwrxrylsz \\0[0-7]+cCstt|ddddS)Nrrr)ruru)rr5rvrwrwrxrymsz\])rr z\wr8rrZnegatebodyr c sBddy djfddtj|jDStk r<dSXdS)a Helper to easily define string ranges for use in Word construction. Borrows syntax from regexp '[]' string range definitions:: srange("[0-9]") -> "0123456789" srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz" srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_" The input string must be enclosed in []'s, and the returned string is the expanded character set joined into a single string. The values enclosed in the []'s may be: - a single character - an escaped character with a leading backslash (such as C{\-} or C{\]}) - an escaped hex character with a leading C{'\x'} (C{\x21}, which is a C{'!'} character) (C{\0x##} is also supported for backwards compatibility) - an escaped octal character with a leading C{'\0'} (C{\041}, which is a C{'!'} character) - a range of any of the above, separated by a dash (C{'a-z'}, etc.) - any combination of the above (C{'aeiouy'}, C{'a-zA-Z0-9_$'}, etc.) cSs<t|ts|Sdjddtt|dt|ddDS)Nrcss|]}t|VqdS)N)ru)rrrwrwrxrsz+srange....rrr)rzr"rrord)prwrwrxryszsrange..rc3s|]}|VqdS)Nrw)rpart) _expandedrwrxrszsrange..N)r_reBracketExprrrxrK)rrw)r|rxr_rs  csfdd}|S)zt Helper method for defining parse actions that require matching at a specific column in the input text. cs"t||krt||ddS)Nzmatched token not at column %d)r9r)r)Zlocnr1)rrwrx verifyColsz!matchOnlyAtCol..verifyColrw)rr~rw)rrxrMs cs fddS)a Helper method for common parse actions that simply return a literal value. Especially useful when used with C{L{transformString}()}. Example:: num = Word(nums).setParseAction(lambda toks: int(toks[0])) na = oneOf("N/A NA").setParseAction(replaceWith(math.nan)) term = na | num OneOrMore(term).parseString("324 234 N/A 234") # -> [324, 234, nan, 234] csgS)Nrw)rr5rv)replStrrwrxryszreplaceWith..rw)rrw)rrxr\s cCs|dddS)a Helper parse action for removing quotation marks from parsed quoted strings. Example:: # by default, quotation marks are included in parsed results quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"] # use removeQuotes to strip quotation marks from parsed results quotedString.setParseAction(removeQuotes) quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["Now is the Winter of our Discontent"] rrrrsrw)rr5rvrwrwrxrZs c sNfdd}ytdtdj}Wntk rBt}YnX||_|S)aG Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional args are passed, they are forwarded to the given function as additional arguments after the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))}, which will convert the parsed data to an integer using base 16. Example (compare the last to example in L{ParserElement.transformString}:: hex_ints = OneOrMore(Word(hexnums)).setParseAction(tokenMap(int, 16)) hex_ints.runTests(''' 00 11 22 aa FF 0a 0d 1a ''') upperword = Word(alphas).setParseAction(tokenMap(str.upper)) OneOrMore(upperword).runTests(''' my kingdom for a horse ''') wd = Word(alphas).setParseAction(tokenMap(str.title)) OneOrMore(wd).setParseAction(' '.join).runTests(''' now is the winter of our discontent made glorious summer by this sun of york ''') prints:: 00 11 22 aa FF 0a 0d 1a [0, 17, 34, 170, 255, 10, 13, 26] my kingdom for a horse ['MY', 'KINGDOM', 'FOR', 'A', 'HORSE'] now is the winter of our discontent made glorious summer by this sun of york ['Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York'] csfdd|DS)Ncsg|]}|fqSrwrw)rZtokn)rr6rwrxrsz(tokenMap..pa..rw)rr5rv)rr6rwrxr}sztokenMap..parrH)rJrrKr{)r6rr}rLrw)rr6rxrms cCs t|jS)N)rr)rvrwrwrxryscCs t|jS)N)rlower)rvrwrwrxryscCst|tr|}t|| d}n|j}tttd}|rtjj t }t d|dt t t|t d|tddgdjd j d d t d }nd jddtD}tjj t t|B}t d|dt t t|j ttt d|tddgdjd j dd t d }ttd|d }|jdd j|jddjjjd|}|jdd j|jddjjjd|}||_||_||fS)zRInternal helper to construct opening and closing tag expressions, given a tag name)rz_-:rtag=/F)rrCcSs |ddkS)Nrrrw)rr5rvrwrwrxrysz_makeTags..rrcss|]}|dkr|VqdS)rNrw)rrrwrwrxrsz_makeTags..cSs |ddkS)Nrrrw)rr5rvrwrwrxryszrz)rzrrrr/r4r3r>rrrZr+r r2rrrmrrVrYrBr _Lrtitlerrir)tagStrZxmlZresnameZ tagAttrNameZ tagAttrValueZopenTagZprintablesLessRAbrackZcloseTagrwrwrx _makeTagss" T\..rcCs t|dS)a  Helper to construct opening and closing tag expressions for HTML, given a tag name. Matches tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values. Example:: text = 'More info at the pyparsing wiki page' # makeHTMLTags returns pyparsing expressions for the opening and closing tags as a 2-tuple a,a_end = makeHTMLTags("A") link_expr = a + SkipTo(a_end)("link_text") + a_end for link in link_expr.searchString(text): # attributes in the tag (like "href" shown here) are also accessible as named results print(link.link_text, '->', link.href) prints:: pyparsing -> http://pyparsing.wikispaces.com F)r)rrwrwrxrKscCs t|dS)z Helper to construct opening and closing tag expressions for XML, given a tag name. Matches tags only in the given upper/lower case. Example: similar to L{makeHTMLTags} T)r)rrwrwrxrLscs8|r|ddn|jddDfdd}|S)a< Helper to create a validating parse action to be used with start tags created with C{L{makeXMLTags}} or C{L{makeHTMLTags}}. Use C{withAttribute} to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as C{} or C{
}. Call C{withAttribute} with a series of attribute names and values. Specify the list of filter attributes names and values as: - keyword arguments, as in C{(align="right")}, or - as an explicit dict with C{**} operator, when an attribute name is also a Python reserved word, as in C{**{"class":"Customer", "align":"right"}} - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") ) For attribute names with a namespace prefix, you must use the second form. Attribute names are matched insensitive to upper/lower case. If just testing for C{class} (with or without a namespace), use C{L{withClass}}. To verify that the attribute exists, but without specifying a value, pass C{withAttribute.ANY_VALUE} as the value. Example:: html = '''
Some text
1 4 0 1 0
1,3 2,3 1,1
this has no type
''' div,div_end = makeHTMLTags("div") # only match div tag having a type attribute with value "grid" div_grid = div().setParseAction(withAttribute(type="grid")) grid_expr = div_grid + SkipTo(div | div_end)("body") for grid_header in grid_expr.searchString(html): print(grid_header.body) # construct a match with any div tag having a type attribute, regardless of the value div_any_type = div().setParseAction(withAttribute(type=withAttribute.ANY_VALUE)) div_expr = div_any_type + SkipTo(div | div_end)("body") for div_header in div_expr.searchString(html): print(div_header.body) prints:: 1 4 0 1 0 1 4 0 1 0 1,3 2,3 1,1 NcSsg|]\}}||fqSrwrw)rrrrwrwrxrQsz!withAttribute..cs^xXD]P\}}||kr&t||d||tjkr|||krt||d||||fqWdS)Nzno matching attribute z+attribute '%s' has value '%s', must be '%s')rre ANY_VALUE)rr5rZattrNameZ attrValue)attrsrwrxr}Rs zwithAttribute..pa)r)rZattrDictr}rw)rrxres 2 cCs|r d|nd}tf||iS)a Simplified version of C{L{withAttribute}} when matching on a div class - made difficult because C{class} is a reserved word in Python. Example:: html = '''
Some text
1 4 0 1 0
1,3 2,3 1,1
this <div> has no class
''' div,div_end = makeHTMLTags("div") div_grid = div().setParseAction(withClass("grid")) grid_expr = div_grid + SkipTo(div | div_end)("body") for grid_header in grid_expr.searchString(html): print(grid_header.body) div_any_type = div().setParseAction(withClass(withAttribute.ANY_VALUE)) div_expr = div_any_type + SkipTo(div | div_end)("body") for div_header in div_expr.searchString(html): print(div_header.body) prints:: 1 4 0 1 0 1 4 0 1 0 1,3 2,3 1,1 z%s:classclass)re)Z classname namespaceZ classattrrwrwrxrk\s (rcCst}||||B}x`t|D]R\}}|d dd\}} } } | dkrTd|nd|} | dkr|dksxt|dkrtd|\} }tj| }| tjkrd| dkrt||t|t |}n| dkr|dk rt|||t|t ||}nt||t|t |}nD| dkrZt|| |||t|| |||}ntd n| tj krH| dkrt |t st |}t|j |t||}n| dkr|dk rt|||t|t ||}nt||t|t |}nD| dkr>t|| |||t|| |||}ntd ntd | r`|j| ||j| |BK}|}q"W||K}|S) a Helper method for constructing grammars of expressions made up of operators working in a precedence hierarchy. Operators may be unary or binary, left- or right-associative. Parse actions can also be attached to operator expressions. The generated parser will also recognize the use of parentheses to override operator precedences (see example below). Note: if you define a deep operator list, you may see performance issues when using infixNotation. See L{ParserElement.enablePackrat} for a mechanism to potentially improve your parser performance. Parameters: - baseExpr - expression representing the most basic element for the nested - opList - list of tuples, one for each operator precedence level in the expression grammar; each tuple is of the form (opExpr, numTerms, rightLeftAssoc, parseAction), where: - opExpr is the pyparsing expression for the operator; may also be a string, which will be converted to a Literal; if numTerms is 3, opExpr is a tuple of two expressions, for the two operators separating the 3 terms - numTerms is the number of terms for this operator (must be 1, 2, or 3) - rightLeftAssoc is the indicator whether the operator is right or left associative, using the pyparsing-defined constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. - parseAction is the parse action to be associated with expressions matching this operator expression (the parse action tuple member may be omitted) - lpar - expression for matching left-parentheses (default=C{Suppress('(')}) - rpar - expression for matching right-parentheses (default=C{Suppress(')')}) Example:: # simple example of four-function arithmetic with ints and variable names integer = pyparsing_common.signed_integer varname = pyparsing_common.identifier arith_expr = infixNotation(integer | varname, [ ('-', 1, opAssoc.RIGHT), (oneOf('* /'), 2, opAssoc.LEFT), (oneOf('+ -'), 2, opAssoc.LEFT), ]) arith_expr.runTests(''' 5+3*6 (5+3)*6 -2--11 ''', fullDump=False) prints:: 5+3*6 [[5, '+', [3, '*', 6]]] (5+3)*6 [[[5, '+', 3], '*', 6]] -2--11 [[['-', 2], '-', ['-', 11]]] Nrroz%s termz %s%s termrqz@if numterms=3, opExpr must be a tuple or list of two expressionsrrz6operator must be unary (1), binary (2), or ternary (3)z2operator must indicate right or left associativity)N)rrrrrirTLEFTrrrRIGHTrzrr.r)ZbaseExprZopListZlparZrparrZlastExprrZoperDefZopExprZarityZrightLeftAssocr}ZtermNameZopExpr1ZopExpr2ZthisExprrsrwrwrxrisR;    &       &   z4"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*"z string enclosed in double quotesz4'(?:[^'\n\r\\]|(?:'')|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*'z string enclosed in single quotesz*quotedString using single or double quotesuzunicode string literalcCs||krtd|dkr(t|to,t|tr t|dkrt|dkr|dk rtt|t||tjddj dd}n$t j t||tjj dd}nx|dk rtt|t |t |ttjddj dd}n4ttt |t |ttjddj d d}ntd t }|dk rb|tt|t||B|Bt|K}n$|tt|t||Bt|K}|jd ||f|S) a~ Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default=C{"("}); can also be a pyparsing expression - closer - closing character for a nested list (default=C{")"}); can also be a pyparsing expression - content - expression for items within the nested lists (default=C{None}) - ignoreExpr - expression for ignoring opening and closing delimiters (default=C{quotedString}) If an expression is not provided for the content argument, the nested expression will capture all whitespace-delimited content between delimiters as a list of separate values. Use the C{ignoreExpr} argument to define expressions that may contain opening or closing characters that should not be treated as opening or closing characters for nesting, such as quotedString or a comment expression. Specify multiple expressions using an C{L{Or}} or C{L{MatchFirst}}. The default is L{quotedString}, but if no expressions are to be ignored, then pass C{None} for this argument. Example:: data_type = oneOf("void int short long char float double") decl_data_type = Combine(data_type + Optional(Word('*'))) ident = Word(alphas+'_', alphanums+'_') number = pyparsing_common.number arg = Group(decl_data_type + ident) LPAR,RPAR = map(Suppress, "()") code_body = nestedExpr('{', '}', ignoreExpr=(quotedString | cStyleComment)) c_function = (decl_data_type("type") + ident("name") + LPAR + Optional(delimitedList(arg), [])("args") + RPAR + code_body("body")) c_function.ignore(cStyleComment) source_code = ''' int is_odd(int x) { return (x%2); } int dec_to_hex(char hchar) { if (hchar >= '0' && hchar <= '9') { return (ord(hchar)-ord('0')); } else { return (10+ord(hchar)-ord('A')); } } ''' for func in c_function.searchString(source_code): print("%(name)s (%(type)s) args: %(args)s" % func) prints:: is_odd (int) args: [['int', 'x']] dec_to_hex (int) args: [['char', 'hchar']] z.opening and closing strings cannot be the sameNrr)r cSs |djS)Nr)r)rvrwrwrxry9sznestedExpr..cSs |djS)Nr)r)rvrwrwrxry<scSs |djS)Nr)r)rvrwrwrxryBscSs |djS)Nr)r)rvrwrwrxryFszOopening and closing arguments must be strings if no content expression is givenznested %s%s expression)rrzrrr rr r$rNrrCrrrrr+r2ri)openerZcloserZcontentrOrrwrwrxrPs4:     *$c sfdd}fdd}fdd}ttjdj}ttj|jd}tj|jd }tj|jd } |rtt||t|t|t|| } n$tt|t|t|t|} |j t t| jd S) a Helper method for defining space-delimited indentation blocks, such as those used to define block statements in Python source code. Parameters: - blockStatementExpr - expression defining syntax of statement that is repeated within the indented block - indentStack - list created by caller to manage indentation stack (multiple statementWithIndentedBlock expressions within a single grammar should share a common indentStack) - indent - boolean indicating whether block must be indented beyond the the current level; set to False for block of left-most statements (default=C{True}) A valid block must contain at least one C{blockStatement}. Example:: data = ''' def A(z): A1 B = 100 G = A2 A2 A3 B def BB(a,b,c): BB1 def BBA(): bba1 bba2 bba3 C D def spam(x,y): def eggs(z): pass ''' indentStack = [1] stmt = Forward() identifier = Word(alphas, alphanums) funcDecl = ("def" + identifier + Group( "(" + Optional( delimitedList(identifier) ) + ")" ) + ":") func_body = indentedBlock(stmt, indentStack) funcDef = Group( funcDecl + func_body ) rvalue = Forward() funcCall = Group(identifier + "(" + Optional(delimitedList(rvalue)) + ")") rvalue << (funcCall | identifier | Word(nums)) assignment = Group(identifier + "=" + rvalue) stmt << ( funcDef | assignment | identifier ) module_body = OneOrMore(stmt) parseTree = module_body.parseString(data) parseTree.pprint() prints:: [['def', 'A', ['(', 'z', ')'], ':', [['A1'], [['B', '=', '100']], [['G', '=', 'A2']], ['A2'], ['A3']]], 'B', ['def', 'BB', ['(', 'a', 'b', 'c', ')'], ':', [['BB1'], [['def', 'BBA', ['(', ')'], ':', [['bba1'], ['bba2'], ['bba3']]]]]], 'C', 'D', ['def', 'spam', ['(', 'x', 'y', ')'], ':', [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]] csN|t|krdSt||}|dkrJ|dkr>t||dt||ddS)Nrrzillegal nestingznot a peer entryrsrs)rr9r!r)rr5rvcurCol) indentStackrwrxcheckPeerIndents     z&indentedBlock..checkPeerIndentcs2t||}|dkr"j|n t||ddS)Nrrznot a subentryrs)r9rr)rr5rvr)rrwrxcheckSubIndents   z%indentedBlock..checkSubIndentcsN|t|krdSt||}o4|dko4|dksBt||djdS)Nrrrqznot an unindentrsr:)rr9rr)rr5rvr)rrwrx checkUnindents    z$indentedBlock..checkUnindentz INDENTrZUNINDENTzindented block) rrrrr rrirrrrk) ZblockStatementExprrrrrrr!rZPEERZUNDENTZsmExprrw)rrxrfQsN   ,z#[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]z[\0xa1-\0xbf\0xd7\0xf7]z_:zany tagzgt lt amp nbsp quot aposz><& "'z &(?Prnz);zcommon HTML entitycCs tj|jS)zRHelper parser action to replace common HTML entities with their special characters)_htmlEntityMaprZentity)rvrwrwrxr[sz/\*(?:[^*]|\*(?!/))*z*/zC style commentzz HTML commentz.*z rest of linez//(?:\\\n|[^\n])*z // commentzC++ style commentz#.*zPython style comment)rz commaItem)rc@seZdZdZeeZeeZe e j dj eZ e ej dj eedZedj dj eZej edej ej dZejd d eeeed jeBj d Zejeed j dj eZedj dj eZeeBeBjZedj dj eZe ededj dZedj dZ edj dZ!e!de!dj dZ"ee!de!d>dee!de!d?j dZ#e#j$d d d!e j d"Z%e&e"e%Be#Bj d#j d#Z'ed$j d%Z(e)d@d'd(Z*e)dAd*d+Z+ed,j d-Z,ed.j d/Z-ed0j d1Z.e/je0jBZ1e)d2d3Z2e&e3e4d4e5e e6d4d5ee7d6jj d7Z8e9ee:j;e8Bd8d9j d:Zd=S)Brna Here are some common low-level expressions that may be useful in jump-starting parser development: - numeric forms (L{integers}, L{reals}, L{scientific notation}) - common L{programming identifiers} - network addresses (L{MAC}, L{IPv4}, L{IPv6}) - ISO8601 L{dates} and L{datetime} - L{UUID} - L{comma-separated list} Parse actions: - C{L{convertToInteger}} - C{L{convertToFloat}} - C{L{convertToDate}} - C{L{convertToDatetime}} - C{L{stripHTMLTags}} - C{L{upcaseTokens}} - C{L{downcaseTokens}} Example:: pyparsing_common.number.runTests(''' # any int or real number, returned as the appropriate type 100 -100 +100 3.14159 6.02e23 1e-12 ''') pyparsing_common.fnumber.runTests(''' # any int or real number, returned as float 100 -100 +100 3.14159 6.02e23 1e-12 ''') pyparsing_common.hex_integer.runTests(''' # hex numbers 100 FF ''') pyparsing_common.fraction.runTests(''' # fractions 1/2 -3/4 ''') pyparsing_common.mixed_integer.runTests(''' # mixed fractions 1 1/2 -3/4 1-3/4 ''') import uuid pyparsing_common.uuid.setParseAction(tokenMap(uuid.UUID)) pyparsing_common.uuid.runTests(''' # uuid 12345678-1234-5678-1234-567812345678 ''') prints:: # any int or real number, returned as the appropriate type 100 [100] -100 [-100] +100 [100] 3.14159 [3.14159] 6.02e23 [6.02e+23] 1e-12 [1e-12] # any int or real number, returned as float 100 [100.0] -100 [-100.0] +100 [100.0] 3.14159 [3.14159] 6.02e23 [6.02e+23] 1e-12 [1e-12] # hex numbers 100 [256] FF [255] # fractions 1/2 [0.5] -3/4 [-0.75] # mixed fractions 1 [1] 1/2 [0.5] -3/4 [-0.75] 1-3/4 [1.75] # uuid 12345678-1234-5678-1234-567812345678 [UUID('12345678-1234-5678-1234-567812345678')] integerz hex integerrtz[+-]?\d+zsigned integerrfractioncCs|d|dS)Nrrrrsrw)rvrwrwrxryszpyparsing_common.r8z"fraction or mixed integer-fractionz [+-]?\d+\.\d*z real numberz+[+-]?\d+([eE][+-]?\d+|\.\d*([eE][+-]?\d+)?)z$real number with scientific notationz[+-]?\d+\.?\d*([eE][+-]?\d+)?fnumberrB identifierzK(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}z IPv4 addressz[0-9a-fA-F]{1,4} hex_integerrzfull IPv6 addressrrBz::zshort IPv6 addresscCstdd|DdkS)Ncss|]}tjj|rdVqdS)rrN)rn _ipv6_partr)rrfrwrwrxrsz,pyparsing_common...rw)rH)rvrwrwrxrysz::ffff:zmixed IPv6 addressz IPv6 addressz:[0-9a-fA-F]{2}([:.-])[0-9a-fA-F]{2}(?:\1[0-9a-fA-F]{2}){4}z MAC address%Y-%m-%dcsfdd}|S)a Helper to create a parse action for converting parsed date string to Python datetime.date Params - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%d"}) Example:: date_expr = pyparsing_common.iso8601_date.copy() date_expr.setParseAction(pyparsing_common.convertToDate()) print(date_expr.parseString("1999-12-31")) prints:: [datetime.date(1999, 12, 31)] csLytj|djStk rF}zt||t|WYdd}~XnXdS)Nr)rstrptimeZdaterrr{)rr5rvve)fmtrwrxcvt_fnsz.pyparsing_common.convertToDate..cvt_fnrw)rrrw)rrx convertToDates zpyparsing_common.convertToDate%Y-%m-%dT%H:%M:%S.%fcsfdd}|S)a Helper to create a parse action for converting parsed datetime string to Python datetime.datetime Params - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%dT%H:%M:%S.%f"}) Example:: dt_expr = pyparsing_common.iso8601_datetime.copy() dt_expr.setParseAction(pyparsing_common.convertToDatetime()) print(dt_expr.parseString("1999-12-31T23:59:59.999")) prints:: [datetime.datetime(1999, 12, 31, 23, 59, 59, 999000)] csHytj|dStk rB}zt||t|WYdd}~XnXdS)Nr)rrrrr{)rr5rvr)rrwrxrsz2pyparsing_common.convertToDatetime..cvt_fnrw)rrrw)rrxconvertToDatetimes z"pyparsing_common.convertToDatetimez7(?P\d{4})(?:-(?P\d\d)(?:-(?P\d\d))?)?z ISO8601 datez(?P\d{4})-(?P\d\d)-(?P\d\d)[T ](?P\d\d):(?P\d\d)(:(?P\d\d(\.\d*)?)?)?(?PZ|[+-]\d\d:?\d\d)?zISO8601 datetimez2[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}UUIDcCstjj|dS)a Parse action to remove HTML tags from web page HTML source Example:: # strip HTML links from normal text text = 'More info at the
pyparsing wiki page' td,td_end = makeHTMLTags("TD") table_text = td + SkipTo(td_end).setParseAction(pyparsing_common.stripHTMLTags)("body") + td_end print(table_text.parseString(text).body) # -> 'More info at the pyparsing wiki page' r)rn_html_stripperr)rr5rrwrwrx stripHTMLTagss zpyparsing_common.stripHTMLTagsra)rz rr)rzcomma separated listcCs t|jS)N)rr)rvrwrwrxryscCs t|jS)N)rr)rvrwrwrxrysN)rrB)rrB)r)r)?rrrrrmruZconvertToIntegerfloatZconvertToFloatr/rRrirrrDrr'Zsigned_integerrrxrrZ mixed_integerrHrealZsci_realrnumberrr4r3rZ ipv4_addressrZ_full_ipv6_addressZ_short_ipv6_addressr~Z_mixed_ipv6_addressr Z ipv6_addressZ mac_addressrrrZ iso8601_dateZiso8601_datetimeuuidr7r6rrrrrrVr. _commasepitemr@rYrZcomma_separated_listrdrBrwrwrwrxrnsN"" 2   8__main__Zselectfromz_$r])rbcolumnsrjZtablesZcommandaK # '*' as column list and dotted table name select * from SYS.XYZZY # caseless match on "SELECT", and casts back to "select" SELECT * from XYZZY, ABC # list of column names, and mixed case SELECT keyword Select AA,BB,CC from Sys.dual # multiple tables Select A, B, C from Sys.dual, Table2 # invalid SELECT keyword - should fail Xelect A, B, C from Sys.dual # incomplete command - should fail Select # invalid column name - should fail Select ^^^ frox Sys.dual z] 100 -100 +100 3.14159 6.02e23 1e-12 z 100 FF z6 12345678-1234-5678-1234-567812345678 )rq)raF)N)FT)T)r)T)r __version__Z__versionTime__ __author__rweakrefrrrr~rrdrrr"r<rr_threadr ImportErrorZ threadingrrZ ordereddict__all__r version_infor;rmaxsizerr{rchrrurrHrrreversedrrrr6r r rIZmaxintZxrangerZ __builtin__rZfnamerrJrrrrrrZascii_uppercaseZascii_lowercaser4rRrDr3rkrZ printablerVrKrrr!r#r&rr"MutableMappingregisterr9rJrGr/r2r4rQrMr$r,r rrrrQrrrrlr/r'r%r r.r0rrrr*r)r1r0r rrrr rrrrJrr2rMrNrr(rrVr-r rr r+rrbr@r<rrOrNrrSrArgrhrjrirCrIrHrar`rZ _escapedPuncZ_escapedHexCharZ_escapedOctCharUNICODEZ _singleCharZ _charRangermr}r_rMr\rZrmrdrBrrKrLrerrkrTrrrirUr>r^rYrcrPrfr5rWr7r6rrrrr;r[r8rErr]r?r=rFrXrrr:rnrZ selectTokenZ fromTokenZidentZ columnNameZcolumnNameListZ columnSpecZ tableNameZ tableNameListZ simpleSQLrrrrrrrwrwrwrx=s                 8      @d &A= I G3pLOD|M &#@sQ,A,    I# %     &0 ,   ? #k Zr   (  0     "__pycache__/retrying.cpython-36.pyc000064400000017525152347724720013274 0ustar003 Pf&@slddlZddlmZddlZddlZddlZdZddZGdddeZ Gdd d eZ Gd d d e Z dS) N)sixi?csBtdkr,tdr,dd}|dSfdd}|SdS)z Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object rcstjfdd}|S)Ncstjf||S)N)Retryingcall)argskw)f/usr/lib/python3.6/retrying.py wrapped_f$sz-retry..wrap_simple..wrapped_f)rwraps)rr r )rr wrap_simple"szretry..wrap_simplecstjfdd}|S)Ncstjf||S)N)rr)rr)dargsdkwrr r r /sz&retry..wrap..wrapped_f)rr )rr )rr)rr wrap-szretry..wrapN)lencallable)rrr rr )rrr retrys  rc@sneZdZdddZddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ ddZ ddZdS)rNFcs |dkr dn||_|dkrdn||_|dkr0dn||_|dkrBdn||_|dkrTdn||_|dkrfdn||_| dkrxdn| |_| dkrdn| |_| dkrtn| |_ |dkrdn||_ g|dk r̈j |j |dk rj |j |dk r||_n&|dkr fdd|_n t|||_ddg|dk r6j |j|dk sJ|dk rVj |j|dk sj| dk rvj |j| dk s| dk rj |j|dk r||_n&|dkr‡fd d|_n t|||_| dkr|j|_n| |_| dkr|j|_n| |_||_dS) NdirrcstfddDS)Nc3s|]}|VqdS)Nr ).0r)attemptsdelayr r asz6Retrying.__init__....)any)rr) stop_funcs)rrr asz#Retrying.__init__..c_sdS)Nrr )rkwargsr r r rhscstfddDS)Nc3s|]}|VqdS)Nr )rr)rrr r rysz6Retrying.__init__....)max)rr) wait_funcs)rrr rys)_stop_max_attempt_number_stop_max_delay _wait_fixed_wait_random_min_wait_random_max_wait_incrementing_start_wait_incrementing_increment_wait_exponential_multiplierMAX_WAIT_wait_exponential_max_wait_jitter_maxappendstop_after_attemptstop_after_delaystopgetattr fixed_sleep random_sleepincrementing_sleepexponential_sleepwait always_reject_retry_on_exception never_reject_retry_on_result_wrap_exception)selfr.r4Zstop_max_attempt_numberZstop_max_delayZ wait_fixedZwait_random_minZwait_random_maxZwait_incrementing_startZwait_incrementing_incrementZwait_exponential_multiplierZwait_exponential_maxZretry_on_exceptionZretry_on_resultwrap_exceptionZ stop_funcZ wait_funcZwait_jitter_maxr )rrr __init__:sR                 zRetrying.__init__cCs ||jkS)z;Stop after the previous attempt >= stop_max_attempt_number.)r )r:previous_attempt_numberdelay_since_first_attempt_msr r r r,szRetrying.stop_after_attemptcCs ||jkS)z=Stop after the time from the first attempt >= stop_max_delay.)r!)r:r=r>r r r r-szRetrying.stop_after_delaycCsdS)z#Don't sleep at all before retrying.rr )r:r=r>r r r no_sleepszRetrying.no_sleepcCs|jS)z0Sleep a fixed amount of time between each retry.)r")r:r=r>r r r r0szRetrying.fixed_sleepcCstj|j|jS)zISleep a random amount of time between wait_random_min and wait_random_max)randomZrandintr#r$)r:r=r>r r r r1szRetrying.random_sleepcCs$|j|j|d}|dkr d}|S)z Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment rr)r%r&)r:r=r>resultr r r r2szRetrying.incrementing_sleepcCs2d|}|j|}||jkr"|j}|dkr.d}|S)Nr)r'r))r:r=r>ZexprAr r r r3s  zRetrying.exponential_sleepcCsdS)NFr )r:rAr r r r7szRetrying.never_rejectcCsdS)NTr )r:rAr r r r5szRetrying.always_rejectcCs4d}|jr ||j|jdO}n||j|jO}|S)NFr) has_exceptionr6valuer8)r:attemptZrejectr r r should_rejects zRetrying.should_rejectc Ostttjd}d}xyt||||d}Wn tj}t||d}YnX|j|sh|j|jStttjd|}|j ||r|j r|j r|jqt |n<|j ||} |j rtj|j } | td| } tj| d|d7}qWdS)NirFTrg@@)introundtimeAttemptsysexc_inforFgetr9r.rC RetryErrorr4r*r@rsleep) r:fnrrZ start_timeattempt_numberrEtbr>rOZjitterr r r rs*      z Retrying.call)NNNNNNNNNNNNNFNNN)__name__ __module__ __qualname__r<r,r-r?r0r1r2r3r7r5rFrr r r r r8s0 F   rc@s*eZdZdZddZd ddZddZd S) rJz An Attempt encapsulates a call to a target function that may end as a normal return value from the function or an Exception depending on what occurred during the execution. cCs||_||_||_dS)N)rDrQrC)r:rDrQrCr r r r<szAttempt.__init__FcCs@|jr6|rt|qs *!__pycache__/six.cpython-36.opt-1.pyc000064400000057532152347724720013175 0ustar003 PfuI@srdZddlmZddlZddlZddlZddlZddlZdZdZ ej ddkZ ej ddkZ ej dddzkZ e refZefZefZeZeZejZnefZeefZeejfZeZeZejjd red|ZnLGd d d eZ ye!e Wn e"k r ed~ZYn XedZ[ ddZ#ddZ$GdddeZ%Gddde%Z&Gdddej'Z(Gddde%Z)GdddeZ*e*e+Z,Gddde(Z-e)ddd d!e)d"d#d$d%d"e)d&d#d#d'd&e)d(d)d$d*d(e)d+d)d,e)d-d#d$d.d-e)d/d0d0d1d/e)d2d0d0d/d2e)d3d)d$d4d3e)d5d)e rd6nd7d8e)d9d)d:e)d;de)d!d!d e)d?d?d@e)dAdAd@e)dBdBd@e)d4d)d$d4d3e)dCd#d$dDdCe)dEd#d#dFdEe&d$d)e&dGdHe&dIdJe&dKdLdMe&dNdOdNe&dPdQdRe&dSdTdUe&dVdWdXe&dY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Cd;ZZdDd=Z[ej\dEZ]ej\dFZ^ej\dGZ_e#eXdHe#eYdIe#eZdJe#e[dKe rdLdMZ`dNdOZaebZcddldZdedjedPjfZg[dejhdZiejjZkelZmddlnZnenjoZoenjpZpdQZqej d d k rdRZrdSZsn dTZrdUZsnjdVdMZ`dWdOZaecZcebZgdXdYZidZd[ZkejtejuevZmddloZoeojoZoZpd\ZqdRZrdSZse#e`d]e#ead^d_dQZwd`dTZxdadUZye reze4j{dbZ|ddcddZ}nddedfZ|e|dgej dddk re|dhn.ej dddk r8e|din djdkZ~eze4j{dldZedk rjdmdnZej dddk reZdodnZe#e}dpej dddk rejejfdqdrZnejZdsdtZdudvZdwdxZgZe+Zejdydk rge_ejrbx>eejD]0\ZZeej+dkr*ej1e+kr*eje=Pq*W[[ejje,dS(z6Utilities for writing code that runs on Python 2 and 3)absolute_importNz'Benjamin Peterson z1.10.0javac@seZdZddZdS)XcCsdS)Nrrl)selfr r /usr/lib/python3.6/six.py__len__>sz X.__len__N)__name__ __module__ __qualname__r r r r r r <sr ?cCs ||_dS)z Add documentation to a function.N)__doc__)funcdocr r r _add_docKsrcCst|tj|S)z7Import module, returning the module after the last dot.) __import__sysmodules)namer r r _import_modulePsrc@seZdZddZddZdS) _LazyDescrcCs ||_dS)N)r)r rr r r __init__Xsz_LazyDescr.__init__c CsB|j}t||j|yt|j|jWntk r<YnX|S)N)_resolvesetattrrdelattr __class__AttributeError)r objtpresultr r r __get__[sz_LazyDescr.__get__N)rrrrr%r r r r rVsrcs.eZdZdfdd ZddZddZZS) MovedModuleNcs2tt|j|tr(|dkr |}||_n||_dS)N)superr&rPY3mod)r roldnew)r r r ris zMovedModule.__init__cCs t|jS)N)rr))r r r r rrszMovedModule._resolvecCs"|j}t||}t||||S)N)rgetattrr)r attr_modulevaluer r r __getattr__us  zMovedModule.__getattr__)N)rrrrrr0 __classcell__r r )r r r&gs r&cs(eZdZfddZddZgZZS) _LazyModulecstt|j||jj|_dS)N)r'r2rr r)r r)r r r r~sz_LazyModule.__init__cCs ddg}|dd|jD7}|S)NrrcSsg|] }|jqSr )r).0r-r r r sz'_LazyModule.__dir__..)_moved_attributes)r Zattrsr r r __dir__sz_LazyModule.__dir__)rrrrr6r5r1r r )r r r2|s r2cs&eZdZdfdd ZddZZS)MovedAttributeNcsdtt|j|trH|dkr |}||_|dkr@|dkr<|}n|}||_n||_|dkrZ|}||_dS)N)r'r7rr(r)r-)r rZold_modZnew_modZold_attrZnew_attr)r r r rszMovedAttribute.__init__cCst|j}t||jS)N)rr)r,r-)r moduler r r rs zMovedAttribute._resolve)NN)rrrrrr1r r )r r r7sr7c@sVeZdZdZddZddZddZdd d Zd d Zd dZ ddZ ddZ e Z dS)_SixMetaPathImporterz A meta path importer to import six.moves and its submodules. This class implements a PEP302 finder and loader. It should be compatible with Python 2.5 and all existing versions of Python3 cCs||_i|_dS)N)r known_modules)r Zsix_module_namer r r rsz_SixMetaPathImporter.__init__cGs&x |D]}||j|jd|<qWdS)N.)r:r)r r)Z fullnamesfullnamer r r _add_modules z _SixMetaPathImporter._add_modulecCs|j|jd|S)Nr;)r:r)r r<r r r _get_modulesz _SixMetaPathImporter._get_moduleNcCs||jkr|SdS)N)r:)r r<pathr r r find_modules z _SixMetaPathImporter.find_modulec Cs0y |j|Stk r*td|YnXdS)Nz!This loader does not know module )r:KeyError ImportError)r r<r r r Z __get_modules z!_SixMetaPathImporter.__get_modulec CsRy tj|Stk rYnX|j|}t|tr>|j}n||_|tj|<|S)N)rrrA _SixMetaPathImporter__get_module isinstancer&r __loader__)r r<r)r r r load_modules     z _SixMetaPathImporter.load_modulecCst|j|dS)z Return true, if the named module is a package. We need this method to get correct spec objects with Python 3.4 (see PEP451) __path__)hasattrrC)r r<r r r is_packagesz_SixMetaPathImporter.is_packagecCs|j|dS)z;Return None Required, if is_package is implementedN)rC)r r<r r r get_codes z_SixMetaPathImporter.get_code)N) rrrrrr=r>r@rCrFrIrJ get_sourcer r r r r9s  r9c@seZdZdZgZdS) _MovedItemszLazy loading of moved objectsN)rrrrrGr r r r rLsrLZ cStringIOioStringIOfilter itertoolsbuiltinsZifilter filterfalseZ ifilterfalseinputZ __builtin__Z raw_inputinternrmapimapgetcwdosZgetcwdugetcwdbrangeZxrangeZ reload_module importlibZimpreloadreduce functoolsZ shlex_quoteZpipesZshlexZquoteUserDict collectionsUserList UserStringzipZizip zip_longestZ izip_longestZ configparserZ ConfigParsercopyregZcopy_regZdbm_gnuZgdbmzdbm.gnuZ _dummy_threadZ dummy_threadZhttp_cookiejarZ cookielibzhttp.cookiejarZ http_cookiesZCookiez http.cookiesZ html_entitiesZhtmlentitydefsz html.entitiesZ html_parserZ HTMLParserz html.parserZ http_clientZhttplibz http.clientZemail_mime_multipartzemail.MIMEMultipartzemail.mime.multipartZemail_mime_nonmultipartzemail.MIMENonMultipartzemail.mime.nonmultipartZemail_mime_textzemail.MIMETextzemail.mime.textZemail_mime_basezemail.MIMEBasezemail.mime.baseZBaseHTTPServerz http.serverZ CGIHTTPServerZSimpleHTTPServerZcPicklepickleZqueueZQueuereprlibreprZ socketserverZ SocketServer_threadZthreadZtkinterZTkinterZtkinter_dialogZDialogztkinter.dialogZtkinter_filedialogZ FileDialogztkinter.filedialogZtkinter_scrolledtextZ ScrolledTextztkinter.scrolledtextZtkinter_simpledialogZ SimpleDialogztkinter.simpledialogZ tkinter_tixZTixz tkinter.tixZ tkinter_ttkZttkz tkinter.ttkZtkinter_constantsZ Tkconstantsztkinter.constantsZ tkinter_dndZTkdndz tkinter.dndZtkinter_colorchooserZtkColorChooserztkinter.colorchooserZtkinter_commondialogZtkCommonDialogztkinter.commondialogZtkinter_tkfiledialogZ tkFileDialogZ tkinter_fontZtkFontz tkinter.fontZtkinter_messageboxZ tkMessageBoxztkinter.messageboxZtkinter_tksimpledialogZtkSimpleDialogZ urllib_parsez.moves.urllib_parsez urllib.parseZ urllib_errorz.moves.urllib_errorz urllib.errorZurllibz .moves.urllibZurllib_robotparser robotparserzurllib.robotparserZ xmlrpc_clientZ xmlrpclibz xmlrpc.clientZ xmlrpc_serverZSimpleXMLRPCServerz xmlrpc.serverZwin32winreg_winregzmoves.z.movesmovesc@seZdZdZdS)Module_six_moves_urllib_parsez7Lazy loading of moved objects in six.moves.urllib_parseN)rrrrr r r r rn@srnZ ParseResultZurlparseZ SplitResultZparse_qsZ parse_qslZ urldefragZurljoinZurlsplitZ urlunparseZ urlunsplitZ quote_plusZunquoteZ unquote_plusZ urlencodeZ splitqueryZsplittagZ splituserZ uses_fragmentZ uses_netlocZ uses_paramsZ uses_queryZ uses_relativezmoves.urllib_parsezmoves.urllib.parsec@seZdZdZdS)Module_six_moves_urllib_errorz7Lazy loading of moved objects in six.moves.urllib_errorN)rrrrr r r r rohsroZURLErrorZurllib2Z HTTPErrorZContentTooShortErrorz.moves.urllib.errorzmoves.urllib_errorzmoves.urllib.errorc@seZdZdZdS)Module_six_moves_urllib_requestz9Lazy loading of moved objects in six.moves.urllib_requestN)rrrrr r r r rp|srpZurlopenzurllib.requestZinstall_openerZ build_openerZ pathname2urlZ url2pathnameZ getproxiesZRequestZOpenerDirectorZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZ ProxyHandlerZ BaseHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZ HTTPHandlerZ HTTPSHandlerZ FileHandlerZ FTPHandlerZCacheFTPHandlerZUnknownHandlerZHTTPErrorProcessorZ urlretrieveZ urlcleanupZ URLopenerZFancyURLopenerZ proxy_bypassz.moves.urllib.requestzmoves.urllib_requestzmoves.urllib.requestc@seZdZdZdS) Module_six_moves_urllib_responsez:Lazy loading of moved objects in six.moves.urllib_responseN)rrrrr r r r rqsrqZaddbasezurllib.responseZ addclosehookZaddinfoZ addinfourlz.moves.urllib.responsezmoves.urllib_responsezmoves.urllib.responsec@seZdZdZdS)#Module_six_moves_urllib_robotparserz=Lazy loading of moved objects in six.moves.urllib_robotparserN)rrrrr r r r rrsrrZRobotFileParserz.moves.urllib.robotparserzmoves.urllib_robotparserzmoves.urllib.robotparserc@sNeZdZdZgZejdZejdZejdZ ejdZ ejdZ ddZ d S) Module_six_moves_urllibzICreate a six.moves.urllib namespace that resembles the Python 3 namespacezmoves.urllib_parsezmoves.urllib_errorzmoves.urllib_requestzmoves.urllib_responsezmoves.urllib_robotparsercCsdddddgS)Nparseerrorrequestresponserjr )r r r r r6szModule_six_moves_urllib.__dir__N) rrrrrG _importerr>rtrurvrwrjr6r r r r rss     rsz moves.urllibcCstt|j|dS)zAdd an item to six.moves.N)rrLr)Zmover r r add_movesrycCsXytt|WnDtk rRy tj|=Wn"tk rLtd|fYnXYnXdS)zRemove item from six.moves.zno such move, %rN)rrLr!rm__dict__rA)rr r r remove_moves r{__func____self__ __closure____code__ __defaults__ __globals__im_funcZim_selfZ func_closureZ func_codeZ func_defaultsZ func_globalscCs|jS)N)next)itr r r advance_iterator srcCstddt|jDS)Ncss|]}d|jkVqdS)__call__N)rz)r3klassr r r szcallable..)anytype__mro__)r"r r r callablesrcCs|S)Nr )unboundr r r get_unbound_functionsrcCs|S)Nr )rclsr r r create_unbound_methodsrcCs|jS)N)r)rr r r r"scCstj|||jS)N)types MethodTyper )rr"r r r create_bound_method%srcCstj|d|S)N)rr)rrr r r r(sc@seZdZddZdS)IteratorcCst|j|S)N)r__next__)r r r r r-sz Iterator.nextN)rrrrr r r r r+srz3Get the function out of a possibly unbound functioncKst|jf|S)N)iterkeys)dkwr r r iterkeys>srcKst|jf|S)N)rvalues)rrr r r itervaluesAsrcKst|jf|S)N)ritems)rrr r r iteritemsDsrcKst|jf|S)N)rZlists)rrr r r iterlistsGsrrrrcKs |jf|S)N)r)rrr r r rPscKs |jf|S)N)r)rrr r r rSscKs |jf|S)N)r)rrr r r rVscKs |jf|S)N)r)rrr r r rYsviewkeys viewvalues viewitemsz1Return an iterator over the keys of a dictionary.z3Return an iterator over the values of a dictionary.z?Return an iterator over the (key, value) pairs of a dictionary.zBReturn an iterator over the (key, [values]) pairs of a dictionary.cCs |jdS)Nzlatin-1)encode)sr r r bksrcCs|S)Nr )rr r r unsrz>BassertCountEqualZassertRaisesRegexpZassertRegexpMatchesassertRaisesRegex assertRegexcCs|S)Nr )rr r r rscCst|jdddS)Nz\\z\\\\Zunicode_escape)unicodereplace)rr r r rscCs t|dS)Nr)ord)Zbsr r r byte2intsrcCs t||S)N)r)Zbufir r r indexbytessrZassertItemsEqualz Byte literalz Text literalcOst|t||S)N)r,_assertCountEqual)r argskwargsr r r rscOst|t||S)N)r,_assertRaisesRegex)r rrr r r rscOst|t||S)N)r, _assertRegex)r rrr r r rsexeccCs*|dkr|}|j|k r"|j||dS)N) __traceback__with_traceback)r#r/tbr r r reraises   rcCsB|dkr*tjd}|j}|dkr&|j}~n |dkr6|}tddS)zExecute code in a namespace.Nrzexec _code_ in _globs_, _locs_)r _getframe f_globalsf_localsr)Z_code_Z_globs_Z_locs_framer r r exec_s rz9def reraise(tp, value, tb=None): raise tp, value, tb zrdef raise_from(value, from_value): if from_value is None: raise value raise value from from_value zCdef raise_from(value, from_value): raise value from from_value cCs|dS)Nr )r/Z from_valuer r r raise_fromsrprintc s6|jdtjdkrdSfdd}d}|jdd}|dk r`t|trNd}nt|ts`td|jd d}|dk rt|trd}nt|tstd |rtd |sx|D]}t|trd}PqW|rtd }td }nd }d }|dkr|}|dkr|}x,t|D] \} }| r||||qW||dS)z4The new-style print function for Python 2.4 and 2.5.fileNcsdt|tst|}ttrVt|trVjdk rVtdd}|dkrHd}|jj|}j|dS)Nerrorsstrict) rD basestringstrrrencodingr,rwrite)datar)fpr r rs     zprint_..writeFsepTzsep must be None or a stringendzend must be None or a stringz$invalid keyword arguments to print()  )poprstdoutrDrr TypeError enumerate) rrrZ want_unicoderrargnewlineZspacerr )rr print_sL           rcOs<|jdtj}|jdd}t|||r8|dk r8|jdS)NrflushF)getrrr_printr)rrrrr r r r s    zReraise an exception.csfdd}|S)Ncstj|}|_|S)N)r^wraps __wrapped__)f)assignedupdatedwrappedr r wrapperszwraps..wrapperr )rrrrr )rrrr rsrcs&Gfddd}tj|dfiS)z%Create a base class with a metaclass.cseZdZfddZdS)z!with_metaclass..metaclasscs ||S)Nr )rrZ this_basesr)basesmetar r __new__'sz)with_metaclass..metaclass.__new__N)rrrrr )rrr r metaclass%srZtemporary_class)rr)rrrr )rrr with_metaclass srcsfdd}|S)z6Class decorator for creating a class with a metaclass.csl|jj}|jd}|dk rDt|tr,|g}x|D]}|j|q2W|jdd|jdd|j|j|S)N __slots__rz __weakref__)rzcopyrrDrrr __bases__)rZ orig_varsslotsZ slots_var)rr r r.s      zadd_metaclass..wrapperr )rrr )rr add_metaclass,s rcCs2tr.d|jkrtd|j|j|_dd|_|S)a A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing. To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class. __str__zY@python_2_unicode_compatible cannot be applied to %s because it doesn't define __str__().cSs|jjdS)Nzutf-8) __unicode__r)r r r r Jsz-python_2_unicode_compatible..)PY2rz ValueErrorrrr)rr r r python_2_unicode_compatible<s   r__spec__)rrlilill)N)NN)rr)rr)rr)rr)rZ __future__rr^rPoperatorrr __author__ __version__ version_inforr(ZPY34rZ string_typesintZ integer_typesrZ class_typesZ text_typebytesZ binary_typemaxsizeZMAXSIZErZlongZ ClassTyperplatform startswithobjectr len OverflowErrorrrrr& ModuleTyper2r7r9rrxrLr5r-rrrDr=rmrnZ_urllib_parse_moved_attributesroZ_urllib_error_moved_attributesrpZ _urllib_request_moved_attributesrqZ!_urllib_response_moved_attributesrrZ$_urllib_robotparser_moved_attributesrsryr{Z _meth_funcZ _meth_selfZ _func_closureZ _func_codeZ_func_defaultsZ _func_globalsrr NameErrorrrrrrr attrgetterZget_method_functionZget_method_selfZget_function_closureZget_function_codeZget_function_defaultsZget_function_globalsrrrr methodcallerrrrrrchrZunichrstructStructpackZint2byte itemgetterrgetitemrrZ iterbytesrMrNBytesIOrrrpartialrVrrrrr,rQrrrrrWRAPPER_ASSIGNMENTSWRAPPER_UPDATESrrrrrG __package__globalsrrsubmodule_search_locations meta_pathrrZimporterappendr r r r s     >                                                                                                                                                          5     __pycache__/ipaddress.cpython-36.opt-1.pyc000064400000201213152347724720014333 0ustar003 Pf09@s`dZddlmZddlZddlZdZefZy eefZWne k rJYnXye Z Wne k rle Z YnXdOdkrddZ nddZ y ejZWnek rd d ZYnXd d Zeed rddZnddZdPddZGdddeZdZdZGdddeZGdddeZddZdQdd Zd!d"Zd#d$Zd%d&Z d'd(Z!d)d*Z"d+d,Z#d-d.Z$d/d0Z%d1d2Z&d3d4Z'Gd5d6d6eZ(Gd7d8d8e(Z)Gd9d:d:e(Z*Gd;d<dd>e+e)Z,Gd?d@d@e,Z-GdAdBdBe+e*Z.GdCdDdDeZ/e/e,_0GdEdFdFeZ1GdGdHdHe1e)Z2GdIdJdJe2Z3GdKdLdLe1e*Z4GdMdNdNeZ5e5e2_0dS)RzA fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. )unicode_literalsNz1.0.17cCs|S)N)bytrr/usr/lib/python3.6/ipaddress.py_compat_bytes_to_byte_valssrcCsdd|DS)NcSsg|]}tjd|dqS)s!Br)structunpack).0brrr #sz._compat_bytes_to_byte_vals..r)rrrrr"scCs"d}x|D]}|d>|}q W|S)Nrr)Zbytvals endianessresZbvrrr_compat_int_from_byte_vals's rcCst|dkr.|dks|d kr"tjdtjd|S|dkrj|dksJ|ddkrTtjd tjd |d ?|d @StdS)Nr z(integer out of range for 'I' format codes!Iz)integer out of range for 'QQ' format codes!QQ@ll)rerrorpackNotImplementedError)ZintvalZlengthrrrr_compat_to_bytes0s   r bit_lengthcCs|jS)N)r)irrr_compat_bit_length?srcCs&x tjD]}||?dkr |Sq WdS)Nr) itertoolscount)rrrrrrBs ccs$|}x||kr|V||7}qWdS)Nr)startendsteprrrr _compat_rangeHs r$c@s@eZdZfZddZddZddZddZd d Zd d Z d S)_TotalOrderingMixincCstdS)N)r)selfotherrrr__eq__Wsz_TotalOrderingMixin.__eq__cCs|j|}|tkrtS| S)N)r(NotImplemented)r&r'equalrrr__ne__Zs z_TotalOrderingMixin.__ne__cCstdS)N)r)r&r'rrr__lt__`sz_TotalOrderingMixin.__lt__cCs&|j|}|tks| r"|j|S|S)N)r,r)r()r&r'lessrrr__le__cs  z_TotalOrderingMixin.__le__cCs6|j|}|tkrtS|j|}|tkr,tS|p2| S)N)r,r)r()r&r'r-r*rrr__gt__is  z_TotalOrderingMixin.__gt__cCs|j|}|tkrtS| S)N)r,r))r&r'r-rrr__ge__rs z_TotalOrderingMixin.__ge__N) __name__ __module__ __qualname__ __slots__r(r+r,r.r/r0rrrrr%Ps r%rrc@seZdZdZdS)AddressValueErrorz%A Value Error related to the address.N)r1r2r3__doc__rrrrr5}sr5c@seZdZdZdS)NetmaskValueErrorz%A Value Error related to the netmask.N)r1r2r3r6rrrrr7sr7cCsjyt|Sttfk r YnXyt|Sttfk rBYnXt|trZtd|td|dS)aTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the *address* passed isn't either a v4 or a v6 address zx%r does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object?z0%r does not appear to be an IPv4 or IPv6 addressN) IPv4Addressr5r7 IPv6Address isinstancebytes ValueError)addressrrr ip_addresss r>TcCsny t||Sttfk r"YnXy t||Sttfk rFYnXt|tr^td|td|dS)aTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. zx%r does not appear to be an IPv4 or IPv6 network. Did you pass in a bytes (str in Python 2) instead of a unicode object?z0%r does not appear to be an IPv4 or IPv6 networkN) IPv4Networkr5r7 IPv6Networkr:r;r<)r=strictrrr ip_networks   rBcCsTyt|Sttfk r YnXyt|Sttfk rBYnXtd|dS)agTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Notes: The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. z2%r does not appear to be an IPv4 or IPv6 interfaceN) IPv4Interfacer5r7 IPv6Interfacer<)r=rrr ip_interfacesrEc Cs4y t|ddStjtfk r.tdYnXdS)a`Represent an address as 4 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv4 IP address. Returns: The integer address packed as 4 bytes in network (big-endian) order. Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. rbigz&Address negative or too large for IPv4N)rrr OverflowErrorr<)r=rrrv4_int_to_packeds rHc Cs4y t|ddStjtfk r.tdYnXdS)zRepresent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. rrFz&Address negative or too large for IPv6N)rrrrGr<)r=rrrv6_int_to_packeds  rIcCs*t|jd}t|dkr&td||S)zAHelper to split the netmask and raise AddressValueError if needed/rzOnly one '/' permitted in %r) _compat_strsplitlenr5)r=addrrrr_split_optional_netmasks  rOccsRt|}t|}}x.|D]&}|j|jdkr<||fV|}|}qW||fVdS)zFind a sequence of sorted deduplicated IPv#Address. Args: addresses: a list of IPv#Address objects. Yields: A tuple containing the first and last IP addresses in the sequence. r N)iternext_ip) addressesitfirstlastiprrr_find_address_ranges    rXcCs$|dkr |St|t||d@S)zCount the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. rr )minr)Znumberbitsrrr_count_righthand_zero_bits0s r[ccst|tot|tstd|j|jkr8td||f||krHtd|jdkrXt}n|jdkrht}ntd|j}|j}|j}x^||krt t ||t ||dd}||||f}|V|d|>7}|d|j krPqWdS) aSummarize a network range given the first and last IP addresses. Example: >>> list(summarize_address_range(IPv4Address('192.0.2.0'), ... IPv4Address('192.0.2.130'))) ... #doctest: +NORMALIZE_WHITESPACE [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: An iterator of the summarized IPv(4|6) network objects. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version of the first address is not 4 or 6. z1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstrzunknown IP versionr N) r: _BaseAddress TypeErrorversionr<r?r@_max_prefixlenrRrYr[r _ALL_ONES)rUrVrWZip_bitsZ first_intZlast_intZnbitsnetrrrsummarize_address_range@s0         rcccst|}i}xL|rX|j}|j}|j|}|dkr>|||<q||kr||=|j|qWd}x4t|jD]$}|dk r|j|jkrql|V|}qlWdS)auLoops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network('192.0.2.0/26') ip2 = IPv4Network('192.0.2.64/26') ip3 = IPv4Network('192.0.2.128/26') ip4 = IPv4Network('192.0.2.192/26') _collapse_addresses_internal([ip1, ip2, ip3, ip4]) -> [IPv4Network('192.0.2.0/24')] This shouldn't be called directly; it is called via collapse_addresses([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed. N)listpopsupernetgetappendsortedvaluesbroadcast_address)rSZto_mergesubnetsrbrfZexistingrVrrr_collapse_addresses_internalws$   rmc Cs8g}g}g}x|D]}t|trT|rH|dj|jkrHtd||df|j|q|j|jkr|r|dj|jkrtd||dfy|j|jWqtk r|j|j YqXq|r|dj|jkrtd||df|j|qWt t |}|r,x&t |D]\}}|j t||qWt||S) aCollapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network or IPv6Network objects. Returns: An iterator of the collapsed IPv(4|6)Network objects. Raises: TypeError: If passed a list of mixed version objects. r z%%s and %s are not of the same versionrnrnrnrnrn)r:r]_versionr^rh _prefixlenr`rWAttributeErrornetwork_addressrisetrXextendrcrm)rSZaddrsZipsZnetsrWrUrVrrrcollapse_addressess4     rucCs(t|tr|jSt|tr$|jStS)a2Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There are some times however, where you may wish to have ipaddress sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key. )r: _BaseNetwork_get_networks_keyr]_get_address_keyr))objrrrget_mixed_type_keys   rzc@seZdZdZfZeddZeddZeddZedd Z d d Z d d Z e ddZ e ddZe ddZe ddZe ddZddZdS)_IPAddressBasezThe mother class.cCs|jS)z:Return the longhand version of the IP address as a string.)_explode_shorthand_ip_string)r&rrrexplodedsz_IPAddressBase.explodedcCst|S)z;Return the shorthand version of the IP address as a string.)rK)r&rrr compressedsz_IPAddressBase.compressedcCs|jS)aIThe name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa' )_reverse_pointer)r&rrrreverse_pointers z_IPAddressBase.reverse_pointercCsdt|f}t|dS)Nz%200s has no version specified)typer)r&msgrrrr_sz_IPAddressBase.versioncCsF|dkrd}t|||jf||jkrBd}t|||j|jfdS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)r5rorar`)r&r=rrrr_check_int_addresss  z!_IPAddressBase._check_int_addresscCs.t|}||kr*d}t|||||jfdS)Nz~%r (len %d != %d) is not permitted as an IPv%d address. Did you pass in a bytes (str in Python 2) instead of a unicode object?)rMr5ro)r&r=Z expected_lenZ address_lenrrrr_check_packed_address s z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)zTurn the prefix length into a bitwise netmask Args: prefixlen: An integer, the prefix length. Returns: An integer. )ra)cls prefixlenrrr_ip_int_from_prefix+s z"_IPAddressBase._ip_int_from_prefixc Cs\t||j}|j|}||?}d|>d}||krX|jd}t||d}d}t|||S)aReturn prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in expanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & ones r r rFz&Netmask pattern %r mixes zeroes & ones)r[r`rr<) rip_intZtrailing_zeroesrZ leading_onesZall_onesZbyteslenZdetailsrrrr_prefix_from_ip_int8s      z"_IPAddressBase._prefix_from_ip_intcCsd|}t|dS)Nz%r is not a valid netmask)r7)rZ netmask_strrrrr_report_invalid_netmaskQsz&_IPAddressBase._report_invalid_netmaskc Csjtjj|s|j|y t|}Wntk r@|j|YnXd|koV|jknsf|j||S)a Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask r)_BaseV4_DECIMAL_DIGITS issupersetrintr<r`)rZ prefixlen_strrrrr_prefix_from_prefix_stringVs    z)_IPAddressBase._prefix_from_prefix_stringcCsy|j|}Wntk r,|j|YnXy |j|Stk rLYnX||jN}y |j|Stk r|j|YnXdS)aTurn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask/hostmask N)_ip_int_from_stringr5rrr<ra)rip_strrrrr_prefix_from_ip_stringos   z%_IPAddressBase._prefix_from_ip_stringcCs|jt|ffS)N) __class__rK)r&rrr __reduce__sz_IPAddressBase.__reduce__N)r1r2r3r6r4propertyr}r~rr_rr classmethodrrrrrrrrrrr{s        "r{c@sdeZdZdZfZddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdS)r]zA generic IP object. This IP class contains the version independent methods which are used by single IP addresses. cCs|jS)N)rR)r&rrr__int__sz_BaseAddress.__int__c Cs2y|j|jko|j|jkStk r,tSXdS)N)rRrorqr))r&r'rrrr(s   z_BaseAddress.__eq__cCs`t|tstSt|ts(td||f|j|jkrDtd||f|j|jkr\|j|jkSdS)Nz"%s and %s are not of the same typez%%s and %s are not of the same versionF)r:r{r)r]r^rorR)r&r'rrrr,s       z_BaseAddress.__lt__cCs t|tstS|jt||S)N)r:_compat_int_typesr)rr)r&r'rrr__add__s z_BaseAddress.__add__cCs t|tstS|jt||S)N)r:rr)rr)r&r'rrr__sub__s z_BaseAddress.__sub__cCsd|jjt|fS)Nz%s(%r))rr1rK)r&rrr__repr__sz_BaseAddress.__repr__cCst|j|jS)N)rK_string_from_ip_intrR)r&rrr__str__sz_BaseAddress.__str__cCsttt|jS)N)hashhexrrR)r&rrr__hash__sz_BaseAddress.__hash__cCs |j|fS)N)ro)r&rrrrxsz_BaseAddress._get_address_keycCs|j|jffS)N)rrR)r&rrrrsz_BaseAddress.__reduce__N)r1r2r3r6r4rr(r,rrrrrrxrrrrrr]sr]c@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZeddZeddZeddZeddZed d!Zed"d#Zed$d%Zed&d'Zd(d)Zd*d+Zd,d-ZdFd0d1ZdGd2d3Zed4d5Zd6d7Zd8d9Zed:d;Z edd?Z"ed@dAZ#edBdCZ$edDdEZ%d/S)Hrvz~A generic IP network object. This IP class contains the version independent methods which are used by networks. cCs i|_dS)N)_cache)r&r=rrr__init__sz_BaseNetwork.__init__cCsd|jjt|fS)Nz%s(%r))rr1rK)r&rrrrsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rrr)r&rrrrsz_BaseNetwork.__str__ccs<t|j}t|j}x"t|d|D]}|j|Vq$WdS)zGenerate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the network or broadcast addresses. r N)rrrrkr$_address_class)r&network broadcastxrrrhostss  z_BaseNetwork.hostsccs<t|j}t|j}x"t||dD]}|j|Vq$WdS)Nr )rrrrkr$r)r&rrrrrr__iter__s  z_BaseNetwork.__iter__cCslt|j}t|j}|dkr>|||kr0td|j||S|d7}|||krZtd|j||SdS)Nrzaddress out of ranger )rrrrk IndexErrorr)r&nrrrrr __getitem__s    z_BaseNetwork.__getitem__cCsxt|tstSt|ts(td||f|j|jkrDtd||f|j|jkr\|j|jkS|j|jkrt|j|jkSdS)Nz"%s and %s are not of the same typez%%s and %s are not of the same versionF)r:r{r)rvr^rorrnetmask)r&r'rrrr,s         z_BaseNetwork.__lt__c CsFy,|j|jko,|j|jko,t|jt|jkStk r@tSXdS)N)rorrrrrqr))r&r'rrrr(s   z_BaseNetwork.__eq__cCstt|jt|jAS)N)rrrrr)r&rrrrsz_BaseNetwork.__hash__cCsL|j|jkrdSt|trdSt|jt|jkoBt|jkSSdS)NF)ror:rvrrrrRrk)r&r'rrr __contains__s   z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)z*Tell if self is partly contained in other.)rrrk)r&r'rrroverlaps)s   z_BaseNetwork.overlapscCs<|jjd}|dkr8|jt|jt|jB}||jd<|S)Nrk)rrgrrrrhostmask)r&rrrrrk0s    z_BaseNetwork.broadcast_addresscCs8|jjd}|dkr4|jt|j|jA}||jd<|S)Nr)rrgrrrra)r&rrrrr9s   z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rrrp)r&rrrwith_prefixlenAsz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rrr)r&rrr with_netmaskEsz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rrr)r&rrr with_hostmaskIsz_BaseNetwork.with_hostmaskcCst|jt|jdS)z&Number of hosts in the current subnet.r )rrkrr)r&rrr num_addressesMsz_BaseNetwork.num_addressescCsdt|f}t|dS)Nz%%200s has no associated address class)rr)r&rrrrrRsz_BaseNetwork._address_classcCs|jS)N)rp)r&rrrrZsz_BaseNetwork.prefixlenccs|j|jkstd||ft|ts2td||j|sLtd||f||krXdS|jd|j|jf}|j \}}xb||kr||kr|j|r|V|j \}}q||j|r|V|j \}}q|t d|||fq|W||kr|Vn$||kr|Vnt d|||fdS)aRemove an address from a larger block. For example: addr1 = ip_network('192.0.2.0/28') addr2 = ip_network('192.0.2.1/32') list(addr1.address_exclude(addr2)) = [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'), IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')] or IPv6: addr1 = ip_network('2001:db8::1/32') addr2 = ip_network('2001:db8::1/128') list(addr1.address_exclude(addr2)) = [ip_network('2001:db8::1/128'), ip_network('2001:db8::2/127'), ip_network('2001:db8::4/126'), ip_network('2001:db8::8/125'), ... ip_network('2001:db8:8000::/33')] Args: other: An IPv4Network or IPv6Network object of the same type. Returns: An iterator of the IPv(4|6)Network objects which is self minus other. Raises: TypeError: If self and other are of differing address versions, or if other is not a network object. ValueError: If other is not completely contained by self. z%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sNz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s) ror^r:rv subnet_ofr<rrrrrlAssertionError)r&r's1s2rrraddress_exclude^s6$           z_BaseNetwork.address_excludecCs`|j|jkrtd||f|j|jkr,dS|j|jkr other eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25') IPv6Network('2001:db8::2000/124') > IPv6Network('2001:db8::1000/124') Raises: TypeError if the IP versions are different. z"%s and %s are not of the same typer rrnrn)ror^rrr)r&r'rrrcompare_networkss!      z_BaseNetwork.compare_networkscCs|j|j|jfS)zNetwork-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). )rorrr)r&rrrrwsz_BaseNetwork._get_networks_keyr Nc cs|j|jkr|VdS|dk rJ||jkr0td|dkr@td||j}|dkrZtd|j|}||jkr~td||ft|j}t|jd}t|jd|?}x(t|||D]}|j||f}|VqWdS)aThe subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length should be increased by. This should not be set if new_prefix is also set. new_prefix: The desired new prefix length. This must be a larger number (smaller prefix) than the existing prefix. This should not be set if prefixlen_diff is also set. Returns: An iterator of IPv(4|6) objects. Raises: ValueError: The prefixlen_diff is too small or too large. OR prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) Nznew prefix must be longerr z(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s) rpr`r<rrrrkrr$r) r&prefixlen_diff new_prefix new_prefixlenr!r"r#Znew_addrZcurrentrrrrls,       z_BaseNetwork.subnetscCs|jdkr|S|dk rB||jkr(td|dkr8td|j|}|j|}|dkrftd|j|f|jt|jt|j|>@|fS)aThe supernet containing the current network. Args: prefixlen_diff: An integer, the amount the prefix length of the network should be decreased by. For example, given a /24 network and a prefixlen_diff of 3, a supernet with a /21 netmask is returned. Returns: An IPv4 network object. Raises: ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a negative prefix length. OR If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) rNznew prefix must be shorterr z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rpr<rrrrrr)r&rrrrrrrfs     z_BaseNetwork.supernetcCs|jjo|jjS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. )rr is_multicastrk)r&rrrrAs z_BaseNetwork.is_multicastcCsP|j|jkrdSt|dr 255) not permitted)r<rrrMr)rZ octet_strrZ octet_intrrrrs       z_BaseV4._parse_octetcCsdjddt|ddDS)zTurns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. rcss0|](}tt|tr"tjd|dn|VqdS)s!BrN)rKr:r;rr )r r rrr -sz._BaseV4._string_from_ip_int..rrF)joinr)rrrrrr"s z_BaseV4._string_from_ip_intc sh|jd}yfddtt|D}Wntk r:dSXt|t|krPdS|d|dkrddSdS) zTest if the IP string is a hostmask (rather than a netmask). Args: ip_str: A string, the potential hostmask. Returns: A boolean, True if the IP string is a hostmask. rcsg|]}|jkr|qSr)_valid_mask_octets)r r)r&rrr >sz(_BaseV4._is_hostmask..Frr Trn)rLrrr<rM)r&rrZpartsr)r&r _is_hostmask2s z_BaseV4._is_hostmaskcCs&t|jdddd}dj|dS)zReturn the reverse DNS pointer name for the IPv4 address. This implements the method described in RFC1035 3.5. rNr z .in-addr.arparn)rKrLr)r&Zreverse_octetsrrrrGsz_BaseV4._reverse_pointercCs|jS)N)r`)r&rrr max_prefixlenPsz_BaseV4.max_prefixlencCs|jS)N)ro)r&rrrr_Tsz_BaseV4.versionN)r1r2r3r6r4ro IPV4LENGTHra frozensetrrr`rr|rrrrrrrrrr_rrrrrs"    %  rc@s|eZdZdZdZddZeddZedd Zed d Z ed d Z eddZ eddZ eddZ eddZdS)r8z/Represent and manipulate single IPv4 Addresses.rR __weakref__cCsxt|tr|j|||_dSt|trL|j|dt|}t|d|_dSt|}d|krht d||j ||_dS)a Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv4Address('192.0.2.1') == IPv4Address(3221225985). or, more generally IPv4Address(int(IPv4Address('192.0.2.1'))) == IPv4Address('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. NrrFrJzUnexpected '/' in %r) r:rrrRr;rrrrKr5r)r&r=bvsaddr_strrrrr_s      zIPv4Address.__init__cCs t|jS)z*The binary representation of this address.)rHrR)r&rrrpackedszIPv4Address.packedcCs ||jjkS)zTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. ) _constants_reserved_network)r&rrrrs zIPv4Address.is_reservedcstfddjjDS)zTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv4-special-registry. c3s|]}|kVqdS)Nr)r rb)r&rrrsz)IPv4Address.is_private..)anyr_private_networks)r&r)r&rrs zIPv4Address.is_privatecCs||jjko|j S)N)r_public_networkr)r&rrrrs zIPv4Address.is_globalcCs ||jjkS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. )r_multicast_network)r&rrrrs zIPv4Address.is_multicastcCs ||jjkS)zTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. )r_unspecified_address)r&rrrrs zIPv4Address.is_unspecifiedcCs ||jjkS)zTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. )r_loopback_network)r&rrrrszIPv4Address.is_loopbackcCs ||jjkS)zTest if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. )r_linklocal_network)r&rrrrszIPv4Address.is_link_localN)rRr)r1r2r3r6r4rrrrrrrrrrrrrrr8Ys$   r8c@sjeZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZdS)rCcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht |d|_ n|j|_ t|dd|_|jj |_ |jj|_dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj|_dS)Nrr F)rA)r:r;rr8rr?rRrr`rptuplerMrrrrO)r&r=rNrrrrs(        zIPv4Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)rrRrr)r&rrrrs zIPv4Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r8r(r)rrq)r&r' address_equalrrrr(s  zIPv4Interface.__eq__c Cs>tj||}|tkrtSy |j|jkStk r8dSXdS)NF)r8r,r)rrq)r&r' address_lessrrrr,s  zIPv4Interface.__lt__cCs|j|jAt|jjAS)N)rRrprrrr)r&rrrrszIPv4Interface.__hash__cCs t|jS)N)r8rR)r&rrrrW szIPv4Interface.ipcCsd|j|j|jfS)Nz%s/%s)rrRrp)r&rrrrs zIPv4Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)rrRr)r&rrrrs zIPv4Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)rrRr)r&rrrrs zIPv4Interface.with_hostmaskN)r1r2r3rrr(r,rr{rrrWrrrrrrrrCs     rCc@s*eZdZdZeZdddZeddZdS) r?aeThis class represents and manipulates 32-bit IPv4 network + addresses.. Attributes: [examples for IPv4Network('192.0.2.0/27')] .network_address: IPv4Address('192.0.2.0') .hostmask: IPv4Address('0.0.0.31') .broadcast_address: IPv4Address('192.0.2.32') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 TcCs|tj||t|ttfr|jj|std|t|dkr4d}t||t|dS)a&Convert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from [0..FFFF]. zOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr) _HEX_DIGITSrr<rMr)rZ hextet_strrrrrrEs     z_BaseV6._parse_hextetc Csd}d}d}d}xJt|D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr||}|t|kr|dg7}dg|||<|dkrdg|}|S) aCompresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. r rrrnrnrnrn) enumeraterM) rhextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_lenindexZhextetZbest_doublecolon_endrrr_compress_hextets_s.   z_BaseV6._compress_hextetsNcsZ|dkrt|j}||jkr$tdd|fddtdddD}|j|}d j|S) a,Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. NzIPv6 address is too largez%032xcs&g|]}dt||ddqS)z%xrr)r)r r)hex_strrrr sz/_BaseV6._string_from_ip_int..rrrr)rrRrar<rrr)rrrr)rrrs   z_BaseV6._string_from_ip_intcst|trt|j}nt|tr,t|j}nt|}|j|}d|fddtdddD}t|ttfrddj ||j fSdj |S) zExpand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. z%032xcsg|]}||dqS)rr)r r)rrrr sz8_BaseV6._explode_shorthand_ip_string..rrrz%s/%dr) r:r@rKrrrDrWrrrvrrp)r&rrrr)rrr|s     z$_BaseV6._explode_shorthand_ip_stringcCs&|jdddjdd}dj|dS)zReturn the reverse DNS pointer name for the IPv6 address. This implements the method described in RFC3596 2.5. Nr rrrz .ip6.arparn)r}replacer)r&Z reverse_charsrrrrsz_BaseV6._reverse_pointercCs|jS)N)r`)r&rrrrsz_BaseV6.max_prefixlencCs|jS)N)ro)r&rrrr_sz_BaseV6.version)N)r1r2r3r6r4ro IPV6LENGTHrarrrr`rrrrrrrr|rrrr_rrrrrs$   i  0  rc@seZdZdZdZddZeddZedd Zed d Z ed d Z eddZ eddZ eddZ eddZeddZeddZeddZeddZdS) r9z/Represent and manipulate single IPv6 Addresses.rRrcCsxt|tr|j|||_dSt|trL|j|dt|}t|d|_dSt|}d|krht d||j ||_dS)aInstantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:db8::') == IPv6Address(42540766411282592856903984951653826560) or, more generally IPv6Address(int(IPv6Address('2001:db8::'))) == IPv6Address('2001:db8::') Raises: AddressValueError: If address isn't a valid IPv6 address. NrrFrJzUnexpected '/' in %r) r:rrrRr;rrrrKr5r)r&r=rrrrrrs      zIPv6Address.__init__cCs t|jS)z*The binary representation of this address.)rIrR)r&rrrrszIPv6Address.packedcCs ||jjkS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. )rr)r&rrrrs zIPv6Address.is_multicastcstfddjjDS)zTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. c3s|]}|kVqdS)Nr)r r)r&rrrsz*IPv6Address.is_reserved..)rr_reserved_networks)r&r)r&rrs zIPv6Address.is_reservedcCs ||jjkS)zTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. )rr)r&rrrrszIPv6Address.is_link_localcCs ||jjkS)a`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. )r_sitelocal_network)r&rrr is_site_local#s zIPv6Address.is_site_localcstfddjjDS)zTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv6-special-registry. c3s|]}|kVqdS)Nr)r rb)r&rrr:sz)IPv6Address.is_private..)rrr)r&r)r&rr1s zIPv6Address.is_privatecCs|j S)zTest if this address is allocated for public networks. Returns: A boolean, true if the address is not reserved per iana-ipv6-special-registry. )r)r&rrrr<s zIPv6Address.is_globalcCs |jdkS)zTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. r)rR)r&rrrrGs zIPv6Address.is_unspecifiedcCs |jdkS)zTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. r )rR)r&rrrrRs zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@S)zReturn the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. riNl)rRr8)r&rrr ipv4_mapped]s zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@t|jd@fS)zTuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) `i Nrl)rRr8)r&rrrteredojs zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@S)zReturn the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. pi NPl)rRr8)r&rrr sixtofourys zIPv6Address.sixtofourN)rRr)r1r2r3r6r4rrrrrrrrrrrrrrrrrrr9s%   r9c@seZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZe ddZe ddZdS)rDcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht |d|_ n|j|_ t|dd|_|jj |_ |jj|_dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj|_dS)Nrr F)rA)r:r;rr9rr@rRrr`rprrMrrrrO)r&r=rNrrrrs(        zIPv6Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)rrRrr)r&rrrrs zIPv6Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r9r(r)rrq)r&r'rrrrr(s  zIPv6Interface.__eq__c Cs>tj||}|tkrtSy |j|jkStk r8dSXdS)NF)r9r,r)rrq)r&r'rrrrr,s  zIPv6Interface.__lt__cCs|j|jAt|jjAS)N)rRrprrrr)r&rrrrszIPv6Interface.__hash__cCs t|jS)N)r9rR)r&rrrrWszIPv6Interface.ipcCsd|j|j|jfS)Nz%s/%s)rrRrp)r&rrrrs zIPv6Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)rrRr)r&rrrrs zIPv6Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)rrRr)r&rrrrs zIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)rRrr)r&rrrrszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr )rRrr)r&rrrrszIPv6Interface.is_loopbackN)r1r2r3rrr(r,rr{rrrWrrrrrrrrrrDs       rDc@s2eZdZdZeZd ddZddZeddZ d S) r@avThis class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:db8::1000/124')] .network_address: IPv6Address('2001:db8::1000') .hostmask: IPv6Address('::f') .broadcast_address: IPv6Address('2001:db8::100f') .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') .prefixlen: 124 TcCs|tj||t|ttfrrBrErHrIrOrXr[rcrmrurzr{r]rvrr8rCr?rrrr9rDr@r rrrr s        )$ $#716=a*vRr 5V{!__pycache__/distro.cpython-36.pyc000064400000077377152347724720012750 0ustar003 Pf͕@sbdZddlZddlZddlZddlZddlZddlZddlZejj dsXe dj ejdZ dZ iZddd Zd diZejd Zejd Zd dde dfZd:ddZddZd;ddZdddZd?dd Zd@d!d"Zd#d$Zd%d&ZdAd'd(Zd)d*Z d+d,Z!d-d.Z"d/d0Z#d1d2Z$d3d4Z%Gd5d6d6e&Z'e'Z(d7d8Z)e*d9kr^e)dS)Ba, The ``distro`` package (``distro`` stands for Linux Distribution) provides information about the Linux distribution it runs on, such as a reliable machine-readable distro ID, or version information. It is a renewed alternative implementation for Python's original :py:func:`platform.linux_distribution` function, but it provides much more functionality. An alternative implementation became necessary because Python 3.5 deprecated this function, and Python 3.7 is expected to remove it altogether. Its predecessor function :py:func:`platform.dist` was already deprecated since Python 2.6 and is also expected to be removed in Python 3.7. Still, there are many cases in which access to Linux distribution information is needed. See `Python issue 1322 `_ for more information. NlinuxzUnsupported platform: {0}z/etcz os-releaseZoracleZrhel)ZenterpriseenterpriseZredhatenterpriseworkstationZredhatzA(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)z(\w+)[-_](release|version)$Zdebian_versionz lsb-releasez oem-releasezsystem-releaseTcCs tj|S)a$ Return information about the current Linux distribution as a tuple ``(id_name, version, codename)`` with items as follows: * ``id_name``: If *full_distribution_name* is false, the result of :func:`distro.id`. Otherwise, the result of :func:`distro.name`. * ``version``: The result of :func:`distro.version`. * ``codename``: The result of :func:`distro.codename`. The interface of this function is compatible with the original :py:func:`platform.linux_distribution` function, supporting a subset of its parameters. The data it returns may not exactly be the same, because it uses more data sources than the original function, and that may lead to different data if the Linux distribution is not consistent across multiple data sources it provides (there are indeed such distributions ...). Another reason for differences is the fact that the :func:`distro.id` method normalizes the distro ID string to a reliable machine-readable value for a number of popular Linux distributions. )_distrolinux_distribution)full_distribution_namer/usr/lib/python3.6/distro.pyr`srcCstjS)a Return the distro ID of the current Linux distribution, as a machine-readable string. For a number of Linux distributions, the returned distro ID value is *reliable*, in the sense that it is documented and that it does not change across releases of the distribution. This package maintains the following reliable distro ID values: ============== ========================================= Distro ID Distribution ============== ========================================= "ubuntu" Ubuntu "debian" Debian "rhel" RedHat Enterprise Linux "centos" CentOS "fedora" Fedora "sles" SUSE Linux Enterprise Server "opensuse" openSUSE "amazon" Amazon Linux "arch" Arch Linux "cloudlinux" CloudLinux OS "exherbo" Exherbo Linux "gentoo" GenToo Linux "ibm_powerkvm" IBM PowerKVM "kvmibm" KVM for IBM z Systems "linuxmint" Linux Mint "mageia" Mageia "mandriva" Mandriva Linux "parallels" Parallels "pidora" Pidora "raspbian" Raspbian "oracle" Oracle Linux (and Oracle Enterprise Linux) "scientific" Scientific Linux "slackware" Slackware "xenserver" XenServer ============== ========================================= If you have a need to get distros for reliable IDs added into this set, or if you find that the :func:`distro.id` function returns a different distro ID for one of the listed distros, please create an issue in the `distro issue tracker`_. **Lookup hierarchy and transformations:** First, the ID is obtained from the following sources, in the specified order. The first available and non-empty value is used: * the value of the "ID" attribute of the os-release file, * the value of the "Distributor ID" attribute returned by the lsb_release command, * the first part of the file name of the distro release file, The so determined ID value then passes the following transformations, before it is returned by this method: * it is translated to lower case, * blanks (which should not be there anyway) are translated to underscores, * a normalization of the ID is performed, based upon `normalization tables`_. The purpose of this normalization is to ensure that the ID is as reliable as possible, even across incompatible changes in the Linux distributions. A common reason for an incompatible change is the addition of an os-release file, or the addition of the lsb_release command, with ID values that differ from what was previously determined from the distro release file name. )ridrrrrr|sHrFcCs tj|S)an Return the name of the current Linux distribution, as a human-readable string. If *pretty* is false, the name is returned without version or codename. (e.g. "CentOS Linux") If *pretty* is true, the version and codename are appended. (e.g. "CentOS Linux 7.1.1503 (Core)") **Lookup hierarchy:** The name is obtained from the following sources, in the specified order. The first available and non-empty value is used: * If *pretty* is false: - the value of the "NAME" attribute of the os-release file, - the value of the "Distributor ID" attribute returned by the lsb_release command, - the value of the "" field of the distro release file. * If *pretty* is true: - the value of the "PRETTY_NAME" attribute of the os-release file, - the value of the "Description" attribute returned by the lsb_release command, - the value of the "" field of the distro release file, appended with the value of the pretty version ("" and "" fields) of the distro release file, if available. )rname)prettyrrrr s$r cCs tj||S)ay Return the version of the current Linux distribution, as a human-readable string. If *pretty* is false, the version is returned without codename (e.g. "7.0"). If *pretty* is true, the codename in parenthesis is appended, if the codename is non-empty (e.g. "7.0 (Maipo)"). Some distributions provide version numbers with different precisions in the different sources of distribution information. Examining the different sources in a fixed priority order does not always yield the most precise version (e.g. for Debian 8.2, or CentOS 7.1). The *best* parameter can be used to control the approach for the returned version: If *best* is false, the first non-empty version number in priority order of the examined sources is returned. If *best* is true, the most precise version number out of all examined sources is returned. **Lookup hierarchy:** In all cases, the version number is obtained from the following sources. If *best* is false, this order represents the priority order: * the value of the "VERSION_ID" attribute of the os-release file, * the value of the "Release" attribute returned by the lsb_release command, * the version number parsed from the "" field of the first line of the distro release file, * the version number parsed from the "PRETTY_NAME" attribute of the os-release file, if it follows the format of the distro release files. * the version number parsed from the "Description" attribute returned by the lsb_release command, if it follows the format of the distro release files. )rversion)r bestrrrr s)r cCs tj|S)a Return the version of the current Linux distribution as a tuple ``(major, minor, build_number)`` with items as follows: * ``major``: The result of :func:`distro.major_version`. * ``minor``: The result of :func:`distro.minor_version`. * ``build_number``: The result of :func:`distro.build_number`. For a description of the *best* parameter, see the :func:`distro.version` method. )r version_parts)r rrrr sr cCs tj|S)a8 Return the major version of the current Linux distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. )r major_version)r rrrr+s rcCs tj|S)a9 Return the minor version of the current Linux distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. )r minor_version)r rrrr8s rcCs tj|S)a6 Return the build number of the current Linux distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. )r build_number)r rrrrEs rcCstjS)a Return a space-separated list of distro IDs of distributions that are closely related to the current Linux distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from. **Lookup hierarchy:** This information item is only provided by the os-release file. For details, see the description of the "ID_LIKE" attribute in the `os-release man page `_. )rlikerrrrrRsrcCstjS)a Return the codename for the release of the current Linux distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function does not handle such cases in any special way and just returns the string it finds, if any. **Lookup hierarchy:** * the codename within the "VERSION" attribute of the os-release file, if provided, * the value of the "Codename" attribute returned by the lsb_release command, * the value of the "" field of the distro release file. )rcodenamerrrrrcsrcCs tj||S)a Return certain machine-readable information items about the current Linux distribution in a dictionary, as shown in the following example: .. sourcecode:: python { 'id': 'rhel', 'version': '7.0', 'version_parts': { 'major': '7', 'minor': '0', 'build_number': '' }, 'like': 'fedora', 'codename': 'Maipo' } The dictionary structure and keys are always the same, regardless of which information items are available in the underlying data sources. The values for the various keys are as follows: * ``id``: The result of :func:`distro.id`. * ``version``: The result of :func:`distro.version`. * ``version_parts -> major``: The result of :func:`distro.major_version`. * ``version_parts -> minor``: The result of :func:`distro.minor_version`. * ``version_parts -> build_number``: The result of :func:`distro.build_number`. * ``like``: The result of :func:`distro.like`. * ``codename``: The result of :func:`distro.codename`. For a description of the *pretty* and *best* parameters, see the :func:`distro.version` method. )rinfo)r r rrrr{s)rcCstjS)z Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current Linux distribution. See `os-release file`_ for details about these information items. )ros_release_inforrrrrsrcCstjS)z Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current Linux distribution. See `lsb_release command output`_ for details about these information items. )rlsb_release_inforrrrrsrcCstjS)z Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current Linux distribution. See `distro release file`_ for details about these information items. )rdistro_release_inforrrrrsrcCs tj|S)a Return a single named information item from the os-release file data source of the current Linux distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `os-release file`_ for details about these information items. )ros_release_attr) attributerrrrsrcCs tj|S)a Return a single named information item from the lsb_release command output data source of the current Linux distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `lsb_release command output`_ for details about these information items. )rlsb_release_attr)rrrrrsrcCs tj|S)a Return a single named information item from the distro release file data source of the current Linux distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `distro release file`_ for details about these information items. )rdistro_release_attr)rrrrrsrc@seZdZdZd:ddZddZd;dd Zd d ZdddZ d?ddZ d@ddZ dAddZ ddZddZdBddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zed-d.Zd/d0Zed1d2Zd3d4Zd5d6Zed7d8Zd9S)CLinuxDistributiona Provides information about a Linux distribution. This package creates a private module-global instance of this class with default initialization arguments, that is used by the `consolidated accessor functions`_ and `single source accessor functions`_. By using default initialization arguments, that module-global instance returns data about the current Linux distribution (i.e. the distro this package runs on). Normally, it is not necessary to create additional instances of this class. However, in situations where control is needed over the exact data sources that are used, instances of this class can be created with a specific distro release file, or a specific os-release file, or without invoking the lsb_release command. TcCsH|ptjjtt|_|pd|_|j|_|r4|j ni|_ |j |_ dS)a8 The initialization method of this class gathers information from the available data sources, and stores that in private instance attributes. Subsequent access to the information items uses these private instance attributes, so that the data sources are read only once. Parameters: * ``include_lsb`` (bool): Controls whether the `lsb_release command output`_ is included as a data source. If the lsb_release command is not available in the program execution path, the data source for the lsb_release command will be empty. * ``os_release_file`` (string): The path name of the `os-release file`_ that is to be used as a data source. An empty string (the default) will cause the default path name to be used (see `os-release file`_ for details). If the specified or defaulted os-release file does not exist, the data source for the os-release file will be empty. * ``distro_release_file`` (string): The path name of the `distro release file`_ that is to be used as a data source. An empty string (the default) will cause a default search algorithm to be used (see `distro release file`_ for details). If the specified distro release file does not exist, or if no default distro release file can be found, the data source for the distro release file will be empty. Public instance attributes: * ``os_release_file`` (string): The path name of the `os-release file`_ that is actually used as a data source. The empty string if no distro release file is used as a data source. * ``distro_release_file`` (string): The path name of the `distro release file`_ that is actually used as a data source. The empty string if no distro release file is used as a data source. Raises: * :py:exc:`IOError`: Some I/O issue with an os-release file or distro release file. * :py:exc:`subprocess.CalledProcessError`: The lsb_release command had some issue (other than not being available in the program execution path). * :py:exc:`UnicodeError`: A data source has unexpected characters or uses an unexpected encoding. rN) ospathjoin _UNIXCONFDIR_OS_RELEASE_BASENAMEos_release_filedistro_release_file_get_os_release_info_os_release_info_get_lsb_release_info_lsb_release_info_get_distro_release_info_distro_release_info)selfZ include_lsbr"r#rrr__init__s ;  zLinuxDistribution.__init__cCsdj|j|j|j|j|jS)z Return repr of all info zLinuxDistribution(os_release_file={0!r}, distro_release_file={1!r}, _os_release_info={2!r}, _lsb_release_info={3!r}, _distro_release_info={4!r}))formatr"r#r%r'r))r*rrr__repr__Us zLinuxDistribution.__repr__cCs"|r |jn|j|j|jfS)z Return information about the Linux distribution that is compatible with Python's :func:`platform.linux_distribution`, supporting a subset of its parameters. For details, see :func:`distro.linux_distribution`. )r rr r)r*rrrrres z$LinuxDistribution.linux_distributioncCsTdd}|jd}|r ||tS|jd}|r8||tS|jd}|rP||tSdS)zrReturn the distro ID of the Linux distribution, as a string. For details, see :func:`distro.id`. cSs|jjdd}|j||S)N _)lowerreplaceget) distro_idtablerrr normalizexsz'LinuxDistribution.id..normalizerdistributor_idr)rNORMALIZED_OS_IDrNORMALIZED_LSB_IDrNORMALIZED_DISTRO_ID)r*r5r3rrrrss      zLinuxDistribution.idFcCsh|jdp|jdp|jd}|r`|jdp4|jd}|s`|jd}|jdd}|r`|d|}|pfdS) zx Return the name of the Linux distribution, as a string. For details, see :func:`distro.name`. r r6 pretty_name descriptionT)r r.r)rrrr )r*r r r rrrr s        zLinuxDistribution.namecCs|jd|jd|jd|j|jdjdd|j|jdjddg}d}|rxJ|D]$}|jd|jdksv|dkrV|}qVWnx|D]}|dkr|}PqW|r|r|jrdj||j}|S)z~ Return the version of the Linux distribution, as a string. For details, see :func:`distro.version`. version_idreleaser:rr;.z {0} ({1}))rrr_parse_distro_release_contentr2countrr,)r*r r Zversionsr vrrrr s&   zLinuxDistribution.versioncCsL|j|d}|rHtjd}|j|}|rH|j\}}}||p>d|pDdfSdS)z Return the version of the Linux distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. )r z(\d+)\.?(\d+)?\.?(\d+)?r)rrr)r recompilematchgroups)r*r Z version_strZ version_regexmatchesmajorminorrrrrr s   zLinuxDistribution.version_partscCs|j|dS)z Return the major version number of the current distribution. For details, see :func:`distro.major_version`. r)r )r*r rrrrszLinuxDistribution.major_versioncCs|j|dS)z Return the minor version number of the Linux distribution. For details, see :func:`distro.minor_version`. )r )r*r rrrrszLinuxDistribution.minor_versioncCs|j|dS)z{ Return the build number of the Linux distribution. For details, see :func:`distro.build_number`. )r )r*r rrrrszLinuxDistribution.build_numbercCs|jdp dS)z Return the IDs of distributions that are like the Linux distribution. For details, see :func:`distro.like`. Zid_liker)r)r*rrrrszLinuxDistribution.likecCs"|jdp |jdp |jdp dS)zs Return the codename of the Linux distribution. For details, see :func:`distro.codename`. rr)rrr)r*rrrrs   zLinuxDistribution.codenamecCsBt|j|j||t|j||j||j|d|j|jdS)z Return certain machine-readable information about the Linux distribution. For details, see :func:`distro.info`. )rGrHr)rr r rr)dictrr rrrrr)r*r r rrrrs  zLinuxDistribution.infocCs|jS)z Return a dictionary containing key-value pairs for the information items from the os-release file data source of the Linux distribution. For details, see :func:`distro.os_release_info`. )r%)r*rrrr sz!LinuxDistribution.os_release_infocCs|jS)z Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the Linux distribution. For details, see :func:`distro.lsb_release_info`. )r')r*rrrrsz"LinuxDistribution.lsb_release_infocCs|jS)z Return a dictionary containing key-value pairs for the information items from the distro release file data source of the Linux distribution. For details, see :func:`distro.distro_release_info`. )r))r*rrrrsz%LinuxDistribution.distro_release_infocCs|jj|dS)z Return a single named information item from the os-release file data source of the Linux distribution. For details, see :func:`distro.os_release_attr`. r)r%r2)r*rrrrr)sz!LinuxDistribution.os_release_attrcCs|jj|dS)z Return a single named information item from the lsb_release command output data source of the Linux distribution. For details, see :func:`distro.lsb_release_attr`. r)r'r2)r*rrrrr2sz"LinuxDistribution.lsb_release_attrcCs|jj|dS)z Return a single named information item from the distro release file data source of the Linux distribution. For details, see :func:`distro.distro_release_attr`. r)r)r2)r*rrrrr;sz%LinuxDistribution.distro_release_attrc Cs.tjj|jr*t|j }|j|SQRXiS)z Get the information items from the specified os-release file. Returns: A dictionary containing all information items. N)rrisfiler"open_parse_os_release_content)r*Z release_filerrrr$Ds z&LinuxDistribution._get_os_release_infocCsi}tj|dd}d|_tjddkr@t|jtr@|jjd|_t|}x|D]}d|krN|j dd\}}t|tr~|jd}|||j <|d krt j d |}|r|j }|jd }|jd }|j}||d <qd|d <qNqNW|S)aD Parse the lines of an os-release file. Parameters: * lines: Iterable through the lines in the os-release file. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. T)posixrrJz iso-8859-1=rIzutf-8VERSIONz(\(\D+\))|,(\s+)?\D+z(),rr)shlexZwhitespace_splitsys version_info isinstanceZ wordcharsbytesdecodelistsplitr0rBsearchgroupstrip)linespropsZlexertokenstokenkrArrrrrNPs.          z+LinuxDistribution._parse_os_release_contentcCsd}tj|dtjtjd}|j\}}|jd|jd}}|j}|dkr\|j}|j|S|dkrhiStj ddd krtj ||||n@tj dddkrtj |||ntj dddkrtj ||dS)z Get the information items from the lsb_release command output. Returns: A dictionary containing all information items. zlsb_release -aT)shellstdoutstderrzutf-8rNrJ)rgrh)rJri)rJrj) subprocessPopenPIPEZ communicaterX returncode splitlines_parse_lsb_release_contentrTrUZCalledProcessError)r*cmdZprocessrdrecodeZcontentrrrr&s(   z'LinuxDistribution._get_lsb_release_infocCsti}xj|D]b}t|tr"|jdn|}|jdjdd}t|dkrFq |\}}|j|jddj|jiq W|S)aM Parse the output of the lsb_release command. Parameters: * lines: Iterable through the lines of the lsb_release output. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. zutf-8 :rIrJr.r/) rVrWrXr]rZlenupdater1r0)r^r_lineZkvrbrArrrrps  "z,LinuxDistribution._parse_lsb_release_contentcCs|jr@|j|j}tjj|j}tj|}|r<|jd|d<|Stjt }|j x\|D]T}|t krfqXtj|}|rXtjj t |}|j|}d|krX||_|jd|d<|SqXWiSdS)z Get the information items from the specified distro release file. Returns: A dictionary containing all information items. rIrr N) r#_parse_distro_release_filerrbasename _DISTRO_RELEASE_BASENAME_PATTERNrDr\listdirr sort _DISTRO_RELEASE_IGNORE_BASENAMESr)r* distro_inforyrDZ basenamesfilepathrrrr(s,     z*LinuxDistribution._get_distro_release_infoc Cs.tjj|r*t|}|j|jSQRXiS)z Parse a distro release file. Parameters: * filepath: Path name of the distro release file. Returns: A dictionary containing all information items. N)rrrLrMr?readline)r*rfprrrrxs  z,LinuxDistribution._parse_distro_release_filecCst|tr|jd}tj|jddd }i}|r|jdddd |d<|jdrn|jdddd |d<|jdr|jdddd |d<n|r|j|d<|S) a Parse a line from a distro release file. Parameters: * line: Line from the distro release file. Must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. zutf-8NrIrgr rJr<rrrr)rVrWrX(_DISTRO_RELEASE_CONTENT_REVERSED_PATTERNrDr]r\)rwrFr~rrrr?s     z/LinuxDistribution._parse_distro_release_contentN)Trr)T)F)FF)F)F)F)F)FF)__name__ __module__ __qualname____doc__r+r-rrr r r rrrrrrrrrrrrr$ staticmethodrNr&rpr(rxr?rrrrrs: @   !            < )rcCsddl}tjt}|jtj|jtjtj |j dd}|j ddddd|j }|j rv|jt jtd d d nB|jd td d td d }|r|jd|t}|r|jd|dS)NrzLinux distro info tool)r;z--jsonz-jz!Output in machine readable format store_true)helpactionT)indentZ sort_keyszName: %s)r z Version: %sz Codename: %s)argparseloggingZ getLoggerrZsetLevelDEBUGZ addHandlerZ StreamHandlerrTrdArgumentParser add_argument parse_argsjsonrdumpsr r r)rZloggerparserargsZdistribution_versionZdistribution_codenamerrrmains(     r__main__)T)F)FF)F)F)F)F)FF)+rrrBrTrrSrrkplatform startswith ImportErrorr,r r!r7r8r9rCrrzr}rrr r r rrrrrrrrrrrrobjectrrrrrrrrsd     K ' ,   ,    __pycache__/appdirs.cpython-36.pyc000064400000044153152347724720013070 0ustar003 Pf`W@sdZd1ZdjeeeZddlZddlZejddkZ e r>eZ ej j drddl Z e j ddZej drrd Zqej d rd Zqd Znej Zd2ddZd3ddZd4ddZd5ddZd6ddZd7ddZGdddeZddZdd Zd!d"Zd#d$Zed kryddlZeZWnnek rydd%l m!Z!eZWnBek r|yddl"Z#eZWnek rveZYnXYnXYnXe$d&kr~d'Z%d(Z&d8Z'e(d)ee%e&d*d+Z)x$e'D]Z*e(d,e*e+e)e*fqWe(d-ee%e&Z)x$e'D]Z*e(d,e*e+e)e*fqWe(d.ee%Z)x$e'D]Z*e(d,e*e+e)e*fq$We(d/ee%d d0Z)x$e'D]Z*e(d,e*e+e)e*fq^WdS)9zyUtilities for determining application-specific dirs. See for details and usage. .NjavaZWindowswin32ZMacdarwinZlinux2FcCstdkr^|dkr|}|rdpd}tjjt|}|r|dk rNtjj|||}qtjj||}nNtdkrtjjd}|rtjj||}n&tjdtjjd }|rtjj||}|r|rtjj||}|S) aJReturn full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: macOS: ~/Library/Application Support/ Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined Win XP (not roaming): C:\Documents and Settings\\Application Data\\ Win XP (roaming): C:\Documents and Settings\\Local Settings\Application Data\\ Win 7 (not roaming): C:\Users\\AppData\Local\\ Win 7 (roaming): C:\Users\\AppData\Roaming\\ For Unix, we follow the XDG spec and support $XDG_DATA_HOME. That means, by default "~/.local/share/". rN CSIDL_APPDATACSIDL_LOCAL_APPDATAFrz~/Library/Application Support/Z XDG_DATA_HOMEz~/.local/share)systemospathnormpath_get_win_folderjoin expandusergetenv)appname appauthorversionroamingconstr r/usr/lib/python3.6/appdirs.py user_data_dir-s&   rcs tdkrR|dkr}tjjtd}r|dk rBtjj||}qtjj|}ntdkrztjjd}rtjj|}nttjdtjjdd g}d d |j tjD}r|rtjj|fd d |D}|rtjj|}n|d }|So|rtjj||}|S)aiReturn full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of data dirs should be returned. By default, the first item from XDG_DATA_DIRS is returned, or '/usr/local/share/', if XDG_DATA_DIRS is not set Typical user data directories are: macOS: /Library/Application Support/ Unix: /usr/local/share/ or /usr/share/ Win XP: C:\Documents and Settings\All Users\Application Data\\ Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) Win 7: C:\ProgramData\\ # Hidden, but writeable on Win 7. For Unix, this is using the $XDG_DATA_DIRS[0] default. WARNING: Do not use this on Windows. See the Vista-Fail note above for why. rNCSIDL_COMMON_APPDATAFrz/Library/Application SupportZ XDG_DATA_DIRSz/usr/local/sharez /usr/sharecSs g|]}tjj|jtjqSr)r r rrstripsep).0xrrr sz!site_data_dir..csg|]}tjj|gqSr)r rr)rr)rrrr sr) r r r rrrrrpathsepsplit)rrr multipathr pathlistr)rr site_data_dirds4  r%cCsXtdkrt||d|}n&tjdtjjd}|r>tjj||}|rT|rTtjj||}|S)aReturn full path to the user-specific config dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: macOS: same as user_data_dir Unix: ~/.config/ # or in $XDG_CONFIG_HOME, if defined Win *: same as user_data_dir For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. That means, by deafult "~/.config/". rrNZXDG_CONFIG_HOMEz ~/.config)rr)r rr rr rr)rrrrr rrruser_config_dirsr&cstd kr*t|}r|rtjj||}ndtjdd}dd|jtjD}rt|rbtjj|fdd|D}|rtjj|}n|d}|S) aReturn full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of config dirs should be returned. By default, the first item from XDG_CONFIG_DIRS is returned, or '/etc/xdg/', if XDG_CONFIG_DIRS is not set Typical user data directories are: macOS: same as site_data_dir Unix: /etc/xdg/ or $XDG_CONFIG_DIRS[i]/ for each value in $XDG_CONFIG_DIRS Win *: same as site_data_dir Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False WARNING: Do not use this on Windows. See the Vista-Fail note above for why. rrZXDG_CONFIG_DIRSz/etc/xdgcSs g|]}tjj|jtjqSr)r r rrr)rrrrrr sz#site_config_dir..csg|]}tjj|gqSr)r rr)rr)rrrr sr)rr)r r%r r rrr"r!)rrrr#r r$r)rrsite_config_dirs  r'TcCstdkrd|dkr|}tjjtd}|r|dk rBtjj|||}ntjj||}|rtjj|d}nNtdkrtjjd}|rtjj||}n&tjdtjjd }|rtjj||}|r|rtjj||}|S) aReturn full path to the user-specific cache dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Cache" to the base app data dir for Windows. See discussion below. Typical user cache directories are: macOS: ~/Library/Caches/ Unix: ~/.cache/ (XDG default) Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Cache Vista: C:\Users\\AppData\Local\\\Cache On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming app data dir (the default returned by `user_data_dir` above). Apps typically put cache data somewhere *under* the given dir here. Some examples: ...\Mozilla\Firefox\Profiles\\Cache ...\Acme\SuperApp\Cache\1.0 OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value. This can be disabled with the `opinion=False` option. rNr FZCacherz~/Library/CachesZXDG_CACHE_HOMEz~/.cache)r r r rrrrr)rrropinionr rrruser_cache_dirs(! r)cCstdkr tjjtjjd|}nNtdkrLt|||}d}|rntjj|d}n"t|||}d}|rntjj|d}|r|rtjj||}|S)aReturn full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Logs" to the base app data dir for Windows, and "log" to the base cache dir for Unix. See discussion below. Typical user cache directories are: macOS: ~/Library/Logs/ Unix: ~/.cache//log # or under $XDG_CACHE_HOME if defined Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Logs Vista: C:\Users\\AppData\Local\\\Logs On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in examples of what some windows apps use for a logs dir.) OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA` value for Windows and appends "log" to the user cache dir for Unix. This can be disabled with the `opinion=False` option. rz~/Library/LogsrFZLogslog)r r r rrrr))rrrr(r rrr user_log_dir:s    r+c@sbeZdZdZdddZeddZedd Zed d Zed d Z eddZ eddZ dS)AppDirsz1Convenience wrapper for getting application dirs.NFcCs"||_||_||_||_||_dS)N)rrrrr#)selfrrrrr#rrr__init__os zAppDirs.__init__cCst|j|j|j|jdS)N)rr)rrrrr)r-rrrrws zAppDirs.user_data_dircCst|j|j|j|jdS)N)rr#)r%rrrr#)r-rrrr%|s zAppDirs.site_data_dircCst|j|j|j|jdS)N)rr)r&rrrr)r-rrrr&s zAppDirs.user_config_dircCst|j|j|j|jdS)N)rr#)r'rrrr#)r-rrrr's zAppDirs.site_config_dircCst|j|j|jdS)N)r)r)rrr)r-rrrr)s zAppDirs.user_cache_dircCst|j|j|jdS)N)r)r+rrr)r-rrrr+s zAppDirs.user_log_dir)NNFF) __name__ __module__ __qualname____doc__r.propertyrr%r&r'r)r+rrrrr,ms      r,cCs:ddl}dddd|}|j|jd}|j||\}}|S)zThis is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. rNZAppDatazCommon AppDataz Local AppData)r rr z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)_winregOpenKeyHKEY_CURRENT_USERZ QueryValueEx) csidl_namer4Zshell_folder_namekeydirtyperrr_get_win_folder_from_registrysr;cCsddlm}m}|jdt||dd}y`t|}d}x|D]}t|dkr:d}Pq:W|ryddl}|j|}Wnt k rYnXWnt k rYnX|S)Nr)shellconshellFT) win32com.shellr<r=SHGetFolderPathgetattrunicodeordwin32apiGetShortPathName ImportError UnicodeError)r7r<r=r9 has_high_charcrDrrr_get_win_folder_with_pywin32s$   rJcCsddl}dddd|}|jd}|jjjd|dd|d}x|D]}t|dkrBd }PqBW|r|jd}|jjj|j|dr|}|jS) Nr#)r rr iFr>T) ctypesZcreate_unicode_bufferwindllZshell32ZSHGetFolderPathWrCZkernel32ZGetShortPathNameWvalue)r7rNZ csidl_constbufrHrIZbuf2rrr_get_win_folder_with_ctypess"    rRc Csddl}ddlm}ddlm}|jjd}|jd|}|jj }|j dt |j |d|j j ||jj|jjd}d}x|D]} t| dkr~d }Pq~W|r|jd|}|jj } tj|||r|jj|jjd}|S) Nr)jna)rrIFr>T)arrayZcom.sunrSZcom.sun.jna.platformrZWinDefZMAX_PATHZzerosZShell32ZINSTANCEr@rAZShlObjZSHGFP_TYPE_CURRENTZNativeZtoStringZtostringrrCZKernel32ZkernalrE) r7rVrSrZbuf_sizerQr=r9rHrIZkernelrrr_get_win_folder_with_jnas&       rW)rO__main__ZMyAppZ MyCompanyz%-- app dirs (with optional 'version')z1.0)rz%s: %sz) -- app dirs (without optional 'version')z+ -- app dirs (without optional 'appauthor')z( -- app dirs (with disabled 'appauthor'))r)rrr)NNNF)NNNF)NNNF)NNNF)NNNT)NNNT)rr%r&r'r)r+),r2Z__version_info__rmapstr __version__sysr version_infoZPY3rBplatform startswithZjava_verZos_namer rr%r&r'r)r+objectr,r;rJrRrWr?Zwin32comrrFrNrOZ com.sun.jnaZcomr/rrZpropsprintdirsZproprArrrr s~    7 B ( 3 9 3+         chardet/sbcharsetprober.py000064400000013031152347724720011733 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import CharacterCategory, ProbingState, SequenceLikelihood class SingleByteCharSetProber(CharSetProber): SAMPLE_SIZE = 64 SB_ENOUGH_REL_THRESHOLD = 1024 # 0.25 * SAMPLE_SIZE^2 POSITIVE_SHORTCUT_THRESHOLD = 0.95 NEGATIVE_SHORTCUT_THRESHOLD = 0.05 def __init__(self, model, reversed=False, name_prober=None): super(SingleByteCharSetProber, self).__init__() self._model = model # TRUE if we need to reverse every pair in the model lookup self._reversed = reversed # Optional auxiliary prober for name decision self._name_prober = name_prober self._last_order = None self._seq_counters = None self._total_seqs = None self._total_char = None self._freq_char = None self.reset() def reset(self): super(SingleByteCharSetProber, self).reset() # char order of last character self._last_order = 255 self._seq_counters = [0] * SequenceLikelihood.get_num_categories() self._total_seqs = 0 self._total_char = 0 # characters that fall in our sampling range self._freq_char = 0 @property def charset_name(self): if self._name_prober: return self._name_prober.charset_name else: return self._model['charset_name'] @property def language(self): if self._name_prober: return self._name_prober.language else: return self._model.get('language') def feed(self, byte_str): if not self._model['keep_english_letter']: byte_str = self.filter_international_words(byte_str) if not byte_str: return self.state char_to_order_map = self._model['char_to_order_map'] for i, c in enumerate(byte_str): # XXX: Order is in range 1-64, so one would think we want 0-63 here, # but that leads to 27 more test failures than before. order = char_to_order_map[c] # XXX: This was SYMBOL_CAT_ORDER before, with a value of 250, but # CharacterCategory.SYMBOL is actually 253, so we use CONTROL # to make it closer to the original intent. The only difference # is whether or not we count digits and control characters for # _total_char purposes. if order < CharacterCategory.CONTROL: self._total_char += 1 if order < self.SAMPLE_SIZE: self._freq_char += 1 if self._last_order < self.SAMPLE_SIZE: self._total_seqs += 1 if not self._reversed: i = (self._last_order * self.SAMPLE_SIZE) + order model = self._model['precedence_matrix'][i] else: # reverse the order of the letters in the lookup i = (order * self.SAMPLE_SIZE) + self._last_order model = self._model['precedence_matrix'][i] self._seq_counters[model] += 1 self._last_order = order charset_name = self._model['charset_name'] if self.state == ProbingState.DETECTING: if self._total_seqs > self.SB_ENOUGH_REL_THRESHOLD: confidence = self.get_confidence() if confidence > self.POSITIVE_SHORTCUT_THRESHOLD: self.logger.debug('%s confidence = %s, we have a winner', charset_name, confidence) self._state = ProbingState.FOUND_IT elif confidence < self.NEGATIVE_SHORTCUT_THRESHOLD: self.logger.debug('%s confidence = %s, below negative ' 'shortcut threshhold %s', charset_name, confidence, self.NEGATIVE_SHORTCUT_THRESHOLD) self._state = ProbingState.NOT_ME return self.state def get_confidence(self): r = 0.01 if self._total_seqs > 0: r = ((1.0 * self._seq_counters[SequenceLikelihood.POSITIVE]) / self._total_seqs / self._model['typical_positive_ratio']) r = r * self._freq_char / self._total_char if r >= 1.0: r = 0.99 return r chardet/universaldetector.py000064400000030305152347724720012310 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### """ Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco """ import codecs import logging import re from .charsetgroupprober import CharSetGroupProber from .enums import InputState, LanguageFilter, ProbingState from .escprober import EscCharSetProber from .latin1prober import Latin1Prober from .mbcsgroupprober import MBCSGroupProber from .sbcsgroupprober import SBCSGroupProber class UniversalDetector(object): """ The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result """ MINIMUM_THRESHOLD = 0.20 HIGH_BYTE_DETECTOR = re.compile(b'[\x80-\xFF]') ESC_DETECTOR = re.compile(b'(\033|~{)') WIN_BYTE_DETECTOR = re.compile(b'[\x80-\x9F]') ISO_WIN_MAP = {'iso-8859-1': 'Windows-1252', 'iso-8859-2': 'Windows-1250', 'iso-8859-5': 'Windows-1251', 'iso-8859-6': 'Windows-1256', 'iso-8859-7': 'Windows-1253', 'iso-8859-8': 'Windows-1255', 'iso-8859-9': 'Windows-1254', 'iso-8859-13': 'Windows-1257'} def __init__(self, lang_filter=LanguageFilter.ALL): self._esc_charset_prober = None self._charset_probers = [] self.result = None self.done = None self._got_data = None self._input_state = None self._last_char = None self.lang_filter = lang_filter self.logger = logging.getLogger(__name__) self._has_win_bytes = None self.reset() def reset(self): """ Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. """ self.result = {'encoding': None, 'confidence': 0.0, 'language': None} self.done = False self._got_data = False self._has_win_bytes = False self._input_state = InputState.PURE_ASCII self._last_char = b'' if self._esc_charset_prober: self._esc_charset_prober.reset() for prober in self._charset_probers: prober.reset() def feed(self, byte_str): """ Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``result`` attribute). .. note:: You should always call ``close`` when you're done feeding in your document if ``done`` is not already ``True``. """ if self.done: return if not len(byte_str): return if not isinstance(byte_str, bytearray): byte_str = bytearray(byte_str) # First check for known BOMs, since these are guaranteed to be correct if not self._got_data: # If the data starts with BOM, we know it is UTF if byte_str.startswith(codecs.BOM_UTF8): # EF BB BF UTF-8 with BOM self.result = {'encoding': "UTF-8-SIG", 'confidence': 1.0, 'language': ''} elif byte_str.startswith((codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE)): # FF FE 00 00 UTF-32, little-endian BOM # 00 00 FE FF UTF-32, big-endian BOM self.result = {'encoding': "UTF-32", 'confidence': 1.0, 'language': ''} elif byte_str.startswith(b'\xFE\xFF\x00\x00'): # FE FF 00 00 UCS-4, unusual octet order BOM (3412) self.result = {'encoding': "X-ISO-10646-UCS-4-3412", 'confidence': 1.0, 'language': ''} elif byte_str.startswith(b'\x00\x00\xFF\xFE'): # 00 00 FF FE UCS-4, unusual octet order BOM (2143) self.result = {'encoding': "X-ISO-10646-UCS-4-2143", 'confidence': 1.0, 'language': ''} elif byte_str.startswith((codecs.BOM_LE, codecs.BOM_BE)): # FF FE UTF-16, little endian BOM # FE FF UTF-16, big endian BOM self.result = {'encoding': "UTF-16", 'confidence': 1.0, 'language': ''} self._got_data = True if self.result['encoding'] is not None: self.done = True return # If none of those matched and we've only see ASCII so far, check # for high bytes and escape sequences if self._input_state == InputState.PURE_ASCII: if self.HIGH_BYTE_DETECTOR.search(byte_str): self._input_state = InputState.HIGH_BYTE elif self._input_state == InputState.PURE_ASCII and \ self.ESC_DETECTOR.search(self._last_char + byte_str): self._input_state = InputState.ESC_ASCII self._last_char = byte_str[-1:] # If we've seen escape sequences, use the EscCharSetProber, which # uses a simple state machine to check for known escape sequences in # HZ and ISO-2022 encodings, since those are the only encodings that # use such sequences. if self._input_state == InputState.ESC_ASCII: if not self._esc_charset_prober: self._esc_charset_prober = EscCharSetProber(self.lang_filter) if self._esc_charset_prober.feed(byte_str) == ProbingState.FOUND_IT: self.result = {'encoding': self._esc_charset_prober.charset_name, 'confidence': self._esc_charset_prober.get_confidence(), 'language': self._esc_charset_prober.language} self.done = True # If we've seen high bytes (i.e., those with values greater than 127), # we need to do more complicated checks using all our multi-byte and # single-byte probers that are left. The single-byte probers # use character bigram distributions to determine the encoding, whereas # the multi-byte probers use a combination of character unigram and # bigram distributions. elif self._input_state == InputState.HIGH_BYTE: if not self._charset_probers: self._charset_probers = [MBCSGroupProber(self.lang_filter)] # If we're checking non-CJK encodings, use single-byte prober if self.lang_filter & LanguageFilter.NON_CJK: self._charset_probers.append(SBCSGroupProber()) self._charset_probers.append(Latin1Prober()) for prober in self._charset_probers: if prober.feed(byte_str) == ProbingState.FOUND_IT: self.result = {'encoding': prober.charset_name, 'confidence': prober.get_confidence(), 'language': prober.language} self.done = True break if self.WIN_BYTE_DETECTOR.search(byte_str): self._has_win_bytes = True def close(self): """ Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`. """ # Don't bother with checks if we're already done if self.done: return self.result self.done = True if not self._got_data: self.logger.debug('no data received!') # Default to ASCII if it is all we've seen so far elif self._input_state == InputState.PURE_ASCII: self.result = {'encoding': 'ascii', 'confidence': 1.0, 'language': ''} # If we have seen non-ASCII, return the best that met MINIMUM_THRESHOLD elif self._input_state == InputState.HIGH_BYTE: prober_confidence = None max_prober_confidence = 0.0 max_prober = None for prober in self._charset_probers: if not prober: continue prober_confidence = prober.get_confidence() if prober_confidence > max_prober_confidence: max_prober_confidence = prober_confidence max_prober = prober if max_prober and (max_prober_confidence > self.MINIMUM_THRESHOLD): charset_name = max_prober.charset_name lower_charset_name = max_prober.charset_name.lower() confidence = max_prober.get_confidence() # Use Windows encoding name instead of ISO-8859 if we saw any # extra Windows-specific bytes if lower_charset_name.startswith('iso-8859'): if self._has_win_bytes: charset_name = self.ISO_WIN_MAP.get(lower_charset_name, charset_name) self.result = {'encoding': charset_name, 'confidence': confidence, 'language': max_prober.language} # Log all prober confidences if none met MINIMUM_THRESHOLD if self.logger.getEffectiveLevel() == logging.DEBUG: if self.result['encoding'] is None: self.logger.debug('no probers hit minimum threshold') for group_prober in self._charset_probers: if not group_prober: continue if isinstance(group_prober, CharSetGroupProber): for prober in group_prober.probers: self.logger.debug('%s %s confidence = %s', prober.charset_name, prober.language, prober.get_confidence()) else: self.logger.debug('%s %s confidence = %s', prober.charset_name, prober.language, prober.get_confidence()) return self.result chardet/__pycache__/mbcharsetprober.cpython-36.pyc000064400000004151152347724720016214 0ustar003 PfU @s0ddlmZddlmZmZGdddeZdS)) CharSetProber) ProbingState MachineStatecsVeZdZdZdfdd ZfddZeddZed d Zd d Z d dZ Z S)MultiByteCharSetProberz MultiByteCharSetProber Ncs,tt|j|dd|_d|_ddg|_dS)N) lang_filter)superr__init__distribution_analyzer coding_sm _last_char)selfr) __class__%/usr/lib/python3.6/mbcharsetprober.pyr 'szMultiByteCharSetProber.__init__cs<tt|j|jr|jj|jr.|jjddg|_dS)Nr)rrresetr r r )r )rrrr-s   zMultiByteCharSetProber.resetcCstdS)N)NotImplementedError)r rrr charset_name5sz#MultiByteCharSetProber.charset_namecCstdS)N)r)r rrrlanguage9szMultiByteCharSetProber.languagecCsxtt|D]}|jj||}|tjkrN|jjd|j|j |t j |_ Pq|tj krdt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j|q|jj||d|d|qW|d|jd<|jt jkr|jjr|j|jkrt j|_ |jS)Nz!%s %s prober hit error at byte %srr)rangelenr Z next_staterZERRORZloggerdebugrrrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenr r feedstateZ DETECTINGZgot_enough_dataget_confidenceZSHORTCUT_THRESHOLD)r Zbyte_striZ coding_stateZchar_lenrrrr=s.       zMultiByteCharSetProber.feedcCs |jjS)N)r r)r rrrrZsz%MultiByteCharSetProber.get_confidence)N) __name__ __module__ __qualname____doc__r rpropertyrrrr __classcell__rr)rrr"s   rN)Z charsetproberrZenumsrrrrrrrs chardet/__pycache__/hebrewprober.cpython-36.pyc000064400000005513152347724720015523 0ustar003 Pf6@s,ddlmZddlmZGdddeZdS)) CharSetProber) ProbingStatecseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZfddZddZddZddZddZddZeddZeddZedd ZZS)! HebrewProberg{Gz?z ISO-8859-8z windows-1255cs>tt|jd|_d|_d|_d|_d|_d|_|j dS)N) superr__init___final_char_logical_score_final_char_visual_score_prev _before_prev_logical_prober_visual_proberreset)self) __class__"/usr/lib/python3.6/hebrewprober.pyrszHebrewProber.__init__cCsd|_d|_d|_d|_dS)N )rrrr)rrrrrszHebrewProber.resetcCs||_||_dS)N)rr)rZ logicalProberZ visualProberrrrset_model_probersszHebrewProber.set_model_proberscCs||j|j|j|j|jgkS)N) FINAL_KAF FINAL_MEM FINAL_NUNFINAL_PE FINAL_TSADI)rcrrris_finalszHebrewProber.is_finalcCs||j|j|j|jgkS)N) NORMAL_KAF NORMAL_MEM NORMAL_NUN NORMAL_PE)rr%rrr is_non_finals zHebrewProber.is_non_finalcCs|jtjkrtjS|j|}x|D]}|dkrp|jdkr|j|jrT|jd7_q|j|jr|j d7_ n,|jdkr|j|jr|dkr|j d7_ |j|_||_q"Wtj S)Nrr) staterNOT_MEZfilter_high_byte_onlyrr&rrr+r DETECTING)rZbyte_strZcurrrrfeeds         zHebrewProber.feedcCsx|j|j}||jkr|jS||j kr.|jS|jj|jj}||jkrR|jS||j krd|jS|dkrr|jS|jS)Ng) rrMIN_FINAL_CHAR_DISTANCELOGICAL_HEBREW_NAMEVISUAL_HEBREW_NAMErZget_confidencerMIN_MODEL_DISTANCE)rZfinalsubZmodelsubrrr charset_names      zHebrewProber.charset_namecCsdS)NZHebrewr)rrrrlanguageszHebrewProber.languagecCs(|jjtjkr"|jjtjkr"tjStjS)N)rr,rr-rr.)rrrrr,szHebrewProber.state)__name__ __module__ __qualname__r r'r!r(r"r)r#r*r$Z NORMAL_TSADIr0r3r2r1rrrr&r+r/propertyr4r5r, __classcell__rr)rrrs.  ;  rN)Z charsetproberrZenumsrrrrrrs  cchardet/__pycache__/compat.cpython-36.pyc000064400000000431152347724720014312 0ustar003 Pfn@s@ddlZejdkr(dZdZeefZeZndZdZeefZeZdS)NTF)rr) sys version_infoZPY2ZPY3strZunicodeZbase_strZ text_typebytesrr/usr/lib/python3.6/compat.pys chardet/__pycache__/gb2312prober.cpython-36.opt-1.pyc000064400000002041152347724720016077 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)GB2312DistributionAnalysis)GB2312_SM_MODELcs4eZdZfddZeddZeddZZS) GB2312Probercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__"/usr/lib/python3.6/gb2312prober.pyr"s zGB2312Prober.__init__cCsdS)NZGB2312r )r r r r charset_name(szGB2312Prober.charset_namecCsdS)NZChineser )r r r r language,szGB2312Prober.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r!s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/gb2312prober.cpython-36.pyc000064400000002041152347724720015140 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)GB2312DistributionAnalysis)GB2312_SM_MODELcs4eZdZfddZeddZeddZZS) GB2312Probercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__"/usr/lib/python3.6/gb2312prober.pyr"s zGB2312Prober.__init__cCsdS)NZGB2312r )r r r r charset_name(szGB2312Prober.charset_namecCsdS)NZChineser )r r r r language,szGB2312Prober.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r!s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/langhebrewmodel.cpython-36.pyc000064400000055445152347724720016205 0ustar003 PfQ,@sdZdZeedddddZdS)E[OP\YaZDopRI_UNyVGCfkTrgs2J<=*LF@5i]8A61Bn3+,?QMbKl|(:S4/.H ^qm"tvduwh}Wcjz{7ex0'9;)X!%$#>~&-     `g C|?Fz windows-1255ZHebrew)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguageN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZWIN1255_CHAR_TO_ORDER_MAPZHEBREW_LANG_MODELZWin1255HebrewModelrr%/usr/lib/python3.6/langhebrewmodel.py&s* chardet/__pycache__/escprober.cpython-36.pyc000064400000004742152347724720015024 0ustar003 Pfn@sXddlmZddlmZddlmZmZmZddlm Z m Z m Z m Z GdddeZ dS)) CharSetProber)CodingStateMachine)LanguageFilter ProbingState MachineState) HZ_SM_MODELISO2022CN_SM_MODELISO2022JP_SM_MODELISO2022KR_SM_MODELcsVeZdZdZdfdd ZfddZeddZed d Zd d Z d dZ Z S)EscCharSetProberz This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. Ncstt|j|dg|_|jtj@rD|jjtt |jjtt |jtj @r`|jjtt |jtj @r||jjttd|_d|_d|_d|_|jdS)N) lang_filter)superr __init__ coding_smr rZCHINESE_SIMPLIFIEDappendrrrZJAPANESEr ZKOREANr active_sm_count_detected_charset_detected_language_statereset)selfr ) __class__/usr/lib/python3.6/escprober.pyr*s   zEscCharSetProber.__init__csNtt|jx"|jD]}|s qd|_|jqWt|j|_d|_d|_dS)NT) r r rractivelenrrr)rr)rrrr:s   zEscCharSetProber.resetcCs|jS)N)r)rrrr charset_nameEszEscCharSetProber.charset_namecCs|jS)N)r)rrrrlanguageIszEscCharSetProber.languagecCs|jr dSdSdS)NgGz?g)r)rrrrget_confidenceMszEscCharSetProber.get_confidencecCsx|D]}x|jD]}| s|j r&q|j|}|tjkrhd|_|jd8_|jdkrtj|_|j Sq|tj krtj |_|j |_ |j|_|j SqWqW|j S)NFr)rrZ next_staterZERRORrrZNOT_MErstateZITS_MEZFOUND_ITZget_coding_state_machinerrr)rZbyte_strcrZ coding_staterrrfeedSs"       zEscCharSetProber.feed)N) __name__ __module__ __qualname____doc__rrpropertyrrrr" __classcell__rr)rrr #s  r N)Z charsetproberrZcodingstatemachinerZenumsrrrZescsmrrr r r rrrrs  chardet/__pycache__/big5freq.cpython-36.opt-1.pyc000064400000152574152347724720015512 0ustar003 Pfz@sdZdZdZdS(g?  Ra n! L,B { ]  j.Ni:?=NKkq    b  o2 i c8{| " @\ F| QHPv D^ F} E O0s4<2 &M~ G[ ? aK *g Z : K  `l  q~  cu* ~meG^n UCC jo/P7 [ ? oS( p]6j @ 8+3 [\] A  1H d+ 2 OL f139l,  ez QM& X kpM % ' \ 7J!NB P_ q    I8  {   mfx   g &'. M $#DhA rUG QSid 0FC  J UN < :A  9} WP )D4 )r st9 s *]  D j(   u5Yj lu ` = 5!TE xe O P| 6A /k l! B` A  v wM a  } x,} B F km    b) ^ P  , 75 ~ y| z C {1b t  _   b 5Dl|[*  %G ^ l `  pncgm'2{  D f |:    n ;IY} X" -lE~>],vLBi& GB +   a a }E D=0  6 v!9H F"H  oR*.I 3, *SX/bp R 7 2 _ b   ` O `7 a g  _~ a b   ; - Q q`##r sdt c  kw  g QU CSc 5B_ cNY Ld K 8 aG s6 t; N  4:\q. u   r c @   /9   < d 8vC m Zw {$Md 0r gV: Z{$e 0$ 5[vcVR $; f  dWe   J u   K 2L .2 %    x M }Td ` 3; yYL U\VN   "x%;= 2E!^"w # $<Qr%]&< ' 36B (   g )  *+! :7^ ( ,+  x-/h= .V  h /<;0 1z  56 _)234y"  ^5 ?%+f 6_W 7>  g # u 8 9h F V{ O Iw~ ^: ;e1  P <=> (`R? YI  7 ? @oqYnl  i EPV! nA|  B- O CDWTT }E&  ~G $ Wo FG" # D-Q He I Jz KL$ H M: NI HO PQkRR    ST % & S U S CV~!X,O|Pe   T WXYR v  = ZU [ V % \]^8T . ' _vwt`ab> "{ cd9[9dh  e J !f Tg %WMhi( j y7mjk ? W " Bl| ) z  mnuv w * opq7.r  f s& y   > Y tu/ + v  @ w 3, x 69 6 ! yQ:c - oFX f z  {/' b`u v   0ES8[|}G !~FU   es w " a Z& A i  o    A J0 x  Y  Z 8oQ aQp;Pb    ] '.   L / B 0 [ 8 /3 0 n 4<  Y C  }1 K 0 F #\f >    j-p9@ 6y  1 V4 K1  D # 2  ZHpg  qr   K V \ ,  ]u Z j0hh  E    2 Mw y ? tm( +i   L )  f  R"A 3 -1$ (] # $  *   =k !   _^ 2 9 4  b  5 "  4I # j $k  \ gE5  6  %  [  &e o l }z+  n- 'i (   Biq<*j)"*>)7 +z,M )r- Tp##   S.8 z 9 =m Sx/q35:   ; 01n _ ] n %  ` zTs23  { 5 g k 34 c   a:1 !Ah o 6" l - a 5   #! $ 4 f %& N  W ' $< NW kO X , 6&tP  7 - j  C[p  '8 b m  {(  9 :  ^B ;   )<=  > =n HD ?UW = : N KE@4c > Q Ah ( ]B*lCDEh X++JU m EFG k n d F ! r@H"CG ^  8t) ; ? !oI "##$J % &rK'5 ()o @ }A ,*41+ " , C urD - - Lv{| M..NY 6  /0/ 1$2%GRB _C  D 3  .  4@w567i &08 & * + G Ou# 1PRQ )=9l E Sk \  y: ;<F %=R>d', ?e$ 23-  4(S@AB.TO   &  < CD Up G e  E;VF'G) } H*WIT  J. g~Uj  X8* K~  LH % +f  tMN   k YY*/ OR ZH #I 5S ]E [\ sI +PQ, RST,U]V L-! T \4W XYZ[>w+^J _$\l.]`^_q %`a 6g U bcda q x e by fhgh'i  jr  0  =b|  h k l acm n u des K /o7& J 8pqi j f g (`rs <Fk f]It>uv  0-wL  Ga t  SKxyzV O1 { F y9Z |}~F  :2 p;G  h7 qM    (8 N 3 O <TW (1u Z cjP p  v ij  Q K  ' 9  z  k 2 l>=C'> Z mn b q?   " ? }o@>A 1)? x   3 h l ) p'4  A_ BL  Pq rX cs! H w CDtx  / 5 4 ur _/ <~7y m ^5 n b tl 6 7v 8:  0 1 wI ( B 4s  ?Cx EH FyzG{|; }9mH ~z s M  m Io _ 2 3 H* < i:  A R  "     Q Y {K [ JN S I T @  @R t JI  U m{   ;V  < dX96 U L!= )       =$(v&c  >{"#W   $ %&^[ '( 2\ J p pn u q ) O >  *X  + ,  K I-!.DJs#  7 /w|"4 | , ?Y P 01Z Z   #@2|zA'?  8  yLV 3 $M%   .4N   59 %KQ x67B Ov [ &  X* \ P N+ w WC  QD ?] ^ o R E F 'XGS T R8x kST  D9!(L"#$%_ &J:U} ) ;< E+' H=V*Hy, +W3> ?(I,-` qa  )*X +OY,-./ 0.1 Jr 23$  4567 b } fK 8Z9:  c : ;s J @ t ; /<d  U 0e =f u M > [ALi? @Av BC\j[ g DEF BG H(MCh INJ KLM12NdOdV D`#5 P]QEn ^R_FSp i TU V GeHO P`Ww j X 3 aIYJx 7- 4k bZ-. c[ r;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rurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r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%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZBIG5_TYPICAL_DISTRIBUTION_RATIOZBIG5_TABLE_SIZEZBIG5_CHAR_TO_FREQ_ORDERrr/usr/lib/python3.6/big5freq.py+schardet/__pycache__/charsetprober.cpython-36.pyc000064400000006456152347724720015707 0ustar003 Pf@s0ddlZddlZddlmZGdddeZdS)N) ProbingStatec@sneZdZdZdddZddZeddZd d Zed d Z d dZ e ddZ e ddZ e ddZdS) CharSetProbergffffff?NcCsd|_||_tjt|_dS)N)_state lang_filterloggingZ getLogger__name__Zlogger)selfrr #/usr/lib/python3.6/charsetprober.py__init__'szCharSetProber.__init__cCs tj|_dS)N)rZ DETECTINGr)r r r r reset,szCharSetProber.resetcCsdS)Nr )r r r r charset_name/szCharSetProber.charset_namecCsdS)Nr )r bufr r r feed3szCharSetProber.feedcCs|jS)N)r)r r r r state6szCharSetProber.statecCsdS)Ngr )r r r r get_confidence:szCharSetProber.get_confidencecCstjdd|}|S)Ns([-])+ )resub)rr r r filter_high_byte_only=sz#CharSetProber.filter_high_byte_onlycCsbt}tjd|}xJ|D]B}|j|dd|dd}|j rP|dkrPd}|j|qW|S)u9 We define three types of bytes: alphabet: english alphabets [a-zA-Z] international: international characters [€-ÿ] marker: everything else [^a-zA-Z€-ÿ] The input buffer can be thought to contain a series of words delimited by markers. This function works to filter all words that contain at least one international character. All contiguous sequences of markers are replaced by a single space ascii character. This filter applies to all scripts which do not use English characters. s%[a-zA-Z]*[-]+[a-zA-Z]*[^a-zA-Z-]?Nrrr) bytearrayrfindallextendisalpha)rfilteredZwordsZwordZ last_charr r r filter_international_wordsBs  z(CharSetProber.filter_international_wordscCst}d}d}xtt|D]r}|||d}|dkr>d}n |dkrJd}|dkr|j r||kr| r|j||||jd|d}qW|s|j||d |S) a Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain both English characters and extended ASCII characters, but is currently only used by ``Latin1Prober``. Frr>s chardet/__pycache__/charsetprober.cpython-36.opt-1.pyc000064400000006456152347724720016646 0ustar003 Pf@s0ddlZddlZddlmZGdddeZdS)N) ProbingStatec@sneZdZdZdddZddZeddZd d Zed d Z d dZ e ddZ e ddZ e ddZdS) CharSetProbergffffff?NcCsd|_||_tjt|_dS)N)_state lang_filterloggingZ getLogger__name__Zlogger)selfrr #/usr/lib/python3.6/charsetprober.py__init__'szCharSetProber.__init__cCs tj|_dS)N)rZ DETECTINGr)r r r r reset,szCharSetProber.resetcCsdS)Nr )r r r r charset_name/szCharSetProber.charset_namecCsdS)Nr )r bufr r r feed3szCharSetProber.feedcCs|jS)N)r)r r r r state6szCharSetProber.statecCsdS)Ngr )r r r r get_confidence:szCharSetProber.get_confidencecCstjdd|}|S)Ns([-])+ )resub)rr r r filter_high_byte_only=sz#CharSetProber.filter_high_byte_onlycCsbt}tjd|}xJ|D]B}|j|dd|dd}|j rP|dkrPd}|j|qW|S)u9 We define three types of bytes: alphabet: english alphabets [a-zA-Z] international: international characters [€-ÿ] marker: everything else [^a-zA-Z€-ÿ] The input buffer can be thought to contain a series of words delimited by markers. This function works to filter all words that contain at least one international character. All contiguous sequences of markers are replaced by a single space ascii character. This filter applies to all scripts which do not use English characters. s%[a-zA-Z]*[-]+[a-zA-Z]*[^a-zA-Z-]?Nrrr) bytearrayrfindallextendisalpha)rfilteredZwordsZwordZ last_charr r r filter_international_wordsBs  z(CharSetProber.filter_international_wordscCst}d}d}xtt|D]r}|||d}|dkr>d}n |dkrJd}|dkr|j r||kr| r|j||||jd|d}qW|s|j||d |S) a Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain both English characters and extended ASCII characters, but is currently only used by ``Latin1Prober``. Frr>s chardet/__pycache__/sbcsgroupprober.cpython-36.pyc000064400000002776152347724720016266 0ustar003 Pf @sddlmZddlmZddlmZmZmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZddlmZddlmZdd lmZGd d d eZd S) )CharSetGroupProber)SingleByteCharSetProber)Win1251CyrillicModel Koi8rModelLatin5CyrillicModelMacCyrillicModel Ibm866Model Ibm855Model)Latin7GreekModelWin1253GreekModel)Latin5BulgarianModelWin1251BulgarianModel)TIS620ThaiModel)Win1255HebrewModel) HebrewProber)Latin5TurkishModelcseZdZfddZZS)SBCSGroupProberc stt|jtttttttttttt tt tt tt tt ttttg |_t}ttd|}ttd|}|j|||jj|||g|jdS)NFT)superr__init__rrrrrrr r r r r rrZprobersrrZset_model_probersextendreset)selfZ hebrew_proberZlogical_hebrew_proberZvisual_hebrew_prober) __class__%/usr/lib/python3.6/sbcsgroupprober.pyr,s,   zSBCSGroupProber.__init__)__name__ __module__ __qualname__r __classcell__rr)rrr+srN)ZcharsetgroupproberrZsbcharsetproberrZlangcyrillicmodelrrrrrr Zlanggreekmodelr r Zlangbulgarianmodelr r Z langthaimodelrZlanghebrewmodelrZ hebrewproberrZlangturkishmodelrrrrrrs       chardet/__pycache__/langgreekmodel.cpython-36.opt-1.pyc000064400000057637152347724720016772 0ustar003 Pf1@s4dZdZdZeedddddZeedddddZdS)Rdh^betfou\XqUOviSCrw_cmHFPQ<`]YDxaMVE7NsAB:LjgWkpZJ=$.GI6l{n3+)"[(4/,5&1;'#0%!-82T9y|     *@Kgs?Fz ISO-8859-7ZGreek)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZk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rryryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrjrjrjrjryrrrrrrryrjrryrryrjryrrrjrrjrrjrfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrjryrjrjryryrjrryrrjrrrryrrrrrfryrryrryrrryrryrryryrrrfrryryryrryryryrryryryrrryrrrfrrrrrryrrjrjryrrrrrrrfrjrryrryryryrrryrrjrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrjrryrjryrryryrryrryryrryrryryryrrrrrrryrjrrrryrrfryrrrrryryrrrryrfrryryrrrrrrrfrryrrrrrrrrryrfrryrjryryrjryrjryrrrjrjrjrrrjryrrrrfrfrryrryryrryrryrryryrrryrryryryrryryryryrrryrrrryrrfrrrrrrjrrjrjryryrrjrrrryryrryryryrfryrrrfryryrrrjrrrryrrfryrrrrfryrrrrrrrryryrrfrrryrrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryrjrjryryrrrryrryrjrjrryrrrrrrryryryrryryrryrryrryryrrryryryryrfrrryryrryrrryrrrrrrryrrrrrrrryrrjryrjrrrrjrrryryrryrryryryrrryrrrrrrrrryrrryryrrryryryrrrrrrryrrrryrrrrrrrrrrrrrrryrrrjryrryryryryryrrrryrrrrryrrfrrryrrfrrrrryryryrryryrrfryrryryryrryryryryrfryryrrryrrrrrrrrrrrrrrfrrrrrrrrrryrrrrrrrfrrrrrrrrrryrryrryryrrrrrfryrfrrryryrrryrrrrrrrrrrrrrrrjryrjrrryrrrryryrryrrrrfrrryrryrryryrrrrrrryrrrrryryrrrrrrryrrrrrrrrrryrrrrrrrryryrjryryrrrrrrrfrjrryrryryrrrrfrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryrryrrjryrryrrrrrrryryrrrrrrrrrrrrrrrfrrryrrrrrfrfrrryrfryrryryrrfrrrfrrrryrrrrrrrrjrryryryrrryrrrryrrrryrjrryrrrrrrryryrrrryrrfryrrrrfryryrfrrrryrrryrrrrrrrrrfrrrrrrrrrrrrrrrrjrrrrrrryrrrrrrrrrrrrrrrrryrfryrryryrryrrryrrrrrfryrfrryrfrrrrrrrrrrrrryrrrrjrfryryrryrrrrryrrrryrrrjrrrrryryryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryrfrryrrfryrrrrrrrrrrrrrryrrrfrrrrrrryrryryrrryryryryryrrfryrrrryryrrfrryrrryryrrrrrrrrrrrfrrrrrrrrjrrryrrrrrrrrryrryrrrrryrrfryrrrrryryrfrrfrrfrryryryrfrrrrrrrfrrrrrrrryrrfryrrrrrrrrrrryrrryryrrrrrfrrrrrrryrryryrrrrryryrrrrrrryrrrrrrrrrryrrryrrrrryryryryrrrrjrrrrrrrrryrrrrrrryrrrrrrrfrrryrrrrrfryrrrrrrryryrfrfrrrrrrrfrrrrrrrryrryryryrrryrrrrrrrryryryrrrryrrrrrrrrryrrrfrrrrryrfrrrrrrrfrrrrrrfrrrrrrrrrrrrjrryrrrrrrrrryrrrrrryrrrrrrrryrrrrryrrryrrrrryryrrrrrfrrrfrrrrrrrrrrrrrrrrryrryryrfrrrrrrryrrryrryryryrrrrrrryrrrrryrrryrrryrryryrrrrryrryrrrrrryrrrryrrrrrrrrrjrrrryryrryryrrrrrryrrrrrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrfrrrrrrfrrrrrrrrrrrrrrrrrrrrrrrrfrrrrrrrrrrrrrrrrrrryrrryrrrrrrryryryryryrrrrrrryrrrrrrrrrrrrrrfrfrrrrfrrrrrrrryrfrrrrrrryrrrrrrrrrrrrrrrrrrrrrrrryryrrrrrryrrrrrrrrrfrrrrrrrrrryrrrryrrrrrrfrrrrryryrrrrfrrrrrrrrrrrrrrrfrrrrrrrrrrrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrfrrrfrryrrrrryrryrrrrrrrrrrrrrrryrrrrrrrrrrrrrrrrfrrrrrfrfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrfrrrrrrrrrrrrrrfrrrrrfrrryrryrrrrrrrrrrrryrfrrrrrrryrrrrfryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZLatin7_char_to_order_mapZwin1253_char_to_order_mapZGreekLangModelZLatin7GreekModelZWin1253GreekModelrr$/usr/lib/python3.6/langgreekmodel.py#sV chardet/__pycache__/sbcharsetprober.cpython-36.opt-1.pyc000064400000005532152347724720017165 0ustar003 Pf@s4ddlmZddlmZmZmZGdddeZdS)) CharSetProber)CharacterCategory ProbingStateSequenceLikelihoodcsbeZdZdZdZdZdZdfdd Zfd d Ze d d Z e d dZ ddZ ddZ ZS)SingleByteCharSetProber@igffffff?g?FNcsJtt|j||_||_||_d|_d|_d|_d|_ d|_ |j dS)N) superr__init___model _reversed _name_prober _last_order _seq_counters _total_seqs _total_char _freq_charreset)selfmodelreversedZ name_prober) __class__%/usr/lib/python3.6/sbcharsetprober.pyr 'sz SingleByteCharSetProber.__init__cs:tt|jd|_dgtj|_d|_d|_d|_ dS)N) rrrr rZget_num_categoriesrrrr)r)rrrr5s zSingleByteCharSetProber.resetcCs|jr|jjS|jdSdS)N charset_name)r rr )rrrrr?sz$SingleByteCharSetProber.charset_namecCs|jr|jjS|jjdSdS)Nlanguage)r rr get)rrrrrFsz SingleByteCharSetProber.languagec Csn|jds|j|}|s|jS|jd}xt|D]\}}||}|tjkrZ|jd7_||jkr|jd7_|j |jkr|j d7_ |j s|j |j|}|jd|}n||j|j }|jd|}|j |d7<||_ q2W|jd}|jt jkrh|j |jkrh|j}||jkr@|jjd||t j|_n(||jkrh|jjd|||jt j|_|jS)NZkeep_english_letterchar_to_order_maprZprecedence_matrixrz$%s confidence = %s, we have a winnerz9%s confidence = %s, below negative shortcut threshhold %s)r Zfilter_international_wordsstate enumeraterZCONTROLr SAMPLE_SIZErr rr rrZ DETECTINGSB_ENOUGH_REL_THRESHOLDget_confidencePOSITIVE_SHORTCUT_THRESHOLDZloggerdebugZFOUND_ITZ_stateNEGATIVE_SHORTCUT_THRESHOLDZNOT_ME) rZbyte_strricorderrrZ confidencerrrfeedMsF           zSingleByteCharSetProber.feedcCsNd}|jdkrJd|jtj|j|jd}||j|j}|dkrJd}|S)Ng{Gz?rg?Ztypical_positive_ratiogGz?)rrrZPOSITIVEr rr)rrrrrr#|s  z&SingleByteCharSetProber.get_confidence)FN)__name__ __module__ __qualname__r!r"r$r&r rpropertyrrr*r# __classcell__rr)rrr!s  /rN)Z charsetproberrZenumsrrrrrrrrs chardet/__pycache__/cp949prober.cpython-36.pyc000064400000002030152347724720015106 0ustar003 Pf?@sDddlmZddlmZddlmZddlmZGdddeZdS))EUCKRDistributionAnalysis)CodingStateMachine)MultiByteCharSetProber)CP949_SM_MODELcs4eZdZfddZeddZeddZZS) CP949Probercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__!/usr/lib/python3.6/cp949prober.pyr#s zCP949Prober.__init__cCsdS)NZCP949r )r r r r charset_name+szCP949Prober.charset_namecCsdS)NZKoreanr )r r r r language/szCP949Prober.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r"s  rN) ZchardistributionrZcodingstatemachinerZmbcharsetproberrZmbcssmrrr r r r s    chardet/__pycache__/euckrprober.cpython-36.pyc000064400000002031152347724720015350 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)EUCKRDistributionAnalysis)EUCKR_SM_MODELcs4eZdZfddZeddZeddZZS) EUCKRProbercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__!/usr/lib/python3.6/euckrprober.pyr#s zEUCKRProber.__init__cCsdS)NzEUC-KRr )r r r r charset_name)szEUCKRProber.charset_namecCsdS)NZKoreanr )r r r r language-szEUCKRProber.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r"s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/latin1prober.cpython-36.pyc000064400000005456152347724720015445 0ustar003 Pf@s^ddlmZddlmZdZdZdZdZdZdZ dZ dZ d Z d Z eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeee ee ee eeeeeeeeeeee ee ee e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e fZdZGd d d eZd S)) CharSetProber) ProbingStatecsLeZdZfddZddZeddZeddZd d Zd d Z Z S) Latin1Probercs&tt|jd|_d|_|jdS)N)superr __init___last_char_class _freq_counterreset)self) __class__"/usr/lib/python3.6/latin1prober.pyraszLatin1Prober.__init__cCs t|_dgt|_tj|dS)Nr)OTHr FREQ_CAT_NUMrrr)rrrrrgs zLatin1Prober.resetcCsdS)Nz ISO-8859-1r)rrrr charset_namelszLatin1Prober.charset_namecCsdS)Nr)rrrrlanguagepszLatin1Prober.languagecCsb|j|}xP|D]H}t|}t|jt|}|dkr@tj|_P|j|d7<||_qW|j S)Nrr) Zfilter_with_english_lettersLatin1_CharToClassLatin1ClassModelr CLASS_NUMrNOT_MEZ_staterstate)rZbyte_strcZ char_classZfreqrrrfeedts    zLatin1Prober.feedcCs\|jtjkrdSt|j}|dkr(d}n|jd|jdd|}|dkrPd}|d}|S)Ng{Gz?grrg4@g\(\?)rrrsumr)rZtotalZ confidencerrrget_confidences  zLatin1Prober.get_confidence) __name__ __module__ __qualname__rrpropertyrrr!r# __classcell__rr)rrr `s    r N)@rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Z charsetproberrZenumsrrZUDFrZASCZASSZACVZACOZASVZASOrrrr rrrrsh   chardet/__pycache__/mbcssm.cpython-36.pyc000064400000042131152347724720014316 0ustar003 Pfc@sl ddlmZdZejejejdejejejejejejejejejejejejejejejejejejejejfZdZedeeddZd Z ejejdejejejddejd ejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejfFZ d!Z e d e e ddZ d"Z ddddejejejejejejejejejejejejejejejejejejejejejejejejejejdejdejejejejejejejf(Zd#Ze d eeddZd$ZejejdejejejejejejejejejejejejejfZd%ZedeeddZd&Zejejejddddejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejejejejejejejf0Zd'Zed eeddZd(Zejejejejejejdejejejejejejejejejejejejejejejejejdejejejejejejejejejdejejejejejejejejejejejejejf0Zd)Zed eeddZd*ZejejejdejejejejejejejejejejejejejejejejejejejejfZd+Zed eeddZ d,Z!dd d ejddejejejejejejejejejejejejd d d d ejejd d d d d ejd d d d d d dd d ejdd d d ejd d d d d d d ejejejejf8Z"d-Z#e!d e"e#ddZ$d.Z%d d d d ddejejejejejejejejejejejejdddejejejdddejdejd d d d d d dddejdddejejejdddddejdejejejf8Z&d/Z'e%d e&e'ddZ(d0Z)ejejejejejejdd d dd d d dddejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejddddejejejejejejejejejejejejejdddejejejejejejejejejejejejd d d d ejejejejejejejejejejejejejejd d ejejejejejejejejejejejejd d d d ejejejejejejejejejejejejejejejd ejejejejejejejejejejejejddddejejejejejejejejejejejejejejejdejejejejejejejejejejejejdddejejejejejejejejejejejejejejejejejejejejejejejejejejejfZ*d1Z+e)de*e+ddZ,dS)2) MachineStateZBig5)Z class_tableZ class_factorZ state_tableZchar_len_tablename ZCP949zEUC-JPzEUC-KRzx-euc-twZGB2312Z Shift_JISzUTF-16BEzUTF-16LE zUTF-8N(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr) rrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r)rrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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N_TABLEZGB2312_SM_MODELZSJIS_CLSZSJIS_STZSJIS_CHAR_LEN_TABLEZ SJIS_SM_MODELZ UCS2BE_CLSZ UCS2BE_STZUCS2BE_CHAR_LEN_TABLEZUCS2BE_SM_MODELZ UCS2LE_CLSZ UCS2LE_STZUCS2LE_CHAR_LEN_TABLEZUCS2LE_SM_MODELZUTF8_CLSZUTF8_STZUTF8_CHAR_LEN_TABLEZ UTF8_SM_MODELrr/usr/lib/python3.6/mbcssm.pysh  $ (((((,  "$   $  $ $                $chardet/__pycache__/jpcntx.cpython-36.opt-1.pyc000064400000113272152347724720015304 0ustar003 PfL@s8d`ZGdddeZGdd d eZGd d d eZd S)ac@sPeZdZdZdZdZdZdZddZdd Z d d Z d d Z ddZ ddZ dS)JapaneseContextAnalysisrdircCs*d|_d|_d|_d|_d|_|jdS)N) _total_rel _rel_sample_need_to_skip_char_num_last_char_order_donereset)selfr/usr/lib/python3.6/jpcntx.py__init__{s z JapaneseContextAnalysis.__init__cCs*d|_dg|j|_d|_d|_d|_dS)NrrF)r NUM_OF_CATEGORYr r r r)rrrrrs zJapaneseContextAnalysis.resetcCs|jr dS|j}x||kr|j|||d\}}||7}||krV|||_d|_q|dkr|jdkr|jd7_|j|jkrd|_P|jt|j|d7<||_qWdS)NrrTrrr)rr get_orderr r MAX_REL_THRESHOLDr jp2CharContext)rbyte_strZ num_bytesiorderchar_lenrrrfeeds     zJapaneseContextAnalysis.feedcCs |j|jkS)N)r ENOUGH_REL_THRESHOLD)rrrrgot_enough_datasz'JapaneseContextAnalysis.got_enough_datacCs,|j|jkr"|j|jd|jS|jSdS)Nr)r MINIMUM_DATA_THRESHOLDr DONT_KNOW)rrrrget_confidences z&JapaneseContextAnalysis.get_confidencecCsdS)Nrr)rrr)rrrrrrsz!JapaneseContextAnalysis.get_orderNr)__name__ __module__ __qualname__rr!rrr rrrrr"rrrrrrts rcs0eZdZfddZeddZddZZS)SJISContextAnalysiscstt|jd|_dS)NZ SHIFT_JIS)superr&r _charset_name)r) __class__rrrszSJISContextAnalysis.__init__cCs|jS)N)r()rrrr charset_namesz SJISContextAnalysis.charset_namecCs|sdS|d}d|ko"dkns@d|ko:dknrld}|dksdd |ko^dknrpd |_nd}t|dkr|d}|d krd|kod knr|d|fSd|fS)NrrrZCP932r)rrr)r(len)rr first_charr second_charrrrrs0    zSJISContextAnalysis.get_order)r#r$r%rpropertyr*r __classcell__rr)r)rr&s  r&c@seZdZddZdS)EUCJPContextAnalysiscCs|sd S|d}|dks0d|ko*dknr6d}n|dkrDd}nd}t|dkr|d}|d krd|kovd knr|d|fSd |fS)Nrrrrr)rrr)r3)rrr4rr5rrrrs    zEUCJPContextAnalysis.get_orderN)r#r$r%rrrrrr8sr8NSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Sr?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrr)robjectrr&r8rrrrsCchardet/__pycache__/chardistribution.cpython-36.pyc000064400000014135152347724720016412 0ustar003 Pf$@sddlmZmZmZddlmZmZmZddlm Z m Z m Z ddl m Z mZmZddlmZmZmZGdddeZGdd d eZGd d d eZGd d d eZGdddeZGdddeZGdddeZdS))EUCTW_CHAR_TO_FREQ_ORDEREUCTW_TABLE_SIZE EUCTW_TYPICAL_DISTRIBUTION_RATIO)EUCKR_CHAR_TO_FREQ_ORDEREUCKR_TABLE_SIZE EUCKR_TYPICAL_DISTRIBUTION_RATIO)GB2312_CHAR_TO_FREQ_ORDERGB2312_TABLE_SIZE!GB2312_TYPICAL_DISTRIBUTION_RATIO)BIG5_CHAR_TO_FREQ_ORDERBIG5_TABLE_SIZEBIG5_TYPICAL_DISTRIBUTION_RATIO)JIS_CHAR_TO_FREQ_ORDERJIS_TABLE_SIZEJIS_TYPICAL_DISTRIBUTION_RATIOc@sLeZdZdZdZdZdZddZddZd d Z d d Z d dZ ddZ dS)CharDistributionAnalysisigGz?g{Gz?cCs0d|_d|_d|_d|_d|_d|_|jdS)N)_char_to_freq_order _table_sizetypical_distribution_ratio_done _total_chars _freq_charsreset)selfr&/usr/lib/python3.6/chardistribution.py__init__.sz!CharDistributionAnalysis.__init__cCsd|_d|_d|_dS)zreset analyser, clear any stateFN)rrr)rrrrr=szCharDistributionAnalysis.resetcCsX|dkr|j|}nd}|dkrT|jd7_||jkrTd|j|krT|jd7_dS)z"feed a character with known lengthrriN) get_orderrrrr)rcharZchar_lenorderrrrfeedFs  zCharDistributionAnalysis.feedcCsT|jdks|j|jkr|jS|j|jkrN|j|j|j|j}||jkrN|S|jS)z(return confidence based on existing datar)rrMINIMUM_DATA_THRESHOLDSURE_NOrSURE_YES)rrrrrget_confidenceTs   z'CharDistributionAnalysis.get_confidencecCs |j|jkS)N)rENOUGH_DATA_THRESHOLD)rrrrgot_enough_datadsz(CharDistributionAnalysis.got_enough_datacCsdS)Nrr r)rbyte_strrrrr!isz"CharDistributionAnalysis.get_orderN) __name__ __module__ __qualname__r*r'r&r%rrr$r)r+r!rrrrr(s rcs$eZdZfddZddZZS)EUCTWDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) superr0rrrrrrr)r) __class__rrrrsz"EUCTWDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr^rr r)rr, first_charrrrr!xsz#EUCTWDistributionAnalysis.get_order)r-r.r/rr! __classcell__rr)r2rr0qs r0cs$eZdZfddZddZZS)EUCKRDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1r8rrrrrrr)r)r2rrrsz"EUCKRDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nrr4rr5r r)rr,r6rrrr!sz#EUCKRDistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rr8s r8cs$eZdZfddZddZZS)GB2312DistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1r:rrrr rr r)r)r2rrrsz#GB2312DistributionAnalysis.__init__cCs>|d|d}}|dkr6|dkr6d|d|dSdSdS)Nrrr9r5r4r r)rr,r6 second_charrrrr!sz$GB2312DistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rr:s r:cs$eZdZfddZddZZS)Big5DistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1r<rr rr rr r)r)r2rrrsz!Big5DistributionAnalysis.__init__cCsX|d|d}}|dkrP|dkr:d|d|ddSd|d|dSndSdS) Nrrr5?@r r)rr,r6r;rrrr!s z"Big5DistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rr<s r<cs$eZdZfddZddZZS)SJISDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1rArrrrrrr)r)r2rrrsz!SJISDistributionAnalysis.__init__cCsr|d|d}}|dkr0|dkr0d|d}n&|dkrR|dkrRd|dd}nd S||d }|d krnd }|S) Nrrr@r r r)rr,r6r;r#rrrr!s z"SJISDistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rrAs rAcs$eZdZfddZddZZS)EUCJPDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1rIrrrrrrr)r)r2rrrsz"EUCJPDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nrr4r5rr r)rr,r"rrrr!sz#EUCJPDistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rrIs rIN)Z euctwfreqrrrZ euckrfreqrrrZ gb2312freqrr r Zbig5freqr r r Zjisfreqrrrobjectrr0r8r:r<rArIrrrrsIchardet/__pycache__/compat.cpython-36.opt-1.pyc000064400000000431152347724720015251 0ustar003 Pfn@s@ddlZejdkr(dZdZeefZeZndZdZeefZeZdS)NTF)rr) sys version_infoZPY2ZPY3strZunicodeZbase_strZ text_typebytesrr/usr/lib/python3.6/compat.pys chardet/__pycache__/charsetgroupprober.cpython-36.opt-1.pyc000064400000004144152347724720017713 0ustar003 Pf@s,ddlmZddlmZGdddeZdS)) ProbingState) CharSetProbercsReZdZdfdd ZfddZeddZedd Zd d Zd d Z Z S)CharSetGroupProberNcs(tt|j|dd|_g|_d|_dS)N) lang_filter)superr__init__ _active_numprobers_best_guess_prober)selfr) __class__(/usr/lib/python3.6/charsetgroupprober.pyr!szCharSetGroupProber.__init__csNtt|jd|_x.|jD]$}|r|jd|_|jd7_qWd|_dS)NrTr)rrresetr r activer )r prober)r rrr's zCharSetGroupProber.resetcCs |js|j|jsdS|jjS)N)r get_confidence charset_name)r rrrr1s zCharSetGroupProber.charset_namecCs |js|j|jsdS|jjS)N)r rlanguage)r rrrr9s zCharSetGroupProber.languagecCsxx|jD]n}|sq|jsq|j|}|s*q|tjkr@||_|jS|tjkrd|_|jd8_|jdkrtj|_ |jSqW|jS)NFrr) r rfeedrFOUND_ITr stateNOT_MEr Z_state)r Zbyte_strrrrrrrAs$      zCharSetGroupProber.feedcCs|j}|tjkrdS|tjkr"dSd}d|_x\|jD]R}|s>q4|jsV|jjd|j q4|j }|jjd|j |j |||kr4|}||_q4W|jsdS|S)NgGz?g{Gz?gz %s not activez%s %s confidence = %s) rrrrr r rZloggerdebugrrr)r rZ best_confrZconfrrrrUs*    z!CharSetGroupProber.get_confidence)N) __name__ __module__ __qualname__rrpropertyrrrr __classcell__rr)r rr s   rN)ZenumsrZ charsetproberrrrrrrs  chardet/__pycache__/langturkishmodel.cpython-36.opt-1.pyc000064400000055442152347724720017356 0ustar003 Pf^+@sdZdZeedddddZdS)%/'4$-5<1.*0E,#3&>A+8   @  9: ejd^P]i?~}|hIcOU{6zb\yx[gwDvuats2Zrqpo7)(VYF;NGRX!MBTSnK=`CmJWf"_QlLHkgX4 ?Tz ISO-8859-9ZTurkish)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguageN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5rrrrrr6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(r$r r$r$r$rr$r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rrrrrrrrrrrrrrrrrrrrrrr rrrr$r r r$r$rr$r$r$r$r$r$r$r r rrr$r$rr$r$rrr$r$r r$rr$rr$r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r$r$rr$r$r$r$r$r$r$r$r$rrr$r rr$r$rr$r r$r$r$rr$rr$r rrrrrrrrrrrrrr rrrrrrrrrr r rrrrrrr$r$r$rr r$r$rrrrrrr$r$r r$rrr rrr rr rrrr rr rrr$rrrrrrr r rrrrr rr r r rr rrrrrr rrrrrrr rr$r$rr$r$r$r$r$r r$rrrrr r$rr r$rrr r$rr$rr$rr r$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr$r$r r r$r r rrr r$rrr rrrrrrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr$r$rrr$r$rrr$r$rrr rr rr rrrrrr rrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rrr rr$rrr rrr$r$rr$rrrrrr rrrrr r rrrrrr rrrrrrrrrrrrrrr r rr rrrrrrrrrrrr$r$r$r r$r r$r$rr r r r$r$r$rr$rrrr r rrr rrrrrrrrr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r$r$r$r rr r r$r$r$r$r rr rrrr r rrr rr$r$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r$r$rr$r$r$r$r$r$r r rr rr r$r r$r r r r r r r rr$r r$r rr rr r r r rrr r rr r rr rrr rrrr rrrrrrrrr r$r$rrrrrrrr r$r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r r r$r r$r r rr$r$r$rr rr rr rrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrr$r$r$r r$r$r$r$r$r r$rr r$r$rr rrrrrrrr$r rrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r r$r$r rrrrrr$r$rr$rrrrrrrr$rr rrrrrrr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r r$r r r r$r rrr$r$rr$rrrrrrrr$rrr rrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$rr$r$r$r$r$r r r rr rr rr r rrrrr r r r r r r rrr rr rr rrrrr$rr rrr rrr rrrrrrrrrrrrr$r$r$rr$r$r$rrrrr r r$rrr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r rrr r rrrrrrr$r$rr$rrrrrr rr$rrrr rrrrrr rrr r rr r r r rrr rrrr rr rr rrrrrrrrrr$r$r$rr$r r$r rr r r rr$r rr rr rrr rrrrr r rrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr$r$rrr r$rrr$r r$rr$rrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$rr$r$r r$r$r r rrrrrr rrr$rrrr$rrrr$rr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr r rrr$rrrrr$r$r r$rrrrrr rr r rr r rr rrr r rrrrrr rrrrrrrr rr rr rrrrrrrrrrrr$r$r$rrrr$rrrrrrr r rr$rrrrrrrrrrrr rrrrr$rrrrrrr rrrrrrrrrr rrrr rrrrrrrrrr$r$r$rr rr rrrrrrr$r$rr rrrrrr rrrrrrrrrrr rrr rr rr rrrrrr rrrr rrrrrrrrrrrrrr$r r$rrrrrrrrrrrr rrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrr rrrrr rrrrrrrrrrrr$r$r$rrr r$rrrrrrr r$r r$rrrr$rr rrrrrr rrrrr rrrrrrr rrrrrrrrrrrr rrrrrrrrrrrr$r r rrrrrrrrrrr$rrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$rr r$r r rr r rrr rrr$r r r rrr r rrrrr rr$rr rrrrrrrrr r r rrr rrrrrrrrrrrrrrrrrrr r$rr$r$r$r r r r rrrrrrrr r rrr r rr$rrr rrrrrr rrrrrrr rr rrr rrrrrrrrrrrrrrrr$r$r rrr$rrrrrrrr$r rr rrrrrr rrrrrr rrrrr rrrrrrrr rrrrrrr rrrrrr rrrrrrrrrr$r$r rrrrrrrrrrr$r$r r rrrrrr rrrrrr rrrrrrrrrr rr rrrrrr rr rr rr rrrrrrrrrrrr$r$r rrr r rrrrrrr r rr$rrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r rrrrrrrrrr r$rr rrrrrr rrrrrr rr rrrrr r rr rr rrrrrrrrrrrr rrrrrrrrrrrr$r$r$rr rr rrrrrrr$r$rr rrrrrr rr rrrr rrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr r r$r rrrrrr r$rrrrrrrr rr rrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r r$rrrrrrrrrrr r r r rrrrrr rrrrrr rrrrrr rrrrrr rrrrrrr rrr rr rrrrrr rrrrrrrrr r rr rrrrr r rrrrrrrrr$rrrrrrrr rrrrrrrrrrrrr rrrrrrrrrrrrr rrrrrrrrr rrr r$rr r$rr r rr rrr rr rrrr rrrrr rrr rrrrr rrrrrrrr r rr rrr rrrrrrrrrrrrrrrr$r$r$rr rr rrrrrrr$r rrrrrrrr rrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rr r rrrrrrrrrrrr rrrrrrrrrrrrrrr rrrrrrrrr rr rrr rrrr rrr rrrrrrrrr$r r rrr rrrrrrrr r rr rrrrrr rrrrrr rrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r rr r rrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrr rrrrrrrrrrrr rrrrrrrrr r r rrrrrrrrrrrr rrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrr r r r rrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrr r rr rr rrr r rrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrrrrrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZLatin5_TurkishCharToOrderMapZTurkishLangModelZLatin5TurkishModelrr&/usr/lib/python3.6/langturkishmodel.py%s*chardet/__pycache__/sjisprober.cpython-36.opt-1.pyc000064400000004470152347724720016157 0ustar003 Pf@s`ddlmZddlmZddlmZddlmZddlm Z ddl m Z m Z GdddeZ d S) )MultiByteCharSetProber)CodingStateMachine)SJISDistributionAnalysis)SJISContextAnalysis) SJIS_SM_MODEL) ProbingState MachineStatecsPeZdZfddZfddZeddZeddZd d Zd d Z Z S) SJISProbercs4tt|jtt|_t|_t|_ |j dS)N) superr __init__rr coding_smrdistribution_analyzerrcontext_analyzerreset)self) __class__ /usr/lib/python3.6/sjisprober.pyr %s  zSJISProber.__init__cstt|j|jjdS)N)r r rr)r)rrrr,szSJISProber.resetcCs|jjS)N)r charset_name)rrrrr0szSJISProber.charset_namecCsdS)NZJapaneser)rrrrlanguage4szSJISProber.languagecCsLxtt|D]}|jj||}|tjkrP|jjd|j|j |t j |_ Pq|tj krft j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|jd|d||jj|j|q|jj||d||d|||jj||d|d|qW|d|jd<|jt jkrF|jjrF|j|jkrFt j|_ |jS)Nz!%s %s prober hit error at byte %sr)rangelenr Z next_staterZERRORZloggerdebugrrrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenZ _last_charrfeedr stateZ DETECTINGZgot_enough_dataget_confidenceZSHORTCUT_THRESHOLD)rZbyte_striZ coding_stateZchar_lenrrrr8s6      zSJISProber.feedcCs|jj}|jj}t||S)N)rrr max)rZ context_confZ distrib_confrrrrYs  zSJISProber.get_confidence) __name__ __module__ __qualname__r rpropertyrrrr __classcell__rr)rrr $s     !r N)ZmbcharsetproberrZcodingstatemachinerZchardistributionrZjpcntxrZmbcssmrZenumsrrr rrrrs     chardet/__pycache__/universaldetector.cpython-36.pyc000064400000013173152347724720016600 0ustar003 Pf0@sdZddlZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZdd lmZGd d d eZdS) a Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco N)CharSetGroupProber) InputStateLanguageFilter ProbingState)EscCharSetProber) Latin1Prober)MBCSGroupProber)SBCSGroupProberc @sneZdZdZdZejdZejdZejdZ dddd d d d d dZ e j fddZ ddZddZddZdS)UniversalDetectoraq The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result g?s[-]s(|~{)s[-]z Windows-1252z Windows-1250z Windows-1251z Windows-1256z Windows-1253z Windows-1255z Windows-1254z Windows-1257)z iso-8859-1z iso-8859-2z iso-8859-5z iso-8859-6z iso-8859-7z iso-8859-8z iso-8859-9z iso-8859-13cCsNd|_g|_d|_d|_d|_d|_d|_||_tj t |_ d|_ |j dS)N)_esc_charset_prober_charset_probersresultdone _got_data _input_state _last_char lang_filterloggingZ getLogger__name__logger_has_win_bytesreset)selfrr'/usr/lib/python3.6/universaldetector.py__init__Qs zUniversalDetector.__init__cCsZdddd|_d|_d|_d|_tj|_d|_|jr>|jj x|j D] }|j qFWdS)z Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. Ng)encoding confidencelanguageF) rrrrr PURE_ASCIIrrr rr )rproberrrrr^s  zUniversalDetector.resetcCs>|jr dSt|sdSt|ts(t|}|js|jtjrJdddd|_nv|jtj tj frldddd|_nT|jdrdddd|_n:|jd rd ddd|_n |jtj tj frd ddd|_d |_|jd dk rd |_dS|j tjkr.|jj|rtj|_ n*|j tjkr.|jj|j|r.tj|_ |dd|_|j tjkr|js^t|j|_|jj|tjkr:|jj|jj|jjd|_d |_n|j tjkr:|jst |jg|_|jt!j"@r|jj#t$|jj#t%x@|jD]6}|j|tjkr|j|j|jd|_d |_PqW|j&j|r:d |_'dS)a Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``result`` attribute). .. note:: You should always call ``close`` when you're done feeding in your document if ``done`` is not already ``True``. Nz UTF-8-SIGg?)rrrzUTF-32szX-ISO-10646-UCS-4-3412szX-ISO-10646-UCS-4-2143zUTF-16Trr)(rlen isinstance bytearrayr startswithcodecsBOM_UTF8r BOM_UTF32_LE BOM_UTF32_BEBOM_LEBOM_BErrr!HIGH_BYTE_DETECTORsearch HIGH_BYTE ESC_DETECTORrZ ESC_ASCIIr rrfeedrZFOUND_IT charset_nameget_confidencerr r rZNON_CJKappendr rWIN_BYTE_DETECTORr)rZbyte_strr"rrrr3os|              zUniversalDetector.feedc Cs|jr |jSd|_|js&|jjdn|jtjkrBdddd|_n|jtjkrd}d}d}x,|j D]"}|slqb|j }||krb|}|}qbW|r||j kr|j }|j j }|j }|jd r|jr|jj||}|||jd|_|jjtjkrz|jd dkrz|jjd xn|j D]d}|s qt|trZxF|jD] }|jjd |j |j|j q4Wn|jjd |j |j|j qW|jS) z Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`. Tzno data received!asciig?r#)rrrNgziso-8859rz no probers hit minimum thresholdz%s %s confidence = %s)rrrrdebugrrr!r1r r5MINIMUM_THRESHOLDr4lowerr(r ISO_WIN_MAPgetrZgetEffectiveLevelrDEBUGr&rZprobers) rZprober_confidenceZmax_prober_confidenceZ max_proberr"r4Zlower_charset_namerZ group_proberrrrcloses`            zUniversalDetector.closeN)r __module__ __qualname____doc__r:recompiler/r2r7r<rZALLrrr3r?rrrrr 3s"    mr )rBr)rrCZcharsetgroupproberrZenumsrrrZ escproberrZ latin1proberrZmbcsgroupproberr Zsbcsgroupproberr objectr rrrr$s     chardet/__pycache__/enums.cpython-36.pyc000064400000004753152347724720014171 0ustar003 Pf}@shdZGdddeZGdddeZGdddeZGdddeZGd d d eZGd d d eZd S)zr All of the Enums that are used throughout the chardet package. :author: Dan Blanchard (dan.blanchard@gmail.com) c@seZdZdZdZdZdZdS) InputStatezS This enum represents the different states a universal detector can be in. N)__name__ __module__ __qualname____doc__Z PURE_ASCIIZ ESC_ASCIIZ HIGH_BYTEr r /usr/lib/python3.6/enums.pyrsrc@s<eZdZdZdZdZdZdZdZdZ eeBZ e eBeBZ dS) LanguageFilterzj This enum represents the different language filters we can apply to a ``UniversalDetector``. rrN) rrrrZCHINESE_SIMPLIFIEDZCHINESE_TRADITIONALZJAPANESEZKOREANZNON_CJKZALLZCHINESEZCJKr r r r r sr c@seZdZdZdZdZdZdS) ProbingStatezG This enum represents the different states a prober can be in. rrrN)rrrrZ DETECTINGZFOUND_ITZNOT_MEr r r r r src@seZdZdZdZdZdZdS) MachineStatezN This enum represents the different states a state machine can be in. rrrN)rrrrZSTARTZERRORZITS_MEr r r r r)src@s,eZdZdZdZdZdZdZeddZ dS) SequenceLikelihoodzX This enum represents the likelihood of a character following the previous one. rrrcCsdS)z::returns: The number of likelihood categories in the enum.r r )clsr r r get_num_categories;sz%SequenceLikelihood.get_num_categoriesN) rrrrZNEGATIVEZUNLIKELYZLIKELYZPOSITIVE classmethodrr r r r r2s rc@s$eZdZdZdZdZdZdZdZdS)CharacterCategoryz This enum represents the different categories language models for ``SingleByteCharsetProber`` put characters into. Anything less than CONTROL is considered a letter. N) rrrrZ UNDEFINEDZ LINE_BREAKZSYMBOLZDIGITZCONTROLr r r r rAs rN)robjectrr rrrrr r r r s    chardet/__pycache__/jisfreq.cpython-36.opt-1.pyc000064400000126637152347724720015452 0ustar003 Pfd@sdZdZdZdS(g@i('O}  ]   X}kg k%&01,- <pgWX h " \ /  0  h       !"#$%&'()*+,-./01234567Vj4B89:;<=>vSef d +aw I~ ?@ABCD - i E^ . 3i F/ Y j GHIJq1 Yk/2# *[\5!! %@l'A 4 <-7S~K=E;778m& OK=~dLMNOPQRSTUVY>J"p pT_.XLje9P ly D )h F?+gcB]N8j:57R4Gdnht63$WC : x *V WXYZ[\]^_`abcdefghijklmnopqrst uvwxyz{|l} ~   k > j Z[\]        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  2 {Ta ^| =mk  Vy  q  !   CO3r n+ pq ; A C0 n TCo  # ~P  $ z  & _U s  I3 $W1 5P X l H   W~p$@L u JI W _ <]Dhf-}t  , bXF{ `+3qm4 BlX % % 2 u J|r@    L b J c 4 Rm T e ? - *E + & /.s[+  Bc  ) , u  9& v Y 3  Dd| (y<8 i d 5 Bn | !)@ n m 0a z' W[v  o   '  "9 Jhe \p @Q9 w iEJI f  1  ' r  c qx 2 *bFvd !RQP( _ ` f 6 Aa uT 2 ^C [ v%n!FZ^dx ] Bc Pq HY (  g}K 4 W Cg -dk4} q ~ + h@  @A D:e qwdZ* M [sZ >'-  ) tF7 t#Yfkb 1 6oc q  u:N U= vlN]; lL }B 8 Q#`T xr  3n{@ 9 5 h d Z is-r [ 0.S RO  ; 4y ;z p  : (| " Oe C t) 6K8P h  3$* =be  4 .7\ j / =^5  \9#+ s ,7Y M+ i Q6 y s#{ Uf<v) m< g l D bu DB [ 8>   ] D6Z 5 <m , u^ gIg \: Mt EoER Ej gWK C=]$! `Kv0i^ 3"ak ; w yP wt  Ja] Lh u j#C a!s|  Y hO5zi SL.& < 7sA M s*, % k&fOj"(-[ - =} MS     ~ Jtkvey< f Mk owv l]. /f q$g Gn>6 =   N xe* h $ob, t  V iw pH Vi<Z 8rw& />> E x&ew 5 \Si 2+'%x O Q _H gy  0&+   l ''z _  ?  z m |  g 0 * `w #c)R TrV_r ` x fn = *A (xS {T 9M r;(%[a b D- \  o Em)!c , 1] >I T ykzxN  5 "H<d  h  p :L1 > q ?ZMI B K D#  Y>` cTa2y/"U b /   { j 5*ax F7  ?w+8  N ,n  os_?   ?0 y3f =l v]  z yju pj izr F' { n xu$Mk p ^ q `|  |    G -Z1Y-  e[C e .-  7 bl {. z ? 9  } a  Q d;V /^D ?m 9I   {} &~X } 9 :"\ _ 8W~ ^%Ps w 8 L.  NPS:R'0b z K rq n L X@ gi4: r Q  ;' >bmws A t 9  o ^2c r !t1{ s xvap  LOU .). E "y ( q E 6 2u6 . i Vs GGjtW `u  {Q OC  J   $/ _j R7/ 3Du 6X4 >0 ``  U  r )5H ~r   ] @  av/!67w 3c8x B M F g( : H f " ~ y  !N 4A dez 0  { f(lG ^B mF |U2R# F U1 ckN S $O  Y G W C ? ~UF C e / Q_v ; P)Gm G ,Iz_  9n A X #V)< %}Hw 5p.m #h|b @(^z A  " g |6X,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irjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrr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S_TYPICAL_DISTRIBUTION_RATIOZJIS_TABLE_SIZEZJIS_CHAR_TO_FREQ_ORDERrr/usr/lib/python3.6/jisfreq.py,s$chardet/__pycache__/mbcssm.cpython-36.opt-1.pyc000064400000042131152347724720015255 0ustar003 Pfc@sl ddlmZdZejejejdejejejejejejejejejejejejejejejejejejejejfZdZedeeddZd Z ejejdejejejddejd ejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejfFZ d!Z e d e e ddZ d"Z ddddejejejejejejejejejejejejejejejejejejejejejejejejejejdejdejejejejejejejf(Zd#Ze d eeddZd$ZejejdejejejejejejejejejejejejejfZd%ZedeeddZd&Zejejejddddejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejejejejejejejf0Zd'Zed eeddZd(Zejejejejejejdejejejejejejejejejejejejejejejejejdejejejejejejejejejdejejejejejejejejejejejejejf0Zd)Zed eeddZd*ZejejejdejejejejejejejejejejejejejejejejejejejejfZd+Zed eeddZ d,Z!dd d ejddejejejejejejejejejejejejd d d d ejejd d d d d ejd d d d d d dd d ejdd d d ejd d d d d d d ejejejejf8Z"d-Z#e!d e"e#ddZ$d.Z%d d d d ddejejejejejejejejejejejejdddejejejdddejdejd d d d d d dddejdddejejejdddddejdejejejf8Z&d/Z'e%d e&e'ddZ(d0Z)ejejejejejejdd d dd d d dddejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejddddejejejejejejejejejejejejejdddejejejejejejejejejejejejd d d d ejejejejejejejejejejejejejejd d ejejejejejejejejejejejejd d d d ejejejejejejejejejejejejejejejd ejejejejejejejejejejejejddddejejejejejejejejejejejejejejejdejejejejejejejejejejejejdddejejejejejejejejejejejejejejejejejejejejejejejejejejejfZ*d1Z+e)de*e+ddZ,dS)2) MachineStateZBig5)Z class_tableZ class_factorZ state_tableZchar_len_tablename ZCP949zEUC-JPzEUC-KRzx-euc-twZGB2312Z Shift_JISzUTF-16BEzUTF-16LE zUTF-8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rrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r)rrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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_SM_MODELZ UCS2LE_CLSZ UCS2LE_STZUCS2LE_CHAR_LEN_TABLEZUCS2LE_SM_MODELZUTF8_CLSZUTF8_STZUTF8_CHAR_LEN_TABLEZ UTF8_SM_MODELrr/usr/lib/python3.6/mbcssm.pysh  $ (((((,  "$   $  $ $                $chardet/__pycache__/__init__.cpython-36.pyc000064400000001375152347724720014576 0ustar003 Pf@s8ddlmZmZddlmZddlmZmZddZdS))PY2PY3)UniversalDetector) __version__VERSIONcCsHt|ts0t|ts(tdjt|nt|}t}|j||jS)z Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` z4Expected object of type bytes or bytearray, got: {0}) isinstance bytearraybytes TypeErrorformattyperZfeedclose)Zbyte_strZdetectorr/usr/lib/python3.6/__init__.pydetects   rN) compatrrZuniversaldetectorrversionrrrrrrrs chardet/__pycache__/big5prober.cpython-36.opt-1.pyc000064400000002021152347724720016023 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)Big5DistributionAnalysis) BIG5_SM_MODELcs4eZdZfddZeddZeddZZS) Big5Probercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__ /usr/lib/python3.6/big5prober.pyr#s zBig5Prober.__init__cCsdS)NZBig5r )r r r r charset_name)szBig5Prober.charset_namecCsdS)NZChineser )r r r r language-szBig5Prober.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r"s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/escsm.cpython-36.pyc000064400000016167152347724720014156 0ustar003 Pf)@sddlmZdZejejdejejejejejejejejejejejejejejejejejejejdejdejdejdddejdejdddejdejdejejejejejejejf0ZdZedeedd d ZdZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejddejejejejejejejejejejejejejejejejejejejejejejf@Z dZ e d e e d d d Z dZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejdejejejejejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejfHZdZe deeddd ZdZejdejejejejejejejejejejejejejejejejejejejdejejejejejejdejejejejejejejejejejejf(ZdZedeeddd ZdS)) MachineStatez HZ-GB-2312ZChinese)Z class_tableZ class_factorZ state_tableZchar_len_tablenameZlanguage z ISO-2022-CN z ISO-2022-JPZJapanesez ISO-2022-KRZKoreanN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr) rrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr) rrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrr)ZenumsrZHZ_CLSZSTARTZERRORZITS_MEZHZ_STZHZ_CHAR_LEN_TABLEZ HZ_SM_MODELZ ISO2022CN_CLSZ ISO2022CN_STZISO2022CN_CHAR_LEN_TABLEZISO2022CN_SM_MODELZ ISO2022JP_CLSZ ISO2022JP_STZISO2022JP_CHAR_LEN_TABLEZISO2022JP_SM_MODELZ ISO2022KR_CLSZ ISO2022KR_STZISO2022KR_CHAR_LEN_TABLEZISO2022KR_SM_MODELrr/usr/lib/python3.6/escsm.pysp  "    $     $ $chardet/__pycache__/big5prober.cpython-36.pyc000064400000002021152347724720015064 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)Big5DistributionAnalysis) BIG5_SM_MODELcs4eZdZfddZeddZeddZZS) Big5Probercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__ /usr/lib/python3.6/big5prober.pyr#s zBig5Prober.__init__cCsdS)NZBig5r )r r r r charset_name)szBig5Prober.charset_namecCsdS)NZChineser )r r r r language-szBig5Prober.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r"s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/gb2312freq.cpython-36.pyc000064400000112637152347724720014621 0ustar003 PfP@sdZdZdZdS(g?i< T Q <w 9 Z q W yeov   LB Q QEfd( y, E e WR| R   X jE +P;m l eH^ k6" F ^ ?`u$1  U 1 gl G2q PL y  Mk4  @ `5N 73nuG&bh0 M N Y   & Q 7^hJ PrT -G,u $<B$>x LWn TZ {   ? 0b;DCSU> |g  K % 5 l h ? U *<     ! X  Q g r  q z  3  ]cz7 _ C&aH| l =IP ~ 8` w T  [q  g|C  N I5 (/HK 9I|  W ^~ = X3 I 3ro  {iC!H f= 1[ | D%t  .yT9  #Jn >B"a MK W ! r F+  x HJ2KR $9 t   %~ ` 'v |' n * F%)~ J& !D w[   ' k  h B_ ?gh'5]  1 )a ; _Q/u j[}  Q^ Gz VO   mu 6 -$ R} pr ] D i1ntYG / |t0 \ v c ~A"" !8C8  j 1l> ] ~L(KdvD%  , 2 j -. mK o ;  d@a M 1 L@2 wtQ / ~ / _ # OOGk[Oo-   ! I{r .h T 'L a @  T /  Mi l  {8# 9SR wZ0 Egg  LpS  @I L; Oq)  :F5JdA  ) ELY m  c R! (]I e `  [C (P, }O ' L\  Zs' UN  M ig'  P0 s ip n \  !hm(& CB)5  >  {NE3J#c $ 5x ]k P  rL zd# [ ShG U+ yw"V2 &z J P % Z$ o T K1 `V  d + A $ _3\ b f AnxF O[(  #72 xf !6{ Y+  Ke T$h  R" Z _ @a 3 k)j e A ^ W h: z ) |   8 j 3 zpy 2 oD =.9 af*_ *  -  } * tt6 q S !)y  j  VIg L pD % M $ E "U e  | Q   1 $ ]4&z`w  )% &*82> S 1#  #  F , > +  Z 3q $ V ;NmKW5 R4 ID %K| 9n  -3 2 p? ~C[  3 > l `x  # 0 L QR?(m` 3&  sD0 b f@  =  < 6s  S 8Z     N  L J  bg [ ~  f  ` 4= l? c  i w % d ^+ ZF I t / y* s&+)    e Q]  _7 0cuLk #? n   HYu  J_ _& Z% sS  V1'F\ | W|SW *  RlP#  -q  4a @ Xi%8 3,} dx # 6 .A r R d+  {{H  c  ,I c  = J. ,>Le] C *;  p R9  ?: Q'sw[ - )M]}6@ U/s k ? , = 1M /S d o 6 ku W{xW x ^ [ + 7:U ! .HTY @"Cs G b7~. U q {Y/ A *:8'  A _0iK t *   D>v 'V k \! *U z\f     B  {= & V "!  ( = 9 4a-Q  mC7}qD4u v F u a H o lKA  z4 ! H  5 j` B :Oa #d( & ^mg E o (G $@ IA `X7/$ h U"Tm! M  2q9 / p@X ji ^ b nvoov09$ fS z D{X V3 Y  AqU : 2j  {  F  ciR ;k h Y OxzZ<v   I4 Mb   C O 8 .] Vc  H T >  3,flTWH.'>p" J v2 x 2g 4 { z  ? J 8E j \88  `>bS 0 E d1n@ T QC K ;k_\ ewM. ra  g '  T4o Xyx  U ^:  "#  NUp " - :   W G L Gw o Mr  Q I N% X 7 a  ' ih }Ny?t D  l e Js2*y q 5}s $5 B# ds} ~b O / ] ]2f7O R#  [E f S dFC V > B  16m p  <z | Xse ] O + : A  ( m4P n oomy8 <<c C &w $ 9& )`GbE:Qo F  F|; 34 %: cp6 \C09  ~ "h  ) *    %  .9   "! , g J gF  ;i ZE^A l5 4' k  2  X7 {Bx=e( ' D ik -, e7  n} p 7j 9 0P O U <  JtN) .* Ar ] )G_ pk  %  >b_^?:YD% Y l A DB  @ (v g }v   -~y % _ jM G+  3 ; G)    ,I  XA\P v V= 6 <X   8 - Y  c9 - u  R  6 h } ? w   a ( 1 > ] XrP0 ,+ j`.  & WB |7 U WY w  ubq b =$ NJU iK,4r{ Hp5= E9; <5 i \prN^K  *{ + *8  j @l 628 'B \S V ~ V z ^ _ } G qI 8thS }R 9Sn PB sX}f n I^Txr_bOPQRSN(rrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Z!GB2312_TYPICAL_DISTRIBUTION_RATIOZGB2312_TABLE_SIZEZGB2312_CHAR_TO_FREQ_ORDERrr /usr/lib/python3.6/gb2312freq.py*schardet/__pycache__/langthaimodel.cpython-36.pyc000064400000055420152347724720015647 0ustar003 Pf,@sdZdZeedddddZdS)jkde^lmnoY_pq@HIrJstfQuZgNR`[OThiab\XvcUSK4"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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rrrrr|rrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrr|rrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZTIS620CharToOrderMapZ ThaiLangModelZTIS620ThaiModelrr#/usr/lib/python3.6/langthaimodel.py%s* chardet/__pycache__/codingstatemachine.cpython-36.opt-1.pyc000064400000005365152347724720017632 0ustar003 Pf@s(ddlZddlmZGdddeZdS)N) MachineStatec@sDeZdZdZddZddZddZdd Zd d Ze d d Z dS)CodingStateMachinea A state machine to verify a byte sequence for a particular encoding. For each byte the detector receives, it will feed that byte to every active state machine available, one byte at a time. The state machine changes its state based on its previous state and the byte it receives. There are 3 states in a state machine that are of interest to an auto-detector: START state: This is the state to start with, or a legal byte sequence (i.e. a valid code point) for character has been identified. ME state: This indicates that the state machine identified a byte sequence that is specific to the charset it is designed for and that there is no other possible encoding which can contain this byte sequence. This will to lead to an immediate positive answer for the detector. ERROR state: This indicates the state machine identified an illegal byte sequence for that encoding. This will lead to an immediate negative answer for this encoding. Detector will exclude this encoding from consideration from here on. cCs0||_d|_d|_d|_tjt|_|jdS)Nr) _model_curr_byte_pos_curr_char_len _curr_stateloggingZ getLogger__name__Zloggerreset)selfZsmr (/usr/lib/python3.6/codingstatemachine.py__init__7s  zCodingStateMachine.__init__cCs tj|_dS)N)rSTARTr)r r r rr ?szCodingStateMachine.resetcCsh|jd|}|jtjkr0d|_|jd||_|j|jd|}|jd||_|jd7_|jS)NZ class_tablerZchar_len_tableZ class_factorZ state_tabler)rrrrrr)r cZ byte_classZ curr_stater r r next_stateBs zCodingStateMachine.next_statecCs|jS)N)r)r r r rget_current_charlenPsz&CodingStateMachine.get_current_charlencCs |jdS)Nname)r)r r r rget_coding_state_machineSsz+CodingStateMachine.get_coding_state_machinecCs |jdS)Nlanguage)r)r r r rrVszCodingStateMachine.languageN) r __module__ __qualname____doc__rr rrrpropertyrr r r rr!sr)r Zenumsrobjectrr r r rs chardet/__pycache__/langhungarianmodel.cpython-36.opt-1.pyc000064400000060307152347724720017635 0ustar003 Pf01@s4dZdZdZeedddddZeedddddZdS)(6- 21&'5$)"#/.G+!%90@D74   C A> KO3QN,=:B;<E?RJFPHSMTLUI*8VWg(P?Tz ISO-8859-2Z Hungarian)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguagez windows-1250N(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r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__pycache__/hebrewprober.cpython-36.opt-1.pyc000064400000005513152347724720016462 0ustar003 Pf6@s,ddlmZddlmZGdddeZdS)) CharSetProber) ProbingStatecseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZfddZddZddZddZddZddZeddZeddZedd ZZS)! HebrewProberg{Gz?z ISO-8859-8z windows-1255cs>tt|jd|_d|_d|_d|_d|_d|_|j dS)N) superr__init___final_char_logical_score_final_char_visual_score_prev _before_prev_logical_prober_visual_proberreset)self) __class__"/usr/lib/python3.6/hebrewprober.pyrszHebrewProber.__init__cCsd|_d|_d|_d|_dS)N )rrrr)rrrrrszHebrewProber.resetcCs||_||_dS)N)rr)rZ logicalProberZ visualProberrrrset_model_probersszHebrewProber.set_model_proberscCs||j|j|j|j|jgkS)N) FINAL_KAF FINAL_MEM FINAL_NUNFINAL_PE FINAL_TSADI)rcrrris_finalszHebrewProber.is_finalcCs||j|j|j|jgkS)N) NORMAL_KAF NORMAL_MEM NORMAL_NUN NORMAL_PE)rr%rrr is_non_finals zHebrewProber.is_non_finalcCs|jtjkrtjS|j|}x|D]}|dkrp|jdkr|j|jrT|jd7_q|j|jr|j d7_ n,|jdkr|j|jr|dkr|j d7_ |j|_||_q"Wtj S)Nrr) staterNOT_MEZfilter_high_byte_onlyrr&rrr+r DETECTING)rZbyte_strZcurrrrfeeds         zHebrewProber.feedcCsx|j|j}||jkr|jS||j kr.|jS|jj|jj}||jkrR|jS||j krd|jS|dkrr|jS|jS)Ng) rrMIN_FINAL_CHAR_DISTANCELOGICAL_HEBREW_NAMEVISUAL_HEBREW_NAMErZget_confidencerMIN_MODEL_DISTANCE)rZfinalsubZmodelsubrrr charset_names      zHebrewProber.charset_namecCsdS)NZHebrewr)rrrrlanguageszHebrewProber.languagecCs(|jjtjkr"|jjtjkr"tjStjS)N)rr,rr-rr.)rrrrr,szHebrewProber.state)__name__ __module__ __qualname__r r'r!r(r"r)r#r*r$Z NORMAL_TSADIr0r3r2r1rrrr&r+r/propertyr4r5r, __classcell__rr)rrrs.  ;  rN)Z charsetproberrZenumsrrrrrrs  cchardet/__pycache__/langturkishmodel.cpython-36.pyc000064400000055442152347724720016417 0ustar003 Pf^+@sdZdZeedddddZdS)%/'4$-5<1.*0E,#3&>A+8   @  9: ejd^P]i?~}|hIcOU{6zb\yx[gwDvuats2Zrqpo7)(VYF;NGRX!MBTSnK=`CmJWf"_QlLHkgX4 ?Tz ISO-8859-9ZTurkish)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguageN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5rrrrrr6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(r$r r$r$r$rr$r$r$r$r$r$r$r$r rrr$r$rr$r$rr$r$r$r$r$rr$rr$r$r rrrrrrrrrrrrrrrrrrrrrrr r rrrrrrr$r r r$r$rr$r$r$r$r$r$r$r r$rrr$r$rr$r$rr$r$r$r$r$rr$rr$r$rrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrr$r$r r$r$rr$r$r$r$r$r$r$r r$rrr$r$rr$r$rr r$r$r$r$rr$rr$r$rrrrrrrrrrrrrrr rrrrrrrrrr rrrrrrr$r$r$r$r$r$r r$r$r$r$r$r$r$r$rr$r$r rr$r rr r rr$r$rrrr r r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r$r$rr r$r$r$r$r$r$r$rr$r rrr$r rrr r$r$r rrrr r rrrrrrrrrrrrrrrrrrrrrrrrrr rr rrrrrrr$r$rr$r$r$r$r$r$r$rr rrr r$rr r$rrr r r r$rr$rrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r$r$r$r$r$r$r$r$r$r$r$r$rr$r$r$rr$r rr r$r r$r$rrrr r$r rrrrrrrrrr rrrrrrrrrrrrrrrrr rrrr$r$r$r r$r$r r$r$r$r$r r$r$r$rr$r$rrr rrrr r$r r rrrr r r rrrrrrrrrrrrrrrrrrrrrrrrrrr rrrr$r$r$r r$r$r$r$r$r$r$r r$r$r$rr$r rrr$r rrr$r r$r rrrr r r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r$r$r$r$r$r$r$r r$r$r$rr$r r rr r$rrr r r r rrrr r$r$rrrrrrrrrrrrrrrrrrrrrrrrr rrrrrr$r$r$r$r$r$r$r r r r r$r r$r$rr$r$rrr r rrr r r$r rrrr$rr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r$r$r$r rr r r$r r$r$rr$r rrrrrrrr rr rrrrrr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r$r$r r$r r r r$r$r$r$rr$rrrr$r rrr$r$r r$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrr$r r r$r$rr$r$r$r$r$r$r$r r rrr$r$rr$r$rrr$r$r r$rr$rr$r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r$r$rr$r$r$r$r$r$r$r$r$rrr$r rr$r$rr$r r$r$r$rr$rr$r rrrrrrrrrrrrrr rrrrrrrrrr r rrrrrrr$r$r$rr r$r$rrrrrrr$r$r r$rrr rrr rr rrrr rr rrr$rrrrrrr r rrrrr rr r r rr rrrrrr rrrrrrr rr$r$rr$r$r$r$r$r r$rrrrr r$rr r$rrr r$rr$rr$rr r$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr$r$r r r$r r rrr r$rrr rrrrrrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr$r$rrr$r$rrr$r$rrr rr rr rrrrrr rrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rrr rr$rrr rrr$r$rr$rrrrrr rrrrr r rrrrrr rrrrrrrrrrrrrrr r rr rrrrrrrrrrrr$r$r$r r$r r$r$rr r r r$r$r$rr$rrrr r rrr rrrrrrrrr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r$r$r$r rr r r$r$r$r$r rr rrrr r rrr rr$r$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r$r$rr$r$r$r$r$r$r r rr rr r$r r$r r r r r r r rr$r r$r rr rr r r r rrr r rr r rr rrr rrrr rrrrrrrrr r$r$rrrrrrrr r$r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r r r$r r$r r rr$r$r$rr rr rr rrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrr$r$r$r r$r$r$r$r$r r$rr r$r$rr rrrrrrrr$r rrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r r$r$r rrrrrr$r$rr$rrrrrrrr$rr rrrrrrr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r r r$r r r r$r rrr$r$rr$rrrrrrrr$rrr rrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$rr$r$r$r$r$r r r rr rr rr r rrrrr r r r r r r rrr rr rr rrrrr$rr rrr rrr rrrrrrrrrrrrr$r$r$rr$r$r$rrrrr r r$rrr$rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r rrr r rrrrrrr$r$rr$rrrrrr rr$rrrr rrrrrr rrr r rr r r r rrr rrrr rr rr rrrrrrrrrr$r$r$rr$r r$r rr r r rr$r rr rr rrr rrrrr r rrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr$r$rrr r$rrr$r r$rr$rrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$rr$r$r r$r$r r rrrrrr rrr$rrrr$rrrr$rr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr r rrr$rrrrr$r$r r$rrrrrr rr r rr r rr rrr r rrrrrr rrrrrrrr rr rr rrrrrrrrrrrr$r$r$rrrr$rrrrrrr r rr$rrrrrrrrrrrr rrrrr$rrrrrrr rrrrrrrrrr rrrr rrrrrrrrrr$r$r$rr rr rrrrrrr$r$rr rrrrrr rrrrrrrrrrr rrr rr rr rrrrrr rrrr rrrrrrrrrrrrrr$r r$rrrrrrrrrrrr rrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrr rrrrr rrrrrrrrrrrr$r$r$rrr r$rrrrrrr r$r r$rrrr$rr rrrrrr rrrrr rrrrrrr rrrrrrrrrrrr rrrrrrrrrrrr$r r rrrrrrrrrrr$rrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$rr r$r r rr r rrr rrr$r r r rrr r rrrrr rr$rr rrrrrrrrr r r rrr rrrrrrrrrrrrrrrrrrr r$rr$r$r$r r r r rrrrrrrr r rrr r rr$rrr rrrrrr rrrrrrr rr rrr rrrrrrrrrrrrrrrr$r$r rrr$rrrrrrrr$r rr rrrrrr rrrrrr rrrrr rrrrrrrr rrrrrrr rrrrrr rrrrrrrrrr$r$r rrrrrrrrrrr$r$r r rrrrrr rrrrrr rrrrrrrrrr rr rrrrrr rr rr rr rrrrrrrrrrrr$r$r rrr r rrrrrrr r rr$rrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$r rrrrrrrrrr r$rr rrrrrr rrrrrr rr rrrrr r rr rr rrrrrrrrrrrr rrrrrrrrrrrr$r$r$rr rr rrrrrrr$r$rr rrrrrr rr rrrr rrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrr$r$r$rr r r$r rrrrrr r$rrrrrrrr rr rrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r r$rrrrrrrrrrr r r r rrrrrr rrrrrr rrrrrr rrrrrr rrrrrrr rrr rr rrrrrr rrrrrrrrr r rr rrrrr r rrrrrrrrr$rrrrrrrr rrrrrrrrrrrrr rrrrrrrrrrrrr rrrrrrrrr rrr r$rr r$rr r rr rrr rr rrrr rrrrr rrr rrrrr rrrrrrrr r rr rrr rrrrrrrrrrrrrrrr$r$r$rr rr rrrrrrr$r rrrrrrrr rrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rr r rrrrrrrrrrrr rrrrrrrrrrrrrrr rrrrrrrrr rr rrr rrrr rrr rrrrrrrrr$r r rrr rrrrrrrr r rr rrrrrr rrrrrr rrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr$r rr r rrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrr rrrrrrrrrrrr rrrrrrrrr r r rrrrrrrrrrrr rrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrr r r r rrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrr r rr rr rrr r rrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrrrrrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZLatin5_TurkishCharToOrderMapZTurkishLangModelZLatin5TurkishModelrr&/usr/lib/python3.6/langturkishmodel.py%s*chardet/__pycache__/charsetgroupprober.cpython-36.pyc000064400000004144152347724720016754 0ustar003 Pf@s,ddlmZddlmZGdddeZdS)) ProbingState) CharSetProbercsReZdZdfdd ZfddZeddZedd Zd d Zd d Z Z S)CharSetGroupProberNcs(tt|j|dd|_g|_d|_dS)N) lang_filter)superr__init__ _active_numprobers_best_guess_prober)selfr) __class__(/usr/lib/python3.6/charsetgroupprober.pyr!szCharSetGroupProber.__init__csNtt|jd|_x.|jD]$}|r|jd|_|jd7_qWd|_dS)NrTr)rrresetr r activer )r prober)r rrr's zCharSetGroupProber.resetcCs |js|j|jsdS|jjS)N)r get_confidence charset_name)r rrrr1s zCharSetGroupProber.charset_namecCs |js|j|jsdS|jjS)N)r rlanguage)r rrrr9s zCharSetGroupProber.languagecCsxx|jD]n}|sq|jsq|j|}|s*q|tjkr@||_|jS|tjkrd|_|jd8_|jdkrtj|_ |jSqW|jS)NFrr) r rfeedrFOUND_ITr stateNOT_MEr Z_state)r Zbyte_strrrrrrrAs$      zCharSetGroupProber.feedcCs|j}|tjkrdS|tjkr"dSd}d|_x\|jD]R}|s>q4|jsV|jjd|j q4|j }|jjd|j |j |||kr4|}||_q4W|jsdS|S)NgGz?g{Gz?gz %s not activez%s %s confidence = %s) rrrrr r rZloggerdebugrrr)r rZ best_confrZconfrrrrUs*    z!CharSetGroupProber.get_confidence)N) __name__ __module__ __qualname__rrpropertyrrrr __classcell__rr)r rr s   rN)ZenumsrZ charsetproberrrrrrrs  chardet/__pycache__/enums.cpython-36.opt-1.pyc000064400000004753152347724720015130 0ustar003 Pf}@shdZGdddeZGdddeZGdddeZGdddeZGd d d eZGd d d eZd S)zr All of the Enums that are used throughout the chardet package. :author: Dan Blanchard (dan.blanchard@gmail.com) c@seZdZdZdZdZdZdS) InputStatezS This enum represents the different states a universal detector can be in. N)__name__ __module__ __qualname____doc__Z PURE_ASCIIZ ESC_ASCIIZ HIGH_BYTEr r /usr/lib/python3.6/enums.pyrsrc@s<eZdZdZdZdZdZdZdZdZ eeBZ e eBeBZ dS) LanguageFilterzj This enum represents the different language filters we can apply to a ``UniversalDetector``. rrN) rrrrZCHINESE_SIMPLIFIEDZCHINESE_TRADITIONALZJAPANESEZKOREANZNON_CJKZALLZCHINESEZCJKr r r r r sr c@seZdZdZdZdZdZdS) ProbingStatezG This enum represents the different states a prober can be in. rrrN)rrrrZ DETECTINGZFOUND_ITZNOT_MEr r r r r src@seZdZdZdZdZdZdS) MachineStatezN This enum represents the different states a state machine can be in. rrrN)rrrrZSTARTZERRORZITS_MEr r r r r)src@s,eZdZdZdZdZdZdZeddZ dS) SequenceLikelihoodzX This enum represents the likelihood of a character following the previous one. rrrcCsdS)z::returns: The number of likelihood categories in the enum.r r )clsr r r get_num_categories;sz%SequenceLikelihood.get_num_categoriesN) rrrrZNEGATIVEZUNLIKELYZLIKELYZPOSITIVE classmethodrr r r r r2s rc@s$eZdZdZdZdZdZdZdZdS)CharacterCategoryz This enum represents the different categories language models for ``SingleByteCharsetProber`` put characters into. Anything less than CONTROL is considered a letter. N) rrrrZ UNDEFINEDZ LINE_BREAKZSYMBOLZDIGITZCONTROLr r r r rAs rN)robjectrr rrrrr r r r s    chardet/__pycache__/version.cpython-36.pyc000064400000000550152347724720014516 0ustar003 Pf@sdZdZejdZdS)z This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) z3.0.4.N)__doc__ __version__splitVERSIONrr/usr/lib/python3.6/version.pyschardet/__pycache__/mbcharsetprober.cpython-36.opt-1.pyc000064400000004151152347724720017153 0ustar003 PfU @s0ddlmZddlmZmZGdddeZdS)) CharSetProber) ProbingState MachineStatecsVeZdZdZdfdd ZfddZeddZed d Zd d Z d dZ Z S)MultiByteCharSetProberz MultiByteCharSetProber Ncs,tt|j|dd|_d|_ddg|_dS)N) lang_filter)superr__init__distribution_analyzer coding_sm _last_char)selfr) __class__%/usr/lib/python3.6/mbcharsetprober.pyr 'szMultiByteCharSetProber.__init__cs<tt|j|jr|jj|jr.|jjddg|_dS)Nr)rrresetr r r )r )rrrr-s   zMultiByteCharSetProber.resetcCstdS)N)NotImplementedError)r rrr charset_name5sz#MultiByteCharSetProber.charset_namecCstdS)N)r)r rrrlanguage9szMultiByteCharSetProber.languagecCsxtt|D]}|jj||}|tjkrN|jjd|j|j |t j |_ Pq|tj krdt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j|q|jj||d|d|qW|d|jd<|jt jkr|jjr|j|jkrt j|_ |jS)Nz!%s %s prober hit error at byte %srr)rangelenr Z next_staterZERRORZloggerdebugrrrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenr r feedstateZ DETECTINGZgot_enough_dataget_confidenceZSHORTCUT_THRESHOLD)r Zbyte_striZ coding_stateZchar_lenrrrr=s.       zMultiByteCharSetProber.feedcCs |jjS)N)r r)r rrrrZsz%MultiByteCharSetProber.get_confidence)N) __name__ __module__ __qualname____doc__r rpropertyrrrr __classcell__rr)rrr"s   rN)Z charsetproberrZenumsrrrrrrrs chardet/__pycache__/langcyrillicmodel.cpython-36.opt-1.pyc000064400000073220152347724720017471 0ustar003 PfF@sdZdZdZdZdZdZdZeedddddZeedddddZeedddddZ eedddddZ eedddddZ eedddddZ dS)JKGBAL@MHECNIOD '    6;%,:)05.7*<$1&"#+- (48!=>39/?2FglP@?FzKOI8-RZRussian)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguagez windows-1251z ISO-8859-5Z MacCyrillicZIBM866ZIBM855N(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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apZmacCyrillic_char_to_order_mapZIBM855_char_to_order_mapZIBM866_char_to_order_mapZRussianLangModelZ Koi8rModelZWin1251CyrillicModelZLatin5CyrillicModelZMacCyrillicModelZ Ibm866ModelZ Ibm855Modelrr'/usr/lib/python3.6/langcyrillicmodel.pys chardet/__pycache__/euctwprober.cpython-36.opt-1.pyc000064400000002031152347724720016325 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)EUCTWDistributionAnalysis)EUCTW_SM_MODELcs4eZdZfddZeddZeddZZS) EUCTWProbercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__!/usr/lib/python3.6/euctwprober.pyr"s zEUCTWProber.__init__cCsdS)NzEUC-TWr )r r r r charset_name(szEUCTWProber.charset_namecCsdS)NZTaiwanr )r r r r language,szEUCTWProber.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r!s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/codingstatemachine.cpython-36.pyc000064400000005365152347724720016673 0ustar003 Pf@s(ddlZddlmZGdddeZdS)N) MachineStatec@sDeZdZdZddZddZddZdd Zd d Ze d d Z dS)CodingStateMachinea A state machine to verify a byte sequence for a particular encoding. For each byte the detector receives, it will feed that byte to every active state machine available, one byte at a time. The state machine changes its state based on its previous state and the byte it receives. There are 3 states in a state machine that are of interest to an auto-detector: START state: This is the state to start with, or a legal byte sequence (i.e. a valid code point) for character has been identified. ME state: This indicates that the state machine identified a byte sequence that is specific to the charset it is designed for and that there is no other possible encoding which can contain this byte sequence. This will to lead to an immediate positive answer for the detector. ERROR state: This indicates the state machine identified an illegal byte sequence for that encoding. This will lead to an immediate negative answer for this encoding. Detector will exclude this encoding from consideration from here on. cCs0||_d|_d|_d|_tjt|_|jdS)Nr) _model_curr_byte_pos_curr_char_len _curr_stateloggingZ getLogger__name__Zloggerreset)selfZsmr (/usr/lib/python3.6/codingstatemachine.py__init__7s  zCodingStateMachine.__init__cCs tj|_dS)N)rSTARTr)r r r rr ?szCodingStateMachine.resetcCsh|jd|}|jtjkr0d|_|jd||_|j|jd|}|jd||_|jd7_|jS)NZ class_tablerZchar_len_tableZ class_factorZ state_tabler)rrrrrr)r cZ byte_classZ curr_stater r r next_stateBs zCodingStateMachine.next_statecCs|jS)N)r)r r r rget_current_charlenPsz&CodingStateMachine.get_current_charlencCs |jdS)Nname)r)r r r rget_coding_state_machineSsz+CodingStateMachine.get_coding_state_machinecCs |jdS)Nlanguage)r)r r r rrVszCodingStateMachine.languageN) r __module__ __qualname____doc__rr rrrpropertyrr r r rr!sr)r Zenumsrobjectrr r r rs chardet/__pycache__/eucjpprober.cpython-36.opt-1.pyc000064400000004436152347724720016317 0ustar003 Pf@s`ddlmZmZddlmZddlmZddlmZddl m Z ddl m Z GdddeZ d S) ) ProbingState MachineState)MultiByteCharSetProber)CodingStateMachine)EUCJPDistributionAnalysis)EUCJPContextAnalysis)EUCJP_SM_MODELcsPeZdZfddZfddZeddZeddZd d Zd d Z Z S) EUCJPProbercs4tt|jtt|_t|_t|_ |j dS)N) superr __init__rr coding_smrdistribution_analyzerrcontext_analyzerreset)self) __class__!/usr/lib/python3.6/eucjpprober.pyr %s  zEUCJPProber.__init__cstt|j|jjdS)N)r r rr)r)rrrr,szEUCJPProber.resetcCsdS)NzEUC-JPr)rrrr charset_name0szEUCJPProber.charset_namecCsdS)NZJapaneser)rrrrlanguage4szEUCJPProber.languagecCs6xtt|D]}|jj||}|tjkrN|jjd|j|j |t j |_ Pq|tj krdt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j||jj|j|q|jj||d|d||jj||d|d|qW|d|jd<|jt jkr0|jjr0|j|jkr0t j|_ |jS)Nz!%s %s prober hit error at byte %sr)rangelenr Z next_staterZERRORZloggerdebugrrrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenZ _last_charrfeedr stateZ DETECTINGZgot_enough_dataget_confidenceZSHORTCUT_THRESHOLD)rZbyte_striZ coding_stateZchar_lenrrrr8s4      zEUCJPProber.feedcCs|jj}|jj}t||S)N)rrr max)rZ context_confZ distrib_confrrrrYs  zEUCJPProber.get_confidence) __name__ __module__ __qualname__r rpropertyrrrr __classcell__rr)rrr $s     !r N)ZenumsrrZmbcharsetproberrZcodingstatemachinerZchardistributionrZjpcntxrZmbcssmrr rrrrs      chardet/__pycache__/jpcntx.cpython-36.pyc000064400000113272152347724720014345 0ustar003 PfL@s8d`ZGdddeZGdd d eZGd d d eZd S)ac@sPeZdZdZdZdZdZdZddZdd Z d d Z d d Z ddZ ddZ dS)JapaneseContextAnalysisrdircCs*d|_d|_d|_d|_d|_|jdS)N) _total_rel _rel_sample_need_to_skip_char_num_last_char_order_donereset)selfr/usr/lib/python3.6/jpcntx.py__init__{s z JapaneseContextAnalysis.__init__cCs*d|_dg|j|_d|_d|_d|_dS)NrrF)r NUM_OF_CATEGORYr r r r)rrrrrs zJapaneseContextAnalysis.resetcCs|jr dS|j}x||kr|j|||d\}}||7}||krV|||_d|_q|dkr|jdkr|jd7_|j|jkrd|_P|jt|j|d7<||_qWdS)NrrTrrr)rr get_orderr r MAX_REL_THRESHOLDr jp2CharContext)rbyte_strZ num_bytesiorderchar_lenrrrfeeds     zJapaneseContextAnalysis.feedcCs |j|jkS)N)r ENOUGH_REL_THRESHOLD)rrrrgot_enough_datasz'JapaneseContextAnalysis.got_enough_datacCs,|j|jkr"|j|jd|jS|jSdS)Nr)r MINIMUM_DATA_THRESHOLDr DONT_KNOW)rrrrget_confidences z&JapaneseContextAnalysis.get_confidencecCsdS)Nrr)rrr)rrrrrrsz!JapaneseContextAnalysis.get_orderNr)__name__ __module__ __qualname__rr!rrr rrrrr"rrrrrrts rcs0eZdZfddZeddZddZZS)SJISContextAnalysiscstt|jd|_dS)NZ SHIFT_JIS)superr&r _charset_name)r) __class__rrrszSJISContextAnalysis.__init__cCs|jS)N)r()rrrr charset_namesz SJISContextAnalysis.charset_namecCs|sdS|d}d|ko"dkns@d|ko:dknrld}|dksdd |ko^dknrpd |_nd}t|dkr|d}|d krd|kod knr|d|fSd|fS)NrrrZCP932r)rrr)r(len)rr first_charr second_charrrrrs0    zSJISContextAnalysis.get_order)r#r$r%rpropertyr*r __classcell__rr)r)rr&s  r&c@seZdZddZdS)EUCJPContextAnalysiscCs|sd S|d}|dks0d|ko*dknr6d}n|dkrDd}nd}t|dkr|d}|d krd|kovd knr|d|fSd |fS)Nrrrrr)rrr)r3)rrr4rr5rrrrs    zEUCJPContextAnalysis.get_orderN)r#r$r%rrrrrr8sr8NSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Sr?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrr)robjectrr&r8rrrrsCchardet/__pycache__/euckrfreq.cpython-36.pyc000064400000056746152347724720015042 0ustar003 Pf40 @sdZdZ d2Z d1S(3 g@0 xtHa+Wuh]vwmF!p x/9t-yKOn0<4{irXXY&P^9Q"t]{7{;uz/|7.{#|}~t8_     !_*u`"|a?R! /!"=#$%&'(),'b$*+-,&U#-.'f/s0 9e[1Z:23Gy4567,ws89:~;<;}=>?o)@AB2YCD<EFGHI%JKLMNO`>P=QRST; UVWX4YZ[\]^_"P`;~Havz?b<cddefc0dgyhis0j=kl<bU Imnopqrstu6vw*]xyzZ-:b {|&'5>}~wg6%(vwEfV7BN['Sex?qf()~\)$l~C@2KzVQrf h+31 g(zA<jMg2VhJ0bYa!*KD8RB@yX:#iGk=!J=}jEjO4 v]Co lcATk3*q>+;px      l)m8D 7LBDt ! "#$%R&'()*+,,-.m ^/cEam0E1234T567no89F:G;<=>?@ABCDE$FG%pHIJKLMNOPQRS/TUVIHWXqYZ[\rs]^_` vLa.bF>jcZB6`de|f5ghiHjkl1mnopqrCstuvwxyz{|}~OEqI\-S elMQP^ -F .tJgu9  $5%kLARu):"$vcZ*WKL+ B?M[5nC'  FT/8uK(MiT?e (%0O 8        # V P  MW  | S          9D 3   {     ! kNY" # $ % & ' ( ]) * + , - . / >1 \2 3 4 5 6 w7 8 39 : L ; <  = J> ? @ A B C D E F G H I J K L M N IO P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g Ux h i j 4&!Sy " #k l m n pQ.o UOp q r s xt u v w $x y `z { | } ~  C%yo     @ G 2 N  r znP # &Q m c ' w (l@)*    H    r A  },: I N1 W + 1b q , e_d 2   -     7   ,G ^ . g   _ hh{ |3   \        j i4          6d/  o R & knz  XdS} }~ ! N" # s$ % & fD1' ( @) ^* + , - . / J+0 1 2 T3 4 5 6 7 A.8 9 ": ; < = > 0? @ A B C D E F G _[H I `aJ K L M N O iP Q R N(0 rrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQr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rSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 )Z EUCKR_TYPICAL_DISTRIBUTION_RATIOZEUCKR_TABLE_SIZEZEUCKR_CHAR_TO_FREQ_ORDERr1 r1 /usr/lib/python3.6/euckrfreq.py)s(chardet/__pycache__/sbcharsetprober.cpython-36.pyc000064400000005532152347724720016226 0ustar003 Pf@s4ddlmZddlmZmZmZGdddeZdS)) CharSetProber)CharacterCategory ProbingStateSequenceLikelihoodcsbeZdZdZdZdZdZdfdd Zfd d Ze d d Z e d dZ ddZ ddZ ZS)SingleByteCharSetProber@igffffff?g?FNcsJtt|j||_||_||_d|_d|_d|_d|_ d|_ |j dS)N) superr__init___model _reversed _name_prober _last_order _seq_counters _total_seqs _total_char _freq_charreset)selfmodelreversedZ name_prober) __class__%/usr/lib/python3.6/sbcharsetprober.pyr 'sz SingleByteCharSetProber.__init__cs:tt|jd|_dgtj|_d|_d|_d|_ dS)N) rrrr rZget_num_categoriesrrrr)r)rrrr5s zSingleByteCharSetProber.resetcCs|jr|jjS|jdSdS)N charset_name)r rr )rrrrr?sz$SingleByteCharSetProber.charset_namecCs|jr|jjS|jjdSdS)Nlanguage)r rr get)rrrrrFsz SingleByteCharSetProber.languagec Csn|jds|j|}|s|jS|jd}xt|D]\}}||}|tjkrZ|jd7_||jkr|jd7_|j |jkr|j d7_ |j s|j |j|}|jd|}n||j|j }|jd|}|j |d7<||_ q2W|jd}|jt jkrh|j |jkrh|j}||jkr@|jjd||t j|_n(||jkrh|jjd|||jt j|_|jS)NZkeep_english_letterchar_to_order_maprZprecedence_matrixrz$%s confidence = %s, we have a winnerz9%s confidence = %s, below negative shortcut threshhold %s)r Zfilter_international_wordsstate enumeraterZCONTROLr SAMPLE_SIZErr rr rrZ DETECTINGSB_ENOUGH_REL_THRESHOLDget_confidencePOSITIVE_SHORTCUT_THRESHOLDZloggerdebugZFOUND_ITZ_stateNEGATIVE_SHORTCUT_THRESHOLDZNOT_ME) rZbyte_strricorderrrZ confidencerrrfeedMsF           zSingleByteCharSetProber.feedcCsNd}|jdkrJd|jtj|j|jd}||j|j}|dkrJd}|S)Ng{Gz?rg?Ztypical_positive_ratiogGz?)rrrZPOSITIVEr rr)rrrrrr#|s  z&SingleByteCharSetProber.get_confidence)FN)__name__ __module__ __qualname__r!r"r$r&r rpropertyrrr*r# __classcell__rr)rrr!s  /rN)Z charsetproberrZenumsrrrrrrrrs chardet/__pycache__/latin1prober.cpython-36.opt-1.pyc000064400000005456152347724720016404 0ustar003 Pf@s^ddlmZddlmZdZdZdZdZdZdZ dZ dZ d Z d Z eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeee ee ee eeeeeeeeeeee ee ee e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e ee e e e e e e e fZdZGd d d eZd S)) CharSetProber) ProbingStatecsLeZdZfddZddZeddZeddZd d Zd d Z Z S) Latin1Probercs&tt|jd|_d|_|jdS)N)superr __init___last_char_class _freq_counterreset)self) __class__"/usr/lib/python3.6/latin1prober.pyraszLatin1Prober.__init__cCs t|_dgt|_tj|dS)Nr)OTHr FREQ_CAT_NUMrrr)rrrrrgs zLatin1Prober.resetcCsdS)Nz ISO-8859-1r)rrrr charset_namelszLatin1Prober.charset_namecCsdS)Nr)rrrrlanguagepszLatin1Prober.languagecCsb|j|}xP|D]H}t|}t|jt|}|dkr@tj|_P|j|d7<||_qW|j S)Nrr) Zfilter_with_english_lettersLatin1_CharToClassLatin1ClassModelr CLASS_NUMrNOT_MEZ_staterstate)rZbyte_strcZ char_classZfreqrrrfeedts    zLatin1Prober.feedcCs\|jtjkrdSt|j}|dkr(d}n|jd|jdd|}|dkrPd}|d}|S)Ng{Gz?grrg4@g\(\?)rrrsumr)rZtotalZ confidencerrrget_confidences  zLatin1Prober.get_confidence) __name__ __module__ __qualname__rrpropertyrrr!r# __classcell__rr)rrr `s    r N)@rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Z charsetproberrZenumsrrZUDFrZASCZASSZACVZACOZASVZASOrrrr rrrrsh   chardet/__pycache__/euctwprober.cpython-36.pyc000064400000002031152347724720015366 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)EUCTWDistributionAnalysis)EUCTW_SM_MODELcs4eZdZfddZeddZeddZZS) EUCTWProbercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__!/usr/lib/python3.6/euctwprober.pyr"s zEUCTWProber.__init__cCsdS)NzEUC-TWr )r r r r charset_name(szEUCTWProber.charset_namecCsdS)NZTaiwanr )r r r r language,szEUCTWProber.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r!s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/__init__.cpython-36.opt-1.pyc000064400000001375152347724720015535 0ustar003 Pf@s8ddlmZmZddlmZddlmZmZddZdS))PY2PY3)UniversalDetector) __version__VERSIONcCsHt|ts0t|ts(tdjt|nt|}t}|j||jS)z Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` z4Expected object of type bytes or bytearray, got: {0}) isinstance bytearraybytes TypeErrorformattyperZfeedclose)Zbyte_strZdetectorr/usr/lib/python3.6/__init__.pydetects   rN) compatrrZuniversaldetectorrversionrrrrrrrs chardet/__pycache__/mbcsgroupprober.cpython-36.pyc000064400000002024152347724720016242 0ustar003 Pf@sddlmZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZGd d d eZd S) )CharSetGroupProber) UTF8Prober) SJISProber) EUCJPProber) GB2312Prober) EUCKRProber) CP949Prober) Big5Prober) EUCTWProbercseZdZdfdd ZZS)MBCSGroupProberNcsDtt|j|dttttttt t g|_ |j dS)N) lang_filter) superr __init__rrrrrrr r Zprobersreset)selfr ) __class__%/usr/lib/python3.6/mbcsgroupprober.pyr*s zMBCSGroupProber.__init__)N)__name__ __module__ __qualname__r __classcell__rr)rrr )sr N)ZcharsetgroupproberrZ utf8proberrZ sjisproberrZ eucjpproberrZ gb2312proberrZ euckrproberrZ cp949proberrZ big5proberr Z euctwproberr r rrrrs         chardet/__pycache__/langhungarianmodel.cpython-36.pyc000064400000060307152347724720016676 0ustar003 Pf01@s4dZdZdZeedddddZeedddddZdS)(6- 21&'5$)"#/.G+!%90@D74   C A> KO3QN,=:B;<E?RJFPHSMTLUI*8VWg(P?Tz ISO-8859-2Z Hungarian)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguagez windows-1250N(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrr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#r#r#rrrrr#r#r#rrrrrrrrrrrrrr#r#r#r#r#r#rr#r#rr#rr#rrr#r#rrr#r#rrrrrrrrrr)ZLatin2_HungarianCharToOrderMapZwin1250HungarianCharToOrderMapZHungarianLangModelZLatin2HungarianModelZWin1250HungarianModelrr(/usr/lib/python3.6/langhungarianmodel.py#sV chardet/__pycache__/mbcsgroupprober.cpython-36.opt-1.pyc000064400000002024152347724720017201 0ustar003 Pf@sddlmZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZGd d d eZd S) )CharSetGroupProber) UTF8Prober) SJISProber) EUCJPProber) GB2312Prober) EUCKRProber) CP949Prober) Big5Prober) EUCTWProbercseZdZdfdd ZZS)MBCSGroupProberNcsDtt|j|dttttttt t g|_ |j dS)N) lang_filter) superr __init__rrrrrrr r Zprobersreset)selfr ) __class__%/usr/lib/python3.6/mbcsgroupprober.pyr*s zMBCSGroupProber.__init__)N)__name__ __module__ __qualname__r __classcell__rr)rrr )sr N)ZcharsetgroupproberrZ utf8proberrZ sjisproberrZ eucjpproberrZ gb2312proberrZ euckrproberrZ cp949proberrZ big5proberr Z euctwproberr r rrrrs         chardet/__pycache__/utf8prober.cpython-36.pyc000064400000003543152347724720015136 0ustar003 Pf @sHddlmZddlmZmZddlmZddlmZGdddeZ dS)) CharSetProber) ProbingState MachineState)CodingStateMachine) UTF8_SM_MODELcsTeZdZdZfddZfddZeddZedd Zd d Z d d Z Z S) UTF8Proberg?cs*tt|jtt|_d|_|jdS)N)superr__init__rr coding_sm _num_mb_charsreset)self) __class__ /usr/lib/python3.6/utf8prober.pyr &s zUTF8Prober.__init__cs"tt|j|jjd|_dS)N)rrr r r )r )rrrr ,s zUTF8Prober.resetcCsdS)Nzutf-8r)r rrr charset_name1szUTF8Prober.charset_namecCsdS)Nr)r rrrlanguage5szUTF8Prober.languagecCsxj|D]b}|jj|}|tjkr,tj|_Pq|tjkrBtj|_Pq|tj kr|jj dkr|j d7_ qW|j tj kr|j|jkrtj|_|j S)Nr)r Z next_staterZERRORrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenr stateZ DETECTINGget_confidenceZSHORTCUT_THRESHOLD)r Zbyte_strcZ coding_staterrrfeed9s      zUTF8Prober.feedcCs.d}|jdkr&||j|j9}d|S|SdS)NgGz?g?)r ONE_CHAR_PROB)r ZunlikerrrrLs  zUTF8Prober.get_confidence) __name__ __module__ __qualname__rr r propertyrrrr __classcell__rr)rrr#s    rN) Z charsetproberrZenumsrrZcodingstatemachinerZmbcssmrrrrrrs   chardet/__pycache__/gb2312freq.cpython-36.opt-1.pyc000064400000112637152347724720015560 0ustar003 PfP@sdZdZdZdS(g?i< T Q <w 9 Z q W yeov   LB Q QEfd( y, E e WR| R   X jE +P;m l eH^ k6" F ^ ?`u$1  U 1 gl G2q PL y  Mk4  @ `5N 73nuG&bh0 M N Y   & Q 7^hJ PrT -G,u $<B$>x LWn TZ {   ? 0b;DCSU> |g  K % 5 l h ? U *<     ! X  Q g r  q z  3  ]cz7 _ C&aH| l =IP ~ 8` w T  [q  g|C  N I5 (/HK 9I|  W ^~ = X3 I 3ro  {iC!H f= 1[ | D%t  .yT9  #Jn >B"a MK W ! r F+  x HJ2KR $9 t   %~ ` 'v |' n * F%)~ J& !D w[   ' k  h B_ ?gh'5]  1 )a ; _Q/u j[}  Q^ Gz VO   mu 6 -$ R} pr ] D i1ntYG / |t0 \ v c ~A"" !8C8  j 1l> ] ~L(KdvD%  , 2 j -. mK o ;  d@a M 1 L@2 wtQ / ~ / _ # OOGk[Oo-   ! I{r .h T 'L a @  T /  Mi l  {8# 9SR wZ0 Egg  LpS  @I L; Oq)  :F5JdA  ) ELY m  c R! (]I e `  [C (P, }O ' L\  Zs' UN  M ig'  P0 s ip n \  !hm(& CB)5  >  {NE3J#c $ 5x ]k P  rL zd# [ ShG U+ yw"V2 &z J P % Z$ o T K1 `V  d + A $ _3\ b f AnxF O[(  #72 xf !6{ Y+  Ke T$h  R" Z _ @a 3 k)j e A ^ W h: z ) |   8 j 3 zpy 2 oD =.9 af*_ *  -  } * tt6 q S !)y  j  VIg L pD % M $ E "U e  | Q   1 $ ]4&z`w  )% &*82> S 1#  #  F , > +  Z 3q $ V ;NmKW5 R4 ID %K| 9n  -3 2 p? ~C[  3 > l `x  # 0 L QR?(m` 3&  sD0 b f@  =  < 6s  S 8Z     N  L J  bg [ ~  f  ` 4= l? c  i w % d ^+ ZF I t / y* s&+)    e Q]  _7 0cuLk #? n   HYu  J_ _& Z% sS  V1'F\ | W|SW *  RlP#  -q  4a @ Xi%8 3,} dx # 6 .A r R d+  {{H  c  ,I c  = J. ,>Le] C *;  p R9  ?: Q'sw[ - )M]}6@ U/s k ? , = 1M /S d o 6 ku W{xW x ^ [ + 7:U ! .HTY @"Cs G b7~. U q {Y/ A *:8'  A _0iK t *   D>v 'V k \! *U z\f     B  {= & V "!  ( = 9 4a-Q  mC7}qD4u v F u a H o lKA  z4 ! H  5 j` B :Oa #d( & ^mg E o (G $@ IA `X7/$ h U"Tm! M  2q9 / p@X ji ^ b nvoov09$ fS z D{X V3 Y  AqU : 2j  {  F  ciR ;k h Y OxzZ<v   I4 Mb   C O 8 .] Vc  H T >  3,flTWH.'>p" J v2 x 2g 4 { z  ? J 8E j \88  `>bS 0 E d1n@ T QC K ;k_\ ewM. ra  g '  T4o Xyx  U ^:  "#  NUp " - :   W G L Gw o Mr  Q I N% X 7 a  ' ih }Ny?t D  l e Js2*y q 5}s $5 B# ds} ~b O / ] ]2f7O R#  [E f S dFC V > B  16m p  <z | Xse ] O + : A  ( m4P n oomy8 <<c C &w $ 9& )`GbE:Qo F  F|; 34 %: cp6 \C09  ~ "h  ) *    %  .9   "! , g J gF  ;i ZE^A l5 4' k  2  X7 {Bx=e( ' D ik -, e7  n} p 7j 9 0P O U <  JtN) .* Ar ] )G_ pk  %  >b_^?:YD% Y l A DB  @ (v g }v   -~y % _ jM G+  3 ; G)    ,I  XA\P v V= 6 <X   8 - Y  c9 - u  R  6 h } ? w   a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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Z!GB2312_TYPICAL_DISTRIBUTION_RATIOZGB2312_TABLE_SIZEZGB2312_CHAR_TO_FREQ_ORDERrr /usr/lib/python3.6/gb2312freq.py*schardet/__pycache__/jisfreq.cpython-36.pyc000064400000126637152347724720014513 0ustar003 Pfd@sdZdZdZdS(g@i('O}  ]   X}kg k%&01,- <pgWX h " \ /  0  h       !"#$%&'()*+,-./01234567Vj4B89:;<=>vSef d +aw I~ ?@ABCD - i E^ . 3i F/ Y j GHIJq1 Yk/2# *[\5!! %@l'A 4 <-7S~K=E;778m& OK=~dLMNOPQRSTUVY>J"p pT_.XLje9P ly D )h F?+gcB]N8j:57R4Gdnht63$WC : x *V WXYZ[\]^_`abcdefghijklmnopqrst uvwxyz{|l} ~   k > j Z[\]        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  2 {Ta ^| =mk  Vy  q  !   CO3r n+ pq ; A C0 n TCo  # ~P  $ z  & _U s  I3 $W1 5P X l H   W~p$@L u JI W _ <]Dhf-}t  , bXF{ `+3qm4 BlX % % 2 u J|r@    L b J c 4 Rm T e ? - *E + & /.s[+  Bc  ) , u  9& v Y 3  Dd| (y<8 i d 5 Bn | !)@ n m 0a z' W[v  o   '  "9 Jhe \p @Q9 w iEJI f  1  ' r  c qx 2 *bFvd !RQP( _ ` f 6 Aa uT 2 ^C [ v%n!FZ^dx ] Bc Pq HY (  g}K 4 W Cg -dk4} q ~ + h@  @A D:e qwdZ* M [sZ >'-  ) tF7 t#Yfkb 1 6oc q  u:N U= vlN]; lL }B 8 Q#`T xr  3n{@ 9 5 h d Z is-r [ 0.S RO  ; 4y ;z p  : (| " Oe C t) 6K8P h  3$* =be  4 .7\ j / =^5  \9#+ s ,7Y M+ i Q6 y s#{ Uf<v) m< g l D bu DB [ 8>   ] D6Z 5 <m , u^ gIg \: Mt EoER Ej gWK C=]$! `Kv0i^ 3"ak ; w yP wt  Ja] Lh u j#C a!s|  Y hO5zi SL.& < 7sA M s*, % k&fOj"(-[ - =} MS     ~ Jtkvey< f Mk owv l]. /f q$g Gn>6 =   N xe* h $ob, t  V iw pH Vi<Z 8rw& />> E x&ew 5 \Si 2+'%x O Q _H gy  0&+   l ''z _  ?  z m |  g 0 * `w #c)R TrV_r ` x fn = *A (xS {T 9M r;(%[a b D- \  o Em)!c , 1] >I T ykzxN  5 "H<d  h  p :L1 > q ?ZMI B K D#  Y>` cTa2y/"U b /   { j 5*ax F7  ?w+8  N ,n  os_?   ?0 y3f =l v]  z yju pj izr F' { n xu$Mk p ^ q `|  |    G -Z1Y-  e[C e .-  7 bl {. z ? 9  } a  Q d;V /^D ?m 9I   {} &~X } 9 :"\ _ 8W~ ^%Ps w 8 L.  NPS:R'0b z K rq n L X@ gi4: r Q  ;' >bmws A t 9  o ^2c r !t1{ s xvap  LOU .). E "y ( q E 6 2u6 . i Vs GGjtW `u  {Q OC  J   $/ _j R7/ 3Du 6X4 >0 ``  U  r )5H ~r   ] @  av/!67w 3c8x B M F g( : H f " ~ y  !N 4A dez 0  { f(lG ^B mF |U2R# F U1 ckN S $O  Y G W C ? ~UF C e / Q_v ; P)Gm G ,Iz_  9n A X #V)< %}Hw 5p.m #h|b @(^z A  " g |6X, $#Ik :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mrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrrrrrrrrr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L_DISTRIBUTION_RATIOZJIS_TABLE_SIZEZJIS_CHAR_TO_FREQ_ORDERrr/usr/lib/python3.6/jisfreq.py,s$chardet/__pycache__/sbcsgroupprober.cpython-36.opt-1.pyc000064400000002776152347724720017225 0ustar003 Pf @sddlmZddlmZddlmZmZmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZddlmZddlmZdd lmZGd d d eZd S) )CharSetGroupProber)SingleByteCharSetProber)Win1251CyrillicModel Koi8rModelLatin5CyrillicModelMacCyrillicModel Ibm866Model Ibm855Model)Latin7GreekModelWin1253GreekModel)Latin5BulgarianModelWin1251BulgarianModel)TIS620ThaiModel)Win1255HebrewModel) HebrewProber)Latin5TurkishModelcseZdZfddZZS)SBCSGroupProberc stt|jtttttttttttt tt tt tt tt ttttg |_t}ttd|}ttd|}|j|||jj|||g|jdS)NFT)superr__init__rrrrrrr r r r r rrZprobersrrZset_model_probersextendreset)selfZ hebrew_proberZlogical_hebrew_proberZvisual_hebrew_prober) __class__%/usr/lib/python3.6/sbcsgroupprober.pyr,s,   zSBCSGroupProber.__init__)__name__ __module__ __qualname__r __classcell__rr)rrr+srN)ZcharsetgroupproberrZsbcharsetproberrZlangcyrillicmodelrrrrrr Zlanggreekmodelr r Zlangbulgarianmodelr r Z langthaimodelrZlanghebrewmodelrZ hebrewproberrZlangturkishmodelrrrrrrs       chardet/__pycache__/chardistribution.cpython-36.opt-1.pyc000064400000014135152347724720017351 0ustar003 Pf$@sddlmZmZmZddlmZmZmZddlm Z m Z m Z ddl m Z mZmZddlmZmZmZGdddeZGdd d eZGd d d eZGd d d eZGdddeZGdddeZGdddeZdS))EUCTW_CHAR_TO_FREQ_ORDEREUCTW_TABLE_SIZE EUCTW_TYPICAL_DISTRIBUTION_RATIO)EUCKR_CHAR_TO_FREQ_ORDEREUCKR_TABLE_SIZE EUCKR_TYPICAL_DISTRIBUTION_RATIO)GB2312_CHAR_TO_FREQ_ORDERGB2312_TABLE_SIZE!GB2312_TYPICAL_DISTRIBUTION_RATIO)BIG5_CHAR_TO_FREQ_ORDERBIG5_TABLE_SIZEBIG5_TYPICAL_DISTRIBUTION_RATIO)JIS_CHAR_TO_FREQ_ORDERJIS_TABLE_SIZEJIS_TYPICAL_DISTRIBUTION_RATIOc@sLeZdZdZdZdZdZddZddZd d Z d d Z d dZ ddZ dS)CharDistributionAnalysisigGz?g{Gz?cCs0d|_d|_d|_d|_d|_d|_|jdS)N)_char_to_freq_order _table_sizetypical_distribution_ratio_done _total_chars _freq_charsreset)selfr&/usr/lib/python3.6/chardistribution.py__init__.sz!CharDistributionAnalysis.__init__cCsd|_d|_d|_dS)zreset analyser, clear any stateFN)rrr)rrrrr=szCharDistributionAnalysis.resetcCsX|dkr|j|}nd}|dkrT|jd7_||jkrTd|j|krT|jd7_dS)z"feed a character with known lengthrriN) get_orderrrrr)rcharZchar_lenorderrrrfeedFs  zCharDistributionAnalysis.feedcCsT|jdks|j|jkr|jS|j|jkrN|j|j|j|j}||jkrN|S|jS)z(return confidence based on existing datar)rrMINIMUM_DATA_THRESHOLDSURE_NOrSURE_YES)rrrrrget_confidenceTs   z'CharDistributionAnalysis.get_confidencecCs |j|jkS)N)rENOUGH_DATA_THRESHOLD)rrrrgot_enough_datadsz(CharDistributionAnalysis.got_enough_datacCsdS)Nrr r)rbyte_strrrrr!isz"CharDistributionAnalysis.get_orderN) __name__ __module__ __qualname__r*r'r&r%rrr$r)r+r!rrrrr(s rcs$eZdZfddZddZZS)EUCTWDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) superr0rrrrrrr)r) __class__rrrrsz"EUCTWDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr^rr r)rr, first_charrrrr!xsz#EUCTWDistributionAnalysis.get_order)r-r.r/rr! __classcell__rr)r2rr0qs r0cs$eZdZfddZddZZS)EUCKRDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1r8rrrrrrr)r)r2rrrsz"EUCKRDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nrr4rr5r r)rr,r6rrrr!sz#EUCKRDistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rr8s r8cs$eZdZfddZddZZS)GB2312DistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1r:rrrr rr r)r)r2rrrsz#GB2312DistributionAnalysis.__init__cCs>|d|d}}|dkr6|dkr6d|d|dSdSdS)Nrrr9r5r4r r)rr,r6 second_charrrrr!sz$GB2312DistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rr:s r:cs$eZdZfddZddZZS)Big5DistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1r<rr rr rr r)r)r2rrrsz!Big5DistributionAnalysis.__init__cCsX|d|d}}|dkrP|dkr:d|d|ddSd|d|dSndSdS) Nrrr5?@r r)rr,r6r;rrrr!s z"Big5DistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rr<s r<cs$eZdZfddZddZZS)SJISDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1rArrrrrrr)r)r2rrrsz!SJISDistributionAnalysis.__init__cCsr|d|d}}|dkr0|dkr0d|d}n&|dkrR|dkrRd|dd}nd S||d }|d krnd }|S) Nrrr@r r r)rr,r6r;r#rrrr!s z"SJISDistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rrAs rAcs$eZdZfddZddZZS)EUCJPDistributionAnalysiscs$tt|jt|_t|_t|_dS)N) r1rIrrrrrrr)r)r2rrrsz"EUCJPDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nrr4r5rr r)rr,r"rrrr!sz#EUCJPDistributionAnalysis.get_order)r-r.r/rr!r7rr)r2rrIs rIN)Z euctwfreqrrrZ euckrfreqrrrZ gb2312freqrr r Zbig5freqr r r Zjisfreqrrrobjectrr0r8r:r<rArIrrrrsIchardet/__pycache__/big5freq.cpython-36.pyc000064400000152574152347724720014553 0ustar003 Pfz@sdZdZdZdS(g?  Ra n! L,B { ]  j.Ni:?=NKkq    b  o2 i c8{| " @\ F| QHPv D^ F} E O0s4<2 &M~ G[ ? aK *g Z : K  `l  q~  cu* ~meG^n UCC jo/P7 [ ? oS( p]6j @ 8+3 [\] A  1H d+ 2 OL f139l,  ez QM& X kpM % ' \ 7J!NB P_ q    I8  {   mfx   g &'. M $#DhA rUG QSid 0FC  J UN < :A  9} WP )D4 )r st9 s *]  D j(   u5Yj lu ` = 5!TE xe O P| 6A /k l! B` A  v wM a  } x,} B F km    b) ^ P  , 75 ~ y| z C {1b t  _   b 5Dl|[*  %G ^ l `  pncgm'2{  D f |:    n ;IY} X" -lE~>],vLBi& GB +   a a }E D=0  6 v!9H F"H  oR*.I 3, *SX/bp R 7 2 _ b   ` O `7 a g  _~ a b   ; - Q q`##r sdt c  kw  g QU CSc 5B_ cNY Ld K 8 aG s6 t; N  4:\q. u   r c @   /9   < d 8vC m Zw {$Md 0r gV: Z{$e 0$ 5[vcVR $; f  dWe   J u   K 2L .2 %    x M }Td ` 3; yYL U\VN   "x%;= 2E!^"w # $<Qr%]&< ' 36B (   g )  *+! :7^ ( ,+  x-/h= .V  h /<;0 1z  56 _)234y"  ^5 ?%+f 6_W 7>  g # u 8 9h F V{ O Iw~ ^: ;e1  P <=> (`R? YI  7 ? @oqYnl  i EPV! nA|  B- O CDWTT }E&  ~G $ Wo FG" # D-Q He I Jz KL$ H M: NI HO PQkRR    ST % & S U S CV~!X,O|Pe   T WXYR v  = ZU [ V % \]^8T . ' _vwt`ab> "{ cd9[9dh  e J !f Tg %WMhi( j y7mjk ? W " Bl| ) z  mnuv w * opq7.r  f s& y   > Y tu/ + v  @ w 3, x 69 6 ! yQ:c - oFX f z  {/' b`u v   0ES8[|}G !~FU   es w " a Z& A i  o    A J0 x  Y  Z 8oQ aQp;Pb    ] '.   L / B 0 [ 8 /3 0 n 4<  Y C  }1 K 0 F #\f >    j-p9@ 6y  1 V4 K1  D # 2  ZHpg  qr   K V \ ,  ]u Z j0hh  E    2 Mw y ? tm( +i   L )  f  R"A 3 -1$ (] # $  *   =k !   _^ 2 9 4  b  5 "  4I # j $k  \ gE5  6  %  [  &e o l }z+  n- 'i (   Biq<*j)"*>)7 +z,M )r- Tp##   S.8 z 9 =m Sx/q35:   ; 01n _ ] n %  ` zTs23  { 5 g k 34 c   a:1 !Ah o 6" l - a 5   #! $ 4 f %& N  W ' $< NW kO X , 6&tP  7 - j  C[p  '8 b m  {(  9 :  ^B ;   )<=  > =n HD ?UW = : N KE@4c > Q Ah ( ]B*lCDEh X++JU m EFG k n d F ! r@H"CG ^  8t) ; ? !oI "##$J % &rK'5 ()o @ }A ,*41+ " , C urD - - Lv{| M..NY 6  /0/ 1$2%GRB _C  D 3  .  4@w567i &08 & * + G Ou# 1PRQ )=9l E Sk \  y: ;<F %=R>d', ?e$ 23-  4(S@AB.TO   &  < CD Up G e  E;VF'G) } H*WIT  J. g~Uj  X8* K~  LH % +f  tMN   k YY*/ OR ZH #I 5S ]E [\ sI +PQ, RST,U]V L-! T \4W XYZ[>w+^J _$\l.]`^_q %`a 6g U bcda q x e by fhgh'i  jr  0  =b|  h k l acm n u des K /o7& J 8pqi j f g (`rs <Fk f]It>uv  0-wL  Ga t  SKxyzV O1 { F y9Z |}~F  :2 p;G  h7 qM    (8 N 3 O <TW (1u Z cjP p  v ij  Q K  ' 9  z  k 2 l>=C'> Z mn b q?   " ? }o@>A 1)? x   3 h l ) p'4  A_ BL  Pq rX cs! H w CDtx  / 5 4 ur _/ <~7y m ^5 n b tl 6 7v 8:  0 1 wI ( B 4s  ?Cx EH FyzG{|; }9mH ~z s M  m Io _ 2 3 H* < i:  A R  "     Q Y {K [ JN S I T @  @R t JI  U m{   ;V  < dX96 U L!= )       =$(v&c  >{"#W   $ %&^[ '( 2\ J p pn u q ) O >  *X  + ,  K I-!.DJs#  7 /w|"4 | , ?Y P 01Z Z   #@2|zA'?  8  yLV 3 $M%   .4N   59 %KQ x67B Ov [ &  X* \ P N+ w WC  QD ?] ^ o R E F 'XGS T R8x kST  D9!(L"#$%_ &J:U} ) ;< E+' H=V*Hy, +W3>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rr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZBIG5_TYPICAL_DISTRIBUTION_RATIOZBIG5_TABLE_SIZEZBIG5_CHAR_TO_FREQ_ORDERrr/usr/lib/python3.6/big5freq.py+schardet/__pycache__/langthaimodel.cpython-36.opt-1.pyc000064400000055420152347724720016606 0ustar003 Pf,@sdZdZeedddddZdS)jkde^lmnoY_pq@HIrJstfQuZgNR`[OThiab\XvcUSK4"3w/:9157+,0'>6- = *.LB? $ ( #V )!2%CM&]D8;AE<FPGWg@?FzTIS-620ZThai)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguageN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrm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rrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZTIS620CharToOrderMapZ ThaiLangModelZTIS620ThaiModelrr#/usr/lib/python3.6/langthaimodel.py%s* chardet/__pycache__/langbulgarianmodel.cpython-36.pyc000064400000060341152347724720016664 0ustar003 Pf'2@s4dZdZdZeedddddZeedddddZdS)MZcdHmkeOQfL^Rnl[JwT`osAEFB?Dpg\h_VWGtU]aqi- #+%,7/(;!.&$)'"3015269=C<8    K4*>:bxN@SyuXzYjIPvrg! _B?Fz ISO-8859-5Z Bulgairan)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguagez windows-1251Z BulgarianN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr(r/r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr>r?r@rArBrCrDrErrFrGrHrIrJrKrLrMrrrrrrrWrNrOrPrQrRrSrTrUrrVrXrYrZrrrr[r\r]r_r`r^r|r~rrrrrrrrrrrrrrrrrarbrcrdrerfrgrhrirjr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZLatin5_BulgarianCharToOrderMapZwin1251BulgarianCharToOrderMapZBulgarianLangModelZLatin5BulgarianModelZWin1251BulgarianModelrr(/usr/lib/python3.6/langbulgarianmodel.py&sV chardet/__pycache__/sjisprober.cpython-36.pyc000064400000004470152347724720015220 0ustar003 Pf@s`ddlmZddlmZddlmZddlmZddlm Z ddl m Z m Z GdddeZ d S) )MultiByteCharSetProber)CodingStateMachine)SJISDistributionAnalysis)SJISContextAnalysis) SJIS_SM_MODEL) ProbingState MachineStatecsPeZdZfddZfddZeddZeddZd d Zd d Z Z S) SJISProbercs4tt|jtt|_t|_t|_ |j dS)N) superr __init__rr coding_smrdistribution_analyzerrcontext_analyzerreset)self) __class__ /usr/lib/python3.6/sjisprober.pyr %s  zSJISProber.__init__cstt|j|jjdS)N)r r rr)r)rrrr,szSJISProber.resetcCs|jjS)N)r charset_name)rrrrr0szSJISProber.charset_namecCsdS)NZJapaneser)rrrrlanguage4szSJISProber.languagecCsLxtt|D]}|jj||}|tjkrP|jjd|j|j |t j |_ Pq|tj krft j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|jd|d||jj|j|q|jj||d||d|||jj||d|d|qW|d|jd<|jt jkrF|jjrF|j|jkrFt j|_ |jS)Nz!%s %s prober hit error at byte %sr)rangelenr Z next_staterZERRORZloggerdebugrrrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenZ _last_charrfeedr stateZ DETECTINGZgot_enough_dataget_confidenceZSHORTCUT_THRESHOLD)rZbyte_striZ coding_stateZchar_lenrrrr8s6      zSJISProber.feedcCs|jj}|jj}t||S)N)rrr max)rZ context_confZ distrib_confrrrrYs  zSJISProber.get_confidence) __name__ __module__ __qualname__r rpropertyrrrr __classcell__rr)rrr $s     !r N)ZmbcharsetproberrZcodingstatemachinerZchardistributionrZjpcntxrZmbcssmrZenumsrrr rrrrs     chardet/__pycache__/utf8prober.cpython-36.opt-1.pyc000064400000003543152347724720016075 0ustar003 Pf @sHddlmZddlmZmZddlmZddlmZGdddeZ dS)) CharSetProber) ProbingState MachineState)CodingStateMachine) UTF8_SM_MODELcsTeZdZdZfddZfddZeddZedd Zd d Z d d Z Z S) UTF8Proberg?cs*tt|jtt|_d|_|jdS)N)superr__init__rr coding_sm _num_mb_charsreset)self) __class__ /usr/lib/python3.6/utf8prober.pyr &s zUTF8Prober.__init__cs"tt|j|jjd|_dS)N)rrr r r )r )rrrr ,s zUTF8Prober.resetcCsdS)Nzutf-8r)r rrr charset_name1szUTF8Prober.charset_namecCsdS)Nr)r rrrlanguage5szUTF8Prober.languagecCsxj|D]b}|jj|}|tjkr,tj|_Pq|tjkrBtj|_Pq|tj kr|jj dkr|j d7_ qW|j tj kr|j|jkrtj|_|j S)Nr)r Z next_staterZERRORrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenr stateZ DETECTINGget_confidenceZSHORTCUT_THRESHOLD)r Zbyte_strcZ coding_staterrrfeed9s      zUTF8Prober.feedcCs.d}|jdkr&||j|j9}d|S|SdS)NgGz?g?)r ONE_CHAR_PROB)r ZunlikerrrrLs  zUTF8Prober.get_confidence) __name__ __module__ __qualname__rr r propertyrrrr __classcell__rr)rrr#s    rN) Z charsetproberrZenumsrrZcodingstatemachinerZmbcssmrrrrrrs   chardet/__pycache__/langgreekmodel.cpython-36.pyc000064400000057637152347724720016033 0ustar003 Pf1@s4dZdZdZeedddddZeedddddZdS)Rdh^betfou\XqUOviSCrw_cmHFPQ<`]YDxaMVE7NsAB:LjgWkpZJ=$.GI6l{n3+)"[(4/,5&1;'#0%!-82T9y|     *@Kgs?Fz ISO-8859-7ZGreek)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguagez windows-1253N(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrjryrjrjryryrjrryrrjrrrryrrrrrfryrryrryrrryrryrryryrrrfrryryryrryryryrryryryrrryrrrfrrrrrryrrjrjryrrrrrrrfrjrryrryryryrrryrrjrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrjrryrjryrryryrryrryryrryrryryryrrrrrrryrjrrrryrrfryrrrrryryrrrryrfrryryrrrrrrrfrryrrrrrrrrryrfrryrjryryrjryrjryrrrjrjrjrrrjryrrrrfrfrryrryryrryrryrryryrrryrryryryrryryryryrrryrrrryrrfrrrrrrjrrjrjryryrrjrrrryryrryryryrfryrrrfryryrrrjrrrryrrfryrrrrfryrrrrrrrryryrrfrrryrrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryrjrjryryrrrryrryrjrjrryrrrrrrryryryrryryrryrryrryryrrryryryryrfrrryryrryrrryrrrrrrryrrrrrrrryrrjryrjrrrrjrrryryrryrryryryrrryrrrrrrrrryrrryryrrryryryrrrrrrryrrrryrrrrrrrrrrrrrrryrrrjryrryryryryryrrrryrrrrryrrfrrryrrfrrrrryryryrryryrrfryrryryryrryryryryrfryryrrryrrrrrrrrrrrrrrfrrrrrrrrrryrrrrrrrfrrrrrrrrrryrryrryryrrrrrfryrfrrryryrrryrrrrrrrrrrrrrrrjryrjrrryrrrryryrryrrrrfrrryrryrryryrrrrrrryrrrrryryrrrrrrryrrrrrrrrrryrrrrrrrryryrjryryrrrrrrrfrjrryrryryrrrrfrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryrryrrjryrryrrrrrrryryrrrrrrrrrrrrrrrfrrryrrrrrfrfrrryrfryrryryrrfrrrfrrrryrrrrrrrrjrryryryrrryrrrryrrrryrjrryrrrrrrryryrrrryrrfryrrrrfryryrfrrrryrrryrrrrrrrrrfrrrrrrrrrrrrrrrrjrrrrrrryrrrrrrrrrrrrrrrrryrfryrryryrryrrryrrrrrfryrfrryrfrrrrrrrrrrrrryrrrrjrfryryrryrrrrryrrrryrrrjrrrrryryryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryrfrryrrfryrrrrrrrrrrrrrryrrrfrrrrrrryrryryrrryryryryryrrfryrrrryryrrfrryrrryryrrrrrrrrrrrfrrrrrrrrjrrryrrrrrrrrryrryrrrrryrrfryrrrrryryrfrrfrrfrryryryrfrrrrrrrfrrrrrrrryrrfryrrrrrrrrrrryrrryryrrrrrfrrrrrrryrryryrrrrryryrrrrrrryrrrrrrrrrryrrryrrrrryryryryrrrrjrrrrrrrrryrrrrrrryrrrrrrrfrrryrrrrrfryrrrrrrryryrfrfrrrrrrrfrrrrrrrryrryryryrrryrrrrrrrryryryrrrryrrrrrrrrryrrrfrrrrryrfrrrrrrrfrrrrrrfrrrrrrrrrrrrjrryrrrrrrrrryrrrrrryrrrrrrrryrrrrryrrryrrrrryryrrrrrfrrrfrrrrrrrrrrrrrrrrryrryryrfrrrrrrryrrryrryryryrrrrrrryrrrrryrrryrrryrryryrrrrryrryrrrrrryrrrryrrrrrrrrrjrrrryryrryryrrrrrryrrrrrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrfrrrrrrfrrrrrrrrrrrrrrrrrrrrrrrrfrrrrrrrrrrrrrrrrrrryrrryrrrrrrryryryryryrrrrrrryrrrrrrrrrrrrrrfrfrrrrfrrrrrrrryrfrrrrrrryrrrrrrrrrrrrrrrrrrrrrrrryryrrrrrryrrrrrrrrrfrrrrrrrrrryrrrryrrrrrrfrrrrryryrrrrfrrrrrrrrrrrrrrrfrrrrrrrrrrrrryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrfrrrfrryrrrrryrryrrrrrrrrrrrrrrryrrrrrrrrrrrrrrrrfrrrrrfrfrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrfrrrrrrrrrrrrrrfrrrrrfrrryrryrrrrrrrrrrrryrfrrrrrrryrrrrfryrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZLatin7_char_to_order_mapZwin1253_char_to_order_mapZGreekLangModelZLatin7GreekModelZWin1253GreekModelrr$/usr/lib/python3.6/langgreekmodel.py#sV chardet/__pycache__/version.cpython-36.opt-1.pyc000064400000000550152347724720015455 0ustar003 Pf@sdZdZejdZdS)z This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) z3.0.4.N)__doc__ __version__splitVERSIONrr/usr/lib/python3.6/version.pyschardet/__pycache__/eucjpprober.cpython-36.pyc000064400000004436152347724720015360 0ustar003 Pf@s`ddlmZmZddlmZddlmZddlmZddl m Z ddl m Z GdddeZ d S) ) ProbingState MachineState)MultiByteCharSetProber)CodingStateMachine)EUCJPDistributionAnalysis)EUCJPContextAnalysis)EUCJP_SM_MODELcsPeZdZfddZfddZeddZeddZd d Zd d Z Z S) EUCJPProbercs4tt|jtt|_t|_t|_ |j dS)N) superr __init__rr coding_smrdistribution_analyzerrcontext_analyzerreset)self) __class__!/usr/lib/python3.6/eucjpprober.pyr %s  zEUCJPProber.__init__cstt|j|jjdS)N)r r rr)r)rrrr,szEUCJPProber.resetcCsdS)NzEUC-JPr)rrrr charset_name0szEUCJPProber.charset_namecCsdS)NZJapaneser)rrrrlanguage4szEUCJPProber.languagecCs6xtt|D]}|jj||}|tjkrN|jjd|j|j |t j |_ Pq|tj krdt j|_ Pq|tjkr|jj}|dkr|d|jd<|jj|j||jj|j|q|jj||d|d||jj||d|d|qW|d|jd<|jt jkr0|jjr0|j|jkr0t j|_ |jS)Nz!%s %s prober hit error at byte %sr)rangelenr Z next_staterZERRORZloggerdebugrrrZNOT_MEZ_stateZITS_MEZFOUND_ITZSTARTZget_current_charlenZ _last_charrfeedr stateZ DETECTINGZgot_enough_dataget_confidenceZSHORTCUT_THRESHOLD)rZbyte_striZ coding_stateZchar_lenrrrr8s4      zEUCJPProber.feedcCs|jj}|jj}t||S)N)rrr max)rZ context_confZ distrib_confrrrrYs  zEUCJPProber.get_confidence) __name__ __module__ __qualname__r rpropertyrrrr __classcell__rr)rrr $s     !r N)ZenumsrrZmbcharsetproberrZcodingstatemachinerZchardistributionrZjpcntxrZmbcssmrr rrrrs      chardet/__pycache__/langcyrillicmodel.cpython-36.pyc000064400000073220152347724720016532 0ustar003 PfF@sdZdZdZdZdZdZdZeedddddZeedddddZeedddddZ eedddddZ eedddddZ eedddddZ dS)JKGBAL@MHECNIOD '    6;%,:)05.7*<$1&"#+- (48!=>39/?2FglP@?FzKOI8-RZRussian)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguagez windows-1251z ISO-8859-5Z MacCyrillicZIBM866ZIBM855N(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrrrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|r|r|r|rrrrrrrrrr|rrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|r|r|rrr|rr|rrrrrr|r|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|r|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr) ZKOI8R_char_to_order_mapZwin1251_char_to_order_mapZlatin5_char_to_order_mapZmacCyrillic_char_to_order_mapZIBM855_char_to_order_mapZIBM866_char_to_order_mapZRussianLangModelZ Koi8rModelZWin1251CyrillicModelZLatin5CyrillicModelZMacCyrillicModelZ Ibm866ModelZ Ibm855Modelrr'/usr/lib/python3.6/langcyrillicmodel.pys chardet/__pycache__/euckrprober.cpython-36.opt-1.pyc000064400000002031152347724720016307 0ustar003 Pf@sDddlmZddlmZddlmZddlmZGdddeZdS))MultiByteCharSetProber)CodingStateMachine)EUCKRDistributionAnalysis)EUCKR_SM_MODELcs4eZdZfddZeddZeddZZS) EUCKRProbercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__!/usr/lib/python3.6/euckrprober.pyr#s zEUCKRProber.__init__cCsdS)NzEUC-KRr )r r r r charset_name)szEUCKRProber.charset_namecCsdS)NZKoreanr )r r r r language-szEUCKRProber.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r"s  rN) ZmbcharsetproberrZcodingstatemachinerZchardistributionrZmbcssmrrr r r r s    chardet/__pycache__/escsm.cpython-36.opt-1.pyc000064400000016167152347724720015115 0ustar003 Pf)@sddlmZdZejejdejejejejejejejejejejejejejejejejejejejdejdejdejdddejdejdddejdejdejejejejejejejf0ZdZedeedd d ZdZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejejejejejejejddejejejejejejejejejejejejejejejejejejejejejejf@Z dZ e d e e d d d Z dZ ejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejejdejejejdejejejejejdejejejejejejejejejejejejejejejejejejejejejejejejejejejejfHZdZe deeddd ZdZejdejejejejejejejejejejejejejejejejejejejdejejejejejejdejejejejejejejejejejejf(ZdZedeeddd ZdS)) MachineStatez HZ-GB-2312ZChinese)Z class_tableZ class_factorZ state_tableZchar_len_tablenameZlanguage z ISO-2022-CN z ISO-2022-JPZJapanesez ISO-2022-KRZKoreanN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr) rrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr) rrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrr)ZenumsrZHZ_CLSZSTARTZERRORZITS_MEZHZ_STZHZ_CHAR_LEN_TABLEZ HZ_SM_MODELZ ISO2022CN_CLSZ ISO2022CN_STZISO2022CN_CHAR_LEN_TABLEZISO2022CN_SM_MODELZ ISO2022JP_CLSZ ISO2022JP_STZISO2022JP_CHAR_LEN_TABLEZISO2022JP_SM_MODELZ ISO2022KR_CLSZ ISO2022KR_STZISO2022KR_CHAR_LEN_TABLEZISO2022KR_SM_MODELrr/usr/lib/python3.6/escsm.pysp  "    $     $ $chardet/__pycache__/langhebrewmodel.cpython-36.opt-1.pyc000064400000055445152347724720017144 0ustar003 PfQ,@sdZdZeedddddZdS)E[OP\YaZDopRI_UNyVGCfkTrgs2J<=*LF@5i]8A61Bn3+,?QMbKl|(:S4/.H ^qm"tvduw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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZWIN1255_CHAR_TO_ORDER_MAPZHEBREW_LANG_MODELZWin1255HebrewModelrr%/usr/lib/python3.6/langhebrewmodel.py&s* chardet/__pycache__/universaldetector.cpython-36.opt-1.pyc000064400000013173152347724720017537 0ustar003 Pf0@sdZddlZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZdd lmZGd d d eZdS) a Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco N)CharSetGroupProber) InputStateLanguageFilter ProbingState)EscCharSetProber) Latin1Prober)MBCSGroupProber)SBCSGroupProberc @sneZdZdZdZejdZejdZejdZ dddd d d d d dZ e j fddZ ddZddZddZdS)UniversalDetectoraq The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result g?s[-]s(|~{)s[-]z Windows-1252z Windows-1250z Windows-1251z Windows-1256z Windows-1253z Windows-1255z Windows-1254z Windows-1257)z iso-8859-1z iso-8859-2z iso-8859-5z iso-8859-6z iso-8859-7z iso-8859-8z iso-8859-9z iso-8859-13cCsNd|_g|_d|_d|_d|_d|_d|_||_tj t |_ d|_ |j dS)N)_esc_charset_prober_charset_probersresultdone _got_data _input_state _last_char lang_filterloggingZ getLogger__name__logger_has_win_bytesreset)selfrr'/usr/lib/python3.6/universaldetector.py__init__Qs zUniversalDetector.__init__cCsZdddd|_d|_d|_d|_tj|_d|_|jr>|jj x|j D] }|j qFWdS)z Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. Ng)encoding confidencelanguageF) rrrrr PURE_ASCIIrrr rr )rproberrrrr^s  zUniversalDetector.resetcCs>|jr dSt|sdSt|ts(t|}|js|jtjrJdddd|_nv|jtj tj frldddd|_nT|jdrdddd|_n:|jd rd ddd|_n |jtj tj frd ddd|_d |_|jd dk rd |_dS|j tjkr.|jj|rtj|_ n*|j tjkr.|jj|j|r.tj|_ |dd|_|j tjkr|js^t|j|_|jj|tjkr:|jj|jj|jjd|_d |_n|j tjkr:|jst |jg|_|jt!j"@r|jj#t$|jj#t%x@|jD]6}|j|tjkr|j|j|jd|_d |_PqW|j&j|r:d |_'dS)a Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``result`` attribute). .. note:: You should always call ``close`` when you're done feeding in your document if ``done`` is not already ``True``. Nz UTF-8-SIGg?)rrrzUTF-32szX-ISO-10646-UCS-4-3412szX-ISO-10646-UCS-4-2143zUTF-16Trr)(rlen isinstance bytearrayr startswithcodecsBOM_UTF8r BOM_UTF32_LE BOM_UTF32_BEBOM_LEBOM_BErrr!HIGH_BYTE_DETECTORsearch HIGH_BYTE ESC_DETECTORrZ ESC_ASCIIr rrfeedrZFOUND_IT charset_nameget_confidencerr r rZNON_CJKappendr rWIN_BYTE_DETECTORr)rZbyte_strr"rrrr3os|              zUniversalDetector.feedc Cs|jr |jSd|_|js&|jjdn|jtjkrBdddd|_n|jtjkrd}d}d}x,|j D]"}|slqb|j }||krb|}|}qbW|r||j kr|j }|j j }|j }|jd r|jr|jj||}|||jd|_|jjtjkrz|jd dkrz|jjd xn|j D]d}|s qt|trZxF|jD] }|jjd |j |j|j q4Wn|jjd |j |j|j qW|jS) z Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`. Tzno data received!asciig?r#)rrrNgziso-8859rz no probers hit minimum thresholdz%s %s confidence = %s)rrrrdebugrrr!r1r r5MINIMUM_THRESHOLDr4lowerr(r ISO_WIN_MAPgetrZgetEffectiveLevelrDEBUGr&rZprobers) rZprober_confidenceZmax_prober_confidenceZ max_proberr"r4Zlower_charset_namerZ group_proberrrrcloses`            zUniversalDetector.closeN)r __module__ __qualname____doc__r:recompiler/r2r7r<rZALLrrr3r?rrrrr 3s"    mr )rBr)rrCZcharsetgroupproberrZenumsrrrZ escproberrZ latin1proberrZmbcsgroupproberr Zsbcsgroupproberr objectr rrrr$s     chardet/__pycache__/cp949prober.cpython-36.opt-1.pyc000064400000002030152347724720016045 0ustar003 Pf?@sDddlmZddlmZddlmZddlmZGdddeZdS))EUCKRDistributionAnalysis)CodingStateMachine)MultiByteCharSetProber)CP949_SM_MODELcs4eZdZfddZeddZeddZZS) CP949Probercs,tt|jtt|_t|_|jdS)N) superr__init__rrZ coding_smrZdistribution_analyzerreset)self) __class__!/usr/lib/python3.6/cp949prober.pyr#s zCP949Prober.__init__cCsdS)NZCP949r )r r r r charset_name+szCP949Prober.charset_namecCsdS)NZKoreanr )r r r r language/szCP949Prober.language)__name__ __module__ __qualname__rpropertyrr __classcell__r r )r r r"s  rN) ZchardistributionrZcodingstatemachinerZmbcharsetproberrZmbcssmrrr r r r s    chardet/__pycache__/langbulgarianmodel.cpython-36.opt-1.pyc000064400000060341152347724720017623 0ustar003 Pf'2@s4dZdZdZeedddddZeedddddZdS)MZcdHmkeOQfL^Rnl[JwT`osAEFB?Dpg\h_VWGtU]aqi- #+%,7/(;!.&$)'"3015269=C<8    K4*>:bxN@SyuXzYjIPvrg! _B?Fz ISO-8859-5Z Bulgairan)Zchar_to_order_mapZprecedence_matrixZtypical_positive_ratioZkeep_english_letterZ charset_nameZlanguagez windows-1251Z BulgarianN(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr(r/r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8rrrrrr>r?r@rArBrCrDrErrFrGrHrIrJrKrLrMrrrrrrrWrNrOrPrQrRrSrTrUrrVrXrYrZrrrr[r\r]r_r`r^r|r~rrrrrrrrrrrrrrrrrarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{rr}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)ZLatin5_BulgarianCharToOrderMapZwin1251BulgarianCharToOrderMapZBulgarianLangModelZLatin5BulgarianModelZWin1251BulgarianModelrr(/usr/lib/python3.6/langbulgarianmodel.py&sV chardet/__pycache__/euctwfreq.cpython-36.opt-1.pyc000064400000152605152347724720016006 0ustar003 Pf{@sdZdZdZdS(g?i R n! L,As L S  .Ni:?=NKl    o$ i c8z|t " e @\ FM QHPvf DT FN E O/s3<2 &LO GM ? `F *g Z : K  `g  q~P  !u* ~eG^ UCB jo/O2 [ & S( p]6i ' 8+% [\X (  0 H "!+ 1" OG f129l, }h #q QM& X# jM % $' N i 7J!M) PU  %   I3  r  m$x   %& &''. H $#D&A UG Q PS'd 0F* J UI R <S :7   9} VPT )C& )m 4 n *O  + ( U (5Yj lu) *+V = 4!T, xe J Ps 5AV /k l! A` A   M W  t +}j 8 - )m W   a P K , 7' u {k  9 1b o X ,Q   X 5Dl[ Y %. Y * R  pncg+'2{l m : f |5 Z  , ;IY[ X" ~,k-D>],vLBi& GB ! u  av S }; D=0 \ ( v .9H] E!/  -Q*./0 3" *RW/b. R ) 2 Z T w  [ O `7x ^ \ gn  _~0 ay ]   ; - L /`#"0 sds Y  kwo  12gp QU v CS^ 5B_ bNX Lc Kw * aG3 16 26 N  3:\q- 3 x r4 _ U @5   /+ 6  7 Z 84C l` Y5 {$7MV 0r gV89, Z{#W 0$ 4[vcVM $- X  dW[  q 1 t  2 2:3 .2 %     6 4 |S_ ` 3;r 7YL; T\<V5   "x%;8 2E=!^w "s #<Qr$]%. & 35By '   >Y a b ( )* :6^ ( ++  x, .h/ - V  hz .<;/? 08  56 _)12 3y  ^4 ?$+\ 5_W z 60  ]  p 7 8^ < V9 6 Iw}c ^ 9@ A  :e1B  7 ;<={ (`R1 YI  6 d >e ?oqYnlCD{  _ EPU Em@:  A# N BCWTT f ;D& |  <=  V o E F  D-8 Gd  Ht Iz J K | > L: =M? HN OPFkQ9  u v RS} > : T N CU~ WG,O|O?V`  ~  w @!; W" XYRg u h x = Z< [ #= \$]HI^7O $  _%vJ !wt`ab9 &"{ 'cd8[9dZ e @ !("f #$TgK %WMhi% ` y7mLjk : > ! B)l|  zi M  mnuq v  *Nopq7.ry  f s! y O +Pj > Y Atu%  v z 2 w, 3Q x 69k &6 - RyQ9c '. o(BF? l )e z ST {/" b/`0uv1 U* /ES8Z|}F+ !~2,FP m  esC r  a3Z%- 4A i D. n   3 5J0 s  @ V/ 6WA 7o P01n aQ2p:Pb { 37E | FGX] 4}  5&8  L Y 4 B 98 H /3Z[ o :0 n\]^ I;4<=;  X 5 _ }0>p JK & F #[f >q ?r 6  j@-p9; 6yA  ' V`4 K a 6 "K  YGobfc7 s pr 8  A Q C ,  \Lu~ 9BZ Cjd0hge M} 7  D f:N; EF( <GM=wg~ t ? tm# +h[ O  B $ t  a  HQ"<  -1#u 'D  I>J% P i =a Kv   _j?E 1 k8Q l m@ b R 5 L w n4H M \ oN]  \x gE p q O r Z st Pe o ^ }zA&  n- Qi Ru B y  vwBhq<*iS"TC>) xU~zVC )qW DETFp##y Gz   SX u  =H_ RwYz{q35 {  |}S~  Z[` F ] nI   G TJKzSr\)  v 5 b j ]^ c   a:1 Ah a 6 b - H _    | * f  D  LWU  $  NR kE MS ' `sF  a} ( j ~ VB[b W b I c  {  c d  ]= e  N fg h =Xd HC iTW  9 N KEj4J Y G khO  ]PZlQ[kmnRoc SX\+ITUU l Dpq k m K V8 r@Wr CG ^  8t :  !ns " #$]t % &ru'+ ()e  } *41+  , > Xtr?  - vu{w w.xT ,  /0 1 2 GR ^Y Z  [3^  ) \ 4@v567d ] ^8&   9 yu zR{ (_<9l _ S`k [  x: ;<! $=|>d  ?e    }@AB.~aO  `b %  ; CD f " L  E;F&G  x H)cIdT e J g~Ue  fa8g bhKy  L:  *M i ctMN   f Yde* OH # #; I \@  s$ PQ RjST+UV L ! J \4W XYZ[>wkf+% $\l ]l^_g %`ag N K bcd c w e by fhghh'i mz jd i   <| O k l am n u ne & o < pqP Q j  (_rs <ER f]It=uv o k,lw'  mF` f  SJxyznL pO { A yU |}~F q  pB o p- rqq( rs   (. s) t * uTvM { t' g Zw cj+ px h   , =   u/ y yv w  z>C'{Z  a q? | "  }=A 1)? x   hS ( 'xy   _ > }P ~ N c H i j  *   h _/ <~7k T ] U b tg z | { 0  + , I  B 4s  ?C G |1 mC l i } ?  h IV ^ - . ) 2 i  A -       Q O zK [ J@ . D }/ @  @R j ~J  0 mm ~  1   dX9 UL3      $(v&b  {2    ^V 2W  W oi k X  A 4  3       HDIs   w{/ n ,      4 B P 5    |z '5 !  yV  -   " %JC x   l 6   X 7  N m  W  !   >8 "#9 j D $ % X&'E (F )x k*+ D,K-./: 0J1|   E*2 Hx 3 3; p<  45  6O 789: ;< Y =>  ?@AB = o f C D#  > E FZ E  [ $ G?  G @ HA \ L I iJ  KL] MN jQ B OPQ R ST(C UV WXYZd[cH _#0 \]n ^_k D `a b cd d^ E e f_ 7 F g-! h q; X  ij kl~mG ` nyp o>pq ra st" u|?vewxyz{@| } % sR .M? ~b @   6 I  c  2m@ N fZ  \H d J    K #   Kgh>.)n t o I q r p   zUJ 1 K t JL N(rrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@r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BrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Z EUCTW_TYPICAL_DISTRIBUTION_RATIOZEUCTW_TABLE_SIZEZEUCTW_CHAR_TO_FREQ_ORDERrr/usr/lib/python3.6/euctwfreq.py,schardet/__pycache__/escprober.cpython-36.opt-1.pyc000064400000004742152347724720015763 0ustar003 Pfn@sXddlmZddlmZddlmZmZmZddlm Z m Z m Z m Z GdddeZ dS)) CharSetProber)CodingStateMachine)LanguageFilter ProbingState MachineState) HZ_SM_MODELISO2022CN_SM_MODELISO2022JP_SM_MODELISO2022KR_SM_MODELcsVeZdZdZdfdd ZfddZeddZed d Zd d Z d dZ Z S)EscCharSetProberz This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. Ncstt|j|dg|_|jtj@rD|jjtt |jjtt |jtj @r`|jjtt |jtj @r||jjttd|_d|_d|_d|_|jdS)N) lang_filter)superr __init__ coding_smr rZCHINESE_SIMPLIFIEDappendrrrZJAPANESEr ZKOREANr active_sm_count_detected_charset_detected_language_statereset)selfr ) __class__/usr/lib/python3.6/escprober.pyr*s   zEscCharSetProber.__init__csNtt|jx"|jD]}|s qd|_|jqWt|j|_d|_d|_dS)NT) r r rractivelenrrr)rr)rrrr:s   zEscCharSetProber.resetcCs|jS)N)r)rrrr charset_nameEszEscCharSetProber.charset_namecCs|jS)N)r)rrrrlanguageIszEscCharSetProber.languagecCs|jr dSdSdS)NgGz?g)r)rrrrget_confidenceMszEscCharSetProber.get_confidencecCsx|D]}x|jD]}| s|j r&q|j|}|tjkrhd|_|jd8_|jdkrtj|_|j Sq|tj krtj |_|j |_ |j|_|j SqWqW|j S)NFr)rrZ next_staterZERRORrrZNOT_MErstateZITS_MEZFOUND_ITZget_coding_state_machinerrr)rZbyte_strcrZ coding_staterrrfeedSs"       zEscCharSetProber.feed)N) __name__ __module__ __qualname____doc__rrpropertyrrrr" __classcell__rr)rrr #s  r N)Z charsetproberrZcodingstatemachinerZenumsrrrZescsmrrr r r rrrrs  chardet/__pycache__/euckrfreq.cpython-36.opt-1.pyc000064400000056746152347724720016001 0ustar003 Pf40 @sdZdZ d2Z d1S(3 g@0 xtHa+Wuh]vwmF!p x/9t-yKOn0<4{irXXY&P^9Q"t]{7{;uz/|7.{#|}~t8_     !_*u`"|a?R! /!"=#$%&'(),'b$*+-,&U#-.'f/s0 9e[1Z:23Gy4567,ws89:~;<;}=>?o)@AB2YCD<EFGHI%JKLMNO`>P=QRST; UVWX4YZ[\]^_"P`;~Havz?b<cddefc0dgyhis0j=kl<bU Imnopqrstu6vw*]xyzZ-:b {|&'5>}~wg6%(vwEfV7BN['Sex?qf()~\)$l~C@2KzVQrf h+31 g(zA<jMg2VhJ0bYa!*KD8RB@yX:#iGk=!J=}jEjO4 v]Co lcATk3*q>+;px      l)m8D 7LBDt ! "#$%R&'()*+,,-.m ^/cEam0E1234T567no89F:G;<=>?@ABCDE$FG%pHIJKLMNOPQRS/TUVIHWXqYZ[\rs]^_` vLa.bF>jcZB6`de|f5ghiHjkl1mnopqrCstuvwxyz{|}~OEqI\-S elMQP^ -F .tJgu9  $5%kLARu):"$vcZ*WKL+ B?M[5nC'  FT/8uK(MiT?e (%0O 8        # V P  MW  | S          9D 3   {     ! kNY" # $ % & ' ( ]) * + , - . / >1 \2 3 4 5 6 w7 8 39 : L ; <  = J> ? @ A B C D E F G H I J K L M N IO P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g Ux h i j 4&!Sy " #k l m n pQ.o UOp q r s xt u v w $x y `z { | } ~  C%yo     @ G 2 N  r znP # &Q m c ' w (l@)*    H    r A  },: I N1 W + 1b q , e_d 2   -     7   ,G ^ . g   _ hh{ |3   \        j i4          6d/  o R & knz  XdS} }~ ! N" # s$ % & fD1' ( @) ^* + , - . / J+0 1 2 T3 4 5 6 7 A.8 9 ": ; < = > 0? @ A B C D E F G _[H I `aJ K L M N O iP Q R N(0 rrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfr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rhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 )Z EUCKR_TYPICAL_DISTRIBUTION_RATIOZEUCKR_TABLE_SIZEZEUCKR_CHAR_TO_FREQ_ORDERr1 r1 /usr/lib/python3.6/euckrfreq.py)s(chardet/__pycache__/euctwfreq.cpython-36.pyc000064400000152605152347724720015047 0ustar003 Pf{@sdZdZdZdS(g?i R n! L,As L S  .Ni:?=NKl    o$ i c8z|t " e @\ FM QHPvf DT FN E O/s3<2 &LO GM ? `F *g Z : K  `g  q~P  !u* ~eG^ UCB jo/O2 [ & S( p]6i ' 8+% [\X (  0 H "!+ 1" OG f129l, }h #q QM& X# jM % $' N i 7J!M) PU  %   I3  r  m$x   %& &''. H $#D&A UG Q PS'd 0F* J UI R <S :7   9} VPT )C& )m 4 n *O  + ( U (5Yj lu) *+V = 4!T, xe J Ps 5AV /k l! A` A   M W  t +}j 8 - )m W   a P K , 7' u {k  9 1b o X ,Q   X 5Dl[ Y %. Y * R  pncg+'2{l m : f |5 Z  , ;IY[ X" ~,k-D>],vLBi& GB ! u  av S }; D=0 \ ( v .9H] E!/  -Q*./0 3" *RW/b. R ) 2 Z T w  [ O `7x ^ \ gn  _~0 ay ]   ; - L /`#"0 sds Y  kwo  12gp QU v CS^ 5B_ bNX Lc Kw * aG3 16 26 N  3:\q- 3 x r4 _ U @5   /+ 6  7 Z 84C l` Y5 {$7MV 0r gV89, Z{#W 0$ 4[vcVM $- X  dW[  q 1 t  2 2:3 .2 %     6 4 |S_ ` 3;r 7YL; T\<V5   "x%;8 2E=!^w "s #<Qr$]%. & 35By '   >Y a b ( )* :6^ ( ++  x, .h/ - V  hz .<;/? 08  56 _)12 3y  ^4 ?$+\ 5_W z 60  ]  p 7 8^ < V9 6 Iw}c ^ 9@ A  :e1B  7 ;<={ (`R1 YI  6 d >e ?oqYnlCD{  _ EPU Em@:  A# N BCWTT f ;D& |  <=  V o E F  D-8 Gd  Ht Iz J K | > L: =M? HN OPFkQ9  u v RS} > : T N CU~ WG,O|O?V`  ~  w @!; W" XYRg u h x = Z< [ #= \$]HI^7O $  _%vJ !wt`ab9 &"{ 'cd8[9dZ e @ !("f #$TgK %WMhi% ` y7mLjk : > ! B)l|  zi M  mnuq v  *Nopq7.ry  f s! y O +Pj > Y Atu%  v z 2 w, 3Q x 69k &6 - RyQ9c '. o(BF? l )e z ST {/" b/`0uv1 U* /ES8Z|}F+ !~2,FP m  esC r  a3Z%- 4A i D. n   3 5J0 s  @ V/ 6WA 7o P01n aQ2p:Pb { 37E | FGX] 4}  5&8  L Y 4 B 98 H /3Z[ o :0 n\]^ I;4<=;  X 5 _ }0>p JK & F #[f >q ?r 6  j@-p9; 6yA  ' V`4 K a 6 "K  YGobfc7 s pr 8  A Q C ,  \Lu~ 9BZ Cjd0hge M} 7  D f:N; EF( <GM=wg~ t ? tm# +h[ O  B $ t  a  HQ"<  -1#u 'D  I>J% P i =a Kv   _j?E 1 k8Q l m@ b R 5 L w n4H M \ oN]  \x gE p q O r Z st Pe o ^ }zA&  n- Qi Ru B y  vwBhq<*iS"TC>) xU~zVC )qW DETFp##y Gz   SX u  =H_ RwYz{q35 {  |}S~  Z[` F ] nI   G TJKzSr\)  v 5 b j ]^ c   a:1 Ah a 6 b - H _    | * f  D  LWU  $  NR kE MS ' `sF  a} ( j ~ VB[b W b I c  {  c d  ]= e  N fg h =Xd HC iTW  9 N KEj4J Y G khO  ]PZlQ[kmnRoc SX\+ITUU l Dpq k m K V8 r@Wr CG ^  8t :  !ns " #$]t % &ru'+ ()e  } *41+  , > Xtr?  - vu{w w.xT ,  /0 1 2 GR ^Y Z  [3^  ) \ 4@v567d ] ^8&   9 yu zR{ (_<9l _ S`k [  x: ;<! $=|>d  ?e    }@AB.~aO  `b %  ; CD f " L  E;F&G  x H)cIdT e J g~Ue  fa8g bhKy  L:  *M i ctMN   f Yde* OH # #; I \@  s$ PQ RjST+UV L ! J \4W XYZ[>wkf+% $\l ]l^_g %`ag N K bcd c w e by fhghh'i mz jd i   <| O k l am n u ne & o < pqP Q j  (_rs <ER f]It=uv o k,lw'  mF` f  SJxyznL pO { A yU |}~F q  pB o p- rqq( rs   (. s) t * uTvM { t' g Zw cj+ px h   , =   u/ y yv w  z>C'{Z  a q? | "  }=A 1)? x   hS ( 'xy   _ > }P ~ N c H i j  *   h _/ <~7k T ] U b tg z | { 0  + , I  B 4s  ?C G |1 mC l i } ?  h IV ^ - . ) 2 i  A -       Q O zK [ J@ . D }/ @  @R j ~J  0 mm ~  1   dX9 UL3      $(v&b  {2    ^V 2W  W oi k X  A 4  3       HDIs   w{/ n ,      4 B P 5    |z '5 !  yV  -   " %JC x   l 6   X 7  N m  W  !   >8 "#9 j D $ % X&'E (F )x k*+ D,K-./: 0J1|   E*2 Hx 3 3; p<  45  6O 789: ;< Y =>  ?@AB = o f C D#  > E FZ E  [ $ G?  G @ HA \ L I iJ  KL] MN jQ B OPQ R ST(C UV WXYZd[cH _#0 \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rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r! r" r# r$ r% r& r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; r< r= r> r? r@ rA rB rC rD rE rF rG rH rI rJ rK rL rM rN rO rP rQ rR rS rT rU rV rW rX rY rZ r[ r\ r] r^ r_ r` ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz r{ r| r} r~ r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r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2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)Z EUCTW_TYPICAL_DISTRIBUTION_RATIOZEUCTW_TABLE_SIZEZEUCTW_CHAR_TO_FREQ_ORDERrr/usr/lib/python3.6/euctwfreq.py,schardet/mbcsgroupprober.py000064400000003734152347724720011767 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # Proofpoint, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetgroupprober import CharSetGroupProber from .utf8prober import UTF8Prober from .sjisprober import SJISProber from .eucjpprober import EUCJPProber from .gb2312prober import GB2312Prober from .euckrprober import EUCKRProber from .cp949prober import CP949Prober from .big5prober import Big5Prober from .euctwprober import EUCTWProber class MBCSGroupProber(CharSetGroupProber): def __init__(self, lang_filter=None): super(MBCSGroupProber, self).__init__(lang_filter=lang_filter) self.probers = [ UTF8Prober(), SJISProber(), EUCJPProber(), GB2312Prober(), EUCKRProber(), CP949Prober(), Big5Prober(), EUCTWProber() ] self.reset() chardet/chardistribution.py000064400000022303152347724720012122 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .euctwfreq import (EUCTW_CHAR_TO_FREQ_ORDER, EUCTW_TABLE_SIZE, EUCTW_TYPICAL_DISTRIBUTION_RATIO) from .euckrfreq import (EUCKR_CHAR_TO_FREQ_ORDER, EUCKR_TABLE_SIZE, EUCKR_TYPICAL_DISTRIBUTION_RATIO) from .gb2312freq import (GB2312_CHAR_TO_FREQ_ORDER, GB2312_TABLE_SIZE, GB2312_TYPICAL_DISTRIBUTION_RATIO) from .big5freq import (BIG5_CHAR_TO_FREQ_ORDER, BIG5_TABLE_SIZE, BIG5_TYPICAL_DISTRIBUTION_RATIO) from .jisfreq import (JIS_CHAR_TO_FREQ_ORDER, JIS_TABLE_SIZE, JIS_TYPICAL_DISTRIBUTION_RATIO) class CharDistributionAnalysis(object): ENOUGH_DATA_THRESHOLD = 1024 SURE_YES = 0.99 SURE_NO = 0.01 MINIMUM_DATA_THRESHOLD = 3 def __init__(self): # Mapping table to get frequency order from char order (get from # GetOrder()) self._char_to_freq_order = None self._table_size = None # Size of above table # This is a constant value which varies from language to language, # used in calculating confidence. See # http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html # for further detail. self.typical_distribution_ratio = None self._done = None self._total_chars = None self._freq_chars = None self.reset() def reset(self): """reset analyser, clear any state""" # If this flag is set to True, detection is done and conclusion has # been made self._done = False self._total_chars = 0 # Total characters encountered # The number of characters whose frequency order is less than 512 self._freq_chars = 0 def feed(self, char, char_len): """feed a character with known length""" if char_len == 2: # we only care about 2-bytes character in our distribution analysis order = self.get_order(char) else: order = -1 if order >= 0: self._total_chars += 1 # order is valid if order < self._table_size: if 512 > self._char_to_freq_order[order]: self._freq_chars += 1 def get_confidence(self): """return confidence based on existing data""" # if we didn't receive any character in our consideration range, # return negative answer if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD: return self.SURE_NO if self._total_chars != self._freq_chars: r = (self._freq_chars / ((self._total_chars - self._freq_chars) * self.typical_distribution_ratio)) if r < self.SURE_YES: return r # normalize confidence (we don't want to be 100% sure) return self.SURE_YES def got_enough_data(self): # It is not necessary to receive all data to draw conclusion. # For charset detection, certain amount of data is enough return self._total_chars > self.ENOUGH_DATA_THRESHOLD def get_order(self, byte_str): # We do not handle characters based on the original encoding string, # but convert this encoding string to a number, here called order. # This allows multiple encodings of a language to share one frequency # table. return -1 class EUCTWDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(EUCTWDistributionAnalysis, self).__init__() self._char_to_freq_order = EUCTW_CHAR_TO_FREQ_ORDER self._table_size = EUCTW_TABLE_SIZE self.typical_distribution_ratio = EUCTW_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for euc-TW encoding, we are interested # first byte range: 0xc4 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char = byte_str[0] if first_char >= 0xC4: return 94 * (first_char - 0xC4) + byte_str[1] - 0xA1 else: return -1 class EUCKRDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(EUCKRDistributionAnalysis, self).__init__() self._char_to_freq_order = EUCKR_CHAR_TO_FREQ_ORDER self._table_size = EUCKR_TABLE_SIZE self.typical_distribution_ratio = EUCKR_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for euc-KR encoding, we are interested # first byte range: 0xb0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char = byte_str[0] if first_char >= 0xB0: return 94 * (first_char - 0xB0) + byte_str[1] - 0xA1 else: return -1 class GB2312DistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(GB2312DistributionAnalysis, self).__init__() self._char_to_freq_order = GB2312_CHAR_TO_FREQ_ORDER self._table_size = GB2312_TABLE_SIZE self.typical_distribution_ratio = GB2312_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for GB2312 encoding, we are interested # first byte range: 0xb0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char, second_char = byte_str[0], byte_str[1] if (first_char >= 0xB0) and (second_char >= 0xA1): return 94 * (first_char - 0xB0) + second_char - 0xA1 else: return -1 class Big5DistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(Big5DistributionAnalysis, self).__init__() self._char_to_freq_order = BIG5_CHAR_TO_FREQ_ORDER self._table_size = BIG5_TABLE_SIZE self.typical_distribution_ratio = BIG5_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for big5 encoding, we are interested # first byte range: 0xa4 -- 0xfe # second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char, second_char = byte_str[0], byte_str[1] if first_char >= 0xA4: if second_char >= 0xA1: return 157 * (first_char - 0xA4) + second_char - 0xA1 + 63 else: return 157 * (first_char - 0xA4) + second_char - 0x40 else: return -1 class SJISDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(SJISDistributionAnalysis, self).__init__() self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER self._table_size = JIS_TABLE_SIZE self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for sjis encoding, we are interested # first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe # second byte range: 0x40 -- 0x7e, 0x81 -- oxfe # no validation needed here. State machine has done that first_char, second_char = byte_str[0], byte_str[1] if (first_char >= 0x81) and (first_char <= 0x9F): order = 188 * (first_char - 0x81) elif (first_char >= 0xE0) and (first_char <= 0xEF): order = 188 * (first_char - 0xE0 + 31) else: return -1 order = order + second_char - 0x40 if second_char > 0x7F: order = -1 return order class EUCJPDistributionAnalysis(CharDistributionAnalysis): def __init__(self): super(EUCJPDistributionAnalysis, self).__init__() self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER self._table_size = JIS_TABLE_SIZE self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO def get_order(self, byte_str): # for euc-JP encoding, we are interested # first byte range: 0xa0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that char = byte_str[0] if char >= 0xA0: return 94 * (char - 0xA1) + byte_str[1] - 0xa1 else: return -1 chardet/gb2312prober.py000064400000003332152347724720010660 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import GB2312DistributionAnalysis from .mbcssm import GB2312_SM_MODEL class GB2312Prober(MultiByteCharSetProber): def __init__(self): super(GB2312Prober, self).__init__() self.coding_sm = CodingStateMachine(GB2312_SM_MODEL) self.distribution_analyzer = GB2312DistributionAnalysis() self.reset() @property def charset_name(self): return "GB2312" @property def language(self): return "Chinese" chardet/langhungarianmodel.py000064400000030460152347724720012407 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: Latin2_HungarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, 46, 71, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, 253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174, 175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190, 191,192,193,194,195,196,197, 75,198,199,200,201,202,203,204,205, 79,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, 221, 51, 81,222, 78,223,224,225,226, 44,227,228,229, 61,230,231, 232,233,234, 58,235, 66, 59,236,237,238, 60, 69, 63,239,240,241, 82, 14, 74,242, 70, 80,243, 72,244, 15, 83, 77, 84, 30, 76, 85, 245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253, ) win1250HungarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, 46, 72, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, 253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, 161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176, 177,178,179,180, 78,181, 69,182,183,184,185,186,187,188,189,190, 191,192,193,194,195,196,197, 76,198,199,200,201,202,203,204,205, 81,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, 221, 51, 83,222, 80,223,224,225,226, 44,227,228,229, 61,230,231, 232,233,234, 58,235, 66, 59,236,237,238, 60, 70, 63,239,240,241, 84, 14, 75,242, 71, 82,243, 73,244, 15, 85, 79, 86, 30, 77, 87, 245,246,247, 25, 74, 42, 24,248,249,250, 31, 56, 29,251,252,253, ) # Model Table: # total sequences: 100% # first 512 sequences: 94.7368% # first 1024 sequences:5.2623% # rest sequences: 0.8894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,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, ) Latin2HungarianModel = { 'char_to_order_map': Latin2_HungarianCharToOrderMap, 'precedence_matrix': HungarianLangModel, 'typical_positive_ratio': 0.947368, 'keep_english_letter': True, 'charset_name': "ISO-8859-2", 'language': 'Hungarian', } Win1250HungarianModel = { 'char_to_order_map': win1250HungarianCharToOrderMap, 'precedence_matrix': HungarianLangModel, 'typical_positive_ratio': 0.947368, 'keep_english_letter': True, 'charset_name': "windows-1250", 'language': 'Hungarian', } chardet/eucjpprober.py000064400000007245152347724720011075 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import ProbingState, MachineState from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCJPDistributionAnalysis from .jpcntx import EUCJPContextAnalysis from .mbcssm import EUCJP_SM_MODEL class EUCJPProber(MultiByteCharSetProber): def __init__(self): super(EUCJPProber, self).__init__() self.coding_sm = CodingStateMachine(EUCJP_SM_MODEL) self.distribution_analyzer = EUCJPDistributionAnalysis() self.context_analyzer = EUCJPContextAnalysis() self.reset() def reset(self): super(EUCJPProber, self).reset() self.context_analyzer.reset() @property def charset_name(self): return "EUC-JP" @property def language(self): return "Japanese" def feed(self, byte_str): for i in range(len(byte_str)): # PY3K: byte_str is a byte array, so byte_str[i] is an int, not a byte coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: self.logger.debug('%s %s prober hit error at byte %s', self.charset_name, self.language, i) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] self.context_analyzer.feed(self._last_char, char_len) self.distribution_analyzer.feed(self._last_char, char_len) else: self.context_analyzer.feed(byte_str[i - 1:i + 1], char_len) self.distribution_analyzer.feed(byte_str[i - 1:i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: if (self.context_analyzer.got_enough_data() and (self.get_confidence() > self.SHORTCUT_THRESHOLD)): self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): context_conf = self.context_analyzer.get_confidence() distrib_conf = self.distribution_analyzer.get_confidence() return max(context_conf, distrib_conf) chardet/euctwprober.py000064400000003323152347724720011107 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCTWDistributionAnalysis from .mbcssm import EUCTW_SM_MODEL class EUCTWProber(MultiByteCharSetProber): def __init__(self): super(EUCTWProber, self).__init__() self.coding_sm = CodingStateMachine(EUCTW_SM_MODEL) self.distribution_analyzer = EUCTWDistributionAnalysis() self.reset() @property def charset_name(self): return "EUC-TW" @property def language(self): return "Taiwan" chardet/cp949prober.py000064400000003477152347724720010642 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .chardistribution import EUCKRDistributionAnalysis from .codingstatemachine import CodingStateMachine from .mbcharsetprober import MultiByteCharSetProber from .mbcssm import CP949_SM_MODEL class CP949Prober(MultiByteCharSetProber): def __init__(self): super(CP949Prober, self).__init__() self.coding_sm = CodingStateMachine(CP949_SM_MODEL) # NOTE: CP949 is a superset of EUC-KR, so the distribution should be # not different. self.distribution_analyzer = EUCKRDistributionAnalysis() self.reset() @property def charset_name(self): return "CP949" @property def language(self): return "Korean" chardet/utf8prober.py000064400000005316152347724720010652 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState, MachineState from .codingstatemachine import CodingStateMachine from .mbcssm import UTF8_SM_MODEL class UTF8Prober(CharSetProber): ONE_CHAR_PROB = 0.5 def __init__(self): super(UTF8Prober, self).__init__() self.coding_sm = CodingStateMachine(UTF8_SM_MODEL) self._num_mb_chars = None self.reset() def reset(self): super(UTF8Prober, self).reset() self.coding_sm.reset() self._num_mb_chars = 0 @property def charset_name(self): return "utf-8" @property def language(self): return "" def feed(self, byte_str): for c in byte_str: coding_state = self.coding_sm.next_state(c) if coding_state == MachineState.ERROR: self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: if self.coding_sm.get_current_charlen() >= 2: self._num_mb_chars += 1 if self.state == ProbingState.DETECTING: if self.get_confidence() > self.SHORTCUT_THRESHOLD: self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): unlike = 0.99 if self._num_mb_chars < 6: unlike *= self.ONE_CHAR_PROB ** self._num_mb_chars return 1.0 - unlike else: return unlike chardet/big5prober.py000064400000003335152347724720010611 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import Big5DistributionAnalysis from .mbcssm import BIG5_SM_MODEL class Big5Prober(MultiByteCharSetProber): def __init__(self): super(Big5Prober, self).__init__() self.coding_sm = CodingStateMachine(BIG5_SM_MODEL) self.distribution_analyzer = Big5DistributionAnalysis() self.reset() @property def charset_name(self): return "Big5" @property def language(self): return "Chinese" chardet/mbcssm.py000064400000061611152347724720010036 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import MachineState # BIG5 BIG5_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as legal value 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,1, # 78 - 7f 4,4,4,4,4,4,4,4, # 80 - 87 4,4,4,4,4,4,4,4, # 88 - 8f 4,4,4,4,4,4,4,4, # 90 - 97 4,4,4,4,4,4,4,4, # 98 - 9f 4,3,3,3,3,3,3,3, # a0 - a7 3,3,3,3,3,3,3,3, # a8 - af 3,3,3,3,3,3,3,3, # b0 - b7 3,3,3,3,3,3,3,3, # b8 - bf 3,3,3,3,3,3,3,3, # c0 - c7 3,3,3,3,3,3,3,3, # c8 - cf 3,3,3,3,3,3,3,3, # d0 - d7 3,3,3,3,3,3,3,3, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,3,3,3, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,3,3,0 # f8 - ff ) BIG5_ST = ( MachineState.ERROR,MachineState.START,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,#08-0f MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START#10-17 ) BIG5_CHAR_LEN_TABLE = (0, 1, 1, 2, 0) BIG5_SM_MODEL = {'class_table': BIG5_CLS, 'class_factor': 5, 'state_table': BIG5_ST, 'char_len_table': BIG5_CHAR_LEN_TABLE, 'name': 'Big5'} # CP949 CP949_CLS = ( 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,0,0, # 00 - 0f 1,1,1,1,1,1,1,1, 1,1,1,0,1,1,1,1, # 10 - 1f 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 20 - 2f 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 30 - 3f 1,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4, # 40 - 4f 4,4,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 50 - 5f 1,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5, # 60 - 6f 5,5,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 70 - 7f 0,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 80 - 8f 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 90 - 9f 6,7,7,7,7,7,7,7, 7,7,7,7,7,8,8,8, # a0 - af 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, # b0 - bf 7,7,7,7,7,7,9,2, 2,3,2,2,2,2,2,2, # c0 - cf 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # d0 - df 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # e0 - ef 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,0, # f0 - ff ) CP949_ST = ( #cls= 0 1 2 3 4 5 6 7 8 9 # previous state = MachineState.ERROR,MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START, 4, 5,MachineState.ERROR, 6, # MachineState.START MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, # MachineState.ERROR MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME, # MachineState.ITS_ME MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START, # 3 MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, # 4 MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, # 5 MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START, # 6 ) CP949_CHAR_LEN_TABLE = (0, 1, 2, 0, 1, 1, 2, 2, 0, 2) CP949_SM_MODEL = {'class_table': CP949_CLS, 'class_factor': 10, 'state_table': CP949_ST, 'char_len_table': CP949_CHAR_LEN_TABLE, 'name': 'CP949'} # EUC-JP EUCJP_CLS = ( 4,4,4,4,4,4,4,4, # 00 - 07 4,4,4,4,4,4,5,5, # 08 - 0f 4,4,4,4,4,4,4,4, # 10 - 17 4,4,4,5,4,4,4,4, # 18 - 1f 4,4,4,4,4,4,4,4, # 20 - 27 4,4,4,4,4,4,4,4, # 28 - 2f 4,4,4,4,4,4,4,4, # 30 - 37 4,4,4,4,4,4,4,4, # 38 - 3f 4,4,4,4,4,4,4,4, # 40 - 47 4,4,4,4,4,4,4,4, # 48 - 4f 4,4,4,4,4,4,4,4, # 50 - 57 4,4,4,4,4,4,4,4, # 58 - 5f 4,4,4,4,4,4,4,4, # 60 - 67 4,4,4,4,4,4,4,4, # 68 - 6f 4,4,4,4,4,4,4,4, # 70 - 77 4,4,4,4,4,4,4,4, # 78 - 7f 5,5,5,5,5,5,5,5, # 80 - 87 5,5,5,5,5,5,1,3, # 88 - 8f 5,5,5,5,5,5,5,5, # 90 - 97 5,5,5,5,5,5,5,5, # 98 - 9f 5,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,0,5 # f8 - ff ) EUCJP_ST = ( 3, 4, 3, 5,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.START,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#10-17 MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 3,MachineState.ERROR,#18-1f 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START#20-27 ) EUCJP_CHAR_LEN_TABLE = (2, 2, 2, 3, 1, 0) EUCJP_SM_MODEL = {'class_table': EUCJP_CLS, 'class_factor': 6, 'state_table': EUCJP_ST, 'char_len_table': EUCJP_CHAR_LEN_TABLE, 'name': 'EUC-JP'} # EUC-KR EUCKR_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 1,1,1,1,1,1,1,1, # 40 - 47 1,1,1,1,1,1,1,1, # 48 - 4f 1,1,1,1,1,1,1,1, # 50 - 57 1,1,1,1,1,1,1,1, # 58 - 5f 1,1,1,1,1,1,1,1, # 60 - 67 1,1,1,1,1,1,1,1, # 68 - 6f 1,1,1,1,1,1,1,1, # 70 - 77 1,1,1,1,1,1,1,1, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,3,3,3, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,3,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,0 # f8 - ff ) EUCKR_ST = ( MachineState.ERROR,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START #08-0f ) EUCKR_CHAR_LEN_TABLE = (0, 1, 2, 0) EUCKR_SM_MODEL = {'class_table': EUCKR_CLS, 'class_factor': 4, 'state_table': EUCKR_ST, 'char_len_table': EUCKR_CHAR_LEN_TABLE, 'name': 'EUC-KR'} # EUC-TW EUCTW_CLS = ( 2,2,2,2,2,2,2,2, # 00 - 07 2,2,2,2,2,2,0,0, # 08 - 0f 2,2,2,2,2,2,2,2, # 10 - 17 2,2,2,0,2,2,2,2, # 18 - 1f 2,2,2,2,2,2,2,2, # 20 - 27 2,2,2,2,2,2,2,2, # 28 - 2f 2,2,2,2,2,2,2,2, # 30 - 37 2,2,2,2,2,2,2,2, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,2, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,6,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,3,4,4,4,4,4,4, # a0 - a7 5,5,1,1,1,1,1,1, # a8 - af 1,1,1,1,1,1,1,1, # b0 - b7 1,1,1,1,1,1,1,1, # b8 - bf 1,1,3,1,3,3,3,3, # c0 - c7 3,3,3,3,3,3,3,3, # c8 - cf 3,3,3,3,3,3,3,3, # d0 - d7 3,3,3,3,3,3,3,3, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,3,3,3, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,3,3,0 # f8 - ff ) EUCTW_ST = ( MachineState.ERROR,MachineState.ERROR,MachineState.START, 3, 3, 3, 4,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,MachineState.ERROR,#10-17 MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.START,MachineState.START,#20-27 MachineState.START,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START #28-2f ) EUCTW_CHAR_LEN_TABLE = (0, 0, 1, 2, 2, 2, 3) EUCTW_SM_MODEL = {'class_table': EUCTW_CLS, 'class_factor': 7, 'state_table': EUCTW_ST, 'char_len_table': EUCTW_CHAR_LEN_TABLE, 'name': 'x-euc-tw'} # GB2312 GB2312_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 3,3,3,3,3,3,3,3, # 30 - 37 3,3,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,4, # 78 - 7f 5,6,6,6,6,6,6,6, # 80 - 87 6,6,6,6,6,6,6,6, # 88 - 8f 6,6,6,6,6,6,6,6, # 90 - 97 6,6,6,6,6,6,6,6, # 98 - 9f 6,6,6,6,6,6,6,6, # a0 - a7 6,6,6,6,6,6,6,6, # a8 - af 6,6,6,6,6,6,6,6, # b0 - b7 6,6,6,6,6,6,6,6, # b8 - bf 6,6,6,6,6,6,6,6, # c0 - c7 6,6,6,6,6,6,6,6, # c8 - cf 6,6,6,6,6,6,6,6, # d0 - d7 6,6,6,6,6,6,6,6, # d8 - df 6,6,6,6,6,6,6,6, # e0 - e7 6,6,6,6,6,6,6,6, # e8 - ef 6,6,6,6,6,6,6,6, # f0 - f7 6,6,6,6,6,6,6,0 # f8 - ff ) GB2312_ST = ( MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, 3,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,#10-17 4,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f MachineState.ERROR,MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,#20-27 MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START #28-2f ) # To be accurate, the length of class 6 can be either 2 or 4. # But it is not necessary to discriminate between the two since # it is used for frequency analysis only, and we are validating # each code range there as well. So it is safe to set it to be # 2 here. GB2312_CHAR_LEN_TABLE = (0, 1, 1, 1, 1, 1, 2) GB2312_SM_MODEL = {'class_table': GB2312_CLS, 'class_factor': 7, 'state_table': GB2312_ST, 'char_len_table': GB2312_CHAR_LEN_TABLE, 'name': 'GB2312'} # Shift_JIS SJIS_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 2,2,2,2,2,2,2,2, # 40 - 47 2,2,2,2,2,2,2,2, # 48 - 4f 2,2,2,2,2,2,2,2, # 50 - 57 2,2,2,2,2,2,2,2, # 58 - 5f 2,2,2,2,2,2,2,2, # 60 - 67 2,2,2,2,2,2,2,2, # 68 - 6f 2,2,2,2,2,2,2,2, # 70 - 77 2,2,2,2,2,2,2,1, # 78 - 7f 3,3,3,3,3,2,2,3, # 80 - 87 3,3,3,3,3,3,3,3, # 88 - 8f 3,3,3,3,3,3,3,3, # 90 - 97 3,3,3,3,3,3,3,3, # 98 - 9f #0xa0 is illegal in sjis encoding, but some pages does #contain such byte. We need to be more error forgiven. 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 3,3,3,3,3,3,3,3, # e0 - e7 3,3,3,3,3,4,4,4, # e8 - ef 3,3,3,3,3,3,3,3, # f0 - f7 3,3,3,3,3,0,0,0) # f8 - ff SJIS_ST = ( MachineState.ERROR,MachineState.START,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START #10-17 ) SJIS_CHAR_LEN_TABLE = (0, 1, 1, 2, 0, 0) SJIS_SM_MODEL = {'class_table': SJIS_CLS, 'class_factor': 6, 'state_table': SJIS_ST, 'char_len_table': SJIS_CHAR_LEN_TABLE, 'name': 'Shift_JIS'} # UCS2-BE UCS2BE_CLS = ( 0,0,0,0,0,0,0,0, # 00 - 07 0,0,1,0,0,2,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,3,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,3,3,3,3,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,0,0,0,0,0,0,0, # a0 - a7 0,0,0,0,0,0,0,0, # a8 - af 0,0,0,0,0,0,0,0, # b0 - b7 0,0,0,0,0,0,0,0, # b8 - bf 0,0,0,0,0,0,0,0, # c0 - c7 0,0,0,0,0,0,0,0, # c8 - cf 0,0,0,0,0,0,0,0, # d0 - d7 0,0,0,0,0,0,0,0, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,4,5 # f8 - ff ) UCS2BE_ST = ( 5, 7, 7,MachineState.ERROR, 4, 3,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME, 6, 6, 6, 6,MachineState.ERROR,MachineState.ERROR,#10-17 6, 6, 6, 6, 6,MachineState.ITS_ME, 6, 6,#18-1f 6, 6, 6, 6, 5, 7, 7,MachineState.ERROR,#20-27 5, 8, 6, 6,MachineState.ERROR, 6, 6, 6,#28-2f 6, 6, 6, 6,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START #30-37 ) UCS2BE_CHAR_LEN_TABLE = (2, 2, 2, 0, 2, 2) UCS2BE_SM_MODEL = {'class_table': UCS2BE_CLS, 'class_factor': 6, 'state_table': UCS2BE_ST, 'char_len_table': UCS2BE_CHAR_LEN_TABLE, 'name': 'UTF-16BE'} # UCS2-LE UCS2LE_CLS = ( 0,0,0,0,0,0,0,0, # 00 - 07 0,0,1,0,0,2,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,3,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,3,3,3,3,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 0,0,0,0,0,0,0,0, # 80 - 87 0,0,0,0,0,0,0,0, # 88 - 8f 0,0,0,0,0,0,0,0, # 90 - 97 0,0,0,0,0,0,0,0, # 98 - 9f 0,0,0,0,0,0,0,0, # a0 - a7 0,0,0,0,0,0,0,0, # a8 - af 0,0,0,0,0,0,0,0, # b0 - b7 0,0,0,0,0,0,0,0, # b8 - bf 0,0,0,0,0,0,0,0, # c0 - c7 0,0,0,0,0,0,0,0, # c8 - cf 0,0,0,0,0,0,0,0, # d0 - d7 0,0,0,0,0,0,0,0, # d8 - df 0,0,0,0,0,0,0,0, # e0 - e7 0,0,0,0,0,0,0,0, # e8 - ef 0,0,0,0,0,0,0,0, # f0 - f7 0,0,0,0,0,0,4,5 # f8 - ff ) UCS2LE_ST = ( 6, 6, 7, 6, 4, 3,MachineState.ERROR,MachineState.ERROR,#00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f MachineState.ITS_ME,MachineState.ITS_ME, 5, 5, 5,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,#10-17 5, 5, 5,MachineState.ERROR, 5,MachineState.ERROR, 6, 6,#18-1f 7, 6, 8, 8, 5, 5, 5,MachineState.ERROR,#20-27 5, 5, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5, 5,#28-2f 5, 5, 5,MachineState.ERROR, 5,MachineState.ERROR,MachineState.START,MachineState.START #30-37 ) UCS2LE_CHAR_LEN_TABLE = (2, 2, 2, 2, 2, 2) UCS2LE_SM_MODEL = {'class_table': UCS2LE_CLS, 'class_factor': 6, 'state_table': UCS2LE_ST, 'char_len_table': UCS2LE_CHAR_LEN_TABLE, 'name': 'UTF-16LE'} # UTF-8 UTF8_CLS = ( 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as a legal value 1,1,1,1,1,1,0,0, # 08 - 0f 1,1,1,1,1,1,1,1, # 10 - 17 1,1,1,0,1,1,1,1, # 18 - 1f 1,1,1,1,1,1,1,1, # 20 - 27 1,1,1,1,1,1,1,1, # 28 - 2f 1,1,1,1,1,1,1,1, # 30 - 37 1,1,1,1,1,1,1,1, # 38 - 3f 1,1,1,1,1,1,1,1, # 40 - 47 1,1,1,1,1,1,1,1, # 48 - 4f 1,1,1,1,1,1,1,1, # 50 - 57 1,1,1,1,1,1,1,1, # 58 - 5f 1,1,1,1,1,1,1,1, # 60 - 67 1,1,1,1,1,1,1,1, # 68 - 6f 1,1,1,1,1,1,1,1, # 70 - 77 1,1,1,1,1,1,1,1, # 78 - 7f 2,2,2,2,3,3,3,3, # 80 - 87 4,4,4,4,4,4,4,4, # 88 - 8f 4,4,4,4,4,4,4,4, # 90 - 97 4,4,4,4,4,4,4,4, # 98 - 9f 5,5,5,5,5,5,5,5, # a0 - a7 5,5,5,5,5,5,5,5, # a8 - af 5,5,5,5,5,5,5,5, # b0 - b7 5,5,5,5,5,5,5,5, # b8 - bf 0,0,6,6,6,6,6,6, # c0 - c7 6,6,6,6,6,6,6,6, # c8 - cf 6,6,6,6,6,6,6,6, # d0 - d7 6,6,6,6,6,6,6,6, # d8 - df 7,8,8,8,8,8,8,8, # e0 - e7 8,8,8,8,8,9,8,8, # e8 - ef 10,11,11,11,11,11,11,11, # f0 - f7 12,13,13,13,14,15,0,0 # f8 - ff ) UTF8_ST = ( MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 12, 10,#00-07 9, 11, 8, 7, 6, 5, 4, 3,#08-0f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#10-17 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#20-27 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#28-2f MachineState.ERROR,MachineState.ERROR, 5, 5, 5, 5,MachineState.ERROR,MachineState.ERROR,#30-37 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#38-3f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5, 5, 5,MachineState.ERROR,MachineState.ERROR,#40-47 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#48-4f MachineState.ERROR,MachineState.ERROR, 7, 7, 7, 7,MachineState.ERROR,MachineState.ERROR,#50-57 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#58-5f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 7, 7,MachineState.ERROR,MachineState.ERROR,#60-67 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#68-6f MachineState.ERROR,MachineState.ERROR, 9, 9, 9, 9,MachineState.ERROR,MachineState.ERROR,#70-77 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#78-7f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 9,MachineState.ERROR,MachineState.ERROR,#80-87 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#88-8f MachineState.ERROR,MachineState.ERROR, 12, 12, 12, 12,MachineState.ERROR,MachineState.ERROR,#90-97 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#98-9f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 12,MachineState.ERROR,MachineState.ERROR,#a0-a7 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#a8-af MachineState.ERROR,MachineState.ERROR, 12, 12, 12,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#b0-b7 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#b8-bf MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,#c0-c7 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR #c8-cf ) UTF8_CHAR_LEN_TABLE = (0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6) UTF8_SM_MODEL = {'class_table': UTF8_CLS, 'class_factor': 16, 'state_table': UTF8_ST, 'char_len_table': UTF8_CHAR_LEN_TABLE, 'name': 'UTF-8'} chardet/jpcntx.py000064400000046273152347724720010067 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # This is hiragana 2-char sequence table, the number in each cell represents its frequency category jp2CharContext = ( (0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,1,2,1,0,1,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,2), (0,4,0,4,0,4,0,3,0,4,4,3,4,2,4,3,2,0,4,4,4,3,5,3,5,3,3,2,4,2,4,3,4,3,1,4,0,2,3,4,4,4,3,3,3,4,4,4,3,4,1,3,4,3,2,1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3), (0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1), ) class JapaneseContextAnalysis(object): NUM_OF_CATEGORY = 6 DONT_KNOW = -1 ENOUGH_REL_THRESHOLD = 100 MAX_REL_THRESHOLD = 1000 MINIMUM_DATA_THRESHOLD = 4 def __init__(self): self._total_rel = None self._rel_sample = None self._need_to_skip_char_num = None self._last_char_order = None self._done = None self.reset() def reset(self): self._total_rel = 0 # total sequence received # category counters, each integer counts sequence in its category self._rel_sample = [0] * self.NUM_OF_CATEGORY # if last byte in current buffer is not the last byte of a character, # we need to know how many bytes to skip in next buffer self._need_to_skip_char_num = 0 self._last_char_order = -1 # The order of previous char # If this flag is set to True, detection is done and conclusion has # been made self._done = False def feed(self, byte_str, num_bytes): if self._done: return # The buffer we got is byte oriented, and a character may span in more than one # buffers. In case the last one or two byte in last buffer is not # complete, we record how many byte needed to complete that character # and skip these bytes here. We can choose to record those bytes as # well and analyse the character once it is complete, but since a # character will not make much difference, by simply skipping # this character will simply our logic and improve performance. i = self._need_to_skip_char_num while i < num_bytes: order, char_len = self.get_order(byte_str[i:i + 2]) i += char_len if i > num_bytes: self._need_to_skip_char_num = i - num_bytes self._last_char_order = -1 else: if (order != -1) and (self._last_char_order != -1): self._total_rel += 1 if self._total_rel > self.MAX_REL_THRESHOLD: self._done = True break self._rel_sample[jp2CharContext[self._last_char_order][order]] += 1 self._last_char_order = order def got_enough_data(self): return self._total_rel > self.ENOUGH_REL_THRESHOLD def get_confidence(self): # This is just one way to calculate confidence. It works well for me. if self._total_rel > self.MINIMUM_DATA_THRESHOLD: return (self._total_rel - self._rel_sample[0]) / self._total_rel else: return self.DONT_KNOW def get_order(self, byte_str): return -1, 1 class SJISContextAnalysis(JapaneseContextAnalysis): def __init__(self): super(SJISContextAnalysis, self).__init__() self._charset_name = "SHIFT_JIS" @property def charset_name(self): return self._charset_name def get_order(self, byte_str): if not byte_str: return -1, 1 # find out current char's byte length first_char = byte_str[0] if (0x81 <= first_char <= 0x9F) or (0xE0 <= first_char <= 0xFC): char_len = 2 if (first_char == 0x87) or (0xFA <= first_char <= 0xFC): self._charset_name = "CP932" else: char_len = 1 # return its order if it is hiragana if len(byte_str) > 1: second_char = byte_str[1] if (first_char == 202) and (0x9F <= second_char <= 0xF1): return second_char - 0x9F, char_len return -1, char_len class EUCJPContextAnalysis(JapaneseContextAnalysis): def get_order(self, byte_str): if not byte_str: return -1, 1 # find out current char's byte length first_char = byte_str[0] if (first_char == 0x8E) or (0xA1 <= first_char <= 0xFE): char_len = 2 elif first_char == 0x8F: char_len = 3 else: char_len = 1 # return its order if it is hiragana if len(byte_str) > 1: second_char = byte_str[1] if (first_char == 0xA4) and (0xA1 <= second_char <= 0xF3): return second_char - 0xA1, char_len return -1, char_len chardet/euctwfreq.py000064400000075605152347724720010567 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # EUCTW frequency table # Converted from big5 work # by Taiwan's Mandarin Promotion Council # # 128 --> 0.42261 # 256 --> 0.57851 # 512 --> 0.74851 # 1024 --> 0.89384 # 2048 --> 0.97583 # # Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98 # Random Distribution Ration = 512/(5401-512)=0.105 # # Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR EUCTW_TYPICAL_DISTRIBUTION_RATIO = 0.75 # Char to FreqOrder table , EUCTW_TABLE_SIZE = 5376 EUCTW_CHAR_TO_FREQ_ORDER = ( 1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, # 2742 3735, 33,3241, 261, 76, 44,2113, 16,2931,2184,1176, 659,3868, 26,3404,2643, # 2758 1198,3869,3313,4060, 410,2211, 302, 590, 361,1963, 8, 204, 58,4296,7311,1931, # 2774 63,7312,7313, 317,1614, 75, 222, 159,4061,2412,1480,7314,3500,3068, 224,2809, # 2790 3616, 3, 10,3870,1471, 29,2774,1135,2852,1939, 873, 130,3242,1123, 312,7315, # 2806 4297,2051, 507, 252, 682,7316, 142,1914, 124, 206,2932, 34,3501,3173, 64, 604, # 2822 7317,2494,1976,1977, 155,1990, 645, 641,1606,7318,3405, 337, 72, 406,7319, 80, # 2838 630, 238,3174,1509, 263, 939,1092,2644, 756,1440,1094,3406, 449, 69,2969, 591, # 2854 179,2095, 471, 115,2034,1843, 60, 50,2970, 134, 806,1868, 734,2035,3407, 180, # 2870 995,1607, 156, 537,2893, 688,7320, 319,1305, 779,2144, 514,2374, 298,4298, 359, # 2886 2495, 90,2707,1338, 663, 11, 906,1099,2545, 20,2436, 182, 532,1716,7321, 732, # 2902 1376,4062,1311,1420,3175, 25,2312,1056, 113, 399, 382,1949, 242,3408,2467, 529, # 2918 3243, 475,1447,3617,7322, 117, 21, 656, 810,1297,2295,2329,3502,7323, 126,4063, # 2934 706, 456, 150, 613,4299, 71,1118,2036,4064, 145,3069, 85, 835, 486,2114,1246, # 2950 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,7324,2127,2354, 347,3736, 221, # 2966 3503,3110,7325,1955,1153,4065, 83, 296,1199,3070, 192, 624, 93,7326, 822,1897, # 2982 2810,3111, 795,2064, 991,1554,1542,1592, 27, 43,2853, 859, 139,1456, 860,4300, # 2998 437, 712,3871, 164,2392,3112, 695, 211,3017,2096, 195,3872,1608,3504,3505,3618, # 3014 3873, 234, 811,2971,2097,3874,2229,1441,3506,1615,2375, 668,2076,1638, 305, 228, # 3030 1664,4301, 467, 415,7327, 262,2098,1593, 239, 108, 300, 200,1033, 512,1247,2077, # 3046 7328,7329,2173,3176,3619,2673, 593, 845,1062,3244, 88,1723,2037,3875,1950, 212, # 3062 266, 152, 149, 468,1898,4066,4302, 77, 187,7330,3018, 37, 5,2972,7331,3876, # 3078 7332,7333, 39,2517,4303,2894,3177,2078, 55, 148, 74,4304, 545, 483,1474,1029, # 3094 1665, 217,1869,1531,3113,1104,2645,4067, 24, 172,3507, 900,3877,3508,3509,4305, # 3110 32,1408,2811,1312, 329, 487,2355,2247,2708, 784,2674, 4,3019,3314,1427,1788, # 3126 188, 109, 499,7334,3620,1717,1789, 888,1217,3020,4306,7335,3510,7336,3315,1520, # 3142 3621,3878, 196,1034, 775,7337,7338, 929,1815, 249, 439, 38,7339,1063,7340, 794, # 3158 3879,1435,2296, 46, 178,3245,2065,7341,2376,7342, 214,1709,4307, 804, 35, 707, # 3174 324,3622,1601,2546, 140, 459,4068,7343,7344,1365, 839, 272, 978,2257,2572,3409, # 3190 2128,1363,3623,1423, 697, 100,3071, 48, 70,1231, 495,3114,2193,7345,1294,7346, # 3206 2079, 462, 586,1042,3246, 853, 256, 988, 185,2377,3410,1698, 434,1084,7347,3411, # 3222 314,2615,2775,4308,2330,2331, 569,2280, 637,1816,2518, 757,1162,1878,1616,3412, # 3238 287,1577,2115, 768,4309,1671,2854,3511,2519,1321,3737, 909,2413,7348,4069, 933, # 3254 3738,7349,2052,2356,1222,4310, 765,2414,1322, 786,4311,7350,1919,1462,1677,2895, # 3270 1699,7351,4312,1424,2437,3115,3624,2590,3316,1774,1940,3413,3880,4070, 309,1369, # 3286 1130,2812, 364,2230,1653,1299,3881,3512,3882,3883,2646, 525,1085,3021, 902,2000, # 3302 1475, 964,4313, 421,1844,1415,1057,2281, 940,1364,3116, 376,4314,4315,1381, 7, # 3318 2520, 983,2378, 336,1710,2675,1845, 321,3414, 559,1131,3022,2742,1808,1132,1313, # 3334 265,1481,1857,7352, 352,1203,2813,3247, 167,1089, 420,2814, 776, 792,1724,3513, # 3350 4071,2438,3248,7353,4072,7354, 446, 229, 333,2743, 901,3739,1200,1557,4316,2647, # 3366 1920, 395,2744,2676,3740,4073,1835, 125, 916,3178,2616,4317,7355,7356,3741,7357, # 3382 7358,7359,4318,3117,3625,1133,2547,1757,3415,1510,2313,1409,3514,7360,2145, 438, # 3398 2591,2896,2379,3317,1068, 958,3023, 461, 311,2855,2677,4074,1915,3179,4075,1978, # 3414 383, 750,2745,2617,4076, 274, 539, 385,1278,1442,7361,1154,1964, 384, 561, 210, # 3430 98,1295,2548,3515,7362,1711,2415,1482,3416,3884,2897,1257, 129,7363,3742, 642, # 3446 523,2776,2777,2648,7364, 141,2231,1333, 68, 176, 441, 876, 907,4077, 603,2592, # 3462 710, 171,3417, 404, 549, 18,3118,2393,1410,3626,1666,7365,3516,4319,2898,4320, # 3478 7366,2973, 368,7367, 146, 366, 99, 871,3627,1543, 748, 807,1586,1185, 22,2258, # 3494 379,3743,3180,7368,3181, 505,1941,2618,1991,1382,2314,7369, 380,2357, 218, 702, # 3510 1817,1248,3418,3024,3517,3318,3249,7370,2974,3628, 930,3250,3744,7371, 59,7372, # 3526 585, 601,4078, 497,3419,1112,1314,4321,1801,7373,1223,1472,2174,7374, 749,1836, # 3542 690,1899,3745,1772,3885,1476, 429,1043,1790,2232,2116, 917,4079, 447,1086,1629, # 3558 7375, 556,7376,7377,2020,1654, 844,1090, 105, 550, 966,1758,2815,1008,1782, 686, # 3574 1095,7378,2282, 793,1602,7379,3518,2593,4322,4080,2933,2297,4323,3746, 980,2496, # 3590 544, 353, 527,4324, 908,2678,2899,7380, 381,2619,1942,1348,7381,1341,1252, 560, # 3606 3072,7382,3420,2856,7383,2053, 973, 886,2080, 143,4325,7384,7385, 157,3886, 496, # 3622 4081, 57, 840, 540,2038,4326,4327,3421,2117,1445, 970,2259,1748,1965,2081,4082, # 3638 3119,1234,1775,3251,2816,3629, 773,1206,2129,1066,2039,1326,3887,1738,1725,4083, # 3654 279,3120, 51,1544,2594, 423,1578,2130,2066, 173,4328,1879,7386,7387,1583, 264, # 3670 610,3630,4329,2439, 280, 154,7388,7389,7390,1739, 338,1282,3073, 693,2857,1411, # 3686 1074,3747,2440,7391,4330,7392,7393,1240, 952,2394,7394,2900,1538,2679, 685,1483, # 3702 4084,2468,1436, 953,4085,2054,4331, 671,2395, 79,4086,2441,3252, 608, 567,2680, # 3718 3422,4087,4088,1691, 393,1261,1791,2396,7395,4332,7396,7397,7398,7399,1383,1672, # 3734 3748,3182,1464, 522,1119, 661,1150, 216, 675,4333,3888,1432,3519, 609,4334,2681, # 3750 2397,7400,7401,7402,4089,3025, 0,7403,2469, 315, 231,2442, 301,3319,4335,2380, # 3766 7404, 233,4090,3631,1818,4336,4337,7405, 96,1776,1315,2082,7406, 257,7407,1809, # 3782 3632,2709,1139,1819,4091,2021,1124,2163,2778,1777,2649,7408,3074, 363,1655,3183, # 3798 7409,2975,7410,7411,7412,3889,1567,3890, 718, 103,3184, 849,1443, 341,3320,2934, # 3814 1484,7413,1712, 127, 67, 339,4092,2398, 679,1412, 821,7414,7415, 834, 738, 351, # 3830 2976,2146, 846, 235,1497,1880, 418,1992,3749,2710, 186,1100,2147,2746,3520,1545, # 3846 1355,2935,2858,1377, 583,3891,4093,2573,2977,7416,1298,3633,1078,2549,3634,2358, # 3862 78,3750,3751, 267,1289,2099,2001,1594,4094, 348, 369,1274,2194,2175,1837,4338, # 3878 1820,2817,3635,2747,2283,2002,4339,2936,2748, 144,3321, 882,4340,3892,2749,3423, # 3894 4341,2901,7417,4095,1726, 320,7418,3893,3026, 788,2978,7419,2818,1773,1327,2859, # 3910 3894,2819,7420,1306,4342,2003,1700,3752,3521,2359,2650, 787,2022, 506, 824,3636, # 3926 534, 323,4343,1044,3322,2023,1900, 946,3424,7421,1778,1500,1678,7422,1881,4344, # 3942 165, 243,4345,3637,2521, 123, 683,4096, 764,4346, 36,3895,1792, 589,2902, 816, # 3958 626,1667,3027,2233,1639,1555,1622,3753,3896,7423,3897,2860,1370,1228,1932, 891, # 3974 2083,2903, 304,4097,7424, 292,2979,2711,3522, 691,2100,4098,1115,4347, 118, 662, # 3990 7425, 611,1156, 854,2381,1316,2861, 2, 386, 515,2904,7426,7427,3253, 868,2234, # 4006 1486, 855,2651, 785,2212,3028,7428,1040,3185,3523,7429,3121, 448,7430,1525,7431, # 4022 2164,4348,7432,3754,7433,4099,2820,3524,3122, 503, 818,3898,3123,1568, 814, 676, # 4038 1444, 306,1749,7434,3755,1416,1030, 197,1428, 805,2821,1501,4349,7435,7436,7437, # 4054 1993,7438,4350,7439,7440,2195, 13,2779,3638,2980,3124,1229,1916,7441,3756,2131, # 4070 7442,4100,4351,2399,3525,7443,2213,1511,1727,1120,7444,7445, 646,3757,2443, 307, # 4086 7446,7447,1595,3186,7448,7449,7450,3639,1113,1356,3899,1465,2522,2523,7451, 519, # 4102 7452, 128,2132, 92,2284,1979,7453,3900,1512, 342,3125,2196,7454,2780,2214,1980, # 4118 3323,7455, 290,1656,1317, 789, 827,2360,7456,3758,4352, 562, 581,3901,7457, 401, # 4134 4353,2248, 94,4354,1399,2781,7458,1463,2024,4355,3187,1943,7459, 828,1105,4101, # 4150 1262,1394,7460,4102, 605,4356,7461,1783,2862,7462,2822, 819,2101, 578,2197,2937, # 4166 7463,1502, 436,3254,4103,3255,2823,3902,2905,3425,3426,7464,2712,2315,7465,7466, # 4182 2332,2067, 23,4357, 193, 826,3759,2102, 699,1630,4104,3075, 390,1793,1064,3526, # 4198 7467,1579,3076,3077,1400,7468,4105,1838,1640,2863,7469,4358,4359, 137,4106, 598, # 4214 3078,1966, 780, 104, 974,2938,7470, 278, 899, 253, 402, 572, 504, 493,1339,7471, # 4230 3903,1275,4360,2574,2550,7472,3640,3029,3079,2249, 565,1334,2713, 863, 41,7473, # 4246 7474,4361,7475,1657,2333, 19, 463,2750,4107, 606,7476,2981,3256,1087,2084,1323, # 4262 2652,2982,7477,1631,1623,1750,4108,2682,7478,2864, 791,2714,2653,2334, 232,2416, # 4278 7479,2983,1498,7480,2654,2620, 755,1366,3641,3257,3126,2025,1609, 119,1917,3427, # 4294 862,1026,4109,7481,3904,3760,4362,3905,4363,2260,1951,2470,7482,1125, 817,4110, # 4310 4111,3906,1513,1766,2040,1487,4112,3030,3258,2824,3761,3127,7483,7484,1507,7485, # 4326 2683, 733, 40,1632,1106,2865, 345,4113, 841,2524, 230,4364,2984,1846,3259,3428, # 4342 7486,1263, 986,3429,7487, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562,3907, # 4358 3908,2939, 967,2751,2655,1349, 592,2133,1692,3324,2985,1994,4114,1679,3909,1901, # 4374 2185,7488, 739,3642,2715,1296,1290,7489,4115,2198,2199,1921,1563,2595,2551,1870, # 4390 2752,2986,7490, 435,7491, 343,1108, 596, 17,1751,4365,2235,3430,3643,7492,4366, # 4406 294,3527,2940,1693, 477, 979, 281,2041,3528, 643,2042,3644,2621,2782,2261,1031, # 4422 2335,2134,2298,3529,4367, 367,1249,2552,7493,3530,7494,4368,1283,3325,2004, 240, # 4438 1762,3326,4369,4370, 836,1069,3128, 474,7495,2148,2525, 268,3531,7496,3188,1521, # 4454 1284,7497,1658,1546,4116,7498,3532,3533,7499,4117,3327,2684,1685,4118, 961,1673, # 4470 2622, 190,2005,2200,3762,4371,4372,7500, 570,2497,3645,1490,7501,4373,2623,3260, # 4486 1956,4374, 584,1514, 396,1045,1944,7502,4375,1967,2444,7503,7504,4376,3910, 619, # 4502 7505,3129,3261, 215,2006,2783,2553,3189,4377,3190,4378, 763,4119,3763,4379,7506, # 4518 7507,1957,1767,2941,3328,3646,1174, 452,1477,4380,3329,3130,7508,2825,1253,2382, # 4534 2186,1091,2285,4120, 492,7509, 638,1169,1824,2135,1752,3911, 648, 926,1021,1324, # 4550 4381, 520,4382, 997, 847,1007, 892,4383,3764,2262,1871,3647,7510,2400,1784,4384, # 4566 1952,2942,3080,3191,1728,4121,2043,3648,4385,2007,1701,3131,1551, 30,2263,4122, # 4582 7511,2026,4386,3534,7512, 501,7513,4123, 594,3431,2165,1821,3535,3432,3536,3192, # 4598 829,2826,4124,7514,1680,3132,1225,4125,7515,3262,4387,4126,3133,2336,7516,4388, # 4614 4127,7517,3912,3913,7518,1847,2383,2596,3330,7519,4389, 374,3914, 652,4128,4129, # 4630 375,1140, 798,7520,7521,7522,2361,4390,2264, 546,1659, 138,3031,2445,4391,7523, # 4646 2250, 612,1848, 910, 796,3765,1740,1371, 825,3766,3767,7524,2906,2554,7525, 692, # 4662 444,3032,2624, 801,4392,4130,7526,1491, 244,1053,3033,4131,4132, 340,7527,3915, # 4678 1041,2987, 293,1168, 87,1357,7528,1539, 959,7529,2236, 721, 694,4133,3768, 219, # 4694 1478, 644,1417,3331,2656,1413,1401,1335,1389,3916,7530,7531,2988,2362,3134,1825, # 4710 730,1515, 184,2827, 66,4393,7532,1660,2943, 246,3332, 378,1457, 226,3433, 975, # 4726 3917,2944,1264,3537, 674, 696,7533, 163,7534,1141,2417,2166, 713,3538,3333,4394, # 4742 3918,7535,7536,1186, 15,7537,1079,1070,7538,1522,3193,3539, 276,1050,2716, 758, # 4758 1126, 653,2945,3263,7539,2337, 889,3540,3919,3081,2989, 903,1250,4395,3920,3434, # 4774 3541,1342,1681,1718, 766,3264, 286, 89,2946,3649,7540,1713,7541,2597,3334,2990, # 4790 7542,2947,2215,3194,2866,7543,4396,2498,2526, 181, 387,1075,3921, 731,2187,3335, # 4806 7544,3265, 310, 313,3435,2299, 770,4134, 54,3034, 189,4397,3082,3769,3922,7545, # 4822 1230,1617,1849, 355,3542,4135,4398,3336, 111,4136,3650,1350,3135,3436,3035,4137, # 4838 2149,3266,3543,7546,2784,3923,3924,2991, 722,2008,7547,1071, 247,1207,2338,2471, # 4854 1378,4399,2009, 864,1437,1214,4400, 373,3770,1142,2216, 667,4401, 442,2753,2555, # 4870 3771,3925,1968,4138,3267,1839, 837, 170,1107, 934,1336,1882,7548,7549,2118,4139, # 4886 2828, 743,1569,7550,4402,4140, 582,2384,1418,3437,7551,1802,7552, 357,1395,1729, # 4902 3651,3268,2418,1564,2237,7553,3083,3772,1633,4403,1114,2085,4141,1532,7554, 482, # 4918 2446,4404,7555,7556,1492, 833,1466,7557,2717,3544,1641,2829,7558,1526,1272,3652, # 4934 4142,1686,1794, 416,2556,1902,1953,1803,7559,3773,2785,3774,1159,2316,7560,2867, # 4950 4405,1610,1584,3036,2419,2754, 443,3269,1163,3136,7561,7562,3926,7563,4143,2499, # 4966 3037,4406,3927,3137,2103,1647,3545,2010,1872,4144,7564,4145, 431,3438,7565, 250, # 4982 97, 81,4146,7566,1648,1850,1558, 160, 848,7567, 866, 740,1694,7568,2201,2830, # 4998 3195,4147,4407,3653,1687, 950,2472, 426, 469,3196,3654,3655,3928,7569,7570,1188, # 5014 424,1995, 861,3546,4148,3775,2202,2685, 168,1235,3547,4149,7571,2086,1674,4408, # 5030 3337,3270, 220,2557,1009,7572,3776, 670,2992, 332,1208, 717,7573,7574,3548,2447, # 5046 3929,3338,7575, 513,7576,1209,2868,3339,3138,4409,1080,7577,7578,7579,7580,2527, # 5062 3656,3549, 815,1587,3930,3931,7581,3550,3439,3777,1254,4410,1328,3038,1390,3932, # 5078 1741,3933,3778,3934,7582, 236,3779,2448,3271,7583,7584,3657,3780,1273,3781,4411, # 5094 7585, 308,7586,4412, 245,4413,1851,2473,1307,2575, 430, 715,2136,2449,7587, 270, # 5110 199,2869,3935,7588,3551,2718,1753, 761,1754, 725,1661,1840,4414,3440,3658,7589, # 5126 7590, 587, 14,3272, 227,2598, 326, 480,2265, 943,2755,3552, 291, 650,1883,7591, # 5142 1702,1226, 102,1547, 62,3441, 904,4415,3442,1164,4150,7592,7593,1224,1548,2756, # 5158 391, 498,1493,7594,1386,1419,7595,2055,1177,4416, 813, 880,1081,2363, 566,1145, # 5174 4417,2286,1001,1035,2558,2599,2238, 394,1286,7596,7597,2068,7598, 86,1494,1730, # 5190 3936, 491,1588, 745, 897,2948, 843,3340,3937,2757,2870,3273,1768, 998,2217,2069, # 5206 397,1826,1195,1969,3659,2993,3341, 284,7599,3782,2500,2137,2119,1903,7600,3938, # 5222 2150,3939,4151,1036,3443,1904, 114,2559,4152, 209,1527,7601,7602,2949,2831,2625, # 5238 2385,2719,3139, 812,2560,7603,3274,7604,1559, 737,1884,3660,1210, 885, 28,2686, # 5254 3553,3783,7605,4153,1004,1779,4418,7606, 346,1981,2218,2687,4419,3784,1742, 797, # 5270 1642,3940,1933,1072,1384,2151, 896,3941,3275,3661,3197,2871,3554,7607,2561,1958, # 5286 4420,2450,1785,7608,7609,7610,3942,4154,1005,1308,3662,4155,2720,4421,4422,1528, # 5302 2600, 161,1178,4156,1982, 987,4423,1101,4157, 631,3943,1157,3198,2420,1343,1241, # 5318 1016,2239,2562, 372, 877,2339,2501,1160, 555,1934, 911,3944,7611, 466,1170, 169, # 5334 1051,2907,2688,3663,2474,2994,1182,2011,2563,1251,2626,7612, 992,2340,3444,1540, # 5350 2721,1201,2070,2401,1996,2475,7613,4424, 528,1922,2188,1503,1873,1570,2364,3342, # 5366 3276,7614, 557,1073,7615,1827,3445,2087,2266,3140,3039,3084, 767,3085,2786,4425, # 5382 1006,4158,4426,2341,1267,2176,3664,3199, 778,3945,3200,2722,1597,2657,7616,4427, # 5398 7617,3446,7618,7619,7620,3277,2689,1433,3278, 131, 95,1504,3946, 723,4159,3141, # 5414 1841,3555,2758,2189,3947,2027,2104,3665,7621,2995,3948,1218,7622,3343,3201,3949, # 5430 4160,2576, 248,1634,3785, 912,7623,2832,3666,3040,3786, 654, 53,7624,2996,7625, # 5446 1688,4428, 777,3447,1032,3950,1425,7626, 191, 820,2120,2833, 971,4429, 931,3202, # 5462 135, 664, 783,3787,1997, 772,2908,1935,3951,3788,4430,2909,3203, 282,2723, 640, # 5478 1372,3448,1127, 922, 325,3344,7627,7628, 711,2044,7629,7630,3952,2219,2787,1936, # 5494 3953,3345,2220,2251,3789,2300,7631,4431,3790,1258,3279,3954,3204,2138,2950,3955, # 5510 3956,7632,2221, 258,3205,4432, 101,1227,7633,3280,1755,7634,1391,3281,7635,2910, # 5526 2056, 893,7636,7637,7638,1402,4161,2342,7639,7640,3206,3556,7641,7642, 878,1325, # 5542 1780,2788,4433, 259,1385,2577, 744,1183,2267,4434,7643,3957,2502,7644, 684,1024, # 5558 4162,7645, 472,3557,3449,1165,3282,3958,3959, 322,2152, 881, 455,1695,1152,1340, # 5574 660, 554,2153,4435,1058,4436,4163, 830,1065,3346,3960,4437,1923,7646,1703,1918, # 5590 7647, 932,2268, 122,7648,4438, 947, 677,7649,3791,2627, 297,1905,1924,2269,4439, # 5606 2317,3283,7650,7651,4164,7652,4165, 84,4166, 112, 989,7653, 547,1059,3961, 701, # 5622 3558,1019,7654,4167,7655,3450, 942, 639, 457,2301,2451, 993,2951, 407, 851, 494, # 5638 4440,3347, 927,7656,1237,7657,2421,3348, 573,4168, 680, 921,2911,1279,1874, 285, # 5654 790,1448,1983, 719,2167,7658,7659,4441,3962,3963,1649,7660,1541, 563,7661,1077, # 5670 7662,3349,3041,3451, 511,2997,3964,3965,3667,3966,1268,2564,3350,3207,4442,4443, # 5686 7663, 535,1048,1276,1189,2912,2028,3142,1438,1373,2834,2952,1134,2012,7664,4169, # 5702 1238,2578,3086,1259,7665, 700,7666,2953,3143,3668,4170,7667,4171,1146,1875,1906, # 5718 4444,2601,3967, 781,2422, 132,1589, 203, 147, 273,2789,2402, 898,1786,2154,3968, # 5734 3969,7668,3792,2790,7669,7670,4445,4446,7671,3208,7672,1635,3793, 965,7673,1804, # 5750 2690,1516,3559,1121,1082,1329,3284,3970,1449,3794, 65,1128,2835,2913,2759,1590, # 5766 3795,7674,7675, 12,2658, 45, 976,2579,3144,4447, 517,2528,1013,1037,3209,7676, # 5782 3796,2836,7677,3797,7678,3452,7679,2602, 614,1998,2318,3798,3087,2724,2628,7680, # 5798 2580,4172, 599,1269,7681,1810,3669,7682,2691,3088, 759,1060, 489,1805,3351,3285, # 5814 1358,7683,7684,2386,1387,1215,2629,2252, 490,7685,7686,4173,1759,2387,2343,7687, # 5830 4448,3799,1907,3971,2630,1806,3210,4449,3453,3286,2760,2344, 874,7688,7689,3454, # 5846 3670,1858, 91,2914,3671,3042,3800,4450,7690,3145,3972,2659,7691,3455,1202,1403, # 5862 3801,2954,2529,1517,2503,4451,3456,2504,7692,4452,7693,2692,1885,1495,1731,3973, # 5878 2365,4453,7694,2029,7695,7696,3974,2693,1216, 237,2581,4174,2319,3975,3802,4454, # 5894 4455,2694,3560,3457, 445,4456,7697,7698,7699,7700,2761, 61,3976,3672,1822,3977, # 5910 7701, 687,2045, 935, 925, 405,2660, 703,1096,1859,2725,4457,3978,1876,1367,2695, # 5926 3352, 918,2105,1781,2476, 334,3287,1611,1093,4458, 564,3146,3458,3673,3353, 945, # 5942 2631,2057,4459,7702,1925, 872,4175,7703,3459,2696,3089, 349,4176,3674,3979,4460, # 5958 3803,4177,3675,2155,3980,4461,4462,4178,4463,2403,2046, 782,3981, 400, 251,4179, # 5974 1624,7704,7705, 277,3676, 299,1265, 476,1191,3804,2121,4180,4181,1109, 205,7706, # 5990 2582,1000,2156,3561,1860,7707,7708,7709,4464,7710,4465,2565, 107,2477,2157,3982, # 6006 3460,3147,7711,1533, 541,1301, 158, 753,4182,2872,3562,7712,1696, 370,1088,4183, # 6022 4466,3563, 579, 327, 440, 162,2240, 269,1937,1374,3461, 968,3043, 56,1396,3090, # 6038 2106,3288,3354,7713,1926,2158,4467,2998,7714,3564,7715,7716,3677,4468,2478,7717, # 6054 2791,7718,1650,4469,7719,2603,7720,7721,3983,2661,3355,1149,3356,3984,3805,3985, # 6070 7722,1076, 49,7723, 951,3211,3289,3290, 450,2837, 920,7724,1811,2792,2366,4184, # 6086 1908,1138,2367,3806,3462,7725,3212,4470,1909,1147,1518,2423,4471,3807,7726,4472, # 6102 2388,2604, 260,1795,3213,7727,7728,3808,3291, 708,7729,3565,1704,7730,3566,1351, # 6118 1618,3357,2999,1886, 944,4185,3358,4186,3044,3359,4187,7731,3678, 422, 413,1714, # 6134 3292, 500,2058,2345,4188,2479,7732,1344,1910, 954,7733,1668,7734,7735,3986,2404, # 6150 4189,3567,3809,4190,7736,2302,1318,2505,3091, 133,3092,2873,4473, 629, 31,2838, # 6166 2697,3810,4474, 850, 949,4475,3987,2955,1732,2088,4191,1496,1852,7737,3988, 620, # 6182 3214, 981,1242,3679,3360,1619,3680,1643,3293,2139,2452,1970,1719,3463,2168,7738, # 6198 3215,7739,7740,3361,1828,7741,1277,4476,1565,2047,7742,1636,3568,3093,7743, 869, # 6214 2839, 655,3811,3812,3094,3989,3000,3813,1310,3569,4477,7744,7745,7746,1733, 558, # 6230 4478,3681, 335,1549,3045,1756,4192,3682,1945,3464,1829,1291,1192, 470,2726,2107, # 6246 2793, 913,1054,3990,7747,1027,7748,3046,3991,4479, 982,2662,3362,3148,3465,3216, # 6262 3217,1946,2794,7749, 571,4480,7750,1830,7751,3570,2583,1523,2424,7752,2089, 984, # 6278 4481,3683,1959,7753,3684, 852, 923,2795,3466,3685, 969,1519, 999,2048,2320,1705, # 6294 7754,3095, 615,1662, 151, 597,3992,2405,2321,1049, 275,4482,3686,4193, 568,3687, # 6310 3571,2480,4194,3688,7755,2425,2270, 409,3218,7756,1566,2874,3467,1002, 769,2840, # 6326 194,2090,3149,3689,2222,3294,4195, 628,1505,7757,7758,1763,2177,3001,3993, 521, # 6342 1161,2584,1787,2203,2406,4483,3994,1625,4196,4197, 412, 42,3096, 464,7759,2632, # 6358 4484,3363,1760,1571,2875,3468,2530,1219,2204,3814,2633,2140,2368,4485,4486,3295, # 6374 1651,3364,3572,7760,7761,3573,2481,3469,7762,3690,7763,7764,2271,2091, 460,7765, # 6390 4487,7766,3002, 962, 588,3574, 289,3219,2634,1116, 52,7767,3047,1796,7768,7769, # 6406 7770,1467,7771,1598,1143,3691,4198,1984,1734,1067,4488,1280,3365, 465,4489,1572, # 6422 510,7772,1927,2241,1812,1644,3575,7773,4490,3692,7774,7775,2663,1573,1534,7776, # 6438 7777,4199, 536,1807,1761,3470,3815,3150,2635,7778,7779,7780,4491,3471,2915,1911, # 6454 2796,7781,3296,1122, 377,3220,7782, 360,7783,7784,4200,1529, 551,7785,2059,3693, # 6470 1769,2426,7786,2916,4201,3297,3097,2322,2108,2030,4492,1404, 136,1468,1479, 672, # 6486 1171,3221,2303, 271,3151,7787,2762,7788,2049, 678,2727, 865,1947,4493,7789,2013, # 6502 3995,2956,7790,2728,2223,1397,3048,3694,4494,4495,1735,2917,3366,3576,7791,3816, # 6518 509,2841,2453,2876,3817,7792,7793,3152,3153,4496,4202,2531,4497,2304,1166,1010, # 6534 552, 681,1887,7794,7795,2957,2958,3996,1287,1596,1861,3154, 358, 453, 736, 175, # 6550 478,1117, 905,1167,1097,7796,1853,1530,7797,1706,7798,2178,3472,2287,3695,3473, # 6566 3577,4203,2092,4204,7799,3367,1193,2482,4205,1458,2190,2205,1862,1888,1421,3298, # 6582 2918,3049,2179,3474, 595,2122,7800,3997,7801,7802,4206,1707,2636, 223,3696,1359, # 6598 751,3098, 183,3475,7803,2797,3003, 419,2369, 633, 704,3818,2389, 241,7804,7805, # 6614 7806, 838,3004,3697,2272,2763,2454,3819,1938,2050,3998,1309,3099,2242,1181,7807, # 6630 1136,2206,3820,2370,1446,4207,2305,4498,7808,7809,4208,1055,2605, 484,3698,7810, # 6646 3999, 625,4209,2273,3368,1499,4210,4000,7811,4001,4211,3222,2274,2275,3476,7812, # 6662 7813,2764, 808,2606,3699,3369,4002,4212,3100,2532, 526,3370,3821,4213, 955,7814, # 6678 1620,4214,2637,2427,7815,1429,3700,1669,1831, 994, 928,7816,3578,1260,7817,7818, # 6694 7819,1948,2288, 741,2919,1626,4215,2729,2455, 867,1184, 362,3371,1392,7820,7821, # 6710 4003,4216,1770,1736,3223,2920,4499,4500,1928,2698,1459,1158,7822,3050,3372,2877, # 6726 1292,1929,2506,2842,3701,1985,1187,2071,2014,2607,4217,7823,2566,2507,2169,3702, # 6742 2483,3299,7824,3703,4501,7825,7826, 666,1003,3005,1022,3579,4218,7827,4502,1813, # 6758 2253, 574,3822,1603, 295,1535, 705,3823,4219, 283, 858, 417,7828,7829,3224,4503, # 6774 4504,3051,1220,1889,1046,2276,2456,4004,1393,1599, 689,2567, 388,4220,7830,2484, # 6790 802,7831,2798,3824,2060,1405,2254,7832,4505,3825,2109,1052,1345,3225,1585,7833, # 6806 809,7834,7835,7836, 575,2730,3477, 956,1552,1469,1144,2323,7837,2324,1560,2457, # 6822 3580,3226,4005, 616,2207,3155,2180,2289,7838,1832,7839,3478,4506,7840,1319,3704, # 6838 3705,1211,3581,1023,3227,1293,2799,7841,7842,7843,3826, 607,2306,3827, 762,2878, # 6854 1439,4221,1360,7844,1485,3052,7845,4507,1038,4222,1450,2061,2638,4223,1379,4508, # 6870 2585,7846,7847,4224,1352,1414,2325,2921,1172,7848,7849,3828,3829,7850,1797,1451, # 6886 7851,7852,7853,7854,2922,4006,4007,2485,2346, 411,4008,4009,3582,3300,3101,4509, # 6902 1561,2664,1452,4010,1375,7855,7856, 47,2959, 316,7857,1406,1591,2923,3156,7858, # 6918 1025,2141,3102,3157, 354,2731, 884,2224,4225,2407, 508,3706, 726,3583, 996,2428, # 6934 3584, 729,7859, 392,2191,1453,4011,4510,3707,7860,7861,2458,3585,2608,1675,2800, # 6950 919,2347,2960,2348,1270,4511,4012, 73,7862,7863, 647,7864,3228,2843,2255,1550, # 6966 1346,3006,7865,1332, 883,3479,7866,7867,7868,7869,3301,2765,7870,1212, 831,1347, # 6982 4226,4512,2326,3830,1863,3053, 720,3831,4513,4514,3832,7871,4227,7872,7873,4515, # 6998 7874,7875,1798,4516,3708,2609,4517,3586,1645,2371,7876,7877,2924, 669,2208,2665, # 7014 2429,7878,2879,7879,7880,1028,3229,7881,4228,2408,7882,2256,1353,7883,7884,4518, # 7030 3158, 518,7885,4013,7886,4229,1960,7887,2142,4230,7888,7889,3007,2349,2350,3833, # 7046 516,1833,1454,4014,2699,4231,4519,2225,2610,1971,1129,3587,7890,2766,7891,2961, # 7062 1422, 577,1470,3008,1524,3373,7892,7893, 432,4232,3054,3480,7894,2586,1455,2508, # 7078 2226,1972,1175,7895,1020,2732,4015,3481,4520,7896,2733,7897,1743,1361,3055,3482, # 7094 2639,4016,4233,4521,2290, 895, 924,4234,2170, 331,2243,3056, 166,1627,3057,1098, # 7110 7898,1232,2880,2227,3374,4522, 657, 403,1196,2372, 542,3709,3375,1600,4235,3483, # 7126 7899,4523,2767,3230, 576, 530,1362,7900,4524,2533,2666,3710,4017,7901, 842,3834, # 7142 7902,2801,2031,1014,4018, 213,2700,3376, 665, 621,4236,7903,3711,2925,2430,7904, # 7158 2431,3302,3588,3377,7905,4237,2534,4238,4525,3589,1682,4239,3484,1380,7906, 724, # 7174 2277, 600,1670,7907,1337,1233,4526,3103,2244,7908,1621,4527,7909, 651,4240,7910, # 7190 1612,4241,2611,7911,2844,7912,2734,2307,3058,7913, 716,2459,3059, 174,1255,2701, # 7206 4019,3590, 548,1320,1398, 728,4020,1574,7914,1890,1197,3060,4021,7915,3061,3062, # 7222 3712,3591,3713, 747,7916, 635,4242,4528,7917,7918,7919,4243,7920,7921,4529,7922, # 7238 3378,4530,2432, 451,7923,3714,2535,2072,4244,2735,4245,4022,7924,1764,4531,7925, # 7254 4246, 350,7926,2278,2390,2486,7927,4247,4023,2245,1434,4024, 488,4532, 458,4248, # 7270 4025,3715, 771,1330,2391,3835,2568,3159,2159,2409,1553,2667,3160,4249,7928,2487, # 7286 2881,2612,1720,2702,4250,3379,4533,7929,2536,4251,7930,3231,4252,2768,7931,2015, # 7302 2736,7932,1155,1017,3716,3836,7933,3303,2308, 201,1864,4253,1430,7934,4026,7935, # 7318 7936,7937,7938,7939,4254,1604,7940, 414,1865, 371,2587,4534,4535,3485,2016,3104, # 7334 4536,1708, 960,4255, 887, 389,2171,1536,1663,1721,7941,2228,4027,2351,2926,1580, # 7350 7942,7943,7944,1744,7945,2537,4537,4538,7946,4539,7947,2073,7948,7949,3592,3380, # 7366 2882,4256,7950,4257,2640,3381,2802, 673,2703,2460, 709,3486,4028,3593,4258,7951, # 7382 1148, 502, 634,7952,7953,1204,4540,3594,1575,4541,2613,3717,7954,3718,3105, 948, # 7398 3232, 121,1745,3837,1110,7955,4259,3063,2509,3009,4029,3719,1151,1771,3838,1488, # 7414 4030,1986,7956,2433,3487,7957,7958,2093,7959,4260,3839,1213,1407,2803, 531,2737, # 7430 2538,3233,1011,1537,7960,2769,4261,3106,1061,7961,3720,3721,1866,2883,7962,2017, # 7446 120,4262,4263,2062,3595,3234,2309,3840,2668,3382,1954,4542,7963,7964,3488,1047, # 7462 2704,1266,7965,1368,4543,2845, 649,3383,3841,2539,2738,1102,2846,2669,7966,7967, # 7478 1999,7968,1111,3596,2962,7969,2488,3842,3597,2804,1854,3384,3722,7970,7971,3385, # 7494 2410,2884,3304,3235,3598,7972,2569,7973,3599,2805,4031,1460, 856,7974,3600,7975, # 7510 2885,2963,7976,2886,3843,7977,4264, 632,2510, 875,3844,1697,3845,2291,7978,7979, # 7526 4544,3010,1239, 580,4545,4265,7980, 914, 936,2074,1190,4032,1039,2123,7981,7982, # 7542 7983,3386,1473,7984,1354,4266,3846,7985,2172,3064,4033, 915,3305,4267,4268,3306, # 7558 1605,1834,7986,2739, 398,3601,4269,3847,4034, 328,1912,2847,4035,3848,1331,4270, # 7574 3011, 937,4271,7987,3602,4036,4037,3387,2160,4546,3388, 524, 742, 538,3065,1012, # 7590 7988,7989,3849,2461,7990, 658,1103, 225,3850,7991,7992,4547,7993,4548,7994,3236, # 7606 1243,7995,4038, 963,2246,4549,7996,2705,3603,3161,7997,7998,2588,2327,7999,4550, # 7622 8000,8001,8002,3489,3307, 957,3389,2540,2032,1930,2927,2462, 870,2018,3604,1746, # 7638 2770,2771,2434,2463,8003,3851,8004,3723,3107,3724,3490,3390,3725,8005,1179,3066, # 7654 8006,3162,2373,4272,3726,2541,3163,3108,2740,4039,8007,3391,1556,2542,2292, 977, # 7670 2887,2033,4040,1205,3392,8008,1765,3393,3164,2124,1271,1689, 714,4551,3491,8009, # 7686 2328,3852, 533,4273,3605,2181, 617,8010,2464,3308,3492,2310,8011,8012,3165,8013, # 7702 8014,3853,1987, 618, 427,2641,3493,3394,8015,8016,1244,1690,8017,2806,4274,4552, # 7718 8018,3494,8019,8020,2279,1576, 473,3606,4275,3395, 972,8021,3607,8022,3067,8023, # 7734 8024,4553,4554,8025,3727,4041,4042,8026, 153,4555, 356,8027,1891,2888,4276,2143, # 7750 408, 803,2352,8028,3854,8029,4277,1646,2570,2511,4556,4557,3855,8030,3856,4278, # 7766 8031,2411,3396, 752,8032,8033,1961,2964,8034, 746,3012,2465,8035,4279,3728, 698, # 7782 4558,1892,4280,3608,2543,4559,3609,3857,8036,3166,3397,8037,1823,1302,4043,2706, # 7798 3858,1973,4281,8038,4282,3167, 823,1303,1288,1236,2848,3495,4044,3398, 774,3859, # 7814 8039,1581,4560,1304,2849,3860,4561,8040,2435,2161,1083,3237,4283,4045,4284, 344, # 7830 1173, 288,2311, 454,1683,8041,8042,1461,4562,4046,2589,8043,8044,4563, 985, 894, # 7846 8045,3399,3168,8046,1913,2928,3729,1988,8047,2110,1974,8048,4047,8049,2571,1194, # 7862 425,8050,4564,3169,1245,3730,4285,8051,8052,2850,8053, 636,4565,1855,3861, 760, # 7878 1799,8054,4286,2209,1508,4566,4048,1893,1684,2293,8055,8056,8057,4287,4288,2210, # 7894 479,8058,8059, 832,8060,4049,2489,8061,2965,2490,3731, 990,3109, 627,1814,2642, # 7910 4289,1582,4290,2125,2111,3496,4567,8062, 799,4291,3170,8063,4568,2112,1737,3013, # 7926 1018, 543, 754,4292,3309,1676,4569,4570,4050,8064,1489,8065,3497,8066,2614,2889, # 7942 4051,8067,8068,2966,8069,8070,8071,8072,3171,4571,4572,2182,1722,8073,3238,3239, # 7958 1842,3610,1715, 481, 365,1975,1856,8074,8075,1962,2491,4573,8076,2126,3611,3240, # 7974 433,1894,2063,2075,8077, 602,2741,8078,8079,8080,8081,8082,3014,1628,3400,8083, # 7990 3172,4574,4052,2890,4575,2512,8084,2544,2772,8085,8086,8087,3310,4576,2891,8088, # 8006 4577,8089,2851,4578,4579,1221,2967,4053,2513,8090,8091,8092,1867,1989,8093,8094, # 8022 8095,1895,8096,8097,4580,1896,4054, 318,8098,2094,4055,4293,8099,8100, 485,8101, # 8038 938,3862, 553,2670, 116,8102,3863,3612,8103,3498,2671,2773,3401,3311,2807,8104, # 8054 3613,2929,4056,1747,2930,2968,8105,8106, 207,8107,8108,2672,4581,2514,8109,3015, # 8070 890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, # 8086 2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, # 8102 ) chardet/langgreekmodel.py000064400000030620152347724720011526 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: Latin7_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, # 40 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, # 50 253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, # 60 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, # 70 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 80 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 90 253,233, 90,253,253,253,253,253,253,253,253,253,253, 74,253,253, # a0 253,253,253,253,247,248, 61, 36, 46, 71, 73,253, 54,253,108,123, # b0 110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, # c0 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0 124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0 ) win1253_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, # 40 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, # 50 253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, # 60 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, # 70 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 80 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 90 253,233, 61,253,253,253,253,253,253,253,253,253,253, 74,253,253, # a0 253,253,253,253,247,253,253, 36, 46, 71, 73,253, 54,253,108,123, # b0 110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, # c0 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0 124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0 ) # Model Table: # total sequences: 100% # first 512 sequences: 98.2851% # first 1024 sequences:1.7001% # rest sequences: 0.0359% # negative sequences: 0.0148% GreekLangModel = ( 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,3,2,2,3,3,3,3,3,3,3,3,1,3,3,3,0,2,2,3,3,0,3,0,3,2,0,3,3,3,0, 3,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,3,3,3,3,0,3,3,0,3,2,3,3,0,3,2,3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,0,0,0,0,0, 0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,2,0,0,0, 0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,2,0,2,0,0,0, 0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,2,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ) Latin7GreekModel = { 'char_to_order_map': Latin7_char_to_order_map, 'precedence_matrix': GreekLangModel, 'typical_positive_ratio': 0.982851, 'keep_english_letter': False, 'charset_name': "ISO-8859-7", 'language': 'Greek', } Win1253GreekModel = { 'char_to_order_map': win1253_char_to_order_map, 'precedence_matrix': GreekLangModel, 'typical_positive_ratio': 0.982851, 'keep_english_letter': False, 'charset_name': "windows-1253", 'language': 'Greek', } chardet/charsetgroupprober.py000064400000007313152347724720012471 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import ProbingState from .charsetprober import CharSetProber class CharSetGroupProber(CharSetProber): def __init__(self, lang_filter=None): super(CharSetGroupProber, self).__init__(lang_filter=lang_filter) self._active_num = 0 self.probers = [] self._best_guess_prober = None def reset(self): super(CharSetGroupProber, self).reset() self._active_num = 0 for prober in self.probers: if prober: prober.reset() prober.active = True self._active_num += 1 self._best_guess_prober = None @property def charset_name(self): if not self._best_guess_prober: self.get_confidence() if not self._best_guess_prober: return None return self._best_guess_prober.charset_name @property def language(self): if not self._best_guess_prober: self.get_confidence() if not self._best_guess_prober: return None return self._best_guess_prober.language def feed(self, byte_str): for prober in self.probers: if not prober: continue if not prober.active: continue state = prober.feed(byte_str) if not state: continue if state == ProbingState.FOUND_IT: self._best_guess_prober = prober return self.state elif state == ProbingState.NOT_ME: prober.active = False self._active_num -= 1 if self._active_num <= 0: self._state = ProbingState.NOT_ME return self.state return self.state def get_confidence(self): state = self.state if state == ProbingState.FOUND_IT: return 0.99 elif state == ProbingState.NOT_ME: return 0.01 best_conf = 0.0 self._best_guess_prober = None for prober in self.probers: if not prober: continue if not prober.active: self.logger.debug('%s not active', prober.charset_name) continue conf = prober.get_confidence() self.logger.debug('%s %s confidence = %s', prober.charset_name, prober.language, conf) if best_conf < conf: best_conf = conf self._best_guess_prober = prober if not self._best_guess_prober: return 0.0 return best_conf chardet/langhebrewmodel.py000064400000026121152347724720011706 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Simon Montagu # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # Shoshannah Forbes - original C code (?) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Windows-1255 language model # Character Mapping Table: WIN1255_CHAR_TO_ORDER_MAP = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, # 40 78,121, 86, 71, 67,102,107, 84,114,103,115,253,253,253,253,253, # 50 253, 50, 74, 60, 61, 42, 76, 70, 64, 53,105, 93, 56, 65, 54, 49, # 60 66,110, 51, 43, 44, 63, 81, 77, 98, 75,108,253,253,253,253,253, # 70 124,202,203,204,205, 40, 58,206,207,208,209,210,211,212,213,214, 215, 83, 52, 47, 46, 72, 32, 94,216,113,217,109,218,219,220,221, 34,116,222,118,100,223,224,117,119,104,125,225,226, 87, 99,227, 106,122,123,228, 55,229,230,101,231,232,120,233, 48, 39, 57,234, 30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237, 238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250, 9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23, 12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253, ) # Model Table: # total sequences: 100% # first 512 sequences: 98.4004% # first 1024 sequences: 1.5981% # rest sequences: 0.087% # negative sequences: 0.0015% HEBREW_LANG_MODEL = ( 0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0, 3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2, 1,2,1,2,1,2,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2, 1,2,1,3,1,1,0,0,2,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,1,2,2,1,3, 1,2,1,1,2,2,0,0,2,2,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,2,3,2,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,0,1, 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,2,1,1,1,1,1,0,1,0,0,0,0,1,0,1, 0,1,1,1,2,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0, ) Win1255HebrewModel = { 'char_to_order_map': WIN1255_CHAR_TO_ORDER_MAP, 'precedence_matrix': HEBREW_LANG_MODEL, 'typical_positive_ratio': 0.984004, 'keep_english_letter': False, 'charset_name': "windows-1255", 'language': 'Hebrew', } chardet/sjisprober.py000064400000007276152347724720010743 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import SJISDistributionAnalysis from .jpcntx import SJISContextAnalysis from .mbcssm import SJIS_SM_MODEL from .enums import ProbingState, MachineState class SJISProber(MultiByteCharSetProber): def __init__(self): super(SJISProber, self).__init__() self.coding_sm = CodingStateMachine(SJIS_SM_MODEL) self.distribution_analyzer = SJISDistributionAnalysis() self.context_analyzer = SJISContextAnalysis() self.reset() def reset(self): super(SJISProber, self).reset() self.context_analyzer.reset() @property def charset_name(self): return self.context_analyzer.charset_name @property def language(self): return "Japanese" def feed(self, byte_str): for i in range(len(byte_str)): coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: self.logger.debug('%s %s prober hit error at byte %s', self.charset_name, self.language, i) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] self.context_analyzer.feed(self._last_char[2 - char_len:], char_len) self.distribution_analyzer.feed(self._last_char, char_len) else: self.context_analyzer.feed(byte_str[i + 1 - char_len:i + 3 - char_len], char_len) self.distribution_analyzer.feed(byte_str[i - 1:i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: if (self.context_analyzer.got_enough_data() and (self.get_confidence() > self.SHORTCUT_THRESHOLD)): self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): context_conf = self.context_analyzer.get_confidence() distrib_conf = self.distribution_analyzer.get_confidence() return max(context_conf, distrib_conf) chardet/enums.py000064400000003175152347724720007702 0ustar00""" All of the Enums that are used throughout the chardet package. :author: Dan Blanchard (dan.blanchard@gmail.com) """ class InputState(object): """ This enum represents the different states a universal detector can be in. """ PURE_ASCII = 0 ESC_ASCII = 1 HIGH_BYTE = 2 class LanguageFilter(object): """ This enum represents the different language filters we can apply to a ``UniversalDetector``. """ CHINESE_SIMPLIFIED = 0x01 CHINESE_TRADITIONAL = 0x02 JAPANESE = 0x04 KOREAN = 0x08 NON_CJK = 0x10 ALL = 0x1F CHINESE = CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL CJK = CHINESE | JAPANESE | KOREAN class ProbingState(object): """ This enum represents the different states a prober can be in. """ DETECTING = 0 FOUND_IT = 1 NOT_ME = 2 class MachineState(object): """ This enum represents the different states a state machine can be in. """ START = 0 ERROR = 1 ITS_ME = 2 class SequenceLikelihood(object): """ This enum represents the likelihood of a character following the previous one. """ NEGATIVE = 0 UNLIKELY = 1 LIKELY = 2 POSITIVE = 3 @classmethod def get_num_categories(cls): """:returns: The number of likelihood categories in the enum.""" return 4 class CharacterCategory(object): """ This enum represents the different categories language models for ``SingleByteCharsetProber`` put characters into. Anything less than CONTROL is considered a letter. """ UNDEFINED = 255 LINE_BREAK = 254 SYMBOL = 253 DIGIT = 252 CONTROL = 251 chardet/escprober.py000064400000007556152347724720010546 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .codingstatemachine import CodingStateMachine from .enums import LanguageFilter, ProbingState, MachineState from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL, ISO2022KR_SM_MODEL) class EscCharSetProber(CharSetProber): """ This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. """ def __init__(self, lang_filter=None): super(EscCharSetProber, self).__init__(lang_filter=lang_filter) self.coding_sm = [] if self.lang_filter & LanguageFilter.CHINESE_SIMPLIFIED: self.coding_sm.append(CodingStateMachine(HZ_SM_MODEL)) self.coding_sm.append(CodingStateMachine(ISO2022CN_SM_MODEL)) if self.lang_filter & LanguageFilter.JAPANESE: self.coding_sm.append(CodingStateMachine(ISO2022JP_SM_MODEL)) if self.lang_filter & LanguageFilter.KOREAN: self.coding_sm.append(CodingStateMachine(ISO2022KR_SM_MODEL)) self.active_sm_count = None self._detected_charset = None self._detected_language = None self._state = None self.reset() def reset(self): super(EscCharSetProber, self).reset() for coding_sm in self.coding_sm: if not coding_sm: continue coding_sm.active = True coding_sm.reset() self.active_sm_count = len(self.coding_sm) self._detected_charset = None self._detected_language = None @property def charset_name(self): return self._detected_charset @property def language(self): return self._detected_language def get_confidence(self): if self._detected_charset: return 0.99 else: return 0.00 def feed(self, byte_str): for c in byte_str: for coding_sm in self.coding_sm: if not coding_sm or not coding_sm.active: continue coding_state = coding_sm.next_state(c) if coding_state == MachineState.ERROR: coding_sm.active = False self.active_sm_count -= 1 if self.active_sm_count <= 0: self._state = ProbingState.NOT_ME return self.state elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT self._detected_charset = coding_sm.get_coding_state_machine() self._detected_language = coding_sm.language return self.state return self.state chardet/langturkishmodel.py000064400000025536152347724720012134 0ustar00# -*- coding: utf-8 -*- ######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Özgür Baskın - Turkish Language Model # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: Latin5_TurkishCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255, 23, 37, 47, 39, 29, 52, 36, 45, 53, 60, 16, 49, 20, 46, 42, 48, 69, 44, 35, 31, 51, 38, 62, 65, 43, 56,255,255,255,255,255, 255, 1, 21, 28, 12, 2, 18, 27, 25, 3, 24, 10, 5, 13, 4, 15, 26, 64, 7, 8, 9, 14, 32, 57, 58, 11, 22,255,255,255,255,255, 180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165, 164,163,162,161,160,159,101,158,157,156,155,154,153,152,151,106, 150,149,148,147,146,145,144,100,143,142,141,140,139,138,137,136, 94, 80, 93,135,105,134,133, 63,132,131,130,129,128,127,126,125, 124,104, 73, 99, 79, 85,123, 54,122, 98, 92,121,120, 91,103,119, 68,118,117, 97,116,115, 50, 90,114,113,112,111, 55, 41, 40, 86, 89, 70, 59, 78, 71, 82, 88, 33, 77, 66, 84, 83,110, 75, 61, 96, 30, 67,109, 74, 87,102, 34, 95, 81,108, 76, 72, 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,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ) Latin5TurkishModel = { 'char_to_order_map': Latin5_TurkishCharToOrderMap, 'precedence_matrix': TurkishLangModel, 'typical_positive_ratio': 0.970290, 'keep_english_letter': True, 'charset_name': "ISO-8859-9", 'language': 'Turkish', } chardet/latin1prober.py000064400000012372152347724720011154 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState FREQ_CAT_NUM = 4 UDF = 0 # undefined OTH = 1 # other ASC = 2 # ascii capital letter ASS = 3 # ascii small letter ACV = 4 # accent capital vowel ACO = 5 # accent capital other ASV = 6 # accent small vowel ASO = 7 # accent small other CLASS_NUM = 8 # total classes Latin1_CharToClass = ( OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 00 - 07 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 08 - 0F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 10 - 17 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 18 - 1F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 20 - 27 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 28 - 2F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 30 - 37 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 38 - 3F OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 40 - 47 ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 48 - 4F ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 50 - 57 ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH, # 58 - 5F OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 60 - 67 ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 68 - 6F ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 70 - 77 ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH, # 78 - 7F OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH, # 80 - 87 OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF, # 88 - 8F UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 90 - 97 OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO, # 98 - 9F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A0 - A7 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A8 - AF OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B0 - B7 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B8 - BF ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO, # C0 - C7 ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV, # C8 - CF ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH, # D0 - D7 ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO, # D8 - DF ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO, # E0 - E7 ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV, # E8 - EF ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH, # F0 - F7 ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO, # F8 - FF ) # 0 : illegal # 1 : very unlikely # 2 : normal # 3 : very likely Latin1ClassModel = ( # UDF OTH ASC ASS ACV ACO ASV ASO 0, 0, 0, 0, 0, 0, 0, 0, # UDF 0, 3, 3, 3, 3, 3, 3, 3, # OTH 0, 3, 3, 3, 3, 3, 3, 3, # ASC 0, 3, 3, 3, 1, 1, 3, 3, # ASS 0, 3, 3, 3, 1, 2, 1, 2, # ACV 0, 3, 3, 3, 3, 3, 3, 3, # ACO 0, 3, 1, 3, 1, 1, 1, 3, # ASV 0, 3, 1, 3, 1, 1, 3, 3, # ASO ) class Latin1Prober(CharSetProber): def __init__(self): super(Latin1Prober, self).__init__() self._last_char_class = None self._freq_counter = None self.reset() def reset(self): self._last_char_class = OTH self._freq_counter = [0] * FREQ_CAT_NUM CharSetProber.reset(self) @property def charset_name(self): return "ISO-8859-1" @property def language(self): return "" def feed(self, byte_str): byte_str = self.filter_with_english_letters(byte_str) for c in byte_str: char_class = Latin1_CharToClass[c] freq = Latin1ClassModel[(self._last_char_class * CLASS_NUM) + char_class] if freq == 0: self._state = ProbingState.NOT_ME break self._freq_counter[freq] += 1 self._last_char_class = char_class return self.state def get_confidence(self): if self.state == ProbingState.NOT_ME: return 0.01 total = sum(self._freq_counter) if total < 0.01: confidence = 0.0 else: confidence = ((self._freq_counter[3] - self._freq_counter[1] * 20.0) / total) if confidence < 0.0: confidence = 0.0 # lower the confidence of latin1 so that other more accurate # detector can take priority. confidence = confidence * 0.73 return confidence chardet/euckrprober.py000064400000003324152347724720011072 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCKRDistributionAnalysis from .mbcssm import EUCKR_SM_MODEL class EUCKRProber(MultiByteCharSetProber): def __init__(self): super(EUCKRProber, self).__init__() self.coding_sm = CodingStateMachine(EUCKR_SM_MODEL) self.distribution_analyzer = EUCKRDistributionAnalysis() self.reset() @property def charset_name(self): return "EUC-KR" @property def language(self): return "Korean" chardet/version.py000064400000000362152347724720010233 0ustar00""" This module exists only to simplify retrieving the version number of chardet from within setup.py and from chardet subpackages. :author: Dan Blanchard (dan.blanchard@gmail.com) """ __version__ = "3.0.4" VERSION = __version__.split('.') chardet/compat.py000064400000002156152347724720010034 0ustar00######################## BEGIN LICENSE BLOCK ######################## # Contributor(s): # Dan Blanchard # Ian Cordasco # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### import sys if sys.version_info < (3, 0): PY2 = True PY3 = False base_str = (str, unicode) text_type = unicode else: PY2 = False PY3 = True base_str = (bytes, str) text_type = str chardet/langbulgarianmodel.py000064400000031047152347724720012401 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: # this table is modified base on win1251BulgarianCharToOrderMap, so # only number <64 is sure valid Latin5_BulgarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, # 40 110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, # 50 253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, # 60 116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, # 70 194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209, # 80 210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225, # 90 81,226,227,228,229,230,105,231,232,233,234,235,236, 45,237,238, # a0 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, # b0 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,239, 67,240, 60, 56, # c0 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # d0 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, # e0 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253, # f0 ) win1251BulgarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, # 40 110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, # 50 253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, # 60 116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, # 70 206,207,208,209,210,211,212,213,120,214,215,216,217,218,219,220, # 80 221, 78, 64, 83,121, 98,117,105,222,223,224,225,226,227,228,229, # 90 88,230,231,232,233,122, 89,106,234,235,236,237,238, 45,239,240, # a0 73, 80,118,114,241,242,243,244,245, 62, 58,246,247,248,249,250, # b0 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, # c0 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,252, 60, 56, # d0 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # e0 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,253, 42, 16, # f0 ) # Model Table: # total sequences: 100% # first 512 sequences: 96.9392% # first 1024 sequences:3.0618% # rest sequences: 0.2992% # negative sequences: 0.0020% BulgarianLangModel = ( 0,3,3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,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, ) Latin5BulgarianModel = { 'char_to_order_map': Latin5_BulgarianCharToOrderMap, 'precedence_matrix': BulgarianLangModel, 'typical_positive_ratio': 0.969392, 'keep_english_letter': False, 'charset_name': "ISO-8859-5", 'language': 'Bulgairan', } Win1251BulgarianModel = { 'char_to_order_map': win1251BulgarianCharToOrderMap, 'precedence_matrix': BulgarianLangModel, 'typical_positive_ratio': 0.969392, 'keep_english_letter': False, 'charset_name': "windows-1251", 'language': 'Bulgarian', } chardet/cli/chardetect.py000064400000005326152347724720011430 0ustar00#!/usr/bin/env python """ Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. """ from __future__ import absolute_import, print_function, unicode_literals import argparse import sys from pip._vendor.chardet import __version__ from pip._vendor.chardet.compat import PY2 from pip._vendor.chardet.universaldetector import UniversalDetector def description_of(lines, name='stdin'): """ Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str """ u = UniversalDetector() for line in lines: line = bytearray(line) u.feed(line) # shortcut out of the loop to save reading further - particularly useful if we read a BOM. if u.done: break u.close() result = u.result if PY2: name = name.decode(sys.getfilesystemencoding(), 'ignore') if result['encoding']: return '{0}: {1} with confidence {2}'.format(name, result['encoding'], result['confidence']) else: return '{0}: no result'.format(name) def main(argv=None): """ Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str """ # Get command line arguments parser = argparse.ArgumentParser( description="Takes one or more file paths and reports their detected \ encodings") parser.add_argument('input', help='File whose encoding we would like to determine. \ (default: stdin)', type=argparse.FileType('rb'), nargs='*', default=[sys.stdin if PY2 else sys.stdin.buffer]) parser.add_argument('--version', action='version', version='%(prog)s {0}'.format(__version__)) args = parser.parse_args(argv) for f in args.input: if f.isatty(): print("You are running chardetect interactively. Press " + "CTRL-D twice at the start of a blank line to signal the " + "end of your input. If you want help, run chardetect " + "--help\n", file=sys.stderr) print(description_of(f, f.name)) if __name__ == '__main__': main() chardet/cli/__pycache__/chardetect.cpython-36.opt-1.pyc000064400000005671152347724720016656 0ustar003 Pf @srdZddlmZmZmZddlZddlZddlmZddl m Z ddl m Z d dd Z dd d Zed krnedS)a Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. )absolute_importprint_functionunicode_literalsN) __version__)PY2)UniversalDetectorstdincCs|t}x&|D]}t|}|j||jr Pq W|j|j}trP|jtj d}|drndj ||d|dSdj |SdS)z Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str ignoreencodingz{0}: {1} with confidence {2}Z confidencez{0}: no resultN) r bytearrayZfeeddonecloseresultrdecodesysgetfilesystemencodingformat)linesnameulinerr /usr/lib/python3.6/chardetect.pydescription_ofs     rcCstjdd}|jddtjddtr(tjntjjgd|jdd d jt d |j |}x4|j D]*}|j rxt dtjdt t||jq^WdS)z Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str zVTakes one or more file paths and reports their detected encodings) descriptioninputz^File whose encoding we would like to determine. (default: stdin)rb*)helptypenargsdefaultz --versionversionz %(prog)s {0})actionr"z0You are running chardetect interactively. Press z8CTRL-D twice at the start of a blank line to signal the z4end of your input. If you want help, run chardetect z--help )fileNzhYou are running chardetect interactively. Press CTRL-D twice at the start of a blank line to signal the zYou are running chardetect interactively. Press CTRL-D twice at the start of a blank line to signal the end of your input. If you want help, run chardetect zYou are running chardetect interactively. Press CTRL-D twice at the start of a blank line to signal the end of your input. If you want help, run chardetect --help )argparseArgumentParser add_argumentZFileTyperrrbufferrr parse_argsrisattyprintstderrrr)argvparserargsfrrrmain6s     r1__main__)r)N)__doc__Z __future__rrrr%rZchardetrZchardet.compatrZchardet.universaldetectorrrr1__name__rrrrs     chardet/cli/__pycache__/__init__.cpython-36.pyc000064400000000161152347724720015335 0ustar003 Pf@sdS)Nrrr/usr/lib/python3.6/__init__.pyschardet/cli/__pycache__/chardetect.cpython-36.pyc000064400000005671152347724720015717 0ustar003 Pf @srdZddlmZmZmZddlZddlZddlmZddl m Z ddl m Z d dd Z dd d Zed krnedS)a Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. )absolute_importprint_functionunicode_literalsN) __version__)PY2)UniversalDetectorstdincCs|t}x&|D]}t|}|j||jr Pq W|j|j}trP|jtj d}|drndj ||d|dSdj |SdS)z Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str ignoreencodingz{0}: {1} with confidence {2}Z confidencez{0}: no resultN) r bytearrayZfeeddonecloseresultrdecodesysgetfilesystemencodingformat)linesnameulinerr /usr/lib/python3.6/chardetect.pydescription_ofs     rcCstjdd}|jddtjddtr(tjntjjgd|jdd d jt d |j |}x4|j D]*}|j rxt dtjdt t||jq^WdS)z Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str zVTakes one or more file paths and reports their detected encodings) descriptioninputz^File whose encoding we would like to determine. (default: stdin)rb*)helptypenargsdefaultz --versionversionz %(prog)s {0})actionr"z0You are running chardetect interactively. Press z8CTRL-D twice at the start of a blank line to signal the z4end of your input. If you want help, run chardetect z--help )fileNzhYou are running chardetect interactively. Press CTRL-D twice at the start of a blank line to signal the zYou are running chardetect interactively. Press CTRL-D twice at the start of a blank line to signal the end of your input. If you want help, run chardetect zYou are running chardetect interactively. Press CTRL-D twice at the start of a blank line to signal the end of your input. If you want help, run chardetect --help )argparseArgumentParser add_argumentZFileTyperrrbufferrr parse_argsrisattyprintstderrrr)argvparserargsfrrrmain6s     r1__main__)r)N)__doc__Z __future__rrrr%rZchardetrZchardet.compatrZchardet.universaldetectorrrr1__name__rrrrs     chardet/cli/__pycache__/__init__.cpython-36.opt-1.pyc000064400000000161152347724720016274 0ustar003 Pf@sdS)Nrrr/usr/lib/python3.6/__init__.pyschardet/cli/__init__.py000064400000000001152347724720011042 0ustar00 chardet/mbcharsetprober.py000064400000006525152347724720011737 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # Proofpoint, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState, MachineState class MultiByteCharSetProber(CharSetProber): """ MultiByteCharSetProber """ def __init__(self, lang_filter=None): super(MultiByteCharSetProber, self).__init__(lang_filter=lang_filter) self.distribution_analyzer = None self.coding_sm = None self._last_char = [0, 0] def reset(self): super(MultiByteCharSetProber, self).reset() if self.coding_sm: self.coding_sm.reset() if self.distribution_analyzer: self.distribution_analyzer.reset() self._last_char = [0, 0] @property def charset_name(self): raise NotImplementedError @property def language(self): raise NotImplementedError def feed(self, byte_str): for i in range(len(byte_str)): coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: self.logger.debug('%s %s prober hit error at byte %s', self.charset_name, self.language, i) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT break elif coding_state == MachineState.START: char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] self.distribution_analyzer.feed(self._last_char, char_len) else: self.distribution_analyzer.feed(byte_str[i - 1:i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: if (self.distribution_analyzer.got_enough_data() and (self.get_confidence() > self.SHORTCUT_THRESHOLD)): self._state = ProbingState.FOUND_IT return self.state def get_confidence(self): return self.distribution_analyzer.get_confidence() chardet/big5freq.py000064400000075026152347724720010263 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # Big5 frequency table # by Taiwan's Mandarin Promotion Council # # # 128 --> 0.42261 # 256 --> 0.57851 # 512 --> 0.74851 # 1024 --> 0.89384 # 2048 --> 0.97583 # # Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98 # Random Distribution Ration = 512/(5401-512)=0.105 # # Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75 #Char to FreqOrder table BIG5_TABLE_SIZE = 5376 BIG5_CHAR_TO_FREQ_ORDER = ( 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, # 16 3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, # 32 1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, # 48 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, # 64 3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, # 80 4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, # 96 5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, # 112 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, # 128 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, # 144 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, # 160 2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, # 176 1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, # 192 3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, # 208 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, # 224 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, # 240 3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, # 256 2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, # 272 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, # 288 3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, # 304 1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, # 320 5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, # 336 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, # 352 5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, # 368 1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, # 384 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, # 400 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, # 416 3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, # 432 3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, # 448 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, # 464 2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, # 480 2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, # 496 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, # 512 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, # 528 3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, # 544 1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, # 560 1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, # 576 1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, # 592 2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, # 608 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, # 624 4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, # 640 1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, # 656 5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, # 672 2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, # 688 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, # 704 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, # 720 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, # 736 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, # 752 5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, # 768 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, # 784 1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, # 800 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, # 816 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, # 832 5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, # 848 1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, # 864 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, # 880 3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, # 896 4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, # 912 3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, # 928 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, # 944 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, # 960 1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, # 976 4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, # 992 3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, # 1008 3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, # 1024 2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, # 1040 5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, # 1056 3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, # 1072 5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, # 1088 1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, # 1104 2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, # 1120 1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, # 1136 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, # 1152 1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, # 1168 4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, # 1184 3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, # 1200 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, # 1216 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, # 1232 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, # 1248 2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, # 1264 5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, # 1280 1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, # 1296 2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, # 1312 1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, # 1328 1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, # 1344 5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, # 1360 5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, # 1376 5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, # 1392 3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, # 1408 4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, # 1424 4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, # 1440 2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, # 1456 5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, # 1472 3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, # 1488 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, # 1504 5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, # 1520 5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, # 1536 1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, # 1552 2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, # 1568 3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, # 1584 4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, # 1600 5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, # 1616 3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, # 1632 4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, # 1648 1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, # 1664 1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, # 1680 4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, # 1696 1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, # 1712 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, # 1728 1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, # 1744 1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, # 1760 3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, # 1776 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, # 1792 5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, # 1808 2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, # 1824 1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, # 1840 1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, # 1856 5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, # 1872 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, # 1888 4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, # 1904 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, # 1920 2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, # 1936 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, # 1952 1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, # 1968 1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, # 1984 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, # 2000 4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, # 2016 4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, # 2032 1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, # 2048 3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, # 2064 5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, # 2080 5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, # 2096 1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, # 2112 2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, # 2128 1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, # 2144 3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, # 2160 2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, # 2176 3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, # 2192 2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, # 2208 4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, # 2224 4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, # 2240 3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, # 2256 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, # 2272 3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, # 2288 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, # 2304 3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, # 2320 4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, # 2336 3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, # 2352 1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, # 2368 5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, # 2384 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, # 2400 5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, # 2416 1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, # 2432 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, # 2448 4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, # 2464 4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, # 2480 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, # 2496 2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, # 2512 2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, # 2528 3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, # 2544 1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, # 2560 4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, # 2576 2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, # 2592 1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, # 2608 1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, # 2624 2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, # 2640 3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, # 2656 1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, # 2672 5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, # 2688 1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, # 2704 4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, # 2720 1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, # 2736 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, # 2752 1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, # 2768 4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, # 2784 4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, # 2800 2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, # 2816 1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, # 2832 4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, # 2848 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, # 2864 5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, # 2880 2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, # 2896 3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, # 2912 4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, # 2928 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, # 2944 5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, # 2960 5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, # 2976 1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, # 2992 4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, # 3008 4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, # 3024 2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, # 3040 3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, # 3056 3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, # 3072 2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, # 3088 1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, # 3104 4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, # 3120 3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, # 3136 3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, # 3152 2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, # 3168 4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, # 3184 5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, # 3200 3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, # 3216 2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, # 3232 3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, # 3248 1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, # 3264 2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, # 3280 3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, # 3296 4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, # 3312 2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, # 3328 2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, # 3344 5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, # 3360 1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, # 3376 2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, # 3392 1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, # 3408 3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, # 3424 4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, # 3440 2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, # 3456 3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, # 3472 3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, # 3488 2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, # 3504 4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, # 3520 2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, # 3536 3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, # 3552 4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, # 3568 5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, # 3584 3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, # 3600 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, # 3616 1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, # 3632 4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, # 3648 1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, # 3664 4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, # 3680 5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, # 3696 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, # 3712 5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, # 3728 5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, # 3744 2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, # 3760 3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, # 3776 2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, # 3792 2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, # 3808 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, # 3824 1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, # 3840 4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, # 3856 3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, # 3872 3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, # 3888 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, # 3904 2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, # 3920 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, # 3936 2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, # 3952 4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, # 3968 1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, # 3984 4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, # 4000 1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, # 4016 3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, # 4032 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, # 4048 3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, # 4064 5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, # 4080 5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, # 4096 3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, # 4112 3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, # 4128 1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, # 4144 2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, # 4160 5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, # 4176 1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, # 4192 1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, # 4208 3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, # 4224 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, # 4240 1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, # 4256 4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, # 4272 5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, # 4288 2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, # 4304 3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, # 4320 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, # 4336 1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, # 4352 2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, # 4368 2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, # 4384 5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, # 4400 5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, # 4416 5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, # 4432 2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, # 4448 2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, # 4464 1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, # 4480 4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, # 4496 3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, # 4512 3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, # 4528 4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, # 4544 4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, # 4560 2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, # 4576 2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, # 4592 5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, # 4608 4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, # 4624 5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, # 4640 4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, # 4656 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, # 4672 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, # 4688 1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, # 4704 3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, # 4720 4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, # 4736 1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, # 4752 5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, # 4768 2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, # 4784 2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, # 4800 3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, # 4816 5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, # 4832 1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, # 4848 3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, # 4864 5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, # 4880 1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, # 4896 5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, # 4912 2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, # 4928 3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, # 4944 2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, # 4960 3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, # 4976 3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, # 4992 3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, # 5008 4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, # 5024 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, # 5040 2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, # 5056 4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, # 5072 3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, # 5088 5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, # 5104 1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, # 5120 5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, # 5136 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, # 5152 1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, # 5168 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, # 5184 4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, # 5200 1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, # 5216 4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, # 5232 1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, # 5248 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, # 5264 3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, # 5280 4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, # 5296 5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, # 5312 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, # 5328 3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, # 5344 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360 2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376 ) chardet/langthaimodel.py000064400000026032152347724720011360 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # The following result for thai was collected from a limited sample (1M). # Character Mapping Table: TIS620CharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,182,106,107,100,183,184,185,101, 94,186,187,108,109,110,111, # 40 188,189,190, 89, 95,112,113,191,192,193,194,253,253,253,253,253, # 50 253, 64, 72, 73,114, 74,115,116,102, 81,201,117, 90,103, 78, 82, # 60 96,202, 91, 79, 84,104,105, 97, 98, 92,203,253,253,253,253,253, # 70 209,210,211,212,213, 88,214,215,216,217,218,219,220,118,221,222, 223,224, 99, 85, 83,225,226,227,228,229,230,231,232,233,234,235, 236, 5, 30,237, 24,238, 75, 8, 26, 52, 34, 51,119, 47, 58, 57, 49, 53, 55, 43, 20, 19, 44, 14, 48, 3, 17, 25, 39, 62, 31, 54, 45, 9, 16, 2, 61, 15,239, 12, 42, 46, 18, 21, 76, 4, 66, 63, 22, 10, 1, 36, 23, 13, 40, 27, 32, 35, 86,240,241,242,243,244, 11, 28, 41, 29, 33,245, 50, 37, 6, 7, 67, 77, 38, 93,246,247, 68, 56, 59, 65, 69, 60, 70, 80, 71, 87,248,249,250,251,252,253, ) # Model Table: # total sequences: 100% # first 512 sequences: 92.6386% # first 1024 sequences:7.3177% # rest sequences: 1.0230% # negative sequences: 0.0436% ThaiLangModel = ( 0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,3,3, 0,3,3,0,0,0,1,3,0,3,3,2,3,3,0,1,2,3,3,3,3,0,2,0,2,0,0,3,2,1,2,2, 3,0,3,3,2,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,0,3,2,3,0,2,2,2,3, 0,2,3,0,0,0,0,1,0,1,2,3,1,1,3,2,2,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,3,3,2,3,2,3,3,2,2,2, 3,1,2,3,0,3,3,2,2,1,2,3,3,1,2,0,1,3,0,1,0,0,1,0,0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0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,3,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0, 1,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,1,0,0,2,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ) TIS620ThaiModel = { 'char_to_order_map': TIS620CharToOrderMap, 'precedence_matrix': ThaiLangModel, 'typical_positive_ratio': 0.926386, 'keep_english_letter': False, 'charset_name': "TIS-620", 'language': 'Thai', } chardet/hebrewprober.py000064400000033016152347724720011236 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Shy Shalom # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .enums import ProbingState # This prober doesn't actually recognize a language or a charset. # It is a helper prober for the use of the Hebrew model probers ### General ideas of the Hebrew charset recognition ### # # Four main charsets exist in Hebrew: # "ISO-8859-8" - Visual Hebrew # "windows-1255" - Logical Hebrew # "ISO-8859-8-I" - Logical Hebrew # "x-mac-hebrew" - ?? Logical Hebrew ?? # # Both "ISO" charsets use a completely identical set of code points, whereas # "windows-1255" and "x-mac-hebrew" are two different proper supersets of # these code points. windows-1255 defines additional characters in the range # 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific # diacritics and additional 'Yiddish' ligature letters in the range 0xc0-0xd6. # x-mac-hebrew defines similar additional code points but with a different # mapping. # # As far as an average Hebrew text with no diacritics is concerned, all four # charsets are identical with respect to code points. Meaning that for the # main Hebrew alphabet, all four map the same values to all 27 Hebrew letters # (including final letters). # # The dominant difference between these charsets is their directionality. # "Visual" directionality means that the text is ordered as if the renderer is # not aware of a BIDI rendering algorithm. The renderer sees the text and # draws it from left to right. The text itself when ordered naturally is read # backwards. A buffer of Visual Hebrew generally looks like so: # "[last word of first line spelled backwards] [whole line ordered backwards # and spelled backwards] [first word of first line spelled backwards] # [end of line] [last word of second line] ... etc' " # adding punctuation marks, numbers and English text to visual text is # naturally also "visual" and from left to right. # # "Logical" directionality means the text is ordered "naturally" according to # the order it is read. It is the responsibility of the renderer to display # the text from right to left. A BIDI algorithm is used to place general # punctuation marks, numbers and English text in the text. # # Texts in x-mac-hebrew are almost impossible to find on the Internet. From # what little evidence I could find, it seems that its general directionality # is Logical. # # To sum up all of the above, the Hebrew probing mechanism knows about two # charsets: # Visual Hebrew - "ISO-8859-8" - backwards text - Words and sentences are # backwards while line order is natural. For charset recognition purposes # the line order is unimportant (In fact, for this implementation, even # word order is unimportant). # Logical Hebrew - "windows-1255" - normal, naturally ordered text. # # "ISO-8859-8-I" is a subset of windows-1255 and doesn't need to be # specifically identified. # "x-mac-hebrew" is also identified as windows-1255. A text in x-mac-hebrew # that contain special punctuation marks or diacritics is displayed with # some unconverted characters showing as question marks. This problem might # be corrected using another model prober for x-mac-hebrew. Due to the fact # that x-mac-hebrew texts are so rare, writing another model prober isn't # worth the effort and performance hit. # #### The Prober #### # # The prober is divided between two SBCharSetProbers and a HebrewProber, # all of which are managed, created, fed data, inquired and deleted by the # SBCSGroupProber. The two SBCharSetProbers identify that the text is in # fact some kind of Hebrew, Logical or Visual. The final decision about which # one is it is made by the HebrewProber by combining final-letter scores # with the scores of the two SBCharSetProbers to produce a final answer. # # The SBCSGroupProber is responsible for stripping the original text of HTML # tags, English characters, numbers, low-ASCII punctuation characters, spaces # and new lines. It reduces any sequence of such characters to a single space. # The buffer fed to each prober in the SBCS group prober is pure text in # high-ASCII. # The two SBCharSetProbers (model probers) share the same language model: # Win1255Model. # The first SBCharSetProber uses the model normally as any other # SBCharSetProber does, to recognize windows-1255, upon which this model was # built. The second SBCharSetProber is told to make the pair-of-letter # lookup in the language model backwards. This in practice exactly simulates # a visual Hebrew model using the windows-1255 logical Hebrew model. # # The HebrewProber is not using any language model. All it does is look for # final-letter evidence suggesting the text is either logical Hebrew or visual # Hebrew. Disjointed from the model probers, the results of the HebrewProber # alone are meaningless. HebrewProber always returns 0.00 as confidence # since it never identifies a charset by itself. Instead, the pointer to the # HebrewProber is passed to the model probers as a helper "Name Prober". # When the Group prober receives a positive identification from any prober, # it asks for the name of the charset identified. If the prober queried is a # Hebrew model prober, the model prober forwards the call to the # HebrewProber to make the final decision. In the HebrewProber, the # decision is made according to the final-letters scores maintained and Both # model probers scores. The answer is returned in the form of the name of the # charset identified, either "windows-1255" or "ISO-8859-8". class HebrewProber(CharSetProber): # windows-1255 / ISO-8859-8 code points of interest FINAL_KAF = 0xea NORMAL_KAF = 0xeb FINAL_MEM = 0xed NORMAL_MEM = 0xee FINAL_NUN = 0xef NORMAL_NUN = 0xf0 FINAL_PE = 0xf3 NORMAL_PE = 0xf4 FINAL_TSADI = 0xf5 NORMAL_TSADI = 0xf6 # Minimum Visual vs Logical final letter score difference. # If the difference is below this, don't rely solely on the final letter score # distance. MIN_FINAL_CHAR_DISTANCE = 5 # Minimum Visual vs Logical model score difference. # If the difference is below this, don't rely at all on the model score # distance. MIN_MODEL_DISTANCE = 0.01 VISUAL_HEBREW_NAME = "ISO-8859-8" LOGICAL_HEBREW_NAME = "windows-1255" def __init__(self): super(HebrewProber, self).__init__() self._final_char_logical_score = None self._final_char_visual_score = None self._prev = None self._before_prev = None self._logical_prober = None self._visual_prober = None self.reset() def reset(self): self._final_char_logical_score = 0 self._final_char_visual_score = 0 # The two last characters seen in the previous buffer, # mPrev and mBeforePrev are initialized to space in order to simulate # a word delimiter at the beginning of the data self._prev = ' ' self._before_prev = ' ' # These probers are owned by the group prober. def set_model_probers(self, logicalProber, visualProber): self._logical_prober = logicalProber self._visual_prober = visualProber def is_final(self, c): return c in [self.FINAL_KAF, self.FINAL_MEM, self.FINAL_NUN, self.FINAL_PE, self.FINAL_TSADI] def is_non_final(self, c): # The normal Tsadi is not a good Non-Final letter due to words like # 'lechotet' (to chat) containing an apostrophe after the tsadi. This # apostrophe is converted to a space in FilterWithoutEnglishLetters # causing the Non-Final tsadi to appear at an end of a word even # though this is not the case in the original text. # The letters Pe and Kaf rarely display a related behavior of not being # a good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' # for example legally end with a Non-Final Pe or Kaf. However, the # benefit of these letters as Non-Final letters outweighs the damage # since these words are quite rare. return c in [self.NORMAL_KAF, self.NORMAL_MEM, self.NORMAL_NUN, self.NORMAL_PE] def feed(self, byte_str): # Final letter analysis for logical-visual decision. # Look for evidence that the received buffer is either logical Hebrew # or visual Hebrew. # The following cases are checked: # 1) A word longer than 1 letter, ending with a final letter. This is # an indication that the text is laid out "naturally" since the # final letter really appears at the end. +1 for logical score. # 2) A word longer than 1 letter, ending with a Non-Final letter. In # normal Hebrew, words ending with Kaf, Mem, Nun, Pe or Tsadi, # should not end with the Non-Final form of that letter. Exceptions # to this rule are mentioned above in isNonFinal(). This is an # indication that the text is laid out backwards. +1 for visual # score # 3) A word longer than 1 letter, starting with a final letter. Final # letters should not appear at the beginning of a word. This is an # indication that the text is laid out backwards. +1 for visual # score. # # The visual score and logical score are accumulated throughout the # text and are finally checked against each other in GetCharSetName(). # No checking for final letters in the middle of words is done since # that case is not an indication for either Logical or Visual text. # # We automatically filter out all 7-bit characters (replace them with # spaces) so the word boundary detection works properly. [MAP] if self.state == ProbingState.NOT_ME: # Both model probers say it's not them. No reason to continue. return ProbingState.NOT_ME byte_str = self.filter_high_byte_only(byte_str) for cur in byte_str: if cur == ' ': # We stand on a space - a word just ended if self._before_prev != ' ': # next-to-last char was not a space so self._prev is not a # 1 letter word if self.is_final(self._prev): # case (1) [-2:not space][-1:final letter][cur:space] self._final_char_logical_score += 1 elif self.is_non_final(self._prev): # case (2) [-2:not space][-1:Non-Final letter][ # cur:space] self._final_char_visual_score += 1 else: # Not standing on a space if ((self._before_prev == ' ') and (self.is_final(self._prev)) and (cur != ' ')): # case (3) [-2:space][-1:final letter][cur:not space] self._final_char_visual_score += 1 self._before_prev = self._prev self._prev = cur # Forever detecting, till the end or until both model probers return # ProbingState.NOT_ME (handled above) return ProbingState.DETECTING @property def charset_name(self): # Make the decision: is it Logical or Visual? # If the final letter score distance is dominant enough, rely on it. finalsub = self._final_char_logical_score - self._final_char_visual_score if finalsub >= self.MIN_FINAL_CHAR_DISTANCE: return self.LOGICAL_HEBREW_NAME if finalsub <= -self.MIN_FINAL_CHAR_DISTANCE: return self.VISUAL_HEBREW_NAME # It's not dominant enough, try to rely on the model scores instead. modelsub = (self._logical_prober.get_confidence() - self._visual_prober.get_confidence()) if modelsub > self.MIN_MODEL_DISTANCE: return self.LOGICAL_HEBREW_NAME if modelsub < -self.MIN_MODEL_DISTANCE: return self.VISUAL_HEBREW_NAME # Still no good, back to final letter distance, maybe it'll save the # day. if finalsub < 0.0: return self.VISUAL_HEBREW_NAME # (finalsub > 0 - Logical) or (don't know what to do) default to # Logical. return self.LOGICAL_HEBREW_NAME @property def language(self): return 'Hebrew' @property def state(self): # Remain active as long as any of the model probers are active. if (self._logical_prober.state == ProbingState.NOT_ME) and \ (self._visual_prober.state == ProbingState.NOT_ME): return ProbingState.NOT_ME return ProbingState.DETECTING chardet/escsm.py000064400000024416152347724720007666 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .enums import MachineState HZ_CLS = ( 1,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,0,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,0,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,4,0,5,2,0, # 78 - 7f 1,1,1,1,1,1,1,1, # 80 - 87 1,1,1,1,1,1,1,1, # 88 - 8f 1,1,1,1,1,1,1,1, # 90 - 97 1,1,1,1,1,1,1,1, # 98 - 9f 1,1,1,1,1,1,1,1, # a0 - a7 1,1,1,1,1,1,1,1, # a8 - af 1,1,1,1,1,1,1,1, # b0 - b7 1,1,1,1,1,1,1,1, # b8 - bf 1,1,1,1,1,1,1,1, # c0 - c7 1,1,1,1,1,1,1,1, # c8 - cf 1,1,1,1,1,1,1,1, # d0 - d7 1,1,1,1,1,1,1,1, # d8 - df 1,1,1,1,1,1,1,1, # e0 - e7 1,1,1,1,1,1,1,1, # e8 - ef 1,1,1,1,1,1,1,1, # f0 - f7 1,1,1,1,1,1,1,1, # f8 - ff ) HZ_ST = ( MachineState.START,MachineState.ERROR, 3,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START, 4,MachineState.ERROR,# 10-17 5,MachineState.ERROR, 6,MachineState.ERROR, 5, 5, 4,MachineState.ERROR,# 18-1f 4,MachineState.ERROR, 4, 4, 4,MachineState.ERROR, 4,MachineState.ERROR,# 20-27 4,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 28-2f ) HZ_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0) HZ_SM_MODEL = {'class_table': HZ_CLS, 'class_factor': 6, 'state_table': HZ_ST, 'char_len_table': HZ_CHAR_LEN_TABLE, 'name': "HZ-GB-2312", 'language': 'Chinese'} ISO2022CN_CLS = ( 2,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,0,0,0,0, # 20 - 27 0,3,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,4,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 2,2,2,2,2,2,2,2, # 80 - 87 2,2,2,2,2,2,2,2, # 88 - 8f 2,2,2,2,2,2,2,2, # 90 - 97 2,2,2,2,2,2,2,2, # 98 - 9f 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,2, # f8 - ff ) ISO2022CN_ST = ( MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07 MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,# 18-1f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 20-27 5, 6,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 28-2f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 30-37 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,# 38-3f ) ISO2022CN_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0) ISO2022CN_SM_MODEL = {'class_table': ISO2022CN_CLS, 'class_factor': 9, 'state_table': ISO2022CN_ST, 'char_len_table': ISO2022CN_CHAR_LEN_TABLE, 'name': "ISO-2022-CN", 'language': 'Chinese'} ISO2022JP_CLS = ( 2,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,2,2, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,7,0,0,0, # 20 - 27 3,0,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 6,0,4,0,8,0,0,0, # 40 - 47 0,9,5,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 2,2,2,2,2,2,2,2, # 80 - 87 2,2,2,2,2,2,2,2, # 88 - 8f 2,2,2,2,2,2,2,2, # 90 - 97 2,2,2,2,2,2,2,2, # 98 - 9f 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,2, # f8 - ff ) ISO2022JP_ST = ( MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07 MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17 MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,# 18-1f MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 20-27 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 6,MachineState.ITS_ME,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,# 28-2f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,# 30-37 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 38-3f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,MachineState.START,# 40-47 ) ISO2022JP_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) ISO2022JP_SM_MODEL = {'class_table': ISO2022JP_CLS, 'class_factor': 10, 'state_table': ISO2022JP_ST, 'char_len_table': ISO2022JP_CHAR_LEN_TABLE, 'name': "ISO-2022-JP", 'language': 'Japanese'} ISO2022KR_CLS = ( 2,0,0,0,0,0,0,0, # 00 - 07 0,0,0,0,0,0,0,0, # 08 - 0f 0,0,0,0,0,0,0,0, # 10 - 17 0,0,0,1,0,0,0,0, # 18 - 1f 0,0,0,0,3,0,0,0, # 20 - 27 0,4,0,0,0,0,0,0, # 28 - 2f 0,0,0,0,0,0,0,0, # 30 - 37 0,0,0,0,0,0,0,0, # 38 - 3f 0,0,0,5,0,0,0,0, # 40 - 47 0,0,0,0,0,0,0,0, # 48 - 4f 0,0,0,0,0,0,0,0, # 50 - 57 0,0,0,0,0,0,0,0, # 58 - 5f 0,0,0,0,0,0,0,0, # 60 - 67 0,0,0,0,0,0,0,0, # 68 - 6f 0,0,0,0,0,0,0,0, # 70 - 77 0,0,0,0,0,0,0,0, # 78 - 7f 2,2,2,2,2,2,2,2, # 80 - 87 2,2,2,2,2,2,2,2, # 88 - 8f 2,2,2,2,2,2,2,2, # 90 - 97 2,2,2,2,2,2,2,2, # 98 - 9f 2,2,2,2,2,2,2,2, # a0 - a7 2,2,2,2,2,2,2,2, # a8 - af 2,2,2,2,2,2,2,2, # b0 - b7 2,2,2,2,2,2,2,2, # b8 - bf 2,2,2,2,2,2,2,2, # c0 - c7 2,2,2,2,2,2,2,2, # c8 - cf 2,2,2,2,2,2,2,2, # d0 - d7 2,2,2,2,2,2,2,2, # d8 - df 2,2,2,2,2,2,2,2, # e0 - e7 2,2,2,2,2,2,2,2, # e8 - ef 2,2,2,2,2,2,2,2, # f0 - f7 2,2,2,2,2,2,2,2, # f8 - ff ) ISO2022KR_ST = ( MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 10-17 MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 18-1f MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 20-27 ) ISO2022KR_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0) ISO2022KR_SM_MODEL = {'class_table': ISO2022KR_CLS, 'class_factor': 6, 'state_table': ISO2022KR_ST, 'char_len_table': ISO2022KR_CHAR_LEN_TABLE, 'name': "ISO-2022-KR", 'language': 'Korean'} chardet/jisfreq.py000064400000062261152347724720010217 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # Sampling from about 20M text materials include literature and computer technology # # Japanese frequency table, applied to both S-JIS and EUC-JP # They are sorted in order. # 128 --> 0.77094 # 256 --> 0.85710 # 512 --> 0.92635 # 1024 --> 0.97130 # 2048 --> 0.99431 # # Ideal Distribution Ratio = 0.92635 / (1-0.92635) = 12.58 # Random Distribution Ration = 512 / (2965+62+83+86-512) = 0.191 # # Typical Distribution Ratio, 25% of IDR JIS_TYPICAL_DISTRIBUTION_RATIO = 3.0 # Char to FreqOrder table , JIS_TABLE_SIZE = 4368 JIS_CHAR_TO_FREQ_ORDER = ( 40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, # 16 3511,1822,2785,4607,1193,2226,5070,4608, 171,2996,1247, 18, 179,5071, 856,1661, # 32 1262,5072, 619, 127,3431,3512,3230,1899,1700, 232, 228,1294,1298, 284, 283,2041, # 48 2042,1061,1062, 48, 49, 44, 45, 433, 434,1040,1041, 996, 787,2997,1255,4305, # 64 2108,4609,1684,1648,5073,5074,5075,5076,5077,5078,3687,5079,4610,5080,3927,3928, # 80 5081,3296,3432, 290,2285,1471,2187,5082,2580,2825,1303,2140,1739,1445,2691,3375, # 96 1691,3297,4306,4307,4611, 452,3376,1182,2713,3688,3069,4308,5083,5084,5085,5086, # 112 5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102, # 128 5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,4097,5113,5114,5115,5116,5117, # 144 5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133, # 160 5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149, # 176 5150,5151,5152,4612,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164, # 192 5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,1472, 598, 618, 820,1205, # 208 1309,1412,1858,1307,1692,5176,5177,5178,5179,5180,5181,5182,1142,1452,1234,1172, # 224 1875,2043,2149,1793,1382,2973, 925,2404,1067,1241, 960,1377,2935,1491, 919,1217, # 240 1865,2030,1406,1499,2749,4098,5183,5184,5185,5186,5187,5188,2561,4099,3117,1804, # 256 2049,3689,4309,3513,1663,5189,3166,3118,3298,1587,1561,3433,5190,3119,1625,2998, # 272 3299,4613,1766,3690,2786,4614,5191,5192,5193,5194,2161, 26,3377, 2,3929, 20, # 288 3691, 47,4100, 50, 17, 16, 35, 268, 27, 243, 42, 155, 24, 154, 29, 184, # 304 4, 91, 14, 92, 53, 396, 33, 289, 9, 37, 64, 620, 21, 39, 321, 5, # 320 12, 11, 52, 13, 3, 208, 138, 0, 7, 60, 526, 141, 151,1069, 181, 275, # 336 1591, 83, 132,1475, 126, 331, 829, 15, 69, 160, 59, 22, 157, 55,1079, 312, # 352 109, 38, 23, 25, 10, 19, 79,5195, 61, 382,1124, 8, 30,5196,5197,5198, # 368 5199,5200,5201,5202,5203,5204,5205,5206, 89, 62, 74, 34,2416, 112, 139, 196, # 384 271, 149, 84, 607, 131, 765, 46, 88, 153, 683, 76, 874, 101, 258, 57, 80, # 400 32, 364, 121,1508, 169,1547, 68, 235, 145,2999, 41, 360,3027, 70, 63, 31, # 416 43, 259, 262,1383, 99, 533, 194, 66, 93, 846, 217, 192, 56, 106, 58, 565, # 432 280, 272, 311, 256, 146, 82, 308, 71, 100, 128, 214, 655, 110, 261, 104,1140, # 448 54, 51, 36, 87, 67,3070, 185,2618,2936,2020, 28,1066,2390,2059,5207,5208, # 464 5209,5210,5211,5212,5213,5214,5215,5216,4615,5217,5218,5219,5220,5221,5222,5223, # 480 5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,3514,5237,5238, # 496 5239,5240,5241,5242,5243,5244,2297,2031,4616,4310,3692,5245,3071,5246,3598,5247, # 512 4617,3231,3515,5248,4101,4311,4618,3808,4312,4102,5249,4103,4104,3599,5250,5251, # 528 5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267, # 544 5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283, # 560 5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299, # 576 5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315, # 592 5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331, # 608 5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347, # 624 5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363, # 640 5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379, # 656 5380,5381, 363, 642,2787,2878,2788,2789,2316,3232,2317,3434,2011, 165,1942,3930, # 672 3931,3932,3933,5382,4619,5383,4620,5384,5385,5386,5387,5388,5389,5390,5391,5392, # 688 5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408, # 704 5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424, # 720 5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440, # 736 5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456, # 752 5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472, # 768 5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488, # 784 5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504, # 800 5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520, # 816 5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536, # 832 5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552, # 848 5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568, # 864 5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584, # 880 5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600, # 896 5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616, # 912 5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632, # 928 5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648, # 944 5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664, # 960 5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680, # 976 5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696, # 992 5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712, # 1008 5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728, # 1024 5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744, # 1040 5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760, # 1056 5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776, # 1072 5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792, # 1088 5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808, # 1104 5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824, # 1120 5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840, # 1136 5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856, # 1152 5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872, # 1168 5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888, # 1184 5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904, # 1200 5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, # 1216 5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936, # 1232 5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952, # 1248 5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968, # 1264 5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984, # 1280 5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000, # 1296 6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016, # 1312 6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032, # 1328 6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048, # 1344 6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064, # 1360 6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080, # 1376 6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096, # 1392 6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112, # 1408 6113,6114,2044,2060,4621, 997,1235, 473,1186,4622, 920,3378,6115,6116, 379,1108, # 1424 4313,2657,2735,3934,6117,3809, 636,3233, 573,1026,3693,3435,2974,3300,2298,4105, # 1440 854,2937,2463, 393,2581,2417, 539, 752,1280,2750,2480, 140,1161, 440, 708,1569, # 1456 665,2497,1746,1291,1523,3000, 164,1603, 847,1331, 537,1997, 486, 508,1693,2418, # 1472 1970,2227, 878,1220, 299,1030, 969, 652,2751, 624,1137,3301,2619, 65,3302,2045, # 1488 1761,1859,3120,1930,3694,3516, 663,1767, 852, 835,3695, 269, 767,2826,2339,1305, # 1504 896,1150, 770,1616,6118, 506,1502,2075,1012,2519, 775,2520,2975,2340,2938,4314, # 1520 3028,2086,1224,1943,2286,6119,3072,4315,2240,1273,1987,3935,1557, 175, 597, 985, # 1536 3517,2419,2521,1416,3029, 585, 938,1931,1007,1052,1932,1685,6120,3379,4316,4623, # 1552 804, 599,3121,1333,2128,2539,1159,1554,2032,3810, 687,2033,2904, 952, 675,1467, # 1568 3436,6121,2241,1096,1786,2440,1543,1924, 980,1813,2228, 781,2692,1879, 728,1918, # 1584 3696,4624, 548,1950,4625,1809,1088,1356,3303,2522,1944, 502, 972, 373, 513,2827, # 1600 586,2377,2391,1003,1976,1631,6122,2464,1084, 648,1776,4626,2141, 324, 962,2012, # 1616 2177,2076,1384, 742,2178,1448,1173,1810, 222, 102, 301, 445, 125,2420, 662,2498, # 1632 277, 200,1476,1165,1068, 224,2562,1378,1446, 450,1880, 659, 791, 582,4627,2939, # 1648 3936,1516,1274, 555,2099,3697,1020,1389,1526,3380,1762,1723,1787,2229, 412,2114, # 1664 1900,2392,3518, 512,2597, 427,1925,2341,3122,1653,1686,2465,2499, 697, 330, 273, # 1680 380,2162, 951, 832, 780, 991,1301,3073, 965,2270,3519, 668,2523,2636,1286, 535, # 1696 1407, 518, 671, 957,2658,2378, 267, 611,2197,3030,6123, 248,2299, 967,1799,2356, # 1712 850,1418,3437,1876,1256,1480,2828,1718,6124,6125,1755,1664,2405,6126,4628,2879, # 1728 2829, 499,2179, 676,4629, 557,2329,2214,2090, 325,3234, 464, 811,3001, 992,2342, # 1744 2481,1232,1469, 303,2242, 466,1070,2163, 603,1777,2091,4630,2752,4631,2714, 322, # 1760 2659,1964,1768, 481,2188,1463,2330,2857,3600,2092,3031,2421,4632,2318,2070,1849, # 1776 2598,4633,1302,2254,1668,1701,2422,3811,2905,3032,3123,2046,4106,1763,1694,4634, # 1792 1604, 943,1724,1454, 917, 868,2215,1169,2940, 552,1145,1800,1228,1823,1955, 316, # 1808 1080,2510, 361,1807,2830,4107,2660,3381,1346,1423,1134,4108,6127, 541,1263,1229, # 1824 1148,2540, 545, 465,1833,2880,3438,1901,3074,2482, 816,3937, 713,1788,2500, 122, # 1840 1575, 195,1451,2501,1111,6128, 859, 374,1225,2243,2483,4317, 390,1033,3439,3075, # 1856 2524,1687, 266, 793,1440,2599, 946, 779, 802, 507, 897,1081, 528,2189,1292, 711, # 1872 1866,1725,1167,1640, 753, 398,2661,1053, 246, 348,4318, 137,1024,3440,1600,2077, # 1888 2129, 825,4319, 698, 238, 521, 187,2300,1157,2423,1641,1605,1464,1610,1097,2541, # 1904 1260,1436, 759,2255,1814,2150, 705,3235, 409,2563,3304, 561,3033,2005,2564, 726, # 1920 1956,2343,3698,4109, 949,3812,3813,3520,1669, 653,1379,2525, 881,2198, 632,2256, # 1936 1027, 778,1074, 733,1957, 514,1481,2466, 554,2180, 702,3938,1606,1017,1398,6129, # 1952 1380,3521, 921, 993,1313, 594, 449,1489,1617,1166, 768,1426,1360, 495,1794,3601, # 1968 1177,3602,1170,4320,2344, 476, 425,3167,4635,3168,1424, 401,2662,1171,3382,1998, # 1984 1089,4110, 477,3169, 474,6130,1909, 596,2831,1842, 494, 693,1051,1028,1207,3076, # 2000 606,2115, 727,2790,1473,1115, 743,3522, 630, 805,1532,4321,2021, 366,1057, 838, # 2016 684,1114,2142,4322,2050,1492,1892,1808,2271,3814,2424,1971,1447,1373,3305,1090, # 2032 1536,3939,3523,3306,1455,2199, 336, 369,2331,1035, 584,2393, 902, 718,2600,6131, # 2048 2753, 463,2151,1149,1611,2467, 715,1308,3124,1268, 343,1413,3236,1517,1347,2663, # 2064 2093,3940,2022,1131,1553,2100,2941,1427,3441,2942,1323,2484,6132,1980, 872,2368, # 2080 2441,2943, 320,2369,2116,1082, 679,1933,3941,2791,3815, 625,1143,2023, 422,2200, # 2096 3816,6133, 730,1695, 356,2257,1626,2301,2858,2637,1627,1778, 937, 883,2906,2693, # 2112 3002,1769,1086, 400,1063,1325,3307,2792,4111,3077, 456,2345,1046, 747,6134,1524, # 2128 884,1094,3383,1474,2164,1059, 974,1688,2181,2258,1047, 345,1665,1187, 358, 875, # 2144 3170, 305, 660,3524,2190,1334,1135,3171,1540,1649,2542,1527, 927, 968,2793, 885, # 2160 1972,1850, 482, 500,2638,1218,1109,1085,2543,1654,2034, 876, 78,2287,1482,1277, # 2176 861,1675,1083,1779, 724,2754, 454, 397,1132,1612,2332, 893, 672,1237, 257,2259, # 2192 2370, 135,3384, 337,2244, 547, 352, 340, 709,2485,1400, 788,1138,2511, 540, 772, # 2208 1682,2260,2272,2544,2013,1843,1902,4636,1999,1562,2288,4637,2201,1403,1533, 407, # 2224 576,3308,1254,2071, 978,3385, 170, 136,1201,3125,2664,3172,2394, 213, 912, 873, # 2240 3603,1713,2202, 699,3604,3699, 813,3442, 493, 531,1054, 468,2907,1483, 304, 281, # 2256 4112,1726,1252,2094, 339,2319,2130,2639, 756,1563,2944, 748, 571,2976,1588,2425, # 2272 2715,1851,1460,2426,1528,1392,1973,3237, 288,3309, 685,3386, 296, 892,2716,2216, # 2288 1570,2245, 722,1747,2217, 905,3238,1103,6135,1893,1441,1965, 251,1805,2371,3700, # 2304 2601,1919,1078, 75,2182,1509,1592,1270,2640,4638,2152,6136,3310,3817, 524, 706, # 2320 1075, 292,3818,1756,2602, 317, 98,3173,3605,3525,1844,2218,3819,2502, 814, 567, # 2336 385,2908,1534,6137, 534,1642,3239, 797,6138,1670,1529, 953,4323, 188,1071, 538, # 2352 178, 729,3240,2109,1226,1374,2000,2357,2977, 731,2468,1116,2014,2051,6139,1261, # 2368 1593, 803,2859,2736,3443, 556, 682, 823,1541,6140,1369,2289,1706,2794, 845, 462, # 2384 2603,2665,1361, 387, 162,2358,1740, 739,1770,1720,1304,1401,3241,1049, 627,1571, # 2400 2427,3526,1877,3942,1852,1500, 431,1910,1503, 677, 297,2795, 286,1433,1038,1198, # 2416 2290,1133,1596,4113,4639,2469,1510,1484,3943,6141,2442, 108, 712,4640,2372, 866, # 2432 3701,2755,3242,1348, 834,1945,1408,3527,2395,3243,1811, 824, 994,1179,2110,1548, # 2448 1453, 790,3003, 690,4324,4325,2832,2909,3820,1860,3821, 225,1748, 310, 346,1780, # 2464 2470, 821,1993,2717,2796, 828, 877,3528,2860,2471,1702,2165,2910,2486,1789, 453, # 2480 359,2291,1676, 73,1164,1461,1127,3311, 421, 604, 314,1037, 589, 116,2487, 737, # 2496 837,1180, 111, 244, 735,6142,2261,1861,1362, 986, 523, 418, 581,2666,3822, 103, # 2512 855, 503,1414,1867,2488,1091, 657,1597, 979, 605,1316,4641,1021,2443,2078,2001, # 2528 1209, 96, 587,2166,1032, 260,1072,2153, 173, 94, 226,3244, 819,2006,4642,4114, # 2544 2203, 231,1744, 782, 97,2667, 786,3387, 887, 391, 442,2219,4326,1425,6143,2694, # 2560 633,1544,1202, 483,2015, 592,2052,1958,2472,1655, 419, 129,4327,3444,3312,1714, # 2576 1257,3078,4328,1518,1098, 865,1310,1019,1885,1512,1734, 469,2444, 148, 773, 436, # 2592 1815,1868,1128,1055,4329,1245,2756,3445,2154,1934,1039,4643, 579,1238, 932,2320, # 2608 353, 205, 801, 115,2428, 944,2321,1881, 399,2565,1211, 678, 766,3944, 335,2101, # 2624 1459,1781,1402,3945,2737,2131,1010, 844, 981,1326,1013, 550,1816,1545,2620,1335, # 2640 1008, 371,2881, 936,1419,1613,3529,1456,1395,2273,1834,2604,1317,2738,2503, 416, # 2656 1643,4330, 806,1126, 229, 591,3946,1314,1981,1576,1837,1666, 347,1790, 977,3313, # 2672 764,2861,1853, 688,2429,1920,1462, 77, 595, 415,2002,3034, 798,1192,4115,6144, # 2688 2978,4331,3035,2695,2582,2072,2566, 430,2430,1727, 842,1396,3947,3702, 613, 377, # 2704 278, 236,1417,3388,3314,3174, 757,1869, 107,3530,6145,1194, 623,2262, 207,1253, # 2720 2167,3446,3948, 492,1117,1935, 536,1838,2757,1246,4332, 696,2095,2406,1393,1572, # 2736 3175,1782, 583, 190, 253,1390,2230, 830,3126,3389, 934,3245,1703,1749,2979,1870, # 2752 2545,1656,2204, 869,2346,4116,3176,1817, 496,1764,4644, 942,1504, 404,1903,1122, # 2768 1580,3606,2945,1022, 515, 372,1735, 955,2431,3036,6146,2797,1110,2302,2798, 617, # 2784 6147, 441, 762,1771,3447,3607,3608,1904, 840,3037, 86, 939,1385, 572,1370,2445, # 2800 1336, 114,3703, 898, 294, 203,3315, 703,1583,2274, 429, 961,4333,1854,1951,3390, # 2816 2373,3704,4334,1318,1381, 966,1911,2322,1006,1155, 309, 989, 458,2718,1795,1372, # 2832 1203, 252,1689,1363,3177, 517,1936, 168,1490, 562, 193,3823,1042,4117,1835, 551, # 2848 470,4645, 395, 489,3448,1871,1465,2583,2641, 417,1493, 279,1295, 511,1236,1119, # 2864 72,1231,1982,1812,3004, 871,1564, 984,3449,1667,2696,2096,4646,2347,2833,1673, # 2880 3609, 695,3246,2668, 807,1183,4647, 890, 388,2333,1801,1457,2911,1765,1477,1031, # 2896 3316,3317,1278,3391,2799,2292,2526, 163,3450,4335,2669,1404,1802,6148,2323,2407, # 2912 1584,1728,1494,1824,1269, 298, 909,3318,1034,1632, 375, 776,1683,2061, 291, 210, # 2928 1123, 809,1249,1002,2642,3038, 206,1011,2132, 144, 975, 882,1565, 342, 667, 754, # 2944 1442,2143,1299,2303,2062, 447, 626,2205,1221,2739,2912,1144,1214,2206,2584, 760, # 2960 1715, 614, 950,1281,2670,2621, 810, 577,1287,2546,4648, 242,2168, 250,2643, 691, # 2976 123,2644, 647, 313,1029, 689,1357,2946,1650, 216, 771,1339,1306, 808,2063, 549, # 2992 913,1371,2913,2914,6149,1466,1092,1174,1196,1311,2605,2396,1783,1796,3079, 406, # 3008 2671,2117,3949,4649, 487,1825,2220,6150,2915, 448,2348,1073,6151,2397,1707, 130, # 3024 900,1598, 329, 176,1959,2527,1620,6152,2275,4336,3319,1983,2191,3705,3610,2155, # 3040 3706,1912,1513,1614,6153,1988, 646, 392,2304,1589,3320,3039,1826,1239,1352,1340, # 3056 2916, 505,2567,1709,1437,2408,2547, 906,6154,2672, 384,1458,1594,1100,1329, 710, # 3072 423,3531,2064,2231,2622,1989,2673,1087,1882, 333, 841,3005,1296,2882,2379, 580, # 3088 1937,1827,1293,2585, 601, 574, 249,1772,4118,2079,1120, 645, 901,1176,1690, 795, # 3104 2207, 478,1434, 516,1190,1530, 761,2080, 930,1264, 355, 435,1552, 644,1791, 987, # 3120 220,1364,1163,1121,1538, 306,2169,1327,1222, 546,2645, 218, 241, 610,1704,3321, # 3136 1984,1839,1966,2528, 451,6155,2586,3707,2568, 907,3178, 254,2947, 186,1845,4650, # 3152 745, 432,1757, 428,1633, 888,2246,2221,2489,3611,2118,1258,1265, 956,3127,1784, # 3168 4337,2490, 319, 510, 119, 457,3612, 274,2035,2007,4651,1409,3128, 970,2758, 590, # 3184 2800, 661,2247,4652,2008,3950,1420,1549,3080,3322,3951,1651,1375,2111, 485,2491, # 3200 1429,1156,6156,2548,2183,1495, 831,1840,2529,2446, 501,1657, 307,1894,3247,1341, # 3216 666, 899,2156,1539,2549,1559, 886, 349,2208,3081,2305,1736,3824,2170,2759,1014, # 3232 1913,1386, 542,1397,2948, 490, 368, 716, 362, 159, 282,2569,1129,1658,1288,1750, # 3248 2674, 276, 649,2016, 751,1496, 658,1818,1284,1862,2209,2087,2512,3451, 622,2834, # 3264 376, 117,1060,2053,1208,1721,1101,1443, 247,1250,3179,1792,3952,2760,2398,3953, # 3280 6157,2144,3708, 446,2432,1151,2570,3452,2447,2761,2835,1210,2448,3082, 424,2222, # 3296 1251,2449,2119,2836, 504,1581,4338, 602, 817, 857,3825,2349,2306, 357,3826,1470, # 3312 1883,2883, 255, 958, 929,2917,3248, 302,4653,1050,1271,1751,2307,1952,1430,2697, # 3328 2719,2359, 354,3180, 777, 158,2036,4339,1659,4340,4654,2308,2949,2248,1146,2232, # 3344 3532,2720,1696,2623,3827,6158,3129,1550,2698,1485,1297,1428, 637, 931,2721,2145, # 3360 914,2550,2587, 81,2450, 612, 827,2646,1242,4655,1118,2884, 472,1855,3181,3533, # 3376 3534, 569,1353,2699,1244,1758,2588,4119,2009,2762,2171,3709,1312,1531,6159,1152, # 3392 1938, 134,1830, 471,3710,2276,1112,1535,3323,3453,3535, 982,1337,2950, 488, 826, # 3408 674,1058,1628,4120,2017, 522,2399, 211, 568,1367,3454, 350, 293,1872,1139,3249, # 3424 1399,1946,3006,1300,2360,3324, 588, 736,6160,2606, 744, 669,3536,3828,6161,1358, # 3440 199, 723, 848, 933, 851,1939,1505,1514,1338,1618,1831,4656,1634,3613, 443,2740, # 3456 3829, 717,1947, 491,1914,6162,2551,1542,4121,1025,6163,1099,1223, 198,3040,2722, # 3472 370, 410,1905,2589, 998,1248,3182,2380, 519,1449,4122,1710, 947, 928,1153,4341, # 3488 2277, 344,2624,1511, 615, 105, 161,1212,1076,1960,3130,2054,1926,1175,1906,2473, # 3504 414,1873,2801,6164,2309, 315,1319,3325, 318,2018,2146,2157, 963, 631, 223,4342, # 3520 4343,2675, 479,3711,1197,2625,3712,2676,2361,6165,4344,4123,6166,2451,3183,1886, # 3536 2184,1674,1330,1711,1635,1506, 799, 219,3250,3083,3954,1677,3713,3326,2081,3614, # 3552 1652,2073,4657,1147,3041,1752, 643,1961, 147,1974,3955,6167,1716,2037, 918,3007, # 3568 1994, 120,1537, 118, 609,3184,4345, 740,3455,1219, 332,1615,3830,6168,1621,2980, # 3584 1582, 783, 212, 553,2350,3714,1349,2433,2082,4124, 889,6169,2310,1275,1410, 973, # 3600 166,1320,3456,1797,1215,3185,2885,1846,2590,2763,4658, 629, 822,3008, 763, 940, # 3616 1990,2862, 439,2409,1566,1240,1622, 926,1282,1907,2764, 654,2210,1607, 327,1130, # 3632 3956,1678,1623,6170,2434,2192, 686, 608,3831,3715, 903,3957,3042,6171,2741,1522, # 3648 1915,1105,1555,2552,1359, 323,3251,4346,3457, 738,1354,2553,2311,2334,1828,2003, # 3664 3832,1753,2351,1227,6172,1887,4125,1478,6173,2410,1874,1712,1847, 520,1204,2607, # 3680 264,4659, 836,2677,2102, 600,4660,3833,2278,3084,6174,4347,3615,1342, 640, 532, # 3696 543,2608,1888,2400,2591,1009,4348,1497, 341,1737,3616,2723,1394, 529,3252,1321, # 3712 983,4661,1515,2120, 971,2592, 924, 287,1662,3186,4349,2700,4350,1519, 908,1948, # 3728 2452, 156, 796,1629,1486,2223,2055, 694,4126,1259,1036,3392,1213,2249,2742,1889, # 3744 1230,3958,1015, 910, 408, 559,3617,4662, 746, 725, 935,4663,3959,3009,1289, 563, # 3760 867,4664,3960,1567,2981,2038,2626, 988,2263,2381,4351, 143,2374, 704,1895,6175, # 3776 1188,3716,2088, 673,3085,2362,4352, 484,1608,1921,2765,2918, 215, 904,3618,3537, # 3792 894, 509, 976,3043,2701,3961,4353,2837,2982, 498,6176,6177,1102,3538,1332,3393, # 3808 1487,1636,1637, 233, 245,3962, 383, 650, 995,3044, 460,1520,1206,2352, 749,3327, # 3824 530, 700, 389,1438,1560,1773,3963,2264, 719,2951,2724,3834, 870,1832,1644,1000, # 3840 839,2474,3717, 197,1630,3394, 365,2886,3964,1285,2133, 734, 922, 818,1106, 732, # 3856 480,2083,1774,3458, 923,2279,1350, 221,3086, 85,2233,2234,3835,1585,3010,2147, # 3872 1387,1705,2382,1619,2475, 133, 239,2802,1991,1016,2084,2383, 411,2838,1113, 651, # 3888 1985,1160,3328, 990,1863,3087,1048,1276,2647, 265,2627,1599,3253,2056, 150, 638, # 3904 2019, 656, 853, 326,1479, 680,1439,4354,1001,1759, 413,3459,3395,2492,1431, 459, # 3920 4355,1125,3329,2265,1953,1450,2065,2863, 849, 351,2678,3131,3254,3255,1104,1577, # 3936 227,1351,1645,2453,2193,1421,2887, 812,2121, 634, 95,2435, 201,2312,4665,1646, # 3952 1671,2743,1601,2554,2702,2648,2280,1315,1366,2089,3132,1573,3718,3965,1729,1189, # 3968 328,2679,1077,1940,1136, 558,1283, 964,1195, 621,2074,1199,1743,3460,3619,1896, # 3984 1916,1890,3836,2952,1154,2112,1064, 862, 378,3011,2066,2113,2803,1568,2839,6178, # 4000 3088,2919,1941,1660,2004,1992,2194, 142, 707,1590,1708,1624,1922,1023,1836,1233, # 4016 1004,2313, 789, 741,3620,6179,1609,2411,1200,4127,3719,3720,4666,2057,3721, 593, # 4032 2840, 367,2920,1878,6180,3461,1521, 628,1168, 692,2211,2649, 300, 720,2067,2571, # 4048 2953,3396, 959,2504,3966,3539,3462,1977, 701,6181, 954,1043, 800, 681, 183,3722, # 4064 1803,1730,3540,4128,2103, 815,2314, 174, 467, 230,2454,1093,2134, 755,3541,3397, # 4080 1141,1162,6182,1738,2039, 270,3256,2513,1005,1647,2185,3837, 858,1679,1897,1719, # 4096 2954,2324,1806, 402, 670, 167,4129,1498,2158,2104, 750,6183, 915, 189,1680,1551, # 4112 455,4356,1501,2455, 405,1095,2955, 338,1586,1266,1819, 570, 641,1324, 237,1556, # 4128 2650,1388,3723,6184,1368,2384,1343,1978,3089,2436, 879,3724, 792,1191, 758,3012, # 4144 1411,2135,1322,4357, 240,4667,1848,3725,1574,6185, 420,3045,1546,1391, 714,4358, # 4160 1967, 941,1864, 863, 664, 426, 560,1731,2680,1785,2864,1949,2363, 403,3330,1415, # 4176 1279,2136,1697,2335, 204, 721,2097,3838, 90,6186,2085,2505, 191,3967, 124,2148, # 4192 1376,1798,1178,1107,1898,1405, 860,4359,1243,1272,2375,2983,1558,2456,1638, 113, # 4208 3621, 578,1923,2609, 880, 386,4130, 784,2186,2266,1422,2956,2172,1722, 497, 263, # 4224 2514,1267,2412,2610, 177,2703,3542, 774,1927,1344, 616,1432,1595,1018, 172,4360, # 4240 2325, 911,4361, 438,1468,3622, 794,3968,2024,2173,1681,1829,2957, 945, 895,3090, # 4256 575,2212,2476, 475,2401,2681, 785,2744,1745,2293,2555,1975,3133,2865, 394,4668, # 4272 3839, 635,4131, 639, 202,1507,2195,2766,1345,1435,2572,3726,1908,1184,1181,2457, # 4288 3727,3134,4362, 843,2611, 437, 916,4669, 234, 769,1884,3046,3047,3623, 833,6187, # 4304 1639,2250,2402,1355,1185,2010,2047, 999, 525,1732,1290,1488,2612, 948,1578,3728, # 4320 2413,2477,1216,2725,2159, 334,3840,1328,3624,2921,1525,4132, 564,1056, 891,4363, # 4336 1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, # 4352 2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, # 4368 #last 512 ) chardet/codingstatemachine.py000064400000007006152347724720012401 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### import logging from .enums import MachineState class CodingStateMachine(object): """ A state machine to verify a byte sequence for a particular encoding. For each byte the detector receives, it will feed that byte to every active state machine available, one byte at a time. The state machine changes its state based on its previous state and the byte it receives. There are 3 states in a state machine that are of interest to an auto-detector: START state: This is the state to start with, or a legal byte sequence (i.e. a valid code point) for character has been identified. ME state: This indicates that the state machine identified a byte sequence that is specific to the charset it is designed for and that there is no other possible encoding which can contain this byte sequence. This will to lead to an immediate positive answer for the detector. ERROR state: This indicates the state machine identified an illegal byte sequence for that encoding. This will lead to an immediate negative answer for this encoding. Detector will exclude this encoding from consideration from here on. """ def __init__(self, sm): self._model = sm self._curr_byte_pos = 0 self._curr_char_len = 0 self._curr_state = None self.logger = logging.getLogger(__name__) self.reset() def reset(self): self._curr_state = MachineState.START def next_state(self, c): # for each byte we get its class # if it is first byte, we also get byte length byte_class = self._model['class_table'][c] if self._curr_state == MachineState.START: self._curr_byte_pos = 0 self._curr_char_len = self._model['char_len_table'][byte_class] # from byte's class and state_table, we get its next state curr_state = (self._curr_state * self._model['class_factor'] + byte_class) self._curr_state = self._model['state_table'][curr_state] self._curr_byte_pos += 1 return self._curr_state def get_current_charlen(self): return self._curr_char_len def get_coding_state_machine(self): return self._model['name'] @property def language(self): return self._model['language'] chardet/__init__.py000064400000003027152347724720010306 0ustar00######################## BEGIN LICENSE BLOCK ######################## # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .compat import PY2, PY3 from .universaldetector import UniversalDetector from .version import __version__, VERSION def detect(byte_str): """ Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` """ if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): raise TypeError('Expected object of type bytes or bytearray, got: ' '{0}'.format(type(byte_str))) else: byte_str = bytearray(byte_str) detector = UniversalDetector() detector.feed(byte_str) return detector.close() chardet/gb2312freq.py000064400000050353152347724720010331 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # GB2312 most frequently used character table # # Char to FreqOrder table , from hz6763 # 512 --> 0.79 -- 0.79 # 1024 --> 0.92 -- 0.13 # 2048 --> 0.98 -- 0.06 # 6768 --> 1.00 -- 0.02 # # Ideal Distribution Ratio = 0.79135/(1-0.79135) = 3.79 # Random Distribution Ration = 512 / (3755 - 512) = 0.157 # # Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR GB2312_TYPICAL_DISTRIBUTION_RATIO = 0.9 GB2312_TABLE_SIZE = 3760 GB2312_CHAR_TO_FREQ_ORDER = ( 1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205, 2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842, 2204, 869,4207, 970,2678,5626,2944,2956,1479,4048, 514,3595, 588,1346,2820,3409, 249,4088,1746,1873,2047,1774, 581,1813, 358,1174,3590,1014,1561,4844,2245, 670, 1636,3112, 889,1286, 953, 556,2327,3060,1290,3141, 613, 185,3477,1367, 850,3820, 1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349, 388,3098,2091,1360,3585, 152,1687,1539, 738,1559, 59,1232,2925,2267,1388,1249,1741,1679,2960, 151,1566, 1125,1352,4271, 924,4296, 385,3166,4459, 310,1245,2850, 70,3285,2729,3534,3575, 2398,3298,3466,1960,2265, 217,3647, 864,1909,2084,4401,2773,1010,3269,5152, 853, 3051,3121,1244,4251,1895, 364,1499,1540,2313,1180,3655,2268, 562, 715,2417,3061, 544, 336,3768,2380,1752,4075, 950, 280,2425,4382, 183,2759,3272, 333,4297,2155, 1688,2356,1444,1039,4540, 736,1177,3349,2443,2368,2144,2225, 565, 196,1482,3406, 927,1335,4147, 692, 878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816, 2534,1546,2393,2760, 737,2494, 13, 447, 245,2747, 38,2765,2129,2589,1079, 606, 360, 471,3755,2890, 404, 848, 699,1785,1236, 370,2221,1023,3746,2074,2026,2023, 2388,1581,2119, 812,1141,3091,2536,1519, 804,2053, 406,1596,1090, 784, 548,4414, 1806,2264,2936,1100, 343,4114,5096, 622,3358, 743,3668,1510,1626,5020,3567,2513, 3195,4115,5627,2489,2991, 24,2065,2697,1087,2719, 48,1634, 315, 68, 985,2052, 198,2239,1347,1107,1439, 597,2366,2172, 871,3307, 919,2487,2790,1867, 236,2570, 1413,3794, 906,3365,3381,1701,1982,1818,1524,2924,1205, 616,2586,2072,2004, 575, 253,3099, 32,1365,1182, 197,1714,2454,1201, 554,3388,3224,2748, 756,2587, 250, 2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153, 615, 911,1506, 1474,2495,1265,1906,2749,3756,3280,2161, 898,2714,1759,3450,2243,2444, 563, 26, 3286,2266,3769,3344,2707,3677, 611,1402, 531,1028,2871,4548,1375, 261,2948, 835, 1190,4134, 353, 840,2684,1900,3082,1435,2109,1207,1674, 329,1872,2781,4055,2686, 2104, 608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054, 1681,1153, 225,1627,2929, 162,2050,2511,3687,1954, 124,1859,2431,1684,3032,2894, 585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209, 256, 518,2042,2105, 3777,3657, 643,2298,1148,1779, 190, 989,3544, 414, 11,2135,2063,2979,1471, 403, 3678, 126, 770,1563, 671,2499,3216,2877, 600,1179, 307,2805,4937,1268,1297,2694, 252,4032,1448,1494,1331,1394, 127,2256, 222,1647,1035,1481,3056,1915,1048, 873, 3651, 210, 33,1608,2516, 200,1520, 415, 102, 0,3389,1287, 817, 91,3299,2940, 836,1814, 549,2197,1396,1669,2987,3582,2297,2848,4528,1070, 687, 20,1819, 121, 1552,1364,1461,1968,2617,3540,2824,2083, 177, 948,4938,2291, 110,4549,2066, 648, 3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123, 208,1804,3159,2992, 2531,2549,3361,2418,1350,2347,2800,2568,1291,2036,2680, 72, 842,1990, 212,1233, 1154,1586, 75,2027,3410,4900,1823,1337,2710,2676, 728,2810,1522,3026,4995, 157, 755,1050,4022, 710, 785,1936,2194,2085,1406,2777,2400, 150,1250,4049,1206, 807, 1910, 534, 529,3309,1721,1660, 274, 39,2827, 661,2670,1578, 925,3248,3815,1094, 4278,4901,4252, 41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258, 887, 538,4187,3199,1294,2439,3042,2329,2343,2497,1255, 107, 543,1527, 521,3478, 3568, 194,5062, 15, 961,3870,1241,1192,2664, 66,5215,3260,2111,1295,1127,2152, 3805,4135, 901,1164,1976, 398,1278, 530,1460, 748, 904,1054,1966,1426, 53,2909, 509, 523,2279,1534, 536,1019, 239,1685, 460,2353, 673,1065,2401,3600,4298,2272, 1272,2363, 284,1753,3679,4064,1695, 81, 815,2677,2757,2731,1386, 859, 500,4221, 2190,2566, 757,1006,2519,2068,1166,1455, 337,2654,3203,1863,1682,1914,3025,1252, 1409,1366, 847, 714,2834,2038,3209, 964,2970,1901, 885,2553,1078,1756,3049, 301, 1572,3326, 688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088, 262,1158,1254, 389,1641,1812, 526,1719, 923,2073,1073,1902, 468, 489,4625,1140, 857,2375,3070, 3319,2863, 380, 116,1328,2693,1161,2244, 273,1212,1884,2769,3011,1775,1142, 461, 3066,1200,2147,2212, 790, 702,2695,4222,1601,1058, 434,2338,5153,3640, 67,2360, 4099,2502, 618,3472,1329, 416,1132, 830,2782,1807,2653,3211,3510,1662, 192,2124, 296,3979,1739,1611,3684, 23, 118, 324, 446,1239,1225, 293,2520,3814,3795,2535, 3116, 17,1074, 467,2692,2201, 387,2922, 45,1326,3055,1645,3659,2817, 958, 243, 1903,2320,1339,2825,1784,3289, 356, 576, 865,2315,2381,3377,3916,1088,3122,1713, 1655, 935, 628,4689,1034,1327, 441, 800, 720, 894,1979,2183,1528,5289,2702,1071, 4046,3572,2399,1571,3281, 79, 761,1103, 327, 134, 758,1899,1371,1615, 879, 442, 215,2605,2579, 173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946, 814,4968,3487,1548,2644,1567,1285, 2, 295,2636, 97, 946,3576, 832, 141,4257, 3273, 760,3821,3521,3156,2607, 949,1024,1733,1516,1803,1920,2125,2283,2665,3180, 1501,2064,3560,2171,1592, 803,3518,1416, 732,3897,4258,1363,1362,2458, 119,1427, 602,1525,2608,1605,1639,3175, 694,3064, 10, 465, 76,2000,4846,4208, 444,3781, 1619,3353,2206,1273,3796, 740,2483, 320,1723,2377,3660,2619,1359,1137,1762,1724, 2345,2842,1850,1862, 912, 821,1866, 612,2625,1735,2573,3369,1093, 844, 89, 937, 930,1424,3564,2413,2972,1004,3046,3019,2011, 711,3171,1452,4178, 428, 801,1943, 432, 445,2811, 206,4136,1472, 730, 349, 73, 397,2802,2547, 998,1637,1167, 789, 396,3217, 154,1218, 716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627, 552, 3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703, 640,1045,1370,1246, 4996, 371,1575,2436,1621,2210, 984,4033,1734,2638, 16,4529, 663,2755,3255,1451, 3917,2257,1253,1955,2234,1263,2951, 214,1229, 617, 485, 359,1831,1969, 473,2310, 750,2058, 165, 80,2864,2419, 361,4344,2416,2479,1134, 796,3726,1266,2943, 860, 2715, 938, 390,2734,1313,1384, 248, 202, 877,1064,2854, 522,3907, 279,1602, 297, 2357, 395,3740, 137,2075, 944,4089,2584,1267,3802, 62,1533,2285, 178, 176, 780, 2440, 201,3707, 590, 478,1560,4354,2117,1075, 30, 74,4643,4004,1635,1441,2745, 776,2596, 238,1077,1692,1912,2844, 605, 499,1742,3947, 241,3053, 980,1749, 936, 2640,4511,2582, 515,1543,2162,5322,2892,2993, 890,2148,1924, 665,1827,3581,1032, 968,3163, 339,1044,1896, 270, 583,1791,1720,4367,1194,3488,3669, 43,2523,1657, 163,2167, 290,1209,1622,3378, 550, 634,2508,2510, 695,2634,2384,2512,1476,1414, 220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680, 854,3227,1299,2976, 3172, 186,2998,1459, 443,1067,3251,1495, 321,1932,3054, 909, 753,1410,1828, 436, 2441,1119,1587,3164,2186,1258, 227, 231,1425,1890,3200,3942, 247, 959, 725,5254, 2741, 577,2158,2079, 929, 120, 174, 838,2813, 591,1115, 417,2024, 40,3240,1536, 1037, 291,4151,2354, 632,1298,2406,2500,3535,1825,1846,3451, 205,1171, 345,4238, 18,1163, 811, 685,2208,1217, 425,1312,1508,1175,4308,2552,1033, 587,1381,3059, 2984,3482, 340,1316,4023,3972, 792,3176, 519, 777,4690, 918, 933,4130,2981,3741, 90,3360,2911,2200,5184,4550, 609,3079,2030, 272,3379,2736, 363,3881,1130,1447, 286, 779, 357,1169,3350,3137,1630,1220,2687,2391, 747,1277,3688,2618,2682,2601, 1156,3196,5290,4034,3102,1689,3596,3128, 874, 219,2783, 798, 508,1843,2461, 269, 1658,1776,1392,1913,2983,3287,2866,2159,2372, 829,4076, 46,4253,2873,1889,1894, 915,1834,1631,2181,2318, 298, 664,2818,3555,2735, 954,3228,3117, 527,3511,2173, 681,2712,3033,2247,2346,3467,1652, 155,2164,3382, 113,1994, 450, 899, 494, 994, 1237,2958,1875,2336,1926,3727, 545,1577,1550, 633,3473, 204,1305,3072,2410,1956, 2471, 707,2134, 841,2195,2196,2663,3843,1026,4940, 990,3252,4997, 368,1092, 437, 3212,3258,1933,1829, 675,2977,2893, 412, 943,3723,4644,3294,3283,2230,2373,5154, 2389,2241,2661,2323,1404,2524, 593, 787, 677,3008,1275,2059, 438,2709,2609,2240, 2269,2246,1446, 36,1568,1373,3892,1574,2301,1456,3962, 693,2276,5216,2035,1143, 2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090, 424,1694, 312,3634, 3390,4179,3335,2252,1214, 561,1059,3243,2295,2561, 975,5155,2321,2751,3772, 472, 1537,3282,3398,1047,2077,2348,2878,1323,3340,3076, 690,2906, 51, 369, 170,3541, 1060,2187,2688,3670,2541,1083,1683, 928,3918, 459, 109,4427, 599,3744,4286, 143, 2101,2730,2490, 82,1588,3036,2121, 281,1860, 477,4035,1238,2812,3020,2716,3312, 1530,2188,2055,1317, 843, 636,1808,1173,3495, 649, 181,1002, 147,3641,1159,2414, 3750,2289,2795, 813,3123,2610,1136,4368, 5,3391,4541,2174, 420, 429,1728, 754, 1228,2115,2219, 347,2223,2733, 735,1518,3003,2355,3134,1764,3948,3329,1888,2424, 1001,1234,1972,3321,3363,1672,1021,1450,1584, 226, 765, 655,2526,3404,3244,2302, 3665, 731, 594,2184, 319,1576, 621, 658,2656,4299,2099,3864,1279,2071,2598,2739, 795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004, 2591,1084, 213,2287,1963,3565,2250, 822, 793,4574,3187,1772,1789,3050, 595,1484, 1959,2770,1080,2650, 456, 422,2996, 940,3322,4328,4345,3092,2742, 965,2784, 739, 4124, 952,1358,2498,2949,2565, 332,2698,2378, 660,2260,2473,4194,3856,2919, 535, 1260,2651,1208,1428,1300,1949,1303,2942, 433,2455,2450,1251,1946, 614,1269, 641, 1306,1810,2737,3078,2912, 564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307, 3218,2175,1897,3063, 682,1157,4040,4005,1712,1160,1941,1399, 394, 402,2952,1573, 1151,2986,2404, 862, 299,2033,1489,3006, 346, 171,2886,3401,1726,2932, 168,2533, 47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965, 504,1036,2690,2988,2405, 745,5871, 849,2397,2056,3081, 863,2359,3857,2096, 99, 1397,1769,2300,4428,1643,3455,1978,1757,3718,1440, 35,4879,3742,1296,4228,2280, 160,5063,1599,2013, 166, 520,3479,1646,3345,3012, 490,1937,1545,1264,2182,2505, 1096,1188,1369,1436,2421,1667,2792,2460,1270,2122, 727,3167,2143, 806,1706,1012, 1800,3037, 960,2218,1882, 805, 139,2456,1139,1521, 851,1052,3093,3089, 342,2039, 744,5097,1468,1502,1585,2087, 223, 939, 326,2140,2577, 892,2481,1623,4077, 982, 3708, 135,2131, 87,2503,3114,2326,1106, 876,1616, 547,2997,2831,2093,3441,4530, 4314, 9,3256,4229,4148, 659,1462,1986,1710,2046,2913,2231,4090,4880,5255,3392, 3274,1368,3689,4645,1477, 705,3384,3635,1068,1529,2941,1458,3782,1509, 100,1656, 2548, 718,2339, 408,1590,2780,3548,1838,4117,3719,1345,3530, 717,3442,2778,3220, 2898,1892,4590,3614,3371,2043,1998,1224,3483, 891, 635, 584,2559,3355, 733,1766, 1729,1172,3789,1891,2307, 781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535, 3213,1189,1934,5693,3262, 586,3118,1324,1598, 517,1564,2217,1868,1893,4445,3728, 2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711,5098,4287, 338, 1993,3129,3489,2689,1809,2815,1997, 957,1855,3898,2550,3275,3057,1105,1319, 627, 1505,1911,1883,3526, 698,3629,3456,1833,1431, 746, 77,1261,2017,2296,1977,1885, 125,1334,1600, 525,1798,1109,2222,1470,1945, 559,2236,1186,3443,2476,1929,1411, 2411,3135,1777,3372,2621,1841,1613,3229, 668,1430,1839,2643,2916, 195,1989,2671, 2358,1387, 629,3205,2293,5256,4439, 123,1310, 888,1879,4300,3021,3605,1003,1162, 3192,2910,2010, 140,2395,2859, 55,1082,2012,2901, 662, 419,2081,1438, 680,2774, 4654,3912,1620,1731,1625,5035,4065,2328, 512,1344, 802,5443,2163,2311,2537, 524, 3399, 98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346, 180,1113,4655,3461,2028,1698, 833,2696,1235,1322,1594,4408,3623,3013,3225,2040, 3022, 541,2881, 607,3632,2029,1665,1219, 639,1385,1686,1099,2803,3231,1938,3188, 2858, 427, 676,2772,1168,2025, 454,3253,2486,3556, 230,1950, 580, 791,1991,1280, 1086,1974,2034, 630, 257,3338,2788,4903,1017, 86,4790, 966,2789,1995,1696,1131, 259,3095,4188,1308, 179,1463,5257, 289,4107,1248, 42,3413,1725,2288, 896,1947, 774,4474,4254, 604,3430,4264, 392,2514,2588, 452, 237,1408,3018, 988,4531,1970, 3034,3310, 540,2370,1562,1288,2990, 502,4765,1147, 4,1853,2708, 207, 294,2814, 4078,2902,2509, 684, 34,3105,3532,2551, 644, 709,2801,2344, 573,1727,3573,3557, 2021,1081,3100,4315,2100,3681, 199,2263,1837,2385, 146,3484,1195,2776,3949, 997, 1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076, 493, 117,5400,2521, 972, 1490,2934,1796,4542,2374,1512,2933,2657, 413,2888,1135,2762,2314,2156,1355,2369, 766,2007,2527,2170,3124,2491,2593,2632,4757,2437, 234,3125,3591,1898,1750,1376, 1942,3468,3138, 570,2127,2145,3276,4131, 962, 132,1445,4196, 19, 941,3624,3480, 3366,1973,1374,4461,3431,2629, 283,2415,2275, 808,2887,3620,2112,2563,1353,3610, 955,1089,3103,1053, 96, 88,4097, 823,3808,1583, 399, 292,4091,3313, 421,1128, 642,4006, 903,2539,1877,2082, 596, 29,4066,1790, 722,2157, 130, 995,1569, 769, 1485, 464, 513,2213, 288,1923,1101,2453,4316, 133, 486,2445, 50, 625, 487,2207, 57, 423, 481,2962, 159,3729,1558, 491, 303, 482, 501, 240,2837, 112,3648,2392, 1783, 362, 8,3433,3422, 610,2793,3277,1390,1284,1654, 21,3823, 734, 367, 623, 193, 287, 374,1009,1483, 816, 476, 313,2255,2340,1262,2150,2899,1146,2581, 782, 2116,1659,2018,1880, 255,3586,3314,1110,2867,2137,2564, 986,2767,5185,2006, 650, 158, 926, 762, 881,3157,2717,2362,3587, 306,3690,3245,1542,3077,2427,1691,2478, 2118,2985,3490,2438, 539,2305, 983, 129,1754, 355,4201,2386, 827,2923, 104,1773, 2838,2771, 411,2905,3919, 376, 767, 122,1114, 828,2422,1817,3506, 266,3460,1007, 1609,4998, 945,2612,4429,2274, 726,1247,1964,2914,2199,2070,4002,4108, 657,3323, 1422, 579, 455,2764,4737,1222,2895,1670, 824,1223,1487,2525, 558, 861,3080, 598, 2659,2515,1967, 752,2583,2376,2214,4180, 977, 704,2464,4999,2622,4109,1210,2961, 819,1541, 142,2284, 44, 418, 457,1126,3730,4347,4626,1644,1876,3671,1864, 302, 1063,5694, 624, 723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098, 409, 1011,2325,3704,2306, 818,1732,1383,1824,1844,3757, 999,2705,3497,1216,1423,2683, 2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343, 783, 724, 191, 2434,1354,2220,5065,1763,2752,2472,4152, 131, 175,2885,3434, 92,1466,4920,2616, 3871,3872,3866, 128,1551,1632, 669,1854,3682,4691,4125,1230, 188,2973,3290,1302, 1213, 560,3266, 917, 763,3909,3249,1760, 868,1958, 764,1782,2097, 145,2277,3774, 4462, 64,1491,3062, 971,2132,3606,2442, 221,1226,1617, 218, 323,1185,3207,3147, 571, 619,1473,1005,1744,2281, 449,1887,2396,3685, 275, 375,3816,1743,3844,3731, 845,1983,2350,4210,1377, 773, 967,3499,3052,3743,2725,4007,1697,1022,3943,1464, 3264,2855,2722,1952,1029,2839,2467, 84,4383,2215, 820,1391,2015,2448,3672, 377, 1948,2168, 797,2545,3536,2578,2645, 94,2874,1678, 405,1259,3071, 771, 546,1315, 470,1243,3083, 895,2468, 981, 969,2037, 846,4181, 653,1276,2928, 14,2594, 557, 3007,2474, 156, 902,1338,1740,2574, 537,2518, 973,2282,2216,2433,1928, 138,2903, 1293,2631,1612, 646,3457, 839,2935, 111, 496,2191,2847, 589,3186, 149,3994,2060, 4031,2641,4067,3145,1870, 37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261, 1301, 251,2446,2599,2153, 872,3246, 637, 334,3705, 831, 884, 921,3065,3140,4092, 2198,1944, 246,2964, 108,2045,1152,1921,2308,1031, 203,3173,4170,1907,3890, 810, 1401,2003,1690, 506, 647,1242,2828,1761,1649,3208,2249,1589,3709,2931,5156,1708, 498, 666,2613, 834,3817,1231, 184,2851,1124, 883,3197,2261,3710,1765,1553,2658, 1178,2639,2351, 93,1193, 942,2538,2141,4402, 235,1821, 870,1591,2192,1709,1871, 3341,1618,4126,2595,2334, 603, 651, 69, 701, 268,2662,3411,2555,1380,1606, 503, 448, 254,2371,2646, 574,1187,2309,1770, 322,2235,1292,1801, 305, 566,1133, 229, 2067,2057, 706, 167, 483,2002,2672,3295,1820,3561,3067, 316, 378,2746,3452,1112, 136,1981, 507,1651,2917,1117, 285,4591, 182,2580,3522,1304, 335,3303,1835,2504, 1795,1792,2248, 674,1018,2106,2449,1857,2292,2845, 976,3047,1781,2600,2727,1389, 1281, 52,3152, 153, 265,3950, 672,3485,3951,4463, 430,1183, 365, 278,2169, 27, 1407,1336,2304, 209,1340,1730,2202,1852,2403,2883, 979,1737,1062, 631,2829,2542, 3876,2592, 825,2086,2226,3048,3625, 352,1417,3724, 542, 991, 431,1351,3938,1861, 2294, 826,1361,2927,3142,3503,1738, 463,2462,2723, 582,1916,1595,2808, 400,3845, 3891,2868,3621,2254, 58,2492,1123, 910,2160,2614,1372,1603,1196,1072,3385,1700, 3267,1980, 696, 480,2430, 920, 799,1570,2920,1951,2041,4047,2540,1321,4223,2469, 3562,2228,1271,2602, 401,2833,3351,2575,5157, 907,2312,1256, 410, 263,3507,1582, 996, 678,1849,2316,1480, 908,3545,2237, 703,2322, 667,1826,2849,1531,2604,2999, 2407,3146,2151,2630,1786,3711, 469,3542, 497,3899,2409, 858, 837,4446,3393,1274, 786, 620,1845,2001,3311, 484, 308,3367,1204,1815,3691,2332,1532,2557,1842,2020, 2724,1927,2333,4440, 567, 22,1673,2728,4475,1987,1858,1144,1597, 101,1832,3601, 12, 974,3783,4391, 951,1412, 1,3720, 453,4608,4041, 528,1041,1027,3230,2628, 1129, 875,1051,3291,1203,2262,1069,2860,2799,2149,2615,3278, 144,1758,3040, 31, 475,1680, 366,2685,3184, 311,1642,4008,2466,5036,1593,1493,2809, 216,1420,1668, 233, 304,2128,3284, 232,1429,1768,1040,2008,3407,2740,2967,2543, 242,2133, 778, 1565,2022,2620, 505,2189,2756,1098,2273, 372,1614, 708, 553,2846,2094,2278, 169, 3626,2835,4161, 228,2674,3165, 809,1454,1309, 466,1705,1095, 900,3423, 880,2667, 3751,5258,2317,3109,2571,4317,2766,1503,1342, 866,4447,1118, 63,2076, 314,1881, 1348,1061, 172, 978,3515,1747, 532, 511,3970, 6, 601, 905,2699,3300,1751, 276, 1467,3725,2668, 65,4239,2544,2779,2556,1604, 578,2451,1802, 992,2331,2624,1320, 3446, 713,1513,1013, 103,2786,2447,1661, 886,1702, 916, 654,3574,2031,1556, 751, 2178,2821,2179,1498,1538,2176, 271, 914,2251,2080,1325, 638,1953,2937,3877,2432, 2754, 95,3265,1716, 260,1227,4083, 775, 106,1357,3254, 426,1607, 555,2480, 772, 1985, 244,2546, 474, 495,1046,2611,1851,2061, 71,2089,1675,2590, 742,3758,2843, 3222,1433, 267,2180,2576,2826,2233,2092,3913,2435, 956,1745,3075, 856,2113,1116, 451, 3,1988,2896,1398, 993,2463,1878,2049,1341,2718,2721,2870,2108, 712,2904, 4363,2753,2324, 277,2872,2349,2649, 384, 987, 435, 691,3000, 922, 164,3939, 652, 1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664, 2530,1434,2408, 893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078, 49,3770, 3469, 462, 318, 656,2259,3250,3069, 679,1629,2758, 344,1138,1104,3120,1836,1283, 3115,2154,1437,4448, 934, 759,1999, 794,2862,1038, 533,2560,1722,2342, 855,2626, 1197,1663,4476,3127, 85,4240,2528, 25,1111,1181,3673, 407,3470,4561,2679,2713, 768,1925,2841,3986,1544,1165, 932, 373,1240,2146,1930,2673, 721,4766, 354,4333, 391,2963, 187, 61,3364,1442,1102, 330,1940,1767, 341,3809,4118, 393,2496,2062, 2211, 105, 331, 300, 439, 913,1332, 626, 379,3304,1557, 328, 689,3952, 309,1555, 931, 317,2517,3027, 325, 569, 686,2107,3084, 60,1042,1333,2794, 264,3177,4014, 1628, 258,3712, 7,4464,1176,1043,1778, 683, 114,1975, 78,1492, 383,1886, 510, 386, 645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015, 1282,1289,4609, 697,1453,3044,2666,3611,1856,2412, 54, 719,1330, 568,3778,2459, 1748, 788, 492, 551,1191,1000, 488,3394,3763, 282,1799, 348,2016,1523,3155,2390, 1049, 382,2019,1788,1170, 729,2968,3523, 897,3926,2785,2938,3292, 350,2319,3238, 1718,1717,2655,3453,3143,4465, 161,2889,2980,2009,1421, 56,1908,1640,2387,2232, 1917,1874,2477,4921, 148, 83,3438, 592,4245,2882,1822,1055, 741, 115,1496,1624, 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, #last 512 ) chardet/sbcsgroupprober.py000064400000006732152347724720011776 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetgroupprober import CharSetGroupProber from .sbcharsetprober import SingleByteCharSetProber from .langcyrillicmodel import (Win1251CyrillicModel, Koi8rModel, Latin5CyrillicModel, MacCyrillicModel, Ibm866Model, Ibm855Model) from .langgreekmodel import Latin7GreekModel, Win1253GreekModel from .langbulgarianmodel import Latin5BulgarianModel, Win1251BulgarianModel # from .langhungarianmodel import Latin2HungarianModel, Win1250HungarianModel from .langthaimodel import TIS620ThaiModel from .langhebrewmodel import Win1255HebrewModel from .hebrewprober import HebrewProber from .langturkishmodel import Latin5TurkishModel class SBCSGroupProber(CharSetGroupProber): def __init__(self): super(SBCSGroupProber, self).__init__() self.probers = [ SingleByteCharSetProber(Win1251CyrillicModel), SingleByteCharSetProber(Koi8rModel), SingleByteCharSetProber(Latin5CyrillicModel), SingleByteCharSetProber(MacCyrillicModel), SingleByteCharSetProber(Ibm866Model), SingleByteCharSetProber(Ibm855Model), SingleByteCharSetProber(Latin7GreekModel), SingleByteCharSetProber(Win1253GreekModel), SingleByteCharSetProber(Latin5BulgarianModel), SingleByteCharSetProber(Win1251BulgarianModel), # TODO: Restore Hungarian encodings (iso-8859-2 and windows-1250) # after we retrain model. # SingleByteCharSetProber(Latin2HungarianModel), # SingleByteCharSetProber(Win1250HungarianModel), SingleByteCharSetProber(TIS620ThaiModel), SingleByteCharSetProber(Latin5TurkishModel), ] hebrew_prober = HebrewProber() logical_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel, False, hebrew_prober) visual_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel, True, hebrew_prober) hebrew_prober.set_model_probers(logical_hebrew_prober, visual_hebrew_prober) self.probers.extend([hebrew_prober, logical_hebrew_prober, visual_hebrew_prober]) self.reset() chardet/euckrfreq.py000064400000032352152347724720010541 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # Sampling from about 20M text materials include literature and computer technology # 128 --> 0.79 # 256 --> 0.92 # 512 --> 0.986 # 1024 --> 0.99944 # 2048 --> 0.99999 # # Idea Distribution Ratio = 0.98653 / (1-0.98653) = 73.24 # Random Distribution Ration = 512 / (2350-512) = 0.279. # # Typical Distribution Ratio EUCKR_TYPICAL_DISTRIBUTION_RATIO = 6.0 EUCKR_TABLE_SIZE = 2352 # Char to FreqOrder table , EUCKR_CHAR_TO_FREQ_ORDER = ( 13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87, 1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398, 1399,1729,1730,1731, 141, 621, 326,1057, 368,1732, 267, 488, 20,1733,1269,1734, 945,1400,1735, 47, 904,1270,1736,1737, 773, 248,1738, 409, 313, 786, 429,1739, 116, 987, 813,1401, 683, 75,1204, 145,1740,1741,1742,1743, 16, 847, 667, 622, 708,1744,1745,1746, 966, 787, 304, 129,1747, 60, 820, 123, 676,1748,1749,1750, 1751, 617,1752, 626,1753,1754,1755,1756, 653,1757,1758,1759,1760,1761,1762, 856, 344,1763,1764,1765,1766, 89, 401, 418, 806, 905, 848,1767,1768,1769, 946,1205, 709,1770,1118,1771, 241,1772,1773,1774,1271,1775, 569,1776, 999,1777,1778,1779, 1780, 337, 751,1058, 28, 628, 254,1781, 177, 906, 270, 349, 891,1079,1782, 19, 1783, 379,1784, 315,1785, 629, 754,1402, 559,1786, 636, 203,1206,1787, 710, 567, 1788, 935, 814,1789,1790,1207, 766, 528,1791,1792,1208,1793,1794,1795,1796,1797, 1403,1798,1799, 533,1059,1404,1405,1156,1406, 936, 884,1080,1800, 351,1801,1802, 1803,1804,1805, 801,1806,1807,1808,1119,1809,1157, 714, 474,1407,1810, 298, 899, 885,1811,1120, 802,1158,1812, 892,1813,1814,1408, 659,1815,1816,1121,1817,1818, 1819,1820,1821,1822, 319,1823, 594, 545,1824, 815, 937,1209,1825,1826, 573,1409, 1022,1827,1210,1828,1829,1830,1831,1832,1833, 556, 722, 807,1122,1060,1834, 697, 1835, 900, 557, 715,1836,1410, 540,1411, 752,1159, 294, 597,1211, 976, 803, 770, 1412,1837,1838, 39, 794,1413, 358,1839, 371, 925,1840, 453, 661, 788, 531, 723, 544,1023,1081, 869, 91,1841, 392, 430, 790, 602,1414, 677,1082, 457,1415,1416, 1842,1843, 475, 327,1024,1417, 795, 121,1844, 733, 403,1418,1845,1846,1847, 300, 119, 711,1212, 627,1848,1272, 207,1849,1850, 796,1213, 382,1851, 519,1852,1083, 893,1853,1854,1855, 367, 809, 487, 671,1856, 663,1857,1858, 956, 471, 306, 857, 1859,1860,1160,1084,1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871, 282, 96, 574,1872, 502,1085,1873,1214,1874, 907,1875,1876, 827, 977,1419,1420, 1421, 268,1877,1422,1878,1879,1880, 308,1881, 2, 537,1882,1883,1215,1884,1885, 127, 791,1886,1273,1423,1887, 34, 336, 404, 643,1888, 571, 654, 894, 840,1889, 0, 886,1274, 122, 575, 260, 908, 938,1890,1275, 410, 316,1891,1892, 100,1893, 1894,1123, 48,1161,1124,1025,1895, 633, 901,1276,1896,1897, 115, 816,1898, 317, 1899, 694,1900, 909, 734,1424, 572, 866,1425, 691, 85, 524,1010, 543, 394, 841, 1901,1902,1903,1026,1904,1905,1906,1907,1908,1909, 30, 451, 651, 988, 310,1910, 1911,1426, 810,1216, 93,1912,1913,1277,1217,1914, 858, 759, 45, 58, 181, 610, 269,1915,1916, 131,1062, 551, 443,1000, 821,1427, 957, 895,1086,1917,1918, 375, 1919, 359,1920, 687,1921, 822,1922, 293,1923,1924, 40, 662, 118, 692, 29, 939, 887, 640, 482, 174,1925, 69,1162, 728,1428, 910,1926,1278,1218,1279, 386, 870, 217, 854,1163, 823,1927,1928,1929,1930, 834,1931, 78,1932, 859,1933,1063,1934, 1935,1936,1937, 438,1164, 208, 595,1938,1939,1940,1941,1219,1125,1942, 280, 888, 1429,1430,1220,1431,1943,1944,1945,1946,1947,1280, 150, 510,1432,1948,1949,1950, 1951,1952,1953,1954,1011,1087,1955,1433,1043,1956, 881,1957, 614, 958,1064,1065, 1221,1958, 638,1001, 860, 967, 896,1434, 989, 492, 553,1281,1165,1959,1282,1002, 1283,1222,1960,1961,1962,1963, 36, 383, 228, 753, 247, 454,1964, 876, 678,1965, 1966,1284, 126, 464, 490, 835, 136, 672, 529, 940,1088,1435, 473,1967,1968, 467, 50, 390, 227, 587, 279, 378, 598, 792, 968, 240, 151, 160, 849, 882,1126,1285, 639,1044, 133, 140, 288, 360, 811, 563,1027, 561, 142, 523,1969,1970,1971, 7, 103, 296, 439, 407, 506, 634, 990,1972,1973,1974,1975, 645,1976,1977,1978,1979, 1980,1981, 236,1982,1436,1983,1984,1089, 192, 828, 618, 518,1166, 333,1127,1985, 818,1223,1986,1987,1988,1989,1990,1991,1992,1993, 342,1128,1286, 746, 842,1994, 1995, 560, 223,1287, 98, 8, 189, 650, 978,1288,1996,1437,1997, 17, 345, 250, 423, 277, 234, 512, 226, 97, 289, 42, 167,1998, 201,1999,2000, 843, 836, 824, 532, 338, 783,1090, 182, 576, 436,1438,1439, 527, 500,2001, 947, 889,2002,2003, 2004,2005, 262, 600, 314, 447,2006, 547,2007, 693, 738,1129,2008, 71,1440, 745, 619, 688,2009, 829,2010,2011, 147,2012, 33, 948,2013,2014, 74, 224,2015, 61, 191, 918, 399, 637,2016,1028,1130, 257, 902,2017,2018,2019,2020,2021,2022,2023, 2024,2025,2026, 837,2027,2028,2029,2030, 179, 874, 591, 52, 724, 246,2031,2032, 2033,2034,1167, 969,2035,1289, 630, 605, 911,1091,1168,2036,2037,2038,1441, 912, 2039, 623,2040,2041, 253,1169,1290,2042,1442, 146, 620, 611, 577, 433,2043,1224, 719,1170, 959, 440, 437, 534, 84, 388, 480,1131, 159, 220, 198, 679,2044,1012, 819,1066,1443, 113,1225, 194, 318,1003,1029,2045,2046,2047,2048,1067,2049,2050, 2051,2052,2053, 59, 913, 112,2054, 632,2055, 455, 144, 739,1291,2056, 273, 681, 499,2057, 448,2058,2059, 760,2060,2061, 970, 384, 169, 245,1132,2062,2063, 414, 1444,2064,2065, 41, 235,2066, 157, 252, 877, 568, 919, 789, 580,2067, 725,2068, 2069,1292,2070,2071,1445,2072,1446,2073,2074, 55, 588, 66,1447, 271,1092,2075, 1226,2076, 960,1013, 372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085, 850, 2086,2087,2088,2089,2090, 186,2091,1068, 180,2092,2093,2094, 109,1227, 522, 606, 2095, 867,1448,1093, 991,1171, 926, 353,1133,2096, 581,2097,2098,2099,1294,1449, 1450,2100, 596,1172,1014,1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452, 949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112, 2113,2114,2115,2116,2117, 804,2118,2119,1230,1231, 805,1456, 405,1136,2120,2121, 2122,2123,2124, 720, 701,1297, 992,1457, 927,1004,2125,2126,2127,2128,2129,2130, 22, 417,2131, 303,2132, 385,2133, 971, 520, 513,2134,1174, 73,1096, 231, 274, 962,1458, 673,2135,1459,2136, 152,1137,2137,2138,2139,2140,1005,1138,1460,1139, 2141,2142,2143,2144, 11, 374, 844,2145, 154,1232, 46,1461,2146, 838, 830, 721, 1233, 106,2147, 90, 428, 462, 578, 566,1175, 352,2148,2149, 538,1234, 124,1298, 2150,1462, 761, 565,2151, 686,2152, 649,2153, 72, 173,2154, 460, 415,2155,1463, 2156,1235, 305,2157,2158,2159,2160,2161,2162, 579,2163,2164,2165,2166,2167, 747, 2168,2169,2170,2171,1464, 669,2172,2173,2174,2175,2176,1465,2177, 23, 530, 285, 2178, 335, 729,2179, 397,2180,2181,2182,1030,2183,2184, 698,2185,2186, 325,2187, 2188, 369,2189, 799,1097,1015, 348,2190,1069, 680,2191, 851,1466,2192,2193, 10, 2194, 613, 424,2195, 979, 108, 449, 589, 27, 172, 81,1031, 80, 774, 281, 350, 1032, 525, 301, 582,1176,2196, 674,1045,2197,2198,1467, 730, 762,2199,2200,2201, 2202,1468,2203, 993,2204,2205, 266,1070, 963,1140,2206,2207,2208, 664,1098, 972, 2209,2210,2211,1177,1469,1470, 871,2212,2213,2214,2215,2216,1471,2217,2218,2219, 2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233, 2234,2235,1299,2236,2237, 200,2238, 477, 373,2239,2240, 731, 825, 777,2241,2242, 2243, 521, 486, 548,2244,2245,2246,1473,1300, 53, 549, 137, 875, 76, 158,2247, 1301,1474, 469, 396,1016, 278, 712,2248, 321, 442, 503, 767, 744, 941,1237,1178, 1475,2249, 82, 178,1141,1179, 973,2250,1302,2251, 297,2252,2253, 570,2254,2255, 2256, 18, 450, 206,2257, 290, 292,1142,2258, 511, 162, 99, 346, 164, 735,2259, 1476,1477, 4, 554, 343, 798,1099,2260,1100,2261, 43, 171,1303, 139, 215,2262, 2263, 717, 775,2264,1033, 322, 216,2265, 831,2266, 149,2267,1304,2268,2269, 702, 1238, 135, 845, 347, 309,2270, 484,2271, 878, 655, 238,1006,1478,2272, 67,2273, 295,2274,2275, 461,2276, 478, 942, 412,2277,1034,2278,2279,2280, 265,2281, 541, 2282,2283,2284,2285,2286, 70, 852,1071,2287,2288,2289,2290, 21, 56, 509, 117, 432,2291,2292, 331, 980, 552,1101, 148, 284, 105, 393,1180,1239, 755,2293, 187, 2294,1046,1479,2295, 340,2296, 63,1047, 230,2297,2298,1305, 763,1306, 101, 800, 808, 494,2299,2300,2301, 903,2302, 37,1072, 14, 5,2303, 79, 675,2304, 312, 2305,2306,2307,2308,2309,1480, 6,1307,2310,2311,2312, 1, 470, 35, 24, 229, 2313, 695, 210, 86, 778, 15, 784, 592, 779, 32, 77, 855, 964,2314, 259,2315, 501, 380,2316,2317, 83, 981, 153, 689,1308,1481,1482,1483,2318,2319, 716,1484, 2320,2321,2322,2323,2324,2325,1485,2326,2327, 128, 57, 68, 261,1048, 211, 170, 1240, 31,2328, 51, 435, 742,2329,2330,2331, 635,2332, 264, 456,2333,2334,2335, 425,2336,1486, 143, 507, 263, 943,2337, 363, 920,1487, 256,1488,1102, 243, 601, 1489,2338,2339,2340,2341,2342,2343,2344, 861,2345,2346,2347,2348,2349,2350, 395, 2351,1490,1491, 62, 535, 166, 225,2352,2353, 668, 419,1241, 138, 604, 928,2354, 1181,2355,1492,1493,2356,2357,2358,1143,2359, 696,2360, 387, 307,1309, 682, 476, 2361,2362, 332, 12, 222, 156,2363, 232,2364, 641, 276, 656, 517,1494,1495,1035, 416, 736,1496,2365,1017, 586,2366,2367,2368,1497,2369, 242,2370,2371,2372,1498, 2373, 965, 713,2374,2375,2376,2377, 740, 982,1499, 944,1500,1007,2378,2379,1310, 1501,2380,2381,2382, 785, 329,2383,2384,1502,2385,2386,2387, 932,2388,1503,2389, 2390,2391,2392,1242,2393,2394,2395,2396,2397, 994, 950,2398,2399,2400,2401,1504, 1311,2402,2403,2404,2405,1049, 749,2406,2407, 853, 718,1144,1312,2408,1182,1505, 2409,2410, 255, 516, 479, 564, 550, 214,1506,1507,1313, 413, 239, 444, 339,1145, 1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414, 176, 703, 497, 624, 593, 921, 302,2415, 341, 165,1103,1512,2416,1513,2417,2418,2419, 376,2420, 700, 2421,2422,2423, 258, 768,1316,2424,1183,2425, 995, 608,2426,2427,2428,2429, 221, 2430,2431,2432,2433,2434,2435,2436,2437, 195, 323, 726, 188, 897, 983,1317, 377, 644,1050, 879,2438, 452,2439,2440,2441,2442,2443,2444, 914,2445,2446,2447,2448, 915, 489,2449,1514,1184,2450,2451, 515, 64, 427, 495,2452, 583,2453, 483, 485, 1038, 562, 213,1515, 748, 666,2454,2455,2456,2457, 334,2458, 780, 996,1008, 705, 1243,2459,2460,2461,2462,2463, 114,2464, 493,1146, 366, 163,1516, 961,1104,2465, 291,2466,1318,1105,2467,1517, 365,2468, 355, 951,1244,2469,1319,2470, 631,2471, 2472, 218,1320, 364, 320, 756,1518,1519,1321,1520,1322,2473,2474,2475,2476, 997, 2477,2478,2479,2480, 665,1185,2481, 916,1521,2482,2483,2484, 584, 684,2485,2486, 797,2487,1051,1186,2488,2489,2490,1522,2491,2492, 370,2493,1039,1187, 65,2494, 434, 205, 463,1188,2495, 125, 812, 391, 402, 826, 699, 286, 398, 155, 781, 771, 585,2496, 590, 505,1073,2497, 599, 244, 219, 917,1018, 952, 646,1523,2498,1323, 2499,2500, 49, 984, 354, 741,2501, 625,2502,1324,2503,1019, 190, 357, 757, 491, 95, 782, 868,2504,2505,2506,2507,2508,2509, 134,1524,1074, 422,1525, 898,2510, 161,2511,2512,2513,2514, 769,2515,1526,2516,2517, 411,1325,2518, 472,1527,2519, 2520,2521,2522,2523,2524, 985,2525,2526,2527,2528,2529,2530, 764,2531,1245,2532, 2533, 25, 204, 311,2534, 496,2535,1052,2536,2537,2538,2539,2540,2541,2542, 199, 704, 504, 468, 758, 657,1528, 196, 44, 839,1246, 272, 750,2543, 765, 862,2544, 2545,1326,2546, 132, 615, 933,2547, 732,2548,2549,2550,1189,1529,2551, 283,1247, 1053, 607, 929,2552,2553,2554, 930, 183, 872, 616,1040,1147,2555,1148,1020, 441, 249,1075,2556,2557,2558, 466, 743,2559,2560,2561, 92, 514, 426, 420, 526,2562, 2563,2564,2565,2566,2567,2568, 185,2569,2570,2571,2572, 776,1530, 658,2573, 362, 2574, 361, 922,1076, 793,2575,2576,2577,2578,2579,2580,1531, 251,2581,2582,2583, 2584,1532, 54, 612, 237,1327,2585,2586, 275, 408, 647, 111,2587,1533,1106, 465, 3, 458, 9, 38,2588, 107, 110, 890, 209, 26, 737, 498,2589,1534,2590, 431, 202, 88,1535, 356, 287,1107, 660,1149,2591, 381,1536, 986,1150, 445,1248,1151, 974,2592,2593, 846,2594, 446, 953, 184,1249,1250, 727,2595, 923, 193, 883,2596, 2597,2598, 102, 324, 539, 817,2599, 421,1041,2600, 832,2601, 94, 175, 197, 406, 2602, 459,2603,2604,2605,2606,2607, 330, 555,2608,2609,2610, 706,1108, 389,2611, 2612,2613,2614, 233,2615, 833, 558, 931, 954,1251,2616,2617,1537, 546,2618,2619, 1009,2620,2621,2622,1538, 690,1328,2623, 955,2624,1539,2625,2626, 772,2627,2628, 2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042, 670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, # 512, 256 ) chardet/langcyrillicmodel.py000064400000043034152347724720012246 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # KOI8-R language model # Character Mapping Table: KOI8R_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, # 80 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, # 90 223,224,225, 68,226,227,228,229,230,231,232,233,234,235,236,237, # a0 238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, # b0 27, 3, 21, 28, 13, 2, 39, 19, 26, 4, 23, 11, 8, 12, 5, 1, # c0 15, 16, 9, 7, 6, 14, 24, 10, 17, 18, 20, 25, 30, 29, 22, 54, # d0 59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, # e0 35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70, # f0 ) win1251_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 239,240,241,242,243,244,245,246, 68,247,248,249,250,251,252,253, 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, ) latin5_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, 239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255, ) macCyrillic_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 239,240,241,242,243,244,245,246,247,248,249,250,251,252, 68, 16, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255, ) IBM855_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 191,192,193,194, 68,195,196,197,198,199,200,201,202,203,204,205, 206,207,208,209,210,211,212,213,214,215,216,217, 27, 59, 54, 70, 3, 37, 21, 44, 28, 58, 13, 41, 2, 48, 39, 53, 19, 46,218,219, 220,221,222,223,224, 26, 55, 4, 42,225,226,227,228, 23, 60,229, 230,231,232,233,234,235, 11, 36,236,237,238,239,240,241,242,243, 8, 49, 12, 38, 5, 31, 1, 34, 15,244,245,246,247, 35, 16,248, 43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249, 250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255, ) IBM866_char_to_order_map = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, 239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255, ) # Model Table: # total sequences: 100% # first 512 sequences: 97.6601% # first 1024 sequences: 2.3389% # rest sequences: 0.1237% # negative sequences: 0.0009% RussianLangModel = ( 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,2,3,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,2,3,3,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, 0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, 0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,2,2,2,3,1,3,3,1,3,3,3,3,2,2,3,0,2,2,2,3,3,2,1,0, 0,0,0,0,0,0,0,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0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,1,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0, 0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, ) Koi8rModel = { 'char_to_order_map': KOI8R_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "KOI8-R", 'language': 'Russian', } Win1251CyrillicModel = { 'char_to_order_map': win1251_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "windows-1251", 'language': 'Russian', } Latin5CyrillicModel = { 'char_to_order_map': latin5_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "ISO-8859-5", 'language': 'Russian', } MacCyrillicModel = { 'char_to_order_map': macCyrillic_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "MacCyrillic", 'language': 'Russian', } Ibm866Model = { 'char_to_order_map': IBM866_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "IBM866", 'language': 'Russian', } Ibm855Model = { 'char_to_order_map': IBM855_char_to_order_map, 'precedence_matrix': RussianLangModel, 'typical_positive_ratio': 0.976601, 'keep_english_letter': False, 'charset_name': "IBM855", 'language': 'Russian', } chardet/charsetprober.py000064400000011766152347724720011423 0ustar00######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### import logging import re from .enums import ProbingState class CharSetProber(object): SHORTCUT_THRESHOLD = 0.95 def __init__(self, lang_filter=None): self._state = None self.lang_filter = lang_filter self.logger = logging.getLogger(__name__) def reset(self): self._state = ProbingState.DETECTING @property def charset_name(self): return None def feed(self, buf): pass @property def state(self): return self._state def get_confidence(self): return 0.0 @staticmethod def filter_high_byte_only(buf): buf = re.sub(b'([\x00-\x7F])+', b' ', buf) return buf @staticmethod def filter_international_words(buf): """ We define three types of bytes: alphabet: english alphabets [a-zA-Z] international: international characters [\x80-\xFF] marker: everything else [^a-zA-Z\x80-\xFF] The input buffer can be thought to contain a series of words delimited by markers. This function works to filter all words that contain at least one international character. All contiguous sequences of markers are replaced by a single space ascii character. This filter applies to all scripts which do not use English characters. """ filtered = bytearray() # This regex expression filters out only words that have at-least one # international character. The word may include one marker character at # the end. words = re.findall(b'[a-zA-Z]*[\x80-\xFF]+[a-zA-Z]*[^a-zA-Z\x80-\xFF]?', buf) for word in words: filtered.extend(word[:-1]) # If the last character in the word is a marker, replace it with a # space as markers shouldn't affect our analysis (they are used # similarly across all languages and may thus have similar # frequencies). last_char = word[-1:] if not last_char.isalpha() and last_char < b'\x80': last_char = b' ' filtered.extend(last_char) return filtered @staticmethod def filter_with_english_letters(buf): """ Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain both English characters and extended ASCII characters, but is currently only used by ``Latin1Prober``. """ filtered = bytearray() in_tag = False prev = 0 for curr in range(len(buf)): # Slice here to get bytes instead of an int with Python 3 buf_char = buf[curr:curr + 1] # Check if we're coming out of or entering an HTML tag if buf_char == b'>': in_tag = False elif buf_char == b'<': in_tag = True # If current character is not extended-ASCII and not alphabetic... if buf_char < b'\x80' and not buf_char.isalpha(): # ...and we're not in a tag if curr > prev and not in_tag: # Keep everything after last non-extended-ASCII, # non-alphabetic character filtered.extend(buf[prev:curr]) # Output a space to delimit stretch we kept filtered.extend(b' ') prev = curr + 1 # If we're not in a tag... if not in_tag: # Keep everything after last non-extended-ASCII, non-alphabetic # character filtered.extend(buf[prev:]) return filtered colorama/__pycache__/ansi.cpython-36.pyc000064400000006276152347724720014161 0ustar003 Pf @sdZdZdZdZddZddZdd d Zdd d ZGd ddeZ GdddeZ Gddde Z Gddde Z Gddde Z e Ze Ze Ze ZdS)z This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code z]cCstt|dS)Nm)CSIstr)coder/usr/lib/python3.6/ansi.py code_to_chars srcCstd|tS)Nz2;)OSCBEL)titlerrr set_titlesr cCstt|dS)NJ)rr)moderrr clear_screensrcCstt|dS)NK)rr)rrrr clear_linesrc@seZdZddZdS) AnsiCodescCs:x4t|D](}|jds t||}t||t|q WdS)N_)dir startswithgetattrsetattrr)selfnamevaluerrr__init__s  zAnsiCodes.__init__N)__name__ __module__ __qualname__rrrrrrsrc@s>eZdZd ddZdddZdddZddd Zdd d Zd S) AnsiCursorcCstt|dS)NA)rr)rnrrrUP%sz AnsiCursor.UPcCstt|dS)NB)rr)rr#rrrDOWN'szAnsiCursor.DOWNcCstt|dS)NC)rr)rr#rrrFORWARD)szAnsiCursor.FORWARDcCstt|dS)ND)rr)rr#rrrBACK+szAnsiCursor.BACKcCstt|dt|dS)N;H)rr)rxyrrrPOS-szAnsiCursor.POSN)r!)r!)r!)r!)r!r!)rrrr$r&r(r*r/rrrrr $s     r c@sPeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdS)AnsiFore !"#$%'Z[\]^_`aN)rrrBLACKREDGREENYELLOWBLUEMAGENTACYANWHITERESET LIGHTBLACK_EX LIGHTRED_EX LIGHTGREEN_EXLIGHTYELLOW_EX LIGHTBLUE_EXLIGHTMAGENTA_EX LIGHTCYAN_EX LIGHTWHITE_EXrrrrr01s"r0c@sPeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdS)AnsiBack()*+,-./1defghijkN)rrrrBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrrrrrSGs"rSc@seZdZdZdZdZdZdS) AnsiStyler!r N)rrrZBRIGHTZDIMZNORMALZ RESET_ALLrrrrre]sreN)r )r )__doc__rr r rr rrobjectrr r0rSreZForeZBackZStyleZCursorrrrrs     colorama/__pycache__/winterm.cpython-36.opt-1.pyc000064400000010607152347724720015644 0ustar003 Pf@s@ddlmZGdddeZGdddeZGdddeZdS) )win32c@s,eZdZdZdZdZdZdZdZdZ dZ d S) WinColorrN) __name__ __module__ __qualname__ZBLACKZBLUEZGREENZCYANZREDZMAGENTAZYELLOWZGREYrr/usr/lib/python3.6/winterm.pyrsrc@seZdZdZdZdZdS)WinStylerN)r r r ZNORMALBRIGHTBRIGHT_BACKGROUNDrrrrrsrc@seZdZddZddZddZd dd Zd!d d Zd"d dZd#ddZ d$ddZ ddZ d%ddZ d&ddZ d'ddZd(ddZddZdS))WinTermcCs>tjtjj|_|j|j|j|_|j|_ |j |_ d|_ dS)Nr) rGetConsoleScreenBufferInfoSTDOUTZ wAttributes_default set_attrs_fore _default_fore_back _default_back_style_default_style_light)selfrrr__init__s  zWinTerm.__init__cCs|j|jd|j|jBS)N)rrrr )r!rrr get_attrs$szWinTerm.get_attrscCs.|d@|_|d?d@|_|tjtjB@|_dS)Nr r)rrrrrr)r!valuerrrr's zWinTerm.set_attrsNcCs|j|j|j|jddS)N)attrs)rr set_console)r! on_stderrrrr reset_all,s zWinTerm.reset_allFcCsL|dkr|j}||_|r*|jtjO_n|jtjM_|j|ddS)N)r()rrr rrr')r!forelightr(rrrr*0sz WinTerm.forecCsL|dkr|j}||_|r*|jtjO_n|jtjM_|j|ddS)N)r()rrr rrr')r!backr+r(rrrr,;sz WinTerm.backcCs$|dkr|j}||_|j|ddS)N)r()rrr')r!styler(rrrr-Fsz WinTerm.stylecCs0|dkr|j}tj}|r tj}tj||dS)N)r$rrSTDERRZSetConsoleTextAttribute)r!r&r(handlerrrr'Ls zWinTerm.set_consolecCs,tj|j}|jd7_|jd7_|S)Nr)rrdwCursorPositionXY)r!r/positionrrr get_positionTs zWinTerm.get_positioncCs,|dkr dStj}|rtj}tj||dS)N)rrr.SetConsoleCursorPosition)r!r3r(r/rrrset_cursor_position\s zWinTerm.set_cursor_positioncCsBtj}|rtj}|j|}|j||j|f}tj||dddS)NF)Zadjust)rrr.r4r2r1r5)r!xyr(r/r3Zadjusted_positionrrr cursor_adjustfs  zWinTerm.cursor_adjustrc Cstj}|rtj}tj|}|jj|jj}|jj|jj|jj}|dkrX|j}||}|dkrrtjdd}|}n|dkrtjdd}|}tj |d||tj ||j |||dkrtj |ddS)Nrrr )rr) rrr.rdwSizer1r2r0COORDFillConsoleOutputCharacterFillConsoleOutputAttributer$r5) r!moder(r/csbiZcells_in_screenZcells_before_cursor from_coordcells_to_eraserrr erase_screenns&   zWinTerm.erase_screencCstj}|rtj}tj|}|dkr8|j}|jj|jj}|dkrZtjd|jj}|jj}n |dkrztjd|jj}|jj}tj |d||tj ||j ||dS)Nrrrr:) rrr.rr0r;r1r<r2r=r>r$)r!r?r(r/r@rArBrrr erase_lines  zWinTerm.erase_linecCstj|dS)N)rZSetConsoleTitle)r!titlerrr set_titleszWinTerm.set_title)N)NFF)NFF)NF)NF)NF)F)rF)rF)r r r r"r$rr)r*r,r-r'r4r6r9rCrDrFrrrrrs       rN)robjectrrrrrrrs  colorama/__pycache__/ansi.cpython-36.opt-1.pyc000064400000006276152347724720015120 0ustar003 Pf @sdZdZdZdZddZddZdd d Zdd d ZGd ddeZ GdddeZ Gddde Z Gddde Z Gddde Z e Ze Ze Ze ZdS)z This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code z]cCstt|dS)Nm)CSIstr)coder/usr/lib/python3.6/ansi.py code_to_chars srcCstd|tS)Nz2;)OSCBEL)titlerrr set_titlesr cCstt|dS)NJ)rr)moderrr clear_screensrcCstt|dS)NK)rr)rrrr clear_linesrc@seZdZddZdS) AnsiCodescCs:x4t|D](}|jds t||}t||t|q WdS)N_)dir startswithgetattrsetattrr)selfnamevaluerrr__init__s  zAnsiCodes.__init__N)__name__ __module__ __qualname__rrrrrrsrc@s>eZdZd ddZdddZdddZddd Zdd d Zd S) AnsiCursorcCstt|dS)NA)rr)rnrrrUP%sz AnsiCursor.UPcCstt|dS)NB)rr)rr#rrrDOWN'szAnsiCursor.DOWNcCstt|dS)NC)rr)rr#rrrFORWARD)szAnsiCursor.FORWARDcCstt|dS)ND)rr)rr#rrrBACK+szAnsiCursor.BACKcCstt|dt|dS)N;H)rr)rxyrrrPOS-szAnsiCursor.POSN)r!)r!)r!)r!)r!r!)rrrr$r&r(r*r/rrrrr $s     r c@sPeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdS)AnsiFore !"#$%'Z[\]^_`aN)rrrBLACKREDGREENYELLOWBLUEMAGENTACYANWHITERESET LIGHTBLACK_EX LIGHTRED_EX LIGHTGREEN_EXLIGHTYELLOW_EX LIGHTBLUE_EXLIGHTMAGENTA_EX LIGHTCYAN_EX LIGHTWHITE_EXrrrrr01s"r0c@sPeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdS)AnsiBack()*+,-./1defghijkN)rrrrBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrrrrrSGs"rSc@seZdZdZdZdZdZdS) AnsiStyler!r N)rrrZBRIGHTZDIMZNORMALZ RESET_ALLrrrrre]sreN)r )r )__doc__rr r rr rrobjectrr r0rSreZForeZBackZStyleZCursorrrrrs     colorama/__pycache__/ansitowin32.cpython-36.pyc000064400000015522152347724720015401 0ustar003 Pf%@sddlZddlZddlZddlmZmZmZmZddlm Z m Z m Z ddl m Z mZdZe dk rfe ZddZdd ZGd d d eZGd d d eZdS)N)AnsiForeAnsiBack AnsiStyleStyle)WinTermWinColorWinStyle)windll winapi_testcCst|d p|jS)Nclosed)hasattrr )streamr!/usr/lib/python3.6/ansitowin32.pyis_stream_closedsrcCst|do|jS)Nisatty)r r)rrrris_a_ttysrc@s(eZdZdZddZddZddZdS) StreamWrapperz Wraps a stream (such as stdout), acting as a transparent proxy for all attribute access apart from method 'write()', which is delegated to our Converter instance. cCs||_||_dS)N)_StreamWrapper__wrapped_StreamWrapper__convertor)selfwrappedZ converterrrr__init__szStreamWrapper.__init__cCs t|j|S)N)getattrr)rnamerrr __getattr__$szStreamWrapper.__getattr__cCs|jj|dS)N)rwrite)rtextrrrr'szStreamWrapper.writeN)__name__ __module__ __qualname____doc__rrrrrrrrsrc@s~eZdZdZejdZejdZdddZdd Z d d Z d d Z ddZ ddZ ddZddZddZddZddZdS) AnsiToWin32z Implements a 'write()' method which, on Windows, will strip ANSI character sequences from the text, and if outputting to a tty, will convert them into win32 function calls. z?\[((?:\d|;)*)([a-zA-Z])?z?\]((?:.|;)*?)()?NFcCs||_||_t|||_tjdk}|o*t}|dkrL|pJt| oJt| }||_ |dkrp|ont| ont|}||_ |j |_ |jt jk|_dS)Nnt)r autoresetrrosrr rrstripconvertget_win32_calls win32_callssysstderr on_stderr)rrr(r'r%Z on_windowsZconversion_supportedrrrr4s    zAnsiToWin32.__init__cCs|jp|jp|jS)aj True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requested using kwargs to init() )r(r'r%)rrrr should_wrapUszAnsiToWin32.should_wrapcNCs>|jotr8tjtjftjtjtjftjtjtj ftj tjtj ft j tj t j ft jtj t jft jtj t jft jtj t jft jtj t jft jtj t jft jtj t jft jtj t jft jtj ft jtj t j dft jtj t jdft jtj t jdft jtj t jdft jtj t jdft jtj t jdft jtj t jdft jtj t jdftj tj t j ftjtj t jftjtj t jftjtj t jftjtj t jftjtj t jftjtj t jftjtj t jftjtj ftjtj t j dftjtj t jdftjtj t jdftjtj t jdftjtj t jdftjtj t jdftjtj t jdftjtj t jdfi&St!S)NT)"r(wintermr RESET_ALL reset_allZBRIGHTZstyler ZDIMZNORMALrZBLACKZforerZREDZGREENZYELLOWZBLUEZMAGENTAZCYANZWHITEZGREYZRESETZ LIGHTBLACK_EXZ LIGHTRED_EXZ LIGHTGREEN_EXZLIGHTYELLOW_EXZ LIGHTBLUE_EXZLIGHTMAGENTA_EXZ LIGHTCYAN_EXZ LIGHTWHITE_EXrZbackdict)rrrrr)_sP    zAnsiToWin32.get_win32_callscCs@|js |jr|j|n|jj||jj|jr<|jdS)N)r'r(write_and_convertrrflushr%r1)rrrrrrs     zAnsiToWin32.writecCs:|jr|jddn"|j r6t|j r6|jjtjdS)Nmr)r)r( call_win32r'rrrrr0)rrrrr1szAnsiToWin32.reset_allcCsfd}|j|}x@|jj|D]0}|j\}}|j||||j|j|}qW|j||t|dS)z Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. rN) convert_osc ANSI_CSI_REfinditerspanwrite_plain_text convert_ansigroupslen)rrZcursormatchstartendrrrr3s  zAnsiToWin32.write_and_convertcCs*||kr&|jj||||jjdS)N)rrr4)rrr@rArrrr;szAnsiToWin32.write_plain_textcCs"|jr|j||}|j||dS)N)r(extract_paramsr6)r paramstringcommandparamsrrrr<s zAnsiToWin32.convert_ansicCs~|dkrtdd|jdD}t|dkrz|d krnd }n |d krzd }|S)NHfcss&|]}t|dkrt|ndVqdS)rrN)r>int).0prrr sz-AnsiToWin32.extract_params..;rcss"|]}t|dkrt|VqdS)rN)r>rG)rHrIrrrrJsrZJKmABCD)r)r)r)tuplesplitr>)rrDrCrErrrrBs zAnsiToWin32.extract_paramsc Cs|dkrVx|D]B}||jkr|j|}|d}|dd}t|jd}|||qWn|dkrttj|d|jdn|dkrtj|d|jdnf|dkrtj||jdnL|dkr|d}d| fd|f|df| dfd |\} } tj| | |jddS) Nr5rr)r-JKrFrM)ABCD)r*r2r-r/Z erase_screenZ erase_lineZset_cursor_positionZ cursor_adjust) rrDrEZparamZ func_argsfuncargskwargsnxyrrrr6s$     *zAnsiToWin32.call_win32cCsvxp|jj|D]`}|j\}}|d|||d}|j\}}|dkr|jd}|ddkrtj|dqW|S)NrKrZ02r) ANSI_OSC_REr9r:r=rOr/Z set_title)rrr?r@rArCrDrErrrr7s    zAnsiToWin32.convert_osc)NNF)rr r!r"recompiler8r]rr.r)rr1r3r;r<rBr6r7rrrrr#+s   ! , r#)r^r+r&ansirrrrr/rrr Zwin32r r rrobjectrr#rrrrscolorama/__pycache__/win32.cpython-36.opt-1.pyc000064400000006743152347724720015127 0ustar003 Pf@sdZdZy.ddlZddlmZeejZddlmZWn.eefk rddZddZ ddZ YnfXdd lm Z m Z m Z mZejZGd d d e ZejjZejge_eje_ejjZejeege_eje_ejj Zejejge_eje_ejjZejege_eje_ejj Z!eje ejeeejge!_eje!_ejj"Z#ejejejeeejge#_eje#_ejj$Z%ej&ge%_eje%_eeeeeeiZ'd d Z efddZddZ dddZddZ(ddZ"ddZ)dS) N) LibraryLoader)wintypescGsdS)N)_rr/usr/lib/python3.6/win32.pysr cGsdS)Nr)rrrrr s)byref Structurec_charPOINTERc@s>eZdZdZdefdefdejfdejfdefgZddZ d S) CONSOLE_SCREEN_BUFFER_INFOzstruct in wincon.h.dwSizedwCursorPosition wAttributessrWindowdwMaximumWindowSizec CsHd|jj|jj|jj|jj|j|jj|jj|jj|jj |j j|j jf S)Nz"(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)) rYXrrrTopLeftZBottomZRightr)selfrrr__str__s   z"CONSOLE_SCREEN_BUFFER_INFO.__str__N) __name__ __module__ __qualname____doc__COORDrWORDZ SMALL_RECTZ_fields_rrrrrrs rcCs$tt}t}t|t|}t|S)N)handlesSTDOUTr_GetConsoleScreenBufferInfor bool)handlecsbisuccessrrr winapi_testas  r'cCs t|}t}t|t|}|S)N)r rr"r ) stream_idr$r%r&rrrGetConsoleScreenBufferInfohs  r)cCst|}t||S)N)r _SetConsoleTextAttribute)r(Zattrsr$rrrSetConsoleTextAttributeosr+TcCsvt|}|jdks|jdkr dSt|jd|jd}|rdttj}|j|j7_|j|j7_t|}t ||S)Nr) rrrr)r!rrrr _SetConsoleCursorPosition)r(ZpositionZadjustZadjusted_positionsrr$rrrSetConsoleCursorPositionss r/cCsBt|}t|j}tj|}tjd}t||||t|}|jS)Nr)r r encoderDWORD_FillConsoleOutputCharacterAr value)r(charlengthstartr$ num_writtenr&rrrFillConsoleOutputCharacters   r8cCs:t|}tj|}tj|}tjd}t||||t|S)za FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )r)r rrr1_FillConsoleOutputAttributer )r(attrr5r6r$Z attributer7rrrFillConsoleOutputAttributes    r;cCst|S)N)_SetConsoleTitleW)titlerrrSetConsoleTitlesr>ii)T)*r!ZSTDERRZctypesrZWinDLLZwindllrAttributeError ImportErrorr+r'r r r r Z_COORDrrZkernel32Z GetStdHandleZ _GetStdHandler1ZargtypesZHANDLEZrestyper)r"ZBOOLr*rr/r-ZFillConsoleOutputCharacterAr2r;r9ZSetConsoleTitleAr<ZLPCSTRr r8r>rrrrsl           colorama/__pycache__/win32.cpython-36.pyc000064400000006743152347724720014170 0ustar003 Pf@sdZdZy.ddlZddlmZeejZddlmZWn.eefk rddZddZ ddZ YnfXdd lm Z m Z m Z mZejZGd d d e ZejjZejge_eje_ejjZejeege_eje_ejj Zejejge_eje_ejjZejege_eje_ejj Z!eje ejeeejge!_eje!_ejj"Z#ejejejeeejge#_eje#_ejj$Z%ej&ge%_eje%_eeeeeeiZ'd d Z efddZddZ dddZddZ(ddZ"ddZ)dS) N) LibraryLoader)wintypescGsdS)N)_rr/usr/lib/python3.6/win32.pysr cGsdS)Nr)rrrrr s)byref Structurec_charPOINTERc@s>eZdZdZdefdefdejfdejfdefgZddZ d S) CONSOLE_SCREEN_BUFFER_INFOzstruct in wincon.h.dwSizedwCursorPosition wAttributessrWindowdwMaximumWindowSizec CsHd|jj|jj|jj|jj|j|jj|jj|jj|jj |j j|j jf S)Nz"(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)) rYXrrrTopLeftZBottomZRightr)selfrrr__str__s   z"CONSOLE_SCREEN_BUFFER_INFO.__str__N) __name__ __module__ __qualname____doc__COORDrWORDZ SMALL_RECTZ_fields_rrrrrrs rcCs$tt}t}t|t|}t|S)N)handlesSTDOUTr_GetConsoleScreenBufferInfor bool)handlecsbisuccessrrr winapi_testas  r'cCs t|}t}t|t|}|S)N)r rr"r ) stream_idr$r%r&rrrGetConsoleScreenBufferInfohs  r)cCst|}t||S)N)r _SetConsoleTextAttribute)r(Zattrsr$rrrSetConsoleTextAttributeosr+TcCsvt|}|jdks|jdkr dSt|jd|jd}|rdttj}|j|j7_|j|j7_t|}t ||S)Nr) rrrr)r!rrrr _SetConsoleCursorPosition)r(ZpositionZadjustZadjusted_positionsrr$rrrSetConsoleCursorPositionss r/cCsBt|}t|j}tj|}tjd}t||||t|}|jS)Nr)r r encoderDWORD_FillConsoleOutputCharacterAr value)r(charlengthstartr$ num_writtenr&rrrFillConsoleOutputCharacters   r8cCs:t|}tj|}tj|}tjd}t||||t|S)za FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )r)r rrr1_FillConsoleOutputAttributer )r(attrr5r6r$Z attributer7rrrFillConsoleOutputAttributes    r;cCst|S)N)_SetConsoleTitleW)titlerrrSetConsoleTitlesr>ii)T)*r!ZSTDERRZctypesrZWinDLLZwindllrAttributeError ImportErrorr+r'r r r r Z_COORDrrZkernel32Z GetStdHandleZ _GetStdHandler1ZargtypesZHANDLEZrestyper)r"ZBOOLr*rr/r-ZFillConsoleOutputCharacterAr2r;r9ZSetConsoleTitleAr<ZLPCSTRr r8r>rrrrsl           colorama/__pycache__/__init__.cpython-36.pyc000064400000000554152347724720014757 0ustar003 Pf@sDddlmZmZmZmZddlmZmZmZm Z ddl m Z dZ dS))initdeinitreinit colorama_text)ForeBackStyleCursor) AnsiToWin32z0.3.7N) Z initialiserrrransirrrr Z ansitowin32r __version__r r /usr/lib/python3.6/__init__.pys colorama/__pycache__/winterm.cpython-36.pyc000064400000010607152347724720014705 0ustar003 Pf@s@ddlmZGdddeZGdddeZGdddeZdS) )win32c@s,eZdZdZdZdZdZdZdZdZ dZ d S) WinColorrN) __name__ __module__ __qualname__ZBLACKZBLUEZGREENZCYANZREDZMAGENTAZYELLOWZGREYrr/usr/lib/python3.6/winterm.pyrsrc@seZdZdZdZdZdS)WinStylerN)r r r ZNORMALBRIGHTBRIGHT_BACKGROUNDrrrrrsrc@seZdZddZddZddZd dd Zd!d d Zd"d dZd#ddZ d$ddZ ddZ d%ddZ d&ddZ d'ddZd(ddZddZdS))WinTermcCs>tjtjj|_|j|j|j|_|j|_ |j |_ d|_ dS)Nr) rGetConsoleScreenBufferInfoSTDOUTZ wAttributes_default set_attrs_fore _default_fore_back _default_back_style_default_style_light)selfrrr__init__s  zWinTerm.__init__cCs|j|jd|j|jBS)N)rrrr )r!rrr get_attrs$szWinTerm.get_attrscCs.|d@|_|d?d@|_|tjtjB@|_dS)Nr r)rrrrrr)r!valuerrrr's zWinTerm.set_attrsNcCs|j|j|j|jddS)N)attrs)rr set_console)r! on_stderrrrr reset_all,s zWinTerm.reset_allFcCsL|dkr|j}||_|r*|jtjO_n|jtjM_|j|ddS)N)r()rrr rrr')r!forelightr(rrrr*0sz WinTerm.forecCsL|dkr|j}||_|r*|jtjO_n|jtjM_|j|ddS)N)r()rrr rrr')r!backr+r(rrrr,;sz WinTerm.backcCs$|dkr|j}||_|j|ddS)N)r()rrr')r!styler(rrrr-Fsz WinTerm.stylecCs0|dkr|j}tj}|r tj}tj||dS)N)r$rrSTDERRZSetConsoleTextAttribute)r!r&r(handlerrrr'Ls zWinTerm.set_consolecCs,tj|j}|jd7_|jd7_|S)Nr)rrdwCursorPositionXY)r!r/positionrrr get_positionTs zWinTerm.get_positioncCs,|dkr dStj}|rtj}tj||dS)N)rrr.SetConsoleCursorPosition)r!r3r(r/rrrset_cursor_position\s zWinTerm.set_cursor_positioncCsBtj}|rtj}|j|}|j||j|f}tj||dddS)NF)Zadjust)rrr.r4r2r1r5)r!xyr(r/r3Zadjusted_positionrrr cursor_adjustfs  zWinTerm.cursor_adjustrc Cstj}|rtj}tj|}|jj|jj}|jj|jj|jj}|dkrX|j}||}|dkrrtjdd}|}n|dkrtjdd}|}tj |d||tj ||j |||dkrtj |ddS)Nrrr )rr) rrr.rdwSizer1r2r0COORDFillConsoleOutputCharacterFillConsoleOutputAttributer$r5) r!moder(r/csbiZcells_in_screenZcells_before_cursor from_coordcells_to_eraserrr erase_screenns&   zWinTerm.erase_screencCstj}|rtj}tj|}|dkr8|j}|jj|jj}|dkrZtjd|jj}|jj}n |dkrztjd|jj}|jj}tj |d||tj ||j ||dS)Nrrrr:) rrr.rr0r;r1r<r2r=r>r$)r!r?r(r/r@rArBrrr erase_lines  zWinTerm.erase_linecCstj|dS)N)rZSetConsoleTitle)r!titlerrr set_titleszWinTerm.set_title)N)NFF)NFF)NF)NF)NF)F)rF)rF)r r r r"r$rr)r*r,r-r'r4r6r9rCrDrFrrrrrs       rN)robjectrrrrrrrs  colorama/__pycache__/__init__.cpython-36.opt-1.pyc000064400000000554152347724720015716 0ustar003 Pf@sDddlmZmZmZmZddlmZmZmZm Z ddl m Z dZ dS))initdeinitreinit colorama_text)ForeBackStyleCursor) AnsiToWin32z0.3.7N) Z initialiserrrransirrrr Z ansitowin32r __version__r r /usr/lib/python3.6/__init__.pys colorama/__pycache__/initialise.cpython-36.opt-1.pyc000064400000003061152347724720016305 0ustar003 Pf}@stddlZddlZddlZddlmZdadadadada ddZ ddd Z d d Z ej d d ZddZddZdS)N) AnsiToWin32FcCstdk rttjdS)N)r orig_stdout reset_allrr /usr/lib/python3.6/initialise.pyrsrTcCs| rt|||grtdtjatjatjdkr8dantt||||t_atjdkr^da ntt||||t_a t st j t da dS)Nz,wrap=False conflicts with any other arg=TrueT)any ValueErrorsysstdoutrstderr orig_stderrwrapped_stdout wrap_streamwrapped_stderr atexit_doneatexitregisterr) autoresetconvertstripwraprrrinits   rcCs tdk rtt_tdk rtt_dS)N)rr r r r rrrrdeinit3src os"t||z dVWdtXdS)N)rr)argskwargsrrr colorama_text:s  rcCs tdk rtt_tdk rtt_dS)N)rr r rr rrrrreinitCsrcCs&|r"t||||d}|jr"|j}|S)N)rrr)rZ should_wrapstream)rrrrrwrapperrrrrJs  r)FNNT)r contextlibr Z ansitowin32rrr rrrrrrcontextmanagerrrrrrrrs   colorama/__pycache__/initialise.cpython-36.pyc000064400000003061152347724720015346 0ustar003 Pf}@stddlZddlZddlZddlmZdadadadada ddZ ddd Z d d Z ej d d ZddZddZdS)N) AnsiToWin32FcCstdk rttjdS)N)r orig_stdout reset_allrr /usr/lib/python3.6/initialise.pyrsrTcCs| rt|||grtdtjatjatjdkr8dantt||||t_atjdkr^da ntt||||t_a t st j t da dS)Nz,wrap=False conflicts with any other arg=TrueT)any ValueErrorsysstdoutrstderr orig_stderrwrapped_stdout wrap_streamwrapped_stderr atexit_doneatexitregisterr) autoresetconvertstripwraprrrinits   rcCs tdk rtt_tdk rtt_dS)N)rr r r r rrrrdeinit3src os"t||z dVWdtXdS)N)rr)argskwargsrrr colorama_text:s  rcCs tdk rtt_tdk rtt_dS)N)rr r rr rrrrreinitCsrcCs&|r"t||||d}|jr"|j}|S)N)rrr)rZ should_wrapstream)rrrrrwrapperrrrrJs  r)FNNT)r contextlibr Z ansitowin32rrr rrrrrrcontextmanagerrrrrrrrs   colorama/__pycache__/ansitowin32.cpython-36.opt-1.pyc000064400000015522152347724720016340 0ustar003 Pf%@sddlZddlZddlZddlmZmZmZmZddlm Z m Z m Z ddl m Z mZdZe dk rfe ZddZdd ZGd d d eZGd d d eZdS)N)AnsiForeAnsiBack AnsiStyleStyle)WinTermWinColorWinStyle)windll winapi_testcCst|d p|jS)Nclosed)hasattrr )streamr!/usr/lib/python3.6/ansitowin32.pyis_stream_closedsrcCst|do|jS)Nisatty)r r)rrrris_a_ttysrc@s(eZdZdZddZddZddZdS) StreamWrapperz Wraps a stream (such as stdout), acting as a transparent proxy for all attribute access apart from method 'write()', which is delegated to our Converter instance. cCs||_||_dS)N)_StreamWrapper__wrapped_StreamWrapper__convertor)selfwrappedZ converterrrr__init__szStreamWrapper.__init__cCs t|j|S)N)getattrr)rnamerrr __getattr__$szStreamWrapper.__getattr__cCs|jj|dS)N)rwrite)rtextrrrr'szStreamWrapper.writeN)__name__ __module__ __qualname____doc__rrrrrrrrsrc@s~eZdZdZejdZejdZdddZdd Z d d Z d d Z ddZ ddZ ddZddZddZddZddZdS) AnsiToWin32z Implements a 'write()' method which, on Windows, will strip ANSI character sequences from the text, and if outputting to a tty, will convert them into win32 function calls. z?\[((?:\d|;)*)([a-zA-Z])?z?\]((?:.|;)*?)()?NFcCs||_||_t|||_tjdk}|o*t}|dkrL|pJt| oJt| }||_ |dkrp|ont| ont|}||_ |j |_ |jt jk|_dS)Nnt)r autoresetrrosrr rrstripconvertget_win32_calls win32_callssysstderr on_stderr)rrr(r'r%Z on_windowsZconversion_supportedrrrr4s    zAnsiToWin32.__init__cCs|jp|jp|jS)aj True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requested using kwargs to init() )r(r'r%)rrrr should_wrapUszAnsiToWin32.should_wrapcNCs>|jotr8tjtjftjtjtjftjtjtj ftj tjtj ft j tj t j ft jtj t jft jtj t jft jtj t jft jtj t jft jtj t jft jtj t jft jtj t jft jtj ft jtj t j dft jtj t jdft jtj t jdft jtj t jdft jtj t jdft jtj t jdft jtj t jdft jtj t jdftj tj t j ftjtj t jftjtj t jftjtj t jftjtj t jftjtj t jftjtj t jftjtj t jftjtj ftjtj t j dftjtj t jdftjtj t jdftjtj t jdftjtj t jdftjtj t jdftjtj t jdftjtj t jdfi&St!S)NT)"r(wintermr RESET_ALL reset_allZBRIGHTZstyler ZDIMZNORMALrZBLACKZforerZREDZGREENZYELLOWZBLUEZMAGENTAZCYANZWHITEZGREYZRESETZ LIGHTBLACK_EXZ LIGHTRED_EXZ LIGHTGREEN_EXZLIGHTYELLOW_EXZ LIGHTBLUE_EXZLIGHTMAGENTA_EXZ LIGHTCYAN_EXZ LIGHTWHITE_EXrZbackdict)rrrrr)_sP    zAnsiToWin32.get_win32_callscCs@|js |jr|j|n|jj||jj|jr<|jdS)N)r'r(write_and_convertrrflushr%r1)rrrrrrs     zAnsiToWin32.writecCs:|jr|jddn"|j r6t|j r6|jjtjdS)Nmr)r)r( call_win32r'rrrrr0)rrrrr1szAnsiToWin32.reset_allcCsfd}|j|}x@|jj|D]0}|j\}}|j||||j|j|}qW|j||t|dS)z Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. rN) convert_osc ANSI_CSI_REfinditerspanwrite_plain_text convert_ansigroupslen)rrZcursormatchstartendrrrr3s  zAnsiToWin32.write_and_convertcCs*||kr&|jj||||jjdS)N)rrr4)rrr@rArrrr;szAnsiToWin32.write_plain_textcCs"|jr|j||}|j||dS)N)r(extract_paramsr6)r paramstringcommandparamsrrrr<s zAnsiToWin32.convert_ansicCs~|dkrtdd|jdD}t|dkrz|d krnd }n |d krzd }|S)NHfcss&|]}t|dkrt|ndVqdS)rrN)r>int).0prrr sz-AnsiToWin32.extract_params..;rcss"|]}t|dkrt|VqdS)rN)r>rG)rHrIrrrrJsrZJKmABCD)r)r)r)tuplesplitr>)rrDrCrErrrrBs zAnsiToWin32.extract_paramsc Cs|dkrVx|D]B}||jkr|j|}|d}|dd}t|jd}|||qWn|dkrttj|d|jdn|dkrtj|d|jdnf|dkrtj||jdnL|dkr|d}d| fd|f|df| dfd |\} } tj| | |jddS) Nr5rr)r-JKrFrM)ABCD)r*r2r-r/Z erase_screenZ erase_lineZset_cursor_positionZ cursor_adjust) rrDrEZparamZ func_argsfuncargskwargsnxyrrrr6s$     *zAnsiToWin32.call_win32cCsvxp|jj|D]`}|j\}}|d|||d}|j\}}|dkr|jd}|ddkrtj|dqW|S)NrKrZ02r) ANSI_OSC_REr9r:r=rOr/Z set_title)rrr?r@rArCrDrErrrr7s    zAnsiToWin32.convert_osc)NNF)rr r!r"recompiler8r]rr.r)rr1r3r;r<rBr6r7rrrrr#+s   ! , r#)r^r+r&ansirrrrr/rrr Zwin32r r rrobjectrr#rrrrscolorama/initialise.py000064400000003573152347724720011072 0ustar00# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import atexit import contextlib import sys from .ansitowin32 import AnsiToWin32 orig_stdout = None orig_stderr = None wrapped_stdout = None wrapped_stderr = None atexit_done = False def reset_all(): if AnsiToWin32 is not None: # Issue #74: objects might become None at exit AnsiToWin32(orig_stdout).reset_all() def init(autoreset=False, convert=None, strip=None, wrap=True): if not wrap and any([autoreset, convert, strip]): raise ValueError('wrap=False conflicts with any other arg=True') global wrapped_stdout, wrapped_stderr global orig_stdout, orig_stderr orig_stdout = sys.stdout orig_stderr = sys.stderr if sys.stdout is None: wrapped_stdout = None else: sys.stdout = wrapped_stdout = \ wrap_stream(orig_stdout, convert, strip, autoreset, wrap) if sys.stderr is None: wrapped_stderr = None else: sys.stderr = wrapped_stderr = \ wrap_stream(orig_stderr, convert, strip, autoreset, wrap) global atexit_done if not atexit_done: atexit.register(reset_all) atexit_done = True def deinit(): if orig_stdout is not None: sys.stdout = orig_stdout if orig_stderr is not None: sys.stderr = orig_stderr @contextlib.contextmanager def colorama_text(*args, **kwargs): init(*args, **kwargs) try: yield finally: deinit() def reinit(): if wrapped_stdout is not None: sys.stdout = wrapped_stdout if wrapped_stderr is not None: sys.stderr = wrapped_stderr def wrap_stream(stream, convert, strip, autoreset, wrap): if wrap: wrapper = AnsiToWin32(stream, convert=convert, strip=strip, autoreset=autoreset) if wrapper.should_wrap(): stream = wrapper.stream return stream colorama/winterm.py000064400000014446152347724720010426 0ustar00# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from . import win32 # from wincon.h class WinColor(object): BLACK = 0 BLUE = 1 GREEN = 2 CYAN = 3 RED = 4 MAGENTA = 5 YELLOW = 6 GREY = 7 # from wincon.h class WinStyle(object): NORMAL = 0x00 # dim text, dim background BRIGHT = 0x08 # bright text, dim background BRIGHT_BACKGROUND = 0x80 # dim text, bright background class WinTerm(object): def __init__(self): self._default = win32.GetConsoleScreenBufferInfo(win32.STDOUT).wAttributes self.set_attrs(self._default) self._default_fore = self._fore self._default_back = self._back self._default_style = self._style # In order to emulate LIGHT_EX in windows, we borrow the BRIGHT style. # So that LIGHT_EX colors and BRIGHT style do not clobber each other, # we track them separately, since LIGHT_EX is overwritten by Fore/Back # and BRIGHT is overwritten by Style codes. self._light = 0 def get_attrs(self): return self._fore + self._back * 16 + (self._style | self._light) def set_attrs(self, value): self._fore = value & 7 self._back = (value >> 4) & 7 self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND) def reset_all(self, on_stderr=None): self.set_attrs(self._default) self.set_console(attrs=self._default) self._light = 0 def fore(self, fore=None, light=False, on_stderr=False): if fore is None: fore = self._default_fore self._fore = fore # Emulate LIGHT_EX with BRIGHT Style if light: self._light |= WinStyle.BRIGHT else: self._light &= ~WinStyle.BRIGHT self.set_console(on_stderr=on_stderr) def back(self, back=None, light=False, on_stderr=False): if back is None: back = self._default_back self._back = back # Emulate LIGHT_EX with BRIGHT_BACKGROUND Style if light: self._light |= WinStyle.BRIGHT_BACKGROUND else: self._light &= ~WinStyle.BRIGHT_BACKGROUND self.set_console(on_stderr=on_stderr) def style(self, style=None, on_stderr=False): if style is None: style = self._default_style self._style = style self.set_console(on_stderr=on_stderr) def set_console(self, attrs=None, on_stderr=False): if attrs is None: attrs = self.get_attrs() handle = win32.STDOUT if on_stderr: handle = win32.STDERR win32.SetConsoleTextAttribute(handle, attrs) def get_position(self, handle): position = win32.GetConsoleScreenBufferInfo(handle).dwCursorPosition # Because Windows coordinates are 0-based, # and win32.SetConsoleCursorPosition expects 1-based. position.X += 1 position.Y += 1 return position def set_cursor_position(self, position=None, on_stderr=False): if position is None: # I'm not currently tracking the position, so there is no default. # position = self.get_position() return handle = win32.STDOUT if on_stderr: handle = win32.STDERR win32.SetConsoleCursorPosition(handle, position) def cursor_adjust(self, x, y, on_stderr=False): handle = win32.STDOUT if on_stderr: handle = win32.STDERR position = self.get_position(handle) adjusted_position = (position.Y + y, position.X + x) win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False) def erase_screen(self, mode=0, on_stderr=False): # 0 should clear from the cursor to the end of the screen. # 1 should clear from the cursor to the beginning of the screen. # 2 should clear the entire screen, and move cursor to (1,1) handle = win32.STDOUT if on_stderr: handle = win32.STDERR csbi = win32.GetConsoleScreenBufferInfo(handle) # get the number of character cells in the current buffer cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y # get number of character cells before current cursor position cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X if mode == 0: from_coord = csbi.dwCursorPosition cells_to_erase = cells_in_screen - cells_before_cursor elif mode == 1: from_coord = win32.COORD(0, 0) cells_to_erase = cells_before_cursor elif mode == 2: from_coord = win32.COORD(0, 0) cells_to_erase = cells_in_screen else: # invalid mode return # fill the entire screen with blanks win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) # now set the buffer's attributes accordingly win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) if mode == 2: # put the cursor where needed win32.SetConsoleCursorPosition(handle, (1, 1)) def erase_line(self, mode=0, on_stderr=False): # 0 should clear from the cursor to the end of the line. # 1 should clear from the cursor to the beginning of the line. # 2 should clear the entire line. handle = win32.STDOUT if on_stderr: handle = win32.STDERR csbi = win32.GetConsoleScreenBufferInfo(handle) if mode == 0: from_coord = csbi.dwCursorPosition cells_to_erase = csbi.dwSize.X - csbi.dwCursorPosition.X elif mode == 1: from_coord = win32.COORD(0, csbi.dwCursorPosition.Y) cells_to_erase = csbi.dwCursorPosition.X elif mode == 2: from_coord = win32.COORD(0, csbi.dwCursorPosition.Y) cells_to_erase = csbi.dwSize.X else: # invalid mode return # fill the entire screen with blanks win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) # now set the buffer's attributes accordingly win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) def set_title(self, title): win32.SetConsoleTitle(title) colorama/ansi.py000064400000004734152347724720007672 0ustar00# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. ''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\007' def code_to_chars(code): return CSI + str(code) + 'm' def set_title(title): return OSC + '2;' + title + BEL def clear_screen(mode=2): return CSI + str(mode) + 'J' def clear_line(mode=2): return CSI + str(mode) + 'K' class AnsiCodes(object): def __init__(self): # the subclasses declare class attributes which are numbers. # Upon instantiation we define instance attributes, which are the same # as the class attributes but wrapped with the ANSI escape sequence for name in dir(self): if not name.startswith('_'): value = getattr(self, name) setattr(self, name, code_to_chars(value)) class AnsiCursor(object): def UP(self, n=1): return CSI + str(n) + 'A' def DOWN(self, n=1): return CSI + str(n) + 'B' def FORWARD(self, n=1): return CSI + str(n) + 'C' def BACK(self, n=1): return CSI + str(n) + 'D' def POS(self, x=1, y=1): return CSI + str(y) + ';' + str(x) + 'H' class AnsiFore(AnsiCodes): BLACK = 30 RED = 31 GREEN = 32 YELLOW = 33 BLUE = 34 MAGENTA = 35 CYAN = 36 WHITE = 37 RESET = 39 # These are fairly well supported, but not part of the standard. LIGHTBLACK_EX = 90 LIGHTRED_EX = 91 LIGHTGREEN_EX = 92 LIGHTYELLOW_EX = 93 LIGHTBLUE_EX = 94 LIGHTMAGENTA_EX = 95 LIGHTCYAN_EX = 96 LIGHTWHITE_EX = 97 class AnsiBack(AnsiCodes): BLACK = 40 RED = 41 GREEN = 42 YELLOW = 43 BLUE = 44 MAGENTA = 45 CYAN = 46 WHITE = 47 RESET = 49 # These are fairly well supported, but not part of the standard. LIGHTBLACK_EX = 100 LIGHTRED_EX = 101 LIGHTGREEN_EX = 102 LIGHTYELLOW_EX = 103 LIGHTBLUE_EX = 104 LIGHTMAGENTA_EX = 105 LIGHTCYAN_EX = 106 LIGHTWHITE_EX = 107 class AnsiStyle(AnsiCodes): BRIGHT = 1 DIM = 2 NORMAL = 22 RESET_ALL = 0 Fore = AnsiFore() Back = AnsiBack() Style = AnsiStyle() Cursor = AnsiCursor() colorama/ansitowin32.py000064400000024336152347724720011120 0ustar00# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import re import sys import os from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style from .winterm import WinTerm, WinColor, WinStyle from .win32 import windll, winapi_test winterm = None if windll is not None: winterm = WinTerm() class StreamWrapper(object): ''' Wraps a stream (such as stdout), acting as a transparent proxy for all attribute access apart from method 'write()', which is delegated to our Converter instance. ''' def __init__(self, wrapped, converter): # double-underscore everything to prevent clashes with names of # attributes on the wrapped stream object. self.__wrapped = wrapped self.__convertor = converter def __getattr__(self, name): return getattr(self.__wrapped, name) def __enter__(self, *args, **kwargs): # special method lookup bypasses __getattr__/__getattribute__, see # https://stackoverflow.com/questions/12632894/why-doesnt-getattr-work-with-exit # thus, contextlib magic methods are not proxied via __getattr__ return self.__wrapped.__enter__(*args, **kwargs) def __exit__(self, *args, **kwargs): return self.__wrapped.__exit__(*args, **kwargs) def write(self, text): self.__convertor.write(text) def isatty(self): stream = self.__wrapped if 'PYCHARM_HOSTED' in os.environ: if stream is not None and (stream is sys.__stdout__ or stream is sys.__stderr__): return True try: stream_isatty = stream.isatty except AttributeError: return False else: return stream_isatty() @property def closed(self): stream = self.__wrapped try: return stream.closed except AttributeError: return True class AnsiToWin32(object): ''' Implements a 'write()' method which, on Windows, will strip ANSI character sequences from the text, and if outputting to a tty, will convert them into win32 function calls. ''' ANSI_CSI_RE = re.compile('\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer ANSI_OSC_RE = re.compile('\001?\033\\]((?:.|;)*?)(\x07)\002?') # Operating System Command def __init__(self, wrapped, convert=None, strip=None, autoreset=False): # The wrapped stream (normally sys.stdout or sys.stderr) self.wrapped = wrapped # should we reset colors to defaults after every .write() self.autoreset = autoreset # create the proxy wrapping our output stream self.stream = StreamWrapper(wrapped, self) on_windows = os.name == 'nt' # We test if the WinAPI works, because even if we are on Windows # we may be using a terminal that doesn't support the WinAPI # (e.g. Cygwin Terminal). In this case it's up to the terminal # to support the ANSI codes. conversion_supported = on_windows and winapi_test() # should we strip ANSI sequences from our output? if strip is None: strip = conversion_supported or (not self.stream.closed and not self.stream.isatty()) self.strip = strip # should we should convert ANSI sequences into win32 calls? if convert is None: convert = conversion_supported and not self.stream.closed and self.stream.isatty() self.convert = convert # dict of ansi codes to win32 functions and parameters self.win32_calls = self.get_win32_calls() # are we wrapping stderr? self.on_stderr = self.wrapped is sys.stderr def should_wrap(self): ''' True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requested using kwargs to init() ''' return self.convert or self.strip or self.autoreset def get_win32_calls(self): if self.convert and winterm: return { AnsiStyle.RESET_ALL: (winterm.reset_all, ), AnsiStyle.BRIGHT: (winterm.style, WinStyle.BRIGHT), AnsiStyle.DIM: (winterm.style, WinStyle.NORMAL), AnsiStyle.NORMAL: (winterm.style, WinStyle.NORMAL), AnsiFore.BLACK: (winterm.fore, WinColor.BLACK), AnsiFore.RED: (winterm.fore, WinColor.RED), AnsiFore.GREEN: (winterm.fore, WinColor.GREEN), AnsiFore.YELLOW: (winterm.fore, WinColor.YELLOW), AnsiFore.BLUE: (winterm.fore, WinColor.BLUE), AnsiFore.MAGENTA: (winterm.fore, WinColor.MAGENTA), AnsiFore.CYAN: (winterm.fore, WinColor.CYAN), AnsiFore.WHITE: (winterm.fore, WinColor.GREY), AnsiFore.RESET: (winterm.fore, ), AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True), AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True), AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True), AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True), AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True), AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True), AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True), AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True), AnsiBack.BLACK: (winterm.back, WinColor.BLACK), AnsiBack.RED: (winterm.back, WinColor.RED), AnsiBack.GREEN: (winterm.back, WinColor.GREEN), AnsiBack.YELLOW: (winterm.back, WinColor.YELLOW), AnsiBack.BLUE: (winterm.back, WinColor.BLUE), AnsiBack.MAGENTA: (winterm.back, WinColor.MAGENTA), AnsiBack.CYAN: (winterm.back, WinColor.CYAN), AnsiBack.WHITE: (winterm.back, WinColor.GREY), AnsiBack.RESET: (winterm.back, ), AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True), AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True), AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True), AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True), AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True), AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True), AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True), AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True), } return dict() def write(self, text): if self.strip or self.convert: self.write_and_convert(text) else: self.wrapped.write(text) self.wrapped.flush() if self.autoreset: self.reset_all() def reset_all(self): if self.convert: self.call_win32('m', (0,)) elif not self.strip and not self.stream.closed: self.wrapped.write(Style.RESET_ALL) def write_and_convert(self, text): ''' Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. ''' cursor = 0 text = self.convert_osc(text) for match in self.ANSI_CSI_RE.finditer(text): start, end = match.span() self.write_plain_text(text, cursor, start) self.convert_ansi(*match.groups()) cursor = end self.write_plain_text(text, cursor, len(text)) def write_plain_text(self, text, start, end): if start < end: self.wrapped.write(text[start:end]) self.wrapped.flush() def convert_ansi(self, paramstring, command): if self.convert: params = self.extract_params(command, paramstring) self.call_win32(command, params) def extract_params(self, command, paramstring): if command in 'Hf': params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';')) while len(params) < 2: # defaults: params = params + (1,) else: params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0) if len(params) == 0: # defaults: if command in 'JKm': params = (0,) elif command in 'ABCD': params = (1,) return params def call_win32(self, command, params): if command == 'm': for param in params: if param in self.win32_calls: func_args = self.win32_calls[param] func = func_args[0] args = func_args[1:] kwargs = dict(on_stderr=self.on_stderr) func(*args, **kwargs) elif command in 'J': winterm.erase_screen(params[0], on_stderr=self.on_stderr) elif command in 'K': winterm.erase_line(params[0], on_stderr=self.on_stderr) elif command in 'Hf': # cursor position - absolute winterm.set_cursor_position(params, on_stderr=self.on_stderr) elif command in 'ABCD': # cursor position - relative n = params[0] # A - up, B - down, C - forward, D - back x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command] winterm.cursor_adjust(x, y, on_stderr=self.on_stderr) def convert_osc(self, text): for match in self.ANSI_OSC_RE.finditer(text): start, end = match.span() text = text[:start] + text[end:] paramstring, command = match.groups() if command in '\x07': # \x07 = BEL params = paramstring.split(";") # 0 - change title and icon (we will only change title) # 1 - change icon (we don't support this) # 2 - change title if params[0] in '02': winterm.set_title(params[1]) return text colorama/win32.py000064400000012434152347724720007676 0ustar00# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. # from winbase.h STDOUT = -11 STDERR = -12 try: import ctypes from ctypes import LibraryLoader windll = LibraryLoader(ctypes.WinDLL) from ctypes import wintypes except (AttributeError, ImportError): windll = None SetConsoleTextAttribute = lambda *_: None winapi_test = lambda *_: None else: from ctypes import byref, Structure, c_char, POINTER COORD = wintypes._COORD class CONSOLE_SCREEN_BUFFER_INFO(Structure): """struct in wincon.h.""" _fields_ = [ ("dwSize", COORD), ("dwCursorPosition", COORD), ("wAttributes", wintypes.WORD), ("srWindow", wintypes.SMALL_RECT), ("dwMaximumWindowSize", COORD), ] def __str__(self): return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % ( self.dwSize.Y, self.dwSize.X , self.dwCursorPosition.Y, self.dwCursorPosition.X , self.wAttributes , self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right , self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X ) _GetStdHandle = windll.kernel32.GetStdHandle _GetStdHandle.argtypes = [ wintypes.DWORD, ] _GetStdHandle.restype = wintypes.HANDLE _GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo _GetConsoleScreenBufferInfo.argtypes = [ wintypes.HANDLE, POINTER(CONSOLE_SCREEN_BUFFER_INFO), ] _GetConsoleScreenBufferInfo.restype = wintypes.BOOL _SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute _SetConsoleTextAttribute.argtypes = [ wintypes.HANDLE, wintypes.WORD, ] _SetConsoleTextAttribute.restype = wintypes.BOOL _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition _SetConsoleCursorPosition.argtypes = [ wintypes.HANDLE, COORD, ] _SetConsoleCursorPosition.restype = wintypes.BOOL _FillConsoleOutputCharacterA = windll.kernel32.FillConsoleOutputCharacterA _FillConsoleOutputCharacterA.argtypes = [ wintypes.HANDLE, c_char, wintypes.DWORD, COORD, POINTER(wintypes.DWORD), ] _FillConsoleOutputCharacterA.restype = wintypes.BOOL _FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute _FillConsoleOutputAttribute.argtypes = [ wintypes.HANDLE, wintypes.WORD, wintypes.DWORD, COORD, POINTER(wintypes.DWORD), ] _FillConsoleOutputAttribute.restype = wintypes.BOOL _SetConsoleTitleW = windll.kernel32.SetConsoleTitleW _SetConsoleTitleW.argtypes = [ wintypes.LPCWSTR ] _SetConsoleTitleW.restype = wintypes.BOOL def _winapi_test(handle): csbi = CONSOLE_SCREEN_BUFFER_INFO() success = _GetConsoleScreenBufferInfo( handle, byref(csbi)) return bool(success) def winapi_test(): return any(_winapi_test(h) for h in (_GetStdHandle(STDOUT), _GetStdHandle(STDERR))) def GetConsoleScreenBufferInfo(stream_id=STDOUT): handle = _GetStdHandle(stream_id) csbi = CONSOLE_SCREEN_BUFFER_INFO() success = _GetConsoleScreenBufferInfo( handle, byref(csbi)) return csbi def SetConsoleTextAttribute(stream_id, attrs): handle = _GetStdHandle(stream_id) return _SetConsoleTextAttribute(handle, attrs) def SetConsoleCursorPosition(stream_id, position, adjust=True): position = COORD(*position) # If the position is out of range, do nothing. if position.Y <= 0 or position.X <= 0: return # Adjust for Windows' SetConsoleCursorPosition: # 1. being 0-based, while ANSI is 1-based. # 2. expecting (x,y), while ANSI uses (y,x). adjusted_position = COORD(position.Y - 1, position.X - 1) if adjust: # Adjust for viewport's scroll position sr = GetConsoleScreenBufferInfo(STDOUT).srWindow adjusted_position.Y += sr.Top adjusted_position.X += sr.Left # Resume normal processing handle = _GetStdHandle(stream_id) return _SetConsoleCursorPosition(handle, adjusted_position) def FillConsoleOutputCharacter(stream_id, char, length, start): handle = _GetStdHandle(stream_id) char = c_char(char.encode()) length = wintypes.DWORD(length) num_written = wintypes.DWORD(0) # Note that this is hard-coded for ANSI (vs wide) bytes. success = _FillConsoleOutputCharacterA( handle, char, length, start, byref(num_written)) return num_written.value def FillConsoleOutputAttribute(stream_id, attr, length, start): ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )''' handle = _GetStdHandle(stream_id) attribute = wintypes.WORD(attr) length = wintypes.DWORD(length) num_written = wintypes.DWORD(0) # Note that this is hard-coded for ANSI (vs wide) bytes. return _FillConsoleOutputAttribute( handle, attribute, length, start, byref(num_written)) def SetConsoleTitle(title): return _SetConsoleTitleW(title) colorama/__init__.py000064400000000357152347724720010474 0ustar00# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. from .initialise import init, deinit, reinit, colorama_text from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 __version__ = '0.4.3' ipaddress.py000064400000234003152347724720007113 0ustar00# Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. """A fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. """ from __future__ import unicode_literals import itertools import struct __version__ = '1.0.23' # Compatibility functions _compat_int_types = (int,) try: _compat_int_types = (int, long) except NameError: pass try: _compat_str = unicode except NameError: _compat_str = str assert bytes != str if b'\0'[0] == 0: # Python 3 semantics def _compat_bytes_to_byte_vals(byt): return byt else: def _compat_bytes_to_byte_vals(byt): return [struct.unpack(b'!B', b)[0] for b in byt] try: _compat_int_from_byte_vals = int.from_bytes except AttributeError: def _compat_int_from_byte_vals(bytvals, endianess): assert endianess == 'big' res = 0 for bv in bytvals: assert isinstance(bv, _compat_int_types) res = (res << 8) + bv return res def _compat_to_bytes(intval, length, endianess): assert isinstance(intval, _compat_int_types) assert endianess == 'big' if length == 4: if intval < 0 or intval >= 2 ** 32: raise struct.error("integer out of range for 'I' format code") return struct.pack(b'!I', intval) elif length == 16: if intval < 0 or intval >= 2 ** 128: raise struct.error("integer out of range for 'QQ' format code") return struct.pack(b'!QQ', intval >> 64, intval & 0xffffffffffffffff) else: raise NotImplementedError() if hasattr(int, 'bit_length'): # Not int.bit_length , since that won't work in 2.7 where long exists def _compat_bit_length(i): return i.bit_length() else: def _compat_bit_length(i): for res in itertools.count(): if i >> res == 0: return res def _compat_range(start, end, step=1): assert step > 0 i = start while i < end: yield i i += step class _TotalOrderingMixin(object): __slots__ = () # Helper that derives the other comparison operations from # __lt__ and __eq__ # We avoid functools.total_ordering because it doesn't handle # NotImplemented correctly yet (http://bugs.python.org/issue10042) def __eq__(self, other): raise NotImplementedError def __ne__(self, other): equal = self.__eq__(other) if equal is NotImplemented: return NotImplemented return not equal def __lt__(self, other): raise NotImplementedError def __le__(self, other): less = self.__lt__(other) if less is NotImplemented or not less: return self.__eq__(other) return less def __gt__(self, other): less = self.__lt__(other) if less is NotImplemented: return NotImplemented equal = self.__eq__(other) if equal is NotImplemented: return NotImplemented return not (less or equal) def __ge__(self, other): less = self.__lt__(other) if less is NotImplemented: return NotImplemented return not less IPV4LENGTH = 32 IPV6LENGTH = 128 class AddressValueError(ValueError): """A Value Error related to the address.""" class NetmaskValueError(ValueError): """A Value Error related to the netmask.""" def ip_address(address): """Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the *address* passed isn't either a v4 or a v6 address """ try: return IPv4Address(address) except (AddressValueError, NetmaskValueError): pass try: return IPv6Address(address) except (AddressValueError, NetmaskValueError): pass if isinstance(address, bytes): raise AddressValueError( '%r does not appear to be an IPv4 or IPv6 address. ' 'Did you pass in a bytes (str in Python 2) instead of' ' a unicode object?' % address) raise ValueError('%r does not appear to be an IPv4 or IPv6 address' % address) def ip_network(address, strict=True): """Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. """ try: return IPv4Network(address, strict) except (AddressValueError, NetmaskValueError): pass try: return IPv6Network(address, strict) except (AddressValueError, NetmaskValueError): pass if isinstance(address, bytes): raise AddressValueError( '%r does not appear to be an IPv4 or IPv6 network. ' 'Did you pass in a bytes (str in Python 2) instead of' ' a unicode object?' % address) raise ValueError('%r does not appear to be an IPv4 or IPv6 network' % address) def ip_interface(address): """Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Notes: The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. """ try: return IPv4Interface(address) except (AddressValueError, NetmaskValueError): pass try: return IPv6Interface(address) except (AddressValueError, NetmaskValueError): pass raise ValueError('%r does not appear to be an IPv4 or IPv6 interface' % address) def v4_int_to_packed(address): """Represent an address as 4 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv4 IP address. Returns: The integer address packed as 4 bytes in network (big-endian) order. Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. """ try: return _compat_to_bytes(address, 4, 'big') except (struct.error, OverflowError): raise ValueError("Address negative or too large for IPv4") def v6_int_to_packed(address): """Represent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. """ try: return _compat_to_bytes(address, 16, 'big') except (struct.error, OverflowError): raise ValueError("Address negative or too large for IPv6") def _split_optional_netmask(address): """Helper to split the netmask and raise AddressValueError if needed""" addr = _compat_str(address).split('/') if len(addr) > 2: raise AddressValueError("Only one '/' permitted in %r" % address) return addr def _find_address_range(addresses): """Find a sequence of sorted deduplicated IPv#Address. Args: addresses: a list of IPv#Address objects. Yields: A tuple containing the first and last IP addresses in the sequence. """ it = iter(addresses) first = last = next(it) for ip in it: if ip._ip != last._ip + 1: yield first, last first = ip last = ip yield first, last def _count_righthand_zero_bits(number, bits): """Count the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. """ if number == 0: return bits return min(bits, _compat_bit_length(~number & (number - 1))) def summarize_address_range(first, last): """Summarize a network range given the first and last IP addresses. Example: >>> list(summarize_address_range(IPv4Address('192.0.2.0'), ... IPv4Address('192.0.2.130'))) ... #doctest: +NORMALIZE_WHITESPACE [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: An iterator of the summarized IPv(4|6) network objects. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version of the first address is not 4 or 6. """ if (not (isinstance(first, _BaseAddress) and isinstance(last, _BaseAddress))): raise TypeError('first and last must be IP addresses, not networks') if first.version != last.version: raise TypeError("%s and %s are not of the same version" % ( first, last)) if first > last: raise ValueError('last IP address must be greater than first') if first.version == 4: ip = IPv4Network elif first.version == 6: ip = IPv6Network else: raise ValueError('unknown IP version') ip_bits = first._max_prefixlen first_int = first._ip last_int = last._ip while first_int <= last_int: nbits = min(_count_righthand_zero_bits(first_int, ip_bits), _compat_bit_length(last_int - first_int + 1) - 1) net = ip((first_int, ip_bits - nbits)) yield net first_int += 1 << nbits if first_int - 1 == ip._ALL_ONES: break def _collapse_addresses_internal(addresses): """Loops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network('192.0.2.0/26') ip2 = IPv4Network('192.0.2.64/26') ip3 = IPv4Network('192.0.2.128/26') ip4 = IPv4Network('192.0.2.192/26') _collapse_addresses_internal([ip1, ip2, ip3, ip4]) -> [IPv4Network('192.0.2.0/24')] This shouldn't be called directly; it is called via collapse_addresses([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed. """ # First merge to_merge = list(addresses) subnets = {} while to_merge: net = to_merge.pop() supernet = net.supernet() existing = subnets.get(supernet) if existing is None: subnets[supernet] = net elif existing != net: # Merge consecutive subnets del subnets[supernet] to_merge.append(supernet) # Then iterate over resulting networks, skipping subsumed subnets last = None for net in sorted(subnets.values()): if last is not None: # Since they are sorted, # last.network_address <= net.network_address is a given. if last.broadcast_address >= net.broadcast_address: continue yield net last = net def collapse_addresses(addresses): """Collapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network or IPv6Network objects. Returns: An iterator of the collapsed IPv(4|6)Network objects. Raises: TypeError: If passed a list of mixed version objects. """ addrs = [] ips = [] nets = [] # split IP addresses and networks for ip in addresses: if isinstance(ip, _BaseAddress): if ips and ips[-1]._version != ip._version: raise TypeError("%s and %s are not of the same version" % ( ip, ips[-1])) ips.append(ip) elif ip._prefixlen == ip._max_prefixlen: if ips and ips[-1]._version != ip._version: raise TypeError("%s and %s are not of the same version" % ( ip, ips[-1])) try: ips.append(ip.ip) except AttributeError: ips.append(ip.network_address) else: if nets and nets[-1]._version != ip._version: raise TypeError("%s and %s are not of the same version" % ( ip, nets[-1])) nets.append(ip) # sort and dedup ips = sorted(set(ips)) # find consecutive address ranges in the sorted sequence and summarize them if ips: for first, last in _find_address_range(ips): addrs.extend(summarize_address_range(first, last)) return _collapse_addresses_internal(addrs + nets) def get_mixed_type_key(obj): """Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There are some times however, where you may wish to have ipaddress sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key. """ if isinstance(obj, _BaseNetwork): return obj._get_networks_key() elif isinstance(obj, _BaseAddress): return obj._get_address_key() return NotImplemented class _IPAddressBase(_TotalOrderingMixin): """The mother class.""" __slots__ = () @property def exploded(self): """Return the longhand version of the IP address as a string.""" return self._explode_shorthand_ip_string() @property def compressed(self): """Return the shorthand version of the IP address as a string.""" return _compat_str(self) @property def reverse_pointer(self): """The name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa' """ return self._reverse_pointer() @property def version(self): msg = '%200s has no version specified' % (type(self),) raise NotImplementedError(msg) def _check_int_address(self, address): if address < 0: msg = "%d (< 0) is not permitted as an IPv%d address" raise AddressValueError(msg % (address, self._version)) if address > self._ALL_ONES: msg = "%d (>= 2**%d) is not permitted as an IPv%d address" raise AddressValueError(msg % (address, self._max_prefixlen, self._version)) def _check_packed_address(self, address, expected_len): address_len = len(address) if address_len != expected_len: msg = ( '%r (len %d != %d) is not permitted as an IPv%d address. ' 'Did you pass in a bytes (str in Python 2) instead of' ' a unicode object?') raise AddressValueError(msg % (address, address_len, expected_len, self._version)) @classmethod def _ip_int_from_prefix(cls, prefixlen): """Turn the prefix length into a bitwise netmask Args: prefixlen: An integer, the prefix length. Returns: An integer. """ return cls._ALL_ONES ^ (cls._ALL_ONES >> prefixlen) @classmethod def _prefix_from_ip_int(cls, ip_int): """Return prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in expanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & ones """ trailing_zeroes = _count_righthand_zero_bits(ip_int, cls._max_prefixlen) prefixlen = cls._max_prefixlen - trailing_zeroes leading_ones = ip_int >> trailing_zeroes all_ones = (1 << prefixlen) - 1 if leading_ones != all_ones: byteslen = cls._max_prefixlen // 8 details = _compat_to_bytes(ip_int, byteslen, 'big') msg = 'Netmask pattern %r mixes zeroes & ones' raise ValueError(msg % details) return prefixlen @classmethod def _report_invalid_netmask(cls, netmask_str): msg = '%r is not a valid netmask' % netmask_str raise NetmaskValueError(msg) @classmethod def _prefix_from_prefix_string(cls, prefixlen_str): """Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask """ # int allows a leading +/- as well as surrounding whitespace, # so we ensure that isn't the case if not _BaseV4._DECIMAL_DIGITS.issuperset(prefixlen_str): cls._report_invalid_netmask(prefixlen_str) try: prefixlen = int(prefixlen_str) except ValueError: cls._report_invalid_netmask(prefixlen_str) if not (0 <= prefixlen <= cls._max_prefixlen): cls._report_invalid_netmask(prefixlen_str) return prefixlen @classmethod def _prefix_from_ip_string(cls, ip_str): """Turn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask/hostmask """ # Parse the netmask/hostmask like an IP address. try: ip_int = cls._ip_int_from_string(ip_str) except AddressValueError: cls._report_invalid_netmask(ip_str) # Try matching a netmask (this would be /1*0*/ as a bitwise regexp). # Note that the two ambiguous cases (all-ones and all-zeroes) are # treated as netmasks. try: return cls._prefix_from_ip_int(ip_int) except ValueError: pass # Invert the bits, and try matching a /0+1+/ hostmask instead. ip_int ^= cls._ALL_ONES try: return cls._prefix_from_ip_int(ip_int) except ValueError: cls._report_invalid_netmask(ip_str) def __reduce__(self): return self.__class__, (_compat_str(self),) class _BaseAddress(_IPAddressBase): """A generic IP object. This IP class contains the version independent methods which are used by single IP addresses. """ __slots__ = () def __int__(self): return self._ip def __eq__(self, other): try: return (self._ip == other._ip and self._version == other._version) except AttributeError: return NotImplemented def __lt__(self, other): if not isinstance(other, _IPAddressBase): return NotImplemented if not isinstance(other, _BaseAddress): raise TypeError('%s and %s are not of the same type' % ( self, other)) if self._version != other._version: raise TypeError('%s and %s are not of the same version' % ( self, other)) if self._ip != other._ip: return self._ip < other._ip return False # Shorthand for Integer addition and subtraction. This is not # meant to ever support addition/subtraction of addresses. def __add__(self, other): if not isinstance(other, _compat_int_types): return NotImplemented return self.__class__(int(self) + other) def __sub__(self, other): if not isinstance(other, _compat_int_types): return NotImplemented return self.__class__(int(self) - other) def __repr__(self): return '%s(%r)' % (self.__class__.__name__, _compat_str(self)) def __str__(self): return _compat_str(self._string_from_ip_int(self._ip)) def __hash__(self): return hash(hex(int(self._ip))) def _get_address_key(self): return (self._version, self) def __reduce__(self): return self.__class__, (self._ip,) class _BaseNetwork(_IPAddressBase): """A generic IP network object. This IP class contains the version independent methods which are used by networks. """ def __init__(self, address): self._cache = {} def __repr__(self): return '%s(%r)' % (self.__class__.__name__, _compat_str(self)) def __str__(self): return '%s/%d' % (self.network_address, self.prefixlen) def hosts(self): """Generate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the network or broadcast addresses. """ network = int(self.network_address) broadcast = int(self.broadcast_address) for x in _compat_range(network + 1, broadcast): yield self._address_class(x) def __iter__(self): network = int(self.network_address) broadcast = int(self.broadcast_address) for x in _compat_range(network, broadcast + 1): yield self._address_class(x) def __getitem__(self, n): network = int(self.network_address) broadcast = int(self.broadcast_address) if n >= 0: if network + n > broadcast: raise IndexError('address out of range') return self._address_class(network + n) else: n += 1 if broadcast + n < network: raise IndexError('address out of range') return self._address_class(broadcast + n) def __lt__(self, other): if not isinstance(other, _IPAddressBase): return NotImplemented if not isinstance(other, _BaseNetwork): raise TypeError('%s and %s are not of the same type' % ( self, other)) if self._version != other._version: raise TypeError('%s and %s are not of the same version' % ( self, other)) if self.network_address != other.network_address: return self.network_address < other.network_address if self.netmask != other.netmask: return self.netmask < other.netmask return False def __eq__(self, other): try: return (self._version == other._version and self.network_address == other.network_address and int(self.netmask) == int(other.netmask)) except AttributeError: return NotImplemented def __hash__(self): return hash(int(self.network_address) ^ int(self.netmask)) def __contains__(self, other): # always false if one is v4 and the other is v6. if self._version != other._version: return False # dealing with another network. if isinstance(other, _BaseNetwork): return False # dealing with another address else: # address return (int(self.network_address) <= int(other._ip) <= int(self.broadcast_address)) def overlaps(self, other): """Tell if self is partly contained in other.""" return self.network_address in other or ( self.broadcast_address in other or ( other.network_address in self or ( other.broadcast_address in self))) @property def broadcast_address(self): x = self._cache.get('broadcast_address') if x is None: x = self._address_class(int(self.network_address) | int(self.hostmask)) self._cache['broadcast_address'] = x return x @property def hostmask(self): x = self._cache.get('hostmask') if x is None: x = self._address_class(int(self.netmask) ^ self._ALL_ONES) self._cache['hostmask'] = x return x @property def with_prefixlen(self): return '%s/%d' % (self.network_address, self._prefixlen) @property def with_netmask(self): return '%s/%s' % (self.network_address, self.netmask) @property def with_hostmask(self): return '%s/%s' % (self.network_address, self.hostmask) @property def num_addresses(self): """Number of hosts in the current subnet.""" return int(self.broadcast_address) - int(self.network_address) + 1 @property def _address_class(self): # Returning bare address objects (rather than interfaces) allows for # more consistent behaviour across the network address, broadcast # address and individual host addresses. msg = '%200s has no associated address class' % (type(self),) raise NotImplementedError(msg) @property def prefixlen(self): return self._prefixlen def address_exclude(self, other): """Remove an address from a larger block. For example: addr1 = ip_network('192.0.2.0/28') addr2 = ip_network('192.0.2.1/32') list(addr1.address_exclude(addr2)) = [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'), IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')] or IPv6: addr1 = ip_network('2001:db8::1/32') addr2 = ip_network('2001:db8::1/128') list(addr1.address_exclude(addr2)) = [ip_network('2001:db8::1/128'), ip_network('2001:db8::2/127'), ip_network('2001:db8::4/126'), ip_network('2001:db8::8/125'), ... ip_network('2001:db8:8000::/33')] Args: other: An IPv4Network or IPv6Network object of the same type. Returns: An iterator of the IPv(4|6)Network objects which is self minus other. Raises: TypeError: If self and other are of differing address versions, or if other is not a network object. ValueError: If other is not completely contained by self. """ if not self._version == other._version: raise TypeError("%s and %s are not of the same version" % ( self, other)) if not isinstance(other, _BaseNetwork): raise TypeError("%s is not a network object" % other) if not other.subnet_of(self): raise ValueError('%s not contained in %s' % (other, self)) if other == self: return # Make sure we're comparing the network of other. other = other.__class__('%s/%s' % (other.network_address, other.prefixlen)) s1, s2 = self.subnets() while s1 != other and s2 != other: if other.subnet_of(s1): yield s2 s1, s2 = s1.subnets() elif other.subnet_of(s2): yield s1 s1, s2 = s2.subnets() else: # If we got here, there's a bug somewhere. raise AssertionError('Error performing exclusion: ' 's1: %s s2: %s other: %s' % (s1, s2, other)) if s1 == other: yield s2 elif s2 == other: yield s1 else: # If we got here, there's a bug somewhere. raise AssertionError('Error performing exclusion: ' 's1: %s s2: %s other: %s' % (s1, s2, other)) def compare_networks(self, other): """Compare two IP objects. This is only concerned about the comparison of the integer representation of the network addresses. This means that the host bits aren't considered at all in this method. If you want to compare host bits, you can easily enough do a 'HostA._ip < HostB._ip' Args: other: An IP object. Returns: If the IP versions of self and other are the same, returns: -1 if self < other: eg: IPv4Network('192.0.2.0/25') < IPv4Network('192.0.2.128/25') IPv6Network('2001:db8::1000/124') < IPv6Network('2001:db8::2000/124') 0 if self == other eg: IPv4Network('192.0.2.0/24') == IPv4Network('192.0.2.0/24') IPv6Network('2001:db8::1000/124') == IPv6Network('2001:db8::1000/124') 1 if self > other eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25') IPv6Network('2001:db8::2000/124') > IPv6Network('2001:db8::1000/124') Raises: TypeError if the IP versions are different. """ # does this need to raise a ValueError? if self._version != other._version: raise TypeError('%s and %s are not of the same type' % ( self, other)) # self._version == other._version below here: if self.network_address < other.network_address: return -1 if self.network_address > other.network_address: return 1 # self.network_address == other.network_address below here: if self.netmask < other.netmask: return -1 if self.netmask > other.netmask: return 1 return 0 def _get_networks_key(self): """Network-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). """ return (self._version, self.network_address, self.netmask) def subnets(self, prefixlen_diff=1, new_prefix=None): """The subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length should be increased by. This should not be set if new_prefix is also set. new_prefix: The desired new prefix length. This must be a larger number (smaller prefix) than the existing prefix. This should not be set if prefixlen_diff is also set. Returns: An iterator of IPv(4|6) objects. Raises: ValueError: The prefixlen_diff is too small or too large. OR prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) """ if self._prefixlen == self._max_prefixlen: yield self return if new_prefix is not None: if new_prefix < self._prefixlen: raise ValueError('new prefix must be longer') if prefixlen_diff != 1: raise ValueError('cannot set prefixlen_diff and new_prefix') prefixlen_diff = new_prefix - self._prefixlen if prefixlen_diff < 0: raise ValueError('prefix length diff must be > 0') new_prefixlen = self._prefixlen + prefixlen_diff if new_prefixlen > self._max_prefixlen: raise ValueError( 'prefix length diff %d is invalid for netblock %s' % ( new_prefixlen, self)) start = int(self.network_address) end = int(self.broadcast_address) + 1 step = (int(self.hostmask) + 1) >> prefixlen_diff for new_addr in _compat_range(start, end, step): current = self.__class__((new_addr, new_prefixlen)) yield current def supernet(self, prefixlen_diff=1, new_prefix=None): """The supernet containing the current network. Args: prefixlen_diff: An integer, the amount the prefix length of the network should be decreased by. For example, given a /24 network and a prefixlen_diff of 3, a supernet with a /21 netmask is returned. Returns: An IPv4 network object. Raises: ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a negative prefix length. OR If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) """ if self._prefixlen == 0: return self if new_prefix is not None: if new_prefix > self._prefixlen: raise ValueError('new prefix must be shorter') if prefixlen_diff != 1: raise ValueError('cannot set prefixlen_diff and new_prefix') prefixlen_diff = self._prefixlen - new_prefix new_prefixlen = self.prefixlen - prefixlen_diff if new_prefixlen < 0: raise ValueError( 'current prefixlen is %d, cannot have a prefixlen_diff of %d' % (self.prefixlen, prefixlen_diff)) return self.__class__(( int(self.network_address) & (int(self.netmask) << prefixlen_diff), new_prefixlen)) @property def is_multicast(self): """Test if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. """ return (self.network_address.is_multicast and self.broadcast_address.is_multicast) @staticmethod def _is_subnet_of(a, b): try: # Always false if one is v4 and the other is v6. if a._version != b._version: raise TypeError( "%s and %s are not of the same version" % (a, b)) return (b.network_address <= a.network_address and b.broadcast_address >= a.broadcast_address) except AttributeError: raise TypeError("Unable to test subnet containment " "between %s and %s" % (a, b)) def subnet_of(self, other): """Return True if this network is a subnet of other.""" return self._is_subnet_of(self, other) def supernet_of(self, other): """Return True if this network is a supernet of other.""" return self._is_subnet_of(other, self) @property def is_reserved(self): """Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. """ return (self.network_address.is_reserved and self.broadcast_address.is_reserved) @property def is_link_local(self): """Test if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. """ return (self.network_address.is_link_local and self.broadcast_address.is_link_local) @property def is_private(self): """Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv4-special-registry or iana-ipv6-special-registry. """ return (self.network_address.is_private and self.broadcast_address.is_private) @property def is_global(self): """Test if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry or iana-ipv6-special-registry. """ return not self.is_private @property def is_unspecified(self): """Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. """ return (self.network_address.is_unspecified and self.broadcast_address.is_unspecified) @property def is_loopback(self): """Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. """ return (self.network_address.is_loopback and self.broadcast_address.is_loopback) class _BaseV4(object): """Base IPv4 object. The following methods are used by IPv4 objects in both single IP addresses and networks. """ __slots__ = () _version = 4 # Equivalent to 255.255.255.255 or 32 bits of 1's. _ALL_ONES = (2 ** IPV4LENGTH) - 1 _DECIMAL_DIGITS = frozenset('0123456789') # the valid octets for host and netmasks. only useful for IPv4. _valid_mask_octets = frozenset([255, 254, 252, 248, 240, 224, 192, 128, 0]) _max_prefixlen = IPV4LENGTH # There are only a handful of valid v4 netmasks, so we cache them all # when constructed (see _make_netmask()). _netmask_cache = {} def _explode_shorthand_ip_string(self): return _compat_str(self) @classmethod def _make_netmask(cls, arg): """Make a (netmask, prefix_len) tuple from the given argument. Argument can be: - an integer (the prefix length) - a string representing the prefix length (e.g. "24") - a string representing the prefix netmask (e.g. "255.255.255.0") """ if arg not in cls._netmask_cache: if isinstance(arg, _compat_int_types): prefixlen = arg else: try: # Check for a netmask in prefix length form prefixlen = cls._prefix_from_prefix_string(arg) except NetmaskValueError: # Check for a netmask or hostmask in dotted-quad form. # This may raise NetmaskValueError. prefixlen = cls._prefix_from_ip_string(arg) netmask = IPv4Address(cls._ip_int_from_prefix(prefixlen)) cls._netmask_cache[arg] = netmask, prefixlen return cls._netmask_cache[arg] @classmethod def _ip_int_from_string(cls, ip_str): """Turn the given IP string into an integer for comparison. Args: ip_str: A string, the IP ip_str. Returns: The IP ip_str as an integer. Raises: AddressValueError: if ip_str isn't a valid IPv4 Address. """ if not ip_str: raise AddressValueError('Address cannot be empty') octets = ip_str.split('.') if len(octets) != 4: raise AddressValueError("Expected 4 octets in %r" % ip_str) try: return _compat_int_from_byte_vals( map(cls._parse_octet, octets), 'big') except ValueError as exc: raise AddressValueError("%s in %r" % (exc, ip_str)) @classmethod def _parse_octet(cls, octet_str): """Convert a decimal octet into an integer. Args: octet_str: A string, the number to parse. Returns: The octet as an integer. Raises: ValueError: if the octet isn't strictly a decimal from [0..255]. """ if not octet_str: raise ValueError("Empty octet not permitted") # Whitelist the characters, since int() allows a lot of bizarre stuff. if not cls._DECIMAL_DIGITS.issuperset(octet_str): msg = "Only decimal digits permitted in %r" raise ValueError(msg % octet_str) # We do the length check second, since the invalid character error # is likely to be more informative for the user if len(octet_str) > 3: msg = "At most 3 characters permitted in %r" raise ValueError(msg % octet_str) # Convert to integer (we know digits are legal) octet_int = int(octet_str, 10) # Any octets that look like they *might* be written in octal, # and which don't look exactly the same in both octal and # decimal are rejected as ambiguous if octet_int > 7 and octet_str[0] == '0': msg = "Ambiguous (octal/decimal) value in %r not permitted" raise ValueError(msg % octet_str) if octet_int > 255: raise ValueError("Octet %d (> 255) not permitted" % octet_int) return octet_int @classmethod def _string_from_ip_int(cls, ip_int): """Turns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. """ return '.'.join(_compat_str(struct.unpack(b'!B', b)[0] if isinstance(b, bytes) else b) for b in _compat_to_bytes(ip_int, 4, 'big')) def _is_hostmask(self, ip_str): """Test if the IP string is a hostmask (rather than a netmask). Args: ip_str: A string, the potential hostmask. Returns: A boolean, True if the IP string is a hostmask. """ bits = ip_str.split('.') try: parts = [x for x in map(int, bits) if x in self._valid_mask_octets] except ValueError: return False if len(parts) != len(bits): return False if parts[0] < parts[-1]: return True return False def _reverse_pointer(self): """Return the reverse DNS pointer name for the IPv4 address. This implements the method described in RFC1035 3.5. """ reverse_octets = _compat_str(self).split('.')[::-1] return '.'.join(reverse_octets) + '.in-addr.arpa' @property def max_prefixlen(self): return self._max_prefixlen @property def version(self): return self._version class IPv4Address(_BaseV4, _BaseAddress): """Represent and manipulate single IPv4 Addresses.""" __slots__ = ('_ip', '__weakref__') def __init__(self, address): """ Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv4Address('192.0.2.1') == IPv4Address(3221225985). or, more generally IPv4Address(int(IPv4Address('192.0.2.1'))) == IPv4Address('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. """ # Efficient constructor from integer. if isinstance(address, _compat_int_types): self._check_int_address(address) self._ip = address return # Constructing from a packed address if isinstance(address, bytes): self._check_packed_address(address, 4) bvs = _compat_bytes_to_byte_vals(address) self._ip = _compat_int_from_byte_vals(bvs, 'big') return # Assume input argument to be string or any object representation # which converts into a formatted IP string. addr_str = _compat_str(address) if '/' in addr_str: raise AddressValueError("Unexpected '/' in %r" % address) self._ip = self._ip_int_from_string(addr_str) @property def packed(self): """The binary representation of this address.""" return v4_int_to_packed(self._ip) @property def is_reserved(self): """Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. """ return self in self._constants._reserved_network @property def is_private(self): """Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv4-special-registry. """ return any(self in net for net in self._constants._private_networks) @property def is_global(self): return ( self not in self._constants._public_network and not self.is_private) @property def is_multicast(self): """Test if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. """ return self in self._constants._multicast_network @property def is_unspecified(self): """Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. """ return self == self._constants._unspecified_address @property def is_loopback(self): """Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. """ return self in self._constants._loopback_network @property def is_link_local(self): """Test if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. """ return self in self._constants._linklocal_network class IPv4Interface(IPv4Address): def __init__(self, address): if isinstance(address, (bytes, _compat_int_types)): IPv4Address.__init__(self, address) self.network = IPv4Network(self._ip) self._prefixlen = self._max_prefixlen return if isinstance(address, tuple): IPv4Address.__init__(self, address[0]) if len(address) > 1: self._prefixlen = int(address[1]) else: self._prefixlen = self._max_prefixlen self.network = IPv4Network(address, strict=False) self.netmask = self.network.netmask self.hostmask = self.network.hostmask return addr = _split_optional_netmask(address) IPv4Address.__init__(self, addr[0]) self.network = IPv4Network(address, strict=False) self._prefixlen = self.network._prefixlen self.netmask = self.network.netmask self.hostmask = self.network.hostmask def __str__(self): return '%s/%d' % (self._string_from_ip_int(self._ip), self.network.prefixlen) def __eq__(self, other): address_equal = IPv4Address.__eq__(self, other) if not address_equal or address_equal is NotImplemented: return address_equal try: return self.network == other.network except AttributeError: # An interface with an associated network is NOT the # same as an unassociated address. That's why the hash # takes the extra info into account. return False def __lt__(self, other): address_less = IPv4Address.__lt__(self, other) if address_less is NotImplemented: return NotImplemented try: return (self.network < other.network or self.network == other.network and address_less) except AttributeError: # We *do* allow addresses and interfaces to be sorted. The # unassociated address is considered less than all interfaces. return False def __hash__(self): return self._ip ^ self._prefixlen ^ int(self.network.network_address) __reduce__ = _IPAddressBase.__reduce__ @property def ip(self): return IPv4Address(self._ip) @property def with_prefixlen(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self._prefixlen) @property def with_netmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.netmask) @property def with_hostmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.hostmask) class IPv4Network(_BaseV4, _BaseNetwork): """This class represents and manipulates 32-bit IPv4 network + addresses.. Attributes: [examples for IPv4Network('192.0.2.0/27')] .network_address: IPv4Address('192.0.2.0') .hostmask: IPv4Address('0.0.0.31') .broadcast_address: IPv4Address('192.0.2.32') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 """ # Class to use when creating address objects _address_class = IPv4Address def __init__(self, address, strict=True): """Instantiate a new IPv4 network object. Args: address: A string or integer representing the IP [& network]. '192.0.2.0/24' '192.0.2.0/255.255.255.0' '192.0.0.2/0.0.0.255' are all functionally the same in IPv4. Similarly, '192.0.2.1' '192.0.2.1/255.255.255.255' '192.0.2.1/32' are also functionally equivalent. That is to say, failing to provide a subnetmask will create an object with a mask of /32. If the mask (portion after the / in the argument) is given in dotted quad form, it is treated as a netmask if it starts with a non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it starts with a zero field (e.g. 0.255.255.255 == /8), with the single exception of an all-zero mask which is treated as a netmask == /0. If no mask is given, a default of /32 is used. Additionally, an integer can be passed, so IPv4Network('192.0.2.1') == IPv4Network(3221225985) or, more generally IPv4Interface(int(IPv4Interface('192.0.2.1'))) == IPv4Interface('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. NetmaskValueError: If the netmask isn't valid for an IPv4 address. ValueError: If strict is True and a network address is not supplied. """ _BaseNetwork.__init__(self, address) # Constructing from a packed address or integer if isinstance(address, (_compat_int_types, bytes)): self.network_address = IPv4Address(address) self.netmask, self._prefixlen = self._make_netmask( self._max_prefixlen) # fixme: address/network test here. return if isinstance(address, tuple): if len(address) > 1: arg = address[1] else: # We weren't given an address[1] arg = self._max_prefixlen self.network_address = IPv4Address(address[0]) self.netmask, self._prefixlen = self._make_netmask(arg) packed = int(self.network_address) if packed & int(self.netmask) != packed: if strict: raise ValueError('%s has host bits set' % self) else: self.network_address = IPv4Address(packed & int(self.netmask)) return # Assume input argument to be string or any object representation # which converts into a formatted IP prefix string. addr = _split_optional_netmask(address) self.network_address = IPv4Address(self._ip_int_from_string(addr[0])) if len(addr) == 2: arg = addr[1] else: arg = self._max_prefixlen self.netmask, self._prefixlen = self._make_netmask(arg) if strict: if (IPv4Address(int(self.network_address) & int(self.netmask)) != self.network_address): raise ValueError('%s has host bits set' % self) self.network_address = IPv4Address(int(self.network_address) & int(self.netmask)) if self._prefixlen == (self._max_prefixlen - 1): self.hosts = self.__iter__ @property def is_global(self): """Test if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry. """ return (not (self.network_address in IPv4Network('100.64.0.0/10') and self.broadcast_address in IPv4Network('100.64.0.0/10')) and not self.is_private) class _IPv4Constants(object): _linklocal_network = IPv4Network('169.254.0.0/16') _loopback_network = IPv4Network('127.0.0.0/8') _multicast_network = IPv4Network('224.0.0.0/4') _public_network = IPv4Network('100.64.0.0/10') _private_networks = [ IPv4Network('0.0.0.0/8'), IPv4Network('10.0.0.0/8'), IPv4Network('127.0.0.0/8'), IPv4Network('169.254.0.0/16'), IPv4Network('172.16.0.0/12'), IPv4Network('192.0.0.0/29'), IPv4Network('192.0.0.170/31'), IPv4Network('192.0.2.0/24'), IPv4Network('192.168.0.0/16'), IPv4Network('198.18.0.0/15'), IPv4Network('198.51.100.0/24'), IPv4Network('203.0.113.0/24'), IPv4Network('240.0.0.0/4'), IPv4Network('255.255.255.255/32'), ] _reserved_network = IPv4Network('240.0.0.0/4') _unspecified_address = IPv4Address('0.0.0.0') IPv4Address._constants = _IPv4Constants class _BaseV6(object): """Base IPv6 object. The following methods are used by IPv6 objects in both single IP addresses and networks. """ __slots__ = () _version = 6 _ALL_ONES = (2 ** IPV6LENGTH) - 1 _HEXTET_COUNT = 8 _HEX_DIGITS = frozenset('0123456789ABCDEFabcdef') _max_prefixlen = IPV6LENGTH # There are only a bunch of valid v6 netmasks, so we cache them all # when constructed (see _make_netmask()). _netmask_cache = {} @classmethod def _make_netmask(cls, arg): """Make a (netmask, prefix_len) tuple from the given argument. Argument can be: - an integer (the prefix length) - a string representing the prefix length (e.g. "24") - a string representing the prefix netmask (e.g. "255.255.255.0") """ if arg not in cls._netmask_cache: if isinstance(arg, _compat_int_types): prefixlen = arg else: prefixlen = cls._prefix_from_prefix_string(arg) netmask = IPv6Address(cls._ip_int_from_prefix(prefixlen)) cls._netmask_cache[arg] = netmask, prefixlen return cls._netmask_cache[arg] @classmethod def _ip_int_from_string(cls, ip_str): """Turn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: An int, the IPv6 address Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. """ if not ip_str: raise AddressValueError('Address cannot be empty') parts = ip_str.split(':') # An IPv6 address needs at least 2 colons (3 parts). _min_parts = 3 if len(parts) < _min_parts: msg = "At least %d parts expected in %r" % (_min_parts, ip_str) raise AddressValueError(msg) # If the address has an IPv4-style suffix, convert it to hexadecimal. if '.' in parts[-1]: try: ipv4_int = IPv4Address(parts.pop())._ip except AddressValueError as exc: raise AddressValueError("%s in %r" % (exc, ip_str)) parts.append('%x' % ((ipv4_int >> 16) & 0xFFFF)) parts.append('%x' % (ipv4_int & 0xFFFF)) # An IPv6 address can't have more than 8 colons (9 parts). # The extra colon comes from using the "::" notation for a single # leading or trailing zero part. _max_parts = cls._HEXTET_COUNT + 1 if len(parts) > _max_parts: msg = "At most %d colons permitted in %r" % ( _max_parts - 1, ip_str) raise AddressValueError(msg) # Disregarding the endpoints, find '::' with nothing in between. # This indicates that a run of zeroes has been skipped. skip_index = None for i in _compat_range(1, len(parts) - 1): if not parts[i]: if skip_index is not None: # Can't have more than one '::' msg = "At most one '::' permitted in %r" % ip_str raise AddressValueError(msg) skip_index = i # parts_hi is the number of parts to copy from above/before the '::' # parts_lo is the number of parts to copy from below/after the '::' if skip_index is not None: # If we found a '::', then check if it also covers the endpoints. parts_hi = skip_index parts_lo = len(parts) - skip_index - 1 if not parts[0]: parts_hi -= 1 if parts_hi: msg = "Leading ':' only permitted as part of '::' in %r" raise AddressValueError(msg % ip_str) # ^: requires ^:: if not parts[-1]: parts_lo -= 1 if parts_lo: msg = "Trailing ':' only permitted as part of '::' in %r" raise AddressValueError(msg % ip_str) # :$ requires ::$ parts_skipped = cls._HEXTET_COUNT - (parts_hi + parts_lo) if parts_skipped < 1: msg = "Expected at most %d other parts with '::' in %r" raise AddressValueError(msg % (cls._HEXTET_COUNT - 1, ip_str)) else: # Otherwise, allocate the entire address to parts_hi. The # endpoints could still be empty, but _parse_hextet() will check # for that. if len(parts) != cls._HEXTET_COUNT: msg = "Exactly %d parts expected without '::' in %r" raise AddressValueError(msg % (cls._HEXTET_COUNT, ip_str)) if not parts[0]: msg = "Leading ':' only permitted as part of '::' in %r" raise AddressValueError(msg % ip_str) # ^: requires ^:: if not parts[-1]: msg = "Trailing ':' only permitted as part of '::' in %r" raise AddressValueError(msg % ip_str) # :$ requires ::$ parts_hi = len(parts) parts_lo = 0 parts_skipped = 0 try: # Now, parse the hextets into a 128-bit integer. ip_int = 0 for i in range(parts_hi): ip_int <<= 16 ip_int |= cls._parse_hextet(parts[i]) ip_int <<= 16 * parts_skipped for i in range(-parts_lo, 0): ip_int <<= 16 ip_int |= cls._parse_hextet(parts[i]) return ip_int except ValueError as exc: raise AddressValueError("%s in %r" % (exc, ip_str)) @classmethod def _parse_hextet(cls, hextet_str): """Convert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from [0..FFFF]. """ # Whitelist the characters, since int() allows a lot of bizarre stuff. if not cls._HEX_DIGITS.issuperset(hextet_str): raise ValueError("Only hex digits permitted in %r" % hextet_str) # We do the length check second, since the invalid character error # is likely to be more informative for the user if len(hextet_str) > 4: msg = "At most 4 characters permitted in %r" raise ValueError(msg % hextet_str) # Length check means we can skip checking the integer value return int(hextet_str, 16) @classmethod def _compress_hextets(cls, hextets): """Compresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. """ best_doublecolon_start = -1 best_doublecolon_len = 0 doublecolon_start = -1 doublecolon_len = 0 for index, hextet in enumerate(hextets): if hextet == '0': doublecolon_len += 1 if doublecolon_start == -1: # Start of a sequence of zeros. doublecolon_start = index if doublecolon_len > best_doublecolon_len: # This is the longest sequence of zeros so far. best_doublecolon_len = doublecolon_len best_doublecolon_start = doublecolon_start else: doublecolon_len = 0 doublecolon_start = -1 if best_doublecolon_len > 1: best_doublecolon_end = (best_doublecolon_start + best_doublecolon_len) # For zeros at the end of the address. if best_doublecolon_end == len(hextets): hextets += [''] hextets[best_doublecolon_start:best_doublecolon_end] = [''] # For zeros at the beginning of the address. if best_doublecolon_start == 0: hextets = [''] + hextets return hextets @classmethod def _string_from_ip_int(cls, ip_int=None): """Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. """ if ip_int is None: ip_int = int(cls._ip) if ip_int > cls._ALL_ONES: raise ValueError('IPv6 address is too large') hex_str = '%032x' % ip_int hextets = ['%x' % int(hex_str[x:x + 4], 16) for x in range(0, 32, 4)] hextets = cls._compress_hextets(hextets) return ':'.join(hextets) def _explode_shorthand_ip_string(self): """Expand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. """ if isinstance(self, IPv6Network): ip_str = _compat_str(self.network_address) elif isinstance(self, IPv6Interface): ip_str = _compat_str(self.ip) else: ip_str = _compat_str(self) ip_int = self._ip_int_from_string(ip_str) hex_str = '%032x' % ip_int parts = [hex_str[x:x + 4] for x in range(0, 32, 4)] if isinstance(self, (_BaseNetwork, IPv6Interface)): return '%s/%d' % (':'.join(parts), self._prefixlen) return ':'.join(parts) def _reverse_pointer(self): """Return the reverse DNS pointer name for the IPv6 address. This implements the method described in RFC3596 2.5. """ reverse_chars = self.exploded[::-1].replace(':', '') return '.'.join(reverse_chars) + '.ip6.arpa' @property def max_prefixlen(self): return self._max_prefixlen @property def version(self): return self._version class IPv6Address(_BaseV6, _BaseAddress): """Represent and manipulate single IPv6 Addresses.""" __slots__ = ('_ip', '__weakref__') def __init__(self, address): """Instantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:db8::') == IPv6Address(42540766411282592856903984951653826560) or, more generally IPv6Address(int(IPv6Address('2001:db8::'))) == IPv6Address('2001:db8::') Raises: AddressValueError: If address isn't a valid IPv6 address. """ # Efficient constructor from integer. if isinstance(address, _compat_int_types): self._check_int_address(address) self._ip = address return # Constructing from a packed address if isinstance(address, bytes): self._check_packed_address(address, 16) bvs = _compat_bytes_to_byte_vals(address) self._ip = _compat_int_from_byte_vals(bvs, 'big') return # Assume input argument to be string or any object representation # which converts into a formatted IP string. addr_str = _compat_str(address) if '/' in addr_str: raise AddressValueError("Unexpected '/' in %r" % address) self._ip = self._ip_int_from_string(addr_str) @property def packed(self): """The binary representation of this address.""" return v6_int_to_packed(self._ip) @property def is_multicast(self): """Test if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. """ return self in self._constants._multicast_network @property def is_reserved(self): """Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. """ return any(self in x for x in self._constants._reserved_networks) @property def is_link_local(self): """Test if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. """ return self in self._constants._linklocal_network @property def is_site_local(self): """Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. """ return self in self._constants._sitelocal_network @property def is_private(self): """Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv6-special-registry. """ return any(self in net for net in self._constants._private_networks) @property def is_global(self): """Test if this address is allocated for public networks. Returns: A boolean, true if the address is not reserved per iana-ipv6-special-registry. """ return not self.is_private @property def is_unspecified(self): """Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. """ return self._ip == 0 @property def is_loopback(self): """Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. """ return self._ip == 1 @property def ipv4_mapped(self): """Return the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. """ if (self._ip >> 32) != 0xFFFF: return None return IPv4Address(self._ip & 0xFFFFFFFF) @property def teredo(self): """Tuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) """ if (self._ip >> 96) != 0x20010000: return None return (IPv4Address((self._ip >> 64) & 0xFFFFFFFF), IPv4Address(~self._ip & 0xFFFFFFFF)) @property def sixtofour(self): """Return the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. """ if (self._ip >> 112) != 0x2002: return None return IPv4Address((self._ip >> 80) & 0xFFFFFFFF) class IPv6Interface(IPv6Address): def __init__(self, address): if isinstance(address, (bytes, _compat_int_types)): IPv6Address.__init__(self, address) self.network = IPv6Network(self._ip) self._prefixlen = self._max_prefixlen return if isinstance(address, tuple): IPv6Address.__init__(self, address[0]) if len(address) > 1: self._prefixlen = int(address[1]) else: self._prefixlen = self._max_prefixlen self.network = IPv6Network(address, strict=False) self.netmask = self.network.netmask self.hostmask = self.network.hostmask return addr = _split_optional_netmask(address) IPv6Address.__init__(self, addr[0]) self.network = IPv6Network(address, strict=False) self.netmask = self.network.netmask self._prefixlen = self.network._prefixlen self.hostmask = self.network.hostmask def __str__(self): return '%s/%d' % (self._string_from_ip_int(self._ip), self.network.prefixlen) def __eq__(self, other): address_equal = IPv6Address.__eq__(self, other) if not address_equal or address_equal is NotImplemented: return address_equal try: return self.network == other.network except AttributeError: # An interface with an associated network is NOT the # same as an unassociated address. That's why the hash # takes the extra info into account. return False def __lt__(self, other): address_less = IPv6Address.__lt__(self, other) if address_less is NotImplemented: return NotImplemented try: return (self.network < other.network or self.network == other.network and address_less) except AttributeError: # We *do* allow addresses and interfaces to be sorted. The # unassociated address is considered less than all interfaces. return False def __hash__(self): return self._ip ^ self._prefixlen ^ int(self.network.network_address) __reduce__ = _IPAddressBase.__reduce__ @property def ip(self): return IPv6Address(self._ip) @property def with_prefixlen(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self._prefixlen) @property def with_netmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.netmask) @property def with_hostmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.hostmask) @property def is_unspecified(self): return self._ip == 0 and self.network.is_unspecified @property def is_loopback(self): return self._ip == 1 and self.network.is_loopback class IPv6Network(_BaseV6, _BaseNetwork): """This class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:db8::1000/124')] .network_address: IPv6Address('2001:db8::1000') .hostmask: IPv6Address('::f') .broadcast_address: IPv6Address('2001:db8::100f') .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') .prefixlen: 124 """ # Class to use when creating address objects _address_class = IPv6Address def __init__(self, address, strict=True): """Instantiate a new IPv6 Network object. Args: address: A string or integer representing the IPv6 network or the IP and prefix/netmask. '2001:db8::/128' '2001:db8:0000:0000:0000:0000:0000:0000/128' '2001:db8::' are all functionally the same in IPv6. That is to say, failing to provide a subnetmask will create an object with a mask of /128. Additionally, an integer can be passed, so IPv6Network('2001:db8::') == IPv6Network(42540766411282592856903984951653826560) or, more generally IPv6Network(int(IPv6Network('2001:db8::'))) == IPv6Network('2001:db8::') strict: A boolean. If true, ensure that we have been passed A true network address, eg, 2001:db8::1000/124 and not an IP address on a network, eg, 2001:db8::1/124. Raises: AddressValueError: If address isn't a valid IPv6 address. NetmaskValueError: If the netmask isn't valid for an IPv6 address. ValueError: If strict was True and a network address was not supplied. """ _BaseNetwork.__init__(self, address) # Efficient constructor from integer or packed address if isinstance(address, (bytes, _compat_int_types)): self.network_address = IPv6Address(address) self.netmask, self._prefixlen = self._make_netmask( self._max_prefixlen) return if isinstance(address, tuple): if len(address) > 1: arg = address[1] else: arg = self._max_prefixlen self.netmask, self._prefixlen = self._make_netmask(arg) self.network_address = IPv6Address(address[0]) packed = int(self.network_address) if packed & int(self.netmask) != packed: if strict: raise ValueError('%s has host bits set' % self) else: self.network_address = IPv6Address(packed & int(self.netmask)) return # Assume input argument to be string or any object representation # which converts into a formatted IP prefix string. addr = _split_optional_netmask(address) self.network_address = IPv6Address(self._ip_int_from_string(addr[0])) if len(addr) == 2: arg = addr[1] else: arg = self._max_prefixlen self.netmask, self._prefixlen = self._make_netmask(arg) if strict: if (IPv6Address(int(self.network_address) & int(self.netmask)) != self.network_address): raise ValueError('%s has host bits set' % self) self.network_address = IPv6Address(int(self.network_address) & int(self.netmask)) if self._prefixlen == (self._max_prefixlen - 1): self.hosts = self.__iter__ def hosts(self): """Generate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the Subnet-Router anycast address. """ network = int(self.network_address) broadcast = int(self.broadcast_address) for x in _compat_range(network + 1, broadcast + 1): yield self._address_class(x) @property def is_site_local(self): """Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. """ return (self.network_address.is_site_local and self.broadcast_address.is_site_local) class _IPv6Constants(object): _linklocal_network = IPv6Network('fe80::/10') _multicast_network = IPv6Network('ff00::/8') _private_networks = [ IPv6Network('::1/128'), IPv6Network('::/128'), IPv6Network('::ffff:0:0/96'), IPv6Network('100::/64'), IPv6Network('2001::/23'), IPv6Network('2001:2::/48'), IPv6Network('2001:db8::/32'), IPv6Network('2001:10::/28'), IPv6Network('fc00::/7'), IPv6Network('fe80::/10'), ] _reserved_networks = [ IPv6Network('::/8'), IPv6Network('100::/8'), IPv6Network('200::/7'), IPv6Network('400::/6'), IPv6Network('800::/5'), IPv6Network('1000::/4'), IPv6Network('4000::/3'), IPv6Network('6000::/3'), IPv6Network('8000::/3'), IPv6Network('A000::/3'), IPv6Network('C000::/3'), IPv6Network('E000::/4'), IPv6Network('F000::/5'), IPv6Network('F800::/6'), IPv6Network('FE00::/9'), ] _sitelocal_network = IPv6Network('fec0::/10') IPv6Address._constants = _IPv6Constants distlib/index.py000064400000051112152347724720007674 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportError: from dummy_threading import Thread from . import DistlibException from .compat import (HTTPBasicAuthHandler, Request, HTTPPasswordMgr, urlparse, build_opener, string_types) from .util import cached_property, zip_dir, ServerProxy logger = logging.getLogger(__name__) DEFAULT_INDEX = 'https://pypi.org/pypi' DEFAULT_REALM = 'pypi' class PackageIndex(object): """ This class represents a package index compatible with PyPI, the Python Package Index. """ boundary = b'----------ThIs_Is_tHe_distlib_index_bouNdaRY_$' def __init__(self, url=None): """ Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. """ self.url = url or DEFAULT_INDEX self.read_configuration() scheme, netloc, path, params, query, frag = urlparse(self.url) if params or query or frag or scheme not in ('http', 'https'): raise DistlibException('invalid repository: %s' % self.url) self.password_handler = None self.ssl_verifier = None self.gpg = None self.gpg_home = None with open(os.devnull, 'w') as sink: # Use gpg by default rather than gpg2, as gpg2 insists on # prompting for passwords for s in ('gpg', 'gpg2'): try: rc = subprocess.check_call([s, '--version'], stdout=sink, stderr=sink) if rc == 0: self.gpg = s break except OSError: pass def _get_pypirc_command(self): """ Get the distutils command for interacting with PyPI configurations. :return: the command. """ from distutils.core import Distribution from distutils.config import PyPIRCCommand d = Distribution() return PyPIRCCommand(d) def read_configuration(self): """ Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. """ # get distutils to do the work c = self._get_pypirc_command() c.repository = self.url cfg = c._read_pypirc() self.username = cfg.get('username') self.password = cfg.get('password') self.realm = cfg.get('realm', 'pypi') self.url = cfg.get('repository', self.url) def save_configuration(self): """ Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. """ self.check_credentials() # get distutils to do the work c = self._get_pypirc_command() c._store_pypirc(self.username, self.password) def check_credentials(self): """ Check that ``username`` and ``password`` have been set, and raise an exception if not. """ if self.username is None or self.password is None: raise DistlibException('username and password must be set') pm = HTTPPasswordMgr() _, netloc, _, _, _, _ = urlparse(self.url) pm.add_password(self.realm, netloc, self.username, self.password) self.password_handler = HTTPBasicAuthHandler(pm) def register(self, metadata): """ Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request. """ self.check_credentials() metadata.validate() d = metadata.todict() d[':action'] = 'verify' request = self.encode_request(d.items(), []) response = self.send_request(request) d[':action'] = 'submit' request = self.encode_request(d.items(), []) return self.send_request(request) def _reader(self, name, stream, outbuf): """ Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to. """ while True: s = stream.readline() if not s: break s = s.decode('utf-8').rstrip() outbuf.append(s) logger.debug('%s: %s' % (name, s)) stream.close() def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. """ cmd = [self.gpg, '--status-fd', '2', '--no-tty'] if keystore is None: keystore = self.gpg_home if keystore: cmd.extend(['--homedir', keystore]) if sign_password is not None: cmd.extend(['--batch', '--passphrase-fd', '0']) td = tempfile.mkdtemp() sf = os.path.join(td, os.path.basename(filename) + '.asc') cmd.extend(['--detach-sign', '--armor', '--local-user', signer, '--output', sf, filename]) logger.debug('invoking: %s', ' '.join(cmd)) return cmd, sf def run_command(self, cmd, input_data=None): """ Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit code, a list of lines read from the subprocess' ``stdout``, and a list of lines read from the subprocess' ``stderr``. """ kwargs = { 'stdout': subprocess.PIPE, 'stderr': subprocess.PIPE, } if input_data is not None: kwargs['stdin'] = subprocess.PIPE stdout = [] stderr = [] p = subprocess.Popen(cmd, **kwargs) # We don't use communicate() here because we may need to # get clever with interacting with the command t1 = Thread(target=self._reader, args=('stdout', p.stdout, stdout)) t1.start() t2 = Thread(target=self._reader, args=('stderr', p.stderr, stderr)) t2.start() if input_data is not None: p.stdin.write(input_data) p.stdin.close() p.wait() t1.join() t2.join() return p.returncode, stdout, stderr def sign_file(self, filename, signer, sign_password, keystore=None): """ Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The absolute pathname of the file where the signature is stored. """ cmd, sig_file = self.get_sign_command(filename, signer, sign_password, keystore) rc, stdout, stderr = self.run_command(cmd, sign_password.encode('utf-8')) if rc != 0: raise DistlibException('sign command failed with error ' 'code %s' % rc) return sig_file def upload_file(self, metadata, filename, signer=None, sign_password=None, filetype='sdist', pyversion='source', keystore=None): """ Upload a release file to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the file to be uploaded. :param filename: The pathname of the file to be uploaded. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param filetype: The type of the file being uploaded. This is the distutils command which produced that file, e.g. ``sdist`` or ``bdist_wheel``. :param pyversion: The version of Python which the release relates to. For code compatible with any Python, this would be ``source``, otherwise it would be e.g. ``3.2``. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The HTTP response received from PyPI upon submission of the request. """ self.check_credentials() if not os.path.exists(filename): raise DistlibException('not found: %s' % filename) metadata.validate() d = metadata.todict() sig_file = None if signer: if not self.gpg: logger.warning('no signing program available - not signed') else: sig_file = self.sign_file(filename, signer, sign_password, keystore) with open(filename, 'rb') as f: file_data = f.read() md5_digest = hashlib.md5(file_data).hexdigest() sha256_digest = hashlib.sha256(file_data).hexdigest() d.update({ ':action': 'file_upload', 'protocol_version': '1', 'filetype': filetype, 'pyversion': pyversion, 'md5_digest': md5_digest, 'sha256_digest': sha256_digest, }) files = [('content', os.path.basename(filename), file_data)] if sig_file: with open(sig_file, 'rb') as f: sig_data = f.read() files.append(('gpg_signature', os.path.basename(sig_file), sig_data)) shutil.rmtree(os.path.dirname(sig_file)) request = self.encode_request(d.items(), files) return self.send_request(request) def upload_documentation(self, metadata, doc_dir): """ Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. """ self.check_credentials() if not os.path.isdir(doc_dir): raise DistlibException('not a directory: %r' % doc_dir) fn = os.path.join(doc_dir, 'index.html') if not os.path.exists(fn): raise DistlibException('not found: %r' % fn) metadata.validate() name, version = metadata.name, metadata.version zip_data = zip_dir(doc_dir).getvalue() fields = [(':action', 'doc_upload'), ('name', name), ('version', version)] files = [('content', name, zip_data)] request = self.encode_request(fields, files) return self.send_request(request) def get_verify_command(self, signature_filename, data_filename, keystore=None): """ Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. """ cmd = [self.gpg, '--status-fd', '2', '--no-tty'] if keystore is None: keystore = self.gpg_home if keystore: cmd.extend(['--homedir', keystore]) cmd.extend(['--verify', signature_filename, data_filename]) logger.debug('invoking: %s', ' '.join(cmd)) return cmd def verify_signature(self, signature_filename, data_filename, keystore=None): """ Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. """ if not self.gpg: raise DistlibException('verification unavailable because gpg ' 'unavailable') cmd = self.get_verify_command(signature_filename, data_filename, keystore) rc, stdout, stderr = self.run_command(cmd) if rc not in (0, 1): raise DistlibException('verify command failed with error ' 'code %s' % rc) return rc == 0 def download_file(self, url, destfile, digest=None, reporthook=None): """ This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. """ if digest is None: digester = None logger.debug('No digest specified') else: if isinstance(digest, (list, tuple)): hasher, digest = digest else: hasher = 'md5' digester = getattr(hashlib, hasher)() logger.debug('Digest specified: %s' % digest) # The following code is equivalent to urlretrieve. # We need to do it this way so that we can compute the # digest of the file as we go. with open(destfile, 'wb') as dfp: # addinfourl is not a context manager on 2.x # so we have to use try/finally sfp = self.send_request(Request(url)) try: headers = sfp.info() blocksize = 8192 size = -1 read = 0 blocknum = 0 if "content-length" in headers: size = int(headers["Content-Length"]) if reporthook: reporthook(blocknum, blocksize, size) while True: block = sfp.read(blocksize) if not block: break read += len(block) dfp.write(block) if digester: digester.update(block) blocknum += 1 if reporthook: reporthook(blocknum, blocksize, size) finally: sfp.close() # check that we got the whole file, if we can if size >= 0 and read < size: raise DistlibException( 'retrieval incomplete: got only %d out of %d bytes' % (read, size)) # if we have a digest, it must match. if digester: actual = digester.hexdigest() if digest != actual: raise DistlibException('%s digest mismatch for %s: expected ' '%s, got %s' % (hasher, destfile, digest, actual)) logger.debug('Digest verified: %s', digest) def send_request(self, req): """ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). """ handlers = [] if self.password_handler: handlers.append(self.password_handler) if self.ssl_verifier: handlers.append(self.ssl_verifier) opener = build_opener(*handlers) return opener.open(req) def encode_request(self, fields, files): """ Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. """ # Adapted from packaging, which in turn was adapted from # http://code.activestate.com/recipes/146306 parts = [] boundary = self.boundary for k, values in fields: if not isinstance(values, (list, tuple)): values = [values] for v in values: parts.extend(( b'--' + boundary, ('Content-Disposition: form-data; name="%s"' % k).encode('utf-8'), b'', v.encode('utf-8'))) for key, filename, value in files: parts.extend(( b'--' + boundary, ('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename)).encode('utf-8'), b'', value)) parts.extend((b'--' + boundary + b'--', b'')) body = b'\r\n'.join(parts) ct = b'multipart/form-data; boundary=' + boundary headers = { 'Content-type': ct, 'Content-length': str(len(body)) } return Request(self.url, body, headers) def search(self, terms, operator=None): if isinstance(terms, string_types): terms = {'name': terms} rpc_proxy = ServerProxy(self.url, timeout=3.0) try: return rpc_proxy.search(terms, operator or 'and') finally: rpc_proxy('close')() distlib/manifest.py000064400000034733152347724720010405 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2013 Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """ Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. """ import fnmatch import logging import os import re import sys from . import DistlibException from .compat import fsdecode from .util import convert_path __all__ = ['Manifest'] logger = logging.getLogger(__name__) # a \ followed by some spaces + EOL _COLLAPSE_PATTERN = re.compile('\\\\w*\n', re.M) _COMMENTED_LINE = re.compile('#.*?(?=\n)|\n(?=$)', re.M | re.S) # # Due to the different results returned by fnmatch.translate, we need # to do slightly different processing for Python 2.7 and 3.2 ... this needed # to be brought in for Python 3.6 onwards. # _PYTHON_VERSION = sys.version_info[:2] class Manifest(object): """A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. """ def __init__(self, base=None): """ Initialise an instance. :param base: The base directory to explore under. """ self.base = os.path.abspath(os.path.normpath(base or os.getcwd())) self.prefix = self.base + os.sep self.allfiles = None self.files = set() # # Public API # def findall(self): """Find all files under the base and set ``allfiles`` to the absolute pathnames of files found. """ from stat import S_ISREG, S_ISDIR, S_ISLNK self.allfiles = allfiles = [] root = self.base stack = [root] pop = stack.pop push = stack.append while stack: root = pop() names = os.listdir(root) for name in names: fullname = os.path.join(root, name) # Avoid excess stat calls -- just one will do, thank you! stat = os.stat(fullname) mode = stat.st_mode if S_ISREG(mode): allfiles.append(fsdecode(fullname)) elif S_ISDIR(mode) and not S_ISLNK(mode): push(fullname) def add(self, item): """ Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. """ if not item.startswith(self.prefix): item = os.path.join(self.base, item) self.files.add(os.path.normpath(item)) def add_many(self, items): """ Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. """ for item in items: self.add(item) def sorted(self, wantdirs=False): """ Return sorted files in directory order """ def add_dir(dirs, d): dirs.add(d) logger.debug('add_dir added %s', d) if d != self.base: parent, _ = os.path.split(d) assert parent not in ('', '/') add_dir(dirs, parent) result = set(self.files) # make a copy! if wantdirs: dirs = set() for f in result: add_dir(dirs, os.path.dirname(f)) result |= dirs return [os.path.join(*path_tuple) for path_tuple in sorted(os.path.split(path) for path in result)] def clear(self): """Clear all collected files.""" self.files = set() self.allfiles = [] def process_directive(self, directive): """ Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands """ # Parse the line: split it up, make sure the right number of words # is there, and return the relevant words. 'action' is always # defined: it's the first word of the line. Which of the other # three are defined depends on the action; it'll be either # patterns, (dir and patterns), or (dirpattern). action, patterns, thedir, dirpattern = self._parse_directive(directive) # OK, now we know that the action is valid and we have the # right number of words on the line for that action -- so we # can proceed with minimal error-checking. if action == 'include': for pattern in patterns: if not self._include_pattern(pattern, anchor=True): logger.warning('no files found matching %r', pattern) elif action == 'exclude': for pattern in patterns: found = self._exclude_pattern(pattern, anchor=True) #if not found: # logger.warning('no previously-included files ' # 'found matching %r', pattern) elif action == 'global-include': for pattern in patterns: if not self._include_pattern(pattern, anchor=False): logger.warning('no files found matching %r ' 'anywhere in distribution', pattern) elif action == 'global-exclude': for pattern in patterns: found = self._exclude_pattern(pattern, anchor=False) #if not found: # logger.warning('no previously-included files ' # 'matching %r found anywhere in ' # 'distribution', pattern) elif action == 'recursive-include': for pattern in patterns: if not self._include_pattern(pattern, prefix=thedir): logger.warning('no files found matching %r ' 'under directory %r', pattern, thedir) elif action == 'recursive-exclude': for pattern in patterns: found = self._exclude_pattern(pattern, prefix=thedir) #if not found: # logger.warning('no previously-included files ' # 'matching %r found under directory %r', # pattern, thedir) elif action == 'graft': if not self._include_pattern(None, prefix=dirpattern): logger.warning('no directories found matching %r', dirpattern) elif action == 'prune': if not self._exclude_pattern(None, prefix=dirpattern): logger.warning('no previously-included directories found ' 'matching %r', dirpattern) else: # pragma: no cover # This should never happen, as it should be caught in # _parse_template_line raise DistlibException( 'invalid action %r' % action) # # Private API # def _parse_directive(self, directive): """ Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns """ words = directive.split() if len(words) == 1 and words[0] not in ('include', 'exclude', 'global-include', 'global-exclude', 'recursive-include', 'recursive-exclude', 'graft', 'prune'): # no action given, let's use the default 'include' words.insert(0, 'include') action = words[0] patterns = thedir = dir_pattern = None if action in ('include', 'exclude', 'global-include', 'global-exclude'): if len(words) < 2: raise DistlibException( '%r expects ...' % action) patterns = [convert_path(word) for word in words[1:]] elif action in ('recursive-include', 'recursive-exclude'): if len(words) < 3: raise DistlibException( '%r expects ...' % action) thedir = convert_path(words[1]) patterns = [convert_path(word) for word in words[2:]] elif action in ('graft', 'prune'): if len(words) != 2: raise DistlibException( '%r expects a single ' % action) dir_pattern = convert_path(words[1]) else: raise DistlibException('unknown action %r' % action) return action, patterns, thedir, dir_pattern def _include_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. """ # XXX docstring lying about what the special chars are? found = False pattern_re = self._translate_pattern(pattern, anchor, prefix, is_regex) # delayed loading of allfiles list if self.allfiles is None: self.findall() for name in self.allfiles: if pattern_re.search(name): self.files.add(name) found = True return found def _exclude_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions """ found = False pattern_re = self._translate_pattern(pattern, anchor, prefix, is_regex) for f in list(self.files): if pattern_re.search(f): self.files.remove(f) found = True return found def _translate_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Translate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). """ if is_regex: if isinstance(pattern, str): return re.compile(pattern) else: return pattern if _PYTHON_VERSION > (3, 2): # ditch start and end characters start, _, end = self._glob_to_re('_').partition('_') if pattern: pattern_re = self._glob_to_re(pattern) if _PYTHON_VERSION > (3, 2): assert pattern_re.startswith(start) and pattern_re.endswith(end) else: pattern_re = '' base = re.escape(os.path.join(self.base, '')) if prefix is not None: # ditch end of pattern character if _PYTHON_VERSION <= (3, 2): empty_pattern = self._glob_to_re('') prefix_re = self._glob_to_re(prefix)[:-len(empty_pattern)] else: prefix_re = self._glob_to_re(prefix) assert prefix_re.startswith(start) and prefix_re.endswith(end) prefix_re = prefix_re[len(start): len(prefix_re) - len(end)] sep = os.sep if os.sep == '\\': sep = r'\\' if _PYTHON_VERSION <= (3, 2): pattern_re = '^' + base + sep.join((prefix_re, '.*' + pattern_re)) else: pattern_re = pattern_re[len(start): len(pattern_re) - len(end)] pattern_re = r'%s%s%s%s.*%s%s' % (start, base, prefix_re, sep, pattern_re, end) else: # no prefix -- respect anchor flag if anchor: if _PYTHON_VERSION <= (3, 2): pattern_re = '^' + base + pattern_re else: pattern_re = r'%s%s%s' % (start, base, pattern_re[len(start):]) return re.compile(pattern_re) def _glob_to_re(self, pattern): """Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). """ pattern_re = fnmatch.translate(pattern) # '?' and '*' in the glob pattern become '.' and '.*' in the RE, which # IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix, # and by extension they shouldn't match such "special characters" under # any OS. So change all non-escaped dots in the RE to match any # character except the special characters (currently: just os.sep). sep = os.sep if os.sep == '\\': # we're using a regex to manipulate a regex, so we need # to escape the backslash twice sep = r'\\\\' escaped = r'\1[^%s]' % sep pattern_re = re.sub(r'((? s^#!.*pythonw?[0-9.]*([ ].*)?$a|# -*- coding: utf-8 -*- if __name__ == '__main__': import sys, re def _resolve(module, func): __import__(module) mod = sys.modules[module] parts = func.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result try: sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) func = _resolve('%(module)s', '%(func)s') rc = func() # None interpreted as 0 except Exception as e: # only supporting Python >= 2.6 sys.stderr.write('%%s\n' %% e) rc = 1 sys.exit(rc) cCsZd|krV|jdrD|jdd\}}d|krV|jd rVd||f}n|jdsVd|}|S)N z /usr/bin/env r"z%s "%s"z"%s") startswithsplit) executableenvZ _executabler/usr/lib/python3.6/scripts.py_enquote_executableBs  rc@seZdZdZeZdZd%ddZddZe j j d rBd d Z d d Z d&ddZddZeZddZddZd'ddZddZeddZejddZejdksejd krejdkrdd Zd(d!d"Zd)d#d$ZdS)* ScriptMakerz_ A class to copy or create scripts from source scripts or callable specifications. NTFcCsz||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t d|_ |pRt ||_ tjdkprtjdkortjdk|_ dS)NFposixjavaX.Ynt)rr) source_dir target_dir add_launchersforceclobberosname_nameset_modesetvariantsr_fileop_is_nt)selfrrrdry_runZfileoprrr__init__[s   zScriptMaker.__init__cCs@|jddr<|jr|jd}n |jd}t} t| d} | jd|WdQRX| j } |||| }xd|D]Z} tj j |j | } |rrtj j | \}}|jdr|} d| } y|jj| |Wntk rntjdd | }tj j|r tj|tj| ||jj| |tjd ytj|Wntk rhYnXYnXnp|jr| jd | rd | |f} tj j| r|j rtjd | q|jj| ||jr|jj| g|j| qWdS)Nzutf-8pytwz __main__.pyz.pyz%s.exez:Failed to write executable - trying to use .deleteme logicz %s.deletemez0Able to replace executable using .deleteme logic.z%s.%szSkipping existing file %s)rr(r!lineseprM _get_launcherrrZwritestrgetvaluer/r1rsplitextrr'Zwrite_binary_file Exceptionr:r;existsremoverenamedebugr?r r$set_executable_modeappend)r)namesrSZ script_bytes filenamesextZ use_launcherreZlauncherstreamZzfZzip_datar"outnameneZdfnamerrr _write_scriptsT            zScriptMaker._write_scriptc Csd}|r0|jdg}|r0ddj|}|jd}|jd||d}|j|jd}|j}t} d|jkrp| j|d|jkr| jd |t j d fd |jkr| jd |t j dd f|r|jddrd} nd} |j | |||| dS)NrAZinterpreter_argsz %sr zutf-8)r2rXz%s%srzX.Yz%s-%sr,Fpywra) r.r1rMrTr\r"r%r&addrJversionrw) r)r[rqr2rRargsrSscriptr"Z scriptnamesrrrrr _make_scripts(      zScriptMaker._make_scriptcCsd}tjj|jt|}tjj|jtjj|}|j rX|jj || rXt j d|dSyt |d}Wn t k r|js~d}YnLX|j}|st jd|j|dStj|jdd}|rd}|jdpd }|s|r|j|jj|||jr|jj|g|j|nt jd ||j|jjst|j\} } |jd |j| |} d |krbd } nd} tjj|} |j| g| |j || |r|jdS)NFznot copying %s (up-to-date)rbz"%s: %s is an empty file (skipping)s rFTrrAzcopying and adjusting %s -> %srspythonwrzra)!r!r/r1rr rr]rr'Znewerr:rmr6r9r*readliner;Zget_command_name FIRST_LINE_REmatchr0groupcloseZ copy_filer$rnroinforseekrTrwr7)r)r~rqZadjustrtfZ first_linerrRrQlinesrSrrrurrr _copy_scriptsR         zScriptMaker._copy_scriptcCs|jjS)N)r'r*)r)rrrr*JszScriptMaker.dry_runcCs ||j_dS)N)r'r*)r)valuerrrr*NsrcCsHtjddkrd}nd}d||f}tjddd}t|j|j}|S) NPZ64Z32z%s%s.exerdrr)structcalcsize__name__rsplitrfindbytes)r)Zkindbitsr"Zdistlib_packageresultrrrrfVs zScriptMaker._get_launchercCs6g}t|}|dkr"|j||n|j|||d|S)a Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. N)r2)r rr)r) specificationr2rqr[rrrmakeds zScriptMaker.makecCs(g}x|D]}|j|j||q W|S)z Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, )extendr)r)Zspecificationsr2rqrrrr make_multiplews zScriptMaker.make_multiple)TFN)rAN)N)N)N)r __module__ __qualname____doc__SCRIPT_TEMPLATErWrr+r4rJrKrr=r@rTr\_DEFAULT_MANIFESTr^r`rwrrpropertyr*setterr!r"r#rfrrrrrrrRs,    82 4  r)iorZloggingr!rerrJcompatrrrZ resourcesrutilrr r r r Z getLoggerrr:striprcompilerrrobjectrrrrrs    distlib/__pycache__/compat.cpython-36.pyc000064400000076252152347724720014350 0ustar003 Pfa@s ddlmZddlZddlZddlZy ddlZWnek rHdZYnXejddkr~ddlmZe fZ e Z ddl mZddlZddlZddlmZddlmZmZmZmZmZdd lmZmZmZm Z m!Z!m"Z"m#Z#d d Zddl$Z$dd l$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-er&dd l$m.Z.ddl/Z/ddl0Z0ddl1Z2ddl3m3Z3ddl4Z4e5Z5ddl6m7Z8ddl6m9Z:da;ddZ<n ddl=mZe>fZ e>Z ddl=m?ZddlZddlZddlZddl@mZmZmZmZod?d@ZiYnXyddAlpmqZqWn"ek r ddAlrmqZqYnXejddBddkr,e3jsZsn ddDlpmsZsyddEl`mtZtWndek rddFl`muZuyddGlvmwZxWn ek rdedIdJZxYnXGdKdLdLeuZtYnXyddMlymzZzWn ek rdfdNdOZzYnXyddPl`m{Z{Wnek rzyddQl|m}Z~Wn"ek r4ddQlm}Z~YnXyddRlmZmZmZWnek rdYnXGdSdTdTeZ{YnXyddUlmZmZWnvek rejmdVejZdWdXZGdYdZdZeZdgd[d\ZGd]d^d^eZGd_d`d`eZGdadbdbeQZYnXdS)h)absolute_importN)StringIO)FileType)shutil)urlparse urlunparseurljoinurlsplit urlunsplit) urlretrievequoteunquote url2pathname pathname2urlContentTooShortError splittypecCst|tr|jd}t|S)Nzutf-8) isinstanceunicodeencode_quote)sr/usr/lib/python3.6/compat.pyrs  r) RequesturlopenURLError HTTPErrorHTTPBasicAuthHandlerHTTPPasswordMgr HTTPHandlerHTTPRedirectHandler build_opener) HTTPSHandler) HTMLParser)ifilter) ifilterfalsecCs<tdkrddl}|jdatj|}|r4|jddSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.Nrz ^(.*)@(.*)$r) _userprogrecompilematchgroup)hostr*r,rrr splituser4s   r/) TextIOWrapper) rr r r/rrr r r) rr rrrrr r!r"r#)rrr) filterfalse)match_hostnameCertificateErrorc@s eZdZdS)r3N)__name__ __module__ __qualname__rrrrr3^sr3c Csg}|s dS|jd}|d|dd}}|jd}||krNtdt||sb|j|jkS|dkrv|jdn>|jd s|jd r|jtj|n|jtj|j d d x|D]}|jtj|qWtj d d j |dtj } | j |S)zpMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 F.rrN*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr3reprlowerappend startswithr*escapereplacer+join IGNORECASEr,) ZdnhostnameZ max_wildcardsZpatspartsZleftmostZ remainderZ wildcardsfragZpatrrr_dnsname_matchbs(    rFcCs|s tdg}|jdf}x0|D](\}}|dkr"t||r@dS|j|q"W|sxF|jdfD]6}x0|D](\}}|dkrjt||rdS|j|qjWq`Wt|dkrtd|d jtt|fn*t|dkrtd ||d fntd dS) a=Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDZsubjectAltNameZDNSNZsubjectZ commonNamerz&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found) ValueErrorgetrFr=lenr3rAmapr;)ZcertrCZdnsnamesZsankeyvaluesubrrrr2s.     r2)SimpleNamespacec@seZdZdZddZdS) ContainerzR A generic container for when multiple values need to be returned cKs|jj|dS)N)__dict__update)selfkwargsrrr__init__szContainer.__init__N)r4r5r6__doc__rTrrrrrOsrO)whichc s"dd}tjjr&||r"SdS|dkr>tjjdtj}|sFdS|jtj}tj dkrtj |krt|j dtj tjjddjtj}t fd d |Drg}q‡fd d |D}ng}t }xT|D]L}tjj|}||kr|j|x(|D] } tjj|| } || |r| SqWqWdS) aKGiven a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cSs&tjj|o$tj||o$tjj| S)N)ospathexistsaccessisdir)fnmoderrr _access_checkszwhich.._access_checkNPATHZwin32rZPATHEXTc3s |]}jj|jVqdS)N)r<endswith).0ext)cmdrr szwhich..csg|] }|qSrr)rbrc)rdrr szwhich..)rWrXdirnameenvironrHdefpathr9pathsepsysplatformcurdirinsertanysetnormcaseaddrA) rdr]rXr^ZpathextfilesseendirZnormdirZthefilenamer)rdrrVs8            rV)ZipFile __enter__) ZipExtFilec@s$eZdZddZddZddZdS)rycCs|jj|jdS)N)rPrQ)rRbaserrrrTszZipExtFile.__init__cCs|S)Nr)rRrrrrxszZipExtFile.__enter__cGs |jdS)N)close)rRexc_inforrr__exit__szZipExtFile.__exit__N)r4r5r6rTrxr}rrrrrysryc@s$eZdZddZddZddZdS)rwcCs|S)Nr)rRrrrrx"szZipFile.__enter__cGs |jdS)N)r{)rRr|rrrr}%szZipFile.__exit__cOstj|f||}t|S)N) BaseZipFileopenry)rRargsrSrzrrrr)sz ZipFile.openN)r4r5r6rxr}rrrrrrw!srw)python_implementationcCs0dtjkrdStjdkrdStjjdr,dSdS)z6Return a string identifying the Python implementation.ZPyPyjavaZJythonZ IronPythonZCPython)rkversionrWrvr>rrrrr0s   r) sysconfig)CallablecCs t|tS)N)rr)objrrrcallableDsrmbcsstrictsurrogateescapecCs:t|tr|St|tr$|jttStdt|jdS)Nzexpect bytes or str, not %s) rbytes text_typer _fsencoding _fserrors TypeErrortyper4)filenamerrrfsencodeRs    rcCs:t|tr|St|tr$|jttStdt|jdS)Nzexpect bytes or str, not %s) rrrdecoderrrrr4)rrrrfsdecode[s    r)detect_encoding)BOM_UTF8lookupzcoding[:=]\s*([-\w.]+)cCsH|ddjjdd}|dks*|jdr.dS|d ks@|jdrDdS|S)z(Imitates get_normal_name in tokenizer.c.N _-zutf-8zutf-8-latin-1 iso-8859-1 iso-latin-1latin-1- iso-8859-1- iso-latin-1-)rrr)rrr)r<r@r>)orig_encencrrr_get_normal_namels rc sy jjWntk r$dYnXdd}d}fdd}fdd}|}|jtrpd|d d}d }|s||gfS||}|r||gfS|}|s||gfS||}|r|||gfS|||gfS) a? The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. NFzutf-8c s yStk rdSXdS)N) StopIterationr)readlinerr read_or_stopsz%detect_encoding..read_or_stopcsy|jd}Wn4tk rBd}dk r6dj|}t|YnXtj|}|sVdSt|d}y t|}Wn:tk rdkrd|}n dj|}t|YnXr|j dkr؈dkrd}n dj}t||d 7}|S) Nzutf-8z'invalid or missing encoding declarationz {} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig) rUnicodeDecodeErrorformat SyntaxError cookie_refindallrr LookupErrorrv)line line_stringmsgZmatchesencodingcodec) bom_foundrrr find_cookies6       z$detect_encoding..find_cookieTrz utf-8-sig)__self__rvAttributeErrorr>r)rrdefaultrrfirstsecondr)rrrrrws4   &     r)r?r()unescape)ChainMap)MutableMapping)recursive_repr...csfdd}|S)zm Decorator to make a repr function return fillvalue for a recursive call csLtfdd}td|_td|_td|_tdi|_|S)Nc sBt|tf}|krSj|z |}Wdj|X|S)N)id get_identrrdiscard)rRrKresult) fillvalue repr_running user_functionrrwrappers   z=_recursive_repr..decorating_function..wrapperr5rUr4__annotations__)rpgetattrr5rUr4r)rr)r)rrrdecorating_functions   z,_recursive_repr..decorating_functionr)rrr)rr_recursive_reprs rc@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS)(ra A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. cGst|p ig|_dS)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)listmaps)rRrrrrrT szChainMap.__init__cCs t|dS)N)KeyError)rRrKrrr __missing__szChainMap.__missing__c Cs8x,|jD]"}y||Stk r(YqXqW|j|S)N)rrr)rRrKmappingrrr __getitem__s   zChainMap.__getitem__NcCs||kr||S|S)Nr)rRrKrrrrrHsz ChainMap.getcCsttj|jS)N)rIrpunionr)rRrrr__len__"szChainMap.__len__cCsttj|jS)N)iterrprr)rRrrr__iter__%szChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdS)Nr)rbm)rKrrre)sz(ChainMap.__contains__..)ror)rRrKr)rKr __contains__(szChainMap.__contains__cCs t|jS)N)ror)rRrrr__bool__+szChainMap.__bool__cCsdj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rrArJr;r)rRrrr__repr__.szChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterablerrrrr3szChainMap.fromkeyscCs$|j|jdjf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rrN) __class__rcopy)rRrrrr8sz ChainMap.copycCs|jif|jS)z;New ChainMap with a new dict followed by all previous maps.)rr)rRrrr new_child>szChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rN)rr)rRrrrparentsBszChainMap.parentscCs||jd|<dS)Nr)r)rRrKrLrrr __setitem__GszChainMap.__setitem__c Cs8y|jd|=Wn"tk r2tdj|YnXdS)Nrz(Key not found in the first mapping: {!r})rrr)rRrKrrr __delitem__JszChainMap.__delitem__c Cs0y|jdjStk r*tdYnXdS)zPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.rz#No keys found in the first mapping.N)rpopitemr)rRrrrrPszChainMap.popitemc Gs>y|jdj|f|Stk r8tdj|YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].rz(Key not found in the first mapping: {!r}N)rpoprr)rRrKrrrrrWsz ChainMap.popcCs|jdjdS)z'Clear maps[0], leaving maps[1:] intact.rN)rclear)rRrrrr^szChainMap.clear)N)r4r5r6rUrTrrrHrrrrrr classmethodrr__copy__rpropertyrrrrrrrrrrrs(    r)cache_from_sourcecCs0|jdst|dkrd}|r$d}nd}||S)Nz.pyTco)raAssertionError)rXdebug_overridesuffixrrrresr) OrderedDict)r)KeysView ValuesView ItemsViewc@seZdZdZddZejfddZejfddZdd Zd d Z d d Z d6ddZ ddZ ddZ ddZddZddZddZddZeZeZefdd Zd7d"d#Zd8d$d%Zd&d'Zd(d)Zed9d*d+Zd,d-Zd.d/Zd0d1Zd2d3Z d4d5Z!d!S):rz)Dictionary that remembers insertion orderc Osnt|dkrtdt|y |jWn6tk r\g|_}||dg|dd<i|_YnX|j||dS)zInitialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. rz$expected at most 1 arguments, got %dN)rIr_OrderedDict__rootr_OrderedDict__map_OrderedDict__update)rRrkwdsrootrrrrTs    zOrderedDict.__init__cCsF||kr6|j}|d}|||g|d<|d<|j|<||||dS)z!od.__setitem__(i, y) <==> od[i]=yrrN)rr)rRrKrLZ dict_setitemrlastrrrrs  zOrderedDict.__setitem__cCs0||||jj|\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]rrN)rr)rRrKZ dict_delitem link_prev link_nextrrrrs zOrderedDict.__delitem__ccs2|j}|d}x||k r,|dV|d}qWdS)zod.__iter__() <==> iter(od)rr(N)r)rRrcurrrrrrs   zOrderedDict.__iter__ccs2|j}|d}x||k r,|dV|d}qWdS)z#od.__reversed__() <==> reversed(od)rr(N)r)rRrrrrr __reversed__s   zOrderedDict.__reversed__c CshyDx|jjD]}|dd=qW|j}||dg|dd<|jjWntk rXYnXtj|dS)z.od.clear() -> None. Remove all items from od.N)r itervaluesrrrr)rRZnoderrrrrszOrderedDict.clearTcCs||s td|j}|r8|d}|d}||d<||d<n |d}|d}||d<||d<|d}|j|=tj||}||fS)zod.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. zdictionary is emptyrrr()rrrrr)rRrrlinkrrrKrLrrrrs   zOrderedDict.popitemcCst|S)zod.keys() -> list of keys in od)r)rRrrrkeysszOrderedDict.keyscsfddDS)z#od.values() -> list of values in odcsg|] }|qSrr)rbrK)rRrrrfsz&OrderedDict.values..r)rRr)rRrvaluesszOrderedDict.valuescsfddDS)z.od.items() -> list of (key, value) pairs in odcsg|]}||fqSrr)rbrK)rRrrrfsz%OrderedDict.items..r)rRr)rRritemsszOrderedDict.itemscCst|S)z0od.iterkeys() -> an iterator over the keys in od)r)rRrrriterkeysszOrderedDict.iterkeysccsx|D]}||VqWdS)z2od.itervalues -> an iterator over the values in odNr)rRkrrrrs zOrderedDict.itervaluesccs x|D]}|||fVqWdS)z=od.iteritems -> an iterator over the (key, value) items in odNr)rRrrrr iteritemss zOrderedDict.iteritemscOst|dkr tdt|fn |s,td|d}f}t|dkrL|d}t|trrx^|D]}||||<q\WnDt|drx8|jD]}||||<qWnx|D]\}}|||<qWx|jD]\}}|||<qWdS)aod.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v r(z8update() takes at most 2 positional arguments (%d given)z,update() takes at least 1 argument (0 given)rrrN)rIrrrhasattrrr)rrrRotherrKrLrrrrQs&      zOrderedDict.updatecCs0||kr||}||=|S||jkr,t||S)zod.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. )_OrderedDict__markerr)rRrKrrrrrr!s zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rRrKrrrr setdefault.szOrderedDict.setdefaultc Cs^|si}t|tf}||kr"dSd||<z&|s>d|jjfSd|jj|jfS||=XdS)zod.__repr__() <==> repr(od)z...rz%s()z%s(%r)N)r _get_identrr4r)rRZ _repr_runningZcall_keyrrrr5szOrderedDict.__repr__cs\fddD}tj}xttD]}|j|dq*W|rPj|f|fSj|ffS)z%Return state information for picklingcsg|]}||gqSrr)rbr)rRrrrfEsz*OrderedDict.__reduce__..N)varsrrrr)rRrZ inst_dictrr)rRr __reduce__Cs zOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)r)rRrrrrMszOrderedDict.copycCs |}x|D] }|||<q W|S)zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). r)rrrLdrKrrrrQs  zOrderedDict.fromkeyscCs6t|tr*t|t|ko(|j|jkStj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. )rrrIrr__eq__)rRrrrrr\s  zOrderedDict.__eq__cCs ||k S)Nr)rRrrrr__ne__eszOrderedDict.__ne__cCst|S)z@od.viewkeys() -> a set-like object providing a view on od's keys)r)rRrrrviewkeysjszOrderedDict.viewkeyscCst|S)z an object providing a view on od's values)r)rRrrr viewvaluesnszOrderedDict.viewvaluescCst|S)zBod.viewitems() -> a set-like object providing a view on od's items)r)rRrrr viewitemsrszOrderedDict.viewitems)T)N)N)N)"r4r5r6rUrTrrrrrrrrrrrrrrQrobjectrrr rr rrrrrrrrrrrrrs:         r)BaseConfigurator valid_identz^[a-z_][a-z0-9_]*$cCstj|}|std|dS)Nz!Not a valid Python identifier: %rT) IDENTIFIERr,rG)rrrrrr|s  rc@s"eZdZdZddZdddZdS)ConvertingDictz A converting dictionary wrapper.cCsJtj||}|jj|}||k rF|||<t|tttfkrF||_||_ |S)N) rr configuratorconvertrrConvertingListConvertingTupleparentrK)rRrKrLrrrrrs   zConvertingDict.__getitem__NcCsLtj|||}|jj|}||k rH|||<t|tttfkrH||_||_ |S)N) rrHrrrrrrrrK)rRrKrrLrrrrrHs  zConvertingDict.get)N)r4r5r6rUrrHrrrrrs rcCsDtj|||}|jj|}||k r@t|tttfkr@||_||_ |S)N) rrrrrrrrrrK)rRrKrrLrrrrrs  rc@s"eZdZdZddZd ddZdS) rzA converting list wrapper.cCsJtj||}|jj|}||k rF|||<t|tttfkrF||_||_ |S)N) rrrrrrrrrrK)rRrKrLrrrrrs   zConvertingList.__getitem__rcCs<tj||}|jj|}||k r8t|tttfkr8||_|S)N) rrrrrrrrr)rRidxrLrrrrrs   zConvertingList.popN)r)r4r5r6rUrrrrrrrs rc@seZdZdZddZdS)rzA converting tuple wrapper.cCsBtj||}|jj|}||k r>t|tttfkr>||_||_ |S)N) tuplerrrrrrrrrK)rRrKrLrrrrrs   zConvertingTuple.__getitem__N)r4r5r6rUrrrrrrsrc@seZdZdZejdZejdZejdZejdZ ejdZ ddd Z e e Zd d Zd d ZddZddZddZddZddZdS)rzQ The configurator base class which defines some useful defaults. z%^(?P[a-z]+)://(?P.*)$z ^\s*(\w+)\s*z^\.\s*(\w+)\s*z^\[\s*(\w+)\s*\]\s*z^\d+$ ext_convert cfg_convert)rcZcfgcCst||_||j_dS)N)rconfigr)rRr"rrrrTs zBaseConfigurator.__init__c Cs|jd}|jd}y`|j|}xP|D]H}|d|7}yt||}Wq&tk rl|j|t||}Yq&Xq&W|Stk rtjdd\}}td||f}|||_ |_ |YnXdS)zl Resolve strings to objects using standard import and attribute syntax. r7rrNzCannot resolve %r: %s) r9rimporterrr ImportErrorrkr|rG __cause__ __traceback__) rRrrvZusedfoundrEetbvrrrresolves"      zBaseConfigurator.resolvecCs |j|S)z*Default converter for the ext:// protocol.)r+)rRrLrrrr szBaseConfigurator.ext_convertc Cs|}|jj|}|dkr&td|n||jd}|j|jd}x|r|jj|}|rp||jd}nd|jj|}|r|jd}|jj|s||}n2yt |}||}Wnt k r||}YnX|r||jd}qJtd||fqJW|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r) WORD_PATTERNr,rGendr"groups DOT_PATTERN INDEX_PATTERN DIGIT_PATTERNintr)rRrLrestrr rnrrrr!s2       zBaseConfigurator.cfg_convertcCst|t r&t|tr&t|}||_nt|t rLt|trLt|}||_n|t|t rrt|trrt|}||_nVt|tr|j j |}|r|j }|d}|j j |d}|r|d}t||}||}|S)z Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. prefixNr)rrrrrrrr string_typesCONVERT_PATTERNr, groupdictvalue_convertersrHr)rRrLrr r5Z converterrrrrr)s*     zBaseConfigurator.convertcsrjd}t|s|j|}jdd}tfddD}|f|}|rnx |jD]\}}t|||qVW|S)z1Configure an object with a user-supplied factory.z()r7Ncs g|]}t|r||fqSr)r)rbr)r"rrrfLsz5BaseConfigurator.configure_custom..)rrr+rrsetattr)rRr"rZpropsrSrrvrLr)r"rconfigure_customEs    z!BaseConfigurator.configure_customcCst|trt|}|S)z0Utility function which converts lists to tuples.)rrr)rRrLrrras_tupleSs zBaseConfigurator.as_tupleN)r4r5r6rUr*r+r7r,r/r0r1r9 staticmethod __import__r#rTr+r r!rr;r<rrrrrs      "r)r)rr)r)N)N)Z __future__rrWr*rkZsslr$ version_inforZ basestringr6rrtypesrZ file_typeZ __builtin__builtinsZ ConfigParserZ configparserZ _backportrrr r r r Zurllibr rrrrrrrZurllib2rrrrrr r!r"r#r$ZhttplibZ xmlrpclibZQueueZqueuer%ZhtmlentitydefsZ raw_input itertoolsr&filterr'r1r)r/iostrr0Z urllib.parseZurllib.requestZ urllib.errorZ http.clientZclientZrequestZ xmlrpc.clientZ html.parserZ html.entitiesZentitiesinputr2r3rGrFrNrOrrVF_OKX_OKZzipfilerwr~rryZBaseZipExtFilerlrrr NameError collectionsrrrrgetfilesystemencodingrrtokenizercodecsrrr+rrZhtmlr?ZcgirrrreprlibrrZimprrZthreadrr Z dummy_threadZ_abcollrrrrZlogging.configrrIrrrrrrrrrrrs&      $,      ,0        2+A              [   b w  distlib/__pycache__/util.cpython-36.opt-1.pyc000064400000126527152347724720015002 0ustar003 Pfi@s>ddlZddlmZddlZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZy ddlZWnek rdZYnXddlZddlZddlZddlZddlZy ddlZWnek rddlZYnXddlZddlmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/e j0e1Z2dZ3e j4e3Z5dZ6d e6d Z7e6d Z8d Z9d e9de8de3d e9de8dZ:dZ;de:de;de:dZde6de>de<dZ?e j4e?Z@de9de8d ZAe j4eAZBdd ZCd!d"ZDd#d$ZEd%d&ZFdd'd(ZGd)d*ZHd+d,ZId-d.ZJejKd/d0ZLejKd1d2ZMejKdd4d5ZNGd6d7d7eOZPd8d9ZQGd:d;d;eOZRdd?d?eOZTe j4d@e jUZVdAdBZWddCdDZXdEdFZYdGdHZZdIdJZ[dKdLZ\dMdNZ]e j4dOe j^Z_e j4dPZ`ddQdRZae j4dSZbdTdUZcdVdWZddXdYZedZZfd[d\Zgd]d^ZhGd_d`d`eOZiGdadbdbeOZjGdcddddeOZkdZlddmdnZmdodpZndZoGdwdxdxeOZpe j4dyZqe j4dzZre j4d{Zsd|d}Zd~dZter\ddlmuZvmwZwmxZxGddde$jyZyGdddevZuGdddeue'Zzej{ddZ|e|dkrGddde$j}Z}erGddde$j~Z~Gddde%jZerGddde%jZGddde%jZddZGdddeOZGdddeZGdddeZGddde(ZGdddeOZddZdS)N)deque)iglob)DistlibException) string_types text_typeshutil raw_inputStringIOcache_from_sourceurlopenurljoinhttplib xmlrpclib splittype HTTPHandlerBaseConfigurator valid_ident Container configparserURLErrorZipFilefsdecodeunquotez\s*,\s*z (\w|[.-])+z(\*|:(\*|\w+):|)z\*?z([<>=!~]=)|[<>](z)?\s*(z)(z)\s*(z))*z(from\s+(?P.*))z \(\s*(?P|z)\s*\)|(?Pz\s*)z)*z \[\s*(?Pz)?\s*\]z(?Pz \s*)?(\s*z)?$z(?Pz )\s*(?Pc sddd}tj|}|r|j}|d}|dp8|d}|dsHd}nd}|dj}|snd}d}|d}nL|dd krd |}tj|} fd d | D}d |djdd |Df}|dsd} ntj|d} t ||| |||d}|S)NcSs|j}|d|dfS)NopZvn) groupdict)mdr!/usr/lib/python3.6/util.pyget_constraintYsz)parse_requirement..get_constraintZdnZc1Zc2Zdirefrz<>!=z~=csg|] }|qSr!r!).0r)r#r!r" qsz%parse_requirement..z%s (%s)z, cSsg|] }d|qS)z%s %sr!)r%Zconr!r!r"r&rsZex)nameZ constraintsextrasZ requirementsourceurl) REQUIREMENT_REmatchrstripRELOP_IDENT_REfinditerjoinCOMMA_REsplitr) sresultrr r'Zconsr*ZconstrZrsiteratorr(r!)r#r"parse_requirementWs4      r6cCsdd}i}x|D]\}}}tjj||}xt|D]t}tjj||} x`t| D]T} ||| } |dkrt|j| dqP||| } |jtjjdjd} | d| || <qPWq4WqW|S)z%Find destinations for resources filescSs6|jtjjd}|jtjjd}|t|djdS)N/)replaceospathseplenlstrip)baser:r!r!r" get_rel_pathsz)get_resources_dests..get_rel_pathNr7)r9r:r0rpopr8r;rstrip)Zresources_rootZrulesr?Z destinationsr>suffixdestprefixZabs_baseZabs_globZabs_pathZ resource_fileZrel_pathZrel_destr!r!r"get_resources_dests|s  rEcCs(ttdrd}ntjttdtjk}|S)NZ real_prefixT base_prefix)hasattrsysrDgetattr)r4r!r!r"in_venvs rJcCs$tjjtj}t|ts t|}|S)N)r9r:normcaserH executable isinstancerr)r4r!r!r"get_executables  rNcCsT|}xJt|}|}| r |r |}|r|dj}||kr:P|rd|||f}qW|S)Nrz %c: %s %s)r lower)promptZ allowed_charsZ error_promptdefaultpr3cr!r!r"proceeds  rTcCs<t|tr|j}i}x |D]}||kr||||<qW|S)N)rMrr2)r keysr4keyr!r!r"extract_by_keys  rWcCsntjddkrtjd|}|j}t|}yftj|}|ddd}xF|jD]:\}}x0|jD]$\}}d||f}t |} | ||<qdWqRW|St k r|j ddYnXdd } t j } y| | |Wn<t jk r|jtj|}t|}| | |YnXi}xT| jD]H} i|| <}x4| j| D]&\} }d| |f}t |} | || <q:WqW|S) Nrzutf-8 extensionszpython.exportsexportsz%s = %scSs$t|dr|j|n |j|dS)N read_file)rGr[Zreadfp)cpstreamr!r!r" read_streams  z!read_exports..read_stream)rH version_infocodecs getreaderreadr jsonloaditemsget_export_entry Exceptionseekr ConfigParserZMissingSectionHeaderErrorclosetextwrapdedentZsections)r]dataZjdatar4groupZentrieskvr3entryr^r\rVr'valuer!r!r" read_exportss@     rscCstjddkrtjd|}tj}x||jD]p\}}|j|x\|jD]P}|j dkr`|j }nd|j |j f}|j rd|dj |j f}|j ||j|qJWq.W|j|dS)NrrXzutf-8z%s:%sz%s [%s]z, )rHr_r` getwriterrrireZ add_sectionvaluesrBrDflagsr0setr'write)rZr]r\rorprqr3r!r!r" write_exportss  ryc cs$tj}z |VWdtj|XdS)N)tempfilemkdtemprrmtree)Ztdr!r!r"tempdir s r}c cs.tj}ztj|dVWdtj|XdS)N)r9getcwdchdir)r cwdr!r!r"rs   rc cs.tj}ztj|dVWdtj|XdS)N)socketZgetdefaulttimeoutZsetdefaulttimeout)ZsecondsZctor!r!r"socket_timeouts   rc@seZdZddZdddZdS)cached_propertycCs ||_dS)N)func)selfrr!r!r"__init__)szcached_property.__init__NcCs,|dkr |S|j|}tj||jj||S)N)robject __setattr____name__)robjclsrrr!r!r"__get__.s  zcached_property.__get__)N)r __module__ __qualname__rrr!r!r!r"r(srcCstjdkr|S|s|S|ddkr.td||ddkrFtd||jd}xtj|krj|jtjqRW|svtjStjj|S)aReturn 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. r7rzpath '%s' cannot be absoluterzpath '%s' cannot end with '/')r9r; ValueErrorr2curdirremover:r0)pathnamepathsr!r!r" convert_path6s       rc@seZdZd$ddZddZddZdd Zd%d d Zd&ddZddZ ddZ ddZ ddZ ddZ d'ddZddZddZd d!Zd"d#Zd S)( FileOperatorFcCs||_t|_|jdS)N)dry_runrwensured _init_record)rrr!r!r"rRszFileOperator.__init__cCsd|_t|_t|_dS)NF)recordrw files_written dirs_created)rr!r!r"rWszFileOperator._init_recordcCs|jr|jj|dS)N)rradd)rr:r!r!r"record_as_written\szFileOperator.record_as_writtencCsHtjj|s tdtjj|tjj|s0dStj|jtj|jkS)aTell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'source'. Raise PackagingFileError if 'source' does not exist. Note that this test is not very accurate: files created in the same second will have the same "age". zfile '%r' does not existT)r9r:existsrabspathstatst_mtime)rr)targetr!r!r"newer`s  zFileOperator.newerTcCs|jtjj|tjd|||jsd}|rftjj|rDd|}n"tjj|rftjj | rfd|}|rvt |dt j |||j |dS)z8Copy a file respecting dry-run and force flags. zCopying %s to %sNz%s is a symlinkz%s is a non-regular filez which would be overwritten) ensure_dirr9r:dirnameloggerinforislinkrisfilerrZcopyfiler)rZinfileoutfilecheckmsgr!r!r" copy_filets    zFileOperator.copy_fileNc Cst|jtjj|tjd|||jsf|dkr:t|d}ntj|d|d}zt j ||Wd|j X|j |dS)NzCopying stream %s to %swbw)encoding) rr9r:rrrropenr`rZ copyfileobjrjr)rZinstreamrrZ outstreamr!r!r" copy_streams  zFileOperator.copy_streamc CsF|jtjj||js8t|d}|j|WdQRX|j|dS)Nr)rr9r:rrrrxr)rr:rmfr!r!r"write_binary_files  zFileOperator.write_binary_filec CsL|jtjj||js>t|d}|j|j|WdQRX|j|dS)Nr) rr9r:rrrrxencoder)rr:rmrrr!r!r"write_text_files  zFileOperator.write_text_filecCsrtjdkstjdkrntjdkrnxN|D]F}|jrszFileOperator.cCs~tjj|}||jkrztjj| rz|jj|tjj|\}}|j|tj d||j shtj ||j rz|j j|dS)Nz Creating %s)r9r:rrrrr2rrrrmkdirrr)rr:r rr!r!r"rs    zFileOperator.ensure_dircCsht|| }tjd|||jsZ|s0|j||rJ|s:d}n|t|d}tj|||d|j||S)NzByte-compiling %s to %sT) r rrrrr< py_compilecompiler)rr:optimizeforcerDZdpathZdiagpathr!r!r" byte_compiles  zFileOperator.byte_compilecCstjj|rtjj|r`tjj| r`tjd||jsBtj ||j r||j kr|j j |nPtjj|rrd}nd}tjd|||jstj ||j r||j kr|j j |dS)NzRemoving directory tree at %slinkfilezRemoving %s %s)r9r:risdirrrdebugrrr|rrrr)rr:r3r!r!r"ensure_removeds"       zFileOperator.ensure_removedcCsHd}x>|sBtjj|r&tj|tj}Ptjj|}||kr)r'rDrBrv)rr!r!r"__repr__!s zExportEntry.__repr__cCsDt|tsd}n0|j|jko>|j|jko>|j|jko>|j|jk}|S)NF)rMrr'rDrBrv)rotherr4r!r!r"__eq__%s     zExportEntry.__eq__N) rrrrrrrrrr__hash__r!r!r!r"rs   rz(?P(\w|[-.+])+) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P\w+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? c Cstj|}|s0d}d|ks"d|krtd|n|j}|d}|d}|jd}|dkrf|d}}n"|dkrztd||jd\}}|d } | dkrd|ksd|krtd|g} nd d | jd D} t|||| }|S) N[]zInvalid specification '%s'r'callable:rrrvcSsg|] }|jqSr!)r-)r%rr!r!r"r&Qsz$get_export_entry..,)ENTRY_REsearchrrcountr2r) Z specificationrr4r r'r:ZcolonsrDrBrvr!r!r"rf7s2    rfc Cs|dkr d}tjdkr.dtjkr.tjjd}n tjjd}tjj|rftj|tj}|st j d|n|jdd\}}d|kr.|}n|jdd\}}|||fS)N@rr)r2)ZnetlocZusernameZpasswordrDr!r!r"parse_credentialssrcCstjd}tj||S)N)r9umask)r4r!r!r"get_process_umasks  rcCs2d}d}x$t|D]\}}t|tsd}PqW|S)NTF) enumeraterMr)seqr4ir3r!r!r"is_string_sequences rz3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)z -py(\d\.?\d?)cCsd}d}t|jdd}tj|}|r@|jd}|d|j}|rt|t|dkrtjtj |d|}|r|j }|d|||dd|f}|dkrt j|}|r|jd|jd|f}|S)zw Extract name, version, python version from a filename (no extension) Return name, version, pyver or None N -rz\brX) rr8PYTHON_VERSIONrrnstartr<rer,escapeendPROJECT_NAME_AND_VERSION)filenameZ project_namer4Zpyverrnr!r!r"split_filenames"   rz-(?P[\w .-]+)\s*\(\s*(?P[^\s)]+)\)$cCs:tj|}|std||j}|djj|dfS)z A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. z$Ill-formed name/version string: '%s'r'Zver)NAME_VERSION_REr,rrr-rO)rRrr r!r!r"parse_name_and_versions  rcCst}t|pg}t|pg}d|kr8|jd||O}x|D]x}|dkrV|j|q>|jdr|dd}||krtjd|||kr|j|q>||krtjd||j|q>W|S)N*rrzundeclared extra: %s)rwrr startswithrr)Z requestedZ availabler4rZunwantedr!r!r" get_extrass&        rcCsi}yNt|}|j}|jd}|jds8tjd|ntjd|}tj |}Wn0t k r}ztj d||WYdd}~XnX|S)Nz Content-Typezapplication/jsonz(Unexpected response for JSON request: %szutf-8z&Failed to get external data for %s: %s) r rgetrrrr`rarcrdrg exception)r*r4ZrespZheadersZctreaderer!r!r"_get_external_datas   rz'https://www.red-dove.com/pypi/projects/cCs*d|dj|f}tt|}t|}|S)Nz%s/%s/project.jsonr)upperr _external_data_base_urlr)r'r*r4r!r!r"get_project_datas rcCs(d|dj||f}tt|}t|S)Nz%s/%s/package-%s.jsonr)rr rr)r'versionr*r!r!r"get_package_datas r c@s(eZdZdZddZddZddZdS) Cachez A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. cCsPtjj|stj|tj|jd@dkr6tjd|tjjtjj ||_ dS)zu Initialise an instance. :param base: The base directory where the cache should be located. ?rzDirectory '%s' is not privateN) r9r:rrrrrrrnormpathr>)rr>r!r!r"r"s    zCache.__init__cCst|S)zN Converts a resource prefix to a directory name in the cache. )r)rrDr!r!r" prefix_to_dir0szCache.prefix_to_dirc Csg}xtj|jD]r}tjj|j|}y>tjj|s@tjj|rLtj|ntjj|rbt j |Wqt k r|j |YqXqW|S)z" Clear the cache. ) r9rr>r:r0rrrrrr|rgappend)rZ not_removedfnr!r!r"clear6s  z Cache.clearN)rrr__doc__rr$r'r!r!r!r"r!sr!c@s:eZdZdZddZdddZddZd d Zd d Zd S) EventMixinz1 A very simple publish/subscribe system. cCs i|_dS)N) _subscribers)rr!r!r"rKszEventMixin.__init__TcCsD|j}||krt|g||<n"||}|r6|j|n |j|dS)a` Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list for the event. N)r*rr% appendleft)revent subscriberr%subsZsqr!r!r"rNs  zEventMixin.addcCs,|j}||krtd|||j|dS)z Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. zNo subscribers: %rN)r*rr)rr,r-r.r!r!r"rbs zEventMixin.removecCst|jj|fS)z Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. )iterr*r)rr,r!r!r"get_subscribersnszEventMixin.get_subscribersc Ospg}xT|j|D]F}y||f||}Wn"tk rJtjdd}YnX|j|qWtjd|||||S)a^ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The keyword arguments to pass to the event's subscribers. z"Exception during event publicationNz/publish %s: args = %s, kwargs = %s, result = %s)r0rgrrr%r)rr,argskwargsr4r-rrr!r!r"publishus    zEventMixin.publishN)T) rrrr(rrrr0r3r!r!r!r"r)Gs   r)c@s^eZdZddZddZdddZdd Zd d Zd d ZddZ e ddZ e ddZ dS) SequencercCsi|_i|_t|_dS)N)_preds_succsrw_nodes)rr!r!r"rszSequencer.__init__cCs|jj|dS)N)r7r)rnoder!r!r"add_nodeszSequencer.add_nodeFcCs||jkr|jj||rx&t|jj|fD]}|j||q.Wx&t|jj|fD]}|j||qVWx&t|jjD]\}}|sz|j|=qzWx&t|jjD]\}}|s|j|=qWdS)N)r7rrwr5rr6rre)rr8ZedgesrRr3rorpr!r!r" remove_nodes   zSequencer.remove_nodecCs0|jj|tj||jj|tj|dS)N)r5 setdefaultrwrr6)rpredsuccr!r!r"rsz Sequencer.addcCs|y|j|}|j|}Wn tk r8td|YnXy|j||j|Wn$tk rvtd||fYnXdS)Nz%r not a successor of anythingz%r not a successor of %r)r5r6KeyErrorrr)rr<r=predsZsuccsr!r!r"rs  zSequencer.removecCs||jkp||jkp||jkS)N)r5r6r7)rstepr!r!r"is_stepszSequencer.is_stepcCs|j|std|g}g}t}|j|xd|r|jd}||krd||kr|j||j|q0|j||j||jj|f}|j |q0Wt |S)Nz Unknown: %rr) rArrwr%r@rrr5rextendreversed)rfinalr4Ztodoseenr@r?r!r!r" get_stepss"        zSequencer.get_stepscsVdggiig|jfddxD]}|kr:|q:WS)Nrc sd|<d|<dd7<j|y |}Wntk rVg}YnXxR|D]J}|kr|t|||<q^|kr^t|||<q^W||krg}x j}|j|||krPqWt|}j|dS)Nrr)r%rgminr@tuple)r8Z successorsZ successorZconnected_componentZ component)graphindex index_counterlowlinksr4stack strongconnectr!r"rNs.       z3Sequencer.strong_connections..strongconnect)r6)rr8r!)rIrJrKrLr4rMrNr"strong_connectionss"  zSequencer.strong_connectionscCsrdg}x8|jD].}|j|}x|D]}|jd||fq"WqWx|jD]}|jd|qHW|jddj|S)Nz digraph G {z %s -> %s;z %s;} )r5r%r7r0)rr4r=r?r<r8r!r!r"dot s     z Sequencer.dotN)F) rrrrr9r:rrrArFpropertyrOrRr!r!r!r"r4s   3r4.tar.gz.tar.bz2.tar.zip.tgz.tbz.whlTc sffdd}tjjtd}|dkr|jdr>d}nH|jdrRd}d }n4|jdrfd }d }n |jdrzd}d}n td|z|dkrt|d}|r|j}xD|D] }||qWn.tj ||}|r|j }x|D] }||qW|dkr6t j ddkr6x.|j D]"} t| jts| jjd| _qWdd} | |_|jWd|r`|jXdS)NcsTt|ts|jd}tjjtjj|}|j sD|tjkrPt d|dS)Nzutf-8zpath outside destination: %r) rMrdecoder9r:rr0rr;r)r:rR)dest_dirplenr!r" check_paths   zunarchive..check_path.zip.whlzip.tar.gz.tgzZtgzzr:gz.tar.bz2.tbzZtbzzr:bz2z.tarZtarrzUnknown format for %rrrXzutf-8cSsBy tj||Stjk r<}ztt|WYdd}~XnXdS)z:Run tarfile.tar_fillter, but raise the expected ValueErrorN)tarfileZ tar_filterZ FilterErrorrstr)memberr:excr!r!r"extraction_filterPs z$unarchive..extraction_filter)r_r`)rbrc)rdre)r9r:rr<rrrZnamelistrfrZgetnamesrHr_Z getmembersrMr'rr[rjZ extractallrj) Zarchive_filenamer\formatrr^archivernamesr'Ztarinforjr!)r\r]r" unarchivesL           rnc Cstj}t|}t|db}xZtj|D]L\}}}x@|D]8}tjj||}||d} tjj| |} |j|| q8Wq(WWdQRX|S)z*zip a directory tree into a BytesIO objectrN) ioBytesIOr<rr9walkr:r0rx) Z directoryr4ZdlenZzfrootrrr'ZfullZrelrCr!r!r"zip_dir`s   rsr$KMGTPc@sreZdZdZdddZddZdd Zd d Zd d Ze ddZ e ddZ ddZ e ddZ e ddZdS)ProgressZUNKNOWNrdcCs(||_|_||_d|_d|_d|_dS)NrF)rGcurmaxstartedelapseddone)rZminvalZmaxvalr!r!r"rws  zProgress.__init__cCs0||_tj}|jdkr ||_n ||j|_dS)N)r{timer}r~)rZcurvalZnowr!r!r"updates  zProgress.updatecCs|j|j|dS)N)rr{)rZincrr!r!r" incrementszProgress.incrementcCs|j|j|S)N)rrG)rr!r!r"r s zProgress.startcCs |jdk r|j|jd|_dS)NT)r|rr)rr!r!r"stops  z Progress.stopcCs|jdkr|jS|jS)N)r|unknown)rr!r!r"maximumszProgress.maximumcCsD|jr d}n4|jdkrd}n$d|j|j|j|j}d|}|S)Nz100 %z ?? %gY@z%3d %%)rr|r{rG)rr4rpr!r!r" percentages zProgress.percentagecCs:|dkr|jdks|j|jkr$d}ntjdtj|}|S)Nrz??:??:??z%H:%M:%S)r|r{rGrZstrftimeZgmtime)rZdurationr4r!r!r"format_durationszProgress.format_durationcCs|jrd}|j}n^d}|jdkr&d}nJ|jdks<|j|jkrBd}n.t|j|j}||j|j}|d|j}d||j|fS)NZDonezETA rrz%s: %sr)rr~r|r{rGfloatr)rrDtr!r!r"ETAs z Progress.ETAcCsN|jdkrd}n|j|j|j}xtD]}|dkr6P|d}q(Wd||fS)Nrgig@@z%d %sB/s)r~r{rGUNITS)rr4Zunitr!r!r"speeds   zProgress.speedN)rrz)rrrrrrrr rrSrrrrrr!r!r!r"ryts     ryz \{([^}]*)\}z[^/\\,{]\*\*|\*\*[^/\\,}]z^[^{]*\}|\{[^}]*$cCs<tj|rd}t||tj|r4d}t||t|S)zAExtended globbing function that supports ** and {opt1,opt2,opt3}.z7invalid glob %r: recursive glob "**" must be used alonez2invalid glob %r: mismatching set marker '{' or '}')_CHECK_RECURSIVE_GLOBrr_CHECK_MISMATCH_SET_iglob) path_globrr!r!r"rs    rc cstj|d}t|dkr\|\}}}x|jdD](}x"tdj|||fD] }|VqHWq.Wnd|kr~xt|D] }|VqnWn|jdd\}}|dkrd}|dkrd}n|jd}|jd}xFtj|D]8\}}} tj j |}x ttj j||D] } | VqWqWdS) Nrrr$z**rrr7\) RICH_GLOBr2r<rr0 std_iglobr=r9rqr:r#) rZrich_path_globrDrwrBitemr:Zradicaldirrr&r!r!r"rs(       r) HTTPSHandlermatch_hostnameCertificateErrorc@seZdZdZdZddZdS)HTTPSConnectionNTc CsPtj|j|jf|j}t|ddr0||_|jtt dsp|j rHt j }nt j }t j ||j|j|t j|j d|_nxt jt j}|jt jO_|jr|j|j|ji}|j rt j |_|j|j dtt ddr|j|d<|j |f||_|j o|jrLy$t|jj|jtjd|jWn0tk rJ|jjtj|jjYnXdS) NZ _tunnel_hostF SSLContext) cert_reqsZ ssl_versionca_certs)ZcafileZHAS_SNIZserver_hostnamezHost verified: %s) rZcreate_connectionhostporttimeoutrIsockZ_tunnelrGsslrZ CERT_REQUIREDZ CERT_NONEZ wrap_socketZkey_fileZ cert_fileZPROTOCOL_SSLv23rZoptionsZ OP_NO_SSLv2Zload_cert_chainZ verify_modeZload_verify_locations check_domainrZ getpeercertrrrZshutdownZ SHUT_RDWRrj)rrrcontextr2r!r!r"connect s>      zHTTPSConnection.connect)rrrrrrr!r!r!r"rsrc@s&eZdZd ddZddZddZdS) rTcCstj|||_||_dS)N)BaseHTTPSHandlerrrr)rrrr!r!r"r0s zHTTPSHandler.__init__cOs$t||}|jr |j|_|j|_|S)a This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. )rrr)rr1r2r4r!r!r" _conn_maker5s zHTTPSHandler._conn_makercCsVy|j|j|Stk rP}z&dt|jkr>td|jnWYdd}~XnXdS)Nzcertificate verify failedz*Unable to verify server certificate for %s)Zdo_openrrrgreasonrr)rreqrr!r!r" https_openEs zHTTPSHandler.https_openN)T)rrrrrrr!r!r!r"r/s rc@seZdZddZdS)HTTPSOnlyHandlercCstd|dS)NzAUnexpected HTTP request on what should be a secure connection: %s)r)rrr!r!r" http_openYszHTTPSOnlyHandler.http_openN)rrrrr!r!r!r"rXsrc@seZdZdddZdS)HTTPr$NcKs&|dkr d}|j|j||f|dS)Nr)_setup_connection_class)rrrr2r!r!r"resz HTTP.__init__)r$N)rrrrr!r!r!r"rdsrc@seZdZdddZdS)HTTPSr$NcKs&|dkr d}|j|j||f|dS)Nr)rr)rrrr2r!r!r"rmszHTTPS.__init__)r$N)rrrrr!r!r!r"rlsrc@seZdZdddZddZdS) TransportrcCs||_tjj||dS)N)rrrr)rr use_datetimer!r!r"rtszTransport.__init__cCsb|j|\}}}tdkr(t||jd}n6|j s>||jdkrT||_|tj|f|_|jd}|S)Nrr)rrr)rr) get_host_info _ver_inforr _connection_extra_headersrZHTTPConnection)rrhehZx509r4r!r!r"make_connectionxs zTransport.make_connectionN)r)rrrrrr!r!r!r"rss rc@seZdZdddZddZdS) SafeTransportrcCs||_tjj||dS)N)rrrr)rrrr!r!r"rszSafeTransport.__init__cCsz|j|\}}}|si}|j|d<tdkr:t|df|}n<|j sP||jdkrl||_|tj|df|f|_|jd}|S)Nrrrrr)rr)rrrrrrrr)rrrrr2r4r!r!r"rs    zSafeTransport.make_connectionN)r)rrrrrr!r!r!r"rs rc@seZdZddZdS) ServerProxyc Kst|jdd|_}|dk r^t|\}}|jdd}|dkr@t}nt}|||d|d<}||_tjj ||f|dS)NrrrZhttps)r transport) r@rrrrrrrrr) rZurir2rscheme_rZtclsrr!r!r"rs  zServerProxy.__init__N)rrrrr!r!r!r"rsrcKs.tjddkr|d7}nd|d<t||f|S)NrrXbr$newline)rHr_r)r&rr2r!r!r" _csv_opens rc@s4eZdZedededdZddZddZd S) CSVBaser"rQ)Z delimiterZ quotecharZlineterminatorcCs|S)Nr!)rr!r!r" __enter__szCSVBase.__enter__cGs|jjdS)N)r]rj)rrr!r!r"__exit__szCSVBase.__exit__N)rrrrgdefaultsrrr!r!r!r"rs  rc@s(eZdZddZddZddZeZdS) CSVReadercKs\d|kr4|d}tjddkr,tjd|}||_nt|dd|_tj|jf|j|_dS)Nr]rrXzutf-8r:r) rHr_r`rar]rcsvrr)rr2r]r!r!r"rszCSVReader.__init__cCs|S)Nr!)rr!r!r"__iter__szCSVReader.__iter__cCsJt|j}tjddkrFx,t|D] \}}t|ts"|jd||<q"W|S)NrrXzutf-8)nextrrHr_rrMrr[)rr4rrr!r!r"rs   zCSVReader.nextN)rrrrrr__next__r!r!r!r"rs rc@seZdZddZddZdS) CSVWritercKs$t|d|_tj|jf|j|_dS)Nr)rr]rwriterr)rr&r2r!r!r"rs zCSVWriter.__init__cCsRtjddkrBg}x*|D]"}t|tr0|jd}|j|qW|}|jj|dS)NrrXzutf-8)rHr_rMrrr%rwriterow)rrowrrr!r!r"rs   zCSVWriter.writerowN)rrrrrr!r!r!r"rsrcsHeZdZeejZded<d fdd ZddZdd Zd d Z Z S) Configurator inc_convertZincNcs"tt|j||ptj|_dS)N)superrrr9r~r>)rconfigr>) __class__r!r"rszConfigurator.__init__c sfddjd}t|s*j|}jdd}jdf}|r\tfdd|D}fddD}t|}|||}|rx$|jD]\}} t||| qW|S) Ncszt|ttfr*t|fdd|D}nLt|trld|krHj|}qvi}x(|D]}||||<qRWn j|}|S)Ncsg|] }|qSr!r!)r%r)convertr!r"r&szBConfigurator.configure_custom..convert..z())rMrrHtypedictconfigure_customr)or4ro)rrr!r"rs    z.Configurator.configure_custom..convertz()rz[]csg|] }|qSr!r!)r%r)rr!r"r&sz1Configurator.configure_custom..cs$g|]}t|r||fqSr!)r)r%ro)rrr!r"r&s)r@rrrHrresetattr) rrrSZpropsr1rer2r4rrpr!)rrrr"rs     zConfigurator.configure_customcCs4|j|}t|tr0d|kr0|j||j|<}|S)Nz())rrMrr)rrVr4r!r!r" __getitem__s zConfigurator.__getitem__c CsFtjj|stjj|j|}tj|ddd}tj|}WdQRX|S)z*Default converter for the inc:// protocol.rzutf-8)rN) r9r:isabsr0r>r`rrcrd)rrrrr4r!r!r"rs  zConfigurator.inc_convert)N) rrrrrZvalue_convertersrrrr __classcell__r!r!)rr"rs  rc@s&eZdZd ddZddZddZdS) SubprocessMixinFNcCs||_||_dS)N)verboseprogress)rrrr!r!r"r+szSubprocessMixin.__init__cCsn|j}|j}xT|j}|sP|dk r0|||q|sBtjjdntjj|jdtjjqW|jdS)z Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. Nrzutf-8) rrreadlinerHstderrrxr[flushrj)rr]rrrr3r!r!r"r/s zSubprocessMixin.readercKstj|ftjtjd|}tj|j|jdfd}|jtj|j|jdfd}|j|j |j |j |j dk r|j ddn|j rt jjd|S)N)stdoutrr)rr1rzdone.mainzdone. ) subprocessPopenPIPE threadingZThreadrrr rwaitr0rrrHrx)rcmdr2rRZt1Zt2r!r!r" run_commandDs   zSubprocessMixin.run_command)FN)rrrrrrr!r!r!r"r*s rcCstjdd|jS)z,Normalize a python package name a la PEP 503z[-_.]+r)r subrO)r'r!r!r"normalize_nameUsr)NN)r)N)N)rTrUrVrWrXrYrZ)NT)r$rtrurvrwrx)rr)r` collectionsr contextlibrZglobrrrorcZloggingr9rr rrr ImportErrorrrHrfrzrkrZdummy_threadingrr$rcompatrrr r r r r rrrrrrrrrrrrZ getLoggerrrCOMMArr1ZIDENTZ EXTRA_IDENTZVERSPECZRELOPZBARE_CONSTRAINTSZ DIRECT_REFZ CONSTRAINTSZ EXTRA_LISTZEXTRASZ REQUIREMENTr+Z RELOP_IDENTr.r6rErJrNrTrWrsrycontextmanagerr}rrrrrrrrVERBOSErrfrrrrrrIr rrrrrrrrr r!r)r4ZARCHIVE_EXTENSIONSrnrsrryrrrrrrrrrrr_rrrrrrrrrrrrrr!r!r!r"s      X   ,   %   /  7  )     ,H  C]    *)  :+distlib/__pycache__/metadata.cpython-36.pyc000064400000064571152347724720014646 0ustar003 Pf@sdZddlmZddlZddlmZddlZddlZddlZddl m Z m Z ddl m Z mZmZddlmZdd lmZmZdd lmZmZejeZGd d d e ZGd dde ZGddde ZGddde ZdddgZdZ dZ!ej"dZ#ej"dZ$dGZ%dHZ&dIZ'dJZ(dKZ)dLZ*dMZ+e,Z-e-j.e%e-j.e&e-j.e(e-j.e*ej"d8Z/d9d:Z0d;d<Z1ddddd%ddd d!d"d#d+d,d$d&d'd-d/d0d5d1d2d*d)d(d.d3d4d6d7d=Z2dNZ3dOZ4dPZ5dQZ6dRZ7dSZ8dTZ9e:Z;ej"d>ZdDZ?dEZ@GdFdde:ZAdS)VzImplementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). )unicode_literalsN)message_from_file)DistlibException __version__)StringIO string_types text_type) interpret)extract_by_key get_extras) get_schemePEP440_VERSION_REc@seZdZdZdS)MetadataMissingErrorzA required metadata is missingN)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/metadata.pyrsrc@seZdZdZdS)MetadataConflictErrorz>Attempt to read or write metadata fields that are conflictual.N)rrrrrrrrr src@seZdZdZdS) MetadataUnrecognizedVersionErrorz Unknown metadata version number.N)rrrrrrrrr$src@seZdZdZdS)MetadataInvalidErrorzA metadata value is invalidN)rrrrrrrrr(srMetadataPKG_INFO_ENCODINGPKG_INFO_PREFERRED_VERSIONzutf-8z1.1z \|z Metadata-VersionNameVersionPlatformSummary DescriptionKeywords Home-pageAuthor Author-emailLicenseSupported-Platform Classifier Download-URL ObsoletesProvidesRequires MaintainerMaintainer-emailObsoletes-Dist Project-URL Provides-Dist Requires-DistRequires-PythonRequires-ExternalPrivate-Version Obsoleted-BySetup-Requires-Dist ExtensionProvides-Extraz"extra\s*==\s*("([^"]+)"|'([^']+)')cCs<|dkr tS|dkrtS|dkr$tS|dkr0tSt|dS)Nz1.0z1.1z1.2z2.0) _241_FIELDS _314_FIELDS _345_FIELDS _426_FIELDSr)versionrrr_version2fieldlistgsr?c Csdd}g}x.|jD]"\}}|gddfkr.q|j|qWddddg}xt|D]l}|tkrld|krl|jd|tkrd|kr|jd|tkrd|kr|jd|tkrNd|krN|jdqNWt|d kr|d St|d krtd d|ko||t }d|ko ||t }d|ko||t }t |t |t |d krFtd | rl| rl| rlt |krlt S|rvdS|rdSdS) z5Detect the best version depending on the fields used.cSsx|D]}||krdSqWdS)NTFr)keysmarkersmarkerrrr _has_markerus z"_best_version.._has_markerUNKNOWNNz1.0z1.1z1.2z2.0rrzUnknown metadata setz(You used incompatible 1.1/1.2/2.0 fields)itemsappendr:remover;r<r=lenr _314_MARKERS _345_MARKERS _426_MARKERSintr) fieldsrCr@keyvalueZpossible_versionsZis_1_1Zis_1_2Zis_2_0rrr _best_versionssB        rP)metadata_versionnamer>platformZsupported_platformsummary descriptionkeywords home_pageauthor author_email maintainermaintainer_emaillicense classifier download_urlobsoletes_dist provides_dist requires_distsetup_requires_distrequires_pythonrequires_externalrequiresprovides obsoletes project_urlZprivate_versionZ obsoleted_by extensionZprovides_extraz[^A-Za-z0-9.]+FcCs0|r$tjd|}tjd|jdd}d||fS)zhReturn the distribution name with version. If for_filename is true, return a filename-escaped form.- .z%s-%s) _FILESAFEsubreplace)rRr>Z for_filenamerrr_get_name_and_versions rpc@s eZdZdZd?ddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZd@ddZddZdd Zd!d"Zd#d$ZdAd%d&ZdBd'd(ZdCd)d*Zd+d,Zefd-d.ZdDd/d0ZdEd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!dS)FLegacyMetadataaaThe legacy metadata of a release. Supports versions 1.0, 1.1 and 1.2 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name NdefaultcCsz|||gjddkrtdi|_g|_d|_||_|dk rH|j|n.|dk r\|j|n|dk rv|j||j dS)Nz'path, fileobj and mapping are exclusive) count TypeError_fieldsZrequires_filesZ _dependenciesschemeread read_fileupdateset_metadata_version)selfpathfileobjmappingrwrrr__init__s   zLegacyMetadata.__init__cCst|j|jd<dS)NzMetadata-Version)rPrv)r|rrrr{sz#LegacyMetadata.set_metadata_versioncCs|jd||fdS)Nz%s: %s )write)r|r~rRrOrrr _write_field szLegacyMetadata._write_fieldcCs |j|S)N)get)r|rRrrr __getitem__szLegacyMetadata.__getitem__cCs |j||S)N)set)r|rRrOrrr __setitem__szLegacyMetadata.__setitem__c Cs8|j|}y |j|=Wntk r2t|YnXdS)N) _convert_namervKeyError)r|rR field_namerrr __delitem__s   zLegacyMetadata.__delitem__cCs||jkp|j||jkS)N)rvr)r|rRrrr __contains__s zLegacyMetadata.__contains__cCs(|tkr |S|jddj}tj||S)Nrj_) _ALL_FIELDSrolower _ATTR2FIELDr)r|rRrrrrszLegacyMetadata._convert_namecCs|tks|tkrgSdS)NrD) _LISTFIELDS_ELEMENTSFIELD)r|rRrrr_default_value%szLegacyMetadata._default_valuecCs&|jdkrtjd|Stjd|SdS)N1.01.1 )rr)rQ_LINE_PREFIX_PRE_1_2rn_LINE_PREFIX_1_2)r|rOrrr_remove_line_prefix*s  z"LegacyMetadata._remove_line_prefixcCs|tkr||St|dS)N)rAttributeError)r|rRrrr __getattr__0szLegacyMetadata.__getattr__FcCst|d|d|S)zhReturn the distribution name with version. If filesafe is true, return a filename-escaped form.rr)rp)r|Zfilesaferrr get_fullname;szLegacyMetadata.get_fullnamecCs|j|}|tkS)z+return True if name is a valid metadata key)rr)r|rRrrris_fieldAs zLegacyMetadata.is_fieldcCs|j|}|tkS)N)rr)r|rRrrris_multi_fieldFs zLegacyMetadata.is_multi_fieldc Cs.tj|ddd}z|j|Wd|jXdS)z*Read the metadata values from a file path.rzutf-8)encodingN)codecsopenryclose)r|filepathfprrrrxJszLegacyMetadata.readcCst|}|d|jd<xxtD]p}||kr*q|tkrh|j|}|tkrZ|dk rZdd|D}|j||q||}|dk r|dkr|j||qW|jdS)z,Read the metadata values from a file object.zmetadata-versionzMetadata-VersionNcSsg|]}t|jdqS),)tuplesplit).0rOrrr _sz,LegacyMetadata.read_file..rD)rrvrrZget_all_LISTTUPLEFIELDSrr{)r|ZfileobmsgfieldvaluesrOrrrryRs  zLegacyMetadata.read_filec Cs0tj|ddd}z|j||Wd|jXdS)z&Write the metadata fields to filepath.wzutf-8)rN)rr write_filer)r|r skip_unknownrrrrrhszLegacyMetadata.writecCs|jxt|dD]}|j|}|r:|dgdgfkr:q|tkrX|j||dj|q|tkr|dkr|jd kr|jdd}n |jdd }|g}|t krd d |D}x|D]}|j|||qWqWd S)z0Write the PKG-INFO format data to a file object.zMetadata-VersionrDrr!1.01.1rz z |cSsg|]}dj|qS)r)join)rrOrrrrsz-LegacyMetadata.write_file..N)rr) r{r?rrrrrrQror)r|Z fileobjectrrrrOrrrrps$    zLegacyMetadata.write_filec sfdd}|snHt|dr>x<|jD]}||||q&Wnx|D]\}}|||qDW|r~x|jD]\}}|||qhWdS)aSet metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. cs"|tkr|rjj||dS)N)rrr)rNrO)r|rr_sets z#LegacyMetadata.update.._setr@N)hasattrr@rE)r|otherkwargsrkvr)r|rrzs  zLegacyMetadata.updatecCsn|j|}|tks|dkrPt|ttf rPt|trJdd|jdD}q~g}n.|tkr~t|ttf r~t|trz|g}ng}tj t j rB|d}t |j }|tkr|dk rx|D](}|j|jddstjd |||qWn`|tko|dk r|j|sBtjd |||n0|tkrB|dk rB|j|sBtjd ||||tkr`|d kr`|j|}||j|<dS) z"Control then set a metadata field.rcSsg|] }|jqSr)strip)rrrrrrsz&LegacyMetadata.set..rrN;rz$'%s': '%s' is not valid (field '%s')z.'%s': '%s' is not a valid version (field '%s')r!)rr isinstancelistrrrrloggerZ isEnabledForloggingZWARNINGr rw_PREDICATE_FIELDSis_valid_matcherwarning_VERSIONS_FIELDSis_valid_constraint_list_VERSION_FIELDSis_valid_version_UNICODEFIELDSrrv)r|rRrOZ project_namerwrrrrrs@            zLegacyMetadata.setcCs|j|}||jkr*|tkr&|j|}|S|tkr@|j|}|S|tkr|j|}|dkr^gSg}x6|D].}|tkr|j|qh|j|d|dfqhW|S|tkr|j|}t |t r|j dS|j|S)zGet a metadata field.Nrrr) rrv_MISSINGrrrrrFrrrr)r|rRrrrOresvalrrrrs.          zLegacyMetadata.getc s |jgg}}xd D]}||kr|j|qW|rT|gkrTddj|}t|xdD]}||krZ|j|qZW|ddkr||fSt|jfd d }xdt|ftjft j ffD]F\}}x<|D]4} |j | d } | d k o||  r|jd | | fqWqW||fS)zkCheck if the metadata is compliant. If strict is True then raise if no Name or Version are providedrrzmissing required metadata: %sz, Home-pager$zMetadata-Versionz1.2cs*x$|D]}j|jddsdSqWdS)NrrFT)rr)rOr)rwrrare_valid_constraintss z3LegacyMetadata.check..are_valid_constraintsNzWrong value for '%s': %s)rr)rr$) r{rFrrr rwrrrrrr) r|strictmissingwarningsattrrrrMZ controllerrrOr)rwrchecks2         zLegacyMetadata.checkcCs|jdB}i}x,|D]$\}}| s.||jkr||||<qW|ddkrdK}x|D]F\}}| sn||jkrV|d&kr||||<qVd,d-||D||<qVWnF|dd.krdO}x2|D]*\}}| s||jkr||||<qW|S)PzReturn fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). rQMetadata-VersionrRrr>rrTr rW Home-pagerXr$rY Author-emailr\r&rUr!rVr"rSr classifiersr(r^ Download-URLz1.2ra Requires-DistrcRequires-PythonrdRequires-Externalr` Provides-Distr_Obsoletes-Distrh Project-URLrZr-r[Maintainer-emailcSsg|]}dj|qS)r)r)rurrrrGsz)LegacyMetadata.todict..z1.1rfr+rer,rgr*rQrrRrr>rrTr rWrrXr$rYrr\r&rUr!rVr"rSrrr(r^r) rrrrrrrrrrrrrrarrcrrdrr`rr_rrhrrZr-r[r)rrrrrrrrrfr+rer,rgr*)rrr)r{rv)r|Z skip_missingZ mapping_1_0datarNrZ mapping_1_2Z mapping_1_1rrrtodictsP zLegacyMetadata.todictcCs<|ddkr(xdD]}||kr||=qW|d|7<dS)NzMetadata-Versionz1.1r*r,r+z Requires-Dist)r*r,r+r)r| requirementsrrrradd_requirementsUs    zLegacyMetadata.add_requirementscCstt|dS)NzMetadata-Version)rr?)r|rrrr@`szLegacyMetadata.keysccsx|jD] }|Vq WdS)N)r@)r|rNrrr__iter__cszLegacyMetadata.__iter__csfddjDS)Ncsg|] }|qSrr)rrN)r|rrrhsz)LegacyMetadata.values..)r@)r|r)r|rrgszLegacyMetadata.valuescsfddjDS)Ncsg|]}||fqSrr)rrN)r|rrrksz(LegacyMetadata.items..)r@)r|r)r|rrEjszLegacyMetadata.itemscCsd|jj|j|jfS)Nz <%s %s %s>) __class__rrRr>)r|rrr__repr__ms zLegacyMetadata.__repr__)NNNrr)F)F)F)N)F)F)"rrrrrr{rrrrrrrrrrrrrxryrrrzrrrrrrr@rrrErrrrrrqs>      ,  , ; rqz pydist.jsonz metadata.jsonc@seZdZdZejdZejdejZe Z ejdZ dZ de ZffdIdZd Zd ZeffedJfe dKfe dLfd ZdMZdNddZedOZdefZdefZdefdefeeedefeeeedefdPdQd Z[[dd ZdRd!d"Zd#d$Zed%d&Z ed'd(Z!e!j"d)d(Z!dSd*d+Z#ed,d-Z$ed.d/Z%e%j"d0d/Z%d1d2Z&d3d4Z'd5d6Z(d7d8Z)d9d:d;dZ*d?d@Z+dTdCdDZ,dEdFZ-dGdHZ.dS)Urz The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. z ^\d+(\.\d+)*$z!^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$z .{1,2047}z2.0z distlib (%s)legacy)rRr>rTzqname version license summary description author author_email keywords platform home_page classifiers download_urlzwextras run_requires test_requires build_requires dev_requires provides meta_requires obsoleted_by supports_environments)rQrRr>rT_legacy_datarwNrrcCs0|||gjddkrtdd|_d|_||_|dk rzy|j||||_Wn*tk rvt||d|_|jYnXnd}|rt |d}|j }WdQRXn |r|j }|dkr|j |j d|_ndt |ts|jd}ytj||_|j|j|Wn0tk r*tt||d|_|jYnXdS)Nrsz'path, fileobj and mapping are exclusive)rrwrb)rQ generatorzutf-8)r~rw)rtrurrrw_validate_mappingrrqvalidaterrxMETADATA_VERSION GENERATORrr decodejsonloads ValueErrorr)r|r}r~rrwrfrrrrs<       zMetadata.__init__rRr>r\rVrTz Requires-DistzSetup-Requires-DistzProvides-Extrar( Download-URLMetadata-Version) run_requiresbuild_requires dev_requiresZ test_requires meta_requiresextrasmodules namespacesexportscommandsrZ source_urlrQc CsZtj|d}tj|d}||kr||\}}|jr^|dkrP|dkrHdn|}n |jj|}n|dkrjdn|}|d kr|jj||}nt}|}|jjd} | r |dkr| jd |}nR|dkr| jd } | r| j||}n.| jd } | s|jjd } | r | j||}||krV|}n:||kr4tj||}n"|jrJ|jj|}n |jj|}|S) N common_keys mapped_keysrrrrr extensionszpython.commandszpython.detailszpython.exports)rrrrr)object__getattribute__rrr) r|rNcommonmappedlkZmakerresultrOsentineldrrrrsF            zMetadata.__getattribute__cCsH||jkrD|j|\}}|p |j|krD|j|}|sDtd||fdS)Nz.'%s' is an invalid value for the '%s' property)SYNTAX_VALIDATORSrwmatchr)r|rNrOrwpattern exclusionsmrrr_validate_values  zMetadata._validate_valuecCs*|j||tj|d}tj|d}||kr||\}}|jrV|dkrJt||j|<nf|d krj||j|<nR|jjdi}|dkr||d <n2|dkr|jd i}|||<n|jd i}|||<nh||krtj|||nP|d krt|t r|j }|r|j }ng}|jr||j|<n ||j|<dS)Nrrrrrrrrzpython.commandszpython.detailszpython.exportsrV)rrrrr) r'rrrNotImplementedErrorr setdefault __setattr__rrrr)r|rNrOrrrrr!rrrr*s>               zMetadata.__setattr__cCst|j|jdS)NT)rprRr>)r|rrrname_and_version@szMetadata.name_and_versioncCsF|jr|jd}n|jjdg}d|j|jf}||krB|j||S)Nz Provides-Distrfz%s (%s))rrr)rRr>rF)r|rsrrrrfDs  zMetadata.providescCs |jr||jd<n ||jd<dS)Nz Provides-Distrf)rr)r|rOrrrrfOs c Cs|jr |}ng}t|pg|j}xl|D]d}d|kr@d|kr@d}n8d|krNd}n|jd|k}|rx|jd}|rxt||}|r&|j|dq&WxNd D]F}d|} | |kr|j| |jjd |g}|j|j|||d qW|S) a Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. :param env: An optional environment for marker evaluation. extra environmentTrebuilddevtestz:%s:z %s_requires)renv)r/r0r1) rr rrr extendrGrget_requirements) r|reqtsrr2rr!includerBrNerrrr4Vs0       zMetadata.get_requirementscCs|jr|jS|jS)N)r _from_legacyr)r|rrr dictionaryszMetadata.dictionarycCs|jr tnt|j|jSdS)N)rr(r rDEPENDENCY_KEYS)r|rrr dependenciesszMetadata.dependenciescCs|jr tn |jj|dS)N)rr(rrz)r|rOrrrr;sc Cs|jd|jkrtg}x0|jjD]"\}}||kr&||kr&|j|q&W|rfddj|}t|x"|jD]\}}|j|||qpWdS)NrQzMissing metadata items: %sz, ) rrrMANDATORY_KEYSrErFrrr') r|rrwrrNr%rrrrrrrszMetadata._validate_mappingcCsB|jr.|jjd\}}|s|r>tjd||n|j|j|jdS)NTz#Metadata: missing: %s, warnings: %s)rrrrrrrw)r|rrrrrrs  zMetadata.validatecCs(|jr|jjdSt|j|j}|SdS)NT)rrr r INDEX_KEYS)r|rrrrrs zMetadata.todictc Cs|jr|j st|j|jd}|jjd}x2dD]*}||kr2|dkrLd }n|}||||<q2W|jd g}|d gkrzg}||d <d}x2|D]*\}}||kr||rd||ig||<qW|j|d<i}i} |S)N)rQrTrRr>r\rTrUr]rr"rVrarrbrrerf)rRr>r\rTrUr]rarrbr)r?r@)rrAssertionErrorrrrrrf) r|rZlmdrnkkwr@okrXrZrrrr8s0     zMetadata._from_legacyrrr&r r!)rRr>r\rTrUrcCsdd}|jr|j stt}|j}x*|jjD]\}}||kr2||||<q2W||j|j}||j|j }|j rt |j |d<t ||d<t ||d<|S)NcSst}x|D]}|jd}|jd}|d}xb|D]Z}| rN| rN|j|q2d}|r^d|}|rx|rtd||f}n|}|jdj||fq2Wq W|S)Nr-r.rer>z extra == "%s"z (%s) and %sr)rraddr)Zentriesr5r7r-r2ZrlistrrBrrrprocess_entriess"      z,Metadata._to_legacy..process_entrieszProvides-Extraz Requires-DistzSetup-Requires-Dist) rrrArqLEGACY_MAPPINGrErrrrrsorted)r|rFrZnmdrBrDZr1Zr2rrr _to_legacys  zMetadata._to_legacyFTcCs||gjddkrtd|j|r`|jr4|j}n|j}|rP|j||dq|j||dn^|jrp|j}n|j}|rt j ||ddddn.t j |dd}t j ||ddddWdQRXdS) Nrz)Exactly one of path and fileobj is needed)rTrs)Z ensure_asciiindentZ sort_keysrzutf-8) rtr rrrIrrr8rrdumprr)r|r}r~rrZ legacy_mdr!r rrrrs&    zMetadata.writecCs|jr|jj|nt|jjdg}d}x"|D]}d|kr,d|kr,|}Pq,W|dkrhd|i}|jd|n t|dt|B}t||d<dS)Nrr.r-rer)rrrr)insertrrH)r|rralwaysentryZrsetrrrrs zMetadata.add_requirementscCs*|jpd}|jpd}d|jj|j||fS)Nz (no name)z no versionz<%s %s %s (%s)>)rRr>rrrQ)r|rRr>rrrr(s  zMetadata.__repr__)r)r)r)r)rrrw)NNNrr)rRr>r\rVrT)r N)r N)N)NN)NNFT)/rrrrrecompileZMETADATA_VERSION_MATCHERIZ NAME_MATCHERrZVERSION_MATCHERZSUMMARY_MATCHERrrrr<r=r:r" __slots__rrrrZ none_listdictZ none_dictrrr'r*propertyr+rfsetterr4r9r;rrrr8rGrIrrrrrrrrvsx    ,+ '   *   % ) rrrrr r!r"r#r$r%r&)rrrrr'r r!r"r#r$r%r&r(r)r*r+r,)r*r+r,r(r))rrrrr'r r!r"r#r$r%r-r.r&r(r)r/r0r1r2r3r4)r1r2r3r/r4r-r.r0)rrrrr'r r!r"r#r$r%r-r.r&r(r)r/r0r1r2r3r4r5r6r7r8r9)r5r9r6r7r8)r2r/r1)r3)r)rr(r*r,r+r/r1r2r4r0r'r7r9r8)r0)r")r$r-r r!)F)BrZ __future__rrZemailrrrrOr>rrcompatrrr rAr utilr r r>r rZ getLoggerrrrrrr__all__rrrPrrr:r;rIr<rJr=rKrrrzZEXTRA_REr?rPrrrrrrrrrrrmrprqZMETADATA_FILENAMEZWHEEL_METADATA_FILENAMErrrrr s             9   distlib/__pycache__/markers.cpython-36.pyc000064400000013506152347724720014522 0ustar003 Pf@sddZddlZddlZddlZddlZddlmZmZddlm Z dgZ Gddde Z d d dZ dS) zEParser for the environment markers micro-language defined in PEP 345.N)python_implementation string_types)in_venv interpretc @seZdZdZddddddddddddd dd dd dd Zejd ejddejj ddde j e e ejejejed Zd*ddZddZddZd+ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)ZdS), Evaluatorz5 A limited evaluator for Python expressions. cCs||kS)N)xyrr/usr/lib/python3.6/markers.pyszEvaluator.cCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs| S)Nr)r rrr r scCs||kS)Nr)r r rrr r !scCs||kS)Nr)r r rrr r "s) eqgtZgteinltZltenotZnoteqZnotinz%s.%sN rr) Z sys_platformZpython_versionZpython_full_versionZos_nameZplatform_in_venvZplatform_releaseZplatform_versionZplatform_machineZplatform_python_implementationcCs|pi|_d|_dS)zu Initialise an instance. :param context: If specified, names are looked up in this mapping. N)contextsource)selfrrrr __init__3s zEvaluator.__init__cCs8d}d|j|||}||t|jkr4|d7}|S)zH Get the part of the source which is causing a problem. z%rz...)rlen)roffsetZ fragment_lensrrr get_fragment<s zEvaluator.get_fragmentcCst|d|dS)z@ Get a handler for the specified AST node type. zdo_%sN)getattr)r node_typerrr get_handlerFszEvaluator.get_handlercCst|trr||_ddi}|r$||d<ytj|f|}Wn:tk rp}z|j|j}td|WYdd}~XnX|jj j }|j |}|dkr|jdkrd}n |j|j }td||f||S)zf Evaluate a source string or node, using ``filename`` when displaying errors. modeevalfilenamezsyntax error %sNz(source not available)z don't know how to evaluate %r %s) isinstancerrastparse SyntaxErrorrr __class____name__lowerr col_offset)rnoder"kwargserrZhandlerrrr evaluateLs&       zEvaluator.evaluatecCs&t|tjstdd|jj|jfS)Nzattribute node expectedz%s.%s)r#r$Z AttributeAssertionErrorvalueidattr)rr+rrr get_attr_keyfszEvaluator.get_attr_keycCsft|jtjsd}n|j|}||jkp0||jk}|sBtd|||jkrX|j|}n |j|}|S)NFzinvalid expression: %s)r#r0r$Namer3rallowed_valuesr&)rr+validkeyresultrrr do_attributejs     zEvaluator.do_attributecCs|j|jd}|jjtjk}|jjtjk}|s8|s8t|r@|sJ|r| rx4|jddD]"}|j|}|rp|sz|rZ| rZPqZW|S)Nrr)r.valuesopr'r$ZOrZAndr/)rr+r8Zis_orZis_andnrrr do_boolopxs  zEvaluator.do_boolopc sfdd}j}j|}d}xntjjD]\\}}||||jjj}|jkrft d|j|}j|||}|sP|}|}q2W|S)Ncs@d}t|tjr t|tjr d}|s<jj}td|dS)NTFzInvalid comparison: %s)r#r$ZStrrr*r&)lhsnoderhsnoder6r)r+rrr sanity_checks  z*Evaluator.do_compare..sanity_checkTzunsupported operation: %r) leftr.zipZopsZ comparatorsr'r(r) operatorsr&) rr+r@r>Zlhsr8r;r?Zrhsr)r+rr do_compares        zEvaluator.do_comparecCs |j|jS)N)r.Zbody)rr+rrr do_expressionszEvaluator.do_expressioncCsTd}|j|jkr"d}|j|j}n|j|jkr>d}|j|j}|sPtd|j|S)NFTzinvalid expression: %s)r1rr5r&)rr+r6r8rrr do_names   zEvaluator.do_namecCs|jS)N)r)rr+rrr do_strszEvaluator.do_str)N)N)r( __module__ __qualname____doc__rCsysplatform version_infoversionsplitosnamestrrreleasemachinerr5rrrr.r3r9r=rDrErFrGrrrr rs<       rcCst|j|jS)z Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping )rr.strip)ZmarkerZexecution_contextrrr rs )N)rJr$rPrKrLcompatrrutilr__all__objectrrrrrr s "distlib/__pycache__/compat.cpython-36.opt-1.pyc000064400000076203152347724720015303 0ustar003 Pfa@s ddlmZddlZddlZddlZy ddlZWnek rHdZYnXejddkr~ddlmZe fZ e Z ddl mZddlZddlZddlmZddlmZmZmZmZmZdd lmZmZmZm Z m!Z!m"Z"m#Z#d d Zddl$Z$dd l$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-er&dd l$m.Z.ddl/Z/ddl0Z0ddl1Z2ddl3m3Z3ddl4Z4e5Z5ddl6m7Z8ddl6m9Z:da;ddZ<n ddl=mZe>fZ e>Z ddl=m?ZddlZddlZddlZddl@mZmZmZmZod?d@ZiYnXyddAlpmqZqWn"ek r ddAlrmqZqYnXejddBddkr,e3jsZsn ddDlpmsZsyddEl`mtZtWndek rddFl`muZuyddGlvmwZxWn ek rdedIdJZxYnXGdKdLdLeuZtYnXyddMlymzZzWn ek rdfdNdOZzYnXyddPl`m{Z{Wnek rzyddQl|m}Z~Wn"ek r4ddQlm}Z~YnXyddRlmZmZmZWnek rdYnXGdSdTdTeZ{YnXyddUlmZmZWnvek rejmdVejZdWdXZGdYdZdZeZdgd[d\ZGd]d^d^eZGd_d`d`eZGdadbdbeQZYnXdS)h)absolute_importN)StringIO)FileType)shutil)urlparse urlunparseurljoinurlsplit urlunsplit) urlretrievequoteunquote url2pathname pathname2urlContentTooShortError splittypecCst|tr|jd}t|S)Nzutf-8) isinstanceunicodeencode_quote)sr/usr/lib/python3.6/compat.pyrs  r) RequesturlopenURLError HTTPErrorHTTPBasicAuthHandlerHTTPPasswordMgr HTTPHandlerHTTPRedirectHandler build_opener) HTTPSHandler) HTMLParser)ifilter) ifilterfalsecCs<tdkrddl}|jdatj|}|r4|jddSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.Nrz ^(.*)@(.*)$r) _userprogrecompilematchgroup)hostr*r,rrr splituser4s   r/) TextIOWrapper) rr r r/rrr r r) rr rrrrr r!r"r#)rrr) filterfalse)match_hostnameCertificateErrorc@s eZdZdS)r3N)__name__ __module__ __qualname__rrrrr3^sr3c Csg}|s dS|jd}|d|dd}}|jd}||krNtdt||sb|j|jkS|dkrv|jdn>|jd s|jd r|jtj|n|jtj|j d d x|D]}|jtj|qWtj d d j |dtj } | j |S)zpMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 F.rrN*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr3reprlowerappend startswithr*escapereplacer+join IGNORECASEr,) ZdnhostnameZ max_wildcardsZpatspartsZleftmostZ remainderZ wildcardsfragZpatrrr_dnsname_matchbs(    rFcCs|s tdg}|jdf}x0|D](\}}|dkr"t||r@dS|j|q"W|sxF|jdfD]6}x0|D](\}}|dkrjt||rdS|j|qjWq`Wt|dkrtd|d jtt|fn*t|dkrtd ||d fntd dS) a=Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDZsubjectAltNameZDNSNZsubjectZ commonNamerz&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found) ValueErrorgetrFr=lenr3rAmapr;)ZcertrCZdnsnamesZsankeyvaluesubrrrr2s.     r2)SimpleNamespacec@seZdZdZddZdS) ContainerzR A generic container for when multiple values need to be returned cKs|jj|dS)N)__dict__update)selfkwargsrrr__init__szContainer.__init__N)r4r5r6__doc__rTrrrrrOsrO)whichc s"dd}tjjr&||r"SdS|dkr>tjjdtj}|sFdS|jtj}tj dkrtj |krt|j dtj tjjddjtj}t fd d |Drg}q‡fd d |D}ng}t }xT|D]L}tjj|}||kr|j|x(|D] } tjj|| } || |r| SqWqWdS) aKGiven a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cSs&tjj|o$tj||o$tjj| S)N)ospathexistsaccessisdir)fnmoderrr _access_checkszwhich.._access_checkNPATHZwin32rZPATHEXTc3s |]}jj|jVqdS)N)r<endswith).0ext)cmdrr szwhich..csg|] }|qSrr)rbrc)rdrr szwhich..)rWrXdirnameenvironrHdefpathr9pathsepsysplatformcurdirinsertanysetnormcaseaddrA) rdr]rXr^ZpathextfilesseendirZnormdirZthefilenamer)rdrrVs8            rV)ZipFile __enter__) ZipExtFilec@s$eZdZddZddZddZdS)rycCs|jj|jdS)N)rPrQ)rRbaserrrrTszZipExtFile.__init__cCs|S)Nr)rRrrrrxszZipExtFile.__enter__cGs |jdS)N)close)rRexc_inforrr__exit__szZipExtFile.__exit__N)r4r5r6rTrxr}rrrrrysryc@s$eZdZddZddZddZdS)rwcCs|S)Nr)rRrrrrx"szZipFile.__enter__cGs |jdS)N)r{)rRr|rrrr}%szZipFile.__exit__cOstj|f||}t|S)N) BaseZipFileopenry)rRargsrSrzrrrr)sz ZipFile.openN)r4r5r6rxr}rrrrrrw!srw)python_implementationcCs0dtjkrdStjdkrdStjjdr,dSdS)z6Return a string identifying the Python implementation.ZPyPyjavaZJythonZ IronPythonZCPython)rkversionrWrvr>rrrrr0s   r) sysconfig)CallablecCs t|tS)N)rr)objrrrcallableDsrmbcsstrictsurrogateescapecCs:t|tr|St|tr$|jttStdt|jdS)Nzexpect bytes or str, not %s) rbytes text_typer _fsencoding _fserrors TypeErrortyper4)filenamerrrfsencodeRs    rcCs:t|tr|St|tr$|jttStdt|jdS)Nzexpect bytes or str, not %s) rrrdecoderrrrr4)rrrrfsdecode[s    r)detect_encoding)BOM_UTF8lookupzcoding[:=]\s*([-\w.]+)cCsH|ddjjdd}|dks*|jdr.dS|d ks@|jdrDdS|S)z(Imitates get_normal_name in tokenizer.c.N _-zutf-8zutf-8-latin-1 iso-8859-1 iso-latin-1latin-1- iso-8859-1- iso-latin-1-)rrr)rrr)r<r@r>)orig_encencrrr_get_normal_namels rc sy jjWntk r$dYnXdd}d}fdd}fdd}|}|jtrpd|d d}d }|s||gfS||}|r||gfS|}|s||gfS||}|r|||gfS|||gfS) a? The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. NFzutf-8c s yStk rdSXdS)N) StopIterationr)readlinerr read_or_stopsz%detect_encoding..read_or_stopcsy|jd}Wn4tk rBd}dk r6dj|}t|YnXtj|}|sVdSt|d}y t|}Wn:tk rdkrd|}n dj|}t|YnXr|j dkr؈dkrd}n dj}t||d 7}|S) Nzutf-8z'invalid or missing encoding declarationz {} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig) rUnicodeDecodeErrorformat SyntaxError cookie_refindallrr LookupErrorrv)line line_stringmsgZmatchesencodingcodec) bom_foundrrr find_cookies6       z$detect_encoding..find_cookieTrz utf-8-sig)__self__rvAttributeErrorr>r)rrdefaultrrfirstsecondr)rrrrrws4   &     r)r?r()unescape)ChainMap)MutableMapping)recursive_repr...csfdd}|S)zm Decorator to make a repr function return fillvalue for a recursive call csLtfdd}td|_td|_td|_tdi|_|S)Nc sBt|tf}|krSj|z |}Wdj|X|S)N)id get_identrrdiscard)rRrKresult) fillvalue repr_running user_functionrrwrappers   z=_recursive_repr..decorating_function..wrapperr5rUr4__annotations__)rpgetattrr5rUr4r)rr)r)rrrdecorating_functions   z,_recursive_repr..decorating_functionr)rrr)rr_recursive_reprs rc@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS)(ra A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. cGst|p ig|_dS)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)listmaps)rRrrrrrT szChainMap.__init__cCs t|dS)N)KeyError)rRrKrrr __missing__szChainMap.__missing__c Cs8x,|jD]"}y||Stk r(YqXqW|j|S)N)rrr)rRrKmappingrrr __getitem__s   zChainMap.__getitem__NcCs||kr||S|S)Nr)rRrKrrrrrHsz ChainMap.getcCsttj|jS)N)rIrpunionr)rRrrr__len__"szChainMap.__len__cCsttj|jS)N)iterrprr)rRrrr__iter__%szChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdS)Nr)rbm)rKrrre)sz(ChainMap.__contains__..)ror)rRrKr)rKr __contains__(szChainMap.__contains__cCs t|jS)N)ror)rRrrr__bool__+szChainMap.__bool__cCsdj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rrArJr;r)rRrrr__repr__.szChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterablerrrrr3szChainMap.fromkeyscCs$|j|jdjf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rrN) __class__rcopy)rRrrrr8sz ChainMap.copycCs|jif|jS)z;New ChainMap with a new dict followed by all previous maps.)rr)rRrrr new_child>szChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rN)rr)rRrrrparentsBszChainMap.parentscCs||jd|<dS)Nr)r)rRrKrLrrr __setitem__GszChainMap.__setitem__c Cs8y|jd|=Wn"tk r2tdj|YnXdS)Nrz(Key not found in the first mapping: {!r})rrr)rRrKrrr __delitem__JszChainMap.__delitem__c Cs0y|jdjStk r*tdYnXdS)zPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.rz#No keys found in the first mapping.N)rpopitemr)rRrrrrPszChainMap.popitemc Gs>y|jdj|f|Stk r8tdj|YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].rz(Key not found in the first mapping: {!r}N)rpoprr)rRrKrrrrrWsz ChainMap.popcCs|jdjdS)z'Clear maps[0], leaving maps[1:] intact.rN)rclear)rRrrrr^szChainMap.clear)N)r4r5r6rUrTrrrHrrrrrr classmethodrr__copy__rpropertyrrrrrrrrrrrs(    r)cache_from_sourcecCs"|dkr d}|rd}nd}||S)NFcor)rXdebug_overridesuffixrrrres r) OrderedDict)r)KeysView ValuesView ItemsViewc@seZdZdZddZejfddZejfddZdd Zd d Z d d Z d6ddZ ddZ ddZ ddZddZddZddZddZeZeZefdd Zd7d"d#Zd8d$d%Zd&d'Zd(d)Zed9d*d+Zd,d-Zd.d/Zd0d1Zd2d3Z d4d5Z!d!S):rz)Dictionary that remembers insertion orderc Osnt|dkrtdt|y |jWn6tk r\g|_}||dg|dd<i|_YnX|j||dS)zInitialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. rz$expected at most 1 arguments, got %dN)rIr_OrderedDict__rootr_OrderedDict__map_OrderedDict__update)rRrkwdsrootrrrrTs    zOrderedDict.__init__cCsF||kr6|j}|d}|||g|d<|d<|j|<||||dS)z!od.__setitem__(i, y) <==> od[i]=yrrN)rr)rRrKrLZ dict_setitemrlastrrrrs  zOrderedDict.__setitem__cCs0||||jj|\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]rrN)rr)rRrKZ dict_delitem link_prev link_nextrrrrs zOrderedDict.__delitem__ccs2|j}|d}x||k r,|dV|d}qWdS)zod.__iter__() <==> iter(od)rr(N)r)rRrcurrrrrrs   zOrderedDict.__iter__ccs2|j}|d}x||k r,|dV|d}qWdS)z#od.__reversed__() <==> reversed(od)rr(N)r)rRrrrrr __reversed__s   zOrderedDict.__reversed__c CshyDx|jjD]}|dd=qW|j}||dg|dd<|jjWntk rXYnXtj|dS)z.od.clear() -> None. Remove all items from od.N)r itervaluesrrrr)rRZnoderrrrrszOrderedDict.clearTcCs||s td|j}|r8|d}|d}||d<||d<n |d}|d}||d<||d<|d}|j|=tj||}||fS)zod.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. zdictionary is emptyrrr()rrrrr)rRrrlinkrrrKrLrrrrs   zOrderedDict.popitemcCst|S)zod.keys() -> list of keys in od)r)rRrrrkeysszOrderedDict.keyscsfddDS)z#od.values() -> list of values in odcsg|] }|qSrr)rbrK)rRrrrfsz&OrderedDict.values..r)rRr)rRrvaluesszOrderedDict.valuescsfddDS)z.od.items() -> list of (key, value) pairs in odcsg|]}||fqSrr)rbrK)rRrrrfsz%OrderedDict.items..r)rRr)rRritemsszOrderedDict.itemscCst|S)z0od.iterkeys() -> an iterator over the keys in od)r)rRrrriterkeysszOrderedDict.iterkeysccsx|D]}||VqWdS)z2od.itervalues -> an iterator over the values in odNr)rRkrrrrs zOrderedDict.itervaluesccs x|D]}|||fVqWdS)z=od.iteritems -> an iterator over the (key, value) items in odNr)rRrrrr iteritemss zOrderedDict.iteritemscOst|dkr tdt|fn |s,td|d}f}t|dkrL|d}t|trrx^|D]}||||<q\WnDt|drx8|jD]}||||<qWnx|D]\}}|||<qWx|jD]\}}|||<qWdS)aod.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v r(z8update() takes at most 2 positional arguments (%d given)z,update() takes at least 1 argument (0 given)rrrN)rIrrrhasattrrr)rrrRotherrKrLrrrrQs&      zOrderedDict.updatecCs0||kr||}||=|S||jkr,t||S)zod.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. )_OrderedDict__markerr)rRrKrrrrrr!s zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rRrKrrrr setdefault.szOrderedDict.setdefaultc Cs^|si}t|tf}||kr"dSd||<z&|s>d|jjfSd|jj|jfS||=XdS)zod.__repr__() <==> repr(od)z...rz%s()z%s(%r)N)r _get_identrr4r)rRZ _repr_runningZcall_keyrrrr5szOrderedDict.__repr__cs\fddD}tj}xttD]}|j|dq*W|rPj|f|fSj|ffS)z%Return state information for picklingcsg|]}||gqSrr)rbr)rRrrrfEsz*OrderedDict.__reduce__..N)varsrrrr)rRrZ inst_dictrr)rRr __reduce__Cs zOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)r)rRrrrrMszOrderedDict.copycCs |}x|D] }|||<q W|S)zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). r)rrrLdrKrrrrQs  zOrderedDict.fromkeyscCs6t|tr*t|t|ko(|j|jkStj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. )rrrIrr__eq__)rRrrrrr \s  zOrderedDict.__eq__cCs ||k S)Nr)rRrrrr__ne__eszOrderedDict.__ne__cCst|S)z@od.viewkeys() -> a set-like object providing a view on od's keys)r)rRrrrviewkeysjszOrderedDict.viewkeyscCst|S)z an object providing a view on od's values)r)rRrrr viewvaluesnszOrderedDict.viewvaluescCst|S)zBod.viewitems() -> a set-like object providing a view on od's items)r)rRrrr viewitemsrszOrderedDict.viewitems)T)N)N)N)"r4r5r6rUrTrrrrrrrrrrrrrrQrobjectrrrrr rrrr rrrrrrrrrs:         r)BaseConfigurator valid_identz^[a-z_][a-z0-9_]*$cCstj|}|std|dS)Nz!Not a valid Python identifier: %rT) IDENTIFIERr,rG)rrrrrr|s  rc@s"eZdZdZddZdddZdS)ConvertingDictz A converting dictionary wrapper.cCsJtj||}|jj|}||k rF|||<t|tttfkrF||_||_ |S)N) rr configuratorconvertrrConvertingListConvertingTupleparentrK)rRrKrLrrrrrs   zConvertingDict.__getitem__NcCsLtj|||}|jj|}||k rH|||<t|tttfkrH||_||_ |S)N) rrHrrrrrrrrK)rRrKrrLrrrrrHs  zConvertingDict.get)N)r4r5r6rUrrHrrrrrs rcCsDtj|||}|jj|}||k r@t|tttfkr@||_||_ |S)N) rrrrrrrrrrK)rRrKrrLrrrrrs  rc@s"eZdZdZddZd ddZdS) rzA converting list wrapper.cCsJtj||}|jj|}||k rF|||<t|tttfkrF||_||_ |S)N) rrrrrrrrrrK)rRrKrLrrrrrs   zConvertingList.__getitem__rcCs<tj||}|jj|}||k r8t|tttfkr8||_|S)N) rrrrrrrrr)rRidxrLrrrrrs   zConvertingList.popN)r)r4r5r6rUrrrrrrrs rc@seZdZdZddZdS)rzA converting tuple wrapper.cCsBtj||}|jj|}||k r>t|tttfkr>||_||_ |S)N) tuplerrrrrrrrrK)rRrKrLrrrrrs   zConvertingTuple.__getitem__N)r4r5r6rUrrrrrrsrc@seZdZdZejdZejdZejdZejdZ ejdZ ddd Z e e Zd d Zd d ZddZddZddZddZddZdS)rzQ The configurator base class which defines some useful defaults. z%^(?P[a-z]+)://(?P.*)$z ^\s*(\w+)\s*z^\.\s*(\w+)\s*z^\[\s*(\w+)\s*\]\s*z^\d+$ ext_convert cfg_convert)rcZcfgcCst||_||j_dS)N)rconfigr)rRr!rrrrTs zBaseConfigurator.__init__c Cs|jd}|jd}y`|j|}xP|D]H}|d|7}yt||}Wq&tk rl|j|t||}Yq&Xq&W|Stk rtjdd\}}td||f}|||_ |_ |YnXdS)zl Resolve strings to objects using standard import and attribute syntax. r7rrNzCannot resolve %r: %s) r9rimporterrr ImportErrorrkr|rG __cause__ __traceback__) rRrrvZusedfoundrEetbvrrrresolves"      zBaseConfigurator.resolvecCs |j|S)z*Default converter for the ext:// protocol.)r*)rRrLrrrrszBaseConfigurator.ext_convertc Cs|}|jj|}|dkr&td|n||jd}|j|jd}x|r|jj|}|rp||jd}nd|jj|}|r|jd}|jj|s||}n2yt |}||}Wnt k r||}YnX|r||jd}qJtd||fqJW|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r) WORD_PATTERNr,rGendr!groups DOT_PATTERN INDEX_PATTERN DIGIT_PATTERNintr)rRrLrestrr rnrrrr s2       zBaseConfigurator.cfg_convertcCst|t r&t|tr&t|}||_nt|t rLt|trLt|}||_n|t|t rrt|trrt|}||_nVt|tr|j j |}|r|j }|d}|j j |d}|r|d}t||}||}|S)z Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. prefixNr)rrrrrrrr string_typesCONVERT_PATTERNr, groupdictvalue_convertersrHr)rRrLrr r4Z converterrrrrr)s*     zBaseConfigurator.convertcsrjd}t|s|j|}jdd}tfddD}|f|}|rnx |jD]\}}t|||qVW|S)z1Configure an object with a user-supplied factory.z()r7Ncs g|]}t|r||fqSr)r)rbr)r!rrrfLsz5BaseConfigurator.configure_custom..)rrr*rrsetattr)rRr!rZpropsrSrrvrLr)r!rconfigure_customEs    z!BaseConfigurator.configure_customcCst|trt|}|S)z0Utility function which converts lists to tuples.)rrr)rRrLrrras_tupleSs zBaseConfigurator.as_tupleN)r4r5r6rUr*r+r6r+r.r/r0r8 staticmethod __import__r"rTr*rr rr:r;rrrrrs      "r)r)rr)r)N)N)Z __future__rrWr*rkZsslr# version_inforZ basestringr5rrtypesrZ file_typeZ __builtin__builtinsZ ConfigParserZ configparserZ _backportrrr r r r Zurllibr rrrrrrrZurllib2rrrrrr r!r"r#r$ZhttplibZ xmlrpclibZQueueZqueuer%ZhtmlentitydefsZ raw_input itertoolsr&filterr'r1r)r/iostrr0Z urllib.parseZurllib.requestZ urllib.errorZ http.clientZclientZrequestZ xmlrpc.clientZ html.parserZ html.entitiesZentitiesinputr2r3rGrFrNrOrrVF_OKX_OKZzipfilerwr~rryZBaseZipExtFilerlrrr NameError collectionsrrrrgetfilesystemencodingrrtokenizercodecsrrr+rrZhtmlr?ZcgirrrreprlibrrZimprrZthreadrr Z dummy_threadZ_abcollrrrrZlogging.configrrIrrrrrrrrrrrs&      $,      ,0        2+A              [   b w  distlib/__pycache__/resources.cpython-36.opt-1.pyc000064400000025116152347724720016027 0ustar003 Pf*@sddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZejeZdaGdddeZGdd d eZGd d d eZGd d d eZGdddeZGdddeZedee jeiZyFy ddl Z!Wne"k r$ddl#Z!YnXeee!j$<eee!j%<[!Wne"e&fk rXYnXddZ'iZ(ddZ)e j*e+dZ,ddZ-dS))unicode_literalsN)DistlibException)cached_propertyget_cache_basepath_to_cache_dirCachecs.eZdZdfdd ZddZddZZS) ResourceCacheNcs0|dkrtjjttd}tt|j|dS)Nzresource-cache)ospathjoinrstrsuperr __init__)selfbase) __class__/usr/lib/python3.6/resources.pyrszResourceCache.__init__cCsdS)z Is the cache stale for the given resource? :param resource: The :class:`Resource` being cached. :param path: The path of the resource in the cache. :return: True if the cache is stale. Tr)rresourcer rrris_stale#s zResourceCache.is_stalec Cs|jj|\}}|dkr|}n~tjj|j|j||}tjj|}tjj|sXtj |tjj |sjd}n |j ||}|rt |d}|j |jWdQRX|S)z Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. NTwb)finderget_cache_infor r r rZ prefix_to_dirdirnameisdirmakedirsexistsropenwritebytes)rrprefixr resultrZstalefrrrget.s      zResourceCache.get)N)__name__ __module__ __qualname__rrr$ __classcell__rr)rrr s r c@seZdZddZdS) ResourceBasecCs||_||_dS)N)rname)rrr*rrrrIszResourceBase.__init__N)r%r&r'rrrrrr)Hsr)c@s@eZdZdZdZddZeddZeddZed d Z d S) Resourcez A class representing an in-package resource, such as a data file. This is not normally instantiated by user code, but rather by a :class:`ResourceFinder` which manages the resource. FcCs |jj|S)z Get the resource as a stream. This is not a property to make it obvious that it returns a new stream each time. )r get_stream)rrrr as_streamVszResource.as_streamcCstdkrtatj|S)N)cacher r$)rrrr file_path_szResource.file_pathcCs |jj|S)N)r get_bytes)rrrrr fszResource.bytescCs |jj|S)N)rget_size)rrrrsizejsz Resource.sizeN) r%r&r'__doc__ is_containerr-rr/r r2rrrrr+Ns   r+c@seZdZdZeddZdS)ResourceContainerTcCs |jj|S)N)r get_resources)rrrr resourcesrszResourceContainer.resourcesN)r%r&r'r4rr7rrrrr5osr5c@seZdZdZejjdrdZnd ZddZdd Z d d Z d d Z ddZ ddZ ddZddZddZddZddZeejjZddZdS)!ResourceFinderz4 Resource finder for file system resources. java.pyc.pyo.classcCs.||_t|dd|_tjjt|dd|_dS)N __loader____file__)modulegetattrloaderr r rr)rr@rrrrszResourceFinder.__init__cCs tjj|S)N)r r realpath)rr rrr _adjust_pathszResourceFinder._adjust_pathcCsBt|trd}nd}|j|}|jd|jtjj|}|j|S)N//r) isinstancer splitinsertrr r r rD)r resource_nameseppartsr"rrr _make_paths   zResourceFinder._make_pathcCs tjj|S)N)r r r)rr rrr_findszResourceFinder._findcCs d|jfS)N)r )rrrrrrszResourceFinder.get_cache_infocCsD|j|}|j|sd}n&|j|r0t||}n t||}||_|S)N)rMrN _is_directoryr5r+r )rrJr r"rrrfinds     zResourceFinder.findcCs t|jdS)Nrb)rr )rrrrrr,szResourceFinder.get_streamc Cs t|jd }|jSQRXdS)NrQ)rr read)rrr#rrrr0szResourceFinder.get_bytescCstjj|jS)N)r r getsize)rrrrrr1szResourceFinder.get_sizecs*fddtfddtj|jDS)Ncs|dko|jj S)N __pycache__)endswithskipped_extensions)r#)rrrallowedsz-ResourceFinder.get_resources..allowedcsg|]}|r|qSrr).0r#)rWrr sz0ResourceFinder.get_resources..)setr listdirr )rrr)rWrrr6s zResourceFinder.get_resourcescCs |j|jS)N)rOr )rrrrrr4szResourceFinder.is_containerccs|j|}|dk r|g}xn|r|jd}|V|jr|j}xH|jD]>}|sP|}ndj||g}|j|}|jrz|j|qB|VqBWqWdS)NrrF)rPpopr4r*r7r append)rrJrZtodoZrnamer*new_nameZchildrrriterators      zResourceFinder.iteratorN)r:r;r<)r:r;)r%r&r'r3sysplatform startswithrVrrDrMrNrrPr,r0r1r6r4 staticmethodr r rrOr_rrrrr8ws"    r8cs`eZdZdZfddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ Z S)ZipResourceFinderz6 Resource finder for resources in .zip files. csZtt|j||jj}dt||_t|jdr>|jj|_n t j ||_t |j|_ dS)Nr_files) rrdrrBarchivelen prefix_lenhasattrre zipimport_zip_directory_cachesortedindex)rr@rf)rrrrs   zZipResourceFinder.__init__cCs|S)Nr)rr rrrrDszZipResourceFinder._adjust_pathc Cs||jd}||jkrd}nX|r:|dtjkr:|tj}tj|j|}y|j|j|}Wntk rtd}YnX|stj d||j j ntj d||j j |S)NTrFz_find failed: %r %rz_find worked: %r %r) rhrer rKbisectrmrb IndexErrorloggerdebugrBr!)rr r"irrrrNs   zZipResourceFinder._findcCs&|jj}|jdt|d}||fS)Nr)rBrfr rg)rrr!r rrrrsz ZipResourceFinder.get_cache_infocCs|jj|jS)N)rBget_datar )rrrrrr0szZipResourceFinder.get_bytescCstj|j|S)N)ioBytesIOr0)rrrrrr,szZipResourceFinder.get_streamcCs|j|jd}|j|dS)N)r rhre)rrr rrrr1szZipResourceFinder.get_sizecCs|j|jd}|r,|dtjkr,|tj7}t|}t}tj|j|}xV|t|jkr|j|j|sjP|j||d}|j |j tjdd|d7}qJW|S)Nrrrn) r rhr rKrgrZrormrbaddrH)rrr Zplenr"rssrrrr6s  zZipResourceFinder.get_resourcesc Csj||jd}|r*|dtjkr*|tj7}tj|j|}y|j|j|}Wntk rdd}YnX|S)NrFrn)rhr rKrormrbrp)rr rsr"rrrrOs  zZipResourceFinder._is_directory)r%r&r'r3rrDrNrr0r,r1r6rOr(rr)rrrds rdcCs|tt|<dS)N)_finder_registrytype)rB finder_makerrrrregister_finder0sr}cCs|tkrt|}nv|tjkr$t|tj|}t|dd}|dkrJtdt|dd}tjt|}|dkrxtd|||}|t|<|S)z Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. __path__Nz8You cannot get a finder for a module, only for a packager=zUnable to locate finder for %r) _finder_cacher`modules __import__rArrzr$r{)packager"r@r rBr|rrrr6s      rZ __dummy__cCsRd}tj|tjj|}tjt|}|rNt}tj j |d|_ ||_ ||}|S)z Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. Nr?) pkgutilZ get_importerr`path_importer_cacher$rzr{ _dummy_moduler r r r>r=)r r"rBrr@rrrfinder_for_pathRs  r).Z __future__rroruZloggingr rZshutilr`typesrjr?rutilrrrrZ getLoggerr%rqr.r objectr)r+r5r8rdr{ zipimporterrz_frozen_importlib_externalZ_fi ImportError_frozen_importlibSourceFileLoader FileFinderAttributeErrorr}rr ModuleTyper rrrrrrsH   ,!ZN    distlib/__pycache__/metadata.cpython-36.opt-1.pyc000064400000064462152347724720015604 0ustar003 Pf@sdZddlmZddlZddlmZddlZddlZddlZddl m Z m Z ddl m Z mZmZddlmZdd lmZmZdd lmZmZejeZGd d d e ZGd dde ZGddde ZGddde ZdddgZdZ dZ!ej"dZ#ej"dZ$dGZ%dHZ&dIZ'dJZ(dKZ)dLZ*dMZ+e,Z-e-j.e%e-j.e&e-j.e(e-j.e*ej"d8Z/d9d:Z0d;d<Z1ddddd%ddd d!d"d#d+d,d$d&d'd-d/d0d5d1d2d*d)d(d.d3d4d6d7d=Z2dNZ3dOZ4dPZ5dQZ6dRZ7dSZ8dTZ9e:Z;ej"d>ZdDZ?dEZ@GdFdde:ZAdS)VzImplementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). )unicode_literalsN)message_from_file)DistlibException __version__)StringIO string_types text_type) interpret)extract_by_key get_extras) get_schemePEP440_VERSION_REc@seZdZdZdS)MetadataMissingErrorzA required metadata is missingN)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/metadata.pyrsrc@seZdZdZdS)MetadataConflictErrorz>Attempt to read or write metadata fields that are conflictual.N)rrrrrrrrr src@seZdZdZdS) MetadataUnrecognizedVersionErrorz Unknown metadata version number.N)rrrrrrrrr$src@seZdZdZdS)MetadataInvalidErrorzA metadata value is invalidN)rrrrrrrrr(srMetadataPKG_INFO_ENCODINGPKG_INFO_PREFERRED_VERSIONzutf-8z1.1z \|z Metadata-VersionNameVersionPlatformSummary DescriptionKeywords Home-pageAuthor Author-emailLicenseSupported-Platform Classifier Download-URL ObsoletesProvidesRequires MaintainerMaintainer-emailObsoletes-Dist Project-URL Provides-Dist Requires-DistRequires-PythonRequires-ExternalPrivate-Version Obsoleted-BySetup-Requires-Dist ExtensionProvides-Extraz"extra\s*==\s*("([^"]+)"|'([^']+)')cCs<|dkr tS|dkrtS|dkr$tS|dkr0tSt|dS)Nz1.0z1.1z1.2z2.0) _241_FIELDS _314_FIELDS _345_FIELDS _426_FIELDSr)versionrrr_version2fieldlistgsr?c Csdd}g}x.|jD]"\}}|gddfkr.q|j|qWddddg}xt|D]l}|tkrld|krl|jd|tkrd|kr|jd|tkrd|kr|jd|tkrNd|krN|jdqNWt|d kr|d St|d krtd d|ko||t }d|ko ||t }d|ko||t }t |t |t |d krFtd | rl| rl| rlt |krlt S|rvdS|rdSdS) z5Detect the best version depending on the fields used.cSsx|D]}||krdSqWdS)NTFr)keysmarkersmarkerrrr _has_markerus z"_best_version.._has_markerUNKNOWNNz1.0z1.1z1.2z2.0rrzUnknown metadata setz(You used incompatible 1.1/1.2/2.0 fields)itemsappendr:remover;r<r=lenr _314_MARKERS _345_MARKERS _426_MARKERSintr) fieldsrCr@keyvalueZpossible_versionsZis_1_1Zis_1_2Zis_2_0rrr _best_versionssB        rP)metadata_versionnamer>platformZsupported_platformsummary descriptionkeywords home_pageauthor author_email maintainermaintainer_emaillicense classifier download_urlobsoletes_dist provides_dist requires_distsetup_requires_distrequires_pythonrequires_externalrequiresprovides obsoletes project_urlZprivate_versionZ obsoleted_by extensionZprovides_extraz[^A-Za-z0-9.]+FcCs0|r$tjd|}tjd|jdd}d||fS)zhReturn the distribution name with version. If for_filename is true, return a filename-escaped form.- .z%s-%s) _FILESAFEsubreplace)rRr>Z for_filenamerrr_get_name_and_versions rpc@s eZdZdZd?ddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZd@ddZddZdd Zd!d"Zd#d$ZdAd%d&ZdBd'd(ZdCd)d*Zd+d,Zefd-d.ZdDd/d0ZdEd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!dS)FLegacyMetadataaaThe legacy metadata of a release. Supports versions 1.0, 1.1 and 1.2 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name NdefaultcCsz|||gjddkrtdi|_g|_d|_||_|dk rH|j|n.|dk r\|j|n|dk rv|j||j dS)Nz'path, fileobj and mapping are exclusive) count TypeError_fieldsZrequires_filesZ _dependenciesschemeread read_fileupdateset_metadata_version)selfpathfileobjmappingrwrrr__init__s   zLegacyMetadata.__init__cCst|j|jd<dS)NzMetadata-Version)rPrv)r|rrrr{sz#LegacyMetadata.set_metadata_versioncCs|jd||fdS)Nz%s: %s )write)r|r~rRrOrrr _write_field szLegacyMetadata._write_fieldcCs |j|S)N)get)r|rRrrr __getitem__szLegacyMetadata.__getitem__cCs |j||S)N)set)r|rRrOrrr __setitem__szLegacyMetadata.__setitem__c Cs8|j|}y |j|=Wntk r2t|YnXdS)N) _convert_namervKeyError)r|rR field_namerrr __delitem__s   zLegacyMetadata.__delitem__cCs||jkp|j||jkS)N)rvr)r|rRrrr __contains__s zLegacyMetadata.__contains__cCs(|tkr |S|jddj}tj||S)Nrj_) _ALL_FIELDSrolower _ATTR2FIELDr)r|rRrrrrszLegacyMetadata._convert_namecCs|tks|tkrgSdS)NrD) _LISTFIELDS_ELEMENTSFIELD)r|rRrrr_default_value%szLegacyMetadata._default_valuecCs&|jdkrtjd|Stjd|SdS)N1.01.1 )rr)rQ_LINE_PREFIX_PRE_1_2rn_LINE_PREFIX_1_2)r|rOrrr_remove_line_prefix*s  z"LegacyMetadata._remove_line_prefixcCs|tkr||St|dS)N)rAttributeError)r|rRrrr __getattr__0szLegacyMetadata.__getattr__FcCst|d|d|S)zhReturn the distribution name with version. If filesafe is true, return a filename-escaped form.rr)rp)r|Zfilesaferrr get_fullname;szLegacyMetadata.get_fullnamecCs|j|}|tkS)z+return True if name is a valid metadata key)rr)r|rRrrris_fieldAs zLegacyMetadata.is_fieldcCs|j|}|tkS)N)rr)r|rRrrris_multi_fieldFs zLegacyMetadata.is_multi_fieldc Cs.tj|ddd}z|j|Wd|jXdS)z*Read the metadata values from a file path.rzutf-8)encodingN)codecsopenryclose)r|filepathfprrrrxJszLegacyMetadata.readcCst|}|d|jd<xxtD]p}||kr*q|tkrh|j|}|tkrZ|dk rZdd|D}|j||q||}|dk r|dkr|j||qW|jdS)z,Read the metadata values from a file object.zmetadata-versionzMetadata-VersionNcSsg|]}t|jdqS),)tuplesplit).0rOrrr _sz,LegacyMetadata.read_file..rD)rrvrrZget_all_LISTTUPLEFIELDSrr{)r|ZfileobmsgfieldvaluesrOrrrryRs  zLegacyMetadata.read_filec Cs0tj|ddd}z|j||Wd|jXdS)z&Write the metadata fields to filepath.wzutf-8)rN)rr write_filer)r|r skip_unknownrrrrrhszLegacyMetadata.writecCs|jxt|dD]}|j|}|r:|dgdgfkr:q|tkrX|j||dj|q|tkr|dkr|jd kr|jdd}n |jdd }|g}|t krd d |D}x|D]}|j|||qWqWd S)z0Write the PKG-INFO format data to a file object.zMetadata-VersionrDrr!1.01.1rz z |cSsg|]}dj|qS)r)join)rrOrrrrsz-LegacyMetadata.write_file..N)rr) r{r?rrrrrrQror)r|Z fileobjectrrrrOrrrrps$    zLegacyMetadata.write_filec sfdd}|snHt|dr>x<|jD]}||||q&Wnx|D]\}}|||qDW|r~x|jD]\}}|||qhWdS)aSet metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. cs"|tkr|rjj||dS)N)rrr)rNrO)r|rr_sets z#LegacyMetadata.update.._setr@N)hasattrr@rE)r|otherkwargsrkvr)r|rrzs  zLegacyMetadata.updatecCsn|j|}|tks|dkrPt|ttf rPt|trJdd|jdD}q~g}n.|tkr~t|ttf r~t|trz|g}ng}tj t j rB|d}t |j }|tkr|dk rx|D](}|j|jddstjd |||qWn`|tko|dk r|j|sBtjd |||n0|tkrB|dk rB|j|sBtjd ||||tkr`|d kr`|j|}||j|<dS) z"Control then set a metadata field.rcSsg|] }|jqSr)strip)rrrrrrsz&LegacyMetadata.set..rrN;rz$'%s': '%s' is not valid (field '%s')z.'%s': '%s' is not a valid version (field '%s')r!)rr isinstancelistrrrrloggerZ isEnabledForloggingZWARNINGr rw_PREDICATE_FIELDSis_valid_matcherwarning_VERSIONS_FIELDSis_valid_constraint_list_VERSION_FIELDSis_valid_version_UNICODEFIELDSrrv)r|rRrOZ project_namerwrrrrrs@            zLegacyMetadata.setcCs|j|}||jkr*|tkr&|j|}|S|tkr@|j|}|S|tkr|j|}|dkr^gSg}x6|D].}|tkr|j|qh|j|d|dfqhW|S|tkr|j|}t |t r|j dS|j|S)zGet a metadata field.Nrrr) rrv_MISSINGrrrrrFrrrr)r|rRrrrOresvalrrrrs.          zLegacyMetadata.getc s |jgg}}xd D]}||kr|j|qW|rT|gkrTddj|}t|xdD]}||krZ|j|qZW|ddkr||fSt|jfd d }xdt|ftjft j ffD]F\}}x<|D]4} |j | d } | d k o||  r|jd | | fqWqW||fS)zkCheck if the metadata is compliant. If strict is True then raise if no Name or Version are providedrrzmissing required metadata: %sz, Home-pager$zMetadata-Versionz1.2cs*x$|D]}j|jddsdSqWdS)NrrFT)rr)rOr)rwrrare_valid_constraintss z3LegacyMetadata.check..are_valid_constraintsNzWrong value for '%s': %s)rr)rr$) r{rFrrr rwrrrrrr) r|strictmissingwarningsattrrrrMZ controllerrrOr)rwrchecks2         zLegacyMetadata.checkcCs|jdB}i}x,|D]$\}}| s.||jkr||||<qW|ddkrdK}x|D]F\}}| sn||jkrV|d&kr||||<qVd,d-||D||<qVWnF|dd.krdO}x2|D]*\}}| s||jkr||||<qW|S)PzReturn fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). rQMetadata-VersionrRrr>rrTr rW Home-pagerXr$rY Author-emailr\r&rUr!rVr"rSr classifiersr(r^ Download-URLz1.2ra Requires-DistrcRequires-PythonrdRequires-Externalr` Provides-Distr_Obsoletes-Distrh Project-URLrZr-r[Maintainer-emailcSsg|]}dj|qS)r)r)rurrrrGsz)LegacyMetadata.todict..z1.1rfr+rer,rgr*rQrrRrr>rrTr rWrrXr$rYrr\r&rUr!rVr"rSrrr(r^r) rrrrrrrrrrrrrrarrcrrdrr`rr_rrhrrZr-r[r)rrrrrrrrrfr+rer,rgr*)rrr)r{rv)r|Z skip_missingZ mapping_1_0datarNrZ mapping_1_2Z mapping_1_1rrrtodictsP zLegacyMetadata.todictcCs<|ddkr(xdD]}||kr||=qW|d|7<dS)NzMetadata-Versionz1.1r*r,r+z Requires-Dist)r*r,r+r)r| requirementsrrrradd_requirementsUs    zLegacyMetadata.add_requirementscCstt|dS)NzMetadata-Version)rr?)r|rrrr@`szLegacyMetadata.keysccsx|jD] }|Vq WdS)N)r@)r|rNrrr__iter__cszLegacyMetadata.__iter__csfddjDS)Ncsg|] }|qSrr)rrN)r|rrrhsz)LegacyMetadata.values..)r@)r|r)r|rrgszLegacyMetadata.valuescsfddjDS)Ncsg|]}||fqSrr)rrN)r|rrrksz(LegacyMetadata.items..)r@)r|r)r|rrEjszLegacyMetadata.itemscCsd|jj|j|jfS)Nz <%s %s %s>) __class__rrRr>)r|rrr__repr__ms zLegacyMetadata.__repr__)NNNrr)F)F)F)N)F)F)"rrrrrr{rrrrrrrrrrrrrxryrrrzrrrrrrr@rrrErrrrrrqs>      ,  , ; rqz pydist.jsonz metadata.jsonc@seZdZdZejdZejdejZe Z ejdZ dZ de ZffdIdZd Zd ZeffedJfe dKfe dLfd ZdMZdNddZedOZdefZdefZdefdefeeedefeeeedefdPdQd Z[[dd ZdRd!d"Zd#d$Zed%d&Z ed'd(Z!e!j"d)d(Z!dSd*d+Z#ed,d-Z$ed.d/Z%e%j"d0d/Z%d1d2Z&d3d4Z'd5d6Z(d7d8Z)d9d:d;dZ*d?d@Z+dTdCdDZ,dEdFZ-dGdHZ.dS)Urz The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. z ^\d+(\.\d+)*$z!^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$z .{1,2047}z2.0z distlib (%s)legacy)rRr>rTzqname version license summary description author author_email keywords platform home_page classifiers download_urlzwextras run_requires test_requires build_requires dev_requires provides meta_requires obsoleted_by supports_environments)rQrRr>rT_legacy_datarwNrrcCs0|||gjddkrtdd|_d|_||_|dk rzy|j||||_Wn*tk rvt||d|_|jYnXnd}|rt |d}|j }WdQRXn |r|j }|dkr|j |j d|_ndt |ts|jd}ytj||_|j|j|Wn0tk r*tt||d|_|jYnXdS)Nrsz'path, fileobj and mapping are exclusive)rrwrb)rQ generatorzutf-8)r~rw)rtrurrrw_validate_mappingrrqvalidaterrxMETADATA_VERSION GENERATORrr decodejsonloads ValueErrorr)r|r}r~rrwrfrrrrs<       zMetadata.__init__rRr>r\rVrTz Requires-DistzSetup-Requires-DistzProvides-Extrar( Download-URLMetadata-Version) run_requiresbuild_requires dev_requiresZ test_requires meta_requiresextrasmodules namespacesexportscommandsrZ source_urlrQc CsZtj|d}tj|d}||kr||\}}|jr^|dkrP|dkrHdn|}n |jj|}n|dkrjdn|}|d kr|jj||}nt}|}|jjd} | r |dkr| jd |}nR|dkr| jd } | r| j||}n.| jd } | s|jjd } | r | j||}||krV|}n:||kr4tj||}n"|jrJ|jj|}n |jj|}|S) N common_keys mapped_keysrrrrr extensionszpython.commandszpython.detailszpython.exports)rrrrr)object__getattribute__rrr) r|rNcommonmappedlkZmakerresultrOsentineldrrrrsF            zMetadata.__getattribute__cCsH||jkrD|j|\}}|p |j|krD|j|}|sDtd||fdS)Nz.'%s' is an invalid value for the '%s' property)SYNTAX_VALIDATORSrwmatchr)r|rNrOrwpattern exclusionsmrrr_validate_values  zMetadata._validate_valuecCs*|j||tj|d}tj|d}||kr||\}}|jrV|dkrJt||j|<nf|d krj||j|<nR|jjdi}|dkr||d <n2|dkr|jd i}|||<n|jd i}|||<nh||krtj|||nP|d krt|t r|j }|r|j }ng}|jr||j|<n ||j|<dS)Nrrrrrrrrzpython.commandszpython.detailszpython.exportsrV)rrrrr) r'rrrNotImplementedErrorr setdefault __setattr__rrrr)r|rNrOrrrrr!rrrr*s>               zMetadata.__setattr__cCst|j|jdS)NT)rprRr>)r|rrrname_and_version@szMetadata.name_and_versioncCsF|jr|jd}n|jjdg}d|j|jf}||krB|j||S)Nz Provides-Distrfz%s (%s))rrr)rRr>rF)r|rsrrrrfDs  zMetadata.providescCs |jr||jd<n ||jd<dS)Nz Provides-Distrf)rr)r|rOrrrrfOs c Cs|jr |}ng}t|pg|j}xl|D]d}d|kr@d|kr@d}n8d|krNd}n|jd|k}|rx|jd}|rxt||}|r&|j|dq&WxNd D]F}d|} | |kr|j| |jjd |g}|j|j|||d qW|S) a Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. :param env: An optional environment for marker evaluation. extra environmentTrebuilddevtestz:%s:z %s_requires)renv)r/r0r1) rr rrr extendrGrget_requirements) r|reqtsrr2rr!includerBrNerrrr4Vs0       zMetadata.get_requirementscCs|jr|jS|jS)N)r _from_legacyr)r|rrr dictionaryszMetadata.dictionarycCs|jr tnt|j|jSdS)N)rr(r rDEPENDENCY_KEYS)r|rrr dependenciesszMetadata.dependenciescCs|jr tn |jj|dS)N)rr(rrz)r|rOrrrr;sc Cs|jd|jkrtg}x0|jjD]"\}}||kr&||kr&|j|q&W|rfddj|}t|x"|jD]\}}|j|||qpWdS)NrQzMissing metadata items: %sz, ) rrrMANDATORY_KEYSrErFrrr') r|rrwrrNr%rrrrrrrszMetadata._validate_mappingcCsB|jr.|jjd\}}|s|r>tjd||n|j|j|jdS)NTz#Metadata: missing: %s, warnings: %s)rrrrrrrw)r|rrrrrrs  zMetadata.validatecCs(|jr|jjdSt|j|j}|SdS)NT)rrr r INDEX_KEYS)r|rrrrrs zMetadata.todictc Cs|j|jd}|jjd}x2dD]*}||kr |dkr:d }n|}||||<q W|jd g}|d gkrhg}||d <d}x2|D]*\}}||krz||rzd||ig||<qzW|j|d<i}i} |S)N)rQrTrRr>r\rTrUr]rr"rVrarrbrrerf)rRr>r\rTrUr]rarrbr)r?r@)rrrrrrf) r|rZlmdrnkkwr@okrXrZrrrr8s.     zMetadata._from_legacyrrr&r r!)rRr>r\rTrUrcCsdd}t}|j}x*|jjD]\}}||kr ||||<q W||j|j}||j|j}|jrtt |j|d<t ||d<t ||d<|S)NcSst}x|D]}|jd}|jd}|d}xb|D]Z}| rN| rN|j|q2d}|r^d|}|rx|rtd||f}n|}|jdj||fq2Wq W|S)Nr-r.rer>z extra == "%s"z (%s) and %sr)rraddr)Zentriesr5r7r-r2ZrlistrrBrrrprocess_entriess"      z,Metadata._to_legacy..process_entrieszProvides-Extraz Requires-DistzSetup-Requires-Dist) rqrLEGACY_MAPPINGrErrrrrsorted)r|rErZnmdrArCZr1Zr2rrr _to_legacys  zMetadata._to_legacyFTcCs||gjddkrtd|j|r`|jr4|j}n|j}|rP|j||dq|j||dn^|jrp|j}n|j}|rt j ||ddddn.t j |dd}t j ||ddddWdQRXdS) Nrz)Exactly one of path and fileobj is needed)rTrs)Z ensure_asciiindentZ sort_keysrzutf-8) rtr rrrHrrr8rrdumprr)r|r}r~rrZ legacy_mdr!r rrrrs&    zMetadata.writecCs|jr|jj|nt|jjdg}d}x"|D]}d|kr,d|kr,|}Pq,W|dkrhd|i}|jd|n t|dt|B}t||d<dS)Nrr.r-rer)rrrr)insertrrG)r|rralwaysentryZrsetrrrrs zMetadata.add_requirementscCs*|jpd}|jpd}d|jj|j||fS)Nz (no name)z no versionz<%s %s %s (%s)>)rRr>rrrQ)r|rRr>rrrr(s  zMetadata.__repr__)r)r)r)r)rrrw)NNNrr)rRr>r\rVrT)r N)r N)N)NN)NNFT)/rrrrrecompileZMETADATA_VERSION_MATCHERIZ NAME_MATCHERrZVERSION_MATCHERZSUMMARY_MATCHERrrrr<r=r:r" __slots__rrrrZ none_listdictZ none_dictrrr'r*propertyr+rfsetterr4r9r;rrrr8rFrHrrrrrrrrvsx    ,+ '   *   % ) rrrrr r!r"r#r$r%r&)rrrrr'r r!r"r#r$r%r&r(r)r*r+r,)r*r+r,r(r))rrrrr'r r!r"r#r$r%r-r.r&r(r)r/r0r1r2r3r4)r1r2r3r/r4r-r.r0)rrrrr'r r!r"r#r$r%r-r.r&r(r)r/r0r1r2r3r4r5r6r7r8r9)r5r9r6r7r8)r2r/r1)r3)r)rr(r*r,r+r/r1r2r4r0r'r7r9r8)r0)r")r$r-r r!)F)BrZ __future__rrZemailrrrrNr>rrcompatrrr rAr utilr r r>r rZ getLoggerrrrrrr__all__rrrOrrr:r;rIr<rJr=rKrrrzZEXTRA_REr?rPrrrrrrrrrrrmrprqZMETADATA_FILENAMEZWHEEL_METADATA_FILENAMErrrrr s             9   distlib/__pycache__/__init__.cpython-36.pyc000064400000001703152347724720014611 0ustar003 PfE @snddlZdZGdddeZyddlmZWn&ek rRGdddejZYnXejeZ e j edS)Nz0.2.4c@s eZdZdS)DistlibExceptionN)__name__ __module__ __qualname__rr/usr/lib/python3.6/__init__.pyr sr) NullHandlerc@s$eZdZddZddZddZdS)rcCsdS)Nr)selfrecordrrrhandleszNullHandler.handlecCsdS)Nr)r r rrremitszNullHandler.emitcCs d|_dS)N)lock)r rrr createLockszNullHandler.createLockN)rrrr r rrrrrrsr) Zlogging __version__ Exceptionrr ImportErrorZHandlerZ getLoggerrZloggerZ addHandlerrrrrs distlib/__pycache__/index.cpython-36.opt-1.pyc000064400000041620152347724720015122 0ustar003 Pf]R @sddlZddlZddlZddlZddlZddlZyddlmZWn ek r`ddl mZYnXddl m Z ddl m Z mZmZmZmZmZddlmZmZmZejeZdZdZGd d d eZdS) N)Thread)DistlibException)HTTPBasicAuthHandlerRequestHTTPPasswordMgrurlparse build_opener string_types)cached_propertyzip_dir ServerProxyzhttps://pypi.python.org/pypipypic@seZdZdZdZd*ddZddZdd Zd d Zd d Z ddZ ddZ d+ddZ d,ddZ d-ddZd.ddZddZd/ddZd0d d!Zd1d"d#Zd$d%Zd&d'Zd2d(d)ZdS)3 PackageIndexzc This class represents a package index compatible with PyPI, the Python Package Index. s.----------ThIs_Is_tHe_distlib_index_bouNdaRY_$Nc Cs|pt|_|jt|j\}}}}}}|s<|s<|s<|d krJtd|jd|_d|_d|_d|_d|_ t t j dR}xJd D]B} y(t j| dg||d } | d kr| |_PWq|tk rYq|Xq|WWdQRXdS) z Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. httphttpszinvalid repository: %sNwgpggpg2z --version)stdoutstderrr)rr)rr) DEFAULT_INDEXurlread_configurationrrpassword_handler ssl_verifierrgpg_home rpc_proxyopenosdevnull subprocessZ check_callOSError) selfrschemenetlocpathZparamsZqueryZfragZsinksrcr)/usr/lib/python3.6/index.py__init__$s(   zPackageIndex.__init__cCs&ddlm}ddlm}|}||S)zs Get the distutils command for interacting with PyPI configurations. :return: the command. r) Distribution) PyPIRCCommand)Zdistutils.corer,Zdistutils.configr-)r#r,r-dr)r)r*_get_pypirc_commandBs  z PackageIndex._get_pypirc_commandcCsR|j}|j|_|j}|jd|_|jd|_|jdd|_|jd|j|_dS)z Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. usernamepasswordrealmr repositoryN)r/rr3Z _read_pypircgetr0r1r2)r#cZcfgr)r)r*rLs  zPackageIndex.read_configurationcCs$|j|j}|j|j|jdS)z Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. N)check_credentialsr/Z _store_pypircr0r1)r#r5r)r)r*save_configuration[szPackageIndex.save_configurationcCs\|jdks|jdkrtdt}t|j\}}}}}}|j|j||j|jt||_ dS)zp Check that ``username`` and ``password`` have been set, and raise an exception if not. Nz!username and password must be set) r0r1rrrrZ add_passwordr2rr)r#Zpm_r%r)r)r*r6gs zPackageIndex.check_credentialscCs\|j|j|j}d|d<|j|jg}|j|}d|d<|j|jg}|j|S)aq Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request. Zverifyz:actionZsubmit)r6validatetodictencode_requestitems send_request)r#metadatar.requestZresponser)r)r*registerss  zPackageIndex.registercCsJx<|j}|sP|jdj}|j|tjd||fqW|jdS)ar Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to. zutf-8z%s: %sN)readlinedecoderstripappendloggerdebugclose)r#namestreamZoutbufr'r)r)r*_readers  zPackageIndex._readercCs|jdddg}|dkr|j}|r.|jd|g|dk rF|jdddgtj}tjj|tjj|d }|jd d d |d ||gt j ddj|||fS)a Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. z --status-fd2z--no-ttyNz --homedirz--batchz--passphrase-fd0z.ascz --detach-signz--armorz --local-userz--outputz invoking: %s ) rrextendtempfileZmkdtemprr&joinbasenamerErF)r#filenamesigner sign_passwordkeystorecmdZtdZsfr)r)r*get_sign_commands zPackageIndex.get_sign_commandc Cstjtjd}|dk r tj|d<g}g}tj|f|}t|jd|j|fd}|jt|jd|j|fd}|j|dk r|jj ||jj |j |j |j |j ||fS)a Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit code, a list of lines read from the subprocess' ``stdout``, and a list of lines read from the subprocess' ``stderr``. )rrNstdinr)targetargsr)r!PIPEPopenrrJrstartrrXwriterGwaitrP returncode) r#rVZ input_datakwargsrrpZt1Zt2r)r)r* run_commands$     zPackageIndex.run_commandc CsD|j||||\}}|j||jd\}}} |dkr@td||S)aR Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The absolute pathname of the file where the signature is stored. zutf-8rz&sign command failed with error code %s)rWrcencoder) r#rRrSrTrUrVsig_filer(rrr)r)r* sign_files  zPackageIndex.sign_filesdistsourcecCs(|jtjj|s td||j|j}d} |rZ|jsJtj dn|j ||||} t |d} | j } WdQRXt j| j} t j| j} |jdd||| | ddtjj|| fg}| rt | d} | j }WdQRX|jd tjj| |ftjtjj| |j|j|}|j|S) a Upload a release file to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the file to be uploaded. :param filename: The pathname of the file to be uploaded. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param filetype: The type of the file being uploaded. This is the distutils command which produced that file, e.g. ``sdist`` or ``bdist_wheel``. :param pyversion: The version of Python which the release relates to. For code compatible with any Python, this would be ``source``, otherwise it would be e.g. ``3.2``. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The HTTP response received from PyPI upon submission of the request. z not found: %sNz)no signing program available - not signedrbZ file_upload1)z:actionZprotocol_versionfiletype pyversion md5_digest sha256_digestcontentZ gpg_signature)r6rr&existsrr9r:rrEZwarningrfrreadhashlibmd5 hexdigestZsha256updaterQrDshutilZrmtreedirnamer;r<r=)r#r>rRrSrTrkrlrUr.refZ file_datarmrnfilesZsig_datar?r)r)r* upload_files>       zPackageIndex.upload_filec Cs|jtjj|s td|tjj|d}tjj|sFtd||j|j|j }}t |j }d d|fd|fg}d||fg}|j ||} |j | S) a2 Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. znot a directory: %rz index.htmlz not found: %r:action doc_uploadrHversionro)r{r|)r6rr&isdirrrPrpr9rHr}r getvaluer;r=) r#r>Zdoc_dirfnrHr}Zzip_datafieldsryr?r)r)r*upload_documentation)s        z!PackageIndex.upload_documentationcCsT|jdddg}|dkr|j}|r.|jd|g|jd||gtjddj||S) a| Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. z --status-fdrKz--no-ttyNz --homedirz--verifyz invoking: %srM)rrrNrErFrP)r#signature_filename data_filenamerUrVr)r)r*get_verify_commandEszPackageIndex.get_verify_commandcCsH|jstd|j|||}|j|\}}}|dkr@td||dkS)a6 Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. z0verification unavailable because gpg unavailablerrz(verify command failed with error code %s)rr)rrrrc)r#rrrUrVr(rrr)r)r*verify_signature]szPackageIndex.verify_signaturecCsp|dkrd}tjdn6t|ttfr0|\}}nd}tt|}tjd|t|d}|jt |}z|j } d} d} d} d} d | krt | d } |r|| | | xP|j | }|sP| t |7} |j||r|j|| d7} |r|| | | qWWd|jXWdQRX| dkr4| | kr4td | | f|rl|j}||kr`td ||||ftjd |dS)a This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. NzNo digest specifiedrszDigest specified: %swbi rrzcontent-lengthzContent-Lengthz1retrieval incomplete: got only %d out of %d bytesz.%s digest mismatch for %s: expected %s, got %szDigest verified: %s)rErF isinstancelisttuplegetattrrrrr=rinfointrqlenr^rurGrrt)r#rdestfileZdigestZ reporthookZdigesterZhasherZdfpZsfpheadersZ blocksizesizerqZblocknumblockactualr)r)r* download_filevsV             zPackageIndex.download_filecCs:g}|jr|j|j|jr(|j|jt|}|j|S)z Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). )rrDrr r)r#ZreqZhandlersopenerr)r)r*r=s  zPackageIndex.send_requestcCsg}|j}xX|D]P\}}t|ttfs,|g}x2|D]*}|jd|d|jdd|jdfq2WqWx6|D].\}} } |jd|d|| fjdd| fqjW|jd|ddfdj|} d|} | tt| d} t |j | | S) a& Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. s--z)Content-Disposition: form-data; name="%s"zutf-8z8Content-Disposition: form-data; name="%s"; filename="%s"s smultipart/form-data; boundary=)z Content-typezContent-length) boundaryrrrrNrdrPstrrrr)r#rrypartsrkvaluesvkeyrRvalueZbodyZctrr)r)r*r;s2     zPackageIndex.encode_requestcCs>t|trd|i}|jdkr,t|jdd|_|jj||p:dS)NrHg@)Ztimeoutand)rr rr rsearch)r#Ztermsoperatorr)r)r*rs   zPackageIndex.search)N)N)N)N)NNrgrhN)N)N)NN)N)__name__ __module__ __qualname____doc__rr+r/rr7r6r@rJrWrcrfrzrrrrr=r;rr)r)r)r*rs*      #  8   M+r)rrZloggingrrvr!rOZ threadingr ImportErrorZdummy_threadingrcompatrrrrr r utilr r r Z getLoggerrrErZ DEFAULT_REALMobjectrr)r)r)r*s    distlib/__pycache__/locators.cpython-36.opt-1.pyc000064400000113116152347724720015641 0ustar003 PfE@s@ddlZddlmZddlZddlZddlZddlZddlZy ddlZWne k rdddl ZYnXddl Z ddl m Z ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.dd l/m0Z0m1Z1dd l2m3Z3m4Z4ej5e6Z7ej8d Z9ej8d ej:Z;ej8d ZGdddeZ?Gddde@ZAGdddeAZBGdddeAZCGddde@ZDGdddeAZEGdddeAZFGdd d eAZGGd!d"d"eAZHGd#d$d$eAZIeIeGeEd%d&d'd(d)ZJeJjKZKej8d*ZLGd+d,d,e@ZMdS).N)BytesIO)DistlibException)urljoinurlparse urlunparse url2pathname pathname2urlqueuequoteunescape string_types build_openerHTTPRedirectHandler text_typeRequest HTTPErrorURLError) DistributionDistributionPath make_dist)Metadata) cached_propertyparse_credentials ensure_slashsplit_filenameget_project_dataparse_requirementparse_name_and_version ServerProxynormalize_name) get_schemeUnsupportedVersionError)Wheel is_compatiblez^(\w+)=([a-f0-9]+)z;\s*charset\s*=\s*(.*)\s*$ztext/html|application/x(ht)?mlzhttps://pypi.python.org/pypicCs |dkr t}t|dd}|jS)z Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names. Ng@)timeout) DEFAULT_INDEXr list_packages)urlclientr*/usr/lib/python3.6/locators.pyget_all_distribution_names)s r,c@s$eZdZdZddZeZZZdS)RedirectHandlerzE A class to work around a bug in some Python 3.2.x releases. c Csd}xdD]}||kr ||}Pq W|dkr0dSt|}|jdkrpt|j|}t|drh|j||n|||<tj||||||S)Nlocationurireplace_header)r.r/)rschemerZ get_full_urlhasattrr1BaseRedirectHandlerhttp_error_302) selfreqfpcodemsgheadersZnewurlkeyZurlpartsr*r*r+r5=s   zRedirectHandler.http_error_302N)__name__ __module__ __qualname____doc__r5Zhttp_error_301Zhttp_error_303Zhttp_error_307r*r*r*r+r-4sr-c@seZdZdZd/Zd0Zd1Zd Zed2Zd3ddZ ddZ ddZ ddZ ddZ ddZee eZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd4d-d.Zd S)5LocatorzG A base class for locators - things that locate distributions. .tar.gz.tar.bz2.tar.zip.tgz.tbz.egg.exe.whl.pdfNdefaultcCs,i|_||_tt|_d|_tj|_dS)a^ Initialise an instance. :param scheme: Because locators look for most recent versions, they need to know the version scheme to use. This specifies the current PEP-recommended scheme - use ``'legacy'`` if you need to support existing distributions on PyPI. N) _cacher2rr-openermatcherr Queueerrors)r6r2r*r*r+__init__cs  zLocator.__init__c CsXg}xN|jjsRy|jjd}|j|Wn|jjk rDwYnX|jjqW|S)z8 Return any errors which have occurred. F)rQemptygetappendZEmpty task_done)r6resulter*r*r+ get_errorsvs  zLocator.get_errorscCs |jdS)z> Clear any errors which may have been logged. N)rY)r6r*r*r+ clear_errorsszLocator.clear_errorscCs|jjdS)N)rMclear)r6r*r*r+ clear_cacheszLocator.clear_cachecCs|jS)N)_scheme)r6r*r*r+ _get_schemeszLocator._get_schemecCs ||_dS)N)r])r6valuer*r*r+ _set_schemeszLocator._set_schemecCs tddS)a= For a given project, get a dictionary mapping available versions to Distribution instances. This should be implemented in subclasses. If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. z Please implement in the subclassN)NotImplementedError)r6namer*r*r+ _get_projects zLocator._get_projectcCs tddS)zJ Return all the distribution names known to this locator. z Please implement in the subclassN)ra)r6r*r*r+get_distribution_namesszLocator.get_distribution_namescCsL|jdkr|j|}n2||jkr,|j|}n|j|j|}||j|<|S)z For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top. N)rMrcrZ)r6rbrWr*r*r+ get_projects      zLocator.get_projectcCsPt|}tj|j}d}|jd}|r6tt||j}|jdkd|j k|||fS)zu Give an url a score which can be used to choose preferred URLs for a given project release. Tz.whlhttpszpypi.python.org) r posixpathbasenamepathendswithr$r# wheel_tagsr2netloc)r6r(trhZ compatibleZis_wheelr*r*r+ score_urls  zLocator.score_urlcCsR|}|rN|j|}|j|}||kr(|}||kr@tjd||ntjd|||S)a{ Choose one of two URLs where both are candidates for distribution archives for the same version of a distribution (for example, .tar.gz vs. zip). The current implementation favours https:// URLs over http://, archives from PyPI over those from other locations, wheel compatibility (if a wheel) and then the archive name. zNot replacing %r with %rzReplacing %r with %r)rnloggerdebug)r6url1url2rWs1s2r*r*r+ prefer_urls   zLocator.prefer_urlcCs t||S)zZ Attempt to split a filename in project name, version and Python version. )r)r6filename project_namer*r*r+rszLocator.split_filenamecCsdd}d}t|\}}}}} } | jjdr.same_projectNzegg=z %s: version hint in fragment: %rr/z.whlTr0z, cSs"g|]}djt|ddqS).N)joinlist).0vr*r*r+ sz8Locator.convert_url_to_download_info..)rbversionrvr(zpython-versionzinvalid path for wheel: %sz No match for project/version: %s)rbrrvr(zpython-versionz %s_digest)NNr)rlower startswithrorp HASHER_HASHmatchgroupsrjr#r$rkrbrrvrr|pyver Exceptionwarningdownloadable_extensionsrgrhlenr)r6r(rwrxrWr2rlriparamsqueryfragmalgodigestZorigpathwheelincluderXrvZextrmrbrrr*r*r+convert_url_to_download_infosf            z$Locator.convert_url_to_download_infocCs4d}x*dD]"}d|}||kr |||f}Pq W|S)z Get a digest from a dictionary by looking at keys of the form 'algo_digest'. Returns a 2-tuple (algo, digest) if found, else None. Currently looks only for SHA256, then MD5. Nsha256md5z %s_digest)rrr*)r6inforWrr<r*r*r+ _get_digest)s  zLocator._get_digestc Cs|jd}|jd}||kr,||}|j}nt|||jd}|j}|j||_}|d}||d|<|j|dkr|j|j||_|dj|t j |||_ |||<dS)z Update a result dictionary (the final result from _get_project) with a dictionary for a specific version, which typically holds information gleaned from a filename or URL for an archive for the distribution. rbr)r2r(digestsurlsN) popmetadatarr2rr source_urlru setdefaultsetaddlocator) r6rWrrbrdistmdrr(r*r*r+_update_version_data9s   zLocator._update_version_dataFc Csd}t|}|dkr td|t|j}|j|j|_}tjd|t|j |j |j }t |dkr8g}|j } x|D]|} | d krqzyJ|j| stjd|| n,|s| | j r|j| ntjd| |j Wqztk rtjd || YqzXqzWt |d krt||jd }|r8tjd ||d} || }|r|jrN|j|_|jdij| t|_i} |jdi} x&|jD]}|| kr~| || |<q~W| |_d|_|S)a Find the most recent distribution which matches the given requirement. :param requirement: A requirement of the form 'foo (1.0)' or perhaps 'foo (>= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be located. Otherwise, pre-release versions are not returned. :return: A :class:`Distribution` instance, or ``None`` if no such distribution could be located. NzNot a valid requirement: %rzmatcher: %s (%s)r{rrz%s did not match %rz%skipping pre-release version %s of %szerror matching %s with %rr)r<zsorted list: %s)rrr)rrr!r2rO requirementrorptyper=rerbrZ version_classrZ is_prereleaserUrrsortedr<ZextrasrTr download_urlsr)r6r prereleasesrWrr2rOversionsZslistZvclskrdZsdr(r*r*r+locatePsT            zLocator.locate)rBrCrDrErFrG)rHrIrJ)rK)rJ)rL)F)r=r>r?r@source_extensionsbinary_extensionsexcluded_extensionsrkrrRrYrZr\r^r`propertyr2rcrdrernrurrrrrr*r*r*r+rASs.   FrAcs0eZdZdZfddZddZddZZS)PyPIRPCLocatorz This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). c s*tt|jf|||_t|dd|_dS)z Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. g@)r%N)superrrRbase_urlrr))r6r(kwargs) __class__r*r+rRszPyPIRPCLocator.__init__cCst|jjS)zJ Return all the distribution names known to this locator. )rr)r')r6r*r*r+rdsz%PyPIRPCLocator.get_distribution_namesc Csiid}|jj|d}x|D]}|jj||}|jj||}t|jd}|d|_|d|_|jd|_ |jdg|_ |jd|_ t |}|r|d } | d |_ |j| |_||_|||<xB|D]:} | d } |j| } |d j|tj| | |d | <qWqW|S) N)rrT)r2rbrlicensekeywordssummaryrr(rr)r)Zpackage_releasesZ release_urlsZ release_datarr2rbrrTrrrrrrrrrrr) r6rbrWrrrdatarrrr(rr*r*r+rcs0           zPyPIRPCLocator._get_project)r=r>r?r@rRrdrc __classcell__r*r*)rr+rs rcs0eZdZdZfddZddZddZZS)PyPIJSONLocatorzw This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. c s tt|jf|t||_dS)N)rrrRrr)r6r(r)rr*r+rRszPyPIJSONLocator.__init__cCs tddS)zJ Return all the distribution names known to this locator. zNot available from this locatorN)ra)r6r*r*r+rdsz&PyPIJSONLocator.get_distribution_namescCsiid}t|jdt|}y|jj|}|jj}tj|}t |j d}|d}|d|_ |d|_ |j d|_|j dg|_|j d |_t|}||_|d } |||j <x`|d D]T} | d }|jj||j| |j|<|d j|j tj||j| |d |<qWx|d jD]\} } | |j kr:q"t |j d} |j | _ | | _ t| }||_||| <x\| D]T} | d }|jj||j| |j|<|d j| tj||j| |d |<qpWq"WWn@tk r}z"|jjt|tjd|WYdd}~XnX|S)N)rrz%s/json)r2rrbrrrrrr(rZreleaseszJSON fetch failed: %s) rrr rNopenreaddecodejsonloadsrr2rbrrTrrrrrrrrrrritemsrrQputrro exception)r6rbrWr(resprrrrrrrZinfosZomdodistrXr*r*r+rcsT               " zPyPIJSONLocator._get_project)r=r>r?r@rRrdrcrr*r*)rr+rs rc@s`eZdZdZejdejejBejBZ ejdejejBZ ddZ ejdejZ e ddZd S) Pagez4 This class represents a scraped HTML page. z (rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*))\s+)? href\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)) (\s+rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)))? z!]+)cCs4||_||_|_|jj|j}|r0|jd|_dS)zk Initialise an instance with the Unicode page contents and the URL they came from. rN)rrr(_basesearchgroup)r6rr(rr*r*r+rRs  z Page.__init__z[^a-z0-9$&+,/:;=?@.#%_\\|-]cCsdd}t}x|jj|jD]}|jd}|dpZ|dpZ|dpZ|dpZ|dpZ|d }|d pr|d pr|d }t|j|}t|}|jj d d|}|j ||fqWt |dddd}|S)z Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. cSs,t|\}}}}}}t||t||||fS)zTidy up an URL.)rrr )r(r2rlrirrrr*r*r+clean%s zPage.links..cleanr0Zrel1Zrel2Zrel3Zrel4Zrel5Zrel6rqrrZurl3cSsdt|jdS)Nz%%%2xr)ordr)rr*r*r+3szPage.links..cSs|dS)Nrr*)rmr*r*r+r7sT)r<reverse) r_hreffinditerr groupdictrrr _clean_resubrr)r6rrWrrrelr(r*r*r+linkss  z Page.linksN)r=r>r?r@recompileISXrrrRrrrr*r*r*r+rs rcseZdZdZejdddddZdfdd Zd d Zd d Z ddZ e j de j ZddZddZddZddZddZe j dZddZZS)SimpleScrapingLocatorz A locator which scrapes HTML pages to locate downloads for a distribution. This runs multiple threads to do the I/O; performance is at least as good as pip's PackageFinder, which works in an analogous fashion. cCstjttdjS)N)Zfileobj)gzipZGzipFilerrr)br*r*r+rEszSimpleScrapingLocator.cCs|S)Nr*)rr*r*r+rFs)ZdeflaterZnoneN c sftt|jf|t||_||_i|_t|_t j |_ t|_ d|_ ||_tj|_tj|_dS)a Initialise an instance. :param url: The root URL to use for scraping. :param timeout: The timeout, in seconds, to be applied to requests. This defaults to ``None`` (no timeout specified). :param num_workers: The number of worker threads you want to do I/O, This defaults to 10. :param kwargs: Passed to the superclass. FN)rrrRrrr% _page_cacher_seenr rP _to_fetch _bad_hostsskip_externals num_workers threadingRLock_lock_gplock)r6r(r%rr)rr*r+rRIs    zSimpleScrapingLocator.__init__cCsJg|_x>t|jD]0}tj|jd}|jd|j|jj|qWdS)z Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web pages). )targetTN) _threadsrangerrZThread_fetchZ setDaemonstartrU)r6irmr*r*r+_prepare_threadscs  z&SimpleScrapingLocator._prepare_threadscCs>x|jD]}|jjdqWx|jD] }|jq$Wg|_dS)zu Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. N)rrrr|)r6rmr*r*r+ _wait_threadsps    z#SimpleScrapingLocator._wait_threadscCsiid}|jx||_||_t|jdt|}|jj|jj|j z&t j d||j j ||j jWd|jX|`WdQRX|S)N)rrz%s/z Queueing %s)rrWrwrrr rr[rrrorprrr|r)r6rbrWr(r*r*r+rc}s      z"SimpleScrapingLocator._get_projectz<\b(linux-(i\d86|x86_64|arm\w+)|win(32|-amd64)|macosx-?\d+)\bcCs |jj|S)zD Does an URL refer to a platform-specific download? )platform_dependentr)r6r(r*r*r+_is_platform_dependentsz,SimpleScrapingLocator._is_platform_dependentc CsT|j|rd}n|j||j}tjd|||rP|j|j|j|WdQRX|S)a% See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value. Nzprocess_download: %s -> %s)rrrwrorprrrW)r6r(rr*r*r+_process_downloads z'SimpleScrapingLocator._process_downloadc Cst|\}}}}}}|j|j|j|jr2d}n~|jrL|j|j rLd}nd|j|js^d}nR|d krld}nD|dkrzd}n6|j|rd}n&|j ddd } | j d krd}nd }t j d |||||S)z Determine whether a link URL from a referring page and with a particular "rel" attribute should be queued for scraping. Fhomepagedownloadhttprfftp:rrZ localhostTz#should_queue: %s (%s) from %s -> %s)rr)rrfr) rrjrrrrrrrsplitrrorp) r6linkZreferrerrr2rlri_rWhostr*r*r+ _should_queues*     z#SimpleScrapingLocator._should_queuecCsx|jj}zyz|r|j|}|dkr(wx\|jD]R\}}||jkr0|jj||j| r0|j|||r0tj d|||jj |q0WWn2t k r}z|j j t |WYdd}~XnXWd|jjX|sPqWdS)z Get a URL to fetch from the work queue, get the HTML page, examine its links for download candidates and candidates for further scraping. This is a handy method to run in a thread. NzQueueing %s from %s)rrTget_pagerrrrrrorprrrQrrV)r6r(pagerrrXr*r*r+rs&     & zSimpleScrapingLocator._fetchcCsXt|\}}}}}}|dkr:tjjt|r:tt|d}||jkr`|j|}tj d||n|j ddd}d}||j krtj d||nt |d d id }zytj d ||j j||jd } tj d|| j} | jdd} tj| r| j} | j} | jd}|r"|j|}|| } d}tj| }|r@|jd}y| j|} Wn tk rn| jd} YnXt| | }||j| <Wntk r}z |jdkrtjd||WYdd}~Xnt k r}z2tjd|||j!|j j"|WdQRXWYdd}~Xn2t#k rB}ztjd||WYdd}~XnXWd||j|<X|S)a Get the HTML for an URL, possibly from an in-memory cache. XXX TODO Note: this cache is never actually cleared. It's assumed that the data won't get stale over the lifetime of a locator instance (not necessarily true for the default_locator). filez index.htmlzReturning %s from cache: %srrrNzSkipping %s due to bad host %szAccept-encodingZidentity)r;z Fetching %s)r%z Fetched %sz Content-Typer0zContent-Encodingzutf-8zlatin-1izFetch failed: %s: %s)$rosriisdirrrrrrorprrrrNrr%rrTHTML_CONTENT_TYPErZgeturlrdecodersCHARSETrrr UnicodeErrorrrr9rrrrr)r6r(r2rlrirrWrr7rr;Z content_typeZ final_urlrencodingdecoderrrXr*r*r+rsZ              &$ zSimpleScrapingLocator.get_pagez]*>([^<]+)r?r@zlibZ decompressrrRrrrcrrrrrrrrrr rdrr*r*)rr+r;s"   ; rcs8eZdZdZfddZddZddZdd ZZS) DirectoryLocatorz? This class locates distributions in a directory tree. c sN|jdd|_tt|jf|tjj|}tjj|sDt d|||_ dS)a Initialise an instance. :param path: The root of the directory tree to search. :param kwargs: Passed to the superclass constructor, except for: * recursive - if True (the default), subdirectories are recursed into. If False, only the top-level directory is searched, recursiveTzNot a directory: %rN) rrrr rRrriabspathrrbase_dir)r6rir)rr*r+rR5s    zDirectoryLocator.__init__cCs |j|jS)z Should a filename be considered as a candidate for a distribution archive? As well as the filename, the directory which contains it is provided, though not used by the current implementation. )rjr)r6rvparentr*r*r+should_includeFszDirectoryLocator.should_includec Csiid}xtj|jD]v\}}}xb|D]Z}|j||r(tjj||}tddttjj|dddf}|j ||}|r(|j ||q(W|j sPqW|S)N)rrrr0) rwalkrrrir|rr rrrr) r6rbrWrootdirsfilesfnr(rr*r*r+rcNs     zDirectoryLocator._get_projectc Cst}xtj|jD]x\}}}xd|D]\}|j||r$tjj||}tddttjj |dddf}|j |d}|r$|j |dq$W|j sPqW|S)zJ Return all the distribution names known to this locator. rr0Nrb) rrrrrrir|rr rrrr)r6rWrrrrr(rr*r*r+rd^s    z'DirectoryLocator.get_distribution_names) r=r>r?r@rRrrcrdrr*r*)rr+r 0s  r c@s eZdZdZddZddZdS) JSONLocatora This locator uses special extended metadata (not available on PyPI) and is the basis of performant dependency resolution in distlib. Other locators require archive downloads before dependencies can be determined! As you might imagine, that can be slow. cCs tddS)zJ Return all the distribution names known to this locator. zNot available from this locatorN)ra)r6r*r*r+rdxsz"JSONLocator.get_distribution_namescCsiid}t|}|rx|jdgD]}|ddks$|ddkrBq$t|d|d|jd d |jd }|j}|d |_d |kr|d rd|d f|_|jdi|_|jdi|_|||j <|dj |j t j |d q$W|S)N)rrrZptypeZsdistZ pyversionsourcerbrrzPlaceholder for summary)rr2r(rrZ requirementsexportsr) rrTrr2rrrZ dependenciesrrrrr)r6rbrWrrrrr*r*r+rc~s&    "zJSONLocator._get_projectN)r=r>r?r@rdrcr*r*r*r+rqsrcs(eZdZdZfddZddZZS)DistPathLocatorz This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. c stt|jf|||_dS)zs Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. N)rrrRdistpath)r6rr)rr*r+rRszDistPathLocator.__init__cCsP|jj|}|dkr iid}n,|j|d|jt|jgid|jtdgii}|S)N)rrrr)rZget_distributionrrr)r6rbrrWr*r*r+rcs  zDistPathLocator._get_project)r=r>r?r@rRrcrr*r*)rr+rs rcsReZdZdZfddZfddZddZeej j eZ dd Z d d Z Z S) AggregatingLocatorzI This class allows you to chain and/or merge a list of locators. cs*|jdd|_||_tt|jf|dS)a Initialise an instance. :param locators: The list of locators to search. :param kwargs: Passed to the superclass constructor, except for: * merge - if False (the default), the first successful search from any of the locators is returned. If True, the results from all locators are merged (this can be slow). mergeFN)rrlocatorsrrrR)r6rr)rr*r+rRs zAggregatingLocator.__init__cs*tt|jx|jD] }|jqWdS)N)rrr\r)r6r)rr*r+r\s zAggregatingLocator.clear_cachecCs ||_x|jD] }||_qWdS)N)r]rr2)r6r_rr*r*r+r`s zAggregatingLocator._set_schemec Csi}x|jD]}|j|}|r |jr|jdi}|jdi}|j||jd}|r|rx6|jD]*\}} ||kr||| O<qb| ||<qbW|jd} |r| r| j|q |jdkrd} n$d} x|D]}|jj|rd} PqW| r |}Pq W|S)NrrTF)rrerrTupdaterrOr) r6rbrWrrrrZdfrrZddfoundr*r*r+rcs8           zAggregatingLocator._get_projectc Cs@t}x4|jD]*}y||jO}Wqtk r6YqXqW|S)zJ Return all the distribution names known to this locator. )rrrdra)r6rWrr*r*r+rds  z)AggregatingLocator.get_distribution_names)r=r>r?r@rRr\r`rrAr2fgetrcrdrr*r*)rr+rs  ,rzhttps://pypi.python.org/simple/g@)r%legacy)r2z1(?P[\w-]+)\s*\(\s*(==\s*)?(?P[^)]+)\)$c@sLeZdZdZdddZddZddZd d Zd d Zd dZ dddZ dS)DependencyFinderz0 Locate dependencies for distributions. NcCs|pt|_t|jj|_dS)zf Initialise an instance, using the specified locator to locate distributions. N)default_locatorrr!r2)r6rr*r*r+rRs zDependencyFinder.__init__cCsvtjd||j}||j|<||j||jf<xD|jD]:}t|\}}tjd||||jj |t j ||fq4WdS)z Add a distribution to the finder. This will update internal information about who provides what. :param dist: The distribution to add. zadding distribution %szAdd to provided: %s, %s, %sN) rorpr< dists_by_namedistsrprovidesrprovidedrrr)r6rrbprr*r*r+add_distribution&s    z!DependencyFinder.add_distributioncCs|tjd||j}|j|=|j||jf=xN|jD]D}t|\}}tjd||||j|}|j ||f|s0|j|=q0WdS)z Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove. zremoving distribution %sz Remove from provided: %s, %s, %sN) rorpr<r&r'rr(rr)remove)r6rrbr*rsr*r*r+remove_distribution5s    z$DependencyFinder.remove_distributionc CsBy|jj|}Wn,tk r<|jd}|jj|}YnX|S)z Get a version matcher for a requirement. :param reqt: The requirement :type reqt: str :return: A version matcher (an instance of :class:`distlib.version.Matcher`). r)r2rOr"r)r6reqtrOrbr*r*r+ get_matcherGs  zDependencyFinder.get_matcherc Csv|j|}|j}t}|j}||krrxL||D]@\}}y|j|}Wntk r\d}YnX|r.|j|Pq.W|S)z Find the distributions which can fulfill a requirement. :param reqt: The requirement. :type reqt: str :return: A set of distribution which can fulfill the requirement. F)r0r<rr)rr"r) r6r/rOrbrWr)rproviderrr*r*r+find_providersWs   zDependencyFinder.find_providersc Cs|j|}t}x,|D]$}|j|}|j|js|j|qW|r^|jd||t|fd}nD|j||j|=x"|D]}|jj|tj|qvW|j |d}|S)a Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :param provider: The provider we are trying to replace with. :param other: The provider we're trying to replace. :param problems: If False is returned, this will contain what problems prevented replacement. This is currently a tuple of the literal string 'cantreplace', ``provider``, ``other`` and the set of requirements that ``provider`` couldn't fulfill. :return: True if we can replace ``other`` with ``provider``, else False. Z cantreplaceFT) reqtsrr0rrr frozensetr.rr+) r6r1otherproblemsZrlistZ unmatchedr-rOrWr*r*r+try_to_replaceos"         zDependencyFinder.try_to_replaceFcCsi|_i|_i|_i|_t|p g}d|krH|jd|tdddgO}t|trh|}}tj d|n4|j j ||d}}|dkrt d|tj d |d |_ t}t|g}t|g}x|r|j}|j} | |jkr|j|n"|j| } | |kr |j|| ||j|jB} |j} t} ||krbx2dD]*}d|}||kr4| t|d|O} q4W| | B| B}x>|D]4}|j|}|sNtj d||j j ||d}|dkr| r|j j |d d}|dkrtj d||jd|fn^|j|j}}||f|jkr|j||j||| krN||krN|j|tj d|jxZ|D]R}|j} | |jkr|jj|tj|n"|j| } | |krT|j|| |qTWqvWqWt|jj}x.|D]&}||k|_|jrtj d|jqWtj d|||fS)a Find a distribution and all distributions it depends on. :param requirement: The requirement specifying the distribution to find, or a Distribution instance. :param meta_extras: A list of meta extras such as :test:, :build: and so on. :param prereleases: If ``True``, allow pre-release versions to be returned - otherwise, don't return prereleases unless they're all that's available. Return a set of :class:`Distribution` instances and a set of problems. The distributions returned should be such that they have the :attr:`required` attribute set to ``True`` if they were from the ``requirement`` passed to ``find()``, and they have the :attr:`build_time_dependency` attribute set to ``True`` unless they are post-installation dependencies of the ``requirement``. The problems should be a tuple consisting of the string ``'unsatisfied'`` and the requirement which couldn't be satisfied by any distribution known to the locator. z:*:z:test:z:build:z:dev:zpassed %s as requirement)rNzUnable to locate %rz located %sTtestbuilddevz:%s:z %s_requireszNo providers found for %rzCannot satisfy %rZ unsatisfiedzAdding %s to install_distsz#%s is a build-time dependency only.zfind done for %s)r8r9r:)r)r'r&r3rr, isinstancerrorprrrZ requestedrr<r+r7Z run_requiresZ meta_requiresZbuild_requiresgetattrr2rrZname_and_versionrvaluesZbuild_time_dependency)r6rZ meta_extrasrrrr6ZtodoZ install_distsrbr5ZireqtsZsreqtsZereqtsr<rXZ all_reqtsrZ providersr1nrr*r'r*r*r+finds                                zDependencyFinder.find)N)NF) r=r>r?r@rRr+r.r0r2r7r?r*r*r*r+r$s (r$)N)NriorrZloggingrrgrr ImportErrorZdummy_threadingr r0rcompatrrrrr r r r r rrr4rrrrZdatabaserrrrrutilrrrrrrrrr rr!r"rr#r$Z getLoggerr=rorrrrrr&r,r-objectrArrrrr rrrr%rZNAME_VERSION_REr$r*r*r*r+sZ   D ,    ;0E:vA&[ distlib/__pycache__/version.cpython-36.pyc000064400000050714152347724720014545 0ustar003 Pf\ @sZdZddlZddlZddlmZddddd d d d gZejeZGd d d e Z Gddde Z Gddde Z ejdZddZeZGddde ZddZGddde Zejddfejddfejddfejddfejd d!fejd"d!fejd#d$fejd%d&fejd'd(fejd)d*ff Zejd+dfejd,dfejd-d$fejd#d$fejd.dffZejd/Zd0d1Zd2d3Zejd4ejZd5d5d6d5d7ddd8Zd9d:ZGd;dde ZGdd?Z!d@dAZ"GdBd d e Z#GdCd d e Z$GdDdEdEe Z%e%eeee%eedFdGe%e"e$edHZ&e&dIe&dJ<dKd Z'dS)Lz~ Implementation of a flexible versioning scheme providing support for PEP-440, setuptools-compatible and semantic versioning. N) string_typesNormalizedVersionNormalizedMatcher LegacyVersion LegacyMatcherSemanticVersionSemanticMatcherUnsupportedVersionError get_schemec@seZdZdZdS)r zThis is an unsupported version.N)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/version.pyr sc@sxeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZeddZdS)VersioncCs@|j|_}|j||_}t|ts,tt|dks=|<|>|!=|={2,3}|~=)?\s*([^\s,]+)$z ^\d+(\.\d+)*$cCs||kS)Nr)vcprrrWszMatcher.cCs||kS)Nr)r2r3r4rrrr5XscCs||kp||kS)Nr)r2r3r4rrrr5YscCs||kp||kS)Nr)r2r3r4rrrr5ZscCs||kS)Nr)r2r3r4rrrr5[scCs||kS)Nr)r2r3r4rrrr5\scCs||kp||kS)Nr)r2r3r4rrrr5^scCs||kS)Nr)r2r3r4rrrr5_s)<>z<=z>=z==z===z~=z!=c CsJ|jdkrtd|j|_}|jj|}|snsz$Matcher.__init__..,zInvalid %r in %rz~=rz.*==!=z#'.*' not allowed for %r constraintsTF)r=r>) version_class ValueErrorrrdist_rematchgroupsnamelowerkeysplitcomp_reendswithnum_reappendrr) rrmrDZclistZ constraintsr3opZvnprefixrrrrbs:           zMatcher.__init__cCszt|tr|j|}x`|jD]V\}}}|jj|}t|trFt||}|sbd||jjf}t |||||sdSqWdS)z Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. z%r not implemented for %sFT) rrr@r _operatorsgetgetattrr,r r)rversionoperator constraintrOfmsgrrrrCs      z Matcher.matchcCs6d}t|jdkr2|jdddkr2|jdd}|S)Nrr=====)rXrY)rr)rresultrrr exact_versions zMatcher.exact_versioncCs0t|t|ks|j|jkr,td||fdS)Nzcannot compare %s and %s)r rEr!)rr"rrrr#szMatcher._check_compatiblecCs"|j||j|jko |j|jkS)N)r#rGr)rr"rrrr$s zMatcher.__eq__cCs |j| S)N)r$)rr"rrrr%szMatcher.__ne__cCst|jt|jS)N)r*rGr)rrrrr+szMatcher.__hash__cCsd|jj|jfS)Nz%s(%r))r,r r)rrrrr-szMatcher.__repr__cCs|jS)N)r)rrrrr.szMatcher.__str__)r r rr@recompilerBrIrKrPrrCr0r[r#r$r%r+r-r.rrrrr1Ns*    % r1zk^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?(\.(post)(\d+))?(\.(dev)(\d+))?(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$c Cs|j}tj|}|s"td||j}tdd|djdD}x(t|dkrn|ddkrn|dd}qHW|ds~d}n t|d}|dd}|d d }|d d }|d }|dkrf}n|dt|df}|dkrf}n|dt|df}|dkr f}n|dt|df}|dkr.f}nLg} x>|jdD]0} | j rZdt| f} nd| f} | j | q>Wt| }|s| r|rd}nd}|sd}|sd}||||||fS)NzNot a valid version: %scss|]}t|VqdS)N)int)r:r2rrr sz_pep_440_key..r.r az_finalrl)NN)NN)NNrl)rhrl)ri)rj)rk) rPEP440_VERSION_RErCr rDrrHrr^isdigitrL) rrMrDZnumsZepochpreZpostdevZlocalrpartrrr _pep_440_keysT         rrc@s6eZdZdZddZedddddgZed d Zd S) raIA rational version. Good: 1.2 # equivalent to "1.2.0" 1.2.0 1.2a1 1.2.3a2 1.2.3b1 1.2.3c1 1.2.3.4 TODO: fill this out Bad: 1 # minimum two numbers 1.2a # release level must have a release serial 1.2.3b cCs<t|}tj|}|j}tdd|djdD|_|S)Ncss|]}t|VqdS)N)r^)r:r2rrrr_sz*NormalizedVersion.parse..rr`)_normalized_keyrmrCrDrrH_release_clause)rrrZrMrDrrrrs  zNormalizedVersion.parserhbr3rcrpcstfddjDS)Nc3s |]}|r|djkVqdS)rN) PREREL_TAGS)r:t)rrrr_sz2NormalizedVersion.is_prerelease..)anyr)rr)rrr/szNormalizedVersion.is_prereleaseN) r r rrrsetrwr0r/rrrrrs cCs>t|}t|}||krdS|j|s*dSt|}||dkS)NTFr`)str startswithr)xynrrr _match_prefix"s rc @sneZdZeZddddddddd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZdS)r_match_compatible _match_lt _match_gt _match_le _match_ge _match_eq_match_arbitrary _match_ne)z~=r6r7z<=z>=z==z===z!=cCsV|rd|ko|jd}n|jd o,|jd}|rN|jjddd}|j|}||fS)N+rrrlrlrl)rrrHr@)rrSrUrOZ strip_localrrrr _adjust_local<s zNormalizedMatcher._adjust_localcCsD|j|||\}}||krdS|j}djdd|D}t|| S)NFr`cSsg|] }t|qSr)r{)r:irrrr;Osz/NormalizedMatcher._match_lt..)rrtjoinr)rrSrUrOrelease_clausepfxrrrrJs zNormalizedMatcher._match_ltcCsD|j|||\}}||krdS|j}djdd|D}t|| S)NFr`cSsg|] }t|qSr)r{)r:rrrrr;Wsz/NormalizedMatcher._match_gt..)rrtrr)rrSrUrOrrrrrrRs zNormalizedMatcher._match_gtcCs|j|||\}}||kS)N)r)rrSrUrOrrrrZszNormalizedMatcher._match_lecCs|j|||\}}||kS)N)r)rrSrUrOrrrr^szNormalizedMatcher._match_gecCs.|j|||\}}|s ||k}n t||}|S)N)rr)rrSrUrOrZrrrrbs   zNormalizedMatcher._match_eqcCst|t|kS)N)r{)rrSrUrOrrrrjsz"NormalizedMatcher._match_arbitrarycCs0|j|||\}}|s ||k}n t|| }|S)N)rr)rrSrUrOrZrrrrms   zNormalizedMatcher._match_necCsf|j|||\}}||krdS||kr*dS|j}t|dkrH|dd}djdd|D}t||S)NTFrr`cSsg|] }t|qSr)r{)r:rrrrr;sz7NormalizedMatcher._match_compatible..rl)rrtrrr)rrSrUrOrrrrrrus  z#NormalizedMatcher._match_compatibleN)r r rrr@rPrrrrrrrrrrrrrr-s$z[.+-]$r8z^[.](\d)z0.\1z^[.-]z ^\((.*)\)$z\1z^v(ersion)?\s*(\d+)z\2z^r(ev)?\s*(\d+)z[.]{2,}r`z\b(alfa|apha)\balphaz\b(pre-alpha|prealpha)\bz pre.alphaz \(beta\)$betaz ^[:~._+-]+z [,*")([\]]z[~:+_ -]z\.$z (\d+(\.\d+)*)cCsZ|jj}xtD]\}}|j||}qW|s2d}tj|}|sJd}|}n|jdjd}dd|D}xt|dkr|j dqlWt|dkr||j d}n8dj dd|ddD||j d}|dd}dj d d|D}|j}|rxt D]\}}|j||}qW|s*|}nd |kr8d nd }|||}t |sVd}|S) z Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. z0.0.0rr`cSsg|] }t|qSr)r^)r:rrrrr;sz-_suggest_semantic_version..NcSsg|] }t|qSr)r{)r:rrrrr;scSsg|] }t|qSr)r{)r:rrrrr;srp-r)rrF _REPLACEMENTSsub_NUMERIC_PREFIXrCrDrHrrLendr_SUFFIX_REPLACEMENTS is_semver)rrZZpatreplrMrOsuffixseprrr_suggest_semantic_versions:   ,   rcCsly t||Stk r YnX|j}xdBD]\}}|j||}q0Wtjdd|}tjdd|}tjdd|}tjdd|}tjdd|}|jdr|d d!}tjd"d|}tjd#d$|}tjd%d&|}tjd'd|}tjd(d)|}tjd*d)|}tjd+d |}tjd,d-|}tjd.d&|}tjd/d0|}tjd1d2|}y t|Wntk rfd!}YnX|S)CaSuggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on observation of versions currently in use on PyPI. Given a dump of those version during PyCon 2009, 4287 of them: - 2312 (53.93%) match NormalizedVersion without change with the automatic suggestion - 3474 (81.04%) match when using this suggestion method @param s {str} An irrational version string. @returns A rational version string, or None, if couldn't determine one. -alpharh-betarurrrvr3-finalr8-pre-release.release-stablerr`rj .finalrkzpre$Zpre0zdev$Zdev0z([abc]|rc)[\-\.](\d+)$z\1\2z[\-\.](dev)[\-\.]?r?(\d+)$z.\1\2z[.~]?([abc])\.?z\1r2rNz\b0+(\d+)(?!\d)z (\d+[abc])$z\g<1>0z\.?(dev-r|dev\.r)\.?(\d+)$z.dev\2z-(a|b|c)(\d+)$z[\.\-](dev|devel)$z.dev0z(?![\.\-])dev$z(final|stable)$z\.?(r|-|-r)\.?(\d+)$z.post\2z\.?(dev|git|bzr)\.?(\d+)$z\.?(pre|preview|-c)(\d+)$zc\g<2>zp(\d+)$z.post\1rrhrrurrhrrurvr3rr8rr3rr8rr8rr8rr`rjr`rr8rr8rkr8)rrrrrrrrrrrrrrr)rsr rFreplacer\rr|)rZrsZorigrrrr_suggest_normalized_versionsH      rz([a-z]+|\d+|[\.-])r3zfinal-@)roZpreviewrrvrpr8r`cCs~dd}g}xh||D]\}|jdrh|dkrJx|rH|ddkrH|jq.Wx|rf|d dkrf|jqLW|j|qWt|S) NcSsxg}xdtj|jD]R}tj||}|rd|ddkoBdknrT|jd}nd|}|j|qW|jd|S)N0r9*z*final) _VERSION_PARTrHrF_VERSION_REPLACErQzfillrL)rrZr4rrr get_partsIs    z_legacy_key..get_partsrz*finalrz*final-Z00000000rlrl)r|poprLr)rrrZr4rrr _legacy_keyHs    rc@s eZdZddZeddZdS)rcCst|S)N)r)rrrrrrcszLegacyVersion.parsecCs:d}x0|jD]&}t|tr |jdr |dkr d}Pq W|S)NFrz*finalT)rrrr|)rrZr}rrrr/fs zLegacyVersion.is_prereleaseN)r r rrr0r/rrrrrbsc@s4eZdZeZeejZded<ej dZ ddZ dS)rrz~=z^(\d+(\.\d+)*)cCs`||kr dS|jjt|}|s2tjd||dS|jd}d|krV|jddd}t||S)NFzACannot compute compatible match for version %s and constraint %sTrr`r) numeric_rerCr{loggerZwarningrDrsplitr)rrSrUrOrMrrrrrys zLegacyMatcher._match_compatibleN) r r rrr@dictr1rPr\r]rrrrrrrqs   zN^(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+(\.[a-z0-9-]+)*)?(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$cCs tj|S)N) _SEMVER_RErC)rrrrrsrc Csndd}t|}|st||j}dd|ddD\}}}||dd||dd}}|||f||fS) NcSs8|dkr|f}n$|ddjd}tdd|D}|S)Nrr`cSs"g|]}|jr|jdn|qS)r)rnr)r:r4rrrr;sz5_semantic_key..make_tuple..)rHr)rZabsentrZrrrr make_tuples z!_semantic_key..make_tuplecSsg|] }t|qSr)r^)r:rrrrr;sz!_semantic_key..r|r)rr rD) rrrMrDmajorminorZpatchroZbuildrrr _semantic_keys rc@s eZdZddZeddZdS)rcCst|S)N)r)rrrrrrszSemanticVersion.parsecCs|jdddkS)Nrrr)r)rrrrr/szSemanticVersion.is_prereleaseN)r r rrr0r/rrrrrsc@seZdZeZdS)r N)r r rrr@rrrrr sc@s6eZdZd ddZddZddZdd Zd d ZdS) VersionSchemeNcCs||_||_||_dS)N)rGmatcher suggester)rrGrrrrrrszVersionScheme.__init__c Cs2y|jj|d}Wntk r,d}YnX|S)NTF)rr@r )rrrZrrris_valid_versions   zVersionScheme.is_valid_versionc Cs0y|j|d}Wntk r*d}YnX|S)NTF)rr )rrrZrrris_valid_matchers   zVersionScheme.is_valid_matchercCs|jd|S)z: Used for processing some metadata fields zdummy_name (%s))r)rrrrris_valid_constraint_listsz&VersionScheme.is_valid_constraint_listcCs|jdkrd}n |j|}|S)N)r)rrrZrrrsuggests  zVersionScheme.suggest)N)r r rrrrrrrrrrrs  rcCs|S)Nr)rrrrrr5sr5) normalizedlegacyZsemanticrdefaultcCs|tkrtd|t|S)Nzunknown scheme name: %r)_SCHEMESrA)rErrrr s )(rZloggingr\compatr__all__Z getLoggerr rrAr objectrr1r]rmrrrsrrrrrrrrIrrrrrrrrrr rrr rrrr sz  1k =$ W             .r $  distlib/__pycache__/database.cpython-36.pyc000064400000122116152347724720014620 0ustar003 Pf@sdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZdd lmZmZmZmZmZmZmZd d d d dgZ ej!e"Z#dZ$dZ%deddde$dfZ&dZ'Gddde(Z)Gddde(Z*Gdd d e(Z+Gdd d e+Z,Gdd d e,Z-Gdd d e,Z.e-Z/e.Z0Gddde(Z1d)d!d"Z2d#d$Z3d%d&Z4d'd(Z5dS)*zPEP 376 implementation.)unicode_literalsN)DistlibException resources)StringIO) get_schemeUnsupportedVersionError)MetadataMETADATA_FILENAMEWHEEL_METADATA_FILENAME)parse_requirementcached_propertyparse_name_and_version read_exports write_exports CSVReader CSVWriter DistributionBaseInstalledDistributionInstalledDistributionEggInfoDistributionDistributionPathzpydist-exports.jsonzpydist-commands.jsonZ INSTALLERRECORD REQUESTED RESOURCESSHAREDz .dist-infoc@s(eZdZdZddZddZddZdS) _CachezL A simple cache mapping names and .dist-info paths to distributions cCsi|_i|_d|_dS)zZ Initialise an instance. There is normally one for each DistributionPath. FN)namepath generated)selfr!/usr/lib/python3.6/database.py__init__0sz_Cache.__init__cCs|jj|jjd|_dS)zC Clear the cache, setting it to its initial state. FN)rclearrr)r r!r!r"r$8s  z _Cache.clearcCs2|j|jkr.||j|j<|jj|jgj|dS)z` Add a distribution to the cache. :param dist: The distribution to add. N)rr setdefaultkeyappend)r distr!r!r"add@s  z _Cache.addN)__name__ __module__ __qualname____doc__r#r$r)r!r!r!r"r,src@seZdZdZdddZddZdd ZeeeZd d Z d d Z ddZ e ddZ ddZddZdddZddZdddZdS)rzU Represents a set of distributions installed on a path (typically sys.path). NFcCsD|dkrtj}||_d|_||_t|_t|_d|_td|_ dS)a Create an instance from a path, optionally including legacy (distutils/ setuptools/distribute) distributions. :param path: The path to use, as a list of directories. If not specified, sys.path is used. :param include_egg: If True, this instance will look for and return legacy distributions as well as those based on PEP 376. NTdefault) sysr _include_dist _include_eggr_cache _cache_egg_cache_enabledr_scheme)r rZ include_eggr!r!r"r#Ns zDistributionPath.__init__cCs|jS)N)r4)r r!r!r"_get_cache_enabledbsz#DistributionPath._get_cache_enabledcCs ||_dS)N)r4)r valuer!r!r"_set_cache_enabledesz#DistributionPath._set_cache_enabledcCs|jj|jjdS)z, Clears the internal cache. N)r2r$r3)r r!r!r" clear_cachejs zDistributionPath.clear_cachec csTt}xF|jD]:}tj|}|dkr*q|jd}| s|j rDqt|j}x|D]}|j|}| sV|j|krvqV|jo|jt rt t g}x*|D] }t j ||} |j| } | rPqWqVtj| j} t| dd} WdQRXtjd|j|j|jt|j| |dVqV|jrV|jd rVtjd|j|j|jt|j|VqVWqWdS) zD Yield .dist-info and/or .egg(-info) distributions. Nlegacy)fileobjschemezFound %s)metadataenv .egg-info.egg)r@rA)setrrfinder_for_pathfindZ is_containersortedr0endswith DISTINFO_EXTr r posixpathjoin contextlibclosing as_streamr loggerdebugr)new_dist_classr1old_dist_class) r seenrfinderrZrsetentryZpossible_filenamesZmetadata_filenameZ metadata_pathZpydiststreamr>r!r!r"_yield_distributionsrs@            z%DistributionPath._yield_distributionscCst|jj }|jo|jj }|s"|rpx4|jD](}t|trH|jj|q,|jj|q,W|rdd|j_|rpd|j_dS)zk Scan the path for distributions and populate the cache with those that are found. TN)r2rr1r3rV isinstancerr))r Zgen_distZgen_eggr(r!r!r"_generate_caches  z DistributionPath._generate_cachecCs|jdd}dj||gtS)ao The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distribution name by replacing any runs of non- alphanumeric characters with a single ``'-'``. :type name: string :parameter version: is converted to a standard version string. Spaces become dots, and all other non-alphanumeric characters (except dots) become dashes, with runs of multiple dashes condensed to a single dash. :type version: string :returns: directory name :rtype: string-_)replacerIrG)clsrversionr!r!r"distinfo_dirnames z!DistributionPath.distinfo_dirnameccsj|js x^|jD] }|VqWnF|jx|jjjD] }|Vq6W|jrfx|jjjD] }|VqXWdS)a5 Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances N)r4rVrXr2rvaluesr1r3)r r(r!r!r"get_distributionss   z"DistributionPath.get_distributionscCsd}|j}|js6xj|jD]}|j|kr|}PqWnH|j||jjkr\|jj|d}n"|jr~||jjkr~|jj|d}|S)a= Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None`` Nr) lowerr4rVr&rXr2rr1r3)r rresultr(r!r!r"get_distributions   z!DistributionPath.get_distributionc csd}|dk rJy|jjd||f}Wn$tk rHtd||fYnXxd|jD]X}|j}xL|D]D}t|\}}|dkr||kr|VPqd||krd|j|rd|VPqdWqTWdS)a Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. :parameter version: a version specifier that indicates the version required, conforming to the format in ``PEP-345`` :type name: string :type version: string Nz%s (%s)zinvalid name or version: %r, %r)r5matcher ValueErrorrr`providesrmatch) r rr]rdr(providedpp_namep_verr!r!r"provides_distributions$  z&DistributionPath.provides_distributioncCs(|j|}|dkrtd||j|S)z5 Return the path to a resource file. Nzno distribution named %r found)rc LookupErrorget_resource_path)r r relative_pathr(r!r!r" get_file_paths  zDistributionPath.get_file_pathccs`xZ|jD]N}|j}||kr ||}|dk r@||krX||Vq x|jD] }|VqJWq WdS)z Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. N)r`exportsr_)r categoryrr(rSdvr!r!r"get_exported_entries"s z%DistributionPath.get_exported_entries)NF)N)N)r*r+r,r-r#r6r8propertyZ cache_enabledr9rVrX classmethodr^r`rcrlrprur!r!r!r"rJs  *  $ c@seZdZdZdZdZddZeddZeZ eddZ ed d Z d d Z ed dZ eddZeddZeddZeddZddZddZddZddZdS) rz A base class for distributions, whether installed or from indexes. Either way, it must have some metadata, so that's all that's needed for construction. FcCsL||_|j|_|jj|_|j|_d|_d|_d|_d|_t |_ i|_ dS)z Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. N) r>rrar&r]ZlocatordigestextrascontextrBZ download_urlsZdigests)r r>r!r!r"r#Gs zDistribution.__init__cCs|jjS)zH The source archive download URL for this distribution. )r> source_url)r r!r!r"r{XszDistribution.source_urlcCsd|j|jfS)zX A utility property which displays the name and version in parentheses. z%s (%s))rr])r r!r!r"name_and_versionaszDistribution.name_and_versioncCs.|jj}d|j|jf}||kr*|j||S)z A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. z%s (%s))r>rfrr]r')r Zplistsr!r!r"rfhs  zDistribution.providescCs8|j}tjd|jt||}t|j||j|jdS)Nz%Getting requirements from metadata %r)ryr?) r>rMrNZtodictgetattrrBZget_requirementsryrz)r Zreq_attrmdZreqtsr!r!r"_get_requirementsts   zDistribution._get_requirementscCs |jdS)N run_requires)r)r r!r!r"r{szDistribution.run_requirescCs |jdS)N meta_requires)r)r r!r!r"rszDistribution.meta_requirescCs |jdS)Nbuild_requires)r)r r!r!r"rszDistribution.build_requirescCs |jdS)N test_requires)r)r r!r!r"rszDistribution.test_requirescCs |jdS)N dev_requires)r)r r!r!r"rszDistribution.dev_requiresc Cst|}t|jj}y|j|j}Wn6tk rZtjd||j d}|j|}YnX|j }d}xJ|j D]@}t |\}} ||krqny|j | }PWqntk rYqnXqnW|S)z Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. z+could not read version %r - using name onlyrF)r rr>r=rd requirementrrMwarningsplitr&rfrrg) r reqrSr=rdrrbrirjrkr!r!r"matches_requirements*       z Distribution.matches_requirementcCs(|jrd|j}nd}d|j|j|fS)zC Return a textual representation of this instance, z [%s]r:z)r{rr])r suffixr!r!r"__repr__s zDistribution.__repr__cCs>t|t|k rd}n$|j|jko8|j|jko8|j|jk}|S)a< See if this distribution is the same as another. :param other: The distribution to compare with. To be equal to one another. distributions must have the same type, name, version and source_url. :return: True if it is the same, else False. F)typerr]r{)r otherrbr!r!r"__eq__s    zDistribution.__eq__cCst|jt|jt|jS)zH Compute hash in a way which matches the equality test. )hashrr]r{)r r!r!r"__hash__szDistribution.__hash__N)r*r+r,r-Zbuild_time_dependency requestedr#rvr{Z download_urlr|rfrrrrrrrrrrr!r!r!r"r5s$        " cs0eZdZdZdZdfdd ZdddZZS) rz] This is the base class for installed distributions (whether PEP 376 or legacy). Ncs tt|j|||_||_dS)a Initialise an instance. :param metadata: An instance of :class:`Metadata` which describes the distribution. This will normally have been initialised from a metadata file in the ``path``. :param path: The path of the ``.dist-info`` or ``.egg-info`` directory for the distribution. :param env: This is normally the :class:`DistributionPath` instance where this distribution was found. N)superrr#r dist_path)r r>rr?) __class__r!r"r#s z"BaseInstalledDistribution.__init__cCsd|dkr|j}|dkr"tj}d}ntt|}d|j}||j}tj|jdjd}d||fS)a Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and ``'sha512'``. If no hasher is specified, the ``hasher`` attribute of the :class:`InstalledDistribution` instance is used. If the hasher is determined to be ``None``, MD5 is used as the hashing algorithm. :returns: The hash of the data. If a hasher was explicitly specified, the returned hash will be prefixed with the specified hasher followed by '='. :rtype: str Nr:z%s==asciiz%s%s) hasherhashlibmd5r~rxbase64Zurlsafe_b64encoderstripdecode)r datarprefixrxr!r!r"get_hashs   z"BaseInstalledDistribution.get_hash)N)N)r*r+r,r-rr#r __classcell__r!r!)rr"rscseZdZdZdZd'fdd ZddZdd Zd d Ze d d Z ddZ ddZ ddZ ddZd(ddZddZe ddZd)ddZdd Zd!d"Zd#d$Zd%d&ZejZZS)*ra  Created with the *path* of the ``.dist-info`` directory provided to the constructor. It reads the metadata contained in ``pydist.json`` when it is instantiated., or uses a passed in Metadata instance (useful for when dry-run mode is being used). Zsha256Ncs0tj||_}|dkr(ddl}|j|rN|jrN||jjkrN|jj|j}nt|dkr|j t }|dkrr|j t }|dkr|j d}|dkrt dt |ft j|j}t|dd}WdQRXtt|j||||r|jr|jj|y|j d}Wn&tk r ddl}|jYnX|dk |_dS)NrZMETADATAzno %s found in %sr;)r<r=r)rrCrRpdbZ set_tracer4r2rr>rDr r rerJrKrLr rrr#r)AttributeErrorr)r rr>r?rRrrSrU)rr!r"r#s4      zInstalledDistribution.__init__cCsd|j|j|jfS)Nz#)rr]r)r r!r!r"r2szInstalledDistribution.__repr__cCsd|j|jfS)Nz%s %s)rr])r r!r!r"__str__6szInstalledDistribution.__str__c Csg}|jd}tj|j`}t|dJ}xB|D]:}ddtt|dD}||\}}} |j||| fq0WWdQRXWdQRX|S)a" Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). r)rUcSsg|]}dqS)Nr!).0ir!r!r" Hsz6InstalledDistribution._get_records..N)get_distinfo_resourcerJrKrLrrangelenr') r resultsrSrUZ record_readerrowmissingrchecksumsizer!r!r" _get_records9s   (z"InstalledDistribution._get_recordscCsi}|jt}|r|j}|S)a Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. )rEXPORTS_FILENAMEr)r rbrSr!r!r"rqPs  zInstalledDistribution.exportsc Cs8i}|jt}|r4tj|j}t|}WdQRX|S)z Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. N)rrrJrKrLr)r rbrSrUr!r!r"r^s  z"InstalledDistribution.read_exportsc Cs.|jt}t|d}t||WdQRXdS)a Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. wN)get_distinfo_fileropenr)r rqZrffr!r!r"rms  z#InstalledDistribution.write_exportscCsh|jd}tj|j:}t|d$}x|D]\}}||kr,|Sq,WWdQRXWdQRXtd|dS)aW NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be found. r)rUNz3no resource file with relative path %r is installed)rrJrKrLrKeyError)r rorSrUZresources_readerZrelativeZ destinationr!r!r"rnxs  z'InstalledDistribution.get_resource_pathccsx|jD] }|Vq WdS)z Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) N)r)r rbr!r!r"list_installed_filessz*InstalledDistribution.list_installed_filesFc Cs,tjj|d}tjj|j}|j|}tjj|d}|jd}tjd||rRdSt|}x|D]}tjj |s||j d rd} } n4dtjj |} t |d} |j | j} WdQRX|j|s|r|j|rtjj||}|j|| | fqbW|j|rtjj||}|j|ddfWdQRX|S) z Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. r:rz creating %sN.pyc.pyoz%drb)rr)osrrIdirname startswithrrMinforisdirrFgetsizerrreadrelpathZwriterow) r pathsrdry_runbaseZbase_under_prefix record_pathwriterr hash_valuerfpr!r!r"write_installed_filess.         z+InstalledDistribution.write_installed_filesc Csg}tjj|j}|jd}x|jD]\}}}tjj|sLtjj||}||krVq(tjj|sv|j|dddfq(tjj |r(t tjj |}|r||kr|j|d||fq(|r(d|kr|j ddd}nd }t |d 2} |j| j|} | |kr |j|d || fWd QRXq(W|S) a Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. rexistsTFr=rrNrr)rrrrrisabsrIrr'isfilestrrrrrr) r mismatchesrrrrrZ actual_sizerrZ actual_hashr!r!r"check_installed_filess.         z+InstalledDistribution.check_installed_filesc Csi}tjj|jd}tjj|rtj|ddd}|jj}WdQRXx@|D]8}|jdd\}}|dkr~|j |gj |qN|||<qNW|S) a A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any paths selected by the user at installation time (e.g. via command-line arguments). In the case of the 'namespace' key, this would be a list of absolute paths for the roots of namespace packages in this distribution. The first time this property is accessed, the relevant information is read from the SHARED file in the .dist-info directory. rrSzutf-8)encodingNrr namespace) rrrIrcodecsrr splitlinesrr%r')r rb shared_pathrlinesliner&r7r!r!r"shared_locationss   z&InstalledDistribution.shared_locationsc Cstjj|jd}tjd||r$dSg}x6dD].}||}tjj||r.|jd ||fq.Wx"|jd fD]}|jd |qnWtj |d d d}|j dj|WdQRX|S)aa Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is actually written. :return: The path of the file written to. rz creating %sNrlibheadersscriptsrz%s=%srz namespace=%srzutf-8)r )rrrrr) rrrIrMrrr'getrrwrite) r rrrrr&rnsrr!r!r"write_shared_locationss   z,InstalledDistribution.write_shared_locationscCsF|tkrtd||jftj|j}|dkr.set_name_and_version) rrr4r3r>rr] _get_metadatar)rrr#)r rr?rr>)rr!r"r#Ws   zEggInfoDistribution.__init__c s2d}ddfdd}|jdrtjj|rdtjj|dd}t|dd }tjj|dd }||}n`tj|}t|j d j d }t|dd }y|j d} | j d}Wnt k rd}YnXnX|jdrtjj|rtjj|d }||}tjj|d}t|dd }n t d||r.|j ||S)NcSsg}|j}x|D]}|j}|jdr6tjd|Pt|}|sPtjd|q|jr`tjd|jst|j|j qdj dd|jD}|jd|j |fqW|S) zCreate a list of dependencies from a requires.txt file. *data*: the contents of a setuptools-produced requires.txt file. [z.Unexpected line: quitting requirement scan: %rz#Not recognised as a requirement: %rz4extra requirements in requires.txt are not supportedz, css|]}d|VqdS)z%s%sNr!)rcr!r!r" szQEggInfoDistribution._get_metadata..parse_requires_data..z%s (%s)) rstriprrMrr ryZ constraintsr'rrI)rreqsrrrSZconsr!r!r"parse_requires_dataos&    z>EggInfoDistribution._get_metadata..parse_requires_datacsHg}y*tj|dd}|j}WdQRXWntk rBYnX|S)zCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. rSzutf-8N)rrrIOError)req_pathrr)rr!r"parse_requires_pathsz>EggInfoDistribution._get_metadata..parse_requires_pathz.eggzEGG-INFOzPKG-INFOr;)rr=z requires.txtzEGG-INFO/PKG-INFOutf8)r<r=zEGG-INFO/requires.txtzutf-8z .egg-infoz,path must end with .egg-info or .egg, got %r)rFrrrrIr zipimport zipimporterrget_datarrrZadd_requirements) r rrequiresr meta_pathr>rZzipfr<rr!)rr"rls:           z!EggInfoDistribution._get_metadatacCsd|j|j|jfS)Nz!)rr]r)r r!r!r"rszEggInfoDistribution.__repr__cCsd|j|jfS)Nz%s %s)rr])r r!r!r"rszEggInfoDistribution.__str__cCsdg}tjj|jd}tjj|r`x>|jD]2\}}}||kr>q*tjj|s*|j|dddfq*W|S)a Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. zinstalled-files.txtrTF)rrrIrrr')r rrrrZr!r!r"rs   z)EggInfoDistribution.check_installed_filesc Csdd}dd}tjj|jd}g}tjj|rtj|ddd|}xt|D]l}|j}tjjtjj|j|}tjj|stj d ||j d rqHtjj |sH|j |||||fqHWWd QRX|j |d d f|S)z Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) c Ss0t|d}z |j}Wd|jXtj|jS)Nr)rrcloserrZ hexdigest)rrZcontentr!r!r"_md5s    z6EggInfoDistribution.list_installed_files.._md5cSs tj|jS)N)rstatst_size)rr!r!r"_sizesz7EggInfoDistribution.list_installed_files.._sizezinstalled-files.txtrSzutf-8)rzNon-existent file: %s.pyc.pyoN)rr) rrrIrrrrnormpathrMrrFrr')r rrrrbrrrir!r!r"rs"      &z(EggInfoDistribution.list_installed_filesFc cstjj|jd}d}tj|dddd}x\|D]T}|j}|dkrFd}q,|s,tjjtjj|j|}|j|jr,|rz|Vq,|Vq,WWdQRXdS) a  Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed into a local absolute path. Otherwise the raw value from ``installed-files.txt`` is returned. :type absolute: boolean :returns: iterator of paths zinstalled-files.txtTrSzutf-8)rz./FN)rrrIrrrrr)r Zabsoluterskiprrrir!r!r"rs   z'EggInfoDistribution.list_distinfo_filescCst|to|j|jkS)N)rWrr)r rr!r!r"rs zEggInfoDistribution.__eq__)N)F)r*r+r,r-rrr#rrrrrrrrrrr!r!)rr"rNsK& c@s^eZdZdZddZddZdddZd d Zd d ZdddZ dddZ ddZ ddZ dS)DependencyGrapha Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions. cCsi|_i|_i|_dS)N)adjacency_list reverse_listr)r r!r!r"r#.szDependencyGraph.__init__cCsg|j|<g|j|<dS)zAdd the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` N)rr)r distributionr!r!r"add_distribution3s z DependencyGraph.add_distributionNcCs6|j|j||f||j|kr2|j|j|dS)aAdd an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type label: ``str`` or ``None`` N)rr'r)r xylabelr!r!r"add_edge=s zDependencyGraph.add_edgecCs&tjd|||jj|gj|dS)a Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str`` z %s missing %rN)rMrNrr%r')r rrr!r!r" add_missingLszDependencyGraph.add_missingcCsd|j|jfS)Nz%s %s)rr])r r(r!r!r" _repr_distWszDependencyGraph._repr_distrcCs|j|g}xv|j|D]h\}}|j|}|dk r>d||f}|jd|t||j||d}|jd}|j|ddqWdj|S)zPrints only a subgraphNz%s [%s]z rr)rrr'r repr_noderextendrI)r r(leveloutputrr Z suboutputZsubsr!r!r"rZs    zDependencyGraph.repr_nodeTcCsg}|jdx||jjD]n\}}t|dkr>| r>|j|xH|D]@\}}|dk rn|jd|j|j|fqD|jd|j|jfqDWqW| rt|dkr|jd|jd|jdx&|D]}|jd |j|jd qW|jd |jd dS) a9Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool`` zdigraph dependencies { rNz"%s" -> "%s" [label="%s"] z "%s" -> "%s" zsubgraph disconnected { zlabel = "Disconnected" zbgcolor = red z"%s"rz} )rritemsrr'r)r rZskip_disconnectedZ disconnectedr(adjsrr r!r!r"to_dotgs&        zDependencyGraph.to_dotcsg}i}x&|jjD]\}}|dd||<qWxgx4t|jddD]\}}|sLj|||=qLWsrPx*|jD]\}}fdd|D||<q|WtjdddD|jq2W|t|jfS)aa Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they have circular dependencies and so form a cycle. Ncs g|]\}}|kr||fqSr!r!)rrsrS) to_remover!r"rsz4DependencyGraph.topological_sort..zMoving to result: %scSsg|]}d|j|jfqS)z%s (%s))rr])rrsr!r!r"rs)rrlistr'rMrNrkeys)r rbZalistkrtr!)rr"topological_sorts$  z DependencyGraph.topological_sortcCs6g}x&|jjD]\}}|j|j|qWdj|S)zRepresentation of the graphr)rrr'rrI)r rr(rr!r!r"rszDependencyGraph.__repr__)N)r)T) r*r+r,r-r#r r rrrrrrr!r!r!r"rs   rr.cCsft|}t}i}xX|D]P}|j|x@|jD]6}t|\}}tjd||||j|gj||fq.WqWx|D]}|j |j B|j B|j B}x|D]} y|j | } Wn6tk rtjd| | jd}|j |} YnX| j}d} ||krJxV||D]J\}} y| j|} Wntk r,d} YnX| r|j|| | d} PqW| s|j|| qWqrW|S)a6Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance zAdd to provided: %s, %s, %sz+could not read version %r - using name onlyrFT)rrr rfrrMrNr%r'rrrrrdrrrr&rgr r)distsr=graphrhr(rirr]rrrdZmatchedZproviderrgr!r!r" make_graphsD         rcCs~||krtd|jt|}|g}|j|}x@|rn|j}|j|x$|j|D]}||krR|j|qRWq0W|jd|S)zRecursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested z1given distribution %r is not a member of the listr)rrrrpopr')rr(rZdeptodorsZsuccr!r!r"get_dependent_distss    r!cCsv||krtd|jt|}g}|j|}xD|rp|jd}|j|x$|j|D]}||krT|j|qTWq.W|S)zRecursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested z1given distribution %r is not a member of the listr)rrrrrr')rr(rrr rsZpredr!r!r"get_required_distss    r"cKs4|jdd}tf|}||_||_|p(d|_t|S)zO A convenience method for making a dist given just a name and version. summaryzPlaceholder for summary)rr rr]r#r)rr]kwargsr#rr!r!r" make_dists    r%)r.)6r-Z __future__rrrrJrZloggingrrHr/rr:rrcompatrr]rrr>r r r utilr r rrrrr__all__Z getLoggerr*rMrZCOMMANDS_FILENAMErrGrrrrrrrrOrPrrr!r"r%r!r!r!r"sV  $  l7GM 6distlib/__pycache__/scripts.cpython-36.pyc000064400000023415152347724720014545 0ustar003 Pfx;@sddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZejeZdjZejdZd Zd d ZGd d d eZdS))BytesION) sysconfigdetect_encodingZipFile)finder) FileOperatorget_export_entry convert_pathget_executablein_venva s^#!.*pythonw?[0-9.]*([ ].*)?$a|# -*- coding: utf-8 -*- if __name__ == '__main__': import sys, re def _resolve(module, func): __import__(module) mod = sys.modules[module] parts = func.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result try: sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) func = _resolve('%(module)s', '%(func)s') rc = func() # None interpreted as 0 except Exception as e: # only supporting Python >= 2.6 sys.stderr.write('%%s\n' %% e) rc = 1 sys.exit(rc) cCsZd|krV|jdrD|jdd\}}d|krV|jd rVd||f}n|jdsVd|}|S)N z /usr/bin/env r"z%s "%s"z"%s") startswithsplit) executableenvZ _executabler/usr/lib/python3.6/scripts.py_enquote_executableBs  rc@seZdZdZeZdZd%ddZddZe j j d rBd d Z d d Z d&ddZddZeZddZddZd'ddZddZeddZejddZejdksejd krejdkrdd Zd(d!d"Zd)d#d$ZdS)* ScriptMakerz_ A class to copy or create scripts from source scripts or callable specifications. NTFcCsz||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t d|_ |pRt ||_ tjdkprtjdkortjdk|_ dS)NFposixjavaX.Ynt)rr) source_dir target_dir add_launchersforceclobberosname_nameset_modesetvariantsr_fileop_is_nt)selfrrrdry_runZfileoprrr__init__[s   zScriptMaker.__init__cCs@|jddr<|jr|jd}n |jd}t} t| d} | jd|WdQRX| j } |||| }xd|D]Z} tj j |j | } |rrtj j | \}}|jdr|} d| } y|jj| |Wntk rntjdd | }tj j|r tj|tj| ||jj| |tjd ytj|Wntk rhYnXYnXnp|jr| jd | rd | |f} tj j| r|j rtjd | q|jj| ||jr|jj| g|j| qWdS)Nzutf-8pytwz __main__.pyz.pyz%s.exez:Failed to write executable - trying to use .deleteme logicz %s.deletemez0Able to replace executable using .deleteme logic.z%s.%szSkipping existing file %s)rr(r!lineseprM _get_launcherrrZwritestrgetvaluer/r1rsplitextrr'Zwrite_binary_file Exceptionr:r;existsremoverenamedebugr?r r$set_executable_modeappend)r)namesrSZ script_bytes filenamesextZ use_launcherreZlauncherstreamZzfZzip_datar"outnameneZdfnamerrr _write_scriptsT            zScriptMaker._write_scriptc Csd}|r0|jdg}|r0ddj|}|jd}|jd||d}|j|jd}|j}t} d|jkrp| j|d|jkr| jd |t j d fd |jkr| jd |t j dd f|r|jddrd} nd} |j | |||| dS)NrAZinterpreter_argsz %sr zutf-8)r2rXz%s%srzX.Yz%s-%sr,Fpywra) r.r1rMrTr\r"r%r&addrJversionrw) r)r[rqr2rRargsrSscriptr"Z scriptnamesrrrrr _make_scripts(      zScriptMaker._make_scriptcCsd}tjj|jt|}tjj|jtjj|}|j rX|jj || rXt j d|dSyt |d}Wn t k r|js~d}YnLX|j}|st jd|j|dStj|jdd}|rd}|jdpd }|s|r|j|jj|||jr|jj|g|j|nt jd ||j|jjst|j\} } |jd |j| |} d |krbd } nd} tjj|} |j| g| |j || |r|jdS)NFznot copying %s (up-to-date)rbz"%s: %s is an empty file (skipping)s rFTrrAzcopying and adjusting %s -> %srspythonwrzra)!r!r/r1rr rr]rr'Znewerr:rmr6r9r*readliner;Zget_command_name FIRST_LINE_REmatchr0groupcloseZ copy_filer$rnroinforseekrTrwr7)r)r~rqZadjustrtfZ first_linerrRrQlinesrSrrrurrr _copy_scriptsR         zScriptMaker._copy_scriptcCs|jjS)N)r'r*)r)rrrr*JszScriptMaker.dry_runcCs ||j_dS)N)r'r*)r)valuerrrr*NsrcCsHtjddkrd}nd}d||f}tjddd}t|j|j}|S) NPZ64Z32z%s%s.exerdrr)structcalcsize__name__rsplitrfindbytes)r)Zkindbitsr"Zdistlib_packageresultrrrrfVs zScriptMaker._get_launchercCs6g}t|}|dkr"|j||n|j|||d|S)a Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. N)r2)r rr)r) specificationr2rqr[rrrmakeds zScriptMaker.makecCs(g}x|D]}|j|j||q W|S)z Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, )extendr)r)Zspecificationsr2rqrrrr make_multiplews zScriptMaker.make_multiple)TFN)rAN)N)N)N)r __module__ __qualname____doc__SCRIPT_TEMPLATErWrr+r4rJrKrr=r@rTr\_DEFAULT_MANIFESTr^r`rwrrpropertyr*setterr!r"r#rfrrrrrrrRs,    82 4  r)iorZloggingr!rerrJcompatrrrZ resourcesrutilrr r r r Z getLoggerrr:striprcompilerrrobjectrrrrrs    distlib/__pycache__/markers.cpython-36.opt-1.pyc000064400000013337152347724720015463 0ustar003 Pf@sddZddlZddlZddlZddlZddlmZmZddlm Z dgZ Gddde Z d d dZ dS) zEParser for the environment markers micro-language defined in PEP 345.N)python_implementation string_types)in_venv interpretc @seZdZdZddddddddddddd dd dd dd Zejd ejddejj ddde j e e ejejejed Zd*ddZddZddZd+ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)ZdS), Evaluatorz5 A limited evaluator for Python expressions. cCs||kS)N)xyrr/usr/lib/python3.6/markers.pyszEvaluator.cCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs||kS)Nr)r r rrr r scCs| S)Nr)r rrr r scCs||kS)Nr)r r rrr r !scCs||kS)Nr)r r rrr r "s) eqgtZgteinltZltenotZnoteqZnotinz%s.%sN rr) Z sys_platformZpython_versionZpython_full_versionZos_nameZplatform_in_venvZplatform_releaseZplatform_versionZplatform_machineZplatform_python_implementationcCs|pi|_d|_dS)zu Initialise an instance. :param context: If specified, names are looked up in this mapping. N)contextsource)selfrrrr __init__3s zEvaluator.__init__cCs8d}d|j|||}||t|jkr4|d7}|S)zH Get the part of the source which is causing a problem. z%rz...)rlen)roffsetZ fragment_lensrrr get_fragment<s zEvaluator.get_fragmentcCst|d|dS)z@ Get a handler for the specified AST node type. zdo_%sN)getattr)r node_typerrr get_handlerFszEvaluator.get_handlercCst|trr||_ddi}|r$||d<ytj|f|}Wn:tk rp}z|j|j}td|WYdd}~XnX|jj j }|j |}|dkr|jdkrd}n |j|j }td||f||S)zf Evaluate a source string or node, using ``filename`` when displaying errors. modeevalfilenamezsyntax error %sNz(source not available)z don't know how to evaluate %r %s) isinstancerrastparse SyntaxErrorrr __class____name__lowerr col_offset)rnoder"kwargserrZhandlerrrr evaluateLs&       zEvaluator.evaluatecCsd|jj|jfS)Nz%s.%s)valueidattr)rr+rrr get_attr_keyfszEvaluator.get_attr_keycCsft|jtjsd}n|j|}||jkp0||jk}|sBtd|||jkrX|j|}n |j|}|S)NFzinvalid expression: %s)r#r/r$Namer2rallowed_valuesr&)rr+validkeyresultrrr do_attributejs     zEvaluator.do_attributecCsx|j|jd}|jjtjk}|jjtjk}|r4|s>|rt| rtx4|jddD]"}|j|}|rd|sn|rN| rNPqNW|S)Nrr)r.valuesopr'r$ZOrZAnd)rr+r7Zis_orZis_andnrrr do_boolopxs zEvaluator.do_boolopc sfdd}j}j|}d}xntjjD]\\}}||||jjj}|jkrft d|j|}j|||}|sP|}|}q2W|S)Ncs@d}t|tjr t|tjr d}|s<jj}td|dS)NTFzInvalid comparison: %s)r#r$ZStrrr*r&)lhsnoderhsnoder5r)r+rrr sanity_checks  z*Evaluator.do_compare..sanity_checkTzunsupported operation: %r) leftr.zipZopsZ comparatorsr'r(r) operatorsr&) rr+r?r=Zlhsr7r:r>Zrhsr)r+rr do_compares        zEvaluator.do_comparecCs |j|jS)N)r.Zbody)rr+rrr do_expressionszEvaluator.do_expressioncCsTd}|j|jkr"d}|j|j}n|j|jkr>d}|j|j}|sPtd|j|S)NFTzinvalid expression: %s)r0rr4r&)rr+r5r7rrr do_names   zEvaluator.do_namecCs|jS)N)r)rr+rrr do_strszEvaluator.do_str)N)N)r( __module__ __qualname____doc__rBsysplatform version_infoversionsplitosnamestrrreleasemachinerr4rrrr.r2r8r<rCrDrErFrrrr rs<       rcCst|j|jS)z Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping )rr.strip)ZmarkerZexecution_contextrrr rs )N)rIr$rOrJrKcompatrrutilr__all__objectrrrrrr s "distlib/__pycache__/manifest.cpython-36.opt-1.pyc000064400000023660152347724720015625 0ustar003 Pf9@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z dgZ ej eZejdejZejd ejejBZejdd ZGd ddeZdS) zu Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. N)DistlibException)fsdecode) convert_pathManifestz\\w* z#.*?(?= )| (?=$)c@szeZdZdZdddZddZddZd d Zdd d ZddZ ddZ ddZ dddZ d ddZ d!ddZddZdS)"rz~A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. NcCs>tjjtjj|ptj|_|jtj|_d|_t |_ dS)zd Initialise an instance. :param base: The base directory to explore under. N) ospathabspathnormpathgetcwdbasesepprefixallfilessetfiles)selfr r/usr/lib/python3.6/manifest.py__init__*szManifest.__init__cCsddlm}m}m}g|_}|j}|g}|j}|j}xv|r|}tj |} x\| D]T} tj j || } tj| } | j } || r|jt | qR|| rR||  rR|| qRWq8WdS)zmFind all files under the base and set ``allfiles`` to the absolute pathnames of files found. r)S_ISREGS_ISDIRS_ISLNKN)statrrrrr popappendrlistdirr joinst_moder)rrrrrrootstackrpushnamesnamefullnamermoderrrfindall9s"    zManifest.findallcCs4|j|jstjj|j|}|jjtjj|dS)zz Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. N) startswithrrr rr raddr )ritemrrrr)Ts z Manifest.addcCsx|D]}|j|qWdS)z Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. N)r))ritemsr*rrradd_many^s zManifest.add_manyFcsffddtj}|rJt}x|D]}|tjj|q(W||O}ddtdd|DDS)z8 Return sorted files in directory order cs>|j|tjd||jkr:tjj|\}}||dS)Nzadd_dir added %s)r)loggerdebugr rr split)dirsdparent_)add_dirrrrr4ls    z Manifest.sorted..add_dircSsg|]}tjj|qSr)rr r).0Z path_tuplerrr zsz#Manifest.sorted..css|]}tjj|VqdS)N)rr r/)r5r rrr {sz"Manifest.sorted..)rrrr dirnamesorted)rZwantdirsresultr0fr)r4rrr9gs  zManifest.sortedcCst|_g|_dS)zClear all collected files.N)rrr)rrrrclear}szManifest.clearcCs|j|\}}}}|dkrFx&|D]}|j|dds tjd|q Wn<|dkrnx|D]}|j|dd}qTWn|dkrx&|D]}|j|dds|tjd|q|Wn|d krx|D]}|j|dd}qWn|d krx|D] }|j||d stjd ||qWn|d kr&xz|D]}|j||d }q Wn\|dkrN|jd|d stjd|n4|dkrv|jd|d stjd|n td|dS)av Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands includeT)anchorzno files found matching %rexcludezglobal-includeFz3no files found matching %r anywhere in distributionzglobal-excludezrecursive-include)rz-no files found matching %r under directory %rzrecursive-excludegraftNz no directories found matching %rprunez4no previously-included directories found matching %rzinvalid action %r)_parse_directive_include_patternr-Zwarning_exclude_patternr)r directiveactionpatternsthedirZ dirpatternpatternfoundrrrprocess_directivesD           zManifest.process_directivec Cs|j}t|dkr,|ddkr,|jdd|d}d }}}|dkrxt|d kr`td |dd|dd D}n|dkrt|dkrtd|t|d}dd|d d D}n<|dkrt|d krtd|t|d}n td|||||fS)z Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns rrr=r?global-includeglobal-excluderecursive-includerecursive-excluder@rANrz$%r expects ...cSsg|] }t|qSr)r)r5wordrrrr6sz-Manifest._parse_directive..z*%r expects ...cSsg|] }t|qSr)r)r5rPrrrr6sz!%r expects a single zunknown action %r)r=r?rLrMrNrOr@rA)r=r?rLrM)rNrO)r@rA)r/leninsertrr)rrEZwordsrFrGrHZ dir_patternrrrrBs:           zManifest._parse_directiveTcCsTd}|j||||}|jdkr&|jx(|jD]}|j|r.|jj|d}q.W|S)aSelect strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. FNT)_translate_patternrr'searchrr))rrIr>ris_regexrJ pattern_rer$rrrrCs    zManifest._include_patterncCsFd}|j||||}x,t|jD]}|j|r |jj|d}q W|S)atRemove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions FT)rTlistrrUremove)rrIr>rrVrJrWr;rrrrD)s   zManifest._exclude_patternc Csv|rt|trtj|S|Std kr:|jdjd\}}}|rR|j|}td krVnd}tjtj j |j d} |dk r4tdkr|jd} |j|dt |  } n&|j|} | t |t | t |} tj } tj dkrd} tdkrd| | j | d |f}n0|t |t |t |}d || | | ||f}n8|rltdkrRd| |}nd || |t |df}tj|S)aTranslate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). rQrr3N\z\\^z.*z%s%s%s%s.*%s%sz%s%s%s)rQr)rQr)rQr)rQr)rQr) isinstancestrrecompile_PYTHON_VERSION _glob_to_re partitionescaperr rr rRr) rrIr>rrVstartr3endrWr Z empty_patternZ prefix_rerrrrrT=s@             zManifest._translate_patterncCs8tj|}tj}tjdkrd}d|}tjd||}|S)zTranslate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). r[z\\\\z\1[^%s]z((? s    distlib/__pycache__/__init__.cpython-36.opt-1.pyc000064400000001703152347724720015550 0ustar003 PfE @snddlZdZGdddeZyddlmZWn&ek rRGdddejZYnXejeZ e j edS)Nz0.2.4c@s eZdZdS)DistlibExceptionN)__name__ __module__ __qualname__rr/usr/lib/python3.6/__init__.pyr sr) NullHandlerc@s$eZdZddZddZddZdS)rcCsdS)Nr)selfrecordrrrhandleszNullHandler.handlecCsdS)Nr)r r rrremitszNullHandler.emitcCs d|_dS)N)lock)r rrr createLockszNullHandler.createLockN)rrrr r rrrrrrsr) Zlogging __version__ Exceptionrr ImportErrorZHandlerZ getLoggerrZloggerZ addHandlerrrrrs distlib/__pycache__/wheel.cpython-36.opt-1.pyc000064400000060467152347724720015131 0ustar003 Pf˘@sddlmZddlZddlZddlZddlZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlmZmZddlmZmZmZmZmZddlmZddlm Z m!Z!dd l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+dd l,m-Z-m.Z.e j/e0Z1da2e3ed r4d Z4n*ej5j6d rHdZ4nej5dkrZdZ4ndZ4ej7dZ8e8sdej9ddZ8de8Z:e4e8Z;ej"j<j=ddj=ddZ>ej7dZ?e?re?j6dre?j=ddZ?nddZ@e@Z?[@ejAdejBejCBZDejAdejBejCBZEejAdZFejAd ZGd!ZHd"ZIe jJd#kr>d$d%ZKnd&d%ZKGd'd(d(eLZMeMZNGd)d*d*eLZOd+d,ZPePZQ[Pd/d-d.ZRdS)0)unicode_literalsN)message_from_file) __version__DistlibException) sysconfigZipFilefsdecode text_typefilter)InstalledDistribution)MetadataMETADATA_FILENAME) FileOperator convert_path CSVReader CSVWriterCachecached_propertyget_cache_base read_exportstempdir)NormalizedVersionUnsupportedVersionErrorZpypy_version_infoZppjavaZjyZcliZipcppy_version_nodotz%s%spy-_.SOABIzcpython-cCsRdtg}tjdr|jdtjdr0|jdtjddkrH|jdd j|S) NrPy_DEBUGd WITH_PYMALLOCmZPy_UNICODE_SIZEu) VER_SUFFIXrget_config_varappendjoin)partsr//usr/lib/python3.6/wheel.py _derive_abi;s     r1zz (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? -(?P\w+\d+(\.\w+\d+)*) -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ z7 (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ s \s*#![^\r\n]*s^(\s*#!("[^"]+"|\S+))\s+(.*)$s#!pythons #!pythonw/cCs|S)Nr/)or/r/r0]sr4cCs|jtjdS)Nr2)replaceossep)r3r/r/r0r4_sc@s6eZdZddZddZddZd dd Zd d ZdS) MountercCsi|_i|_dS)N) impure_wheelslibs)selfr/r/r0__init__cszMounter.__init__cCs||j|<|jj|dS)N)r9r:update)r;pathname extensionsr/r/r0addgs z Mounter.addcCs4|jj|}x"|D]\}}||jkr|j|=qWdS)N)r9popr:)r;r>r?kvr/r/r0removeks  zMounter.removeNcCs||jkr|}nd}|S)N)r:)r;fullnamepathresultr/r/r0 find_moduleqs zMounter.find_modulecCsj|tjkrtj|}nP||jkr,td|tj||j|}||_|jdd}t|dkrf|d|_ |S)Nzunable to find extension for %sr!rr) sysmodulesr: ImportErrorimpZ load_dynamic __loader__rsplitlen __package__)r;rErGr.r/r/r0 load_modulexs       zMounter.load_module)N)__name__ __module__ __qualname__r<r@rDrHrQr/r/r/r0r8bs  r8c@seZdZdZd2ZdZd3ddZedd Zed d Z ed d Z e ddZ ddZ e ddZddZd4ddZddZddZddZd5ddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd6d*d+Zd,d-Zd.d/Zd7d0d1ZdS)8Wheelz@ Class to build and install from Wheel files (PEP 427). rZsha256NFcCs8||_||_d|_tg|_dg|_dg|_tj|_ |dkrRd|_ d|_ |j |_ ntj|}|r|jd}|d|_ |djd d |_ |d |_|j |_ ntjj|\}}tj|}|std ||rtjj||_ ||_ |jd}|d|_ |d|_ |d |_|d jd|_|djd|_|djd|_dS)zB Initialise an instance using a (valid) filename. r)noneanyNZdummyz0.1ZnmZvnr rZbnzInvalid name or filename: %rrr!Zbiar)signZ should_verifybuildverPYVERpyverabiarchr6getcwddirnamenameversionfilenameZ _filenameNAME_VERSION_REmatch groupdictr5rFsplit FILENAME_RErabspath)r;rcrYverifyr&infor`r/r/r0r<sB            zWheel.__init__cCs^|jrd|j}nd}dj|j}dj|j}dj|j}|jjdd}d|j|||||fS)zJ Build and return a filename from the various components. rr)r!r z%s-%s%s-%s-%s-%s.whl)rZr-r\r]r^rbr5ra)r;rZr\r]r^rbr/r/r0rcs     zWheel.filenamecCstjj|j|j}tjj|S)N)r6rFr-r`rcisfile)r;rFr/r/r0existssz Wheel.existsccs@x:|jD]0}x*|jD] }x|jD]}|||fVq WqWqWdS)N)r\r]r^)r;r\r]r^r/r/r0tagss   z Wheel.tagscCstjj|j|j}d|j|jf}d|}tjd}t |d}|j |}|dj dd}t dd |D}|d krzd } nt } y8tj|| } |j| } || } t| d } WdQRXWn tk rtd | YnXWdQRX| S)Nz%s-%sz %s.dist-infozutf-8rz Wheel-Versionr!rcSsg|] }t|qSr/)int).0ir/r/r0 sz"Wheel.metadata..ZMETADATA)Zfileobjz$Invalid wheel, because %s is missing)rr)r6rFr-r`rcrarbcodecs getreaderrget_wheel_metadatargtupler posixpathopenr KeyError ValueError)r;r>name_verinfo_dirwrapperzfwheel_metadatawv file_versionfnmetadata_filenamebfwfrGr/r/r0metadatas(     zWheel.metadatac CsXd|j|jf}d|}tj|d}|j|}tjd|}t|}WdQRXt|S)Nz%s-%sz %s.dist-infoWHEELzutf-8) rarbrxr-ryrtrurdict)r;rr|r}rrrmessager/r/r0rvs  zWheel.get_wheel_metadatac Cs6tjj|j|j}t|d}|j|}WdQRX|S)Nro)r6rFr-r`rcrrv)r;r>rrGr/r/r0rks z Wheel.infoc Cstj|}|r||j}|d|||d}}d|jkrBt}nt}tj|}|rfd|jd }nd}||}||}nT|jd}|jd} |dks|| krd} n|||dd krd } nd} t| |}|S) Nspythonw r  rrs ) SHEBANG_REreendlowerSHEBANG_PYTHONWSHEBANG_PYTHONSHEBANG_DETAIL_REgroupsfind) r;datar&rZshebangZdata_after_shebangZshebang_pythonargsZcrZlfZtermr/r/r0process_shebangs,       zWheel.process_shebangc Csh|dkr|j}ytt|}Wn tk r<td|YnX||j}tj|jdj d}||fS)NzUnsupported hash algorithm: %r=ascii) hash_kindgetattrhashlibAttributeErrorrdigestbase64Zurlsafe_b64encoderstripdecode)r;rrhasherrGr/r/r0get_hashs zWheel.get_hashc Csbt|}ttjj||}|j|ddf|jt|}x|D]}|j|qBWWdQRXdS)Nr)) listto_posixr6rFrelpathr,sortrZwriterow)r;recordsZ record_pathbasepwriterrowr/r/r0 write_record's  zWheel.write_recordc Csg}|\}}tt|j}xX|D]P\}} t| d} | j} WdQRXd|j| } tjj| } |j || | fqWtjj |d} |j || |t tjj |d}|j || fdS)Nrbz%s=%sRECORD) rrrryreadrr6rFgetsizer,r-rr)r;rklibdir archive_pathsrdistinfor}raprfrrsizer/r/r0 write_records0s   zWheel.write_recordsc CsJt|dtj2}x*|D]"\}}tjd|||j||qWWdQRXdS)NwzWrote %s to %s in wheel)rzipfileZ ZIP_DEFLATEDloggerdebugwrite)r;r>rrrrr/r/r0 build_zip@szWheel.build_zipc!s|dkr i}ttfddd$d}|dkrFd}tg}tg}tg}nd}tg}d g}d g}|jd ||_|jd ||_|jd ||_ |} d|j |j f} d| } d| } g} xd%D]}|krq|}t j j|rxt j|D]\}}}x|D]}tt j j||}t j j||}tt j j| ||}| j||f|dkr|jd rt|d}|j}WdQRX|j|}t|d}|j|WdQRXqWqWqW| }d}xt j|D]\}}}||krx@t|D]4\}}t|}|jdrt j j||}||=PqWxP|D]H}t|jd&r2qt j j||}tt j j||}| j||fqWqWt j|}xJ|D]B}|d'kr|tt j j||}tt j j| |}| j||fq|Wd|p|jdtd |g}x*|jD] \}}}|jd!|||fqWt j j|d}t|d"}|jd#j|WdQRXtt j j| d}| j||f|j|| f| | t j j|j |j!} |j"| | | S)(z Build a wheel from files in specified paths, and use any specified tags when determining the name of the wheel. Ncs|kS)Nr/)r3)pathsr/r0r4NszWheel.build..purelibplatlibrZfalsetruerVrWr\r]r^z%s-%sz%s.dataz %s.dist-inforheadersscriptsz.exerwbz .dist-info.pyc.pyor INSTALLERSHAREDrzWheel-Version: %d.%dzGenerator: distlib %szRoot-Is-Purelib: %sz Tag: %s-%s-%sr )rr)rrr)rr)rrrr)#rr IMPVERABIARCHr[getr\r]r^rarbr6rFisdirwalkr r-rrr,endswithryrrr enumeratelistdir wheel_versionrrnrr`rcr)!r;rrnrZlibkeyZis_pureZ default_pyverZ default_abiZ default_archrr|data_dirr}rkeyrFrootdirsfilesrrrprrrrrrdnrr\r]r^r>r/)rr0buildFs      "         z Wheel.buildcBIKs`|j}|jd}|jdd}tjj|j|j}d|j|jf}d|} d|} t j| t } t j| d} t j| d} t j d }t |d }|j| }||}t|}Wd QRX|d jd d}tdd|D}||jkr|r||j||ddkr|d}n|d}i}|j| <}t|d&}x|D]}|d}|||<q.WWd QRXWd QRXt j| d}t j| d}t j| dd}t|d}d|_tj }g} tj}!|!|_d |_zy^x|jD]}"|"j}#t|#tr|#}$n |#jd }$|$j drq||$}|dr0t!|"j"|dkr0t#d|$|dr|djdd\}%}&|j|#}|j$}'Wd QRX|j%|'|%\}(})|)|&krt#d|#|r|$j&||frt'j(d |$q|$j&|o|$j d! }*|$j&|r|$jd"d\}(}+},tjj||+t)|,}-n$|$| | fkrqtjj|t)|$}-|*s|j|#}|j*||-Wd QRX| j+|-| r|drt|-d#4}|j$}'|j%|'|%\}(}.|.|)krt#d$|-Wd QRX|rx|-j d%rxy|j,|-}/| j+|/Wn$t-k rt'j.d&dd'YnXnttjj/t)|#}0tjj|!|0}1|j|#}|j*||1Wd QRXtjj|-\}2}0|2|_|j0|0}3|j1|3| j2|3qW|rt'j(d(d }4n~d }5|j3d }|d)kr~t j| d*}6y|j|6}t4|}7Wd QRXi}5xxd|=s |>r|jdd}?tjj;|?s.tW|>rd,di}Ax8|>j=D],\}9};d8|9|;f}@|j0|@|A}3|j1|3qWtjj|| }t>|}4t?|}|d=|d=||d9<|4j@||}|r| j+||4jA| |d:||4St-k r@t'jBd;|jCYnXWd tDjE|!XWd QRXd S)=a Install a wheel to the specified paths. If kwarg ``warner`` is specified, it should be a callable, which will be called with two tuples indicating the wheel version of this software and the wheel version in the file, if there is a discrepancy in the versions. This can be used to issue any warnings to raise any exceptions. If kwarg ``lib_only`` is True, only the purelib/platlib files are installed, and the headers, scripts, data and dist-info metadata are not written. The return value is a :class:`InstalledDistribution` instance unless ``options.lib_only`` is True, in which case the return value is ``None``. warnerlib_onlyFz%s-%sz%s.dataz %s.dist-inforrzutf-8roNz Wheel-Versionr!rcSsg|] }t|qSr/)rp)rqrrr/r/r0rssz!Wheel.install..zRoot-Is-Purelibrrr)streamrr)r)dry_runTz /RECORD.jwsrzsize mismatch for %s=zdigest mismatch for %szlib_only: skipping %sz.exer2rzdigest mismatch on write for %sz.pyzByte-compilation failed)exc_infozlib_only: returning Nonez1.0zentry_points.txtconsoleguiz %s_scriptszwrap_%sz%s:%sz %szAUnable to read legacy script metadata, so cannot generate scriptsr?zpython.commandsz8Unable to read JSON metadata, so cannot generate scriptsZ wrap_consoleZwrap_guizValid script path not specifiedz%s = %slibprefixzinstallation failed.)rr)Frrr6rFr-r`rcrarbrxrrtrurryrrgrwrrrrecordrIdont_write_bytecodetempfileZmkdtempZ source_dirZ target_dirinfolist isinstancer rrstr file_sizerrr startswithrrrZ copy_streamr,Z byte_compile ExceptionZwarningbasenameZmakeZset_executable_modeextendrkrvaluesrsuffixflagsjsonloadrr{itemsr rZwrite_shared_locationsZwrite_installed_filesZ exceptionZrollbackshutilZrmtree)Br;rZmakerkwargsrrrr>r|rr} metadata_namewheel_metadata_name record_namer~rbwfrrrrrrrreaderrrZdata_pfxZinfo_pfxZ script_pfxZfileopZbcZoutfilesworkdirzinfoarcname u_arcnamekindvaluerr rZ is_scriptwhererZoutfileZ newdigestZpycrZworknamer filenamesZdistZcommandsZepZepdatarrBr$rCsZconsole_scriptsZ gui_scriptsZ script_dirZscriptZoptionsr/r/r0installsB            "                                          z Wheel.installcCs4tdkr0tjjttdtjdd}t|atS)Nz dylib-cache) cacher6rFr-rrrIrbr)r;rr/r/r0_get_dylib_caches zWheel._get_dylib_cachecCsltjj|j|j}d|j|jf}d|}tj|d}tj d}g}t |d}y|j |}||} t j | } |j} | j|} tjj| j| } tjj| stj| x| jD]\}}tjj| t|}tjj|sd}n6tj|j}tjj|}|j|}tj|j}||k}|r(|j|| |j||fqWWdQRXWntk r\YnXWdQRX|S)Nz%s-%sz %s.dist-infoZ EXTENSIONSzutf-8roT)r6rFr-r`rcrarbrxrtrurryrrrZ prefix_to_dirrrmakedirsrrrmstatst_mtimedatetimeZ fromtimestampZgetinfoZ date_timeextractr,rz)r;r>r|r}rr~rGrrrr?r rZ cache_baserardestrZ file_timerkZ wheel_timer/r/r0_get_extensionss>              zWheel._get_extensionscCst|S)zM Determine if a wheel is compatible with the running system. ) is_compatible)r;r/r/r0rszWheel.is_compatiblecCsdS)zP Determine if a wheel is asserted as mountable by its metadata. Tr/)r;r/r/r0 is_mountableszWheel.is_mountablecCstjjtjj|j|j}|js2d|}t||jsJd|}t||t jkrbt j d|nN|rtt jj |nt jj d||j}|rtt jkrt jj ttj||dS)Nz)Wheel %s not compatible with this Python.z$Wheel %s is marked as not mountable.z%s already in pathr)r6rFrir-r`rcrrrrIrrr,insertr_hook meta_pathr@)r;r,r>msgr?r/r/r0mounts"   z Wheel.mountcCsrtjjtjj|j|j}|tjkr2tjd|nr/r/r0unmounts     z Wheel.unmountc'Cstjj|j|j}d|j|jf}d|}d|}tj|t}tj|d}tj|d}t j d}t |d} | j |} || } t | } WdQRX| djd d } td d | D}i}| j |:}t|d $}x|D]}|d}|||<qWWdQRXWdQRXx| jD]}|j}t|tr*|}n |jd}d|krJtd||jdrZq||}|drt|j|dkrtd||d r|d jdd \}}| j |}|j}WdQRX|j||\}}||krtd|qWWdQRXdS)Nz%s-%sz%s.dataz %s.dist-inforrzutf-8roz Wheel-Versionr!rcSsg|] }t|qSr/)rp)rqrrr/r/r0rssz Wheel.verify..)rrz..zinvalid entry in wheel: %rz /RECORD.jwsrzsize mismatch for %srzdigest mismatch for %s)r6rFr-r`rcrarbrxrrtrurryrrgrwrrrr rrrrrrr)r;r>r|rr}rrrr~rrrrrrrrrrrrrrrrrr rr/r/r0rjsT                z Wheel.verifycKsdd}dd}tjj|j|j}d|j|jf}d|}tj|d} t} t |d} i} xt| j D]h} | j}t |t r|}n |j d }|| krqjd |krtd || j| | tjj| t|}|| |<qjWWd QRX|| |\}}|| f|}|r|| |\}}|r(||kr(||||d krRtjd d| d\}}tj|n*tjj|sltd|tjj||j}t| j}tjj| |}||f}|j|| ||j|||d krtj||Wd QRX|S)a Update the contents of a wheel in a generic way. The modifier should be a callable which expects a dictionary argument: its keys are archive-entry paths, and its values are absolute filesystem paths where the contents the corresponding archive entries can be found. The modifier is free to change the contents of the files pointed to, add new entries and remove entries, before returning. This method will extract the entire contents of the wheel to a temporary location, call the modifier, and then use the passed (and possibly updated) dictionary to write a new wheel. If ``dest_dir`` is specified, the new wheel is written there -- otherwise, the original wheel is overwritten. The modifier should return True if it updated the wheel, else False. This method returns the same value the modifier returns. cSsHd}}d|tf}||kr$d|}||kr@||}t|dj}||fS)Nz%s/%sz %s/PKG-INFO)rF)rr rb)path_mapr}rbrFrr/r/r0 get_version1s  z!Wheel.update..get_versionc Ssd}y|t|}|jd}|dkr*d|}nTdd||ddjdD}|dd7<d|d|djd d |Df}Wn tk rtjd |YnX|rt|d }||_|j t  }|j ||d tjd||dS)Nrrz%s+1cSsg|] }t|qSr/)rp)rqr r/r/r0rsCsz8Wheel.update..update_version..rr!z%s+%scss|]}t|VqdS)N)r)rqrrr/r/r0 Fsz7Wheel.update..update_version..z0Cannot update non-compliant (PEP-440) version %r)rF)rFlegacyzVersion updated from %r to %rr) rrrgr-rrrr rbrrr)rbrFupdatedrCrrr.Zmdr!r/r/r0update_version;s(       z$Wheel.update..update_versionz%s-%sz %s.dist-inforrozutf-8z..zinvalid entry in wheel: %rNz.whlz wheel-update-)rrdirzNot a directory: %r)r6rFr-r`rcrarbrxrrrrr rrrrrZmkstempcloserrrrrrZcopyfile)r;ZmodifierZdest_dirrrr#r>r|r}rrrrrrrrFZoriginal_versionr ZmodifiedZcurrent_versionfdnewpathrrrkr/r/r0r= sX                z Wheel.update)rr)NFF)N)NN)F)N)rRrSrT__doc__rrr<propertyrcrmrnrrrvrkrrrrrrr rrrrrrrjr=r/r/r/r0rUs4 )        he "  6rUcCstg}td}x6ttjddddD]}|jdj|t|gq&Wg}x6tjD]*\}}}|j drT|j|j dddqTW|j t dkr|j dt |jdg}tg}tjdkrtjd t}|r|j\} }}} t|}| g} | dkr| jd | dkr| jd| dkr*| jd| dkr>| jd| dkrR| jdxL|dkrx2| D]*} d| ||| f} | tkrd|j| qdW|d8}qTWx<|D]4}x,|D]$} |jdjt|df|| fqWqWxXt|D]L\}}|jdjt|fddf|dkr|jdjt|dfddfqWxXt|D]L\}}|jdjd|fddf|dkrB|jdjd|dfddfqBWt|S)zG Return (pyver, abi, arch) tuples compatible with this Python. rrr)z.abir!rrVdarwinz(\w+)_(\d+)_(\d+)_(\w+)$i386ppcZfatx86_64Zfat3ppc64Zfat64intelZ universalz %s_%s_%s_%srWrrr)r+r,)r+r,r-)r.r-)r+r-)r+r-r/r,r.)r*rangerI version_infor,r-rrLZ get_suffixesrrgrrrrplatformrererrp IMP_PREFIXrset)ZversionsmajorminorZabisrr rGZarchesr&rar^Zmatchesrer r]rrrbr/r/r0compatible_tagss`                    * $ $r8cCs^t|tst|}d}|dkr"t}x6|D].\}}}||jkr(||jkr(||jkr(d}Pq(W|S)NFT)rrUCOMPATIBLE_TAGSr\r]r^)ZwheelrnrGZverr]r^r/r/r0rs r)N)SZ __future__rrrtrZdistutils.utilZ distutilsZemailrrrLrZloggingr6rxr3rrIrrr)rrcompatrrr r r Zdatabaser rr rutilrrrrrrrrrrbrrZ getLoggerrRrr hasattrr4r2rr+r*r1r[r get_platformr5rrr1compile IGNORECASEVERBOSErhrdrrrrr7robjectr8rrUr8r9rr/r/r/r0s   ,          #>distlib/__pycache__/resources.cpython-36.pyc000064400000025116152347724720015070 0ustar003 Pf*@sddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZejeZdaGdddeZGdd d eZGd d d eZGd d d eZGdddeZGdddeZedee jeiZyFy ddl Z!Wne"k r$ddl#Z!YnXeee!j$<eee!j%<[!Wne"e&fk rXYnXddZ'iZ(ddZ)e j*e+dZ,ddZ-dS))unicode_literalsN)DistlibException)cached_propertyget_cache_basepath_to_cache_dirCachecs.eZdZdfdd ZddZddZZS) ResourceCacheNcs0|dkrtjjttd}tt|j|dS)Nzresource-cache)ospathjoinrstrsuperr __init__)selfbase) __class__/usr/lib/python3.6/resources.pyrszResourceCache.__init__cCsdS)z Is the cache stale for the given resource? :param resource: The :class:`Resource` being cached. :param path: The path of the resource in the cache. :return: True if the cache is stale. Tr)rresourcer rrris_stale#s zResourceCache.is_stalec Cs|jj|\}}|dkr|}n~tjj|j|j||}tjj|}tjj|sXtj |tjj |sjd}n |j ||}|rt |d}|j |jWdQRX|S)z Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. NTwb)finderget_cache_infor r r rZ prefix_to_dirdirnameisdirmakedirsexistsropenwritebytes)rrprefixr resultrZstalefrrrget.s      zResourceCache.get)N)__name__ __module__ __qualname__rrr$ __classcell__rr)rrr s r c@seZdZddZdS) ResourceBasecCs||_||_dS)N)rname)rrr*rrrrIszResourceBase.__init__N)r%r&r'rrrrrr)Hsr)c@s@eZdZdZdZddZeddZeddZed d Z d S) Resourcez A class representing an in-package resource, such as a data file. This is not normally instantiated by user code, but rather by a :class:`ResourceFinder` which manages the resource. FcCs |jj|S)z Get the resource as a stream. This is not a property to make it obvious that it returns a new stream each time. )r get_stream)rrrr as_streamVszResource.as_streamcCstdkrtatj|S)N)cacher r$)rrrr file_path_szResource.file_pathcCs |jj|S)N)r get_bytes)rrrrr fszResource.bytescCs |jj|S)N)rget_size)rrrrsizejsz Resource.sizeN) r%r&r'__doc__ is_containerr-rr/r r2rrrrr+Ns   r+c@seZdZdZeddZdS)ResourceContainerTcCs |jj|S)N)r get_resources)rrrr resourcesrszResourceContainer.resourcesN)r%r&r'r4rr7rrrrr5osr5c@seZdZdZejjdrdZnd ZddZdd Z d d Z d d Z ddZ ddZ ddZddZddZddZddZeejjZddZdS)!ResourceFinderz4 Resource finder for file system resources. java.pyc.pyo.classcCs.||_t|dd|_tjjt|dd|_dS)N __loader____file__)modulegetattrloaderr r rr)rr@rrrrszResourceFinder.__init__cCs tjj|S)N)r r realpath)rr rrr _adjust_pathszResourceFinder._adjust_pathcCsBt|trd}nd}|j|}|jd|jtjj|}|j|S)N//r) isinstancer splitinsertrr r r rD)r resource_nameseppartsr"rrr _make_paths   zResourceFinder._make_pathcCs tjj|S)N)r r r)rr rrr_findszResourceFinder._findcCs d|jfS)N)r )rrrrrrszResourceFinder.get_cache_infocCsD|j|}|j|sd}n&|j|r0t||}n t||}||_|S)N)rMrN _is_directoryr5r+r )rrJr r"rrrfinds     zResourceFinder.findcCs t|jdS)Nrb)rr )rrrrrr,szResourceFinder.get_streamc Cs t|jd }|jSQRXdS)NrQ)rr read)rrr#rrrr0szResourceFinder.get_bytescCstjj|jS)N)r r getsize)rrrrrr1szResourceFinder.get_sizecs*fddtfddtj|jDS)Ncs|dko|jj S)N __pycache__)endswithskipped_extensions)r#)rrrallowedsz-ResourceFinder.get_resources..allowedcsg|]}|r|qSrr).0r#)rWrr sz0ResourceFinder.get_resources..)setr listdirr )rrr)rWrrr6s zResourceFinder.get_resourcescCs |j|jS)N)rOr )rrrrrr4szResourceFinder.is_containerccs|j|}|dk r|g}xn|r|jd}|V|jr|j}xH|jD]>}|sP|}ndj||g}|j|}|jrz|j|qB|VqBWqWdS)NrrF)rPpopr4r*r7r append)rrJrZtodoZrnamer*new_nameZchildrrriterators      zResourceFinder.iteratorN)r:r;r<)r:r;)r%r&r'r3sysplatform startswithrVrrDrMrNrrPr,r0r1r6r4 staticmethodr r rrOr_rrrrr8ws"    r8cs`eZdZdZfddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ Z S)ZipResourceFinderz6 Resource finder for resources in .zip files. csZtt|j||jj}dt||_t|jdr>|jj|_n t j ||_t |j|_ dS)Nr_files) rrdrrBarchivelen prefix_lenhasattrre zipimport_zip_directory_cachesortedindex)rr@rf)rrrrs   zZipResourceFinder.__init__cCs|S)Nr)rr rrrrDszZipResourceFinder._adjust_pathc Cs||jd}||jkrd}nX|r:|dtjkr:|tj}tj|j|}y|j|j|}Wntk rtd}YnX|stj d||j j ntj d||j j |S)NTrFz_find failed: %r %rz_find worked: %r %r) rhrer rKbisectrmrb IndexErrorloggerdebugrBr!)rr r"irrrrNs   zZipResourceFinder._findcCs&|jj}|jdt|d}||fS)Nr)rBrfr rg)rrr!r rrrrsz ZipResourceFinder.get_cache_infocCs|jj|jS)N)rBget_datar )rrrrrr0szZipResourceFinder.get_bytescCstj|j|S)N)ioBytesIOr0)rrrrrr,szZipResourceFinder.get_streamcCs|j|jd}|j|dS)N)r rhre)rrr rrrr1szZipResourceFinder.get_sizecCs|j|jd}|r,|dtjkr,|tj7}t|}t}tj|j|}xV|t|jkr|j|j|sjP|j||d}|j |j tjdd|d7}qJW|S)Nrrrn) r rhr rKrgrZrormrbaddrH)rrr Zplenr"rssrrrr6s  zZipResourceFinder.get_resourcesc Csj||jd}|r*|dtjkr*|tj7}tj|j|}y|j|j|}Wntk rdd}YnX|S)NrFrn)rhr rKrormrbrp)rr rsr"rrrrOs  zZipResourceFinder._is_directory)r%r&r'r3rrDrNrr0r,r1r6rOr(rr)rrrds rdcCs|tt|<dS)N)_finder_registrytype)rB finder_makerrrrregister_finder0sr}cCs|tkrt|}nv|tjkr$t|tj|}t|dd}|dkrJtdt|dd}tjt|}|dkrxtd|||}|t|<|S)z Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. __path__Nz8You cannot get a finder for a module, only for a packager=zUnable to locate finder for %r) _finder_cacher`modules __import__rArrzr$r{)packager"r@r rBr|rrrr6s      rZ __dummy__cCsRd}tj|tjj|}tjt|}|rNt}tj j |d|_ ||_ ||}|S)z Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. Nr?) pkgutilZ get_importerr`path_importer_cacher$rzr{ _dummy_moduler r r r>r=)r r"rBrr@rrrfinder_for_pathRs  r).Z __future__rroruZloggingr rZshutilr`typesrjr?rutilrrrrZ getLoggerr%rqr.r objectr)r+r5r8rdr{ zipimporterrz_frozen_importlib_externalZ_fi ImportError_frozen_importlibSourceFileLoader FileFinderAttributeErrorr}rr ModuleTyper rrrrrrsH   ,!ZN    distlib/__pycache__/wheel.cpython-36.pyc000064400000060601152347724720014160 0ustar003 Pf˘@sddlmZddlZddlZddlZddlZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlmZmZddlmZmZmZmZmZddlmZddlm Z m!Z!dd l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+dd l,m-Z-m.Z.e j/e0Z1da2e3ed r4d Z4n*ej5j6d rHdZ4nej5dkrZdZ4ndZ4ej7dZ8e8sdej9ddZ8de8Z:e4e8Z;ej"j<j=ddj=ddZ>ej7dZ?e?re?j6dre?j=ddZ?nddZ@e@Z?[@ejAdejBejCBZDejAdejBejCBZEejAdZFejAd ZGd!ZHd"ZIe jJd#kr>d$d%ZKnd&d%ZKGd'd(d(eLZMeMZNGd)d*d*eLZOd+d,ZPePZQ[Pd/d-d.ZRdS)0)unicode_literalsN)message_from_file) __version__DistlibException) sysconfigZipFilefsdecode text_typefilter)InstalledDistribution)MetadataMETADATA_FILENAME) FileOperator convert_path CSVReader CSVWriterCachecached_propertyget_cache_base read_exportstempdir)NormalizedVersionUnsupportedVersionErrorZpypy_version_infoZppjavaZjyZcliZipcppy_version_nodotz%s%spy-_.SOABIzcpython-cCsRdtg}tjdr|jdtjdr0|jdtjddkrH|jdd j|S) NrPy_DEBUGd WITH_PYMALLOCmZPy_UNICODE_SIZEu) VER_SUFFIXrget_config_varappendjoin)partsr//usr/lib/python3.6/wheel.py _derive_abi;s     r1zz (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? -(?P\w+\d+(\.\w+\d+)*) -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ z7 (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ s \s*#![^\r\n]*s^(\s*#!("[^"]+"|\S+))\s+(.*)$s#!pythons #!pythonw/cCs|S)Nr/)or/r/r0]sr4cCs|jtjdS)Nr2)replaceossep)r3r/r/r0r4_sc@s6eZdZddZddZddZd dd Zd d ZdS) MountercCsi|_i|_dS)N) impure_wheelslibs)selfr/r/r0__init__cszMounter.__init__cCs||j|<|jj|dS)N)r9r:update)r;pathname extensionsr/r/r0addgs z Mounter.addcCs4|jj|}x"|D]\}}||jkr|j|=qWdS)N)r9popr:)r;r>r?kvr/r/r0removeks  zMounter.removeNcCs||jkr|}nd}|S)N)r:)r;fullnamepathresultr/r/r0 find_moduleqs zMounter.find_modulecCsj|tjkrtj|}nP||jkr,td|tj||j|}||_|jdd}t|dkrf|d|_ |S)Nzunable to find extension for %sr!rr) sysmodulesr: ImportErrorimpZ load_dynamic __loader__rsplitlen __package__)r;rErGr.r/r/r0 load_modulexs       zMounter.load_module)N)__name__ __module__ __qualname__r<r@rDrHrQr/r/r/r0r8bs  r8c@seZdZdZd2ZdZd3ddZedd Zed d Z ed d Z e ddZ ddZ e ddZddZd4ddZddZddZddZd5ddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd6d*d+Zd,d-Zd.d/Zd7d0d1ZdS)8Wheelz@ Class to build and install from Wheel files (PEP 427). rZsha256NFcCs8||_||_d|_tg|_dg|_dg|_tj|_ |dkrRd|_ d|_ |j |_ ntj|}|r|jd}|d|_ |djd d |_ |d |_|j |_ ntjj|\}}tj|}|std ||rtjj||_ ||_ |jd}|d|_ |d|_ |d |_|d jd|_|djd|_|djd|_dS)zB Initialise an instance using a (valid) filename. r)noneanyNZdummyz0.1ZnmZvnr rZbnzInvalid name or filename: %rrr!Zbiar)signZ should_verifybuildverPYVERpyverabiarchr6getcwddirnamenameversionfilenameZ _filenameNAME_VERSION_REmatch groupdictr5rFsplit FILENAME_RErabspath)r;rcrYverifyr&infor`r/r/r0r<sB            zWheel.__init__cCs^|jrd|j}nd}dj|j}dj|j}dj|j}|jjdd}d|j|||||fS)zJ Build and return a filename from the various components. rr)r!r z%s-%s%s-%s-%s-%s.whl)rZr-r\r]r^rbr5ra)r;rZr\r]r^rbr/r/r0rcs     zWheel.filenamecCstjj|j|j}tjj|S)N)r6rFr-r`rcisfile)r;rFr/r/r0existssz Wheel.existsccs@x:|jD]0}x*|jD] }x|jD]}|||fVq WqWqWdS)N)r\r]r^)r;r\r]r^r/r/r0tagss   z Wheel.tagscCstjj|j|j}d|j|jf}d|}tjd}t |d}|j |}|dj dd}t dd |D}|d krzd } nt } y8tj|| } |j| } || } t| d } WdQRXWn tk rtd | YnXWdQRX| S)Nz%s-%sz %s.dist-infozutf-8rz Wheel-Versionr!rcSsg|] }t|qSr/)int).0ir/r/r0 sz"Wheel.metadata..ZMETADATA)Zfileobjz$Invalid wheel, because %s is missing)rr)r6rFr-r`rcrarbcodecs getreaderrget_wheel_metadatargtupler posixpathopenr KeyError ValueError)r;r>name_verinfo_dirwrapperzfwheel_metadatawv file_versionfnmetadata_filenamebfwfrGr/r/r0metadatas(     zWheel.metadatac CsXd|j|jf}d|}tj|d}|j|}tjd|}t|}WdQRXt|S)Nz%s-%sz %s.dist-infoWHEELzutf-8) rarbrxr-ryrtrurdict)r;rr|r}rrrmessager/r/r0rvs  zWheel.get_wheel_metadatac Cs6tjj|j|j}t|d}|j|}WdQRX|S)Nro)r6rFr-r`rcrrv)r;r>rrGr/r/r0rks z Wheel.infoc Cstj|}|r||j}|d|||d}}d|jkrBt}nt}tj|}|rfd|jd }nd}||}||}nT|jd}|jd} |dks|| krd} n|||dd krd } nd} t| |}|S) Nspythonw r  rrs ) SHEBANG_REreendlowerSHEBANG_PYTHONWSHEBANG_PYTHONSHEBANG_DETAIL_REgroupsfind) r;datar&rZshebangZdata_after_shebangZshebang_pythonargsZcrZlfZtermr/r/r0process_shebangs,       zWheel.process_shebangc Csh|dkr|j}ytt|}Wn tk r<td|YnX||j}tj|jdj d}||fS)NzUnsupported hash algorithm: %r=ascii) hash_kindgetattrhashlibAttributeErrorrdigestbase64Zurlsafe_b64encoderstripdecode)r;rrhasherrGr/r/r0get_hashs zWheel.get_hashc Csbt|}ttjj||}|j|ddf|jt|}x|D]}|j|qBWWdQRXdS)Nr)) listto_posixr6rFrelpathr,sortrZwriterow)r;recordsZ record_pathbasepwriterrowr/r/r0 write_record's  zWheel.write_recordc Csg}|\}}tt|j}xX|D]P\}} t| d} | j} WdQRXd|j| } tjj| } |j || | fqWtjj |d} |j || |t tjj |d}|j || fdS)Nrbz%s=%sRECORD) rrrryreadrr6rFgetsizer,r-rr)r;rklibdir archive_pathsrdistinfor}raprfrrsizer/r/r0 write_records0s   zWheel.write_recordsc CsJt|dtj2}x*|D]"\}}tjd|||j||qWWdQRXdS)NwzWrote %s to %s in wheel)rzipfileZ ZIP_DEFLATEDloggerdebugwrite)r;r>rrrrr/r/r0 build_zip@szWheel.build_zipc!s|dkr i}ttfddd%d}|dkrFd}tg}tg}tg}nd}tg}d g}d g}|jd ||_|jd ||_|jd ||_ |} d|j |j f} d| } d| } g} xd&D]}|krq|}t j j|rxt j|D]\}}}x|D]}tt j j||}t j j||}tt j j| ||}| j||f|dkr|jd rt|d}|j}WdQRX|j|}t|d}|j|WdQRXqWqWqW| }d}xt j|D]\}}}||kr"x@t|D]4\}}t|}|jdrt j j||}||=PqW|s"tdxP|D]H}t|jd'r@q(t j j||}tt j j||}| j||fq(WqWt j|}xJ|D]B}|d(krtt j j||}tt j j| |}| j||fqWd|p|jd td!|g}x*|jD] \}}}|jd"|||fqWt j j|d}t|d#}|jd$j|WdQRXtt j j| d}| j||f|j || f| | t j j|j!|j"} |j#| | | S))z Build a wheel from files in specified paths, and use any specified tags when determining the name of the wheel. Ncs|kS)Nr/)r3)pathsr/r0r4NszWheel.build..purelibplatlibrZfalsetruerVrWr\r]r^z%s-%sz%s.dataz %s.dist-inforheadersscriptsz.exerwbz .dist-infoz(.dist-info directory expected, not found.pyc.pyor INSTALLERSHAREDrzWheel-Version: %d.%dzGenerator: distlib %szRoot-Is-Purelib: %sz Tag: %s-%s-%sr )rr)rrr)rr)rrrr)$rr IMPVERABIARCHr[getr\r]r^rarbr6rFisdirwalkr r-rrr,endswithryrrr enumerateAssertionErrorlistdir wheel_versionrrnrr`rcr)!r;rrnrZlibkeyZis_pureZ default_pyverZ default_abiZ default_archrr|data_dirr}rkeyrFrootdirsfilesrrrprrrrrrdnrr\r]r^r>r/)rr0buildFs      "         z Wheel.buildcBIKs`|j}|jd}|jdd}tjj|j|j}d|j|jf}d|} d|} t j| t } t j| d} t j| d} t j d }t |d }|j| }||}t|}Wd QRX|d jd d}tdd|D}||jkr|r||j||ddkr|d}n|d}i}|j| <}t|d&}x|D]}|d}|||<q.WWd QRXWd QRXt j| d}t j| d}t j| dd}t|d}d|_tj }g} tj}!|!|_d |_zy^x|jD]}"|"j}#t|#tr|#}$n |#jd }$|$j drq||$}|dr0t!|"j"|dkr0t#d|$|dr|djdd\}%}&|j|#}|j$}'Wd QRX|j%|'|%\}(})|)|&krt#d|#|r|$j&||frt'j(d |$q|$j&|o|$j d! }*|$j&|r|$jd"d\}(}+},tjj||+t)|,}-n$|$| | fkrqtjj|t)|$}-|*s|j|#}|j*||-Wd QRX| j+|-| r|drt|-d#4}|j$}'|j%|'|%\}(}.|.|)krt#d$|-Wd QRX|rx|-j d%rxy|j,|-}/| j+|/Wn$t-k rt'j.d&dd'YnXnttjj/t)|#}0tjj|!|0}1|j|#}|j*||1Wd QRXtjj|-\}2}0|2|_|j0|0}3|j1|3| j2|3qW|rt'j(d(d }4n~d }5|j3d }|d)kr~t j| d*}6y|j|6}t4|}7Wd QRXi}5xxd|=s |>r|jdd}?tjj;|?s.tW|>rd,di}Ax8|>j=D],\}9};d8|9|;f}@|j0|@|A}3|j1|3qWtjj|| }t>|}4t?|}|d=|d=||d9<|4j@||}|r| j+||4jA| |d:||4St-k r@t'jBd;|jCYnXWd tDjE|!XWd QRXd S)=a Install a wheel to the specified paths. If kwarg ``warner`` is specified, it should be a callable, which will be called with two tuples indicating the wheel version of this software and the wheel version in the file, if there is a discrepancy in the versions. This can be used to issue any warnings to raise any exceptions. If kwarg ``lib_only`` is True, only the purelib/platlib files are installed, and the headers, scripts, data and dist-info metadata are not written. The return value is a :class:`InstalledDistribution` instance unless ``options.lib_only`` is True, in which case the return value is ``None``. warnerlib_onlyFz%s-%sz%s.dataz %s.dist-inforrzutf-8roNz Wheel-Versionr!rcSsg|] }t|qSr/)rp)rqrrr/r/r0rssz!Wheel.install..zRoot-Is-Purelibrrr)streamrr)r)dry_runTz /RECORD.jwsrzsize mismatch for %s=zdigest mismatch for %szlib_only: skipping %sz.exer2rzdigest mismatch on write for %sz.pyzByte-compilation failed)exc_infozlib_only: returning Nonez1.0zentry_points.txtconsoleguiz %s_scriptszwrap_%sz%s:%sz %szAUnable to read legacy script metadata, so cannot generate scriptsr?zpython.commandsz8Unable to read JSON metadata, so cannot generate scriptsZ wrap_consoleZwrap_guizValid script path not specifiedz%s = %slibprefixzinstallation failed.)rr)Frrr6rFr-r`rcrarbrxrrtrurryrrgrwrrrrecordrIdont_write_bytecodetempfileZmkdtempZ source_dirZ target_dirinfolist isinstancer rrstr file_sizerrr startswithrrrZ copy_streamr,Z byte_compile ExceptionZwarningbasenameZmakeZset_executable_modeextendrkrvaluesrsuffixflagsjsonloadrr{itemsr rZwrite_shared_locationsZwrite_installed_filesZ exceptionZrollbackshutilZrmtree)Br;rZmakerkwargsrrrr>r|rr} metadata_namewheel_metadata_name record_namer~rbwfrrrrrrrreaderrrZdata_pfxZinfo_pfxZ script_pfxZfileopZbcZoutfilesworkdirzinfoarcname u_arcnamekindvaluerr rZ is_scriptwhererZoutfileZ newdigestZpycrZworknamer filenamesZdistZcommandsZepZepdatarrBr$rCsZconsole_scriptsZ gui_scriptsZ script_dirZscriptZoptionsr/r/r0installsB            "                                          z Wheel.installcCs4tdkr0tjjttdtjdd}t|atS)Nz dylib-cache) cacher6rFr-rrrIrbr)r;rr/r/r0_get_dylib_caches zWheel._get_dylib_cachecCsltjj|j|j}d|j|jf}d|}tj|d}tj d}g}t |d}y|j |}||} t j | } |j} | j|} tjj| j| } tjj| stj| x| jD]\}}tjj| t|}tjj|sd}n6tj|j}tjj|}|j|}tj|j}||k}|r(|j|| |j||fqWWdQRXWntk r\YnXWdQRX|S)Nz%s-%sz %s.dist-infoZ EXTENSIONSzutf-8roT)r6rFr-r`rcrarbrxrtrurryrrrZ prefix_to_dirrrmakedirsrrrmstatst_mtimedatetimeZ fromtimestampZgetinfoZ date_timeextractr,rz)r;r>r|r}rr~rGrrrr?rrZ cache_baserardestrZ file_timerkZ wheel_timer/r/r0_get_extensionss>              zWheel._get_extensionscCst|S)zM Determine if a wheel is compatible with the running system. ) is_compatible)r;r/r/r0rszWheel.is_compatiblecCsdS)zP Determine if a wheel is asserted as mountable by its metadata. Tr/)r;r/r/r0 is_mountableszWheel.is_mountablecCstjjtjj|j|j}|js2d|}t||jsJd|}t||t jkrbt j d|nN|rtt jj |nt jj d||j}|rtt jkrt jj ttj||dS)Nz)Wheel %s not compatible with this Python.z$Wheel %s is marked as not mountable.z%s already in pathr)r6rFrir-r`rcrrrrIrrr,insertr_hook meta_pathr@)r;r,r>msgr?r/r/r0mounts"   z Wheel.mountcCsrtjjtjj|j|j}|tjkr2tjd|nr/r/r0unmounts     z Wheel.unmountc'Cstjj|j|j}d|j|jf}d|}d|}tj|t}tj|d}tj|d}t j d}t |d} | j |} || } t | } WdQRX| djd d } td d | D}i}| j |:}t|d $}x|D]}|d}|||<qWWdQRXWdQRXx| jD]}|j}t|tr*|}n |jd}d|krJtd||jdrZq||}|drt|j|dkrtd||d r|d jdd \}}| j |}|j}WdQRX|j||\}}||krtd|qWWdQRXdS)Nz%s-%sz%s.dataz %s.dist-inforrzutf-8roz Wheel-Versionr!rcSsg|] }t|qSr/)rp)rqrrr/r/r0rssz Wheel.verify..)rrz..zinvalid entry in wheel: %rz /RECORD.jwsrzsize mismatch for %srzdigest mismatch for %s)r6rFr-r`rcrarbrxrrtrurryrrgrwrrrr rrrrrrr)r;r>r|rr}rrrr~rrrrrrrrrrrrrrrrrr rr/r/r0rjsT                z Wheel.verifycKsdd}dd}tjj|j|j}d|j|jf}d|}tj|d} t} t |d} i} xt| j D]h} | j}t |t r|}n |j d }|| krqjd |krtd || j| | tjj| t|}|| |<qjWWd QRX|| |\}}|| f|}|r|| |\}}|r(||kr(||||d krRtjd d| d\}}tj|n*tjj|sltd|tjj||j}t| j}tjj| |}||f}|j|| ||j|||d krtj||Wd QRX|S)a Update the contents of a wheel in a generic way. The modifier should be a callable which expects a dictionary argument: its keys are archive-entry paths, and its values are absolute filesystem paths where the contents the corresponding archive entries can be found. The modifier is free to change the contents of the files pointed to, add new entries and remove entries, before returning. This method will extract the entire contents of the wheel to a temporary location, call the modifier, and then use the passed (and possibly updated) dictionary to write a new wheel. If ``dest_dir`` is specified, the new wheel is written there -- otherwise, the original wheel is overwritten. The modifier should return True if it updated the wheel, else False. This method returns the same value the modifier returns. cSsHd}}d|tf}||kr$d|}||kr@||}t|dj}||fS)Nz%s/%sz %s/PKG-INFO)rF)rr rb)path_mapr}rbrFrr/r/r0 get_version1s  z!Wheel.update..get_versionc Ssd}y|t|}|jd}|dkr*d|}nTdd||ddjdD}|dd7<d|d|djd d |Df}Wn tk rtjd |YnX|rt|d }||_|j t  }|j ||d tjd||dS)Nrrz%s+1cSsg|] }t|qSr/)rp)rqr r/r/r0rsCsz8Wheel.update..update_version..rr!z%s+%scss|]}t|VqdS)N)r)rqrrr/r/r0 Fsz7Wheel.update..update_version..z0Cannot update non-compliant (PEP-440) version %r)rF)rFlegacyzVersion updated from %r to %rr) rrrgr-rrrr rbrrr)rbrFupdatedrCrrr.Zmdr"r/r/r0update_version;s(       z$Wheel.update..update_versionz%s-%sz %s.dist-inforrozutf-8z..zinvalid entry in wheel: %rNz.whlz wheel-update-)rrdirzNot a directory: %r)r6rFr-r`rcrarbrxrrrrr rrrrrZmkstempcloserrrrrrZcopyfile)r;ZmodifierZdest_dirrr r$r>r|r}rrrrrrrrFZoriginal_versionr ZmodifiedZcurrent_versionfdnewpathrrrkr/r/r0r= sX                z Wheel.update)rr)NFF)N)NN)F)N)rRrSrT__doc__rrr<propertyrcrmrnrrrvrkrrrrrrr rrrrrrrjr=r/r/r/r0rUs4 )        he "  6rUcCstg}td}x6ttjddddD]}|jdj|t|gq&Wg}x6tjD]*\}}}|j drT|j|j dddqTW|j t dkr|j dt |jdg}tg}tjdkrtjd t}|r|j\} }}} t|}| g} | dkr| jd | dkr| jd| dkr*| jd| dkr>| jd| dkrR| jdxL|dkrx2| D]*} d| ||| f} | tkrd|j| qdW|d8}qTWx<|D]4}x,|D]$} |jdjt|df|| fqWqWxXt|D]L\}}|jdjt|fddf|dkr|jdjt|dfddfqWxXt|D]L\}}|jdjd|fddf|dkrB|jdjd|dfddfqBWt|S)zG Return (pyver, abi, arch) tuples compatible with this Python. rrr)z.abir!rrVdarwinz(\w+)_(\d+)_(\d+)_(\w+)$i386ppcZfatx86_64Zfat3ppc64Zfat64intelZ universalz %s_%s_%s_%srWrrr)r,r-)r,r-r.)r/r.)r,r.)r,r.r0r-r/)r*rangerI version_infor,r-rrLZ get_suffixesrrgrrrrplatformrererrp IMP_PREFIXrset)ZversionsmajorminorZabisrr rGZarchesr&rar^Zmatchesrer r]rrrbr/r/r0compatible_tagss`                    * $ $r9cCs^t|tst|}d}|dkr"t}x6|D].\}}}||jkr(||jkr(||jkr(d}Pq(W|S)NFT)rrUCOMPATIBLE_TAGSr\r]r^)ZwheelrnrGZverr]r^r/r/r0rs r)N)SZ __future__rrrtrZdistutils.utilZ distutilsZemailrrrLrZloggingr6rxr4rrIrrr)rrcompatrrr r r Zdatabaser rr rutilrrrrrrrrrrbrrZ getLoggerrRrrhasattrr5r3rr+r*r2r[r get_platformr5rrr1compile IGNORECASEVERBOSErhrdrrrrr7robjectr8rrUr9r:rr/r/r/r0s   ,          #>distlib/__pycache__/util.cpython-36.pyc000064400000127326152347724720014041 0ustar003 Pfi@s>ddlZddlmZddlZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZy ddlZWnek rdZYnXddlZddlZddlZddlZddlZy ddlZWnek rddlZYnXddlZddlmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/e j0e1Z2dZ3e j4e3Z5dZ6d e6d Z7e6d Z8d Z9d e9de8de3d e9de8dZ:dZ;de:de;de:dZde6de>de<dZ?e j4e?Z@de9de8d ZAe j4eAZBdd ZCd!d"ZDd#d$ZEd%d&ZFdd'd(ZGd)d*ZHd+d,ZId-d.ZJejKd/d0ZLejKd1d2ZMejKdd4d5ZNGd6d7d7eOZPd8d9ZQGd:d;d;eOZRdd?d?eOZTe j4d@e jUZVdAdBZWddCdDZXdEdFZYdGdHZZdIdJZ[dKdLZ\dMdNZ]e j4dOe j^Z_e j4dPZ`ddQdRZae j4dSZbdTdUZcdVdWZddXdYZedZZfd[d\Zgd]d^ZhGd_d`d`eOZiGdadbdbeOZjGdcddddeOZkdZlddmdnZmdodpZndZoGdwdxdxeOZpe j4dyZqe j4dzZre j4d{Zsd|d}Zd~dZter\ddlmuZvmwZwmxZxGddde$jyZyGdddevZuGdddeue'Zzej{ddZ|e|dkrGddde$j}Z}erGddde$j~Z~Gddde%jZerGddde%jZGddde%jZddZGdddeOZGdddeZGdddeZGddde(ZGdddeOZddZdS)N)deque)iglob)DistlibException) string_types text_typeshutil raw_inputStringIOcache_from_sourceurlopenurljoinhttplib xmlrpclib splittype HTTPHandlerBaseConfigurator valid_ident Container configparserURLErrorZipFilefsdecodeunquotez\s*,\s*z (\w|[.-])+z(\*|:(\*|\w+):|)z\*?z([<>=!~]=)|[<>](z)?\s*(z)(z)\s*(z))*z(from\s+(?P.*))z \(\s*(?P|z)\s*\)|(?Pz\s*)z)*z \[\s*(?Pz)?\s*\]z(?Pz \s*)?(\s*z)?$z(?Pz )\s*(?Pc sddd}tj|}|r|j}|d}|dp8|d}|dsHd}nd}|dj}|snd}d}|d}nL|dd krd |}tj|} fd d | D}d |djdd |Df}|dsd} ntj|d} t ||| |||d}|S)NcSs|j}|d|dfS)NopZvn) groupdict)mdr!/usr/lib/python3.6/util.pyget_constraintYsz)parse_requirement..get_constraintZdnZc1Zc2Zdirefrz<>!=z~=csg|] }|qSr!r!).0r)r#r!r" qsz%parse_requirement..z%s (%s)z, cSsg|] }d|qS)z%s %sr!)r%Zconr!r!r"r&rsZex)nameZ constraintsextrasZ requirementsourceurl) REQUIREMENT_REmatchrstripRELOP_IDENT_REfinditerjoinCOMMA_REsplitr) sresultrr r'Zconsr*ZconstrZrsiteratorr(r!)r#r"parse_requirementWs4      r6cCsdd}i}x|D]\}}}tjj||}xt|D]t}tjj||} x`t| D]T} ||| } |dkrt|j| dqP||| } |jtjjdjd} | d| || <qPWq4WqW|S)z%Find destinations for resources filescSsD|jtjjd}|jtjjd}|j|s.t|t|djdS)N/)replaceospathsep startswithAssertionErrorlenlstrip)baser:r!r!r" get_rel_pathsz)get_resources_dests..get_rel_pathNr7)r9r:r0rpopr8r;rstrip)Zresources_rootZrulesrAZ destinationsr@suffixdestprefixZabs_baseZabs_globZabs_pathZ resource_fileZrel_pathZrel_destr!r!r"get_resources_dests|s  rGcCs(ttdrd}ntjttdtjk}|S)NZ real_prefixT base_prefix)hasattrsysrFgetattr)r4r!r!r"in_venvs rLcCs$tjjtj}t|ts t|}|S)N)r9r:normcaserJ executable isinstancerr)r4r!r!r"get_executables  rPcCsT|}xJt|}|}| r |r |}|r|dj}||kr:P|rd|||f}qW|S)Nrz %c: %s %s)r lower)promptZ allowed_charsZ error_promptdefaultpr3cr!r!r"proceeds  rVcCs<t|tr|j}i}x |D]}||kr||||<qW|S)N)rOrr2)r keysr4keyr!r!r"extract_by_keys  rYcCstjddkrtjd|}|j}t|}yrtj|}|ddd}xR|jD]F\}}x<|jD]0\}}d||f}t |} | dk st | ||<qdWqRW|St k r|j ddYnXdd } t j} y| | |Wn<t jk r|jtj|}t|}| | |YnXi}xb| jD]V} i|| <}xB| j| D]4\} }d| |f}t |} | dk spt | || <qFWq*W|S) Nrzutf-8 extensionszpython.exportsexportsz%s = %scSs$t|dr|j|n |j|dS)N read_file)rIr]Zreadfp)cpstreamr!r!r" read_streams  z!read_exports..read_stream)rJ version_infocodecs getreaderreadr jsonloaditemsget_export_entryr= Exceptionseekr ConfigParserZMissingSectionHeaderErrorclosetextwrapdedentZsections)r_dataZjdatar4groupZentrieskvr3entryr`r^rXr'valuer!r!r" read_exportssD      rucCstjddkrtjd|}tj}x||jD]p\}}|j|x\|jD]P}|j dkr`|j }nd|j |j f}|j rd|dj |j f}|j ||j|qJWq.W|j|dS)NrrZzutf-8z%s:%sz%s [%s]z, )rJrarb getwriterrrkrgZ add_sectionvaluesrDrFflagsr0setr'write)r\r_r^rqrrrsr3r!r!r" write_exportss  r{c cs$tj}z |VWdtj|XdS)N)tempfilemkdtemprrmtree)Ztdr!r!r"tempdir s rc cs.tj}ztj|dVWdtj|XdS)N)r9getcwdchdir)r cwdr!r!r"rs   rc cs.tj}ztj|dVWdtj|XdS)N)socketZgetdefaulttimeoutZsetdefaulttimeout)ZsecondsZctor!r!r"socket_timeouts   rc@seZdZddZdddZdS)cached_propertycCs ||_dS)N)func)selfrr!r!r"__init__)szcached_property.__init__NcCs,|dkr |S|j|}tj||jj||S)N)robject __setattr____name__)robjclsrtr!r!r"__get__.s  zcached_property.__get__)N)r __module__ __qualname__rrr!r!r!r"r(srcCstjdkr|S|s|S|ddkr.td||ddkrFtd||jd}xtj|krj|jtjqRW|svtjStjj|S)aReturn 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. r7rzpath '%s' cannot be absoluterzpath '%s' cannot end with '/')r9r; ValueErrorr2curdirremover:r0)pathnamepathsr!r!r" convert_path6s       rc@seZdZd$ddZddZddZdd Zd%d d Zd&ddZddZ ddZ ddZ ddZ ddZ d'ddZddZddZd d!Zd"d#Zd S)( FileOperatorFcCs||_t|_|jdS)N)dry_runryensured _init_record)rrr!r!r"rRszFileOperator.__init__cCsd|_t|_t|_dS)NF)recordry files_written dirs_created)rr!r!r"rWszFileOperator._init_recordcCs|jr|jj|dS)N)rradd)rr:r!r!r"record_as_written\szFileOperator.record_as_writtencCsHtjj|s tdtjj|tjj|s0dStj|jtj|jkS)aTell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'source'. Raise PackagingFileError if 'source' does not exist. Note that this test is not very accurate: files created in the same second will have the same "age". zfile '%r' does not existT)r9r:existsrabspathstatst_mtime)rr)targetr!r!r"newer`s  zFileOperator.newerTcCs|jtjj|tjd|||jsd}|rftjj|rDd|}n"tjj|rftjj | rfd|}|rvt |dt j |||j |dS)z8Copy a file respecting dry-run and force flags. zCopying %s to %sNz%s is a symlinkz%s is a non-regular filez which would be overwritten) ensure_dirr9r:dirnameloggerinforislinkrisfilerrZcopyfiler)rZinfileoutfilecheckmsgr!r!r" copy_filets    zFileOperator.copy_fileNc Cstjj| st|jtjj|tjd|||jsx|dkrLt |d}nt j |d|d}zt j ||Wd|j X|j|dS)NzCopying stream %s to %swbw)encoding)r9r:isdirr=rrrrropenrbrZ copyfileobjrlr)rZinstreamrrZ outstreamr!r!r" copy_streams  zFileOperator.copy_streamc CsF|jtjj||js8t|d}|j|WdQRX|j|dS)Nr)rr9r:rrrrzr)rr:rofr!r!r"write_binary_files  zFileOperator.write_binary_filec CsL|jtjj||js>t|d}|j|j|WdQRX|j|dS)Nr) rr9r:rrrrzencoder)rr:rorrr!r!r"write_text_files  zFileOperator.write_text_filecCsrtjdkstjdkrntjdkrnxN|D]F}|jrszFileOperator.cCs~tjj|}||jkrztjj| rz|jj|tjj|\}}|j|tj d||j shtj ||j rz|j j|dS)Nz Creating %s)r9r:rrrrr2rrrrmkdirrr)rr:r rr!r!r"rs    zFileOperator.ensure_dircCsvt|| }tjd|||jsh|s0|j||rX|s:d}n|j|sHt|t|d}tj |||d|j ||S)NzByte-compiling %s to %sT) r rrrrr<r=r> py_compilecompiler)rr:optimizeforcerFZdpathZdiagpathr!r!r" byte_compiles  zFileOperator.byte_compilecCstjj|rtjj|r`tjj| r`tjd||jsBtj ||j r||j kr|j j |nPtjj|rrd}nd}tjd|||jstj ||j r||j kr|j j |dS)NzRemoving directory tree at %slinkfilezRemoving %s %s)r9r:rrrrdebugrrr~rrrr)rr:r3r!r!r"ensure_removeds"       zFileOperator.ensure_removedcCsHd}x>|sBtjj|r&tj|tj}Ptjj|}||kr)r'rFrDrx)rr!r!r"__repr__!s zExportEntry.__repr__cCsDt|tsd}n0|j|jko>|j|jko>|j|jko>|j|jk}|S)NF)rOrr'rFrDrx)rotherr4r!r!r"__eq__%s     zExportEntry.__eq__N) rrrrrrtrrr__hash__r!r!r!r"rs   rz(?P(\w|[-.+])+) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P\w+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? c Cstj|}|s0d}d|ks"d|krtd|n|j}|d}|d}|jd}|dkrf|d}}n"|dkrztd||jd\}}|d } | dkrd|ksd|krtd|g} nd d | jd D} t|||| }|S) N[]zInvalid specification '%s'r'callable:rrrxcSsg|] }|jqSr!)r-)r%rr!r!r"r&Qsz$get_export_entry..,)ENTRY_REsearchrrcountr2r) Z specificationrr4r r'r:ZcolonsrFrDrxr!r!r"rh7s2    rhc Cs|dkr d}tjdkr.dtjkr.tjjd}n tjjd}tjj|rftj|tj}|st j d|n|jdd\}}d|kr.|}n|jdd\}}|||fS)N@rr)r2)ZnetlocZusernameZpasswordrFr!r!r"parse_credentialssrcCstjd}tj||S)N)r9umask)r4r!r!r"get_process_umasks  rcCs>d}d}x$t|D]\}}t|tsd}PqW|dk s:t|S)NTF) enumeraterOrr=)seqr4ir3r!r!r"is_string_sequences  rz3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)z -py(\d\.?\d?)cCsd}d}t|jdd}tj|}|r@|jd}|d|j}|rt|t|dkrtjtj |d|}|r|j }|d|||dd|f}|dkrt j|}|r|jd|jd|f}|S)zw Extract name, version, python version from a filename (no extension) Return name, version, pyver or None N -rz\brZ) rr8PYTHON_VERSIONrrpstartr>rer,escapeendPROJECT_NAME_AND_VERSION)filenameZ project_namer4Zpyverrnr!r!r"split_filenames"   rz-(?P[\w .-]+)\s*\(\s*(?P[^\s)]+)\)$cCs:tj|}|std||j}|djj|dfS)z A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. z$Ill-formed name/version string: '%s'r'Zver)NAME_VERSION_REr,rrr-rQ)rTrr r!r!r"parse_name_and_versions  rcCst}t|pg}t|pg}d|kr8|jd||O}x|D]x}|dkrV|j|q>|jdr|dd}||krtjd|||kr|j|q>||krtjd||j|q>W|S)N*r rzundeclared extra: %s)ryrrr<rr)Z requestedZ availabler4rZunwantedr!r!r" get_extrass&        rcCsi}yNt|}|j}|jd}|jds8tjd|ntjd|}tj |}Wn0t k r}ztj d||WYdd}~XnX|S)Nz Content-Typezapplication/jsonz(Unexpected response for JSON request: %szutf-8z&Failed to get external data for %s: %s) r rgetr<rrrbrcrerfri exception)r*r4ZrespZheadersZctreaderer!r!r"_get_external_datas   rz'https://www.red-dove.com/pypi/projects/cCs*d|dj|f}tt|}t|}|S)Nz%s/%s/project.jsonr)upperr _external_data_base_urlr)r'r*r4r!r!r"get_project_datas r cCs(d|dj||f}tt|}t|S)Nz%s/%s/package-%s.jsonr)rr rr)r'versionr*r!r!r"get_package_datas r"c@s(eZdZdZddZddZddZdS) Cachez A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. cCsPtjj|stj|tj|jd@dkr6tjd|tjjtjj ||_ dS)zu Initialise an instance. :param base: The base directory where the cache should be located. ?rzDirectory '%s' is not privateN) r9r:rrrrrrrnormpathr@)rr@r!r!r"r"s    zCache.__init__cCst|S)zN Converts a resource prefix to a directory name in the cache. )r)rrFr!r!r" prefix_to_dir0szCache.prefix_to_dirc Csg}xtj|jD]r}tjj|j|}y>tjj|s@tjj|rLtj|ntjj|rbt j |Wqt k r|j |YqXqW|S)z" Clear the cache. ) r9rr@r:r0rrrrrr~riappend)rZ not_removedfnr!r!r"clear6s  z Cache.clearN)rrr__doc__rr&r)r!r!r!r"r#sr#c@s:eZdZdZddZdddZddZd d Zd d Zd S) EventMixinz1 A very simple publish/subscribe system. cCs i|_dS)N) _subscribers)rr!r!r"rKszEventMixin.__init__TcCsD|j}||krt|g||<n"||}|r6|j|n |j|dS)a` Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list for the event. N)r,rr' appendleft)revent subscriberr'subsZsqr!r!r"rNs  zEventMixin.addcCs,|j}||krtd|||j|dS)z Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. zNo subscribers: %rN)r,rr)rr.r/r0r!r!r"rbs zEventMixin.removecCst|jj|fS)z Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. )iterr,r)rr.r!r!r"get_subscribersnszEventMixin.get_subscribersc Ospg}xT|j|D]F}y||f||}Wn"tk rJtjdd}YnX|j|qWtjd|||||S)a^ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The keyword arguments to pass to the event's subscribers. z"Exception during event publicationNz/publish %s: args = %s, kwargs = %s, result = %s)r2rirrr'r)rr.argskwargsr4r/rtr!r!r"publishus    zEventMixin.publishN)T) rrrr*rrrr2r5r!r!r!r"r+Gs   r+c@s^eZdZddZddZdddZdd Zd d Zd d ZddZ e ddZ e ddZ dS) SequencercCsi|_i|_t|_dS)N)_preds_succsry_nodes)rr!r!r"rszSequencer.__init__cCs|jj|dS)N)r9r)rnoder!r!r"add_nodeszSequencer.add_nodeFcCs||jkr|jj||rx&t|jj|fD]}|j||q.Wx&t|jj|fD]}|j||qVWx&t|jjD]\}}|sz|j|=qzWx&t|jjD]\}}|s|j|=qWdS)N)r9rryr7rr8rrg)rr:ZedgesrTr3rqrrr!r!r" remove_nodes   zSequencer.remove_nodecCs<||ks t|jj|tj||jj|tj|dS)N)r=r7 setdefaultryrr8)rpredsuccr!r!r"rs z Sequencer.addcCs||ks ty|j|}|j|}Wn tk rDtd|YnXy|j||j|Wn$tk rtd||fYnXdS)Nz%r not a successor of anythingz%r not a successor of %r)r=r7r8KeyErrorrr)rr>r?predsZsuccsr!r!r"rs   zSequencer.removecCs||jkp||jkp||jkS)N)r7r8r9)rstepr!r!r"is_stepszSequencer.is_stepcCs|j|std|g}g}t}|j|xd|r|jd}||krd||kr|j||j|q0|j||j||jj|f}|j |q0Wt |S)Nz Unknown: %rr) rCrryr'rBrrr7rextendreversed)rfinalr4ZtodoseenrBrAr!r!r" get_stepss"        zSequencer.get_stepscsVdggiig|jfddxD]}|kr:|q:WS)Nrc sd|<d|<dd7<j|y |}Wntk rVg}YnXxR|D]J}|kr|t|||<q^|kr^t|||<q^W||krg}x j}|j|||krPqWt|}j|dS)Nrr)r'riminrBtuple)r:Z successorsZ successorZconnected_componentZ component)graphindex index_counterlowlinksr4stack strongconnectr!r"rPs.       z3Sequencer.strong_connections..strongconnect)r8)rr:r!)rKrLrMrNr4rOrPr"strong_connectionss"  zSequencer.strong_connectionscCsrdg}x8|jD].}|j|}x|D]}|jd||fq"WqWx|jD]}|jd|qHW|jddj|S)Nz digraph G {z %s -> %s;z %s;} )r7r'r9r0)rr4r?rAr>r:r!r!r"dot s     z Sequencer.dotN)F) rrrrr;r<rrrCrHpropertyrQrTr!r!r!r"r6s   3r6.tar.gz.tar.bz2.tar.zip.tgz.tbz.whlTc sffdd}tjjtd}|dkr|jdr>d}nH|jdrRd}d }n4|jdrfd }d }n |jdrzd}d}n td|z|dkrt|d}|r|j}xD|D] }||qWn.tj ||}|r|j }x|D] }||qW|dkr6t j ddkr6x.|j D]"} t| jts| jjd| _qWdd} | |_|jWd|r`|jXdS)NcsTt|ts|jd}tjjtjj|}|j sD|tjkrPt d|dS)Nzutf-8zpath outside destination: %r) rOrdecoder9r:rr0r<r;r)r:rT)dest_dirplenr!r" check_paths   zunarchive..check_path.zip.whlzip.tar.gz.tgzZtgzzr:gz.tar.bz2.tbzZtbzzr:bz2z.tarZtarrzUnknown format for %rrrZzutf-8cSsBy tj||Stjk r<}ztt|WYdd}~XnXdS)z:Run tarfile.tar_fillter, but raise the expected ValueErrorN)tarfileZ tar_filterZ FilterErrorrstr)memberr:excr!r!r"extraction_filterPs z$unarchive..extraction_filter)rarb)rdre)rfrg)r9r:rr>rrrZnamelistrhrZgetnamesrJraZ getmembersrOr'rr]rlZ extractallrl) Zarchive_filenamer^formatrr`archivernamesr'Ztarinforlr!)r^r_r" unarchivesL           rpc Cstj}t|}t|db}xZtj|D]L\}}}x@|D]8}tjj||}||d} tjj| |} |j|| q8Wq(WWdQRX|S)z*zip a directory tree into a BytesIO objectrN) ioBytesIOr>rr9walkr:r0rz) Z directoryr4ZdlenZzfrootrrr'ZfullZrelrEr!r!r"zip_dir`s   rur$KMGTPc@sreZdZdZdddZddZdd Zd d Zd d Ze ddZ e ddZ ddZ e ddZ e ddZdS)ProgressZUNKNOWNrdcCs<|dks||kst||_|_||_d|_d|_d|_dS)NrF)r=rIcurmaxstartedelapseddone)rZminvalZmaxvalr!r!r"rws  zProgress.__init__cCsV|j|kst|jdks&||jks&t||_tj}|jdkrF||_n ||j|_dS)N)rIr=r~r}timerr)rZcurvalZnowr!r!r"updates zProgress.updatecCs |dks t|j|j|dS)Nr)r=rr})rZincrr!r!r" increments zProgress.incrementcCs|j|j|S)N)rrI)rr!r!r"r s zProgress.startcCs |jdk r|j|jd|_dS)NT)r~rr)rr!r!r"stops  z Progress.stopcCs|jdkr|jS|jS)N)r~unknown)rr!r!r"maximumszProgress.maximumcCsD|jr d}n4|jdkrd}n$d|j|j|j|j}d|}|S)Nz100 %z ?? %gY@z%3d %%)rr~r}rI)rr4rrr!r!r" percentages zProgress.percentagecCs:|dkr|jdks|j|jkr$d}ntjdtj|}|S)Nrz??:??:??z%H:%M:%S)r~r}rIrZstrftimeZgmtime)rZdurationr4r!r!r"format_durationszProgress.format_durationcCs|jrd}|j}n^d}|jdkr&d}nJ|jdks<|j|jkrBd}n.t|j|j}||j|j}|d|j}d||j|fS)NZDonezETA rrz%s: %sr)rrr~r}rIfloatr)rrFtr!r!r"ETAs z Progress.ETAcCsN|jdkrd}n|j|j|j}xtD]}|dkr6P|d}q(Wd||fS)Nrgig@@z%d %sB/s)rr}rIUNITS)rr4Zunitr!r!r"speeds   zProgress.speedN)rr|)rrrrrrrr rrUrrrrrr!r!r!r"r{ts     r{z \{([^}]*)\}z[^/\\,{]\*\*|\*\*[^/\\,}]z^[^{]*\}|\{[^}]*$cCs<tj|rd}t||tj|r4d}t||t|S)zAExtended globbing function that supports ** and {opt1,opt2,opt3}.z7invalid glob %r: recursive glob "**" must be used alonez2invalid glob %r: mismatching set marker '{' or '}')_CHECK_RECURSIVE_GLOBrr_CHECK_MISMATCH_SET_iglob) path_globrr!r!r"rs    rc cstj|d}t|dkrpt|dks,t||\}}}x|jdD](}x"tdj|||fD] }|Vq\WqBWnd|krxt|D] }|VqWn|jdd\}}|dkrd}|dkrd}n|jd}|jd }xHtj |D]:\}}} tj j |}x"ttj j||D] } | VqWqWdS) NrrZrr$z**rrr7\) RICH_GLOBr2r>r=rr0 std_iglobr?r9rsr:r%) rZrich_path_globrFryrDitemr:Zradicaldirrr(r!r!r"rs*       r) HTTPSHandlermatch_hostnameCertificateErrorc@seZdZdZdZddZdS)HTTPSConnectionNTc CsPtj|j|jf|j}t|ddr0||_|jtt dsp|j rHt j }nt j }t j ||j|j|t j|j d|_nxt jt j}|jt jO_|jr|j|j|ji}|j rt j |_|j|j dtt ddr|j|d<|j |f||_|j o|jrLy$t|jj|jtjd|jWn0tk rJ|jjtj|jjYnXdS) NZ _tunnel_hostF SSLContext) cert_reqsZ ssl_versionca_certs)ZcafileZHAS_SNIZserver_hostnamezHost verified: %s) rZcreate_connectionhostporttimeoutrKsockZ_tunnelrIsslrZ CERT_REQUIREDZ CERT_NONEZ wrap_socketZkey_fileZ cert_fileZPROTOCOL_SSLv23rZoptionsZ OP_NO_SSLv2Zload_cert_chainZ verify_modeZload_verify_locations check_domainrZ getpeercertrrrZshutdownZ SHUT_RDWRrl)rrrcontextr4r!r!r"connect s>      zHTTPSConnection.connect)rrrrrrr!r!r!r"rsrc@s&eZdZd ddZddZddZdS) rTcCstj|||_||_dS)N)BaseHTTPSHandlerrrr)rrrr!r!r"r0s zHTTPSHandler.__init__cOs$t||}|jr |j|_|j|_|S)a This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. )rrr)rr3r4r4r!r!r" _conn_maker5s zHTTPSHandler._conn_makercCsVy|j|j|Stk rP}z&dt|jkr>td|jnWYdd}~XnXdS)Nzcertificate verify failedz*Unable to verify server certificate for %s)Zdo_openrrrireasonrr)rreqrr!r!r" https_openEs zHTTPSHandler.https_openN)T)rrrrrrr!r!r!r"r/s rc@seZdZddZdS)HTTPSOnlyHandlercCstd|dS)NzAUnexpected HTTP request on what should be a secure connection: %s)r)rrr!r!r" http_openYszHTTPSOnlyHandler.http_openN)rrrrr!r!r!r"rXsrc@seZdZdddZdS)HTTPr$NcKs&|dkr d}|j|j||f|dS)Nr)_setup_connection_class)rrrr4r!r!r"resz HTTP.__init__)r$N)rrrrr!r!r!r"rdsrc@seZdZdddZdS)HTTPSr$NcKs&|dkr d}|j|j||f|dS)Nr)rr)rrrr4r!r!r"rmszHTTPS.__init__)r$N)rrrrr!r!r!r"rlsrc@seZdZdddZddZdS) TransportrcCs||_tjj||dS)N)rrrr)rr use_datetimer!r!r"rtszTransport.__init__cCsb|j|\}}}tdkr(t||jd}n6|j s>||jdkrT||_|tj|f|_|jd}|S)Nrr)rrr)rr) get_host_info _ver_inforr _connection_extra_headersrZHTTPConnection)rrhehZx509r4r!r!r"make_connectionxs zTransport.make_connectionN)r)rrrrrr!r!r!r"rss rc@seZdZdddZddZdS) SafeTransportrcCs||_tjj||dS)N)rrrr)rrrr!r!r"rszSafeTransport.__init__cCsz|j|\}}}|si}|j|d<tdkr:t|df|}n<|j sP||jdkrl||_|tj|df|f|_|jd}|S)Nrrrrr)rr)rrrrrrrr)rrrrr4r4r!r!r"rs    zSafeTransport.make_connectionN)r)rrrrrr!r!r!r"rs rc@seZdZddZdS) ServerProxyc Kst|jdd|_}|dk r^t|\}}|jdd}|dkr@t}nt}|||d|d<}||_tjj ||f|dS)NrrrZhttps)r transport) rBrrrrrrrrr) rZurir4rscheme_rZtclsrr!r!r"rs  zServerProxy.__init__N)rrrrr!r!r!r"rsrcKs.tjddkr|d7}nd|d<t||f|S)NrrZbr$newline)rJrar)r(rr4r!r!r" _csv_opens rc@s4eZdZedededdZddZddZd S) CSVBaser"rS)Z delimiterZ quotecharZlineterminatorcCs|S)Nr!)rr!r!r" __enter__szCSVBase.__enter__cGs|jjdS)N)r_rl)rrr!r!r"__exit__szCSVBase.__exit__N)rrrridefaultsrrr!r!r!r"rs  rc@s(eZdZddZddZddZeZdS) CSVReadercKs\d|kr4|d}tjddkr,tjd|}||_nt|dd|_tj|jf|j|_dS)Nr_rrZzutf-8r:r) rJrarbrcr_rcsvrr)rr4r_r!r!r"rszCSVReader.__init__cCs|S)Nr!)rr!r!r"__iter__szCSVReader.__iter__cCsJt|j}tjddkrFx,t|D] \}}t|ts"|jd||<q"W|S)NrrZzutf-8)nextrrJrarrOrr])rr4rrr!r!r"rs   zCSVReader.nextN)rrrrrr__next__r!r!r!r"rs rc@seZdZddZddZdS) CSVWritercKs$t|d|_tj|jf|j|_dS)Nr)rr_rwriterr)rr(r4r!r!r"rs zCSVWriter.__init__cCsRtjddkrBg}x*|D]"}t|tr0|jd}|j|qW|}|jj|dS)NrrZzutf-8)rJrarOrrr'rwriterow)rrowrrr!r!r"rs   zCSVWriter.writerowN)rrrrrr!r!r!r"rsrcsHeZdZeejZded<d fdd ZddZdd Zd d Z Z S) Configurator inc_convertZincNcs"tt|j||ptj|_dS)N)superrrr9rr@)rconfigr@) __class__r!r"rszConfigurator.__init__c sfddjd}t|s*j|}jdd}jdf}|r\tfdd|D}fddD}t|}|||}|rx$|jD]\}} t||| qW|S) Ncszt|ttfr*t|fdd|D}nLt|trld|krHj|}qvi}x(|D]}||||<qRWn j|}|S)Ncsg|] }|qSr!r!)r%r)convertr!r"r&szBConfigurator.configure_custom..convert..z())rOrrJtypedictconfigure_customr)or4rq)rrr!r"rs    z.Configurator.configure_custom..convertz()rz[]csg|] }|qSr!r!)r%r)rr!r"r&sz1Configurator.configure_custom..cs$g|]}t|r||fqSr!)r)r%rq)rrr!r"r&s)rBrrrJrrgsetattr) rrrUZpropsr3rgr4r4rrrr!)rrrr"rs     zConfigurator.configure_customcCs4|j|}t|tr0d|kr0|j||j|<}|S)Nz())rrOrr)rrXr4r!r!r" __getitem__s zConfigurator.__getitem__c CsFtjj|stjj|j|}tj|ddd}tj|}WdQRX|S)z*Default converter for the inc:// protocol.rzutf-8)rN) r9r:isabsr0r@rbrrerf)rrtrr4r!r!r"rs  zConfigurator.inc_convert)N) rrrrrZvalue_convertersrrrr __classcell__r!r!)rr"rs  rc@s&eZdZd ddZddZddZdS) SubprocessMixinFNcCs||_||_dS)N)verboseprogress)rrrr!r!r"r+szSubprocessMixin.__init__cCsn|j}|j}xT|j}|sP|dk r0|||q|sBtjjdntjj|jdtjjqW|jdS)z Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. Nrzutf-8) rrreadlinerJstderrrzr]flushrl)rr_rrrr3r!r!r"r/s zSubprocessMixin.readercKstj|ftjtjd|}tj|j|jdfd}|jtj|j|jdfd}|j|j |j |j |j dk r|j ddn|j rt jjd|S)N)stdoutrr)rr3rzdone.mainzdone. ) subprocessPopenPIPE threadingZThreadrrr rwaitr0rrrJrz)rcmdr4rTZt1Zt2r!r!r" run_commandDs   zSubprocessMixin.run_command)FN)rrrrrrr!r!r!r"r*s rcCstjdd|jS)z,Normalize a python package name a la PEP 503z[-_.]+r )r subrQ)r'r!r!r"normalize_nameUsr)NN)r)N)N)rVrWrXrYrZr[r\)NT)r$rvrwrxryrz)rr)rb collectionsr contextlibrZglobrrrqreZloggingr9rr rrr ImportErrorrrJrhr|rmrZdummy_threadingrr$rcompatrrr r r r r rrrrrrrrrrrrZ getLoggerrrCOMMArr1ZIDENTZ EXTRA_IDENTZVERSPECZRELOPZBARE_CONSTRAINTSZ DIRECT_REFZ CONSTRAINTSZ EXTRA_LISTZEXTRASZ REQUIREMENTr+Z RELOP_IDENTr.r6rGrLrPrVrYrur{contextmanagerrrrrrrrrrVERBOSErrhrrrrrrIrr rrrrrrr r"r#r+r6ZARCHIVE_EXTENSIONSrprurr{rrrrrrrrrrrarrrrrrrrrrrrrr!r!r!r"s      X   ,   %   /  7  )     ,H  C]    *)  :+distlib/__pycache__/index.cpython-36.pyc000064400000041620152347724720014163 0ustar003 Pf]R @sddlZddlZddlZddlZddlZddlZyddlmZWn ek r`ddl mZYnXddl m Z ddl m Z mZmZmZmZmZddlmZmZmZejeZdZdZGd d d eZdS) N)Thread)DistlibException)HTTPBasicAuthHandlerRequestHTTPPasswordMgrurlparse build_opener string_types)cached_propertyzip_dir ServerProxyzhttps://pypi.python.org/pypipypic@seZdZdZdZd*ddZddZdd Zd d Zd d Z ddZ ddZ d+ddZ d,ddZ d-ddZd.ddZddZd/ddZd0d d!Zd1d"d#Zd$d%Zd&d'Zd2d(d)ZdS)3 PackageIndexzc This class represents a package index compatible with PyPI, the Python Package Index. s.----------ThIs_Is_tHe_distlib_index_bouNdaRY_$Nc Cs|pt|_|jt|j\}}}}}}|s<|s<|s<|d krJtd|jd|_d|_d|_d|_d|_ t t j dR}xJd D]B} y(t j| dg||d } | d kr| |_PWq|tk rYq|Xq|WWdQRXdS) z Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used. httphttpszinvalid repository: %sNwgpggpg2z --version)stdoutstderrr)rr)rr) DEFAULT_INDEXurlread_configurationrrpassword_handler ssl_verifierrgpg_home rpc_proxyopenosdevnull subprocessZ check_callOSError) selfrschemenetlocpathZparamsZqueryZfragZsinksrcr)/usr/lib/python3.6/index.py__init__$s(   zPackageIndex.__init__cCs&ddlm}ddlm}|}||S)zs Get the distutils command for interacting with PyPI configurations. :return: the command. r) Distribution) PyPIRCCommand)Zdistutils.corer,Zdistutils.configr-)r#r,r-dr)r)r*_get_pypirc_commandBs  z PackageIndex._get_pypirc_commandcCsR|j}|j|_|j}|jd|_|jd|_|jdd|_|jd|j|_dS)z Read the PyPI access configuration as supported by distutils, getting PyPI to do the actual work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration. usernamepasswordrealmr repositoryN)r/rr3Z _read_pypircgetr0r1r2)r#cZcfgr)r)r*rLs  zPackageIndex.read_configurationcCs$|j|j}|j|j|jdS)z Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work. N)check_credentialsr/Z _store_pypircr0r1)r#r5r)r)r*save_configuration[szPackageIndex.save_configurationcCs\|jdks|jdkrtdt}t|j\}}}}}}|j|j||j|jt||_ dS)zp Check that ``username`` and ``password`` have been set, and raise an exception if not. Nz!username and password must be set) r0r1rrrrZ add_passwordr2rr)r#Zpm_r%r)r)r*r6gs zPackageIndex.check_credentialscCs\|j|j|j}d|d<|j|jg}|j|}d|d<|j|jg}|j|S)aq Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request. Zverifyz:actionZsubmit)r6validatetodictencode_requestitems send_request)r#metadatar.requestZresponser)r)r*registerss  zPackageIndex.registercCsJx<|j}|sP|jdj}|j|tjd||fqW|jdS)ar Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to. zutf-8z%s: %sN)readlinedecoderstripappendloggerdebugclose)r#namestreamZoutbufr'r)r)r*_readers  zPackageIndex._readercCs|jdddg}|dkr|j}|r.|jd|g|dk rF|jdddgtj}tjj|tjj|d }|jd d d |d ||gt j ddj|||fS)a Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. z --status-fd2z--no-ttyNz --homedirz--batchz--passphrase-fd0z.ascz --detach-signz--armorz --local-userz--outputz invoking: %s ) rrextendtempfileZmkdtemprr&joinbasenamerErF)r#filenamesigner sign_passwordkeystorecmdZtdZsfr)r)r*get_sign_commands zPackageIndex.get_sign_commandc Cstjtjd}|dk r tj|d<g}g}tj|f|}t|jd|j|fd}|jt|jd|j|fd}|j|dk r|jj ||jj |j |j |j |j ||fS)a Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit code, a list of lines read from the subprocess' ``stdout``, and a list of lines read from the subprocess' ``stderr``. )rrNstdinr)targetargsr)r!PIPEPopenrrJrstartrrXwriterGwaitrP returncode) r#rVZ input_datakwargsrrpZt1Zt2r)r)r* run_commands$     zPackageIndex.run_commandc CsD|j||||\}}|j||jd\}}} |dkr@td||S)aR Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The absolute pathname of the file where the signature is stored. zutf-8rz&sign command failed with error code %s)rWrcencoder) r#rRrSrTrUrVsig_filer(rrr)r)r* sign_files  zPackageIndex.sign_filesdistsourcecCs(|jtjj|s td||j|j}d} |rZ|jsJtj dn|j ||||} t |d} | j } WdQRXt j| j} t j| j} |jdd||| | ddtjj|| fg}| rt | d} | j }WdQRX|jd tjj| |ftjtjj| |j|j|}|j|S) a Upload a release file to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the file to be uploaded. :param filename: The pathname of the file to be uploaded. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param filetype: The type of the file being uploaded. This is the distutils command which produced that file, e.g. ``sdist`` or ``bdist_wheel``. :param pyversion: The version of Python which the release relates to. For code compatible with any Python, this would be ``source``, otherwise it would be e.g. ``3.2``. :param keystore: The path to a directory which contains the keys used in signing. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The HTTP response received from PyPI upon submission of the request. z not found: %sNz)no signing program available - not signedrbZ file_upload1)z:actionZprotocol_versionfiletype pyversion md5_digest sha256_digestcontentZ gpg_signature)r6rr&existsrr9r:rrEZwarningrfrreadhashlibmd5 hexdigestZsha256updaterQrDshutilZrmtreedirnamer;r<r=)r#r>rRrSrTrkrlrUr.refZ file_datarmrnfilesZsig_datar?r)r)r* upload_files>       zPackageIndex.upload_filec Cs|jtjj|s td|tjj|d}tjj|sFtd||j|j|j }}t |j }d d|fd|fg}d||fg}|j ||} |j | S) a2 Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request. znot a directory: %rz index.htmlz not found: %r:action doc_uploadrHversionro)r{r|)r6rr&isdirrrPrpr9rHr}r getvaluer;r=) r#r>Zdoc_dirfnrHr}Zzip_datafieldsryr?r)r)r*upload_documentation)s        z!PackageIndex.upload_documentationcCsT|jdddg}|dkr|j}|r.|jd|g|jd||gtjddj||S) a| Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. z --status-fdrKz--no-ttyNz --homedirz--verifyz invoking: %srM)rrrNrErFrP)r#signature_filename data_filenamerUrVr)r)r*get_verify_commandEszPackageIndex.get_verify_commandcCsH|jstd|j|||}|j|\}}}|dkr@td||dkS)a6 Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :param keystore: The path to a directory which contains the keys used in verification. If not specified, the instance's ``gpg_home`` attribute is used instead. :return: True if the signature was verified, else False. z0verification unavailable because gpg unavailablerrz(verify command failed with error code %s)rr)rrrrc)r#rrrUrVr(rrr)r)r*verify_signature]szPackageIndex.verify_signaturecCsp|dkrd}tjdn6t|ttfr0|\}}nd}tt|}tjd|t|d}|jt |}z|j } d} d} d} d} d | krt | d } |r|| | | xP|j | }|sP| t |7} |j||r|j|| d7} |r|| | | qWWd|jXWdQRX| dkr4| | kr4td | | f|rl|j}||kr`td ||||ftjd |dS)a This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library. NzNo digest specifiedrszDigest specified: %swbi rrzcontent-lengthzContent-Lengthz1retrieval incomplete: got only %d out of %d bytesz.%s digest mismatch for %s: expected %s, got %szDigest verified: %s)rErF isinstancelisttuplegetattrrrrr=rinfointrqlenr^rurGrrt)r#rdestfileZdigestZ reporthookZdigesterZhasherZdfpZsfpheadersZ blocksizesizerqZblocknumblockactualr)r)r* download_filevsV             zPackageIndex.download_filecCs:g}|jr|j|j|jr(|j|jt|}|j|S)z Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). )rrDrr r)r#ZreqZhandlersopenerr)r)r*r=s  zPackageIndex.send_requestcCsg}|j}xX|D]P\}}t|ttfs,|g}x2|D]*}|jd|d|jdd|jdfq2WqWx6|D].\}} } |jd|d|| fjdd| fqjW|jd|ddfdj|} d|} | tt| d} t |j | | S) a& Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple. s--z)Content-Disposition: form-data; name="%s"zutf-8z8Content-Disposition: form-data; name="%s"; filename="%s"s smultipart/form-data; boundary=)z Content-typezContent-length) boundaryrrrrNrdrPstrrrr)r#rrypartsrkvaluesvkeyrRvalueZbodyZctrr)r)r*r;s2     zPackageIndex.encode_requestcCs>t|trd|i}|jdkr,t|jdd|_|jj||p:dS)NrHg@)Ztimeoutand)rr rr rsearch)r#Ztermsoperatorr)r)r*rs   zPackageIndex.search)N)N)N)N)NNrgrhN)N)N)NN)N)__name__ __module__ __qualname____doc__rr+r/rr7r6r@rJrWrcrfrzrrrrr=r;rr)r)r)r*rs*      #  8   M+r)rrZloggingrrvr!rOZ threadingr ImportErrorZdummy_threadingrcompatrrrrr r utilr r r Z getLoggerrrErZ DEFAULT_REALMobjectrr)r)r)r*s    distlib/__pycache__/version.cpython-36.opt-1.pyc000064400000050610152347724720015477 0ustar003 Pf\ @sZdZddlZddlZddlmZddddd d d d gZejeZGd d d e Z Gddde Z Gddde Z ejdZddZeZGddde ZddZGddde Zejddfejddfejddfejddfejd d!fejd"d!fejd#d$fejd%d&fejd'd(fejd)d*ff Zejd+dfejd,dfejd-d$fejd#d$fejd.dffZejd/Zd0d1Zd2d3Zejd4ejZd5d5d6d5d7ddd8Zd9d:ZGd;dde ZGdd?Z!d@dAZ"GdBd d e Z#GdCd d e Z$GdDdEdEe Z%e%eeee%eedFdGe%e"e$edHZ&e&dIe&dJ<dKd Z'dS)Lz~ Implementation of a flexible versioning scheme providing support for PEP-440, setuptools-compatible and semantic versioning. N) string_typesNormalizedVersionNormalizedMatcher LegacyVersion LegacyMatcherSemanticVersionSemanticMatcherUnsupportedVersionError get_schemec@seZdZdZdS)r zThis is an unsupported version.N)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/version.pyr sc@sxeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZeddZdS)VersioncCs"|j|_}|j||_}dS)N)strip_stringparse_parts)selfspartsrrr__init__szVersion.__init__cCs tddS)Nzplease implement in a subclass)NotImplementedError)rrrrrr$sz Version.parsecCs$t|t|kr td||fdS)Nzcannot compare %r and %r)type TypeError)rotherrrr_check_compatible'szVersion._check_compatiblecCs|j||j|jkS)N)rr)rrrrr__eq__+s zVersion.__eq__cCs |j| S)N)r )rrrrr__ne__/szVersion.__ne__cCs|j||j|jkS)N)rr)rrrrr__lt__2s zVersion.__lt__cCs|j|p|j| S)N)r"r )rrrrr__gt__6szVersion.__gt__cCs|j|p|j|S)N)r"r )rrrrr__le__9szVersion.__le__cCs|j|p|j|S)N)r#r )rrrrr__ge__<szVersion.__ge__cCs t|jS)N)hashr)rrrr__hash__@szVersion.__hash__cCsd|jj|jfS)Nz%s('%s')) __class__r r)rrrr__repr__CszVersion.__repr__cCs|jS)N)r)rrrr__str__FszVersion.__str__cCs tddS)NzPlease implement in subclasses.)r)rrrr is_prereleaseIszVersion.is_prereleaseN)r r rrrrr r!r"r#r$r%r'r)r*propertyr+rrrrrsrc @seZdZdZejdZejdZejdZddddddd dd dd dd dd ddZ ddZ ddZ e ddZ ddZddZddZddZddZdd ZdS)!MatcherNz^(\w[\s\w'.-]*)(\((.*)\))?z'^(<=|>=|<|>|!=|={2,3}|~=)?\s*([^\s,]+)$z ^\d+(\.\d+)*$cCs||kS)Nr)vcprrrWszMatcher.cCs||kS)Nr)r.r/r0rrrr1XscCs||kp||kS)Nr)r.r/r0rrrr1YscCs||kp||kS)Nr)r.r/r0rrrr1ZscCs||kS)Nr)r.r/r0rrrr1[scCs||kS)Nr)r.r/r0rrrr1\scCs||kp||kS)Nr)r.r/r0rrrr1^scCs||kS)Nr)r.r/r0rrrr1_s)<>z<=z>=z==z===z~=z!=c CsJ|jdkrtd|j|_}|jj|}|snsz$Matcher.__init__..,zInvalid %r in %rz~=rz.*==!=z#'.*' not allowed for %r constraintsTF)r9r:) version_class ValueErrorrrdist_rematchgroupsnamelowerkeysplitcomp_reendswithnum_reappendtupler) rrmr@ZclistZ constraintsr/opZvnprefixrrrrbs:           zMatcher.__init__cCszt|tr|j|}x`|jD]V\}}}|jj|}t|trFt||}|sbd||jjf}t |||||sdSqWdS)z Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. z%r not implemented for %sFT) isinstancerr<r _operatorsgetgetattrr(r r)rversionoperator constraintrLfmsgrrrr?s      z Matcher.matchcCs6d}t|jdkr2|jdddkr2|jdd}|S)Nrr=====)rVrW)lenr)rresultrrr exact_versions zMatcher.exact_versioncCs0t|t|ks|j|jkr,td||fdS)Nzcannot compare %s and %s)rrAr)rrrrrrszMatcher._check_compatiblecCs"|j||j|jko |j|jkS)N)rrCr)rrrrrr s zMatcher.__eq__cCs |j| S)N)r )rrrrrr!szMatcher.__ne__cCst|jt|jS)N)r&rCr)rrrrr'szMatcher.__hash__cCsd|jj|jfS)Nz%s(%r))r(r r)rrrrr)szMatcher.__repr__cCs|jS)N)r)rrrrr*szMatcher.__str__)r r rr<recompiler>rErGrNrr?r,rZrr r!r'r)r*rrrrr-Ns*    % r-zk^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?(\.(post)(\d+))?(\.(dev)(\d+))?(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$c Cs|j}tj|}|s"td||j}tdd|djdD}x(t|dkrn|ddkrn|dd}qHW|ds~d}n t|d}|dd}|d d }|d d }|d }|dkrf}n|dt|df}|dkrf}n|dt|df}|dkr f}n|dt|df}|dkr.f}nLg} x>|jdD]0} | j rZdt| f} nd| f} | j | q>Wt| }|s| r|rd}nd}|sd}|sd}||||||fS)NzNot a valid version: %scss|]}t|VqdS)N)int)r6r.rrr sz_pep_440_key..r.r az_finalrk)NN)NN)NNrk)rgrk)rh)ri)rj) rPEP440_VERSION_REr?r r@rIrDrXr]isdigitrH) rrJr@ZnumsZepochpreZpostdevZlocalrpartrrr _pep_440_keysT         rqc@s6eZdZdZddZedddddgZed d Zd S) raIA rational version. Good: 1.2 # equivalent to "1.2.0" 1.2.0 1.2a1 1.2.3a2 1.2.3b1 1.2.3c1 1.2.3.4 TODO: fill this out Bad: 1 # minimum two numbers 1.2a # release level must have a release serial 1.2.3b cCs<t|}tj|}|j}tdd|djdD|_|S)Ncss|]}t|VqdS)N)r])r6r.rrrr^sz*NormalizedVersion.parse..rr_)_normalized_keyrlr?r@rIrD_release_clause)rrrYrJr@rrrrs  zNormalizedVersion.parsergbr/rcrocstfddjDS)Nc3s |]}|r|djkVqdS)rN) PREREL_TAGS)r6t)rrrr^sz2NormalizedVersion.is_prerelease..)anyr)rr)rrr+szNormalizedVersion.is_prereleaseN) r r rrrsetrvr,r+rrrrrs cCs>t|}t|}||krdS|j|s*dSt|}||dkS)NTFr_)str startswithrX)xynrrr _match_prefix"s rc @sneZdZeZddddddddd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZdS)r_match_compatible _match_lt _match_gt _match_le _match_ge _match_eq_match_arbitrary _match_ne)z~=r2r3z<=z>=z==z===z!=cCsV|rd|ko|jd}n|jd o,|jd}|rN|jjddd}|j|}||fS)N+rrrkrkrk)rrrDr<)rrQrSrLZ strip_localrrrr _adjust_local<s zNormalizedMatcher._adjust_localcCsD|j|||\}}||krdS|j}djdd|D}t|| S)NFr_cSsg|] }t|qSr)rz)r6irrrr7Osz/NormalizedMatcher._match_lt..)rrsjoinr)rrQrSrLrelease_clausepfxrrrrJs zNormalizedMatcher._match_ltcCsD|j|||\}}||krdS|j}djdd|D}t|| S)NFr_cSsg|] }t|qSr)rz)r6rrrrr7Wsz/NormalizedMatcher._match_gt..)rrsrr)rrQrSrLrrrrrrRs zNormalizedMatcher._match_gtcCs|j|||\}}||kS)N)r)rrQrSrLrrrrZszNormalizedMatcher._match_lecCs|j|||\}}||kS)N)r)rrQrSrLrrrr^szNormalizedMatcher._match_gecCs.|j|||\}}|s ||k}n t||}|S)N)rr)rrQrSrLrYrrrrbs   zNormalizedMatcher._match_eqcCst|t|kS)N)rz)rrQrSrLrrrrjsz"NormalizedMatcher._match_arbitrarycCs0|j|||\}}|s ||k}n t|| }|S)N)rr)rrQrSrLrYrrrrms   zNormalizedMatcher._match_necCsf|j|||\}}||krdS||kr*dS|j}t|dkrH|dd}djdd|D}t||S)NTFrr_cSsg|] }t|qSr)rz)r6rrrrr7sz7NormalizedMatcher._match_compatible..rk)rrsrXrr)rrQrSrLrrrrrrus  z#NormalizedMatcher._match_compatibleN)r r rrr<rNrrrrrrrrrrrrrr-s$z[.+-]$r4z^[.](\d)z0.\1z^[.-]z ^\((.*)\)$z\1z^v(ersion)?\s*(\d+)z\2z^r(ev)?\s*(\d+)z[.]{2,}r_z\b(alfa|apha)\balphaz\b(pre-alpha|prealpha)\bz pre.alphaz \(beta\)$betaz ^[:~._+-]+z [,*")([\]]z[~:+_ -]z\.$z (\d+(\.\d+)*)cCsZ|jj}xtD]\}}|j||}qW|s2d}tj|}|sJd}|}n|jdjd}dd|D}xt|dkr|j dqlWt|dkr||j d}n8dj dd|ddD||j d}|dd}dj d d|D}|j}|rxt D]\}}|j||}qW|s*|}nd |kr8d nd }|||}t |sVd}|S) z Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. z0.0.0rr_cSsg|] }t|qSr)r])r6rrrrr7sz-_suggest_semantic_version..NcSsg|] }t|qSr)rz)r6rrrrr7scSsg|] }t|qSr)rz)r6rrrrr7sro-r)rrB _REPLACEMENTSsub_NUMERIC_PREFIXr?r@rDrXrHendr_SUFFIX_REPLACEMENTS is_semver)rrYZpatreplrJrLsuffixseprrr_suggest_semantic_versions:   ,   rcCsly t||Stk r YnX|j}xdBD]\}}|j||}q0Wtjdd|}tjdd|}tjdd|}tjdd|}tjdd|}|jdr|d d!}tjd"d|}tjd#d$|}tjd%d&|}tjd'd|}tjd(d)|}tjd*d)|}tjd+d |}tjd,d-|}tjd.d&|}tjd/d0|}tjd1d2|}y t|Wntk rfd!}YnX|S)CaSuggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on observation of versions currently in use on PyPI. Given a dump of those version during PyCon 2009, 4287 of them: - 2312 (53.93%) match NormalizedVersion without change with the automatic suggestion - 3474 (81.04%) match when using this suggestion method @param s {str} An irrational version string. @returns A rational version string, or None, if couldn't determine one. -alpharg-betartrrrur/-finalr4-pre-release.release-stablerr_ri .finalrjzpre$Zpre0zdev$Zdev0z([abc]|rc)[\-\.](\d+)$z\1\2z[\-\.](dev)[\-\.]?r?(\d+)$z.\1\2z[.~]?([abc])\.?z\1r.rNz\b0+(\d+)(?!\d)z (\d+[abc])$z\g<1>0z\.?(dev-r|dev\.r)\.?(\d+)$z.dev\2z-(a|b|c)(\d+)$z[\.\-](dev|devel)$z.dev0z(?![\.\-])dev$z(final|stable)$z\.?(r|-|-r)\.?(\d+)$z.post\2z\.?(dev|git|bzr)\.?(\d+)$z\.?(pre|preview|-c)(\d+)$zc\g<2>zp(\d+)$z.post\1rrgrrtrrgrrtrur/rr4rr/rr4rr4rr4rr_rir_rr4rr4rjr4)rrrrrrrrrrrrrrr)rrr rBreplacer[rr{)rZrsZorigrrrr_suggest_normalized_versionsH      rz([a-z]+|\d+|[\.-])r/zfinal-@)rnZpreviewrruror4r_cCs~dd}g}xh||D]\}|jdrh|dkrJx|rH|ddkrH|jq.Wx|rf|d dkrf|jqLW|j|qWt|S) NcSsxg}xdtj|jD]R}tj||}|rd|ddkoBdknrT|jd}nd|}|j|qW|jd|S)N0r9*z*final) _VERSION_PARTrDrB_VERSION_REPLACErOzfillrH)rrYr0rrr get_partsIs    z_legacy_key..get_partsrz*finalrz*final-Z00000000rkrk)r{poprHrI)rrrYr0rrr _legacy_keyHs    rc@s eZdZddZeddZdS)rcCst|S)N)r)rrrrrrcszLegacyVersion.parsecCs:d}x0|jD]&}t|tr |jdr |dkr d}Pq W|S)NFrz*finalT)rrMrr{)rrYr|rrrr+fs zLegacyVersion.is_prereleaseN)r r rrr,r+rrrrrbsc@s4eZdZeZeejZded<ej dZ ddZ dS)rrz~=z^(\d+(\.\d+)*)cCs`||kr dS|jjt|}|s2tjd||dS|jd}d|krV|jddd}t||S)NFzACannot compute compatible match for version %s and constraint %sTrr_r) numeric_rer?rzloggerZwarningr@rsplitr)rrQrSrLrJrrrrrys zLegacyMatcher._match_compatibleN) r r rrr<dictr-rNr[r\rrrrrrrqs   zN^(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+(\.[a-z0-9-]+)*)?(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$cCs tj|S)N) _SEMVER_REr?)rrrrrsrc Csndd}t|}|st||j}dd|ddD\}}}||dd||dd}}|||f||fS) NcSs8|dkr|f}n$|ddjd}tdd|D}|S)Nrr_cSs"g|]}|jr|jdn|qS)r)rmr)r6r0rrrr7sz5_semantic_key..make_tuple..)rDrI)rZabsentrYrrrr make_tuples z!_semantic_key..make_tuplecSsg|] }t|qSr)r])r6rrrrr7sz!_semantic_key..r|r)rr r@) rrrJr@majorminorZpatchrnZbuildrrr _semantic_keys rc@s eZdZddZeddZdS)rcCst|S)N)r)rrrrrrszSemanticVersion.parsecCs|jdddkS)Nrrr)r)rrrrr+szSemanticVersion.is_prereleaseN)r r rrr,r+rrrrrsc@seZdZeZdS)r N)r r rrr<rrrrr sc@s6eZdZd ddZddZddZdd Zd d ZdS) VersionSchemeNcCs||_||_||_dS)N)rCmatcher suggester)rrCrrrrrrszVersionScheme.__init__c Cs2y|jj|d}Wntk r,d}YnX|S)NTF)rr<r )rrrYrrris_valid_versions   zVersionScheme.is_valid_versionc Cs0y|j|d}Wntk r*d}YnX|S)NTF)rr )rrrYrrris_valid_matchers   zVersionScheme.is_valid_matchercCs|jd|S)z: Used for processing some metadata fields zdummy_name (%s))r)rrrrris_valid_constraint_listsz&VersionScheme.is_valid_constraint_listcCs|jdkrd}n |j|}|S)N)r)rrrYrrrsuggests  zVersionScheme.suggest)N)r r rrrrrrrrrrrs  rcCs|S)Nr)rrrrrr1sr1) normalizedlegacyZsemanticrdefaultcCs|tkrtd|t|S)Nzunknown scheme name: %r)_SCHEMESr=)rArrrr s )(rZloggingr[compatr__all__Z getLoggerr rr=r objectrr-r\rlrqrrrrrrrrrrIrrrrrrrrrr rrr rrrr sz  1k =$ W             .r $  distlib/__pycache__/database.cpython-36.opt-1.pyc000064400000122116152347724720015557 0ustar003 Pf@sdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlmZddlmZmZddlmZmZmZdd lmZmZmZmZmZmZmZd d d d dgZ ej!e"Z#dZ$dZ%deddde$dfZ&dZ'Gddde(Z)Gddde(Z*Gdd d e(Z+Gdd d e+Z,Gdd d e,Z-Gdd d e,Z.e-Z/e.Z0Gddde(Z1d)d!d"Z2d#d$Z3d%d&Z4d'd(Z5dS)*zPEP 376 implementation.)unicode_literalsN)DistlibException resources)StringIO) get_schemeUnsupportedVersionError)MetadataMETADATA_FILENAMEWHEEL_METADATA_FILENAME)parse_requirementcached_propertyparse_name_and_version read_exports write_exports CSVReader CSVWriter DistributionBaseInstalledDistributionInstalledDistributionEggInfoDistributionDistributionPathzpydist-exports.jsonzpydist-commands.jsonZ INSTALLERRECORD REQUESTED RESOURCESSHAREDz .dist-infoc@s(eZdZdZddZddZddZdS) _CachezL A simple cache mapping names and .dist-info paths to distributions cCsi|_i|_d|_dS)zZ Initialise an instance. There is normally one for each DistributionPath. FN)namepath generated)selfr!/usr/lib/python3.6/database.py__init__0sz_Cache.__init__cCs|jj|jjd|_dS)zC Clear the cache, setting it to its initial state. FN)rclearrr)r r!r!r"r$8s  z _Cache.clearcCs2|j|jkr.||j|j<|jj|jgj|dS)z` Add a distribution to the cache. :param dist: The distribution to add. N)rr setdefaultkeyappend)r distr!r!r"add@s  z _Cache.addN)__name__ __module__ __qualname____doc__r#r$r)r!r!r!r"r,src@seZdZdZdddZddZdd ZeeeZd d Z d d Z ddZ e ddZ ddZddZdddZddZdddZdS)rzU Represents a set of distributions installed on a path (typically sys.path). NFcCsD|dkrtj}||_d|_||_t|_t|_d|_td|_ dS)a Create an instance from a path, optionally including legacy (distutils/ setuptools/distribute) distributions. :param path: The path to use, as a list of directories. If not specified, sys.path is used. :param include_egg: If True, this instance will look for and return legacy distributions as well as those based on PEP 376. NTdefault) sysr _include_dist _include_eggr_cache _cache_egg_cache_enabledr_scheme)r rZ include_eggr!r!r"r#Ns zDistributionPath.__init__cCs|jS)N)r4)r r!r!r"_get_cache_enabledbsz#DistributionPath._get_cache_enabledcCs ||_dS)N)r4)r valuer!r!r"_set_cache_enabledesz#DistributionPath._set_cache_enabledcCs|jj|jjdS)z, Clears the internal cache. N)r2r$r3)r r!r!r" clear_cachejs zDistributionPath.clear_cachec csTt}xF|jD]:}tj|}|dkr*q|jd}| s|j rDqt|j}x|D]}|j|}| sV|j|krvqV|jo|jt rt t g}x*|D] }t j ||} |j| } | rPqWqVtj| j} t| dd} WdQRXtjd|j|j|jt|j| |dVqV|jrV|jd rVtjd|j|j|jt|j|VqVWqWdS) zD Yield .dist-info and/or .egg(-info) distributions. Nlegacy)fileobjschemezFound %s)metadataenv .egg-info.egg)r@rA)setrrfinder_for_pathfindZ is_containersortedr0endswith DISTINFO_EXTr r posixpathjoin contextlibclosing as_streamr loggerdebugr)new_dist_classr1old_dist_class) r seenrfinderrZrsetentryZpossible_filenamesZmetadata_filenameZ metadata_pathZpydiststreamr>r!r!r"_yield_distributionsrs@            z%DistributionPath._yield_distributionscCst|jj }|jo|jj }|s"|rpx4|jD](}t|trH|jj|q,|jj|q,W|rdd|j_|rpd|j_dS)zk Scan the path for distributions and populate the cache with those that are found. TN)r2rr1r3rV isinstancerr))r Zgen_distZgen_eggr(r!r!r"_generate_caches  z DistributionPath._generate_cachecCs|jdd}dj||gtS)ao The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distribution name by replacing any runs of non- alphanumeric characters with a single ``'-'``. :type name: string :parameter version: is converted to a standard version string. Spaces become dots, and all other non-alphanumeric characters (except dots) become dashes, with runs of multiple dashes condensed to a single dash. :type version: string :returns: directory name :rtype: string-_)replacerIrG)clsrversionr!r!r"distinfo_dirnames z!DistributionPath.distinfo_dirnameccsj|js x^|jD] }|VqWnF|jx|jjjD] }|Vq6W|jrfx|jjjD] }|VqXWdS)a5 Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances N)r4rVrXr2rvaluesr1r3)r r(r!r!r"get_distributionss   z"DistributionPath.get_distributionscCsd}|j}|js6xj|jD]}|j|kr|}PqWnH|j||jjkr\|jj|d}n"|jr~||jjkr~|jj|d}|S)a= Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None`` Nr) lowerr4rVr&rXr2rr1r3)r rresultr(r!r!r"get_distributions   z!DistributionPath.get_distributionc csd}|dk rJy|jjd||f}Wn$tk rHtd||fYnXxd|jD]X}|j}xL|D]D}t|\}}|dkr||kr|VPqd||krd|j|rd|VPqdWqTWdS)a Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. :parameter version: a version specifier that indicates the version required, conforming to the format in ``PEP-345`` :type name: string :type version: string Nz%s (%s)zinvalid name or version: %r, %r)r5matcher ValueErrorrr`providesrmatch) r rr]rdr(providedpp_namep_verr!r!r"provides_distributions$  z&DistributionPath.provides_distributioncCs(|j|}|dkrtd||j|S)z5 Return the path to a resource file. Nzno distribution named %r found)rc LookupErrorget_resource_path)r r relative_pathr(r!r!r" get_file_paths  zDistributionPath.get_file_pathccs`xZ|jD]N}|j}||kr ||}|dk r@||krX||Vq x|jD] }|VqJWq WdS)z Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. N)r`exportsr_)r categoryrr(rSdvr!r!r"get_exported_entries"s z%DistributionPath.get_exported_entries)NF)N)N)r*r+r,r-r#r6r8propertyZ cache_enabledr9rVrX classmethodr^r`rcrlrprur!r!r!r"rJs  *  $ c@seZdZdZdZdZddZeddZeZ eddZ ed d Z d d Z ed dZ eddZeddZeddZeddZddZddZddZddZdS) rz A base class for distributions, whether installed or from indexes. Either way, it must have some metadata, so that's all that's needed for construction. FcCsL||_|j|_|jj|_|j|_d|_d|_d|_d|_t |_ i|_ dS)z Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. N) r>rrar&r]ZlocatordigestextrascontextrBZ download_urlsZdigests)r r>r!r!r"r#Gs zDistribution.__init__cCs|jjS)zH The source archive download URL for this distribution. )r> source_url)r r!r!r"r{XszDistribution.source_urlcCsd|j|jfS)zX A utility property which displays the name and version in parentheses. z%s (%s))rr])r r!r!r"name_and_versionaszDistribution.name_and_versioncCs.|jj}d|j|jf}||kr*|j||S)z A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. z%s (%s))r>rfrr]r')r Zplistsr!r!r"rfhs  zDistribution.providescCs8|j}tjd|jt||}t|j||j|jdS)Nz%Getting requirements from metadata %r)ryr?) r>rMrNZtodictgetattrrBZget_requirementsryrz)r Zreq_attrmdZreqtsr!r!r"_get_requirementsts   zDistribution._get_requirementscCs |jdS)N run_requires)r)r r!r!r"r{szDistribution.run_requirescCs |jdS)N meta_requires)r)r r!r!r"rszDistribution.meta_requirescCs |jdS)Nbuild_requires)r)r r!r!r"rszDistribution.build_requirescCs |jdS)N test_requires)r)r r!r!r"rszDistribution.test_requirescCs |jdS)N dev_requires)r)r r!r!r"rszDistribution.dev_requiresc Cst|}t|jj}y|j|j}Wn6tk rZtjd||j d}|j|}YnX|j }d}xJ|j D]@}t |\}} ||krqny|j | }PWqntk rYqnXqnW|S)z Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. z+could not read version %r - using name onlyrF)r rr>r=rd requirementrrMwarningsplitr&rfrrg) r reqrSr=rdrrbrirjrkr!r!r"matches_requirements*       z Distribution.matches_requirementcCs(|jrd|j}nd}d|j|j|fS)zC Return a textual representation of this instance, z [%s]r:z)r{rr])r suffixr!r!r"__repr__s zDistribution.__repr__cCs>t|t|k rd}n$|j|jko8|j|jko8|j|jk}|S)a< See if this distribution is the same as another. :param other: The distribution to compare with. To be equal to one another. distributions must have the same type, name, version and source_url. :return: True if it is the same, else False. F)typerr]r{)r otherrbr!r!r"__eq__s    zDistribution.__eq__cCst|jt|jt|jS)zH Compute hash in a way which matches the equality test. )hashrr]r{)r r!r!r"__hash__szDistribution.__hash__N)r*r+r,r-Zbuild_time_dependency requestedr#rvr{Z download_urlr|rfrrrrrrrrrrr!r!r!r"r5s$        " cs0eZdZdZdZdfdd ZdddZZS) rz] This is the base class for installed distributions (whether PEP 376 or legacy). Ncs tt|j|||_||_dS)a Initialise an instance. :param metadata: An instance of :class:`Metadata` which describes the distribution. This will normally have been initialised from a metadata file in the ``path``. :param path: The path of the ``.dist-info`` or ``.egg-info`` directory for the distribution. :param env: This is normally the :class:`DistributionPath` instance where this distribution was found. N)superrr#r dist_path)r r>rr?) __class__r!r"r#s z"BaseInstalledDistribution.__init__cCsd|dkr|j}|dkr"tj}d}ntt|}d|j}||j}tj|jdjd}d||fS)a Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and ``'sha512'``. If no hasher is specified, the ``hasher`` attribute of the :class:`InstalledDistribution` instance is used. If the hasher is determined to be ``None``, MD5 is used as the hashing algorithm. :returns: The hash of the data. If a hasher was explicitly specified, the returned hash will be prefixed with the specified hasher followed by '='. :rtype: str Nr:z%s==asciiz%s%s) hasherhashlibmd5r~rxbase64Zurlsafe_b64encoderstripdecode)r datarprefixrxr!r!r"get_hashs   z"BaseInstalledDistribution.get_hash)N)N)r*r+r,r-rr#r __classcell__r!r!)rr"rscseZdZdZdZd'fdd ZddZdd Zd d Ze d d Z ddZ ddZ ddZ ddZd(ddZddZe ddZd)ddZdd Zd!d"Zd#d$Zd%d&ZejZZS)*ra  Created with the *path* of the ``.dist-info`` directory provided to the constructor. It reads the metadata contained in ``pydist.json`` when it is instantiated., or uses a passed in Metadata instance (useful for when dry-run mode is being used). Zsha256Ncs0tj||_}|dkr(ddl}|j|rN|jrN||jjkrN|jj|j}nt|dkr|j t }|dkrr|j t }|dkr|j d}|dkrt dt |ft j|j}t|dd}WdQRXtt|j||||r|jr|jj|y|j d}Wn&tk r ddl}|jYnX|dk |_dS)NrZMETADATAzno %s found in %sr;)r<r=r)rrCrRpdbZ set_tracer4r2rr>rDr r rerJrKrLr rrr#r)AttributeErrorr)r rr>r?rRrrSrU)rr!r"r#s4      zInstalledDistribution.__init__cCsd|j|j|jfS)Nz#)rr]r)r r!r!r"r2szInstalledDistribution.__repr__cCsd|j|jfS)Nz%s %s)rr])r r!r!r"__str__6szInstalledDistribution.__str__c Csg}|jd}tj|j`}t|dJ}xB|D]:}ddtt|dD}||\}}} |j||| fq0WWdQRXWdQRX|S)a" Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). r)rUcSsg|]}dqS)Nr!).0ir!r!r" Hsz6InstalledDistribution._get_records..N)get_distinfo_resourcerJrKrLrrangelenr') r resultsrSrUZ record_readerrowmissingrchecksumsizer!r!r" _get_records9s   (z"InstalledDistribution._get_recordscCsi}|jt}|r|j}|S)a Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. )rEXPORTS_FILENAMEr)r rbrSr!r!r"rqPs  zInstalledDistribution.exportsc Cs8i}|jt}|r4tj|j}t|}WdQRX|S)z Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. N)rrrJrKrLr)r rbrSrUr!r!r"r^s  z"InstalledDistribution.read_exportsc Cs.|jt}t|d}t||WdQRXdS)a Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. wN)get_distinfo_fileropenr)r rqZrffr!r!r"rms  z#InstalledDistribution.write_exportscCsh|jd}tj|j:}t|d$}x|D]\}}||kr,|Sq,WWdQRXWdQRXtd|dS)aW NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be found. r)rUNz3no resource file with relative path %r is installed)rrJrKrLrKeyError)r rorSrUZresources_readerZrelativeZ destinationr!r!r"rnxs  z'InstalledDistribution.get_resource_pathccsx|jD] }|Vq WdS)z Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) N)r)r rbr!r!r"list_installed_filessz*InstalledDistribution.list_installed_filesFc Cs,tjj|d}tjj|j}|j|}tjj|d}|jd}tjd||rRdSt|}x|D]}tjj |s||j d rd} } n4dtjj |} t |d} |j | j} WdQRX|j|s|r|j|rtjj||}|j|| | fqbW|j|rtjj||}|j|ddfWdQRX|S) z Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. r:rz creating %sN.pyc.pyoz%drb)rr)osrrIdirname startswithrrMinforisdirrFgetsizerrreadrelpathZwriterow) r pathsrdry_runbaseZbase_under_prefix record_pathwriterr hash_valuerfpr!r!r"write_installed_filess.         z+InstalledDistribution.write_installed_filesc Csg}tjj|j}|jd}x|jD]\}}}tjj|sLtjj||}||krVq(tjj|sv|j|dddfq(tjj |r(t tjj |}|r||kr|j|d||fq(|r(d|kr|j ddd}nd }t |d 2} |j| j|} | |kr |j|d || fWd QRXq(W|S) a Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. rexistsTFr=rrNrr)rrrrrisabsrIrr'isfilestrrrrrr) r mismatchesrrrrrZ actual_sizerrZ actual_hashr!r!r"check_installed_filess.         z+InstalledDistribution.check_installed_filesc Csi}tjj|jd}tjj|rtj|ddd}|jj}WdQRXx@|D]8}|jdd\}}|dkr~|j |gj |qN|||<qNW|S) a A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any paths selected by the user at installation time (e.g. via command-line arguments). In the case of the 'namespace' key, this would be a list of absolute paths for the roots of namespace packages in this distribution. The first time this property is accessed, the relevant information is read from the SHARED file in the .dist-info directory. rrSzutf-8)encodingNrr namespace) rrrIrcodecsrr splitlinesrr%r')r rb shared_pathrlinesliner&r7r!r!r"shared_locationss   z&InstalledDistribution.shared_locationsc Cstjj|jd}tjd||r$dSg}x6dD].}||}tjj||r.|jd ||fq.Wx"|jd fD]}|jd |qnWtj |d d d}|j dj|WdQRX|S)aa Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is actually written. :return: The path of the file written to. rz creating %sNrlibheadersscriptsrz%s=%srz namespace=%srzutf-8)r )rrrrr) rrrIrMrrr'getrrwrite) r rrrrr&rnsrr!r!r"write_shared_locationss   z,InstalledDistribution.write_shared_locationscCsF|tkrtd||jftj|j}|dkr.set_name_and_version) rrr4r3r>rr] _get_metadatar)rrr#)r rr?rr>)rr!r"r#Ws   zEggInfoDistribution.__init__c s2d}ddfdd}|jdrtjj|rdtjj|dd}t|dd }tjj|dd }||}n`tj|}t|j d j d }t|dd }y|j d} | j d}Wnt k rd}YnXnX|jdrtjj|rtjj|d }||}tjj|d}t|dd }n t d||r.|j ||S)NcSsg}|j}x|D]}|j}|jdr6tjd|Pt|}|sPtjd|q|jr`tjd|jst|j|j qdj dd|jD}|jd|j |fqW|S) zCreate a list of dependencies from a requires.txt file. *data*: the contents of a setuptools-produced requires.txt file. [z.Unexpected line: quitting requirement scan: %rz#Not recognised as a requirement: %rz4extra requirements in requires.txt are not supportedz, css|]}d|VqdS)z%s%sNr!)rcr!r!r" szQEggInfoDistribution._get_metadata..parse_requires_data..z%s (%s)) rstriprrMrr ryZ constraintsr'rrI)rreqsrrrSZconsr!r!r"parse_requires_dataos&    z>EggInfoDistribution._get_metadata..parse_requires_datacsHg}y*tj|dd}|j}WdQRXWntk rBYnX|S)zCreate a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. rSzutf-8N)rrrIOError)req_pathrr)rr!r"parse_requires_pathsz>EggInfoDistribution._get_metadata..parse_requires_pathz.eggzEGG-INFOzPKG-INFOr;)rr=z requires.txtzEGG-INFO/PKG-INFOutf8)r<r=zEGG-INFO/requires.txtzutf-8z .egg-infoz,path must end with .egg-info or .egg, got %r)rFrrrrIr zipimport zipimporterrget_datarrrZadd_requirements) r rrequiresr meta_pathr>rZzipfr<rr!)rr"rls:           z!EggInfoDistribution._get_metadatacCsd|j|j|jfS)Nz!)rr]r)r r!r!r"rszEggInfoDistribution.__repr__cCsd|j|jfS)Nz%s %s)rr])r r!r!r"rszEggInfoDistribution.__str__cCsdg}tjj|jd}tjj|r`x>|jD]2\}}}||kr>q*tjj|s*|j|dddfq*W|S)a Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. zinstalled-files.txtrTF)rrrIrrr')r rrrrZr!r!r"rs   z)EggInfoDistribution.check_installed_filesc Csdd}dd}tjj|jd}g}tjj|rtj|ddd|}xt|D]l}|j}tjjtjj|j|}tjj|stj d ||j d rqHtjj |sH|j |||||fqHWWd QRX|j |d d f|S)z Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) c Ss0t|d}z |j}Wd|jXtj|jS)Nr)rrcloserrZ hexdigest)rrZcontentr!r!r"_md5s    z6EggInfoDistribution.list_installed_files.._md5cSs tj|jS)N)rstatst_size)rr!r!r"_sizesz7EggInfoDistribution.list_installed_files.._sizezinstalled-files.txtrSzutf-8)rzNon-existent file: %s.pyc.pyoN)rr) rrrIrrrrnormpathrMrrFrr')r rrrrbrrrir!r!r"rs"      &z(EggInfoDistribution.list_installed_filesFc cstjj|jd}d}tj|dddd}x\|D]T}|j}|dkrFd}q,|s,tjjtjj|j|}|j|jr,|rz|Vq,|Vq,WWdQRXdS) a  Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed into a local absolute path. Otherwise the raw value from ``installed-files.txt`` is returned. :type absolute: boolean :returns: iterator of paths zinstalled-files.txtTrSzutf-8)rz./FN)rrrIrrrrr)r Zabsoluterskiprrrir!r!r"rs   z'EggInfoDistribution.list_distinfo_filescCst|to|j|jkS)N)rWrr)r rr!r!r"rs zEggInfoDistribution.__eq__)N)F)r*r+r,r-rrr#rrrrrrrrrrr!r!)rr"rNsK& c@s^eZdZdZddZddZdddZd d Zd d ZdddZ dddZ ddZ ddZ dS)DependencyGrapha Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions. cCsi|_i|_i|_dS)N)adjacency_list reverse_listr)r r!r!r"r#.szDependencyGraph.__init__cCsg|j|<g|j|<dS)zAdd the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` N)rr)r distributionr!r!r"add_distribution3s z DependencyGraph.add_distributionNcCs6|j|j||f||j|kr2|j|j|dS)aAdd an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type label: ``str`` or ``None`` N)rr'r)r xylabelr!r!r"add_edge=s zDependencyGraph.add_edgecCs&tjd|||jj|gj|dS)a Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str`` z %s missing %rN)rMrNrr%r')r rrr!r!r" add_missingLszDependencyGraph.add_missingcCsd|j|jfS)Nz%s %s)rr])r r(r!r!r" _repr_distWszDependencyGraph._repr_distrcCs|j|g}xv|j|D]h\}}|j|}|dk r>d||f}|jd|t||j||d}|jd}|j|ddqWdj|S)zPrints only a subgraphNz%s [%s]z rr)rrr'r repr_noderextendrI)r r(leveloutputrr Z suboutputZsubsr!r!r"rZs    zDependencyGraph.repr_nodeTcCsg}|jdx||jjD]n\}}t|dkr>| r>|j|xH|D]@\}}|dk rn|jd|j|j|fqD|jd|j|jfqDWqW| rt|dkr|jd|jd|jdx&|D]}|jd |j|jd qW|jd |jd dS) a9Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool`` zdigraph dependencies { rNz"%s" -> "%s" [label="%s"] z "%s" -> "%s" zsubgraph disconnected { zlabel = "Disconnected" zbgcolor = red z"%s"rz} )rritemsrr'r)r rZskip_disconnectedZ disconnectedr(adjsrr r!r!r"to_dotgs&        zDependencyGraph.to_dotcsg}i}x&|jjD]\}}|dd||<qWxgx4t|jddD]\}}|sLj|||=qLWsrPx*|jD]\}}fdd|D||<q|WtjdddD|jq2W|t|jfS)aa Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they have circular dependencies and so form a cycle. Ncs g|]\}}|kr||fqSr!r!)rrsrS) to_remover!r"rsz4DependencyGraph.topological_sort..zMoving to result: %scSsg|]}d|j|jfqS)z%s (%s))rr])rrsr!r!r"rs)rrlistr'rMrNrkeys)r rbZalistkrtr!)rr"topological_sorts$  z DependencyGraph.topological_sortcCs6g}x&|jjD]\}}|j|j|qWdj|S)zRepresentation of the graphr)rrr'rrI)r rr(rr!r!r"rszDependencyGraph.__repr__)N)r)T) r*r+r,r-r#r r rrrrrrr!r!r!r"rs   rr.cCsft|}t}i}xX|D]P}|j|x@|jD]6}t|\}}tjd||||j|gj||fq.WqWx|D]}|j |j B|j B|j B}x|D]} y|j | } Wn6tk rtjd| | jd}|j |} YnX| j}d} ||krJxV||D]J\}} y| j|} Wntk r,d} YnX| r|j|| | d} PqW| s|j|| qWqrW|S)a6Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance zAdd to provided: %s, %s, %sz+could not read version %r - using name onlyrFT)rrr rfrrMrNr%r'rrrrrdrrrr&rgr r)distsr=graphrhr(rirr]rrrdZmatchedZproviderrgr!r!r" make_graphsD         rcCs~||krtd|jt|}|g}|j|}x@|rn|j}|j|x$|j|D]}||krR|j|qRWq0W|jd|S)zRecursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested z1given distribution %r is not a member of the listr)rrrrpopr')rr(rZdeptodorsZsuccr!r!r"get_dependent_distss    r!cCsv||krtd|jt|}g}|j|}xD|rp|jd}|j|x$|j|D]}||krT|j|qTWq.W|S)zRecursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested z1given distribution %r is not a member of the listr)rrrrrr')rr(rrr rsZpredr!r!r"get_required_distss    r"cKs4|jdd}tf|}||_||_|p(d|_t|S)zO A convenience method for making a dist given just a name and version. summaryzPlaceholder for summary)rr rr]r#r)rr]kwargsr#rr!r!r" make_dists    r%)r.)6r-Z __future__rrrrJrZloggingrrHr/rr:rrcompatrr]rrr>r r r utilr r rrrrr__all__Z getLoggerr*rMrZCOMMANDS_FILENAMErrGrrrrrrrrOrPrrr!r"r%r!r!r!r"sV  $  l7GM 6distlib/__pycache__/locators.cpython-36.pyc000064400000113170152347724720014702 0ustar003 PfE@s@ddlZddlmZddlZddlZddlZddlZddlZy ddlZWne k rdddl ZYnXddl Z ddl m Z ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.dd l/m0Z0m1Z1dd l2m3Z3m4Z4ej5e6Z7ej8d Z9ej8d ej:Z;ej8d ZGdddeZ?Gddde@ZAGdddeAZBGdddeAZCGddde@ZDGdddeAZEGdddeAZFGdd d eAZGGd!d"d"eAZHGd#d$d$eAZIeIeGeEd%d&d'd(d)ZJeJjKZKej8d*ZLGd+d,d,e@ZMdS).N)BytesIO)DistlibException)urljoinurlparse urlunparse url2pathname pathname2urlqueuequoteunescape string_types build_openerHTTPRedirectHandler text_typeRequest HTTPErrorURLError) DistributionDistributionPath make_dist)Metadata) cached_propertyparse_credentials ensure_slashsplit_filenameget_project_dataparse_requirementparse_name_and_version ServerProxynormalize_name) get_schemeUnsupportedVersionError)Wheel is_compatiblez^(\w+)=([a-f0-9]+)z;\s*charset\s*=\s*(.*)\s*$ztext/html|application/x(ht)?mlzhttps://pypi.python.org/pypicCs |dkr t}t|dd}|jS)z Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names. Ng@)timeout) DEFAULT_INDEXr list_packages)urlclientr*/usr/lib/python3.6/locators.pyget_all_distribution_names)s r,c@s$eZdZdZddZeZZZdS)RedirectHandlerzE A class to work around a bug in some Python 3.2.x releases. c Csd}xdD]}||kr ||}Pq W|dkr0dSt|}|jdkrpt|j|}t|drh|j||n|||<tj||||||S)Nlocationurireplace_header)r.r/)rschemerZ get_full_urlhasattrr1BaseRedirectHandlerhttp_error_302) selfreqfpcodemsgheadersZnewurlkeyZurlpartsr*r*r+r5=s   zRedirectHandler.http_error_302N)__name__ __module__ __qualname____doc__r5Zhttp_error_301Zhttp_error_303Zhttp_error_307r*r*r*r+r-4sr-c@seZdZdZd/Zd0Zd1Zd Zed2Zd3ddZ ddZ ddZ ddZ ddZ ddZee eZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd4d-d.Zd S)5LocatorzG A base class for locators - things that locate distributions. .tar.gz.tar.bz2.tar.zip.tgz.tbz.egg.exe.whl.pdfNdefaultcCs,i|_||_tt|_d|_tj|_dS)a^ Initialise an instance. :param scheme: Because locators look for most recent versions, they need to know the version scheme to use. This specifies the current PEP-recommended scheme - use ``'legacy'`` if you need to support existing distributions on PyPI. N) _cacher2rr-openermatcherr Queueerrors)r6r2r*r*r+__init__cs  zLocator.__init__c CsXg}xN|jjsRy|jjd}|j|Wn|jjk rDwYnX|jjqW|S)z8 Return any errors which have occurred. F)rQemptygetappendZEmpty task_done)r6resulter*r*r+ get_errorsvs  zLocator.get_errorscCs |jdS)z> Clear any errors which may have been logged. N)rY)r6r*r*r+ clear_errorsszLocator.clear_errorscCs|jjdS)N)rMclear)r6r*r*r+ clear_cacheszLocator.clear_cachecCs|jS)N)_scheme)r6r*r*r+ _get_schemeszLocator._get_schemecCs ||_dS)N)r])r6valuer*r*r+ _set_schemeszLocator._set_schemecCs tddS)a= For a given project, get a dictionary mapping available versions to Distribution instances. This should be implemented in subclasses. If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. z Please implement in the subclassN)NotImplementedError)r6namer*r*r+ _get_projects zLocator._get_projectcCs tddS)zJ Return all the distribution names known to this locator. z Please implement in the subclassN)ra)r6r*r*r+get_distribution_namesszLocator.get_distribution_namescCsL|jdkr|j|}n2||jkr,|j|}n|j|j|}||j|<|S)z For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top. N)rMrcrZ)r6rbrWr*r*r+ get_projects      zLocator.get_projectcCsPt|}tj|j}d}|jd}|r6tt||j}|jdkd|j k|||fS)zu Give an url a score which can be used to choose preferred URLs for a given project release. Tz.whlhttpszpypi.python.org) r posixpathbasenamepathendswithr$r# wheel_tagsr2netloc)r6r(trhZ compatibleZis_wheelr*r*r+ score_urls  zLocator.score_urlcCsR|}|rN|j|}|j|}||kr(|}||kr@tjd||ntjd|||S)a{ Choose one of two URLs where both are candidates for distribution archives for the same version of a distribution (for example, .tar.gz vs. zip). The current implementation favours https:// URLs over http://, archives from PyPI over those from other locations, wheel compatibility (if a wheel) and then the archive name. zNot replacing %r with %rzReplacing %r with %r)rnloggerdebug)r6url1url2rWs1s2r*r*r+ prefer_urls   zLocator.prefer_urlcCs t||S)zZ Attempt to split a filename in project name, version and Python version. )r)r6filename project_namer*r*r+rszLocator.split_filenamecCsdd}d}t|\}}}}} } | jjdr.same_projectNzegg=z %s: version hint in fragment: %rr/z.whlTr0z, cSs"g|]}djt|ddqS).N)joinlist).0vr*r*r+ sz8Locator.convert_url_to_download_info..)rbversionrvr(zpython-versionzinvalid path for wheel: %sz No match for project/version: %s)rbrrvr(zpython-versionz %s_digest)NNr)rlower startswithrorp HASHER_HASHmatchgroupsrjr#r$rkrbrrvrr|pyver Exceptionwarningdownloadable_extensionsrgrhlenr)r6r(rwrxrWr2rlriparamsqueryfragmalgodigestZorigpathwheelincluderXrvZextrmrbrrr*r*r+convert_url_to_download_infosf            z$Locator.convert_url_to_download_infocCs4d}x*dD]"}d|}||kr |||f}Pq W|S)z Get a digest from a dictionary by looking at keys of the form 'algo_digest'. Returns a 2-tuple (algo, digest) if found, else None. Currently looks only for SHA256, then MD5. Nsha256md5z %s_digest)rrr*)r6inforWrr<r*r*r+ _get_digest)s  zLocator._get_digestc Cs|jd}|jd}||kr,||}|j}nt|||jd}|j}|j||_}|d}||d|<|j|dkr|j|j||_|dj|t j |||_ |||<dS)z Update a result dictionary (the final result from _get_project) with a dictionary for a specific version, which typically holds information gleaned from a filename or URL for an archive for the distribution. rbr)r2r(digestsurlsN) popmetadatarr2rr source_urlru setdefaultsetaddlocator) r6rWrrbrdistmdrr(r*r*r+_update_version_data9s   zLocator._update_version_dataFc Csd}t|}|dkr td|t|j}|j|j|_}tjd|t|j |j |j }t |dkr8g}|j } x|D]|} | d krqzyJ|j| stjd|| n,|s| | j r|j| ntjd| |j Wqztk rtjd || YqzXqzWt |d krt||jd }|r8tjd ||d} || }|r|jrN|j|_|jdij| t|_i} |jdi} x&|jD]}|| kr~| || |<q~W| |_d|_|S)a Find the most recent distribution which matches the given requirement. :param requirement: A requirement of the form 'foo (1.0)' or perhaps 'foo (>= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be located. Otherwise, pre-release versions are not returned. :return: A :class:`Distribution` instance, or ``None`` if no such distribution could be located. NzNot a valid requirement: %rzmatcher: %s (%s)r{rrz%s did not match %rz%skipping pre-release version %s of %szerror matching %s with %rr)r<zsorted list: %s)rrr)rrr!r2rO requirementrorptyper=rerbrZ version_classrZ is_prereleaserUrrsortedr<ZextrasrTr download_urlsr)r6r prereleasesrWrr2rOversionsZslistZvclskrdZsdr(r*r*r+locatePsT            zLocator.locate)rBrCrDrErFrG)rHrIrJ)rK)rJ)rL)F)r=r>r?r@source_extensionsbinary_extensionsexcluded_extensionsrkrrRrYrZr\r^r`propertyr2rcrdrernrurrrrrr*r*r*r+rASs.   FrAcs0eZdZdZfddZddZddZZS)PyPIRPCLocatorz This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). c s*tt|jf|||_t|dd|_dS)z Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. g@)r%N)superrrRbase_urlrr))r6r(kwargs) __class__r*r+rRszPyPIRPCLocator.__init__cCst|jjS)zJ Return all the distribution names known to this locator. )rr)r')r6r*r*r+rdsz%PyPIRPCLocator.get_distribution_namesc Csiid}|jj|d}x|D]}|jj||}|jj||}t|jd}|d|_|d|_|jd|_ |jdg|_ |jd|_ t |}|r|d } | d |_ |j| |_||_|||<xB|D]:} | d } |j| } |d j|tj| | |d | <qWqW|S) N)rrT)r2rbrlicensekeywordssummaryrr(rr)r)Zpackage_releasesZ release_urlsZ release_datarr2rbrrTrrrrrrrrrrr) r6rbrWrrrdatarrrr(rr*r*r+rcs0           zPyPIRPCLocator._get_project)r=r>r?r@rRrdrc __classcell__r*r*)rr+rs rcs0eZdZdZfddZddZddZZS)PyPIJSONLocatorzw This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. c s tt|jf|t||_dS)N)rrrRrr)r6r(r)rr*r+rRszPyPIJSONLocator.__init__cCs tddS)zJ Return all the distribution names known to this locator. zNot available from this locatorN)ra)r6r*r*r+rdsz&PyPIJSONLocator.get_distribution_namescCsiid}t|jdt|}y|jj|}|jj}tj|}t |j d}|d}|d|_ |d|_ |j d|_|j dg|_|j d |_t|}||_|d } |||j <x`|d D]T} | d }|jj||j| |j|<|d j|j tj||j| |d |<qWx|d jD]\} } | |j kr:q"t |j d} |j | _ | | _ t| }||_||| <x\| D]T} | d }|jj||j| |j|<|d j| tj||j| |d |<qpWq"WWn@tk r}z"|jjt|tjd|WYdd}~XnX|S)N)rrz%s/json)r2rrbrrrrrr(rZreleaseszJSON fetch failed: %s) rrr rNopenreaddecodejsonloadsrr2rbrrTrrrrrrrrrrritemsrrQputrro exception)r6rbrWr(resprrrrrrrZinfosZomdodistrXr*r*r+rcsT               " zPyPIJSONLocator._get_project)r=r>r?r@rRrdrcrr*r*)rr+rs rc@s`eZdZdZejdejejBejBZ ejdejejBZ ddZ ejdejZ e ddZd S) Pagez4 This class represents a scraped HTML page. z (rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*))\s+)? href\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)) (\s+rel\s*=\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\s ]*)))? z!]+)cCs4||_||_|_|jj|j}|r0|jd|_dS)zk Initialise an instance with the Unicode page contents and the URL they came from. rN)rrr(_basesearchgroup)r6rr(rr*r*r+rRs  z Page.__init__z[^a-z0-9$&+,/:;=?@.#%_\\|-]cCsdd}t}x|jj|jD]}|jd}|dpZ|dpZ|dpZ|dpZ|dpZ|d }|d pr|d pr|d }t|j|}t|}|jj d d|}|j ||fqWt |dddd}|S)z Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. cSs,t|\}}}}}}t||t||||fS)zTidy up an URL.)rrr )r(r2rlrirrrr*r*r+clean%s zPage.links..cleanr0Zrel1Zrel2Zrel3Zrel4Zrel5Zrel6rqrrZurl3cSsdt|jdS)Nz%%%2xr)ordr)rr*r*r+3szPage.links..cSs|dS)Nrr*)rmr*r*r+r7sT)r<reverse) r_hreffinditerr groupdictrrr _clean_resubrr)r6rrWrrrelr(r*r*r+linkss  z Page.linksN)r=r>r?r@recompileISXrrrRrrrr*r*r*r+rs rcseZdZdZejdddddZdfdd Zd d Zd d Z ddZ e j de j ZddZddZddZddZddZe j dZddZZS)SimpleScrapingLocatorz A locator which scrapes HTML pages to locate downloads for a distribution. This runs multiple threads to do the I/O; performance is at least as good as pip's PackageFinder, which works in an analogous fashion. cCstjttdjS)N)Zfileobj)gzipZGzipFilerrr)br*r*r+rEszSimpleScrapingLocator.cCs|S)Nr*)rr*r*r+rFs)ZdeflaterZnoneN c sftt|jf|t||_||_i|_t|_t j |_ t|_ d|_ ||_tj|_tj|_dS)a Initialise an instance. :param url: The root URL to use for scraping. :param timeout: The timeout, in seconds, to be applied to requests. This defaults to ``None`` (no timeout specified). :param num_workers: The number of worker threads you want to do I/O, This defaults to 10. :param kwargs: Passed to the superclass. FN)rrrRrrr% _page_cacher_seenr rP _to_fetch _bad_hostsskip_externals num_workers threadingRLock_lock_gplock)r6r(r%rr)rr*r+rRIs    zSimpleScrapingLocator.__init__cCsJg|_x>t|jD]0}tj|jd}|jd|j|jj|qWdS)z Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web pages). )targetTN) _threadsrangerrZThread_fetchZ setDaemonstartrU)r6irmr*r*r+_prepare_threadscs  z&SimpleScrapingLocator._prepare_threadscCs>x|jD]}|jjdqWx|jD] }|jq$Wg|_dS)zu Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. N)rrrr|)r6rmr*r*r+ _wait_threadsps    z#SimpleScrapingLocator._wait_threadscCsiid}|jx||_||_t|jdt|}|jj|jj|j z&t j d||j j ||j jWd|jX|`WdQRX|S)N)rrz%s/z Queueing %s)rrWrwrrr rr[rrrorprrr|r)r6rbrWr(r*r*r+rc}s      z"SimpleScrapingLocator._get_projectz<\b(linux-(i\d86|x86_64|arm\w+)|win(32|-amd64)|macosx-?\d+)\bcCs |jj|S)zD Does an URL refer to a platform-specific download? )platform_dependentr)r6r(r*r*r+_is_platform_dependentsz,SimpleScrapingLocator._is_platform_dependentc CsT|j|rd}n|j||j}tjd|||rP|j|j|j|WdQRX|S)a% See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value. Nzprocess_download: %s -> %s)rrrwrorprrrW)r6r(rr*r*r+_process_downloads z'SimpleScrapingLocator._process_downloadc Cst|\}}}}}}|j|j|j|jr2d}n~|jrL|j|j rLd}nd|j|js^d}nR|d krld}nD|dkrzd}n6|j|rd}n&|j ddd } | j d krd}nd }t j d |||||S)z Determine whether a link URL from a referring page and with a particular "rel" attribute should be queued for scraping. Fhomepagedownloadhttprfftp:rrZ localhostTz#should_queue: %s (%s) from %s -> %s)rr)rrfr) rrjrrrrrrrsplitrrorp) r6linkZreferrerrr2rlri_rWhostr*r*r+ _should_queues*     z#SimpleScrapingLocator._should_queuecCsx|jj}zyz|r|j|}|dkr(wx\|jD]R\}}||jkr0|jj||j| r0|j|||r0tj d|||jj |q0WWn2t k r}z|j j t |WYdd}~XnXWd|jjX|sPqWdS)z Get a URL to fetch from the work queue, get the HTML page, examine its links for download candidates and candidates for further scraping. This is a handy method to run in a thread. NzQueueing %s from %s)rrTget_pagerrrrrrorprrrQrrV)r6r(pagerrrXr*r*r+rs&     & zSimpleScrapingLocator._fetchcCsXt|\}}}}}}|dkr:tjjt|r:tt|d}||jkr`|j|}tj d||n|j ddd}d}||j krtj d||nt |d d id }zytj d ||j j||jd } tj d|| j} | jdd} tj| r| j} | j} | jd}|r"|j|}|| } d}tj| }|r@|jd}y| j|} Wn tk rn| jd} YnXt| | }||j| <Wntk r}z |jdkrtjd||WYdd}~Xnt k r}z2tjd|||j!|j j"|WdQRXWYdd}~Xn2t#k rB}ztjd||WYdd}~XnXWd||j|<X|S)a Get the HTML for an URL, possibly from an in-memory cache. XXX TODO Note: this cache is never actually cleared. It's assumed that the data won't get stale over the lifetime of a locator instance (not necessarily true for the default_locator). filez index.htmlzReturning %s from cache: %srrrNzSkipping %s due to bad host %szAccept-encodingZidentity)r;z Fetching %s)r%z Fetched %sz Content-Typer0zContent-Encodingzutf-8zlatin-1izFetch failed: %s: %s)$rosriisdirrrrrrorprrrrNrr%rrTHTML_CONTENT_TYPErZgeturlrdecodersCHARSETrrr UnicodeErrorrrr9rrrrr)r6r(r2rlrirrWrr7rr;Z content_typeZ final_urlrencodingdecoderrrXr*r*r+rsZ              &$ zSimpleScrapingLocator.get_pagez]*>([^<]+)r?r@zlibZ decompressrrRrrrcrrrrrrrrrr rdrr*r*)rr+r;s"   ; rcs8eZdZdZfddZddZddZdd ZZS) DirectoryLocatorz? This class locates distributions in a directory tree. c sN|jdd|_tt|jf|tjj|}tjj|sDt d|||_ dS)a Initialise an instance. :param path: The root of the directory tree to search. :param kwargs: Passed to the superclass constructor, except for: * recursive - if True (the default), subdirectories are recursed into. If False, only the top-level directory is searched, recursiveTzNot a directory: %rN) rrrr rRrriabspathrrbase_dir)r6rir)rr*r+rR5s    zDirectoryLocator.__init__cCs |j|jS)z Should a filename be considered as a candidate for a distribution archive? As well as the filename, the directory which contains it is provided, though not used by the current implementation. )rjr)r6rvparentr*r*r+should_includeFszDirectoryLocator.should_includec Csiid}xtj|jD]v\}}}xb|D]Z}|j||r(tjj||}tddttjj|dddf}|j ||}|r(|j ||q(W|j sPqW|S)N)rrrr0) rwalkrrrir|rr rrrr) r6rbrWrootdirsfilesfnr(rr*r*r+rcNs     zDirectoryLocator._get_projectc Cst}xtj|jD]x\}}}xd|D]\}|j||r$tjj||}tddttjj |dddf}|j |d}|r$|j |dq$W|j sPqW|S)zJ Return all the distribution names known to this locator. rr0Nrb) rrrrrrir|rr rrrr)r6rWrrrrr(rr*r*r+rd^s    z'DirectoryLocator.get_distribution_names) r=r>r?r@rRrrcrdrr*r*)rr+r 0s  r c@s eZdZdZddZddZdS) JSONLocatora This locator uses special extended metadata (not available on PyPI) and is the basis of performant dependency resolution in distlib. Other locators require archive downloads before dependencies can be determined! As you might imagine, that can be slow. cCs tddS)zJ Return all the distribution names known to this locator. zNot available from this locatorN)ra)r6r*r*r+rdxsz"JSONLocator.get_distribution_namescCsiid}t|}|rx|jdgD]}|ddks$|ddkrBq$t|d|d|jd d |jd }|j}|d |_d |kr|d rd|d f|_|jdi|_|jdi|_|||j <|dj |j t j |d q$W|S)N)rrrZptypeZsdistZ pyversionsourcerbrrzPlaceholder for summary)rr2r(rrZ requirementsexportsr) rrTrr2rrrZ dependenciesrrrrr)r6rbrWrrrrr*r*r+rc~s&    "zJSONLocator._get_projectN)r=r>r?r@rdrcr*r*r*r+rqsrcs(eZdZdZfddZddZZS)DistPathLocatorz This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. c s*tt|jf|t|ts t||_dS)zs Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. N)rrrR isinstancerAssertionErrordistpath)r6rr)rr*r+rRszDistPathLocator.__init__cCsP|jj|}|dkr iid}n,|j|d|jt|jgid|jtdgii}|S)N)rrrr)rZget_distributionrrr)r6rbrrWr*r*r+rcs  zDistPathLocator._get_project)r=r>r?r@rRrcrr*r*)rr+rs rcsReZdZdZfddZfddZddZeej j eZ dd Z d d Z Z S) AggregatingLocatorzI This class allows you to chain and/or merge a list of locators. cs*|jdd|_||_tt|jf|dS)a Initialise an instance. :param locators: The list of locators to search. :param kwargs: Passed to the superclass constructor, except for: * merge - if False (the default), the first successful search from any of the locators is returned. If True, the results from all locators are merged (this can be slow). mergeFN)rr locatorsrrrR)r6r!r)rr*r+rRs zAggregatingLocator.__init__cs*tt|jx|jD] }|jqWdS)N)rrr\r!)r6r)rr*r+r\s zAggregatingLocator.clear_cachecCs ||_x|jD] }||_qWdS)N)r]r!r2)r6r_rr*r*r+r`s zAggregatingLocator._set_schemec Csi}x|jD]}|j|}|r |jr|jdi}|jdi}|j||jd}|r|rx6|jD]*\}} ||kr||| O<qb| ||<qbW|jd} |r| r| j|q |jdkrd} n$d} x|D]}|jj|rd} PqW| r |}Pq W|S)NrrTF)r!rer rTupdaterrOr) r6rbrWrrrrZdfrrZddfoundr*r*r+rcs8           zAggregatingLocator._get_projectc Cs@t}x4|jD]*}y||jO}Wqtk r6YqXqW|S)zJ Return all the distribution names known to this locator. )rr!rdra)r6rWrr*r*r+rds  z)AggregatingLocator.get_distribution_names)r=r>r?r@rRr\r`rrAr2fgetrcrdrr*r*)rr+rs  ,rzhttps://pypi.python.org/simple/g@)r%legacy)r2z1(?P[\w-]+)\s*\(\s*(==\s*)?(?P[^)]+)\)$c@sLeZdZdZdddZddZddZd d Zd d Zd dZ dddZ dS)DependencyFinderz0 Locate dependencies for distributions. NcCs|pt|_t|jj|_dS)zf Initialise an instance, using the specified locator to locate distributions. N)default_locatorrr!r2)r6rr*r*r+rRs zDependencyFinder.__init__cCsvtjd||j}||j|<||j||jf<xD|jD]:}t|\}}tjd||||jj |t j ||fq4WdS)z Add a distribution to the finder. This will update internal information about who provides what. :param dist: The distribution to add. zadding distribution %szAdd to provided: %s, %s, %sN) rorpr< dists_by_namedistsrprovidesrprovidedrrr)r6rrbprr*r*r+add_distribution&s    z!DependencyFinder.add_distributioncCs|tjd||j}|j|=|j||jf=xN|jD]D}t|\}}tjd||||j|}|j ||f|s0|j|=q0WdS)z Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove. zremoving distribution %sz Remove from provided: %s, %s, %sN) rorpr<r(r)rr*rr+remove)r6rrbr,rsr*r*r+remove_distribution5s    z$DependencyFinder.remove_distributionc CsBy|jj|}Wn,tk r<|jd}|jj|}YnX|S)z Get a version matcher for a requirement. :param reqt: The requirement :type reqt: str :return: A version matcher (an instance of :class:`distlib.version.Matcher`). r)r2rOr"r)r6reqtrOrbr*r*r+ get_matcherGs  zDependencyFinder.get_matcherc Csv|j|}|j}t}|j}||krrxL||D]@\}}y|j|}Wntk r\d}YnX|r.|j|Pq.W|S)z Find the distributions which can fulfill a requirement. :param reqt: The requirement. :type reqt: str :return: A set of distribution which can fulfill the requirement. F)r2r<rr+rr"r) r6r1rOrbrWr+rproviderrr*r*r+find_providersWs   zDependencyFinder.find_providersc Cs|j|}t}x,|D]$}|j|}|j|js|j|qW|r^|jd||t|fd}nD|j||j|=x"|D]}|jj|tj|qvW|j |d}|S)a Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :param provider: The provider we are trying to replace with. :param other: The provider we're trying to replace. :param problems: If False is returned, this will contain what problems prevented replacement. This is currently a tuple of the literal string 'cantreplace', ``provider``, ``other`` and the set of requirements that ``provider`` couldn't fulfill. :return: True if we can replace ``other`` with ``provider``, else False. Z cantreplaceFT) reqtsrr2rrr frozensetr0rr-) r6r3otherproblemsZrlistZ unmatchedr/rOrWr*r*r+try_to_replaceos"         zDependencyFinder.try_to_replaceFcCsi|_i|_i|_i|_t|p g}d|krH|jd|tdddgO}t|trh|}}tj d|n4|j j ||d}}|dkrt d|tj d |d |_ t}t|g}t|g}x|r|j}|j} | |jkr|j|n"|j| } | |kr |j|| ||j|jB} |j} t} ||krbx2dD]*}d|}||kr4| t|d|O} q4W| | B| B}x>|D]4}|j|}|sNtj d||j j ||d}|dkr| r|j j |d d}|dkrtj d||jd|fn^|j|j}}||f|jkr|j||j||| krN||krN|j|tj d|jxZ|D]R}|j} | |jkr|jj|tj|n"|j| } | |krT|j|| |qTWqvWqWt|jj}x.|D]&}||k|_|jrtj d|jqWtj d|||fS)a Find a distribution and all distributions it depends on. :param requirement: The requirement specifying the distribution to find, or a Distribution instance. :param meta_extras: A list of meta extras such as :test:, :build: and so on. :param prereleases: If ``True``, allow pre-release versions to be returned - otherwise, don't return prereleases unless they're all that's available. Return a set of :class:`Distribution` instances and a set of problems. The distributions returned should be such that they have the :attr:`required` attribute set to ``True`` if they were from the ``requirement`` passed to ``find()``, and they have the :attr:`build_time_dependency` attribute set to ``True`` unless they are post-installation dependencies of the ``requirement``. The problems should be a tuple consisting of the string ``'unsatisfied'`` and the requirement which couldn't be satisfied by any distribution known to the locator. z:*:z:test:z:build:z:dev:zpassed %s as requirement)rNzUnable to locate %rz located %sTtestbuilddevz:%s:z %s_requireszNo providers found for %rzCannot satisfy %rZ unsatisfiedzAdding %s to install_distsz#%s is a build-time dependency only.zfind done for %s)r:r;r<)r+r)r(r5rr.rrrorprrrZ requestedrr<r-r9Z run_requiresZ meta_requiresZbuild_requiresgetattrr4rrZname_and_versionrvaluesZbuild_time_dependency)r6rZ meta_extrasrrrr8ZtodoZ install_distsrbr7ZireqtsZsreqtsZereqtsr<rXZ all_reqtsrZ providersr3nrr,r)r*r*r+finds                                zDependencyFinder.find)N)NF) r=r>r?r@rRr-r0r2r4r9r@r*r*r*r+r&s (r&)N)NriorrZloggingrrgrr ImportErrorZdummy_threadingr r0rcompatrrrrr r r r r rrr4rrrrZdatabaserrrrrutilrrrrrrrrr rr!r"rr#r$Z getLoggerr=rorrrrrr&r,r-objectrArrrrr rrrr'rZNAME_VERSION_REr&r*r*r*r+sZ   D ,    ;0E:vA&[ distlib/__pycache__/manifest.cpython-36.pyc000064400000024052152347724720014662 0ustar003 Pf9@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z dgZ ej eZejdejZejd ejejBZejdd ZGd ddeZdS) zu Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. N)DistlibException)fsdecode) convert_pathManifestz\\w* z#.*?(?= )| (?=$)c@szeZdZdZdddZddZddZd d Zdd d ZddZ ddZ ddZ dddZ d ddZ d!ddZddZdS)"rz~A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. NcCs>tjjtjj|ptj|_|jtj|_d|_t |_ dS)zd Initialise an instance. :param base: The base directory to explore under. N) ospathabspathnormpathgetcwdbasesepprefixallfilessetfiles)selfr r/usr/lib/python3.6/manifest.py__init__*szManifest.__init__cCsddlm}m}m}g|_}|j}|g}|j}|j}xv|r|}tj |} x\| D]T} tj j || } tj| } | j } || r|jt | qR|| rR||  rR|| qRWq8WdS)zmFind all files under the base and set ``allfiles`` to the absolute pathnames of files found. r)S_ISREGS_ISDIRS_ISLNKN)statrrrrr popappendrlistdirr joinst_moder)rrrrrrootstackrpushnamesnamefullnamermoderrrfindall9s"    zManifest.findallcCs4|j|jstjj|j|}|jjtjj|dS)zz Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. N) startswithrrr rr raddr )ritemrrrr)Ts z Manifest.addcCsx|D]}|j|qWdS)z Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. N)r))ritemsr*rrradd_many^s zManifest.add_manyFcsffddtj}|rJt}x|D]}|tjj|q(W||O}ddtdd|DDS)z8 Return sorted files in directory order csJ|j|tjd||jkrFtjj|\}}|dks.add_dircSsg|]}tjj|qSr)rr r).0Z path_tuplerrr zsz#Manifest.sorted..css|]}tjj|VqdS)N)rr r1)r8r rrr {sz"Manifest.sorted..)rrrr dirnamesorted)rZwantdirsresultr3fr)r7rrr<gs  zManifest.sortedcCst|_g|_dS)zClear all collected files.N)rrr)rrrrclear}szManifest.clearcCs|j|\}}}}|dkrFx&|D]}|j|dds tjd|q Wn<|dkrnx|D]}|j|dd}qTWn|dkrx&|D]}|j|dds|tjd|q|Wn|d krx|D]}|j|dd}qWn|d krx|D] }|j||d stjd ||qWn|d kr&xz|D]}|j||d }q Wn\|dkrN|jd|d stjd|n4|dkrv|jd|d stjd|n td|dS)av Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands includeT)anchorzno files found matching %rexcludezglobal-includeFz3no files found matching %r anywhere in distributionzglobal-excludezrecursive-include)rz-no files found matching %r under directory %rzrecursive-excludegraftNz no directories found matching %rprunez4no previously-included directories found matching %rzinvalid action %r)_parse_directive_include_patternr/Zwarning_exclude_patternr)r directiveactionpatternsthedirZ dirpatternpatternfoundrrrprocess_directivesD           zManifest.process_directivec Cs|j}t|dkr,|ddkr,|jdd|d}d }}}|dkrxt|d kr`td |dd|dd D}n|dkrt|dkrtd|t|d}dd|d d D}n<|dkrt|d krtd|t|d}n td|||||fS)z Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns rrr@rBglobal-includeglobal-excluderecursive-includerecursive-excluderCrDNrz$%r expects ...cSsg|] }t|qSr)r)r8wordrrrr9sz-Manifest._parse_directive..z*%r expects ...cSsg|] }t|qSr)r)r8rSrrrr9sz!%r expects a single zunknown action %r)r@rBrOrPrQrRrCrD)r@rBrOrP)rQrR)rCrD)r1leninsertrr)rrHZwordsrIrJrKZ dir_patternrrrrEs:           zManifest._parse_directiveTcCsTd}|j||||}|jdkr&|jx(|jD]}|j|r.|jj|d}q.W|S)aSelect strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. FNT)_translate_patternrr'searchrr))rrLrAris_regexrM pattern_rer$rrrrFs    zManifest._include_patterncCsFd}|j||||}x,t|jD]}|j|r |jj|d}q W|S)atRemove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions FT)rWlistrrXremove)rrLrArrYrMrZr>rrrrG)s   zManifest._exclude_patternc Cs|rt|trtj|S|Std kr:|jdjd\}}}|rj|j|}td krn|j|rd|j|snt nd}tj t j j |jd} |dk rftdkr|jd} |j|dt|  } n>|j|} | j|r| j|st | t|t| t|} t j} t jdkrd} tdkr4d| | j | d |f}n0|t|t|t|}d || | | ||f}n8|rtdkrd| |}nd || |t|df}tj|S)aTranslate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). rTrr6r-N\z\\^z.*z%s%s%s%s.*%s%sz%s%s%s)rTr)rTr)rTr)rTr)rTr) isinstancestrrecompile_PYTHON_VERSION _glob_to_re partitionr(endswithr2escaperr rr rUr) rrLrArrYstartr6endrZr Z empty_patternZ prefix_rerrrrrW=sB             zManifest._translate_patterncCs8tj|}tj}tjdkrd}d|}tjd||}|S)zTranslate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). r]z\\\\z\1[^%s]z((? s    distlib/_backport/sysconfig.py000064400000064346152347724720012552 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """Access to Python's configuration information.""" import codecs import os import re import sys from os.path import pardir, realpath try: import configparser except ImportError: import ConfigParser as configparser __all__ = [ 'get_config_h_filename', 'get_config_var', 'get_config_vars', 'get_makefile_filename', 'get_path', 'get_path_names', 'get_paths', 'get_platform', 'get_python_version', 'get_scheme_names', 'parse_config_h', ] def _safe_realpath(path): try: return realpath(path) except OSError: return path if sys.executable: _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable)) else: # sys.executable can be empty if argv[0] has been changed and Python is # unable to retrieve the real program name _PROJECT_BASE = _safe_realpath(os.getcwd()) if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower(): _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir)) # PC/VS7.1 if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower(): _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir)) # PC/AMD64 if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower(): _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir)) def is_python_build(): for fn in ("Setup.dist", "Setup.local"): if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)): return True return False _PYTHON_BUILD = is_python_build() _cfg_read = False def _ensure_cfg_read(): global _cfg_read if not _cfg_read: from ..resources import finder backport_package = __name__.rsplit('.', 1)[0] _finder = finder(backport_package) _cfgfile = _finder.find('sysconfig.cfg') assert _cfgfile, 'sysconfig.cfg exists' with _cfgfile.as_stream() as s: _SCHEMES.readfp(s) if _PYTHON_BUILD: for scheme in ('posix_prefix', 'posix_home'): _SCHEMES.set(scheme, 'include', '{srcdir}/Include') _SCHEMES.set(scheme, 'platinclude', '{projectbase}/.') _cfg_read = True _SCHEMES = configparser.RawConfigParser() _VAR_REPL = re.compile(r'\{([^{]*?)\}') def _expand_globals(config): _ensure_cfg_read() if config.has_section('globals'): globals = config.items('globals') else: globals = tuple() sections = config.sections() for section in sections: if section == 'globals': continue for option, value in globals: if config.has_option(section, option): continue config.set(section, option, value) config.remove_section('globals') # now expanding local variables defined in the cfg file # for section in config.sections(): variables = dict(config.items(section)) def _replacer(matchobj): name = matchobj.group(1) if name in variables: return variables[name] return matchobj.group(0) for option, value in config.items(section): config.set(section, option, _VAR_REPL.sub(_replacer, value)) #_expand_globals(_SCHEMES) _PY_VERSION = '%s.%s.%s' % sys.version_info[:3] _PY_VERSION_SHORT = '%s.%s' % sys.version_info[:2] _PY_VERSION_SHORT_NO_DOT = '%s%s' % sys.version_info[:2] _PREFIX = os.path.normpath(sys.prefix) _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) _CONFIG_VARS = None _USER_BASE = None def _subst_vars(path, local_vars): """In the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. """ def _replacer(matchobj): name = matchobj.group(1) if name in local_vars: return local_vars[name] elif name in os.environ: return os.environ[name] return matchobj.group(0) return _VAR_REPL.sub(_replacer, path) def _extend_dict(target_dict, other_dict): target_keys = target_dict.keys() for key, value in other_dict.items(): if key in target_keys: continue target_dict[key] = value def _expand_vars(scheme, vars): res = {} if vars is None: vars = {} _extend_dict(vars, get_config_vars()) for key, value in _SCHEMES.items(scheme): if os.name in ('posix', 'nt'): value = os.path.expanduser(value) res[key] = os.path.normpath(_subst_vars(value, vars)) return res def format_value(value, vars): def _replacer(matchobj): name = matchobj.group(1) if name in vars: return vars[name] return matchobj.group(0) return _VAR_REPL.sub(_replacer, value) def _get_default_scheme(): if os.name == 'posix': # the default scheme for posix is posix_prefix return 'posix_prefix' return os.name def _getuserbase(): env_base = os.environ.get("PYTHONUSERBASE", None) def joinuser(*args): return os.path.expanduser(os.path.join(*args)) # what about 'os2emx', 'riscos' ? if os.name == "nt": base = os.environ.get("APPDATA") or "~" if env_base: return env_base else: return joinuser(base, "Python") if sys.platform == "darwin": framework = get_config_var("PYTHONFRAMEWORK") if framework: if env_base: return env_base else: return joinuser("~", "Library", framework, "%d.%d" % sys.version_info[:2]) if env_base: return env_base else: return joinuser("~", ".local") def _parse_makefile(filename, vars=None): """Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ # Regexes needed for parsing Makefile (and similar syntaxes, # like old-style Setup files). _variable_rx = re.compile(r"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)") _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") if vars is None: vars = {} done = {} notdone = {} with codecs.open(filename, encoding='utf-8', errors="surrogateescape") as f: lines = f.readlines() for line in lines: if line.startswith('#') or line.strip() == '': continue m = _variable_rx.match(line) if m: n, v = m.group(1, 2) v = v.strip() # `$$' is a literal `$' in make tmpv = v.replace('$$', '') if "$" in tmpv: notdone[n] = v else: try: v = int(v) except ValueError: # insert literal `$' done[n] = v.replace('$$', '$') else: done[n] = v # do variable interpolation here variables = list(notdone.keys()) # Variables with a 'PY_' prefix in the makefile. These need to # be made available without that prefix through sysconfig. # Special care is needed to ensure that variable expansion works, even # if the expansion uses the name without a prefix. renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS') while len(variables) > 0: for name in tuple(variables): value = notdone[name] m = _findvar1_rx.search(value) or _findvar2_rx.search(value) if m is not None: n = m.group(1) found = True if n in done: item = str(done[n]) elif n in notdone: # get it on a subsequent round found = False elif n in os.environ: # do it like make: fall back to environment item = os.environ[n] elif n in renamed_variables: if (name.startswith('PY_') and name[3:] in renamed_variables): item = "" elif 'PY_' + n in notdone: found = False else: item = str(done['PY_' + n]) else: done[n] = item = "" if found: after = value[m.end():] value = value[:m.start()] + item + after if "$" in after: notdone[name] = value else: try: value = int(value) except ValueError: done[name] = value.strip() else: done[name] = value variables.remove(name) if (name.startswith('PY_') and name[3:] in renamed_variables): name = name[3:] if name not in done: done[name] = value else: # bogus variable reference (e.g. "prefix=$/opt/python"); # just drop it since we can't deal done[name] = value variables.remove(name) # strip spurious spaces for k, v in done.items(): if isinstance(v, str): done[k] = v.strip() # save the results in the global dictionary vars.update(done) return vars def get_makefile_filename(): """Return the path of the Makefile.""" if _PYTHON_BUILD: return os.path.join(_PROJECT_BASE, "Makefile") if hasattr(sys, 'abiflags'): config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags) else: config_dir_name = 'config' return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile') def _init_posix(vars): """Initialize the module as appropriate for POSIX systems.""" # load the installed Makefile: makefile = get_makefile_filename() try: _parse_makefile(makefile, vars) except IOError as e: msg = "invalid Python installation: unable to open %s" % makefile if hasattr(e, "strerror"): msg = msg + " (%s)" % e.strerror raise IOError(msg) # load the installed pyconfig.h: config_h = get_config_h_filename() try: with open(config_h) as f: parse_config_h(f, vars) except IOError as e: msg = "invalid Python installation: unable to open %s" % config_h if hasattr(e, "strerror"): msg = msg + " (%s)" % e.strerror raise IOError(msg) # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if _PYTHON_BUILD: vars['LDSHARED'] = vars['BLDSHARED'] def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories vars['LIBDEST'] = get_path('stdlib') vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') vars['SO'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) # # public APIs # def parse_config_h(fp, vars=None): """Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ if vars is None: vars = {} define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n") undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n") while True: line = fp.readline() if not line: break m = define_rx.match(line) if m: n, v = m.group(1, 2) try: v = int(v) except ValueError: pass vars[n] = v else: m = undef_rx.match(line) if m: vars[m.group(1)] = 0 return vars def get_config_h_filename(): """Return the path of pyconfig.h.""" if _PYTHON_BUILD: if os.name == "nt": inc_dir = os.path.join(_PROJECT_BASE, "PC") else: inc_dir = _PROJECT_BASE else: inc_dir = get_path('platinclude') return os.path.join(inc_dir, 'pyconfig.h') def get_scheme_names(): """Return a tuple containing the schemes names.""" return tuple(sorted(_SCHEMES.sections())) def get_path_names(): """Return a tuple containing the paths names.""" # xxx see if we want a static list return _SCHEMES.options('posix_prefix') def get_paths(scheme=_get_default_scheme(), vars=None, expand=True): """Return a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. """ _ensure_cfg_read() if expand: return _expand_vars(scheme, vars) else: return dict(_SCHEMES.items(scheme)) def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True): """Return a path corresponding to the scheme. ``scheme`` is the install scheme name. """ return get_paths(scheme, vars, expand)[name] def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. """ global _CONFIG_VARS if _CONFIG_VARS is None: _CONFIG_VARS = {} # Normalized versions of prefix and exec_prefix are handy to have; # in fact, these are the standard versions used most places in the # distutils2 module. _CONFIG_VARS['prefix'] = _PREFIX _CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX _CONFIG_VARS['py_version'] = _PY_VERSION _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT _CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2] _CONFIG_VARS['base'] = _PREFIX _CONFIG_VARS['platbase'] = _EXEC_PREFIX _CONFIG_VARS['projectbase'] = _PROJECT_BASE try: _CONFIG_VARS['abiflags'] = sys.abiflags except AttributeError: # sys.abiflags may not be defined on all platforms. _CONFIG_VARS['abiflags'] = '' if os.name in ('nt', 'os2'): _init_non_posix(_CONFIG_VARS) if os.name == 'posix': _init_posix(_CONFIG_VARS) # Setting 'userbase' is done below the call to the # init function to enable using 'get_config_var' in # the init-function. if sys.version >= '2.6': _CONFIG_VARS['userbase'] = _getuserbase() if 'srcdir' not in _CONFIG_VARS: _CONFIG_VARS['srcdir'] = _PROJECT_BASE else: _CONFIG_VARS['srcdir'] = _safe_realpath(_CONFIG_VARS['srcdir']) # Convert srcdir into an absolute path if it appears necessary. # Normally it is relative to the build directory. However, during # testing, for example, we might be running a non-installed python # from a different directory. if _PYTHON_BUILD and os.name == "posix": base = _PROJECT_BASE try: cwd = os.getcwd() except OSError: cwd = None if (not os.path.isabs(_CONFIG_VARS['srcdir']) and base != cwd): # srcdir is relative and we are not in the same directory # as the executable. Assume executable is in the build # directory and make srcdir absolute. srcdir = os.path.join(base, _CONFIG_VARS['srcdir']) _CONFIG_VARS['srcdir'] = os.path.normpath(srcdir) if sys.platform == 'darwin': kernel_version = os.uname()[2] # Kernel version (8.4.3) major_version = int(kernel_version.split('.')[0]) if major_version < 8: # On Mac OS X before 10.4, check if -arch and -isysroot # are in CFLAGS or LDFLAGS and remove them if they are. # This is needed when building extensions on a 10.3 system # using a universal build of python. for key in ('LDFLAGS', 'BASECFLAGS', # a number of derived variables. These need to be # patched up as well. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _CONFIG_VARS[key] flags = re.sub(r'-arch\s+\w+\s', ' ', flags) flags = re.sub('-isysroot [^ \t]*', ' ', flags) _CONFIG_VARS[key] = flags else: # Allow the user to override the architecture flags using # an environment variable. # NOTE: This name was introduced by Apple in OSX 10.5 and # is used by several scripting languages distributed with # that OS release. if 'ARCHFLAGS' in os.environ: arch = os.environ['ARCHFLAGS'] for key in ('LDFLAGS', 'BASECFLAGS', # a number of derived variables. These need to be # patched up as well. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _CONFIG_VARS[key] flags = re.sub(r'-arch\s+\w+\s', ' ', flags) flags = flags + ' ' + arch _CONFIG_VARS[key] = flags # If we're on OSX 10.5 or later and the user tries to # compiles an extension using an SDK that is not present # on the current machine it is better to not use an SDK # than to fail. # # The major usecase for this is users using a Python.org # binary installer on OSX 10.6: that installer uses # the 10.4u SDK, but that SDK is not installed by default # when you install Xcode. # CFLAGS = _CONFIG_VARS.get('CFLAGS', '') m = re.search(r'-isysroot\s+(\S+)', CFLAGS) if m is not None: sdk = m.group(1) if not os.path.exists(sdk): for key in ('LDFLAGS', 'BASECFLAGS', # a number of derived variables. These need to be # patched up as well. 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _CONFIG_VARS[key] flags = re.sub(r'-isysroot\s+\S+(\s|$)', ' ', flags) _CONFIG_VARS[key] = flags if args: vals = [] for name in args: vals.append(_CONFIG_VARS.get(name)) return vals else: return _CONFIG_VARS def get_config_var(name): """Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) """ return get_config_vars().get(name) def get_platform(): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. """ if os.name == 'nt': # sniff sys.version for architecture. prefix = " bit (" i = sys.version.find(prefix) if i == -1: return sys.platform j = sys.version.find(")", i) look = sys.version[i+len(prefix):j].lower() if look == 'amd64': return 'win-amd64' if look == 'itanium': return 'win-ia64' return sys.platform if os.name != "posix" or not hasattr(os, 'uname'): # XXX what about the architecture? NT is Intel or Alpha, # Mac OS is M68k or PPC, etc. return sys.platform # Try to distinguish various flavours of Unix osname, host, release, version, machine = os.uname() # Convert the OS name to lowercase, remove '/' characters # (to accommodate BSD/OS), and translate spaces (for "Power Macintosh") osname = osname.lower().replace('/', '') machine = machine.replace(' ', '_') machine = machine.replace('/', '-') if osname[:5] == "linux": # At least on Linux/Intel, 'machine' is the processor -- # i386, etc. # XXX what about Alpha, SPARC, etc? return "%s-%s" % (osname, machine) elif osname[:5] == "sunos": if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": osname = "cygwin" rel_re = re.compile(r'[\d.]+') m = rel_re.match(release) if m: release = m.group() elif osname[:6] == "darwin": # # For our purposes, we'll assume that the system version from # distutils' perspective is what MACOSX_DEPLOYMENT_TARGET is set # to. This makes the compatibility story a bit more sane because the # machine is going to compile and link as if it were # MACOSX_DEPLOYMENT_TARGET. cfgvars = get_config_vars() macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET') if True: # Always calculate the release of the running machine, # needed to determine if we can build fat binaries or not. macrelease = macver # Get the system version. Reading this plist is a documented # way to get the system version (see the documentation for # the Gestalt Manager) try: f = open('/System/Library/CoreServices/SystemVersion.plist') except IOError: # We're on a plain darwin box, fall back to the default # behaviour. pass else: try: m = re.search(r'ProductUserVisibleVersion\s*' r'(.*?)', f.read()) finally: f.close() if m is not None: macrelease = '.'.join(m.group(1).split('.')[:2]) # else: fall back to the default behaviour if not macver: macver = macrelease if macver: release = macver osname = "macosx" if ((macrelease + '.') >= '10.4.' and '-arch' in get_config_vars().get('CFLAGS', '').strip()): # The universal build will build fat binaries, but not on # systems before 10.4 # # Try to detect 4-way universal builds, those have machine-type # 'universal' instead of 'fat'. machine = 'fat' cflags = get_config_vars().get('CFLAGS') archs = re.findall(r'-arch\s+(\S+)', cflags) archs = tuple(sorted(set(archs))) if len(archs) == 1: machine = archs[0] elif archs == ('i386', 'ppc'): machine = 'fat' elif archs == ('i386', 'x86_64'): machine = 'intel' elif archs == ('i386', 'ppc', 'x86_64'): machine = 'fat3' elif archs == ('ppc64', 'x86_64'): machine = 'fat64' elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'): machine = 'universal' else: raise ValueError( "Don't know machine value for archs=%r" % (archs,)) elif machine == 'i386': # On OSX the machine type returned by uname is always the # 32-bit variant, even if the executable architecture is # the 64-bit variant if sys.maxsize >= 2**32: machine = 'x86_64' elif machine in ('PowerPC', 'Power_Macintosh'): # Pick a sane name for the PPC architecture. # See 'i386' case if sys.maxsize >= 2**32: machine = 'ppc64' else: machine = 'ppc' return "%s-%s-%s" % (osname, release, machine) def get_python_version(): return _PY_VERSION_SHORT def _print_dict(title, data): for index, (key, value) in enumerate(sorted(data.items())): if index == 0: print('%s: ' % (title)) print('\t%s = "%s"' % (key, value)) def _main(): """Display all information sysconfig detains.""" print('Platform: "%s"' % get_platform()) print('Python version: "%s"' % get_python_version()) print('Current installation scheme: "%s"' % _get_default_scheme()) print() _print_dict('Paths', get_paths()) print() _print_dict('Variables', get_config_vars()) if __name__ == '__main__': _main() distlib/_backport/__pycache__/misc.cpython-36.opt-1.pyc000064400000001740152347724720016711 0ustar003 Pf@sdZddlZddlZdddgZyddlmZWnek rLd ddZYnXyeZWn(ek r~dd l m Z d dZYnXy ej Z Wne k rd dZ YnXdS) z/Backports for individual classes and functions.Ncache_from_sourcecallablefsencode)rFcCs|rdp d}||S)Nco)Zpy_filedebugZextrr/usr/lib/python3.6/misc.pyrs )CallablecCs t|tS)N) isinstancer )objrrr rscCs<t|tr|St|tr&|jtjStdt|jdS)Nzexpect bytes or str, not %s) r bytesstrencodesysgetfilesystemencoding TypeErrortype__name__)filenamerrr r"s   )F) __doc__osr__all__Zimpr ImportErrorr NameError collectionsr rAttributeErrorrrrr s    distlib/_backport/__pycache__/sysconfig.cpython-36.pyc000064400000037115152347724720017030 0ustar003 PfKi@sdZddlZddlZddlZddlZddlmZmZy ddlZWne k r\ddl ZYnXdddddd d d d d dg Z ddZ ej rejje ej Zn e ejZejdkrdedEdjkre ejjeeZejdkodedFdjkr e ejjeeeZejdkr@dedGdjkr@e ejjeeeZddZeZdaddZejZejdZddZejjdZ ejdd Z!e de d!Z"ejj#ej$Z%ejj#ej&Z'da(dZ)d"d#Z*d$d%Z+d&d'Z,d(d)Z-d*d+Z.d,d-Z/dHd.d/Z0d0dZ1d1d2Z2d3d4Z3dId5dZ4d6dZ5d7d Z6d8d Z7e.dd9fd:d Z8e.dd9fd;dZ9dd ZdBdCZ?e@dDkre?dS)Jz-Access to Python's configuration information.N)pardirrealpathget_config_h_filenameget_config_varget_config_varsget_makefile_filenameget_pathget_path_names get_paths get_platformget_python_versionget_scheme_namesparse_config_hc Cs"yt|Stk r|SXdS)N)rOSError)pathr/usr/lib/python3.6/sysconfig.py_safe_realpath"srntZpcbuildz\pc\v z\pcbuild\amd64cCs.x(dD] }tjjtjjtd|rdSqWdS)N Setup.dist Setup.localModulesTF)rr)osrisfilejoin _PROJECT_BASE)fnrrris_python_build:s r Fc Cstsddlm}tjddd}||}|jd}|s>td|j}tj |WdQRXt rx(dD] }tj |d d tj |d d qfWdadS)N)finder.rz sysconfig.cfgzsysconfig.cfg exists posix_prefix posix_homeincludez{srcdir}/Include platincludez{projectbase}/.T)r%r&) _cfg_readZ resourcesr"__name__rsplitfindAssertionErrorZ as_stream_SCHEMESZreadfp _PYTHON_BUILDset)r"Zbackport_packageZ_finderZ_cfgfilesschemerrr_ensure_cfg_readDs     r3z \{([^{]*?)\}cst|jdr|jd}nt}|j}xD|D]<}|dkr>q0x,|D]$\}}|j||rZqD|j|||qDWq0W|jdxX|jD]L}t|j|fdd}x,|j|D]\}}|j||t j ||qWqWdS)Nglobalscs$|jd}|kr|S|jdS)Nr$r)group)matchobjname) variablesrr _replaceros z"_expand_globals.._replacer) r3Z has_sectionitemstuplesectionsZ has_optionr0Zremove_sectiondict _VAR_REPLsub)configr4r<ZsectionZoptionvaluer9r)r8r_expand_globalsYs$      rBr!csfdd}tj||S)zIn the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. cs8|jd}|kr|S|tjkr.tj|S|jdS)Nr$r)r5renviron)r6r7) local_varsrrr9s    z_subst_vars.._replacer)r>r?)rrEr9r)rEr _subst_varss rFcCs4|j}x&|jD]\}}||kr$q|||<qWdS)N)keysr:) target_dict other_dict target_keyskeyrArrr _extend_dicts rLcCsdi}|dkri}t|txBtj|D]4\}}tjdkrFtjj|}tjjt ||||<q(W|S)Nposixr)rMr) rLrr.r:rr7r expandusernormpathrF)r2varsresrKrArrr _expand_varss   rRcsfdd}tj||S)Ncs$|jd}|kr|S|jdS)Nr$r)r5)r6r7)rPrrr9s zformat_value.._replacer)r>r?)rArPr9r)rPr format_values rScCstjdkrdStjS)NrMr%)rr7rrrr_get_default_schemes rTcCstjjdd}dd}tjdkrBtjjdp.d}|r8|S||dStjdkr|td }|r||r`|S|dd |d tjdd S|r|S|dd SdS)NPYTHONUSERBASEcWstjjtjj|S)N)rrrNr)argsrrrjoinusersz_getuserbase..joinuserrAPPDATA~PythondarwinPYTHONFRAMEWORKLibraryz%d.%dr!z.local)rrDgetr7sysplatformr version_info)env_baserWbase frameworkrrr _getuserbases"    recCs"tjd}tjd}tjd}|dkr*i}i}i}tj|ddd}|j}WdQRXx|D]} | jds\| jd krxq\|j| } | r\| jd d \} } | j} | j d d } d | kr| || <q\y t | } Wn$t k r| j d d || <Yq\X| || <q\Wt |j }d}xt|dkrxt|D]}||}|j|pJ|j|} | dk r| jd } d}| |kr|t|| }n| |krd}nx| tjkrtj| }n`| |kr|jdr|dd|krd }n$d| |krd}nt|d| }n d || <}|r|| jd}|d| j||}d |krF|||<n~y t |}Wn"t k rt|j||<Yn X|||<|j||jdr|dd|kr|dd}||kr|||<n|||<|j|q(WqWx.|jD]"\}} t| tr| j||<qW|j||S)zParse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. z"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}Nzutf-8surrogateescape)encodingerrors#r$r!z$$$CFLAGSLDFLAGSCPPFLAGSrTFPY_rC)rlrmrn)recompilecodecsopen readlines startswithstripmatchr5replaceint ValueErrorlistrGlenr;searchstrrrDendstartremover: isinstanceupdate)filenamerP _variable_rx _findvar1_rx _findvar2_rxdonenotdoneflineslinemnvtmpvr8renamed_variablesr7rAfounditemafterkrrr_parse_makefiles                             rcCsDtrtjjtdSttdr,dttjf}nd}tjjt d|dS)z Return the path of the Makefile.Makefileabiflagsz config-%s%sr@stdlib) r/rrrrhasattrr__PY_VERSION_SHORTrr)config_dir_namerrrrMs  cCst}yt||WnJtk r^}z.d|}t|drF|d|j}t|WYdd}~XnXt}y"t|}t||WdQRXWnJtk r}z.d|}t|dr|d|j}t|WYdd}~XnXtr|d|d<dS)z7Initialize the module as appropriate for POSIX systems.z.invalid Python installation: unable to open %sstrerrorz (%s)N BLDSHAREDLDSHARED) rrIOErrorrrrrsrr/)rPmakefileemsgconfig_hrrrr _init_posixXs&   rcCsVtd|d<td|d<td|d<d|d<d |d <t|d <tjjttj|d <d S)z+Initialize the module as appropriate for NTrLIBDEST platstdlib BINLIBDESTr' INCLUDEPYz.pydSOz.exeEXEVERSIONBINDIRN)r_PY_VERSION_SHORT_NO_DOTrrdirnamerr_ executable)rPrrr_init_non_posixts   rc Cs|dkr i}tjd}tjd}xx|j}|s0P|j|}|rz|jdd\}}y t|}Wntk rnYnX|||<q"|j|}|r"d||jd<q"W|S)zParse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. Nz"#define ([A-Z][A-Za-z0-9_]+) (.*) z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/ r$r!r)rprqreadlinerwr5ryrz)fprP define_rxundef_rxrrrrrrrrs(      cCs:tr$tjdkrtjjtd}q,t}ntd}tjj|dS)zReturn the path of pyconfig.h.rPCr(z pyconfig.h)r/rr7rrrr)inc_dirrrrrs  cCstttjS)z,Return a tuple containing the schemes names.)r;sortedr.r<rrrrr scCs tjdS)z*Return a tuple containing the paths names.r%)r.Zoptionsrrrrr sTcCs&t|rt||Sttj|SdS)zReturn a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. N)r3rRr=r.r:)r2rPexpandrrrr s cCst||||S)z[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. )r )r7r2rPrrrrrscGstdkriattd<ttd<ttd<ttd<tdtdtd<ttd <ttd <ttd <ytjtd <Wntk rd td <YnXt j d#krt tt j dkrt ttj dkrttd<dtkrttd<nttdtd<tot j dkr\t}y t j}Wntk rd}YnXt jjtd r\||kr\t jj|td}t jj|td<tjdkrt jd}t|jdd}|dkrx:d$D]2}t|}tjdd|}tjdd|}|t|<qWndt jkrt jd}x8d%D]0}t|}tjdd|}|d|}|t|<qWtjdd } tjd | } | dk r| j d!} t jj!| sx,d&D]$}t|}tjd"d|}|t|<q^W|rg} x|D]} | j"tj| qW| StSdS)'ayWith no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. Nprefix exec_prefix py_versionpy_version_shortrr!py_version_nodotrcplatbase projectbaserrjros2rMz2.6userbasesrcdirr[r#rrm BASECFLAGSrl PY_CFLAGSrz -arch\s+\w+\s z-isysroot [^ ]*Z ARCHFLAGSz-isysroot\s+(\S+)r$z-isysroot\s+\S+(\s|$))rr)rmrrlrr)rmrrlrr)rmrrlrr)# _CONFIG_VARS_PREFIX _EXEC_PREFIX _PY_VERSIONrrr_rAttributeErrorrr7rrversionrerr/getcwdrrisabsrrOr`unamerysplitrpr?rDr^r}r5existsappend)rVrccwdrZkernel_versionZ major_versionrKflagsZarchrlrZsdkvalsr7rrrrs                    cCs tj|S)zReturn the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) )rr^)r7rrrrRscCs`tjdkrnd}tjj|}|d:kr(tjStjjd|}tj|t||j}|dkr\dS|dkrhdStjStjd ksttd  rtjStj \}}}}}|jj d d }|j d d}|j d d}|dddkrd||fS|dddkr(|ddkrRd}dt |dd|ddf}n*|dddkrFd||fS|dddkrfd|||fS|ddd krd }t j d!} | j|} | rR| j}n|ddd"krRt} | jd#} | } y td$}Wntk rYnJXzt jd%|j} Wd|jX| dk r4d&j| jdjd&dd} | s>| } | rR| }d'}| d&d(krd)tjd*d jkrd+}tjd*}t jd,|}ttt|}t|dkr|d}n^|d;krd+}nN|d|d=krd1}n.|d>krd3}n|d?krd4}ntd5|fn<|d-kr2tjd@krRd/}n |dAkrRtjdBkrNd2}nd.}d9|||fS)CaReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. rz bit (r$)amd64z win-amd64itaniumzwin-ia64rMr/rjr_-Nlinuxz%s-%ssunosr5solarisz%d.%srCr!irixaixz%s-%s.%scygwinz[\d.]+r[MACOSX_DEPLOYMENT_TARGETz0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)r#Zmacosxz10.4.z-archrlZfatz -arch\s+(\S+)i386ppcx86_64ZintelZfat3ppc64Zfat64Z universalz%Don't know machine value for archs=%r PowerPCPower_Macintoshz%s-%s-%s)rr)rr)rrr)rr)rrrrl)rrl) rr7r_rr,r`r|lowerrrrxryrprqrwr5rr^rsrr}readcloserrrvfindallr;rr0rzmaxsize)rijlookosnamehostreleasermachinerel_rerZcfgvarsZmacverZ macreleaserZcflagsZarchsrrrr [s     $                    cCstS)N)rrrrrr scCsJxDtt|jD]0\}\}}|dkr2td|td||fqWdS)Nrz%s: z %s = "%s") enumeraterr:print)titledataindexrKrArrr _print_dicts rcCsRtdttdttdtttdtttdtdS)z*Display all information sysconfig detains.zPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"Paths VariablesN)rr r rTrr rrrrr_mains r__main__iii)N)N)A__doc__rrrrpr_Zos.pathrrZ configparser ImportErrorZ ConfigParser__all__rrrrrrr7rrr r/r)r3ZRawConfigParserr.rqr>rBrrrrrrOrrrrr _USER_BASErFrLrRrSrTrerrrrrrr r r rrrr r rrr*rrrrs   " #   v     # distlib/_backport/__pycache__/__init__.cpython-36.pyc000064400000000613152347724720016554 0ustar003 Pf@sdZdS)a Modules copied from Python 3 standard libraries, for internal use only. Individual classes and functions are found in d2._backport.misc. Intended usage is to always import things missing from 3.1 from that module: the built-in/stdlib objects will be used if found. N)__doc__rr/usr/lib/python3.6/__init__.pysdistlib/_backport/__pycache__/__init__.cpython-36.opt-1.pyc000064400000000613152347724720017513 0ustar003 Pf@sdZdS)a Modules copied from Python 3 standard libraries, for internal use only. Individual classes and functions are found in d2._backport.misc. Intended usage is to always import things missing from 3.1 from that module: the built-in/stdlib objects will be used if found. N)__doc__rr/usr/lib/python3.6/__init__.pysdistlib/_backport/__pycache__/sysconfig.cpython-36.opt-1.pyc000064400000037031152347724720017764 0ustar003 PfKi@sdZddlZddlZddlZddlZddlmZmZy ddlZWne k r\ddl ZYnXdddddd d d d d dg Z ddZ ej rejje ej Zn e ejZejdkrdedEdjkre ejjeeZejdkodedFdjkr e ejjeeeZejdkr@dedGdjkr@e ejjeeeZddZeZdaddZejZejdZddZejjdZ ejdd Z!e de d!Z"ejj#ej$Z%ejj#ej&Z'da(dZ)d"d#Z*d$d%Z+d&d'Z,d(d)Z-d*d+Z.d,d-Z/dHd.d/Z0d0dZ1d1d2Z2d3d4Z3dId5dZ4d6dZ5d7d Z6d8d Z7e.dd9fd:d Z8e.dd9fd;dZ9dd ZdBdCZ?e@dDkre?dS)Jz-Access to Python's configuration information.N)pardirrealpathget_config_h_filenameget_config_varget_config_varsget_makefile_filenameget_pathget_path_names get_paths get_platformget_python_versionget_scheme_namesparse_config_hc Cs"yt|Stk r|SXdS)N)rOSError)pathr/usr/lib/python3.6/sysconfig.py_safe_realpath"srntZpcbuildz\pc\v z\pcbuild\amd64cCs.x(dD] }tjjtjjtd|rdSqWdS)N Setup.dist Setup.localModulesTF)rr)osrisfilejoin _PROJECT_BASE)fnrrris_python_build:s r Fc Cstsddlm}tjddd}||}|jd}|j}tj|WdQRXt r~x(dD] }tj |d d tj |d d qZWd adS)N)finder.rz sysconfig.cfg posix_prefix posix_homeincludez{srcdir}/Include platincludez{projectbase}/.T)r%r&) _cfg_readZ resourcesr"__name__rsplitfindZ as_stream_SCHEMESZreadfp _PYTHON_BUILDset)r"Zbackport_packageZ_finderZ_cfgfilesschemerrr_ensure_cfg_readDs    r2z \{([^{]*?)\}cst|jdr|jd}nt}|j}xD|D]<}|dkr>q0x,|D]$\}}|j||rZqD|j|||qDWq0W|jdxX|jD]L}t|j|fdd}x,|j|D]\}}|j||t j ||qWqWdS)Nglobalscs$|jd}|kr|S|jdS)Nr$r)group)matchobjname) variablesrr _replaceros z"_expand_globals.._replacer) r2Z has_sectionitemstuplesectionsZ has_optionr/Zremove_sectiondict _VAR_REPLsub)configr3r;ZsectionZoptionvaluer8r)r7r_expand_globalsYs$      rAr!csfdd}tj||S)zIn the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. cs8|jd}|kr|S|tjkr.tj|S|jdS)Nr$r)r4renviron)r5r6) local_varsrrr8s    z_subst_vars.._replacer)r=r>)rrDr8r)rDr _subst_varss rEcCs4|j}x&|jD]\}}||kr$q|||<qWdS)N)keysr9) target_dict other_dict target_keyskeyr@rrr _extend_dicts rKcCsdi}|dkri}t|txBtj|D]4\}}tjdkrFtjj|}tjjt ||||<q(W|S)Nposixr)rLr) rKrr-r9rr6r expandusernormpathrE)r1varsresrJr@rrr _expand_varss   rQcsfdd}tj||S)Ncs$|jd}|kr|S|jdS)Nr$r)r4)r5r6)rOrrr8s zformat_value.._replacer)r=r>)r@rOr8r)rOr format_values rRcCstjdkrdStjS)NrLr%)rr6rrrr_get_default_schemes rScCstjjdd}dd}tjdkrBtjjdp.d}|r8|S||dStjdkr|td }|r||r`|S|dd |d tjdd S|r|S|dd SdS)NPYTHONUSERBASEcWstjjtjj|S)N)rrrMr)argsrrrjoinusersz_getuserbase..joinuserrAPPDATA~PythondarwinPYTHONFRAMEWORKLibraryz%d.%dr!z.local)rrCgetr6sysplatformr version_info)env_baserVbase frameworkrrr _getuserbases"    rdcCs"tjd}tjd}tjd}|dkr*i}i}i}tj|ddd}|j}WdQRXx|D]} | jds\| jd krxq\|j| } | r\| jd d \} } | j} | j d d } d | kr| || <q\y t | } Wn$t k r| j d d || <Yq\X| || <q\Wt |j }d}xt|dkrxt|D]}||}|j|pJ|j|} | dk r| jd } d}| |kr|t|| }n| |krd}nx| tjkrtj| }n`| |kr|jdr|dd|krd }n$d| |krd}nt|d| }n d || <}|r|| jd}|d| j||}d |krF|||<n~y t |}Wn"t k rt|j||<Yn X|||<|j||jdr|dd|kr|dd}||kr|||<n|||<|j|q(WqWx.|jD]"\}} t| tr| j||<qW|j||S)zParse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. z"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}Nzutf-8surrogateescape)encodingerrors#r$r!z$$$CFLAGSLDFLAGSCPPFLAGSrTFPY_rB)rkrlrm)recompilecodecsopen readlines startswithstripmatchr4replaceint ValueErrorlistrFlenr:searchstrrrCendstartremover9 isinstanceupdate)filenamerO _variable_rx _findvar1_rx _findvar2_rxdonenotdoneflineslinemnvtmpvr7renamed_variablesr6r@founditemafterkrrr_parse_makefiles                             rcCsDtrtjjtdSttdr,dttjf}nd}tjjt d|dS)z Return the path of the Makefile.Makefileabiflagsz config-%s%sr?stdlib) r.rrrrhasattrr^_PY_VERSION_SHORTrr)config_dir_namerrrrMs  cCst}yt||WnJtk r^}z.d|}t|drF|d|j}t|WYdd}~XnXt}y"t|}t||WdQRXWnJtk r}z.d|}t|dr|d|j}t|WYdd}~XnXtr|d|d<dS)z7Initialize the module as appropriate for POSIX systems.z.invalid Python installation: unable to open %sstrerrorz (%s)N BLDSHAREDLDSHARED) rrIOErrorrrrrrrr.)rOmakefileemsgconfig_hrrrr _init_posixXs&   rcCsVtd|d<td|d<td|d<d|d<d |d <t|d <tjjttj|d <d S)z+Initialize the module as appropriate for NTrLIBDEST platstdlib BINLIBDESTr' INCLUDEPYz.pydSOz.exeEXEVERSIONBINDIRN)r_PY_VERSION_SHORT_NO_DOTrrdirnamerr^ executable)rOrrr_init_non_posixts   rc Cs|dkr i}tjd}tjd}xx|j}|s0P|j|}|rz|jdd\}}y t|}Wntk rnYnX|||<q"|j|}|r"d||jd<q"W|S)zParse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. Nz"#define ([A-Z][A-Za-z0-9_]+) (.*) z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/ r$r!r)rorpreadlinervr4rxry)fprO define_rxundef_rxrrrrrrrrs(      cCs:tr$tjdkrtjjtd}q,t}ntd}tjj|dS)zReturn the path of pyconfig.h.rPCr(z pyconfig.h)r.rr6rrrr)inc_dirrrrrs  cCstttjS)z,Return a tuple containing the schemes names.)r:sortedr-r;rrrrr scCs tjdS)z*Return a tuple containing the paths names.r%)r-Zoptionsrrrrr sTcCs&t|rt||Sttj|SdS)zReturn a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. N)r2rQr<r-r9)r1rOexpandrrrr s cCst||||S)z[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. )r )r6r1rOrrrrrscGstdkriattd<ttd<ttd<ttd<tdtdtd<ttd <ttd <ttd <ytjtd <Wntk rd td <YnXt j d#krt tt j dkrt ttj dkrttd<dtkrttd<nttdtd<tot j dkr\t}y t j}Wntk rd}YnXt jjtd r\||kr\t jj|td}t jj|td<tjdkrt jd}t|jdd}|dkrx:d$D]2}t|}tjdd|}tjdd|}|t|<qWndt jkrt jd}x8d%D]0}t|}tjdd|}|d|}|t|<qWtjdd } tjd | } | dk r| j d!} t jj!| sx,d&D]$}t|}tjd"d|}|t|<q^W|rg} x|D]} | j"tj| qW| StSdS)'ayWith no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. Nprefix exec_prefix py_versionpy_version_shortrr!py_version_nodotrbplatbase projectbaserriros2rLz2.6userbasesrcdirrZr#rrl BASECFLAGSrk PY_CFLAGSrz -arch\s+\w+\s z-isysroot [^ ]*Z ARCHFLAGSz-isysroot\s+(\S+)r$z-isysroot\s+\S+(\s|$))rr)rlrrkrr)rlrrkrr)rlrrkrr)# _CONFIG_VARS_PREFIX _EXEC_PREFIX _PY_VERSIONrrr^rAttributeErrorrr6rrversionrdrr.getcwdrrisabsrrNr_unamerxsplitror>rCr]r|r4existsappend)rUrbcwdrZkernel_versionZ major_versionrJflagsZarchrkrZsdkvalsr6rrrrs                    cCs tj|S)zReturn the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) )rr])r6rrrrRscCs`tjdkrnd}tjj|}|d:kr(tjStjjd|}tj|t||j}|dkr\dS|dkrhdStjStjd ksttd  rtjStj \}}}}}|jj d d }|j d d}|j d d}|dddkrd||fS|dddkr(|ddkrRd}dt |dd|ddf}n*|dddkrFd||fS|dddkrfd|||fS|ddd krd }t j d!} | j|} | rR| j}n|ddd"krRt} | jd#} | } y td$}Wntk rYnJXzt jd%|j} Wd|jX| dk r4d&j| jdjd&dd} | s>| } | rR| }d'}| d&d(krd)tjd*d jkrd+}tjd*}t jd,|}ttt|}t|dkr|d}n^|d;krd+}nN|d|d=krd1}n.|d>krd3}n|d?krd4}ntd5|fn<|d-kr2tjd@krRd/}n |dAkrRtjdBkrNd2}nd.}d9|||fS)CaReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. rz bit (r$)amd64z win-amd64itaniumzwin-ia64rLr/rir_-Nlinuxz%s-%ssunosr5solarisz%d.%srBr!irixaixz%s-%s.%scygwinz[\d.]+rZMACOSX_DEPLOYMENT_TARGETz0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)r#Zmacosxz10.4.z-archrkZfatz -arch\s+(\S+)i386ppcx86_64ZintelZfat3ppc64Zfat64Z universalz%Don't know machine value for archs=%r PowerPCPower_Macintoshz%s-%s-%s)rr)rr)rrr)rr)rrrrl)rrl) rr6r^rr,r_r{lowerrrrwrxrorprvr4rr]rrrr|readcloserrrufindallr:rr/rymaxsize)rijlookosnamehostreleasermachinerel_rerZcfgvarsZmacverZ macreleaserZcflagsZarchsrrrr [s     $                    cCstS)N)rrrrrr scCsJxDtt|jD]0\}\}}|dkr2td|td||fqWdS)Nrz%s: z %s = "%s") enumeraterr9print)titledataindexrJr@rrr _print_dicts rcCsRtdttdttdtttdtttdtdS)z*Display all information sysconfig detains.zPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"Paths VariablesN)rr r rSrr rrrrr_mains r__main__iii)N)N)A__doc__rqrror^Zos.pathrrZ configparser ImportErrorZ ConfigParser__all__rrrrrrr6rrr r.r)r2ZRawConfigParserr-rpr=rArrrrrrNrrrrr _USER_BASErErKrQrRrSrdrrrrrrr r r rrrr r rrr*rrrrs   " #   v     # distlib/_backport/__pycache__/misc.cpython-36.pyc000064400000001740152347724720015752 0ustar003 Pf@sdZddlZddlZdddgZyddlmZWnek rLd ddZYnXyeZWn(ek r~dd l m Z d dZYnXy ej Z Wne k rd dZ YnXdS) z/Backports for individual classes and functions.Ncache_from_sourcecallablefsencode)rTcCs|rdp d}||S)Nco)Zpy_filedebugZextrr/usr/lib/python3.6/misc.pyrs )CallablecCs t|tS)N) isinstancer )objrrr rscCs<t|tr|St|tr&|jtjStdt|jdS)Nzexpect bytes or str, not %s) r bytesstrencodesysgetfilesystemencoding TypeErrortype__name__)filenamerrr r"s   )T) __doc__osr__all__Zimpr ImportErrorr NameError collectionsr rAttributeErrorrrrr s    distlib/_backport/misc.py000064400000001713152347724720011466 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """Backports for individual classes and functions.""" import os import sys __all__ = ['cache_from_source', 'callable', 'fsencode'] try: from imp import cache_from_source except ImportError: def cache_from_source(py_file, debug=__debug__): ext = debug and 'c' or 'o' return py_file + ext try: callable = callable except NameError: from collections import Callable def callable(obj): return isinstance(obj, Callable) try: fsencode = os.fsencode except AttributeError: def fsencode(filename): if isinstance(filename, bytes): return filename elif isinstance(filename, str): return filename.encode(sys.getfilesystemencoding()) else: raise TypeError("expect bytes or str, not %s" % type(filename).__name__) distlib/_backport/sysconfig.cfg000064400000005071152347724720012647 0ustar00[posix_prefix] # Configuration directories. Some of these come straight out of the # configure script. They are for implementing the other variables, not to # be used directly in [resource_locations]. confdir = /etc datadir = /usr/share libdir = /usr/lib statedir = /var # User resource directory local = ~/.local/{distribution.name} stdlib = {base}/lib/python{py_version_short} platstdlib = {platbase}/lib/python{py_version_short} purelib = {base}/lib/python{py_version_short}/site-packages platlib = {platbase}/lib/python{py_version_short}/site-packages include = {base}/include/python{py_version_short}{abiflags} platinclude = {platbase}/include/python{py_version_short}{abiflags} data = {base} [posix_home] stdlib = {base}/lib/python platstdlib = {base}/lib/python purelib = {base}/lib/python platlib = {base}/lib/python include = {base}/include/python platinclude = {base}/include/python scripts = {base}/bin data = {base} [nt] stdlib = {base}/Lib platstdlib = {base}/Lib purelib = {base}/Lib/site-packages platlib = {base}/Lib/site-packages include = {base}/Include platinclude = {base}/Include scripts = {base}/Scripts data = {base} [os2] stdlib = {base}/Lib platstdlib = {base}/Lib purelib = {base}/Lib/site-packages platlib = {base}/Lib/site-packages include = {base}/Include platinclude = {base}/Include scripts = {base}/Scripts data = {base} [os2_home] stdlib = {userbase}/lib/python{py_version_short} platstdlib = {userbase}/lib/python{py_version_short} purelib = {userbase}/lib/python{py_version_short}/site-packages platlib = {userbase}/lib/python{py_version_short}/site-packages include = {userbase}/include/python{py_version_short} scripts = {userbase}/bin data = {userbase} [nt_user] stdlib = {userbase}/Python{py_version_nodot} platstdlib = {userbase}/Python{py_version_nodot} purelib = {userbase}/Python{py_version_nodot}/site-packages platlib = {userbase}/Python{py_version_nodot}/site-packages include = {userbase}/Python{py_version_nodot}/Include scripts = {userbase}/Scripts data = {userbase} [posix_user] stdlib = {userbase}/lib/python{py_version_short} platstdlib = {userbase}/lib/python{py_version_short} purelib = {userbase}/lib/python{py_version_short}/site-packages platlib = {userbase}/lib/python{py_version_short}/site-packages include = {userbase}/include/python{py_version_short} scripts = {userbase}/bin data = {userbase} [osx_framework_user] stdlib = {userbase}/lib/python platstdlib = {userbase}/lib/python purelib = {userbase}/lib/python/site-packages platlib = {userbase}/lib/python/site-packages include = {userbase}/include scripts = {userbase}/bin data = {userbase} distlib/_backport/__init__.py000064400000000422152347724720012266 0ustar00"""Modules copied from Python 3 standard libraries, for internal use only. Individual classes and functions are found in d2._backport.misc. Intended usage is to always import things missing from 3.1 from that module: the built-in/stdlib objects will be used if found. """ distlib/util.py000064400000164705152347724720007557 0ustar00# # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try: import ssl except ImportError: # pragma: no cover ssl = None import subprocess import sys import tarfile import tempfile import textwrap try: import threading except ImportError: # pragma: no cover import dummy_threading as threading import time from . import DistlibException from .compat import (string_types, text_type, shutil, raw_input, StringIO, cache_from_source, urlopen, urljoin, httplib, xmlrpclib, splittype, HTTPHandler, BaseConfigurator, valid_ident, Container, configparser, URLError, ZipFile, fsdecode, unquote, urlparse) logger = logging.getLogger(__name__) # # Requirement parsing code as per PEP 508 # IDENTIFIER = re.compile(r'^([\w\.-]+)\s*') VERSION_IDENTIFIER = re.compile(r'^([\w\.*+-]+)\s*') COMPARE_OP = re.compile(r'^(<=?|>=?|={2,3}|[~!]=)\s*') MARKER_OP = re.compile(r'^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*') OR = re.compile(r'^or\b\s*') AND = re.compile(r'^and\b\s*') NON_SPACE = re.compile(r'(\S+)\s*') STRING_CHUNK = re.compile(r'([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)') def parse_marker(marker_string): """ Parse a marker string and return a dictionary containing a marker expression. The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in the expression grammar, or strings. A string contained in quotes is to be interpreted as a literal string, and a string not contained in quotes is a variable (such as os_name). """ def marker_var(remaining): # either identifier, or literal string m = IDENTIFIER.match(remaining) if m: result = m.groups()[0] remaining = remaining[m.end():] elif not remaining: raise SyntaxError('unexpected end of input') else: q = remaining[0] if q not in '\'"': raise SyntaxError('invalid expression: %s' % remaining) oq = '\'"'.replace(q, '') remaining = remaining[1:] parts = [q] while remaining: # either a string chunk, or oq, or q to terminate if remaining[0] == q: break elif remaining[0] == oq: parts.append(oq) remaining = remaining[1:] else: m = STRING_CHUNK.match(remaining) if not m: raise SyntaxError('error in string literal: %s' % remaining) parts.append(m.groups()[0]) remaining = remaining[m.end():] else: s = ''.join(parts) raise SyntaxError('unterminated string: %s' % s) parts.append(q) result = ''.join(parts) remaining = remaining[1:].lstrip() # skip past closing quote return result, remaining def marker_expr(remaining): if remaining and remaining[0] == '(': result, remaining = marker(remaining[1:].lstrip()) if remaining[0] != ')': raise SyntaxError('unterminated parenthesis: %s' % remaining) remaining = remaining[1:].lstrip() else: lhs, remaining = marker_var(remaining) while remaining: m = MARKER_OP.match(remaining) if not m: break op = m.groups()[0] remaining = remaining[m.end():] rhs, remaining = marker_var(remaining) lhs = {'op': op, 'lhs': lhs, 'rhs': rhs} result = lhs return result, remaining def marker_and(remaining): lhs, remaining = marker_expr(remaining) while remaining: m = AND.match(remaining) if not m: break remaining = remaining[m.end():] rhs, remaining = marker_expr(remaining) lhs = {'op': 'and', 'lhs': lhs, 'rhs': rhs} return lhs, remaining def marker(remaining): lhs, remaining = marker_and(remaining) while remaining: m = OR.match(remaining) if not m: break remaining = remaining[m.end():] rhs, remaining = marker_and(remaining) lhs = {'op': 'or', 'lhs': lhs, 'rhs': rhs} return lhs, remaining return marker(marker_string) def parse_requirement(req): """ Parse a requirement passed in as a string. Return a Container whose attributes contain the various parts of the requirement. """ remaining = req.strip() if not remaining or remaining.startswith('#'): return None m = IDENTIFIER.match(remaining) if not m: raise SyntaxError('name expected: %s' % remaining) distname = m.groups()[0] remaining = remaining[m.end():] extras = mark_expr = versions = uri = None if remaining and remaining[0] == '[': i = remaining.find(']', 1) if i < 0: raise SyntaxError('unterminated extra: %s' % remaining) s = remaining[1:i] remaining = remaining[i + 1:].lstrip() extras = [] while s: m = IDENTIFIER.match(s) if not m: raise SyntaxError('malformed extra: %s' % s) extras.append(m.groups()[0]) s = s[m.end():] if not s: break if s[0] != ',': raise SyntaxError('comma expected in extras: %s' % s) s = s[1:].lstrip() if not extras: extras = None if remaining: if remaining[0] == '@': # it's a URI remaining = remaining[1:].lstrip() m = NON_SPACE.match(remaining) if not m: raise SyntaxError('invalid URI: %s' % remaining) uri = m.groups()[0] t = urlparse(uri) # there are issues with Python and URL parsing, so this test # is a bit crude. See bpo-20271, bpo-23505. Python doesn't # always parse invalid URLs correctly - it should raise # exceptions for malformed URLs if not (t.scheme and t.netloc): raise SyntaxError('Invalid URL: %s' % uri) remaining = remaining[m.end():].lstrip() else: def get_versions(ver_remaining): """ Return a list of operator, version tuples if any are specified, else None. """ m = COMPARE_OP.match(ver_remaining) versions = None if m: versions = [] while True: op = m.groups()[0] ver_remaining = ver_remaining[m.end():] m = VERSION_IDENTIFIER.match(ver_remaining) if not m: raise SyntaxError('invalid version: %s' % ver_remaining) v = m.groups()[0] versions.append((op, v)) ver_remaining = ver_remaining[m.end():] if not ver_remaining or ver_remaining[0] != ',': break ver_remaining = ver_remaining[1:].lstrip() m = COMPARE_OP.match(ver_remaining) if not m: raise SyntaxError('invalid constraint: %s' % ver_remaining) if not versions: versions = None return versions, ver_remaining if remaining[0] != '(': versions, remaining = get_versions(remaining) else: i = remaining.find(')', 1) if i < 0: raise SyntaxError('unterminated parenthesis: %s' % remaining) s = remaining[1:i] remaining = remaining[i + 1:].lstrip() # As a special diversion from PEP 508, allow a version number # a.b.c in parentheses as a synonym for ~= a.b.c (because this # is allowed in earlier PEPs) if COMPARE_OP.match(s): versions, _ = get_versions(s) else: m = VERSION_IDENTIFIER.match(s) if not m: raise SyntaxError('invalid constraint: %s' % s) v = m.groups()[0] s = s[m.end():].lstrip() if s: raise SyntaxError('invalid constraint: %s' % s) versions = [('~=', v)] if remaining: if remaining[0] != ';': raise SyntaxError('invalid requirement: %s' % remaining) remaining = remaining[1:].lstrip() mark_expr, remaining = parse_marker(remaining) if remaining and remaining[0] != '#': raise SyntaxError('unexpected trailing data: %s' % remaining) if not versions: rs = distname else: rs = '%s %s' % (distname, ', '.join(['%s %s' % con for con in versions])) return Container(name=distname, extras=extras, constraints=versions, marker=mark_expr, url=uri, requirement=rs) def get_resources_dests(resources_root, rules): """Find destinations for resources files""" def get_rel_path(root, path): # normalizes and returns a lstripped-/-separated path root = root.replace(os.path.sep, '/') path = path.replace(os.path.sep, '/') assert path.startswith(root) return path[len(root):].lstrip('/') destinations = {} for base, suffix, dest in rules: prefix = os.path.join(resources_root, base) for abs_base in iglob(prefix): abs_glob = os.path.join(abs_base, suffix) for abs_path in iglob(abs_glob): resource_file = get_rel_path(resources_root, abs_path) if dest is None: # remove the entry if it was here destinations.pop(resource_file, None) else: rel_path = get_rel_path(abs_base, abs_path) rel_dest = dest.replace(os.path.sep, '/').rstrip('/') destinations[resource_file] = rel_dest + '/' + rel_path return destinations def in_venv(): if hasattr(sys, 'real_prefix'): # virtualenv venvs result = True else: # PEP 405 venvs result = sys.prefix != getattr(sys, 'base_prefix', sys.prefix) return result def get_executable(): # The __PYVENV_LAUNCHER__ dance is apparently no longer needed, as # changes to the stub launcher mean that sys.executable always points # to the stub on OS X # if sys.platform == 'darwin' and ('__PYVENV_LAUNCHER__' # in os.environ): # result = os.environ['__PYVENV_LAUNCHER__'] # else: # result = sys.executable # return result result = os.path.normcase(sys.executable) if not isinstance(result, text_type): result = fsdecode(result) return result def proceed(prompt, allowed_chars, error_prompt=None, default=None): p = prompt while True: s = raw_input(p) p = prompt if not s and default: s = default if s: c = s[0].lower() if c in allowed_chars: break if error_prompt: p = '%c: %s\n%s' % (c, error_prompt, prompt) return c def extract_by_key(d, keys): if isinstance(keys, string_types): keys = keys.split() result = {} for key in keys: if key in d: result[key] = d[key] return result def read_exports(stream): if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getreader('utf-8')(stream) # Try to load as JSON, falling back on legacy format data = stream.read() stream = StringIO(data) try: jdata = json.load(stream) result = jdata['extensions']['python.exports']['exports'] for group, entries in result.items(): for k, v in entries.items(): s = '%s = %s' % (k, v) entry = get_export_entry(s) assert entry is not None entries[k] = entry return result except Exception: stream.seek(0, 0) def read_stream(cp, stream): if hasattr(cp, 'read_file'): cp.read_file(stream) else: cp.readfp(stream) cp = configparser.ConfigParser() try: read_stream(cp, stream) except configparser.MissingSectionHeaderError: stream.close() data = textwrap.dedent(data) stream = StringIO(data) read_stream(cp, stream) result = {} for key in cp.sections(): result[key] = entries = {} for name, value in cp.items(key): s = '%s = %s' % (name, value) entry = get_export_entry(s) assert entry is not None #entry.dist = self entries[name] = entry return result def write_exports(exports, stream): if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getwriter('utf-8')(stream) cp = configparser.ConfigParser() for k, v in exports.items(): # TODO check k, v for valid values cp.add_section(k) for entry in v.values(): if entry.suffix is None: s = entry.prefix else: s = '%s:%s' % (entry.prefix, entry.suffix) if entry.flags: s = '%s [%s]' % (s, ', '.join(entry.flags)) cp.set(k, entry.name, s) cp.write(stream) @contextlib.contextmanager def tempdir(): td = tempfile.mkdtemp() try: yield td finally: shutil.rmtree(td) @contextlib.contextmanager def chdir(d): cwd = os.getcwd() try: os.chdir(d) yield finally: os.chdir(cwd) @contextlib.contextmanager def socket_timeout(seconds=15): cto = socket.getdefaulttimeout() try: socket.setdefaulttimeout(seconds) yield finally: socket.setdefaulttimeout(cto) class cached_property(object): def __init__(self, func): self.func = func #for attr in ('__name__', '__module__', '__doc__'): # setattr(self, attr, getattr(func, attr, None)) def __get__(self, obj, cls=None): if obj is None: return self value = self.func(obj) object.__setattr__(obj, self.func.__name__, value) #obj.__dict__[self.func.__name__] = value = self.func(obj) return value def convert_path(pathname): """Return 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if not pathname: return pathname if pathname[0] == '/': raise ValueError("path '%s' cannot be absolute" % pathname) if pathname[-1] == '/': raise ValueError("path '%s' cannot end with '/'" % pathname) paths = pathname.split('/') while os.curdir in paths: paths.remove(os.curdir) if not paths: return os.curdir return os.path.join(*paths) class FileOperator(object): def __init__(self, dry_run=False): self.dry_run = dry_run self.ensured = set() self._init_record() def _init_record(self): self.record = False self.files_written = set() self.dirs_created = set() def record_as_written(self, path): if self.record: self.files_written.add(path) def newer(self, source, target): """Tell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'source'. Raise PackagingFileError if 'source' does not exist. Note that this test is not very accurate: files created in the same second will have the same "age". """ if not os.path.exists(source): raise DistlibException("file '%r' does not exist" % os.path.abspath(source)) if not os.path.exists(target): return True return os.stat(source).st_mtime > os.stat(target).st_mtime def copy_file(self, infile, outfile, check=True): """Copy a file respecting dry-run and force flags. """ self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying %s to %s', infile, outfile) if not self.dry_run: msg = None if check: if os.path.islink(outfile): msg = '%s is a symlink' % outfile elif os.path.exists(outfile) and not os.path.isfile(outfile): msg = '%s is a non-regular file' % outfile if msg: raise ValueError(msg + ' which would be overwritten') shutil.copyfile(infile, outfile) self.record_as_written(outfile) def copy_stream(self, instream, outfile, encoding=None): assert not os.path.isdir(outfile) self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying stream %s to %s', instream, outfile) if not self.dry_run: if encoding is None: outstream = open(outfile, 'wb') else: outstream = codecs.open(outfile, 'w', encoding=encoding) try: shutil.copyfileobj(instream, outstream) finally: outstream.close() self.record_as_written(outfile) def write_binary_file(self, path, data): self.ensure_dir(os.path.dirname(path)) if not self.dry_run: if os.path.exists(path): os.remove(path) with open(path, 'wb') as f: f.write(data) self.record_as_written(path) def write_text_file(self, path, data, encoding): self.write_binary_file(path, data.encode(encoding)) def set_mode(self, bits, mask, files): if os.name == 'posix' or (os.name == 'java' and os._name == 'posix'): # Set the executable bits (owner, group, and world) on # all the files specified. for f in files: if self.dry_run: logger.info("changing mode of %s", f) else: mode = (os.stat(f).st_mode | bits) & mask logger.info("changing mode of %s to %o", f, mode) os.chmod(f, mode) set_executable_mode = lambda s, f: s.set_mode(0o555, 0o7777, f) def ensure_dir(self, path): path = os.path.abspath(path) if path not in self.ensured and not os.path.exists(path): self.ensured.add(path) d, f = os.path.split(path) self.ensure_dir(d) logger.info('Creating %s' % path) if not self.dry_run: os.mkdir(path) if self.record: self.dirs_created.add(path) def byte_compile(self, path, optimize=False, force=False, prefix=None, hashed_invalidation=False): dpath = cache_from_source(path, not optimize) logger.info('Byte-compiling %s to %s', path, dpath) if not self.dry_run: if force or self.newer(path, dpath): if not prefix: diagpath = None else: assert path.startswith(prefix) diagpath = path[len(prefix):] compile_kwargs = {} if hashed_invalidation and hasattr(py_compile, 'PycInvalidationMode'): compile_kwargs['invalidation_mode'] = py_compile.PycInvalidationMode.CHECKED_HASH py_compile.compile(path, dpath, diagpath, True, **compile_kwargs) # raise error self.record_as_written(dpath) return dpath def ensure_removed(self, path): if os.path.exists(path): if os.path.isdir(path) and not os.path.islink(path): logger.debug('Removing directory tree at %s', path) if not self.dry_run: shutil.rmtree(path) if self.record: if path in self.dirs_created: self.dirs_created.remove(path) else: if os.path.islink(path): s = 'link' else: s = 'file' logger.debug('Removing %s %s', s, path) if not self.dry_run: os.remove(path) if self.record: if path in self.files_written: self.files_written.remove(path) def is_writable(self, path): result = False while not result: if os.path.exists(path): result = os.access(path, os.W_OK) break parent = os.path.dirname(path) if parent == path: break path = parent return result def commit(self): """ Commit recorded changes, turn off recording, return changes. """ assert self.record result = self.files_written, self.dirs_created self._init_record() return result def rollback(self): if not self.dry_run: for f in list(self.files_written): if os.path.exists(f): os.remove(f) # dirs should all be empty now, except perhaps for # __pycache__ subdirs # reverse so that subdirs appear before their parents dirs = sorted(self.dirs_created, reverse=True) for d in dirs: flist = os.listdir(d) if flist: assert flist == ['__pycache__'] sd = os.path.join(d, flist[0]) os.rmdir(sd) os.rmdir(d) # should fail if non-empty self._init_record() def resolve(module_name, dotted_path): if module_name in sys.modules: mod = sys.modules[module_name] else: mod = __import__(module_name) if dotted_path is None: result = mod else: parts = dotted_path.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result class ExportEntry(object): def __init__(self, name, prefix, suffix, flags): self.name = name self.prefix = prefix self.suffix = suffix self.flags = flags @cached_property def value(self): return resolve(self.prefix, self.suffix) def __repr__(self): # pragma: no cover return '' % (self.name, self.prefix, self.suffix, self.flags) def __eq__(self, other): if not isinstance(other, ExportEntry): result = False else: result = (self.name == other.name and self.prefix == other.prefix and self.suffix == other.suffix and self.flags == other.flags) return result __hash__ = object.__hash__ ENTRY_RE = re.compile(r'''(?P(\w|[-.+])+) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? ''', re.VERBOSE) def get_export_entry(specification): m = ENTRY_RE.search(specification) if not m: result = None if '[' in specification or ']' in specification: raise DistlibException("Invalid specification " "'%s'" % specification) else: d = m.groupdict() name = d['name'] path = d['callable'] colons = path.count(':') if colons == 0: prefix, suffix = path, None else: if colons != 1: raise DistlibException("Invalid specification " "'%s'" % specification) prefix, suffix = path.split(':') flags = d['flags'] if flags is None: if '[' in specification or ']' in specification: raise DistlibException("Invalid specification " "'%s'" % specification) flags = [] else: flags = [f.strip() for f in flags.split(',')] result = ExportEntry(name, prefix, suffix, flags) return result def get_cache_base(suffix=None): """ Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will be the parent directory of the result. On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home directory - using os.expanduser('~') - will be the parent directory of the result. The result is just the directory '.distlib' in the parent directory as determined above, or with the name specified with ``suffix``. """ if suffix is None: suffix = '.distlib' if os.name == 'nt' and 'LOCALAPPDATA' in os.environ: result = os.path.expandvars('$localappdata') else: # Assume posix, or old Windows result = os.path.expanduser('~') # we use 'isdir' instead of 'exists', because we want to # fail if there's a file with that name if os.path.isdir(result): usable = os.access(result, os.W_OK) if not usable: logger.warning('Directory exists but is not writable: %s', result) else: try: os.makedirs(result) usable = True except OSError: logger.warning('Unable to create %s', result, exc_info=True) usable = False if not usable: result = tempfile.mkdtemp() logger.warning('Default location unusable, using %s', result) return os.path.join(result, suffix) def path_to_cache_dir(path): """ Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended. """ d, p = os.path.splitdrive(os.path.abspath(path)) if d: d = d.replace(':', '---') p = p.replace(os.sep, '--') return d + p + '.cache' def ensure_slash(s): if not s.endswith('/'): return s + '/' return s def parse_credentials(netloc): username = password = None if '@' in netloc: prefix, netloc = netloc.rsplit('@', 1) if ':' not in prefix: username = prefix else: username, password = prefix.split(':', 1) if username: username = unquote(username) if password: password = unquote(password) return username, password, netloc def get_process_umask(): result = os.umask(0o22) os.umask(result) return result def is_string_sequence(seq): result = True i = None for i, s in enumerate(seq): if not isinstance(s, string_types): result = False break assert i is not None return result PROJECT_NAME_AND_VERSION = re.compile('([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-' '([a-z0-9_.+-]+)', re.I) PYTHON_VERSION = re.compile(r'-py(\d\.?\d?)') def split_filename(filename, project_name=None): """ Extract name, version, python version from a filename (no extension) Return name, version, pyver or None """ result = None pyver = None filename = unquote(filename).replace(' ', '-') m = PYTHON_VERSION.search(filename) if m: pyver = m.group(1) filename = filename[:m.start()] if project_name and len(filename) > len(project_name) + 1: m = re.match(re.escape(project_name) + r'\b', filename) if m: n = m.end() result = filename[:n], filename[n + 1:], pyver if result is None: m = PROJECT_NAME_AND_VERSION.match(filename) if m: result = m.group(1), m.group(3), pyver return result # Allow spaces in name because of legacy dists like "Twisted Core" NAME_VERSION_RE = re.compile(r'(?P[\w .-]+)\s*' r'\(\s*(?P[^\s)]+)\)$') def parse_name_and_version(p): """ A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. """ m = NAME_VERSION_RE.match(p) if not m: raise DistlibException('Ill-formed name/version string: \'%s\'' % p) d = m.groupdict() return d['name'].strip().lower(), d['ver'] def get_extras(requested, available): result = set() requested = set(requested or []) available = set(available or []) if '*' in requested: requested.remove('*') result |= available for r in requested: if r == '-': result.add(r) elif r.startswith('-'): unwanted = r[1:] if unwanted not in available: logger.warning('undeclared extra: %s' % unwanted) if unwanted in result: result.remove(unwanted) else: if r not in available: logger.warning('undeclared extra: %s' % r) result.add(r) return result # # Extended metadata functionality # def _get_external_data(url): result = {} try: # urlopen might fail if it runs into redirections, # because of Python issue #13696. Fixed in locators # using a custom redirect handler. resp = urlopen(url) headers = resp.info() ct = headers.get('Content-Type') if not ct.startswith('application/json'): logger.debug('Unexpected response for JSON request: %s', ct) else: reader = codecs.getreader('utf-8')(resp) #data = reader.read().decode('utf-8') #result = json.loads(data) result = json.load(reader) except Exception as e: logger.exception('Failed to get external data for %s: %s', url, e) return result _external_data_base_url = 'https://www.red-dove.com/pypi/projects/' def get_project_data(name): url = '%s/%s/project.json' % (name[0].upper(), name) url = urljoin(_external_data_base_url, url) result = _get_external_data(url) return result def get_package_data(name, version): url = '%s/%s/package-%s.json' % (name[0].upper(), name, version) url = urljoin(_external_data_base_url, url) return _get_external_data(url) class Cache(object): """ A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. """ def __init__(self, base): """ Initialise an instance. :param base: The base directory where the cache should be located. """ # we use 'isdir' instead of 'exists', because we want to # fail if there's a file with that name if not os.path.isdir(base): # pragma: no cover os.makedirs(base) if (os.stat(base).st_mode & 0o77) != 0: logger.warning('Directory \'%s\' is not private', base) self.base = os.path.abspath(os.path.normpath(base)) def prefix_to_dir(self, prefix): """ Converts a resource prefix to a directory name in the cache. """ return path_to_cache_dir(prefix) def clear(self): """ Clear the cache. """ not_removed = [] for fn in os.listdir(self.base): fn = os.path.join(self.base, fn) try: if os.path.islink(fn) or os.path.isfile(fn): os.remove(fn) elif os.path.isdir(fn): shutil.rmtree(fn) except Exception: not_removed.append(fn) return not_removed class EventMixin(object): """ A very simple publish/subscribe system. """ def __init__(self): self._subscribers = {} def add(self, event, subscriber, append=True): """ Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list for the event. """ subs = self._subscribers if event not in subs: subs[event] = deque([subscriber]) else: sq = subs[event] if append: sq.append(subscriber) else: sq.appendleft(subscriber) def remove(self, event, subscriber): """ Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. """ subs = self._subscribers if event not in subs: raise ValueError('No subscribers: %r' % event) subs[event].remove(subscriber) def get_subscribers(self, event): """ Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. """ return iter(self._subscribers.get(event, ())) def publish(self, event, *args, **kwargs): """ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The keyword arguments to pass to the event's subscribers. """ result = [] for subscriber in self.get_subscribers(event): try: value = subscriber(event, *args, **kwargs) except Exception: logger.exception('Exception during event publication') value = None result.append(value) logger.debug('publish %s: args = %s, kwargs = %s, result = %s', event, args, kwargs, result) return result # # Simple sequencing # class Sequencer(object): def __init__(self): self._preds = {} self._succs = {} self._nodes = set() # nodes with no preds/succs def add_node(self, node): self._nodes.add(node) def remove_node(self, node, edges=False): if node in self._nodes: self._nodes.remove(node) if edges: for p in set(self._preds.get(node, ())): self.remove(p, node) for s in set(self._succs.get(node, ())): self.remove(node, s) # Remove empties for k, v in list(self._preds.items()): if not v: del self._preds[k] for k, v in list(self._succs.items()): if not v: del self._succs[k] def add(self, pred, succ): assert pred != succ self._preds.setdefault(succ, set()).add(pred) self._succs.setdefault(pred, set()).add(succ) def remove(self, pred, succ): assert pred != succ try: preds = self._preds[succ] succs = self._succs[pred] except KeyError: # pragma: no cover raise ValueError('%r not a successor of anything' % succ) try: preds.remove(pred) succs.remove(succ) except KeyError: # pragma: no cover raise ValueError('%r not a successor of %r' % (succ, pred)) def is_step(self, step): return (step in self._preds or step in self._succs or step in self._nodes) def get_steps(self, final): if not self.is_step(final): raise ValueError('Unknown: %r' % final) result = [] todo = [] seen = set() todo.append(final) while todo: step = todo.pop(0) if step in seen: # if a step was already seen, # move it to the end (so it will appear earlier # when reversed on return) ... but not for the # final step, as that would be confusing for # users if step != final: result.remove(step) result.append(step) else: seen.add(step) result.append(step) preds = self._preds.get(step, ()) todo.extend(preds) return reversed(result) @property def strong_connections(self): #http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm index_counter = [0] stack = [] lowlinks = {} index = {} result = [] graph = self._succs def strongconnect(node): # set the depth index for this node to the smallest unused index index[node] = index_counter[0] lowlinks[node] = index_counter[0] index_counter[0] += 1 stack.append(node) # Consider successors try: successors = graph[node] except Exception: successors = [] for successor in successors: if successor not in lowlinks: # Successor has not yet been visited strongconnect(successor) lowlinks[node] = min(lowlinks[node],lowlinks[successor]) elif successor in stack: # the successor is in the stack and hence in the current # strongly connected component (SCC) lowlinks[node] = min(lowlinks[node],index[successor]) # If `node` is a root node, pop the stack and generate an SCC if lowlinks[node] == index[node]: connected_component = [] while True: successor = stack.pop() connected_component.append(successor) if successor == node: break component = tuple(connected_component) # storing the result result.append(component) for node in graph: if node not in lowlinks: strongconnect(node) return result @property def dot(self): result = ['digraph G {'] for succ in self._preds: preds = self._preds[succ] for pred in preds: result.append(' %s -> %s;' % (pred, succ)) for node in self._nodes: result.append(' %s;' % node) result.append('}') return '\n'.join(result) # # Unarchiving functionality for zip, tar, tgz, tbz, whl # ARCHIVE_EXTENSIONS = ('.tar.gz', '.tar.bz2', '.tar', '.zip', '.tgz', '.tbz', '.whl') def unarchive(archive_filename, dest_dir, format=None, check=True): def check_path(path): if not isinstance(path, text_type): path = path.decode('utf-8') p = os.path.abspath(os.path.join(dest_dir, path)) if not p.startswith(dest_dir) or p[plen] != os.sep: raise ValueError('path outside destination: %r' % p) dest_dir = os.path.abspath(dest_dir) plen = len(dest_dir) archive = None if format is None: if archive_filename.endswith(('.zip', '.whl')): format = 'zip' elif archive_filename.endswith(('.tar.gz', '.tgz')): format = 'tgz' mode = 'r:gz' elif archive_filename.endswith(('.tar.bz2', '.tbz')): format = 'tbz' mode = 'r:bz2' elif archive_filename.endswith('.tar'): format = 'tar' mode = 'r' else: # pragma: no cover raise ValueError('Unknown format for %r' % archive_filename) try: if format == 'zip': archive = ZipFile(archive_filename, 'r') if check: names = archive.namelist() for name in names: check_path(name) else: archive = tarfile.open(archive_filename, mode) if check: names = archive.getnames() for name in names: check_path(name) if format != 'zip' and sys.version_info[0] < 3: # See Python issue 17153. If the dest path contains Unicode, # tarfile extraction fails on Python 2.x if a member path name # contains non-ASCII characters - it leads to an implicit # bytes -> unicode conversion using ASCII to decode. for tarinfo in archive.getmembers(): if not isinstance(tarinfo.name, text_type): tarinfo.name = tarinfo.name.decode('utf-8') archive.extractall(dest_dir) finally: if archive: archive.close() def zip_dir(directory): """zip a directory tree into a BytesIO object""" result = io.BytesIO() dlen = len(directory) with ZipFile(result, "w") as zf: for root, dirs, files in os.walk(directory): for name in files: full = os.path.join(root, name) rel = root[dlen:] dest = os.path.join(rel, name) zf.write(full, dest) return result # # Simple progress bar # UNITS = ('', 'K', 'M', 'G','T','P') class Progress(object): unknown = 'UNKNOWN' def __init__(self, minval=0, maxval=100): assert maxval is None or maxval >= minval self.min = self.cur = minval self.max = maxval self.started = None self.elapsed = 0 self.done = False def update(self, curval): assert self.min <= curval assert self.max is None or curval <= self.max self.cur = curval now = time.time() if self.started is None: self.started = now else: self.elapsed = now - self.started def increment(self, incr): assert incr >= 0 self.update(self.cur + incr) def start(self): self.update(self.min) return self def stop(self): if self.max is not None: self.update(self.max) self.done = True @property def maximum(self): return self.unknown if self.max is None else self.max @property def percentage(self): if self.done: result = '100 %' elif self.max is None: result = ' ?? %' else: v = 100.0 * (self.cur - self.min) / (self.max - self.min) result = '%3d %%' % v return result def format_duration(self, duration): if (duration <= 0) and self.max is None or self.cur == self.min: result = '??:??:??' #elif duration < 1: # result = '--:--:--' else: result = time.strftime('%H:%M:%S', time.gmtime(duration)) return result @property def ETA(self): if self.done: prefix = 'Done' t = self.elapsed #import pdb; pdb.set_trace() else: prefix = 'ETA ' if self.max is None: t = -1 elif self.elapsed == 0 or (self.cur == self.min): t = 0 else: #import pdb; pdb.set_trace() t = float(self.max - self.min) t /= self.cur - self.min t = (t - 1) * self.elapsed return '%s: %s' % (prefix, self.format_duration(t)) @property def speed(self): if self.elapsed == 0: result = 0.0 else: result = (self.cur - self.min) / self.elapsed for unit in UNITS: if result < 1000: break result /= 1000.0 return '%d %sB/s' % (result, unit) # # Glob functionality # RICH_GLOB = re.compile(r'\{([^}]*)\}') _CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]') _CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$') def iglob(path_glob): """Extended globbing function that supports ** and {opt1,opt2,opt3}.""" if _CHECK_RECURSIVE_GLOB.search(path_glob): msg = """invalid glob %r: recursive glob "**" must be used alone""" raise ValueError(msg % path_glob) if _CHECK_MISMATCH_SET.search(path_glob): msg = """invalid glob %r: mismatching set marker '{' or '}'""" raise ValueError(msg % path_glob) return _iglob(path_glob) def _iglob(path_glob): rich_path_glob = RICH_GLOB.split(path_glob, 1) if len(rich_path_glob) > 1: assert len(rich_path_glob) == 3, rich_path_glob prefix, set, suffix = rich_path_glob for item in set.split(','): for path in _iglob(''.join((prefix, item, suffix))): yield path else: if '**' not in path_glob: for item in std_iglob(path_glob): yield item else: prefix, radical = path_glob.split('**', 1) if prefix == '': prefix = '.' if radical == '': radical = '*' else: # we support both radical = radical.lstrip('/') radical = radical.lstrip('\\') for path, dir, files in os.walk(prefix): path = os.path.normpath(path) for fn in _iglob(os.path.join(path, radical)): yield fn if ssl: from .compat import (HTTPSHandler as BaseHTTPSHandler, match_hostname, CertificateError) # # HTTPSConnection which verifies certificates/matches domains # class HTTPSConnection(httplib.HTTPSConnection): ca_certs = None # set this to the path to the certs file (.pem) check_domain = True # only used if ca_certs is not None # noinspection PyPropertyAccess def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) if getattr(self, '_tunnel_host', False): self.sock = sock self._tunnel() if not hasattr(ssl, 'SSLContext'): # For 2.x if self.ca_certs: cert_reqs = ssl.CERT_REQUIRED else: cert_reqs = ssl.CERT_NONE self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, cert_reqs=cert_reqs, ssl_version=ssl.PROTOCOL_SSLv23, ca_certs=self.ca_certs) else: # pragma: no cover context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) if hasattr(ssl, 'OP_NO_SSLv2'): context.options |= ssl.OP_NO_SSLv2 if self.cert_file: context.load_cert_chain(self.cert_file, self.key_file) kwargs = {} if self.ca_certs: context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(cafile=self.ca_certs) if getattr(ssl, 'HAS_SNI', False): kwargs['server_hostname'] = self.host self.sock = context.wrap_socket(sock, **kwargs) if self.ca_certs and self.check_domain: try: match_hostname(self.sock.getpeercert(), self.host) logger.debug('Host verified: %s', self.host) except CertificateError: # pragma: no cover self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() raise class HTTPSHandler(BaseHTTPSHandler): def __init__(self, ca_certs, check_domain=True): BaseHTTPSHandler.__init__(self) self.ca_certs = ca_certs self.check_domain = check_domain def _conn_maker(self, *args, **kwargs): """ This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. """ result = HTTPSConnection(*args, **kwargs) if self.ca_certs: result.ca_certs = self.ca_certs result.check_domain = self.check_domain return result def https_open(self, req): try: return self.do_open(self._conn_maker, req) except URLError as e: if 'certificate verify failed' in str(e.reason): raise CertificateError('Unable to verify server certificate ' 'for %s' % req.host) else: raise # # To prevent against mixing HTTP traffic with HTTPS (examples: A Man-In-The- # Middle proxy using HTTP listens on port 443, or an index mistakenly serves # HTML containing a http://xyz link when it should be https://xyz), # you can use the following handler class, which does not allow HTTP traffic. # # It works by inheriting from HTTPHandler - so build_opener won't add a # handler for HTTP itself. # class HTTPSOnlyHandler(HTTPSHandler, HTTPHandler): def http_open(self, req): raise URLError('Unexpected HTTP request on what should be a secure ' 'connection: %s' % req) # # XML-RPC with timeouts # _ver_info = sys.version_info[:2] if _ver_info == (2, 6): class HTTP(httplib.HTTP): def __init__(self, host='', port=None, **kwargs): if port == 0: # 0 means use port 0, not the default port port = None self._setup(self._connection_class(host, port, **kwargs)) if ssl: class HTTPS(httplib.HTTPS): def __init__(self, host='', port=None, **kwargs): if port == 0: # 0 means use port 0, not the default port port = None self._setup(self._connection_class(host, port, **kwargs)) class Transport(xmlrpclib.Transport): def __init__(self, timeout, use_datetime=0): self.timeout = timeout xmlrpclib.Transport.__init__(self, use_datetime) def make_connection(self, host): h, eh, x509 = self.get_host_info(host) if _ver_info == (2, 6): result = HTTP(h, timeout=self.timeout) else: if not self._connection or host != self._connection[0]: self._extra_headers = eh self._connection = host, httplib.HTTPConnection(h) result = self._connection[1] return result if ssl: class SafeTransport(xmlrpclib.SafeTransport): def __init__(self, timeout, use_datetime=0): self.timeout = timeout xmlrpclib.SafeTransport.__init__(self, use_datetime) def make_connection(self, host): h, eh, kwargs = self.get_host_info(host) if not kwargs: kwargs = {} kwargs['timeout'] = self.timeout if _ver_info == (2, 6): result = HTTPS(host, None, **kwargs) else: if not self._connection or host != self._connection[0]: self._extra_headers = eh self._connection = host, httplib.HTTPSConnection(h, None, **kwargs) result = self._connection[1] return result class ServerProxy(xmlrpclib.ServerProxy): def __init__(self, uri, **kwargs): self.timeout = timeout = kwargs.pop('timeout', None) # The above classes only come into play if a timeout # is specified if timeout is not None: scheme, _ = splittype(uri) use_datetime = kwargs.get('use_datetime', 0) if scheme == 'https': tcls = SafeTransport else: tcls = Transport kwargs['transport'] = t = tcls(timeout, use_datetime=use_datetime) self.transport = t xmlrpclib.ServerProxy.__init__(self, uri, **kwargs) # # CSV functionality. This is provided because on 2.x, the csv module can't # handle Unicode. However, we need to deal with Unicode in e.g. RECORD files. # def _csv_open(fn, mode, **kwargs): if sys.version_info[0] < 3: mode += 'b' else: kwargs['newline'] = '' # Python 3 determines encoding from locale. Force 'utf-8' # file encoding to match other forced utf-8 encoding kwargs['encoding'] = 'utf-8' return open(fn, mode, **kwargs) class CSVBase(object): defaults = { 'delimiter': str(','), # The strs are used because we need native 'quotechar': str('"'), # str in the csv API (2.x won't take 'lineterminator': str('\n') # Unicode) } def __enter__(self): return self def __exit__(self, *exc_info): self.stream.close() class CSVReader(CSVBase): def __init__(self, **kwargs): if 'stream' in kwargs: stream = kwargs['stream'] if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getreader('utf-8')(stream) self.stream = stream else: self.stream = _csv_open(kwargs['path'], 'r') self.reader = csv.reader(self.stream, **self.defaults) def __iter__(self): return self def next(self): result = next(self.reader) if sys.version_info[0] < 3: for i, item in enumerate(result): if not isinstance(item, text_type): result[i] = item.decode('utf-8') return result __next__ = next class CSVWriter(CSVBase): def __init__(self, fn, **kwargs): self.stream = _csv_open(fn, 'w') self.writer = csv.writer(self.stream, **self.defaults) def writerow(self, row): if sys.version_info[0] < 3: r = [] for item in row: if isinstance(item, text_type): item = item.encode('utf-8') r.append(item) row = r self.writer.writerow(row) # # Configurator functionality # class Configurator(BaseConfigurator): value_converters = dict(BaseConfigurator.value_converters) value_converters['inc'] = 'inc_convert' def __init__(self, config, base=None): super(Configurator, self).__init__(config) self.base = base or os.getcwd() def configure_custom(self, config): def convert(o): if isinstance(o, (list, tuple)): result = type(o)([convert(i) for i in o]) elif isinstance(o, dict): if '()' in o: result = self.configure_custom(o) else: result = {} for k in o: result[k] = convert(o[k]) else: result = self.convert(o) return result c = config.pop('()') if not callable(c): c = self.resolve(c) props = config.pop('.', None) # Check for valid identifiers args = config.pop('[]', ()) if args: args = tuple([convert(o) for o in args]) items = [(k, convert(config[k])) for k in config if valid_ident(k)] kwargs = dict(items) result = c(*args, **kwargs) if props: for n, v in props.items(): setattr(result, n, convert(v)) return result def __getitem__(self, key): result = self.config[key] if isinstance(result, dict) and '()' in result: self.config[key] = result = self.configure_custom(result) return result def inc_convert(self, value): """Default converter for the inc:// protocol.""" if not os.path.isabs(value): value = os.path.join(self.base, value) with codecs.open(value, 'r', encoding='utf-8') as f: result = json.load(f) return result class SubprocessMixin(object): """ Mixin for running subprocesses and capturing their output """ def __init__(self, verbose=False, progress=None): self.verbose = verbose self.progress = progress def reader(self, stream, context): """ Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. """ progress = self.progress verbose = self.verbose while True: s = stream.readline() if not s: break if progress is not None: progress(s, context) else: if not verbose: sys.stderr.write('.') else: sys.stderr.write(s.decode('utf-8')) sys.stderr.flush() stream.close() def run_command(self, cmd, **kwargs): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) t1 = threading.Thread(target=self.reader, args=(p.stdout, 'stdout')) t1.start() t2 = threading.Thread(target=self.reader, args=(p.stderr, 'stderr')) t2.start() p.wait() t1.join() t2.join() if self.progress is not None: self.progress('done.', 'main') elif self.verbose: sys.stderr.write('done.\n') return p def normalize_name(name): """Normalize a python package name a la PEP 503""" # https://www.python.org/dev/peps/pep-0503/#normalized-names return re.sub('[-_.]+', '-', name).lower() distlib/scripts.py000064400000041434152347724720010262 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from io import BytesIO import logging import os import re import struct import sys from .compat import sysconfig, detect_encoding, ZipFile from .resources import finder from .util import (FileOperator, get_export_entry, convert_path, get_executable, in_venv) logger = logging.getLogger(__name__) _DEFAULT_MANIFEST = ''' '''.strip() # check if Python is called on the first line with this expression FIRST_LINE_RE = re.compile(b'^#!.*pythonw?[0-9.]*([ \t].*)?$') SCRIPT_TEMPLATE = r'''# -*- coding: utf-8 -*- import re import sys from %(module)s import %(import_name)s if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(%(func)s()) ''' def enquote_executable(executable): if ' ' in executable: # make sure we quote only the executable in case of env # for example /usr/bin/env "/dir with spaces/bin/jython" # instead of "/usr/bin/env /dir with spaces/bin/jython" # otherwise whole if executable.startswith('/usr/bin/env '): env, _executable = executable.split(' ', 1) if ' ' in _executable and not _executable.startswith('"'): executable = '%s "%s"' % (env, _executable) else: if not executable.startswith('"'): executable = '"%s"' % executable return executable # Keep the old name around (for now), as there is at least one project using it! _enquote_executable = enquote_executable class ScriptMaker(object): """ A class to copy or create scripts from source scripts or callable specifications. """ script_template = SCRIPT_TEMPLATE executable = None # for shebangs def __init__(self, source_dir, target_dir, add_launchers=True, dry_run=False, fileop=None): self.source_dir = source_dir self.target_dir = target_dir self.add_launchers = add_launchers self.force = False self.clobber = False # It only makes sense to set mode bits on POSIX. self.set_mode = (os.name == 'posix') or (os.name == 'java' and os._name == 'posix') self.variants = set(('', 'X.Y')) self._fileop = fileop or FileOperator(dry_run) self._is_nt = os.name == 'nt' or ( os.name == 'java' and os._name == 'nt') self.version_info = sys.version_info def _get_alternate_executable(self, executable, options): if options.get('gui', False) and self._is_nt: # pragma: no cover dn, fn = os.path.split(executable) fn = fn.replace('python', 'pythonw') executable = os.path.join(dn, fn) return executable if sys.platform.startswith('java'): # pragma: no cover def _is_shell(self, executable): """ Determine if the specified executable is a script (contains a #! line) """ try: with open(executable) as fp: return fp.read(2) == '#!' except (OSError, IOError): logger.warning('Failed to open %s', executable) return False def _fix_jython_executable(self, executable): if self._is_shell(executable): # Workaround for Jython is not needed on Linux systems. import java if java.lang.System.getProperty('os.name') == 'Linux': return executable elif executable.lower().endswith('jython.exe'): # Use wrapper exe for Jython on Windows return executable return '/usr/bin/env %s' % executable def _build_shebang(self, executable, post_interp): """ Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang which allows the script to run either under Python or sh, using suitable quoting. Thanks to Harald Nordgren for his input. See also: http://www.in-ulm.de/~mascheck/various/shebang/#length https://hg.mozilla.org/mozilla-central/file/tip/mach """ if os.name != 'posix': simple_shebang = True else: # Add 3 for '#!' prefix and newline suffix. shebang_length = len(executable) + len(post_interp) + 3 if sys.platform == 'darwin': max_shebang_length = 512 else: max_shebang_length = 127 simple_shebang = ((b' ' not in executable) and (shebang_length <= max_shebang_length)) if simple_shebang: result = b'#!' + executable + post_interp + b'\n' else: result = b'#!/bin/sh\n' result += b"'''exec' " + executable + post_interp + b' "$0" "$@"\n' result += b"' '''" return result def _get_shebang(self, encoding, post_interp=b'', options=None): enquote = True if self.executable: executable = self.executable enquote = False # assume this will be taken care of elif not sysconfig.is_python_build(): executable = get_executable() elif in_venv(): # pragma: no cover executable = os.path.join(sysconfig.get_path('scripts'), 'python%s' % sysconfig.get_config_var('EXE')) else: # pragma: no cover executable = os.path.join( sysconfig.get_config_var('BINDIR'), 'python%s%s' % (sysconfig.get_config_var('VERSION'), sysconfig.get_config_var('EXE'))) if options: executable = self._get_alternate_executable(executable, options) if sys.platform.startswith('java'): # pragma: no cover executable = self._fix_jython_executable(executable) # Normalise case for Windows - COMMENTED OUT # executable = os.path.normcase(executable) # N.B. The normalising operation above has been commented out: See # issue #124. Although paths in Windows are generally case-insensitive, # they aren't always. For example, a path containing a ẞ (which is a # LATIN CAPITAL LETTER SHARP S - U+1E9E) is normcased to ß (which is a # LATIN SMALL LETTER SHARP S' - U+00DF). The two are not considered by # Windows as equivalent in path names. # If the user didn't specify an executable, it may be necessary to # cater for executable paths with spaces (not uncommon on Windows) if enquote: executable = enquote_executable(executable) # Issue #51: don't use fsencode, since we later try to # check that the shebang is decodable using utf-8. executable = executable.encode('utf-8') # in case of IronPython, play safe and enable frames support if (sys.platform == 'cli' and '-X:Frames' not in post_interp and '-X:FullFrames' not in post_interp): # pragma: no cover post_interp += b' -X:Frames' shebang = self._build_shebang(executable, post_interp) # Python parser starts to read a script using UTF-8 until # it gets a #coding:xxx cookie. The shebang has to be the # first line of a file, the #coding:xxx cookie cannot be # written before. So the shebang has to be decodable from # UTF-8. try: shebang.decode('utf-8') except UnicodeDecodeError: # pragma: no cover raise ValueError( 'The shebang (%r) is not decodable from utf-8' % shebang) # If the script is encoded to a custom encoding (use a # #coding:xxx cookie), the shebang has to be decodable from # the script encoding too. if encoding != 'utf-8': try: shebang.decode(encoding) except UnicodeDecodeError: # pragma: no cover raise ValueError( 'The shebang (%r) is not decodable ' 'from the script encoding (%r)' % (shebang, encoding)) return shebang def _get_script_text(self, entry): return self.script_template % dict(module=entry.prefix, import_name=entry.suffix.split('.')[0], func=entry.suffix) manifest = _DEFAULT_MANIFEST def get_manifest(self, exename): base = os.path.basename(exename) return self.manifest % base def _write_script(self, names, shebang, script_bytes, filenames, ext): use_launcher = self.add_launchers and self._is_nt linesep = os.linesep.encode('utf-8') if not shebang.endswith(linesep): shebang += linesep if not use_launcher: script_bytes = shebang + script_bytes else: # pragma: no cover if ext == 'py': launcher = self._get_launcher('t') else: launcher = self._get_launcher('w') stream = BytesIO() with ZipFile(stream, 'w') as zf: zf.writestr('__main__.py', script_bytes) zip_data = stream.getvalue() script_bytes = launcher + shebang + zip_data for name in names: outname = os.path.join(self.target_dir, name) if use_launcher: # pragma: no cover n, e = os.path.splitext(outname) if e.startswith('.py'): outname = n outname = '%s.exe' % outname try: self._fileop.write_binary_file(outname, script_bytes) except Exception: # Failed writing an executable - it might be in use. logger.warning('Failed to write executable - trying to ' 'use .deleteme logic') dfname = '%s.deleteme' % outname if os.path.exists(dfname): os.remove(dfname) # Not allowed to fail here os.rename(outname, dfname) # nor here self._fileop.write_binary_file(outname, script_bytes) logger.debug('Able to replace executable using ' '.deleteme logic') try: os.remove(dfname) except Exception: pass # still in use - ignore error else: if self._is_nt and not outname.endswith('.' + ext): # pragma: no cover outname = '%s.%s' % (outname, ext) if os.path.exists(outname) and not self.clobber: logger.warning('Skipping existing file %s', outname) continue self._fileop.write_binary_file(outname, script_bytes) if self.set_mode: self._fileop.set_executable_mode([outname]) filenames.append(outname) def _make_script(self, entry, filenames, options=None): post_interp = b'' if options: args = options.get('interpreter_args', []) if args: args = ' %s' % ' '.join(args) post_interp = args.encode('utf-8') shebang = self._get_shebang('utf-8', post_interp, options=options) script = self._get_script_text(entry).encode('utf-8') name = entry.name scriptnames = set() if '' in self.variants: scriptnames.add(name) if 'X' in self.variants: scriptnames.add('%s%s' % (name, self.version_info[0])) if 'X.Y' in self.variants: scriptnames.add('%s-%s.%s' % (name, self.version_info[0], self.version_info[1])) if options and options.get('gui', False): ext = 'pyw' else: ext = 'py' self._write_script(scriptnames, shebang, script, filenames, ext) def _copy_script(self, script, filenames): adjust = False script = os.path.join(self.source_dir, convert_path(script)) outname = os.path.join(self.target_dir, os.path.basename(script)) if not self.force and not self._fileop.newer(script, outname): logger.debug('not copying %s (up-to-date)', script) return # Always open the file, but ignore failures in dry-run mode -- # that way, we'll get accurate feedback if we can read the # script. try: f = open(script, 'rb') except IOError: # pragma: no cover if not self.dry_run: raise f = None else: first_line = f.readline() if not first_line: # pragma: no cover logger.warning('%s: %s is an empty file (skipping)', self.get_command_name(), script) return match = FIRST_LINE_RE.match(first_line.replace(b'\r\n', b'\n')) if match: adjust = True post_interp = match.group(1) or b'' if not adjust: if f: f.close() self._fileop.copy_file(script, outname) if self.set_mode: self._fileop.set_executable_mode([outname]) filenames.append(outname) else: logger.info('copying and adjusting %s -> %s', script, self.target_dir) if not self._fileop.dry_run: encoding, lines = detect_encoding(f.readline) f.seek(0) shebang = self._get_shebang(encoding, post_interp) if b'pythonw' in first_line: # pragma: no cover ext = 'pyw' else: ext = 'py' n = os.path.basename(outname) self._write_script([n], shebang, f.read(), filenames, ext) if f: f.close() @property def dry_run(self): return self._fileop.dry_run @dry_run.setter def dry_run(self, value): self._fileop.dry_run = value if os.name == 'nt' or (os.name == 'java' and os._name == 'nt'): # pragma: no cover # Executable launcher support. # Launchers are from https://bitbucket.org/vinay.sajip/simple_launcher/ def _get_launcher(self, kind): if struct.calcsize('P') == 8: # 64-bit bits = '64' else: bits = '32' name = '%s%s.exe' % (kind, bits) # Issue 31: don't hardcode an absolute package name, but # determine it relative to the current package distlib_package = __name__.rsplit('.', 1)[0] resource = finder(distlib_package).find(name) if not resource: msg = ('Unable to find resource %s in package %s' % (name, distlib_package)) raise ValueError(msg) return resource.bytes # Public API follows def make(self, specification, options=None): """ Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. """ filenames = [] entry = get_export_entry(specification) if entry is None: self._copy_script(specification, filenames) else: self._make_script(entry, filenames, options=options) return filenames def make_multiple(self, specifications, options=None): """ Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, """ filenames = [] for specification in specifications: filenames.extend(self.make(specification, options)) return filenames distlib/database.py000064400000143563152347724720010345 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """PEP 376 implementation.""" from __future__ import unicode_literals import base64 import codecs import contextlib import hashlib import logging import os import posixpath import sys import zipimport from . import DistlibException, resources from .compat import StringIO from .version import get_scheme, UnsupportedVersionError from .metadata import (Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME, LEGACY_METADATA_FILENAME) from .util import (parse_requirement, cached_property, parse_name_and_version, read_exports, write_exports, CSVReader, CSVWriter) __all__ = ['Distribution', 'BaseInstalledDistribution', 'InstalledDistribution', 'EggInfoDistribution', 'DistributionPath'] logger = logging.getLogger(__name__) EXPORTS_FILENAME = 'pydist-exports.json' COMMANDS_FILENAME = 'pydist-commands.json' DIST_FILES = ('INSTALLER', METADATA_FILENAME, 'RECORD', 'REQUESTED', 'RESOURCES', EXPORTS_FILENAME, 'SHARED') DISTINFO_EXT = '.dist-info' class _Cache(object): """ A simple cache mapping names and .dist-info paths to distributions """ def __init__(self): """ Initialise an instance. There is normally one for each DistributionPath. """ self.name = {} self.path = {} self.generated = False def clear(self): """ Clear the cache, setting it to its initial state. """ self.name.clear() self.path.clear() self.generated = False def add(self, dist): """ Add a distribution to the cache. :param dist: The distribution to add. """ if dist.path not in self.path: self.path[dist.path] = dist self.name.setdefault(dist.key, []).append(dist) class DistributionPath(object): """ Represents a set of distributions installed on a path (typically sys.path). """ def __init__(self, path=None, include_egg=False): """ Create an instance from a path, optionally including legacy (distutils/ setuptools/distribute) distributions. :param path: The path to use, as a list of directories. If not specified, sys.path is used. :param include_egg: If True, this instance will look for and return legacy distributions as well as those based on PEP 376. """ if path is None: path = sys.path self.path = path self._include_dist = True self._include_egg = include_egg self._cache = _Cache() self._cache_egg = _Cache() self._cache_enabled = True self._scheme = get_scheme('default') def _get_cache_enabled(self): return self._cache_enabled def _set_cache_enabled(self, value): self._cache_enabled = value cache_enabled = property(_get_cache_enabled, _set_cache_enabled) def clear_cache(self): """ Clears the internal cache. """ self._cache.clear() self._cache_egg.clear() def _yield_distributions(self): """ Yield .dist-info and/or .egg(-info) distributions. """ # We need to check if we've seen some resources already, because on # some Linux systems (e.g. some Debian/Ubuntu variants) there are # symlinks which alias other files in the environment. seen = set() for path in self.path: finder = resources.finder_for_path(path) if finder is None: continue r = finder.find('') if not r or not r.is_container: continue rset = sorted(r.resources) for entry in rset: r = finder.find(entry) if not r or r.path in seen: continue if self._include_dist and entry.endswith(DISTINFO_EXT): possible_filenames = [METADATA_FILENAME, WHEEL_METADATA_FILENAME, LEGACY_METADATA_FILENAME] for metadata_filename in possible_filenames: metadata_path = posixpath.join(entry, metadata_filename) pydist = finder.find(metadata_path) if pydist: break else: continue with contextlib.closing(pydist.as_stream()) as stream: metadata = Metadata(fileobj=stream, scheme='legacy') logger.debug('Found %s', r.path) seen.add(r.path) yield new_dist_class(r.path, metadata=metadata, env=self) elif self._include_egg and entry.endswith(('.egg-info', '.egg')): logger.debug('Found %s', r.path) seen.add(r.path) yield old_dist_class(r.path, self) def _generate_cache(self): """ Scan the path for distributions and populate the cache with those that are found. """ gen_dist = not self._cache.generated gen_egg = self._include_egg and not self._cache_egg.generated if gen_dist or gen_egg: for dist in self._yield_distributions(): if isinstance(dist, InstalledDistribution): self._cache.add(dist) else: self._cache_egg.add(dist) if gen_dist: self._cache.generated = True if gen_egg: self._cache_egg.generated = True @classmethod def distinfo_dirname(cls, name, version): """ The *name* and *version* parameters are converted into their filename-escaped form, i.e. any ``'-'`` characters are replaced with ``'_'`` other than the one in ``'dist-info'`` and the one separating the name from the version number. :parameter name: is converted to a standard distribution name by replacing any runs of non- alphanumeric characters with a single ``'-'``. :type name: string :parameter version: is converted to a standard version string. Spaces become dots, and all other non-alphanumeric characters (except dots) become dashes, with runs of multiple dashes condensed to a single dash. :type version: string :returns: directory name :rtype: string""" name = name.replace('-', '_') return '-'.join([name, version]) + DISTINFO_EXT def get_distributions(self): """ Provides an iterator that looks for distributions and returns :class:`InstalledDistribution` or :class:`EggInfoDistribution` instances for each one of them. :rtype: iterator of :class:`InstalledDistribution` and :class:`EggInfoDistribution` instances """ if not self._cache_enabled: for dist in self._yield_distributions(): yield dist else: self._generate_cache() for dist in self._cache.path.values(): yield dist if self._include_egg: for dist in self._cache_egg.path.values(): yield dist def get_distribution(self, name): """ Looks for a named distribution on the path. This function only returns the first result found, as no more than one value is expected. If nothing is found, ``None`` is returned. :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution` or ``None`` """ result = None name = name.lower() if not self._cache_enabled: for dist in self._yield_distributions(): if dist.key == name: result = dist break else: self._generate_cache() if name in self._cache.name: result = self._cache.name[name][0] elif self._include_egg and name in self._cache_egg.name: result = self._cache_egg.name[name][0] return result def provides_distribution(self, name, version=None): """ Iterates over all distributions to find which distributions provide *name*. If a *version* is provided, it will be used to filter the results. This function only returns the first result found, since no more than one values are expected. If the directory is not found, returns ``None``. :parameter version: a version specifier that indicates the version required, conforming to the format in ``PEP-345`` :type name: string :type version: string """ matcher = None if version is not None: try: matcher = self._scheme.matcher('%s (%s)' % (name, version)) except ValueError: raise DistlibException('invalid name or version: %r, %r' % (name, version)) for dist in self.get_distributions(): # We hit a problem on Travis where enum34 was installed and doesn't # have a provides attribute ... if not hasattr(dist, 'provides'): logger.debug('No "provides": %s', dist) else: provided = dist.provides for p in provided: p_name, p_ver = parse_name_and_version(p) if matcher is None: if p_name == name: yield dist break else: if p_name == name and matcher.match(p_ver): yield dist break def get_file_path(self, name, relative_path): """ Return the path to a resource file. """ dist = self.get_distribution(name) if dist is None: raise LookupError('no distribution named %r found' % name) return dist.get_resource_path(relative_path) def get_exported_entries(self, category, name=None): """ Return all of the exported entries in a particular category. :param category: The category to search for entries. :param name: If specified, only entries with that name are returned. """ for dist in self.get_distributions(): r = dist.exports if category in r: d = r[category] if name is not None: if name in d: yield d[name] else: for v in d.values(): yield v class Distribution(object): """ A base class for distributions, whether installed or from indexes. Either way, it must have some metadata, so that's all that's needed for construction. """ build_time_dependency = False """ Set to True if it's known to be only a build-time dependency (i.e. not needed after installation). """ requested = False """A boolean that indicates whether the ``REQUESTED`` metadata file is present (in other words, whether the package was installed by user request or it was installed as a dependency).""" def __init__(self, metadata): """ Initialise an instance. :param metadata: The instance of :class:`Metadata` describing this distribution. """ self.metadata = metadata self.name = metadata.name self.key = self.name.lower() # for case-insensitive comparisons self.version = metadata.version self.locator = None self.digest = None self.extras = None # additional features requested self.context = None # environment marker overrides self.download_urls = set() self.digests = {} @property def source_url(self): """ The source archive download URL for this distribution. """ return self.metadata.source_url download_url = source_url # Backward compatibility @property def name_and_version(self): """ A utility property which displays the name and version in parentheses. """ return '%s (%s)' % (self.name, self.version) @property def provides(self): """ A set of distribution names and versions provided by this distribution. :return: A set of "name (version)" strings. """ plist = self.metadata.provides s = '%s (%s)' % (self.name, self.version) if s not in plist: plist.append(s) return plist def _get_requirements(self, req_attr): md = self.metadata logger.debug('Getting requirements from metadata %r', md.todict()) reqts = getattr(md, req_attr) return set(md.get_requirements(reqts, extras=self.extras, env=self.context)) @property def run_requires(self): return self._get_requirements('run_requires') @property def meta_requires(self): return self._get_requirements('meta_requires') @property def build_requires(self): return self._get_requirements('build_requires') @property def test_requires(self): return self._get_requirements('test_requires') @property def dev_requires(self): return self._get_requirements('dev_requires') def matches_requirement(self, req): """ Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. """ # Requirement may contain extras - parse to lose those # from what's passed to the matcher r = parse_requirement(req) scheme = get_scheme(self.metadata.scheme) try: matcher = scheme.matcher(r.requirement) except UnsupportedVersionError: # XXX compat-mode if cannot read the version logger.warning('could not read version %r - using name only', req) name = req.split()[0] matcher = scheme.matcher(name) name = matcher.key # case-insensitive result = False for p in self.provides: p_name, p_ver = parse_name_and_version(p) if p_name != name: continue try: result = matcher.match(p_ver) break except UnsupportedVersionError: pass return result def __repr__(self): """ Return a textual representation of this instance, """ if self.source_url: suffix = ' [%s]' % self.source_url else: suffix = '' return '' % (self.name, self.version, suffix) def __eq__(self, other): """ See if this distribution is the same as another. :param other: The distribution to compare with. To be equal to one another. distributions must have the same type, name, version and source_url. :return: True if it is the same, else False. """ if type(other) is not type(self): result = False else: result = (self.name == other.name and self.version == other.version and self.source_url == other.source_url) return result def __hash__(self): """ Compute hash in a way which matches the equality test. """ return hash(self.name) + hash(self.version) + hash(self.source_url) class BaseInstalledDistribution(Distribution): """ This is the base class for installed distributions (whether PEP 376 or legacy). """ hasher = None def __init__(self, metadata, path, env=None): """ Initialise an instance. :param metadata: An instance of :class:`Metadata` which describes the distribution. This will normally have been initialised from a metadata file in the ``path``. :param path: The path of the ``.dist-info`` or ``.egg-info`` directory for the distribution. :param env: This is normally the :class:`DistributionPath` instance where this distribution was found. """ super(BaseInstalledDistribution, self).__init__(metadata) self.path = path self.dist_path = env def get_hash(self, data, hasher=None): """ Get the hash of some data, using a particular hash algorithm, if specified. :param data: The data to be hashed. :type data: bytes :param hasher: The name of a hash implementation, supported by hashlib, or ``None``. Examples of valid values are ``'sha1'``, ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and ``'sha512'``. If no hasher is specified, the ``hasher`` attribute of the :class:`InstalledDistribution` instance is used. If the hasher is determined to be ``None``, MD5 is used as the hashing algorithm. :returns: The hash of the data. If a hasher was explicitly specified, the returned hash will be prefixed with the specified hasher followed by '='. :rtype: str """ if hasher is None: hasher = self.hasher if hasher is None: hasher = hashlib.md5 prefix = '' else: hasher = getattr(hashlib, hasher) prefix = '%s=' % self.hasher digest = hasher(data).digest() digest = base64.urlsafe_b64encode(digest).rstrip(b'=').decode('ascii') return '%s%s' % (prefix, digest) class InstalledDistribution(BaseInstalledDistribution): """ Created with the *path* of the ``.dist-info`` directory provided to the constructor. It reads the metadata contained in ``pydist.json`` when it is instantiated., or uses a passed in Metadata instance (useful for when dry-run mode is being used). """ hasher = 'sha256' def __init__(self, path, metadata=None, env=None): self.modules = [] self.finder = finder = resources.finder_for_path(path) if finder is None: raise ValueError('finder unavailable for %s' % path) if env and env._cache_enabled and path in env._cache.path: metadata = env._cache.path[path].metadata elif metadata is None: r = finder.find(METADATA_FILENAME) # Temporary - for Wheel 0.23 support if r is None: r = finder.find(WHEEL_METADATA_FILENAME) # Temporary - for legacy support if r is None: r = finder.find(LEGACY_METADATA_FILENAME) if r is None: raise ValueError('no %s found in %s' % (METADATA_FILENAME, path)) with contextlib.closing(r.as_stream()) as stream: metadata = Metadata(fileobj=stream, scheme='legacy') super(InstalledDistribution, self).__init__(metadata, path, env) if env and env._cache_enabled: env._cache.add(self) r = finder.find('REQUESTED') self.requested = r is not None p = os.path.join(path, 'top_level.txt') if os.path.exists(p): with open(p, 'rb') as f: data = f.read().decode('utf-8') self.modules = data.splitlines() def __repr__(self): return '' % ( self.name, self.version, self.path) def __str__(self): return "%s %s" % (self.name, self.version) def _get_records(self): """ Get the list of installed files for the distribution :return: A list of tuples of path, hash and size. Note that hash and size might be ``None`` for some entries. The path is exactly as stored in the file (which is as in PEP 376). """ results = [] r = self.get_distinfo_resource('RECORD') with contextlib.closing(r.as_stream()) as stream: with CSVReader(stream=stream) as record_reader: # Base location is parent dir of .dist-info dir #base_location = os.path.dirname(self.path) #base_location = os.path.abspath(base_location) for row in record_reader: missing = [None for i in range(len(row), 3)] path, checksum, size = row + missing #if not os.path.isabs(path): # path = path.replace('/', os.sep) # path = os.path.join(base_location, path) results.append((path, checksum, size)) return results @cached_property def exports(self): """ Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. """ result = {} r = self.get_distinfo_resource(EXPORTS_FILENAME) if r: result = self.read_exports() return result def read_exports(self): """ Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ result = {} r = self.get_distinfo_resource(EXPORTS_FILENAME) if r: with contextlib.closing(r.as_stream()) as stream: result = read_exports(stream) return result def write_exports(self, exports): """ Write a dictionary of exports to a file in .ini format. :param exports: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ rf = self.get_distinfo_file(EXPORTS_FILENAME) with open(rf, 'w') as f: write_exports(exports, f) def get_resource_path(self, relative_path): """ NOTE: This API may change in the future. Return the absolute path to a resource file with the given relative path. :param relative_path: The path, relative to .dist-info, of the resource of interest. :return: The absolute path where the resource is to be found. """ r = self.get_distinfo_resource('RESOURCES') with contextlib.closing(r.as_stream()) as stream: with CSVReader(stream=stream) as resources_reader: for relative, destination in resources_reader: if relative == relative_path: return destination raise KeyError('no resource file with relative path %r ' 'is installed' % relative_path) def list_installed_files(self): """ Iterates over the ``RECORD`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: iterator of (path, hash, size) """ for result in self._get_records(): yield result def write_installed_files(self, paths, prefix, dry_run=False): """ Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any existing ``RECORD`` file is silently overwritten. prefix is used to determine when to write absolute paths. """ prefix = os.path.join(prefix, '') base = os.path.dirname(self.path) base_under_prefix = base.startswith(prefix) base = os.path.join(base, '') record_path = self.get_distinfo_file('RECORD') logger.info('creating %s', record_path) if dry_run: return None with CSVWriter(record_path) as writer: for path in paths: if os.path.isdir(path) or path.endswith(('.pyc', '.pyo')): # do not put size and hash, as in PEP-376 hash_value = size = '' else: size = '%d' % os.path.getsize(path) with open(path, 'rb') as fp: hash_value = self.get_hash(fp.read()) if path.startswith(base) or (base_under_prefix and path.startswith(prefix)): path = os.path.relpath(path, base) writer.writerow((path, hash_value, size)) # add the RECORD file itself if record_path.startswith(base): record_path = os.path.relpath(record_path, base) writer.writerow((record_path, '', '')) return record_path def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. """ mismatches = [] base = os.path.dirname(self.path) record_path = self.get_distinfo_file('RECORD') for path, hash_value, size in self.list_installed_files(): if not os.path.isabs(path): path = os.path.join(base, path) if path == record_path: continue if not os.path.exists(path): mismatches.append((path, 'exists', True, False)) elif os.path.isfile(path): actual_size = str(os.path.getsize(path)) if size and actual_size != size: mismatches.append((path, 'size', size, actual_size)) elif hash_value: if '=' in hash_value: hasher = hash_value.split('=', 1)[0] else: hasher = None with open(path, 'rb') as f: actual_hash = self.get_hash(f.read(), hasher) if actual_hash != hash_value: mismatches.append((path, 'hash', hash_value, actual_hash)) return mismatches @cached_property def shared_locations(self): """ A dictionary of shared locations whose keys are in the set 'prefix', 'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. The corresponding value is the absolute path of that category for this distribution, and takes into account any paths selected by the user at installation time (e.g. via command-line arguments). In the case of the 'namespace' key, this would be a list of absolute paths for the roots of namespace packages in this distribution. The first time this property is accessed, the relevant information is read from the SHARED file in the .dist-info directory. """ result = {} shared_path = os.path.join(self.path, 'SHARED') if os.path.isfile(shared_path): with codecs.open(shared_path, 'r', encoding='utf-8') as f: lines = f.read().splitlines() for line in lines: key, value = line.split('=', 1) if key == 'namespace': result.setdefault(key, []).append(value) else: result[key] = value return result def write_shared_locations(self, paths, dry_run=False): """ Write shared location information to the SHARED file in .dist-info. :param paths: A dictionary as described in the documentation for :meth:`shared_locations`. :param dry_run: If True, the action is logged but no file is actually written. :return: The path of the file written to. """ shared_path = os.path.join(self.path, 'SHARED') logger.info('creating %s', shared_path) if dry_run: return None lines = [] for key in ('prefix', 'lib', 'headers', 'scripts', 'data'): path = paths[key] if os.path.isdir(paths[key]): lines.append('%s=%s' % (key, path)) for ns in paths.get('namespace', ()): lines.append('namespace=%s' % ns) with codecs.open(shared_path, 'w', encoding='utf-8') as f: f.write('\n'.join(lines)) return shared_path def get_distinfo_resource(self, path): if path not in DIST_FILES: raise DistlibException('invalid path for a dist-info file: ' '%r at %r' % (path, self.path)) finder = resources.finder_for_path(self.path) if finder is None: raise DistlibException('Unable to get a finder for %s' % self.path) return finder.find(path) def get_distinfo_file(self, path): """ Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; If *path* is an absolute path and doesn't start with the ``.dist-info`` directory path, a :class:`DistlibException` is raised :type path: str :rtype: str """ # Check if it is an absolute path # XXX use relpath, add tests if path.find(os.sep) >= 0: # it's an absolute path? distinfo_dirname, path = path.split(os.sep)[-2:] if distinfo_dirname != self.path.split(os.sep)[-1]: raise DistlibException( 'dist-info file %r does not belong to the %r %s ' 'distribution' % (path, self.name, self.version)) # The file must be relative if path not in DIST_FILES: raise DistlibException('invalid path for a dist-info file: ' '%r at %r' % (path, self.path)) return os.path.join(self.path, path) def list_distinfo_files(self): """ Iterates over the ``RECORD`` entries and returns paths for each line if the path is pointing to a file located in the ``.dist-info`` directory or one of its subdirectories. :returns: iterator of paths """ base = os.path.dirname(self.path) for path, checksum, size in self._get_records(): # XXX add separator or use real relpath algo if not os.path.isabs(path): path = os.path.join(base, path) if path.startswith(self.path): yield path def __eq__(self, other): return (isinstance(other, InstalledDistribution) and self.path == other.path) # See http://docs.python.org/reference/datamodel#object.__hash__ __hash__ = object.__hash__ class EggInfoDistribution(BaseInstalledDistribution): """Created with the *path* of the ``.egg-info`` directory or file provided to the constructor. It reads the metadata contained in the file itself, or if the given path happens to be a directory, the metadata is read from the file ``PKG-INFO`` under that directory.""" requested = True # as we have no way of knowing, assume it was shared_locations = {} def __init__(self, path, env=None): def set_name_and_version(s, n, v): s.name = n s.key = n.lower() # for case-insensitive comparisons s.version = v self.path = path self.dist_path = env if env and env._cache_enabled and path in env._cache_egg.path: metadata = env._cache_egg.path[path].metadata set_name_and_version(self, metadata.name, metadata.version) else: metadata = self._get_metadata(path) # Need to be set before caching set_name_and_version(self, metadata.name, metadata.version) if env and env._cache_enabled: env._cache_egg.add(self) super(EggInfoDistribution, self).__init__(metadata, path, env) def _get_metadata(self, path): requires = None def parse_requires_data(data): """Create a list of dependencies from a requires.txt file. *data*: the contents of a setuptools-produced requires.txt file. """ reqs = [] lines = data.splitlines() for line in lines: line = line.strip() if line.startswith('['): logger.warning('Unexpected line: quitting requirement scan: %r', line) break r = parse_requirement(line) if not r: logger.warning('Not recognised as a requirement: %r', line) continue if r.extras: logger.warning('extra requirements in requires.txt are ' 'not supported') if not r.constraints: reqs.append(r.name) else: cons = ', '.join('%s%s' % c for c in r.constraints) reqs.append('%s (%s)' % (r.name, cons)) return reqs def parse_requires_path(req_path): """Create a list of dependencies from a requires.txt file. *req_path*: the path to a setuptools-produced requires.txt file. """ reqs = [] try: with codecs.open(req_path, 'r', 'utf-8') as fp: reqs = parse_requires_data(fp.read()) except IOError: pass return reqs tl_path = tl_data = None if path.endswith('.egg'): if os.path.isdir(path): p = os.path.join(path, 'EGG-INFO') meta_path = os.path.join(p, 'PKG-INFO') metadata = Metadata(path=meta_path, scheme='legacy') req_path = os.path.join(p, 'requires.txt') tl_path = os.path.join(p, 'top_level.txt') requires = parse_requires_path(req_path) else: # FIXME handle the case where zipfile is not available zipf = zipimport.zipimporter(path) fileobj = StringIO( zipf.get_data('EGG-INFO/PKG-INFO').decode('utf8')) metadata = Metadata(fileobj=fileobj, scheme='legacy') try: data = zipf.get_data('EGG-INFO/requires.txt') tl_data = zipf.get_data('EGG-INFO/top_level.txt').decode('utf-8') requires = parse_requires_data(data.decode('utf-8')) except IOError: requires = None elif path.endswith('.egg-info'): if os.path.isdir(path): req_path = os.path.join(path, 'requires.txt') requires = parse_requires_path(req_path) path = os.path.join(path, 'PKG-INFO') tl_path = os.path.join(path, 'top_level.txt') metadata = Metadata(path=path, scheme='legacy') else: raise DistlibException('path must end with .egg-info or .egg, ' 'got %r' % path) if requires: metadata.add_requirements(requires) # look for top-level modules in top_level.txt, if present if tl_data is None: if tl_path is not None and os.path.exists(tl_path): with open(tl_path, 'rb') as f: tl_data = f.read().decode('utf-8') if not tl_data: tl_data = [] else: tl_data = tl_data.splitlines() self.modules = tl_data return metadata def __repr__(self): return '' % ( self.name, self.version, self.path) def __str__(self): return "%s %s" % (self.name, self.version) def check_installed_files(self): """ Checks that the hashes and sizes of the files in ``RECORD`` are matched by the files themselves. Returns a (possibly empty) list of mismatches. Each entry in the mismatch list will be a tuple consisting of the path, 'exists', 'size' or 'hash' according to what didn't match (existence is checked first, then size, then hash), the expected value and the actual value. """ mismatches = [] record_path = os.path.join(self.path, 'installed-files.txt') if os.path.exists(record_path): for path, _, _ in self.list_installed_files(): if path == record_path: continue if not os.path.exists(path): mismatches.append((path, 'exists', True, False)) return mismatches def list_installed_files(self): """ Iterates over the ``installed-files.txt`` entries and returns a tuple ``(path, hash, size)`` for each line. :returns: a list of (path, hash, size) """ def _md5(path): f = open(path, 'rb') try: content = f.read() finally: f.close() return hashlib.md5(content).hexdigest() def _size(path): return os.stat(path).st_size record_path = os.path.join(self.path, 'installed-files.txt') result = [] if os.path.exists(record_path): with codecs.open(record_path, 'r', encoding='utf-8') as f: for line in f: line = line.strip() p = os.path.normpath(os.path.join(self.path, line)) # "./" is present as a marker between installed files # and installation metadata files if not os.path.exists(p): logger.warning('Non-existent file: %s', p) if p.endswith(('.pyc', '.pyo')): continue #otherwise fall through and fail if not os.path.isdir(p): result.append((p, _md5(p), _size(p))) result.append((record_path, None, None)) return result def list_distinfo_files(self, absolute=False): """ Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed into a local absolute path. Otherwise the raw value from ``installed-files.txt`` is returned. :type absolute: boolean :returns: iterator of paths """ record_path = os.path.join(self.path, 'installed-files.txt') if os.path.exists(record_path): skip = True with codecs.open(record_path, 'r', encoding='utf-8') as f: for line in f: line = line.strip() if line == './': skip = False continue if not skip: p = os.path.normpath(os.path.join(self.path, line)) if p.startswith(self.path): if absolute: yield p else: yield line def __eq__(self, other): return (isinstance(other, EggInfoDistribution) and self.path == other.path) # See http://docs.python.org/reference/datamodel#object.__hash__ __hash__ = object.__hash__ new_dist_class = InstalledDistribution old_dist_class = EggInfoDistribution class DependencyGraph(object): """ Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions. """ def __init__(self): self.adjacency_list = {} self.reverse_list = {} self.missing = {} def add_distribution(self, distribution): """Add the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` """ self.adjacency_list[distribution] = [] self.reverse_list[distribution] = [] #self.missing[distribution] = [] def add_edge(self, x, y, label=None): """Add an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type label: ``str`` or ``None`` """ self.adjacency_list[x].append((y, label)) # multiple edges are allowed, so be careful if x not in self.reverse_list[y]: self.reverse_list[y].append(x) def add_missing(self, distribution, requirement): """ Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str`` """ logger.debug('%s missing %r', distribution, requirement) self.missing.setdefault(distribution, []).append(requirement) def _repr_dist(self, dist): return '%s %s' % (dist.name, dist.version) def repr_node(self, dist, level=1): """Prints only a subgraph""" output = [self._repr_dist(dist)] for other, label in self.adjacency_list[dist]: dist = self._repr_dist(other) if label is not None: dist = '%s [%s]' % (dist, label) output.append(' ' * level + str(dist)) suboutput = self.repr_node(other, level + 1) subs = suboutput.split('\n') output.extend(subs[1:]) return '\n'.join(output) def to_dot(self, f, skip_disconnected=True): """Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool`` """ disconnected = [] f.write("digraph dependencies {\n") for dist, adjs in self.adjacency_list.items(): if len(adjs) == 0 and not skip_disconnected: disconnected.append(dist) for other, label in adjs: if not label is None: f.write('"%s" -> "%s" [label="%s"]\n' % (dist.name, other.name, label)) else: f.write('"%s" -> "%s"\n' % (dist.name, other.name)) if not skip_disconnected and len(disconnected) > 0: f.write('subgraph disconnected {\n') f.write('label = "Disconnected"\n') f.write('bgcolor = red\n') for dist in disconnected: f.write('"%s"' % dist.name) f.write('\n') f.write('}\n') f.write('}\n') def topological_sort(self): """ Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they have circular dependencies and so form a cycle. """ result = [] # Make a shallow copy of the adjacency list alist = {} for k, v in self.adjacency_list.items(): alist[k] = v[:] while True: # See what we can remove in this run to_remove = [] for k, v in list(alist.items())[:]: if not v: to_remove.append(k) del alist[k] if not to_remove: # What's left in alist (if anything) is a cycle. break # Remove from the adjacency list of others for k, v in alist.items(): alist[k] = [(d, r) for d, r in v if d not in to_remove] logger.debug('Moving to result: %s', ['%s (%s)' % (d.name, d.version) for d in to_remove]) result.extend(to_remove) return result, list(alist.keys()) def __repr__(self): """Representation of the graph""" output = [] for dist, adjs in self.adjacency_list.items(): output.append(self.repr_node(dist)) return '\n'.join(output) def make_graph(dists, scheme='default'): """Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance """ scheme = get_scheme(scheme) graph = DependencyGraph() provided = {} # maps names to lists of (version, dist) tuples # first, build the graph and find out what's provided for dist in dists: graph.add_distribution(dist) for p in dist.provides: name, version = parse_name_and_version(p) logger.debug('Add to provided: %s, %s, %s', name, version, dist) provided.setdefault(name, []).append((version, dist)) # now make the edges for dist in dists: requires = (dist.run_requires | dist.meta_requires | dist.build_requires | dist.dev_requires) for req in requires: try: matcher = scheme.matcher(req) except UnsupportedVersionError: # XXX compat-mode if cannot read the version logger.warning('could not read version %r - using name only', req) name = req.split()[0] matcher = scheme.matcher(name) name = matcher.key # case-insensitive matched = False if name in provided: for version, provider in provided[name]: try: match = matcher.match(version) except UnsupportedVersionError: match = False if match: graph.add_edge(dist, provider, req) matched = True break if not matched: graph.add_missing(dist, req) return graph def get_dependent_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are dependent on *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibException('given distribution %r is not a member ' 'of the list' % dist.name) graph = make_graph(dists) dep = [dist] # dependent distributions todo = graph.reverse_list[dist] # list of nodes we should inspect while todo: d = todo.pop() dep.append(d) for succ in graph.reverse_list[d]: if succ not in dep: todo.append(succ) dep.pop(0) # remove dist from dep, was there to prevent infinite loops return dep def get_required_dists(dists, dist): """Recursively generate a list of distributions from *dists* that are required by *dist*. :param dists: a list of distributions :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: raise DistlibException('given distribution %r is not a member ' 'of the list' % dist.name) graph = make_graph(dists) req = [] # required distributions todo = graph.adjacency_list[dist] # list of nodes we should inspect while todo: d = todo.pop()[0] req.append(d) for pred in graph.adjacency_list[d]: if pred not in req: todo.append(pred) return req def make_dist(name, version, **kwargs): """ A convenience method for making a dist given just a name and version. """ summary = kwargs.pop('summary', 'Placeholder for summary') md = Metadata(**kwargs) md.name = name md.version = version md.summary = summary or 'Placeholder for summary' return Distribution(md) distlib/wheel.py000064400000120270152347724720007673 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import unicode_literals import base64 import codecs import datetime import distutils.util from email import message_from_file import hashlib import imp import json import logging import os import posixpath import re import shutil import sys import tempfile import zipfile from . import __version__, DistlibException from .compat import sysconfig, ZipFile, fsdecode, text_type, filter from .database import InstalledDistribution from .metadata import (Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME, LEGACY_METADATA_FILENAME) from .util import (FileOperator, convert_path, CSVReader, CSVWriter, Cache, cached_property, get_cache_base, read_exports, tempdir) from .version import NormalizedVersion, UnsupportedVersionError logger = logging.getLogger(__name__) cache = None # created when needed if hasattr(sys, 'pypy_version_info'): # pragma: no cover IMP_PREFIX = 'pp' elif sys.platform.startswith('java'): # pragma: no cover IMP_PREFIX = 'jy' elif sys.platform == 'cli': # pragma: no cover IMP_PREFIX = 'ip' else: IMP_PREFIX = 'cp' VER_SUFFIX = sysconfig.get_config_var('py_version_nodot') if not VER_SUFFIX: # pragma: no cover VER_SUFFIX = '%s%s' % sys.version_info[:2] PYVER = 'py' + VER_SUFFIX IMPVER = IMP_PREFIX + VER_SUFFIX ARCH = distutils.util.get_platform().replace('-', '_').replace('.', '_') ABI = sysconfig.get_config_var('SOABI') if ABI and ABI.startswith('cpython-'): ABI = ABI.replace('cpython-', 'cp') else: def _derive_abi(): parts = ['cp', VER_SUFFIX] if sysconfig.get_config_var('Py_DEBUG'): parts.append('d') if sysconfig.get_config_var('WITH_PYMALLOC'): parts.append('m') if sysconfig.get_config_var('Py_UNICODE_SIZE') == 4: parts.append('u') return ''.join(parts) ABI = _derive_abi() del _derive_abi FILENAME_RE = re.compile(r''' (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? -(?P\w+\d+(\.\w+\d+)*) -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ ''', re.IGNORECASE | re.VERBOSE) NAME_VERSION_RE = re.compile(r''' (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ ''', re.IGNORECASE | re.VERBOSE) SHEBANG_RE = re.compile(br'\s*#![^\r\n]*') SHEBANG_DETAIL_RE = re.compile(br'^(\s*#!("[^"]+"|\S+))\s+(.*)$') SHEBANG_PYTHON = b'#!python' SHEBANG_PYTHONW = b'#!pythonw' if os.sep == '/': to_posix = lambda o: o else: to_posix = lambda o: o.replace(os.sep, '/') class Mounter(object): def __init__(self): self.impure_wheels = {} self.libs = {} def add(self, pathname, extensions): self.impure_wheels[pathname] = extensions self.libs.update(extensions) def remove(self, pathname): extensions = self.impure_wheels.pop(pathname) for k, v in extensions: if k in self.libs: del self.libs[k] def find_module(self, fullname, path=None): if fullname in self.libs: result = self else: result = None return result def load_module(self, fullname): if fullname in sys.modules: result = sys.modules[fullname] else: if fullname not in self.libs: raise ImportError('unable to find extension for %s' % fullname) result = imp.load_dynamic(fullname, self.libs[fullname]) result.__loader__ = self parts = fullname.rsplit('.', 1) if len(parts) > 1: result.__package__ = parts[0] return result _hook = Mounter() class Wheel(object): """ Class to build and install from Wheel files (PEP 427). """ wheel_version = (1, 1) hash_kind = 'sha256' def __init__(self, filename=None, sign=False, verify=False): """ Initialise an instance using a (valid) filename. """ self.sign = sign self.should_verify = verify self.buildver = '' self.pyver = [PYVER] self.abi = ['none'] self.arch = ['any'] self.dirname = os.getcwd() if filename is None: self.name = 'dummy' self.version = '0.1' self._filename = self.filename else: m = NAME_VERSION_RE.match(filename) if m: info = m.groupdict('') self.name = info['nm'] # Reinstate the local version separator self.version = info['vn'].replace('_', '-') self.buildver = info['bn'] self._filename = self.filename else: dirname, filename = os.path.split(filename) m = FILENAME_RE.match(filename) if not m: raise DistlibException('Invalid name or ' 'filename: %r' % filename) if dirname: self.dirname = os.path.abspath(dirname) self._filename = filename info = m.groupdict('') self.name = info['nm'] self.version = info['vn'] self.buildver = info['bn'] self.pyver = info['py'].split('.') self.abi = info['bi'].split('.') self.arch = info['ar'].split('.') @property def filename(self): """ Build and return a filename from the various components. """ if self.buildver: buildver = '-' + self.buildver else: buildver = '' pyver = '.'.join(self.pyver) abi = '.'.join(self.abi) arch = '.'.join(self.arch) # replace - with _ as a local version separator version = self.version.replace('-', '_') return '%s-%s%s-%s-%s-%s.whl' % (self.name, version, buildver, pyver, abi, arch) @property def exists(self): path = os.path.join(self.dirname, self.filename) return os.path.isfile(path) @property def tags(self): for pyver in self.pyver: for abi in self.abi: for arch in self.arch: yield pyver, abi, arch @cached_property def metadata(self): pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver wrapper = codecs.getreader('utf-8') with ZipFile(pathname, 'r') as zf: wheel_metadata = self.get_wheel_metadata(zf) wv = wheel_metadata['Wheel-Version'].split('.', 1) file_version = tuple([int(i) for i in wv]) # if file_version < (1, 1): # fns = [WHEEL_METADATA_FILENAME, METADATA_FILENAME, # LEGACY_METADATA_FILENAME] # else: # fns = [WHEEL_METADATA_FILENAME, METADATA_FILENAME] fns = [WHEEL_METADATA_FILENAME, LEGACY_METADATA_FILENAME] result = None for fn in fns: try: metadata_filename = posixpath.join(info_dir, fn) with zf.open(metadata_filename) as bf: wf = wrapper(bf) result = Metadata(fileobj=wf) if result: break except KeyError: pass if not result: raise ValueError('Invalid wheel, because metadata is ' 'missing: looked in %s' % ', '.join(fns)) return result def get_wheel_metadata(self, zf): name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver metadata_filename = posixpath.join(info_dir, 'WHEEL') with zf.open(metadata_filename) as bf: wf = codecs.getreader('utf-8')(bf) message = message_from_file(wf) return dict(message) @cached_property def info(self): pathname = os.path.join(self.dirname, self.filename) with ZipFile(pathname, 'r') as zf: result = self.get_wheel_metadata(zf) return result def process_shebang(self, data): m = SHEBANG_RE.match(data) if m: end = m.end() shebang, data_after_shebang = data[:end], data[end:] # Preserve any arguments after the interpreter if b'pythonw' in shebang.lower(): shebang_python = SHEBANG_PYTHONW else: shebang_python = SHEBANG_PYTHON m = SHEBANG_DETAIL_RE.match(shebang) if m: args = b' ' + m.groups()[-1] else: args = b'' shebang = shebang_python + args data = shebang + data_after_shebang else: cr = data.find(b'\r') lf = data.find(b'\n') if cr < 0 or cr > lf: term = b'\n' else: if data[cr:cr + 2] == b'\r\n': term = b'\r\n' else: term = b'\r' data = SHEBANG_PYTHON + term + data return data def get_hash(self, data, hash_kind=None): if hash_kind is None: hash_kind = self.hash_kind try: hasher = getattr(hashlib, hash_kind) except AttributeError: raise DistlibException('Unsupported hash algorithm: %r' % hash_kind) result = hasher(data).digest() result = base64.urlsafe_b64encode(result).rstrip(b'=').decode('ascii') return hash_kind, result def write_record(self, records, record_path, base): records = list(records) # make a copy, as mutated p = to_posix(os.path.relpath(record_path, base)) records.append((p, '', '')) with CSVWriter(record_path) as writer: for row in records: writer.writerow(row) def write_records(self, info, libdir, archive_paths): records = [] distinfo, info_dir = info hasher = getattr(hashlib, self.hash_kind) for ap, p in archive_paths: with open(p, 'rb') as f: data = f.read() digest = '%s=%s' % self.get_hash(data) size = os.path.getsize(p) records.append((ap, digest, size)) p = os.path.join(distinfo, 'RECORD') self.write_record(records, p, libdir) ap = to_posix(os.path.join(info_dir, 'RECORD')) archive_paths.append((ap, p)) def build_zip(self, pathname, archive_paths): with ZipFile(pathname, 'w', zipfile.ZIP_DEFLATED) as zf: for ap, p in archive_paths: logger.debug('Wrote %s to %s in wheel', p, ap) zf.write(p, ap) def build(self, paths, tags=None, wheel_version=None): """ Build a wheel from files in specified paths, and use any specified tags when determining the name of the wheel. """ if tags is None: tags = {} libkey = list(filter(lambda o: o in paths, ('purelib', 'platlib')))[0] if libkey == 'platlib': is_pure = 'false' default_pyver = [IMPVER] default_abi = [ABI] default_arch = [ARCH] else: is_pure = 'true' default_pyver = [PYVER] default_abi = ['none'] default_arch = ['any'] self.pyver = tags.get('pyver', default_pyver) self.abi = tags.get('abi', default_abi) self.arch = tags.get('arch', default_arch) libdir = paths[libkey] name_ver = '%s-%s' % (self.name, self.version) data_dir = '%s.data' % name_ver info_dir = '%s.dist-info' % name_ver archive_paths = [] # First, stuff which is not in site-packages for key in ('data', 'headers', 'scripts'): if key not in paths: continue path = paths[key] if os.path.isdir(path): for root, dirs, files in os.walk(path): for fn in files: p = fsdecode(os.path.join(root, fn)) rp = os.path.relpath(p, path) ap = to_posix(os.path.join(data_dir, key, rp)) archive_paths.append((ap, p)) if key == 'scripts' and not p.endswith('.exe'): with open(p, 'rb') as f: data = f.read() data = self.process_shebang(data) with open(p, 'wb') as f: f.write(data) # Now, stuff which is in site-packages, other than the # distinfo stuff. path = libdir distinfo = None for root, dirs, files in os.walk(path): if root == path: # At the top level only, save distinfo for later # and skip it for now for i, dn in enumerate(dirs): dn = fsdecode(dn) if dn.endswith('.dist-info'): distinfo = os.path.join(root, dn) del dirs[i] break assert distinfo, '.dist-info directory expected, not found' for fn in files: # comment out next suite to leave .pyc files in if fsdecode(fn).endswith(('.pyc', '.pyo')): continue p = os.path.join(root, fn) rp = to_posix(os.path.relpath(p, path)) archive_paths.append((rp, p)) # Now distinfo. Assumed to be flat, i.e. os.listdir is enough. files = os.listdir(distinfo) for fn in files: if fn not in ('RECORD', 'INSTALLER', 'SHARED', 'WHEEL'): p = fsdecode(os.path.join(distinfo, fn)) ap = to_posix(os.path.join(info_dir, fn)) archive_paths.append((ap, p)) wheel_metadata = [ 'Wheel-Version: %d.%d' % (wheel_version or self.wheel_version), 'Generator: distlib %s' % __version__, 'Root-Is-Purelib: %s' % is_pure, ] for pyver, abi, arch in self.tags: wheel_metadata.append('Tag: %s-%s-%s' % (pyver, abi, arch)) p = os.path.join(distinfo, 'WHEEL') with open(p, 'w') as f: f.write('\n'.join(wheel_metadata)) ap = to_posix(os.path.join(info_dir, 'WHEEL')) archive_paths.append((ap, p)) # sort the entries by archive path. Not needed by any spec, but it # keeps the archive listing and RECORD tidier than they would otherwise # be. Use the number of path segments to keep directory entries together, # and keep the dist-info stuff at the end. def sorter(t): ap = t[0] n = ap.count('/') if '.dist-info' in ap: n += 10000 return (n, ap) archive_paths = sorted(archive_paths, key=sorter) # Now, at last, RECORD. # Paths in here are archive paths - nothing else makes sense. self.write_records((distinfo, info_dir), libdir, archive_paths) # Now, ready to build the zip file pathname = os.path.join(self.dirname, self.filename) self.build_zip(pathname, archive_paths) return pathname def skip_entry(self, arcname): """ Determine whether an archive entry should be skipped when verifying or installing. """ # The signature file won't be in RECORD, # and we don't currently don't do anything with it # We also skip directories, as they won't be in RECORD # either. See: # # https://github.com/pypa/wheel/issues/294 # https://github.com/pypa/wheel/issues/287 # https://github.com/pypa/wheel/pull/289 # return arcname.endswith(('/', '/RECORD.jws')) def install(self, paths, maker, **kwargs): """ Install a wheel to the specified paths. If kwarg ``warner`` is specified, it should be a callable, which will be called with two tuples indicating the wheel version of this software and the wheel version in the file, if there is a discrepancy in the versions. This can be used to issue any warnings to raise any exceptions. If kwarg ``lib_only`` is True, only the purelib/platlib files are installed, and the headers, scripts, data and dist-info metadata are not written. If kwarg ``bytecode_hashed_invalidation`` is True, written bytecode will try to use file-hash based invalidation (PEP-552) on supported interpreter versions (CPython 2.7+). The return value is a :class:`InstalledDistribution` instance unless ``options.lib_only`` is True, in which case the return value is ``None``. """ dry_run = maker.dry_run warner = kwargs.get('warner') lib_only = kwargs.get('lib_only', False) bc_hashed_invalidation = kwargs.get('bytecode_hashed_invalidation', False) pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) data_dir = '%s.data' % name_ver info_dir = '%s.dist-info' % name_ver metadata_name = posixpath.join(info_dir, LEGACY_METADATA_FILENAME) wheel_metadata_name = posixpath.join(info_dir, 'WHEEL') record_name = posixpath.join(info_dir, 'RECORD') wrapper = codecs.getreader('utf-8') with ZipFile(pathname, 'r') as zf: with zf.open(wheel_metadata_name) as bwf: wf = wrapper(bwf) message = message_from_file(wf) wv = message['Wheel-Version'].split('.', 1) file_version = tuple([int(i) for i in wv]) if (file_version != self.wheel_version) and warner: warner(self.wheel_version, file_version) if message['Root-Is-Purelib'] == 'true': libdir = paths['purelib'] else: libdir = paths['platlib'] records = {} with zf.open(record_name) as bf: with CSVReader(stream=bf) as reader: for row in reader: p = row[0] records[p] = row data_pfx = posixpath.join(data_dir, '') info_pfx = posixpath.join(info_dir, '') script_pfx = posixpath.join(data_dir, 'scripts', '') # make a new instance rather than a copy of maker's, # as we mutate it fileop = FileOperator(dry_run=dry_run) fileop.record = True # so we can rollback if needed bc = not sys.dont_write_bytecode # Double negatives. Lovely! outfiles = [] # for RECORD writing # for script copying/shebang processing workdir = tempfile.mkdtemp() # set target dir later # we default add_launchers to False, as the # Python Launcher should be used instead maker.source_dir = workdir maker.target_dir = None try: for zinfo in zf.infolist(): arcname = zinfo.filename if isinstance(arcname, text_type): u_arcname = arcname else: u_arcname = arcname.decode('utf-8') if self.skip_entry(u_arcname): continue row = records[u_arcname] if row[2] and str(zinfo.file_size) != row[2]: raise DistlibException('size mismatch for ' '%s' % u_arcname) if row[1]: kind, value = row[1].split('=', 1) with zf.open(arcname) as bf: data = bf.read() _, digest = self.get_hash(data, kind) if digest != value: raise DistlibException('digest mismatch for ' '%s' % arcname) if lib_only and u_arcname.startswith((info_pfx, data_pfx)): logger.debug('lib_only: skipping %s', u_arcname) continue is_script = (u_arcname.startswith(script_pfx) and not u_arcname.endswith('.exe')) if u_arcname.startswith(data_pfx): _, where, rp = u_arcname.split('/', 2) outfile = os.path.join(paths[where], convert_path(rp)) else: # meant for site-packages. if u_arcname in (wheel_metadata_name, record_name): continue outfile = os.path.join(libdir, convert_path(u_arcname)) if not is_script: with zf.open(arcname) as bf: fileop.copy_stream(bf, outfile) outfiles.append(outfile) # Double check the digest of the written file if not dry_run and row[1]: with open(outfile, 'rb') as bf: data = bf.read() _, newdigest = self.get_hash(data, kind) if newdigest != digest: raise DistlibException('digest mismatch ' 'on write for ' '%s' % outfile) if bc and outfile.endswith('.py'): try: pyc = fileop.byte_compile(outfile, hashed_invalidation=bc_hashed_invalidation) outfiles.append(pyc) except Exception: # Don't give up if byte-compilation fails, # but log it and perhaps warn the user logger.warning('Byte-compilation failed', exc_info=True) else: fn = os.path.basename(convert_path(arcname)) workname = os.path.join(workdir, fn) with zf.open(arcname) as bf: fileop.copy_stream(bf, workname) dn, fn = os.path.split(outfile) maker.target_dir = dn filenames = maker.make(fn) fileop.set_executable_mode(filenames) outfiles.extend(filenames) if lib_only: logger.debug('lib_only: returning None') dist = None else: # Generate scripts # Try to get pydist.json so we can see if there are # any commands to generate. If this fails (e.g. because # of a legacy wheel), log a warning but don't give up. commands = None file_version = self.info['Wheel-Version'] if file_version == '1.0': # Use legacy info ep = posixpath.join(info_dir, 'entry_points.txt') try: with zf.open(ep) as bwf: epdata = read_exports(bwf) commands = {} for key in ('console', 'gui'): k = '%s_scripts' % key if k in epdata: commands['wrap_%s' % key] = d = {} for v in epdata[k].values(): s = '%s:%s' % (v.prefix, v.suffix) if v.flags: s += ' [%s]' % ','.join(v.flags) d[v.name] = s except Exception: logger.warning('Unable to read legacy script ' 'metadata, so cannot generate ' 'scripts') else: try: with zf.open(metadata_name) as bwf: wf = wrapper(bwf) commands = json.load(wf).get('extensions') if commands: commands = commands.get('python.commands') except Exception: logger.warning('Unable to read JSON metadata, so ' 'cannot generate scripts') if commands: console_scripts = commands.get('wrap_console', {}) gui_scripts = commands.get('wrap_gui', {}) if console_scripts or gui_scripts: script_dir = paths.get('scripts', '') if not os.path.isdir(script_dir): raise ValueError('Valid script path not ' 'specified') maker.target_dir = script_dir for k, v in console_scripts.items(): script = '%s = %s' % (k, v) filenames = maker.make(script) fileop.set_executable_mode(filenames) if gui_scripts: options = {'gui': True } for k, v in gui_scripts.items(): script = '%s = %s' % (k, v) filenames = maker.make(script, options) fileop.set_executable_mode(filenames) p = os.path.join(libdir, info_dir) dist = InstalledDistribution(p) # Write SHARED paths = dict(paths) # don't change passed in dict del paths['purelib'] del paths['platlib'] paths['lib'] = libdir p = dist.write_shared_locations(paths, dry_run) if p: outfiles.append(p) # Write RECORD dist.write_installed_files(outfiles, paths['prefix'], dry_run) return dist except Exception: # pragma: no cover logger.exception('installation failed.') fileop.rollback() raise finally: shutil.rmtree(workdir) def _get_dylib_cache(self): global cache if cache is None: # Use native string to avoid issues on 2.x: see Python #20140. base = os.path.join(get_cache_base(), str('dylib-cache'), '%s.%s' % sys.version_info[:2]) cache = Cache(base) return cache def _get_extensions(self): pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver arcname = posixpath.join(info_dir, 'EXTENSIONS') wrapper = codecs.getreader('utf-8') result = [] with ZipFile(pathname, 'r') as zf: try: with zf.open(arcname) as bf: wf = wrapper(bf) extensions = json.load(wf) cache = self._get_dylib_cache() prefix = cache.prefix_to_dir(pathname) cache_base = os.path.join(cache.base, prefix) if not os.path.isdir(cache_base): os.makedirs(cache_base) for name, relpath in extensions.items(): dest = os.path.join(cache_base, convert_path(relpath)) if not os.path.exists(dest): extract = True else: file_time = os.stat(dest).st_mtime file_time = datetime.datetime.fromtimestamp(file_time) info = zf.getinfo(relpath) wheel_time = datetime.datetime(*info.date_time) extract = wheel_time > file_time if extract: zf.extract(relpath, cache_base) result.append((name, dest)) except KeyError: pass return result def is_compatible(self): """ Determine if a wheel is compatible with the running system. """ return is_compatible(self) def is_mountable(self): """ Determine if a wheel is asserted as mountable by its metadata. """ return True # for now - metadata details TBD def mount(self, append=False): pathname = os.path.abspath(os.path.join(self.dirname, self.filename)) if not self.is_compatible(): msg = 'Wheel %s not compatible with this Python.' % pathname raise DistlibException(msg) if not self.is_mountable(): msg = 'Wheel %s is marked as not mountable.' % pathname raise DistlibException(msg) if pathname in sys.path: logger.debug('%s already in path', pathname) else: if append: sys.path.append(pathname) else: sys.path.insert(0, pathname) extensions = self._get_extensions() if extensions: if _hook not in sys.meta_path: sys.meta_path.append(_hook) _hook.add(pathname, extensions) def unmount(self): pathname = os.path.abspath(os.path.join(self.dirname, self.filename)) if pathname not in sys.path: logger.debug('%s not in path', pathname) else: sys.path.remove(pathname) if pathname in _hook.impure_wheels: _hook.remove(pathname) if not _hook.impure_wheels: if _hook in sys.meta_path: sys.meta_path.remove(_hook) def verify(self): pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) data_dir = '%s.data' % name_ver info_dir = '%s.dist-info' % name_ver metadata_name = posixpath.join(info_dir, LEGACY_METADATA_FILENAME) wheel_metadata_name = posixpath.join(info_dir, 'WHEEL') record_name = posixpath.join(info_dir, 'RECORD') wrapper = codecs.getreader('utf-8') with ZipFile(pathname, 'r') as zf: with zf.open(wheel_metadata_name) as bwf: wf = wrapper(bwf) message = message_from_file(wf) wv = message['Wheel-Version'].split('.', 1) file_version = tuple([int(i) for i in wv]) # TODO version verification records = {} with zf.open(record_name) as bf: with CSVReader(stream=bf) as reader: for row in reader: p = row[0] records[p] = row for zinfo in zf.infolist(): arcname = zinfo.filename if isinstance(arcname, text_type): u_arcname = arcname else: u_arcname = arcname.decode('utf-8') # See issue #115: some wheels have .. in their entries, but # in the filename ... e.g. __main__..py ! So the check is # updated to look for .. in the directory portions p = u_arcname.split('/') if '..' in p: raise DistlibException('invalid entry in ' 'wheel: %r' % u_arcname) if self.skip_entry(u_arcname): continue row = records[u_arcname] if row[2] and str(zinfo.file_size) != row[2]: raise DistlibException('size mismatch for ' '%s' % u_arcname) if row[1]: kind, value = row[1].split('=', 1) with zf.open(arcname) as bf: data = bf.read() _, digest = self.get_hash(data, kind) if digest != value: raise DistlibException('digest mismatch for ' '%s' % arcname) def update(self, modifier, dest_dir=None, **kwargs): """ Update the contents of a wheel in a generic way. The modifier should be a callable which expects a dictionary argument: its keys are archive-entry paths, and its values are absolute filesystem paths where the contents the corresponding archive entries can be found. The modifier is free to change the contents of the files pointed to, add new entries and remove entries, before returning. This method will extract the entire contents of the wheel to a temporary location, call the modifier, and then use the passed (and possibly updated) dictionary to write a new wheel. If ``dest_dir`` is specified, the new wheel is written there -- otherwise, the original wheel is overwritten. The modifier should return True if it updated the wheel, else False. This method returns the same value the modifier returns. """ def get_version(path_map, info_dir): version = path = None key = '%s/%s' % (info_dir, LEGACY_METADATA_FILENAME) if key not in path_map: key = '%s/PKG-INFO' % info_dir if key in path_map: path = path_map[key] version = Metadata(path=path).version return version, path def update_version(version, path): updated = None try: v = NormalizedVersion(version) i = version.find('-') if i < 0: updated = '%s+1' % version else: parts = [int(s) for s in version[i + 1:].split('.')] parts[-1] += 1 updated = '%s+%s' % (version[:i], '.'.join(str(i) for i in parts)) except UnsupportedVersionError: logger.debug('Cannot update non-compliant (PEP-440) ' 'version %r', version) if updated: md = Metadata(path=path) md.version = updated legacy = path.endswith(LEGACY_METADATA_FILENAME) md.write(path=path, legacy=legacy) logger.debug('Version updated from %r to %r', version, updated) pathname = os.path.join(self.dirname, self.filename) name_ver = '%s-%s' % (self.name, self.version) info_dir = '%s.dist-info' % name_ver record_name = posixpath.join(info_dir, 'RECORD') with tempdir() as workdir: with ZipFile(pathname, 'r') as zf: path_map = {} for zinfo in zf.infolist(): arcname = zinfo.filename if isinstance(arcname, text_type): u_arcname = arcname else: u_arcname = arcname.decode('utf-8') if u_arcname == record_name: continue if '..' in u_arcname: raise DistlibException('invalid entry in ' 'wheel: %r' % u_arcname) zf.extract(zinfo, workdir) path = os.path.join(workdir, convert_path(u_arcname)) path_map[u_arcname] = path # Remember the version. original_version, _ = get_version(path_map, info_dir) # Files extracted. Call the modifier. modified = modifier(path_map, **kwargs) if modified: # Something changed - need to build a new wheel. current_version, path = get_version(path_map, info_dir) if current_version and (current_version == original_version): # Add or update local version to signify changes. update_version(current_version, path) # Decide where the new wheel goes. if dest_dir is None: fd, newpath = tempfile.mkstemp(suffix='.whl', prefix='wheel-update-', dir=workdir) os.close(fd) else: if not os.path.isdir(dest_dir): raise DistlibException('Not a directory: %r' % dest_dir) newpath = os.path.join(dest_dir, self.filename) archive_paths = list(path_map.items()) distinfo = os.path.join(workdir, info_dir) info = distinfo, info_dir self.write_records(info, workdir, archive_paths) self.build_zip(newpath, archive_paths) if dest_dir is None: shutil.copyfile(newpath, pathname) return modified def compatible_tags(): """ Return (pyver, abi, arch) tuples compatible with this Python. """ versions = [VER_SUFFIX] major = VER_SUFFIX[0] for minor in range(sys.version_info[1] - 1, - 1, -1): versions.append(''.join([major, str(minor)])) abis = [] for suffix, _, _ in imp.get_suffixes(): if suffix.startswith('.abi'): abis.append(suffix.split('.', 2)[1]) abis.sort() if ABI != 'none': abis.insert(0, ABI) abis.append('none') result = [] arches = [ARCH] if sys.platform == 'darwin': m = re.match(r'(\w+)_(\d+)_(\d+)_(\w+)$', ARCH) if m: name, major, minor, arch = m.groups() minor = int(minor) matches = [arch] if arch in ('i386', 'ppc'): matches.append('fat') if arch in ('i386', 'ppc', 'x86_64'): matches.append('fat3') if arch in ('ppc64', 'x86_64'): matches.append('fat64') if arch in ('i386', 'x86_64'): matches.append('intel') if arch in ('i386', 'x86_64', 'intel', 'ppc', 'ppc64'): matches.append('universal') while minor >= 0: for match in matches: s = '%s_%s_%s_%s' % (name, major, minor, match) if s != ARCH: # already there arches.append(s) minor -= 1 # Most specific - our Python version, ABI and arch for abi in abis: for arch in arches: result.append((''.join((IMP_PREFIX, versions[0])), abi, arch)) # where no ABI / arch dependency, but IMP_PREFIX dependency for i, version in enumerate(versions): result.append((''.join((IMP_PREFIX, version)), 'none', 'any')) if i == 0: result.append((''.join((IMP_PREFIX, version[0])), 'none', 'any')) # no IMP_PREFIX, ABI or arch dependency for i, version in enumerate(versions): result.append((''.join(('py', version)), 'none', 'any')) if i == 0: result.append((''.join(('py', version[0])), 'none', 'any')) return set(result) COMPATIBLE_TAGS = compatible_tags() del compatible_tags def is_compatible(wheel, tags=None): if not isinstance(wheel, Wheel): wheel = Wheel(wheel) # assume it's a filename result = False if tags is None: tags = COMPATIBLE_TAGS for ver, abi, arch in tags: if ver in wheel.pyver and abi in wheel.abi and arch in wheel.arch: result = True break return result distlib/locators.py000064400000145604152347724720010425 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import gzip from io import BytesIO import json import logging import os import posixpath import re try: import threading except ImportError: # pragma: no cover import dummy_threading as threading import zlib from . import DistlibException from .compat import (urljoin, urlparse, urlunparse, url2pathname, pathname2url, queue, quote, unescape, string_types, build_opener, HTTPRedirectHandler as BaseRedirectHandler, text_type, Request, HTTPError, URLError) from .database import Distribution, DistributionPath, make_dist from .metadata import Metadata, MetadataInvalidError from .util import (cached_property, parse_credentials, ensure_slash, split_filename, get_project_data, parse_requirement, parse_name_and_version, ServerProxy, normalize_name) from .version import get_scheme, UnsupportedVersionError from .wheel import Wheel, is_compatible logger = logging.getLogger(__name__) HASHER_HASH = re.compile(r'^(\w+)=([a-f0-9]+)') CHARSET = re.compile(r';\s*charset\s*=\s*(.*)\s*$', re.I) HTML_CONTENT_TYPE = re.compile('text/html|application/x(ht)?ml') DEFAULT_INDEX = 'https://pypi.org/pypi' def get_all_distribution_names(url=None): """ Return all distribution names known by an index. :param url: The URL of the index. :return: A list of all known distribution names. """ if url is None: url = DEFAULT_INDEX client = ServerProxy(url, timeout=3.0) try: return client.list_packages() finally: client('close')() class RedirectHandler(BaseRedirectHandler): """ A class to work around a bug in some Python 3.2.x releases. """ # There's a bug in the base version for some 3.2.x # (e.g. 3.2.2 on Ubuntu Oneiric). If a Location header # returns e.g. /abc, it bails because it says the scheme '' # is bogus, when actually it should use the request's # URL for the scheme. See Python issue #13696. def http_error_302(self, req, fp, code, msg, headers): # Some servers (incorrectly) return multiple Location headers # (so probably same goes for URI). Use first header. newurl = None for key in ('location', 'uri'): if key in headers: newurl = headers[key] break if newurl is None: # pragma: no cover return urlparts = urlparse(newurl) if urlparts.scheme == '': newurl = urljoin(req.get_full_url(), newurl) if hasattr(headers, 'replace_header'): headers.replace_header(key, newurl) else: headers[key] = newurl return BaseRedirectHandler.http_error_302(self, req, fp, code, msg, headers) http_error_301 = http_error_303 = http_error_307 = http_error_302 class Locator(object): """ A base class for locators - things that locate distributions. """ source_extensions = ('.tar.gz', '.tar.bz2', '.tar', '.zip', '.tgz', '.tbz') binary_extensions = ('.egg', '.exe', '.whl') excluded_extensions = ('.pdf',) # A list of tags indicating which wheels you want to match. The default # value of None matches against the tags compatible with the running # Python. If you want to match other values, set wheel_tags on a locator # instance to a list of tuples (pyver, abi, arch) which you want to match. wheel_tags = None downloadable_extensions = source_extensions + ('.whl',) def __init__(self, scheme='default'): """ Initialise an instance. :param scheme: Because locators look for most recent versions, they need to know the version scheme to use. This specifies the current PEP-recommended scheme - use ``'legacy'`` if you need to support existing distributions on PyPI. """ self._cache = {} self.scheme = scheme # Because of bugs in some of the handlers on some of the platforms, # we use our own opener rather than just using urlopen. self.opener = build_opener(RedirectHandler()) # If get_project() is called from locate(), the matcher instance # is set from the requirement passed to locate(). See issue #18 for # why this can be useful to know. self.matcher = None self.errors = queue.Queue() def get_errors(self): """ Return any errors which have occurred. """ result = [] while not self.errors.empty(): # pragma: no cover try: e = self.errors.get(False) result.append(e) except self.errors.Empty: continue self.errors.task_done() return result def clear_errors(self): """ Clear any errors which may have been logged. """ # Just get the errors and throw them away self.get_errors() def clear_cache(self): self._cache.clear() def _get_scheme(self): return self._scheme def _set_scheme(self, value): self._scheme = value scheme = property(_get_scheme, _set_scheme) def _get_project(self, name): """ For a given project, get a dictionary mapping available versions to Distribution instances. This should be implemented in subclasses. If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. """ raise NotImplementedError('Please implement in the subclass') def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Please implement in the subclass') def get_project(self, name): """ For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top. """ if self._cache is None: # pragma: no cover result = self._get_project(name) elif name in self._cache: result = self._cache[name] else: self.clear_errors() result = self._get_project(name) self._cache[name] = result return result def score_url(self, url): """ Give an url a score which can be used to choose preferred URLs for a given project release. """ t = urlparse(url) basename = posixpath.basename(t.path) compatible = True is_wheel = basename.endswith('.whl') is_downloadable = basename.endswith(self.downloadable_extensions) if is_wheel: compatible = is_compatible(Wheel(basename), self.wheel_tags) return (t.scheme == 'https', 'pypi.org' in t.netloc, is_downloadable, is_wheel, compatible, basename) def prefer_url(self, url1, url2): """ Choose one of two URLs where both are candidates for distribution archives for the same version of a distribution (for example, .tar.gz vs. zip). The current implementation favours https:// URLs over http://, archives from PyPI over those from other locations, wheel compatibility (if a wheel) and then the archive name. """ result = url2 if url1: s1 = self.score_url(url1) s2 = self.score_url(url2) if s1 > s2: result = url1 if result != url2: logger.debug('Not replacing %r with %r', url1, url2) else: logger.debug('Replacing %r with %r', url1, url2) return result def split_filename(self, filename, project_name): """ Attempt to split a filename in project name, version and Python version. """ return split_filename(filename, project_name) def convert_url_to_download_info(self, url, project_name): """ See if a URL is a candidate for a download URL for a project (the URL has typically been scraped from an HTML page). If it is, a dictionary is returned with keys "name", "version", "filename" and "url"; otherwise, None is returned. """ def same_project(name1, name2): return normalize_name(name1) == normalize_name(name2) result = None scheme, netloc, path, params, query, frag = urlparse(url) if frag.lower().startswith('egg='): # pragma: no cover logger.debug('%s: version hint in fragment: %r', project_name, frag) m = HASHER_HASH.match(frag) if m: algo, digest = m.groups() else: algo, digest = None, None origpath = path if path and path[-1] == '/': # pragma: no cover path = path[:-1] if path.endswith('.whl'): try: wheel = Wheel(path) if not is_compatible(wheel, self.wheel_tags): logger.debug('Wheel not compatible: %s', path) else: if project_name is None: include = True else: include = same_project(wheel.name, project_name) if include: result = { 'name': wheel.name, 'version': wheel.version, 'filename': wheel.filename, 'url': urlunparse((scheme, netloc, origpath, params, query, '')), 'python-version': ', '.join( ['.'.join(list(v[2:])) for v in wheel.pyver]), } except Exception as e: # pragma: no cover logger.warning('invalid path for wheel: %s', path) elif not path.endswith(self.downloadable_extensions): # pragma: no cover logger.debug('Not downloadable: %s', path) else: # downloadable extension path = filename = posixpath.basename(path) for ext in self.downloadable_extensions: if path.endswith(ext): path = path[:-len(ext)] t = self.split_filename(path, project_name) if not t: # pragma: no cover logger.debug('No match for project/version: %s', path) else: name, version, pyver = t if not project_name or same_project(project_name, name): result = { 'name': name, 'version': version, 'filename': filename, 'url': urlunparse((scheme, netloc, origpath, params, query, '')), #'packagetype': 'sdist', } if pyver: # pragma: no cover result['python-version'] = pyver break if result and algo: result['%s_digest' % algo] = digest return result def _get_digest(self, info): """ Get a digest from a dictionary by looking at a "digests" dictionary or keys of the form 'algo_digest'. Returns a 2-tuple (algo, digest) if found, else None. Currently looks only for SHA256, then MD5. """ result = None if 'digests' in info: digests = info['digests'] for algo in ('sha256', 'md5'): if algo in digests: result = (algo, digests[algo]) break if not result: for algo in ('sha256', 'md5'): key = '%s_digest' % algo if key in info: result = (algo, info[key]) break return result def _update_version_data(self, result, info): """ Update a result dictionary (the final result from _get_project) with a dictionary for a specific version, which typically holds information gleaned from a filename or URL for an archive for the distribution. """ name = info.pop('name') version = info.pop('version') if version in result: dist = result[version] md = dist.metadata else: dist = make_dist(name, version, scheme=self.scheme) md = dist.metadata dist.digest = digest = self._get_digest(info) url = info['url'] result['digests'][url] = digest if md.source_url != info['url']: md.source_url = self.prefer_url(md.source_url, url) result['urls'].setdefault(version, set()).add(url) dist.locator = self result[version] = dist def locate(self, requirement, prereleases=False): """ Find the most recent distribution which matches the given requirement. :param requirement: A requirement of the form 'foo (1.0)' or perhaps 'foo (>= 1.0, < 2.0, != 1.3)' :param prereleases: If ``True``, allow pre-release versions to be located. Otherwise, pre-release versions are not returned. :return: A :class:`Distribution` instance, or ``None`` if no such distribution could be located. """ result = None r = parse_requirement(requirement) if r is None: # pragma: no cover raise DistlibException('Not a valid requirement: %r' % requirement) scheme = get_scheme(self.scheme) self.matcher = matcher = scheme.matcher(r.requirement) logger.debug('matcher: %s (%s)', matcher, type(matcher).__name__) versions = self.get_project(r.name) if len(versions) > 2: # urls and digests keys are present # sometimes, versions are invalid slist = [] vcls = matcher.version_class for k in versions: if k in ('urls', 'digests'): continue try: if not matcher.match(k): logger.debug('%s did not match %r', matcher, k) else: if prereleases or not vcls(k).is_prerelease: slist.append(k) else: logger.debug('skipping pre-release ' 'version %s of %s', k, matcher.name) except Exception: # pragma: no cover logger.warning('error matching %s with %r', matcher, k) pass # slist.append(k) if len(slist) > 1: slist = sorted(slist, key=scheme.key) if slist: logger.debug('sorted list: %s', slist) version = slist[-1] result = versions[version] if result: if r.extras: result.extras = r.extras result.download_urls = versions.get('urls', {}).get(version, set()) d = {} sd = versions.get('digests', {}) for url in result.download_urls: if url in sd: # pragma: no cover d[url] = sd[url] result.digests = d self.matcher = None return result class PyPIRPCLocator(Locator): """ This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). """ def __init__(self, url, **kwargs): """ Initialise an instance. :param url: The URL to use for XML-RPC. :param kwargs: Passed to the superclass constructor. """ super(PyPIRPCLocator, self).__init__(**kwargs) self.base_url = url self.client = ServerProxy(url, timeout=3.0) def get_distribution_names(self): """ Return all the distribution names known to this locator. """ return set(self.client.list_packages()) def _get_project(self, name): result = {'urls': {}, 'digests': {}} versions = self.client.package_releases(name, True) for v in versions: urls = self.client.release_urls(name, v) data = self.client.release_data(name, v) metadata = Metadata(scheme=self.scheme) metadata.name = data['name'] metadata.version = data['version'] metadata.license = data.get('license') metadata.keywords = data.get('keywords', []) metadata.summary = data.get('summary') dist = Distribution(metadata) if urls: info = urls[0] metadata.source_url = info['url'] dist.digest = self._get_digest(info) dist.locator = self result[v] = dist for info in urls: url = info['url'] digest = self._get_digest(info) result['urls'].setdefault(v, set()).add(url) result['digests'][url] = digest return result class PyPIJSONLocator(Locator): """ This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. """ def __init__(self, url, **kwargs): super(PyPIJSONLocator, self).__init__(**kwargs) self.base_url = ensure_slash(url) def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Not available from this locator') def _get_project(self, name): result = {'urls': {}, 'digests': {}} url = urljoin(self.base_url, '%s/json' % quote(name)) try: resp = self.opener.open(url) data = resp.read().decode() # for now d = json.loads(data) md = Metadata(scheme=self.scheme) data = d['info'] md.name = data['name'] md.version = data['version'] md.license = data.get('license') md.keywords = data.get('keywords', []) md.summary = data.get('summary') dist = Distribution(md) dist.locator = self urls = d['urls'] result[md.version] = dist for info in d['urls']: url = info['url'] dist.download_urls.add(url) dist.digests[url] = self._get_digest(info) result['urls'].setdefault(md.version, set()).add(url) result['digests'][url] = self._get_digest(info) # Now get other releases for version, infos in d['releases'].items(): if version == md.version: continue # already done omd = Metadata(scheme=self.scheme) omd.name = md.name omd.version = version odist = Distribution(omd) odist.locator = self result[version] = odist for info in infos: url = info['url'] odist.download_urls.add(url) odist.digests[url] = self._get_digest(info) result['urls'].setdefault(version, set()).add(url) result['digests'][url] = self._get_digest(info) # for info in urls: # md.source_url = info['url'] # dist.digest = self._get_digest(info) # dist.locator = self # for info in urls: # url = info['url'] # result['urls'].setdefault(md.version, set()).add(url) # result['digests'][url] = self._get_digest(info) except Exception as e: self.errors.put(text_type(e)) logger.exception('JSON fetch failed: %s', e) return result class Page(object): """ This class represents a scraped HTML page. """ # The following slightly hairy-looking regex just looks for the contents of # an anchor link, which has an attribute "href" either immediately preceded # or immediately followed by a "rel" attribute. The attribute values can be # declared with double quotes, single quotes or no quotes - which leads to # the length of the expression. _href = re.compile(""" (rel\\s*=\\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\\s\n]*))\\s+)? href\\s*=\\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\\s\n]*)) (\\s+rel\\s*=\\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\\s\n]*)))? """, re.I | re.S | re.X) _base = re.compile(r"""]+)""", re.I | re.S) def __init__(self, data, url): """ Initialise an instance with the Unicode page contents and the URL they came from. """ self.data = data self.base_url = self.url = url m = self._base.search(self.data) if m: self.base_url = m.group(1) _clean_re = re.compile(r'[^a-z0-9$&+,/:;=?@.#%_\\|-]', re.I) @cached_property def links(self): """ Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. """ def clean(url): "Tidy up an URL." scheme, netloc, path, params, query, frag = urlparse(url) return urlunparse((scheme, netloc, quote(path), params, query, frag)) result = set() for match in self._href.finditer(self.data): d = match.groupdict('') rel = (d['rel1'] or d['rel2'] or d['rel3'] or d['rel4'] or d['rel5'] or d['rel6']) url = d['url1'] or d['url2'] or d['url3'] url = urljoin(self.base_url, url) url = unescape(url) url = self._clean_re.sub(lambda m: '%%%2x' % ord(m.group(0)), url) result.add((url, rel)) # We sort the result, hoping to bring the most recent versions # to the front result = sorted(result, key=lambda t: t[0], reverse=True) return result class SimpleScrapingLocator(Locator): """ A locator which scrapes HTML pages to locate downloads for a distribution. This runs multiple threads to do the I/O; performance is at least as good as pip's PackageFinder, which works in an analogous fashion. """ # These are used to deal with various Content-Encoding schemes. decoders = { 'deflate': zlib.decompress, 'gzip': lambda b: gzip.GzipFile(fileobj=BytesIO(d)).read(), 'none': lambda b: b, } def __init__(self, url, timeout=None, num_workers=10, **kwargs): """ Initialise an instance. :param url: The root URL to use for scraping. :param timeout: The timeout, in seconds, to be applied to requests. This defaults to ``None`` (no timeout specified). :param num_workers: The number of worker threads you want to do I/O, This defaults to 10. :param kwargs: Passed to the superclass. """ super(SimpleScrapingLocator, self).__init__(**kwargs) self.base_url = ensure_slash(url) self.timeout = timeout self._page_cache = {} self._seen = set() self._to_fetch = queue.Queue() self._bad_hosts = set() self.skip_externals = False self.num_workers = num_workers self._lock = threading.RLock() # See issue #45: we need to be resilient when the locator is used # in a thread, e.g. with concurrent.futures. We can't use self._lock # as it is for coordinating our internal threads - the ones created # in _prepare_threads. self._gplock = threading.RLock() self.platform_check = False # See issue #112 def _prepare_threads(self): """ Threads are created only when get_project is called, and terminate before it returns. They are there primarily to parallelise I/O (i.e. fetching web pages). """ self._threads = [] for i in range(self.num_workers): t = threading.Thread(target=self._fetch) t.setDaemon(True) t.start() self._threads.append(t) def _wait_threads(self): """ Tell all the threads to terminate (by sending a sentinel value) and wait for them to do so. """ # Note that you need two loops, since you can't say which # thread will get each sentinel for t in self._threads: self._to_fetch.put(None) # sentinel for t in self._threads: t.join() self._threads = [] def _get_project(self, name): result = {'urls': {}, 'digests': {}} with self._gplock: self.result = result self.project_name = name url = urljoin(self.base_url, '%s/' % quote(name)) self._seen.clear() self._page_cache.clear() self._prepare_threads() try: logger.debug('Queueing %s', url) self._to_fetch.put(url) self._to_fetch.join() finally: self._wait_threads() del self.result return result platform_dependent = re.compile(r'\b(linux_(i\d86|x86_64|arm\w+)|' r'win(32|_amd64)|macosx_?\d+)\b', re.I) def _is_platform_dependent(self, url): """ Does an URL refer to a platform-specific download? """ return self.platform_dependent.search(url) def _process_download(self, url): """ See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value. """ if self.platform_check and self._is_platform_dependent(url): info = None else: info = self.convert_url_to_download_info(url, self.project_name) logger.debug('process_download: %s -> %s', url, info) if info: with self._lock: # needed because self.result is shared self._update_version_data(self.result, info) return info def _should_queue(self, link, referrer, rel): """ Determine whether a link URL from a referring page and with a particular "rel" attribute should be queued for scraping. """ scheme, netloc, path, _, _, _ = urlparse(link) if path.endswith(self.source_extensions + self.binary_extensions + self.excluded_extensions): result = False elif self.skip_externals and not link.startswith(self.base_url): result = False elif not referrer.startswith(self.base_url): result = False elif rel not in ('homepage', 'download'): result = False elif scheme not in ('http', 'https', 'ftp'): result = False elif self._is_platform_dependent(link): result = False else: host = netloc.split(':', 1)[0] if host.lower() == 'localhost': result = False else: result = True logger.debug('should_queue: %s (%s) from %s -> %s', link, rel, referrer, result) return result def _fetch(self): """ Get a URL to fetch from the work queue, get the HTML page, examine its links for download candidates and candidates for further scraping. This is a handy method to run in a thread. """ while True: url = self._to_fetch.get() try: if url: page = self.get_page(url) if page is None: # e.g. after an error continue for link, rel in page.links: if link not in self._seen: try: self._seen.add(link) if (not self._process_download(link) and self._should_queue(link, url, rel)): logger.debug('Queueing %s from %s', link, url) self._to_fetch.put(link) except MetadataInvalidError: # e.g. invalid versions pass except Exception as e: # pragma: no cover self.errors.put(text_type(e)) finally: # always do this, to avoid hangs :-) self._to_fetch.task_done() if not url: #logger.debug('Sentinel seen, quitting.') break def get_page(self, url): """ Get the HTML for an URL, possibly from an in-memory cache. XXX TODO Note: this cache is never actually cleared. It's assumed that the data won't get stale over the lifetime of a locator instance (not necessarily true for the default_locator). """ # http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api scheme, netloc, path, _, _, _ = urlparse(url) if scheme == 'file' and os.path.isdir(url2pathname(path)): url = urljoin(ensure_slash(url), 'index.html') if url in self._page_cache: result = self._page_cache[url] logger.debug('Returning %s from cache: %s', url, result) else: host = netloc.split(':', 1)[0] result = None if host in self._bad_hosts: logger.debug('Skipping %s due to bad host %s', url, host) else: req = Request(url, headers={'Accept-encoding': 'identity'}) try: logger.debug('Fetching %s', url) resp = self.opener.open(req, timeout=self.timeout) logger.debug('Fetched %s', url) headers = resp.info() content_type = headers.get('Content-Type', '') if HTML_CONTENT_TYPE.match(content_type): final_url = resp.geturl() data = resp.read() encoding = headers.get('Content-Encoding') if encoding: decoder = self.decoders[encoding] # fail if not found data = decoder(data) encoding = 'utf-8' m = CHARSET.search(content_type) if m: encoding = m.group(1) try: data = data.decode(encoding) except UnicodeError: # pragma: no cover data = data.decode('latin-1') # fallback result = Page(data, final_url) self._page_cache[final_url] = result except HTTPError as e: if e.code != 404: logger.exception('Fetch failed: %s: %s', url, e) except URLError as e: # pragma: no cover logger.exception('Fetch failed: %s: %s', url, e) with self._lock: self._bad_hosts.add(host) except Exception as e: # pragma: no cover logger.exception('Fetch failed: %s: %s', url, e) finally: self._page_cache[url] = result # even if None (failure) return result _distname_re = re.compile(']*>([^<]+)<') def get_distribution_names(self): """ Return all the distribution names known to this locator. """ result = set() page = self.get_page(self.base_url) if not page: raise DistlibException('Unable to get %s' % self.base_url) for match in self._distname_re.finditer(page.data): result.add(match.group(1)) return result class DirectoryLocator(Locator): """ This class locates distributions in a directory tree. """ def __init__(self, path, **kwargs): """ Initialise an instance. :param path: The root of the directory tree to search. :param kwargs: Passed to the superclass constructor, except for: * recursive - if True (the default), subdirectories are recursed into. If False, only the top-level directory is searched, """ self.recursive = kwargs.pop('recursive', True) super(DirectoryLocator, self).__init__(**kwargs) path = os.path.abspath(path) if not os.path.isdir(path): # pragma: no cover raise DistlibException('Not a directory: %r' % path) self.base_dir = path def should_include(self, filename, parent): """ Should a filename be considered as a candidate for a distribution archive? As well as the filename, the directory which contains it is provided, though not used by the current implementation. """ return filename.endswith(self.downloadable_extensions) def _get_project(self, name): result = {'urls': {}, 'digests': {}} for root, dirs, files in os.walk(self.base_dir): for fn in files: if self.should_include(fn, root): fn = os.path.join(root, fn) url = urlunparse(('file', '', pathname2url(os.path.abspath(fn)), '', '', '')) info = self.convert_url_to_download_info(url, name) if info: self._update_version_data(result, info) if not self.recursive: break return result def get_distribution_names(self): """ Return all the distribution names known to this locator. """ result = set() for root, dirs, files in os.walk(self.base_dir): for fn in files: if self.should_include(fn, root): fn = os.path.join(root, fn) url = urlunparse(('file', '', pathname2url(os.path.abspath(fn)), '', '', '')) info = self.convert_url_to_download_info(url, None) if info: result.add(info['name']) if not self.recursive: break return result class JSONLocator(Locator): """ This locator uses special extended metadata (not available on PyPI) and is the basis of performant dependency resolution in distlib. Other locators require archive downloads before dependencies can be determined! As you might imagine, that can be slow. """ def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Not available from this locator') def _get_project(self, name): result = {'urls': {}, 'digests': {}} data = get_project_data(name) if data: for info in data.get('files', []): if info['ptype'] != 'sdist' or info['pyversion'] != 'source': continue # We don't store summary in project metadata as it makes # the data bigger for no benefit during dependency # resolution dist = make_dist(data['name'], info['version'], summary=data.get('summary', 'Placeholder for summary'), scheme=self.scheme) md = dist.metadata md.source_url = info['url'] # TODO SHA256 digest if 'digest' in info and info['digest']: dist.digest = ('md5', info['digest']) md.dependencies = info.get('requirements', {}) dist.exports = info.get('exports', {}) result[dist.version] = dist result['urls'].setdefault(dist.version, set()).add(info['url']) return result class DistPathLocator(Locator): """ This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. """ def __init__(self, distpath, **kwargs): """ Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. """ super(DistPathLocator, self).__init__(**kwargs) assert isinstance(distpath, DistributionPath) self.distpath = distpath def _get_project(self, name): dist = self.distpath.get_distribution(name) if dist is None: result = {'urls': {}, 'digests': {}} else: result = { dist.version: dist, 'urls': {dist.version: set([dist.source_url])}, 'digests': {dist.version: set([None])} } return result class AggregatingLocator(Locator): """ This class allows you to chain and/or merge a list of locators. """ def __init__(self, *locators, **kwargs): """ Initialise an instance. :param locators: The list of locators to search. :param kwargs: Passed to the superclass constructor, except for: * merge - if False (the default), the first successful search from any of the locators is returned. If True, the results from all locators are merged (this can be slow). """ self.merge = kwargs.pop('merge', False) self.locators = locators super(AggregatingLocator, self).__init__(**kwargs) def clear_cache(self): super(AggregatingLocator, self).clear_cache() for locator in self.locators: locator.clear_cache() def _set_scheme(self, value): self._scheme = value for locator in self.locators: locator.scheme = value scheme = property(Locator.scheme.fget, _set_scheme) def _get_project(self, name): result = {} for locator in self.locators: d = locator.get_project(name) if d: if self.merge: files = result.get('urls', {}) digests = result.get('digests', {}) # next line could overwrite result['urls'], result['digests'] result.update(d) df = result.get('urls') if files and df: for k, v in files.items(): if k in df: df[k] |= v else: df[k] = v dd = result.get('digests') if digests and dd: dd.update(digests) else: # See issue #18. If any dists are found and we're looking # for specific constraints, we only return something if # a match is found. For example, if a DirectoryLocator # returns just foo (1.0) while we're looking for # foo (>= 2.0), we'll pretend there was nothing there so # that subsequent locators can be queried. Otherwise we # would just return foo (1.0) which would then lead to a # failure to find foo (>= 2.0), because other locators # weren't searched. Note that this only matters when # merge=False. if self.matcher is None: found = True else: found = False for k in d: if self.matcher.match(k): found = True break if found: result = d break return result def get_distribution_names(self): """ Return all the distribution names known to this locator. """ result = set() for locator in self.locators: try: result |= locator.get_distribution_names() except NotImplementedError: pass return result # We use a legacy scheme simply because most of the dists on PyPI use legacy # versions which don't conform to PEP 426 / PEP 440. default_locator = AggregatingLocator( JSONLocator(), SimpleScrapingLocator('https://pypi.org/simple/', timeout=3.0), scheme='legacy') locate = default_locator.locate NAME_VERSION_RE = re.compile(r'(?P[\w-]+)\s*' r'\(\s*(==\s*)?(?P[^)]+)\)$') class DependencyFinder(object): """ Locate dependencies for distributions. """ def __init__(self, locator=None): """ Initialise an instance, using the specified locator to locate distributions. """ self.locator = locator or default_locator self.scheme = get_scheme(self.locator.scheme) def add_distribution(self, dist): """ Add a distribution to the finder. This will update internal information about who provides what. :param dist: The distribution to add. """ logger.debug('adding distribution %s', dist) name = dist.key self.dists_by_name[name] = dist self.dists[(name, dist.version)] = dist for p in dist.provides: name, version = parse_name_and_version(p) logger.debug('Add to provided: %s, %s, %s', name, version, dist) self.provided.setdefault(name, set()).add((version, dist)) def remove_distribution(self, dist): """ Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove. """ logger.debug('removing distribution %s', dist) name = dist.key del self.dists_by_name[name] del self.dists[(name, dist.version)] for p in dist.provides: name, version = parse_name_and_version(p) logger.debug('Remove from provided: %s, %s, %s', name, version, dist) s = self.provided[name] s.remove((version, dist)) if not s: del self.provided[name] def get_matcher(self, reqt): """ Get a version matcher for a requirement. :param reqt: The requirement :type reqt: str :return: A version matcher (an instance of :class:`distlib.version.Matcher`). """ try: matcher = self.scheme.matcher(reqt) except UnsupportedVersionError: # pragma: no cover # XXX compat-mode if cannot read the version name = reqt.split()[0] matcher = self.scheme.matcher(name) return matcher def find_providers(self, reqt): """ Find the distributions which can fulfill a requirement. :param reqt: The requirement. :type reqt: str :return: A set of distribution which can fulfill the requirement. """ matcher = self.get_matcher(reqt) name = matcher.key # case-insensitive result = set() provided = self.provided if name in provided: for version, provider in provided[name]: try: match = matcher.match(version) except UnsupportedVersionError: match = False if match: result.add(provider) break return result def try_to_replace(self, provider, other, problems): """ Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :param provider: The provider we are trying to replace with. :param other: The provider we're trying to replace. :param problems: If False is returned, this will contain what problems prevented replacement. This is currently a tuple of the literal string 'cantreplace', ``provider``, ``other`` and the set of requirements that ``provider`` couldn't fulfill. :return: True if we can replace ``other`` with ``provider``, else False. """ rlist = self.reqts[other] unmatched = set() for s in rlist: matcher = self.get_matcher(s) if not matcher.match(provider.version): unmatched.add(s) if unmatched: # can't replace other with provider problems.add(('cantreplace', provider, other, frozenset(unmatched))) result = False else: # can replace other with provider self.remove_distribution(other) del self.reqts[other] for s in rlist: self.reqts.setdefault(provider, set()).add(s) self.add_distribution(provider) result = True return result def find(self, requirement, meta_extras=None, prereleases=False): """ Find a distribution and all distributions it depends on. :param requirement: The requirement specifying the distribution to find, or a Distribution instance. :param meta_extras: A list of meta extras such as :test:, :build: and so on. :param prereleases: If ``True``, allow pre-release versions to be returned - otherwise, don't return prereleases unless they're all that's available. Return a set of :class:`Distribution` instances and a set of problems. The distributions returned should be such that they have the :attr:`required` attribute set to ``True`` if they were from the ``requirement`` passed to ``find()``, and they have the :attr:`build_time_dependency` attribute set to ``True`` unless they are post-installation dependencies of the ``requirement``. The problems should be a tuple consisting of the string ``'unsatisfied'`` and the requirement which couldn't be satisfied by any distribution known to the locator. """ self.provided = {} self.dists = {} self.dists_by_name = {} self.reqts = {} meta_extras = set(meta_extras or []) if ':*:' in meta_extras: meta_extras.remove(':*:') # :meta: and :run: are implicitly included meta_extras |= set([':test:', ':build:', ':dev:']) if isinstance(requirement, Distribution): dist = odist = requirement logger.debug('passed %s as requirement', odist) else: dist = odist = self.locator.locate(requirement, prereleases=prereleases) if dist is None: raise DistlibException('Unable to locate %r' % requirement) logger.debug('located %s', odist) dist.requested = True problems = set() todo = set([dist]) install_dists = set([odist]) while todo: dist = todo.pop() name = dist.key # case-insensitive if name not in self.dists_by_name: self.add_distribution(dist) else: #import pdb; pdb.set_trace() other = self.dists_by_name[name] if other != dist: self.try_to_replace(dist, other, problems) ireqts = dist.run_requires | dist.meta_requires sreqts = dist.build_requires ereqts = set() if meta_extras and dist in install_dists: for key in ('test', 'build', 'dev'): e = ':%s:' % key if e in meta_extras: ereqts |= getattr(dist, '%s_requires' % key) all_reqts = ireqts | sreqts | ereqts for r in all_reqts: providers = self.find_providers(r) if not providers: logger.debug('No providers found for %r', r) provider = self.locator.locate(r, prereleases=prereleases) # If no provider is found and we didn't consider # prereleases, consider them now. if provider is None and not prereleases: provider = self.locator.locate(r, prereleases=True) if provider is None: logger.debug('Cannot satisfy %r', r) problems.add(('unsatisfied', r)) else: n, v = provider.key, provider.version if (n, v) not in self.dists: todo.add(provider) providers.add(provider) if r in ireqts and dist in install_dists: install_dists.add(provider) logger.debug('Adding %s to install_dists', provider.name_and_version) for p in providers: name = p.key if name not in self.dists_by_name: self.reqts.setdefault(p, set()).add(r) else: other = self.dists_by_name[name] if other != p: # see if other can be replaced by p self.try_to_replace(p, other, problems) dists = set(self.dists.values()) for dist in dists: dist.build_time_dependency = dist not in install_dists if dist.build_time_dependency: logger.debug('%s is a build-time dependency only.', dist.name_and_version) logger.debug('find done for %s', odist) return dists, problems distlib/version.py000064400000055537152347724720010271 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """ Implementation of a flexible versioning scheme providing support for PEP-440, setuptools-compatible and semantic versioning. """ import logging import re from .compat import string_types from .util import parse_requirement __all__ = ['NormalizedVersion', 'NormalizedMatcher', 'LegacyVersion', 'LegacyMatcher', 'SemanticVersion', 'SemanticMatcher', 'UnsupportedVersionError', 'get_scheme'] logger = logging.getLogger(__name__) class UnsupportedVersionError(ValueError): """This is an unsupported version.""" pass class Version(object): def __init__(self, s): self._string = s = s.strip() self._parts = parts = self.parse(s) assert isinstance(parts, tuple) assert len(parts) > 0 def parse(self, s): raise NotImplementedError('please implement in a subclass') def _check_compatible(self, other): if type(self) != type(other): raise TypeError('cannot compare %r and %r' % (self, other)) def __eq__(self, other): self._check_compatible(other) return self._parts == other._parts def __ne__(self, other): return not self.__eq__(other) def __lt__(self, other): self._check_compatible(other) return self._parts < other._parts def __gt__(self, other): return not (self.__lt__(other) or self.__eq__(other)) def __le__(self, other): return self.__lt__(other) or self.__eq__(other) def __ge__(self, other): return self.__gt__(other) or self.__eq__(other) # See http://docs.python.org/reference/datamodel#object.__hash__ def __hash__(self): return hash(self._parts) def __repr__(self): return "%s('%s')" % (self.__class__.__name__, self._string) def __str__(self): return self._string @property def is_prerelease(self): raise NotImplementedError('Please implement in subclasses.') class Matcher(object): version_class = None # value is either a callable or the name of a method _operators = { '<': lambda v, c, p: v < c, '>': lambda v, c, p: v > c, '<=': lambda v, c, p: v == c or v < c, '>=': lambda v, c, p: v == c or v > c, '==': lambda v, c, p: v == c, '===': lambda v, c, p: v == c, # by default, compatible => >=. '~=': lambda v, c, p: v == c or v > c, '!=': lambda v, c, p: v != c, } # this is a method only to support alternative implementations # via overriding def parse_requirement(self, s): return parse_requirement(s) def __init__(self, s): if self.version_class is None: raise ValueError('Please specify a version class') self._string = s = s.strip() r = self.parse_requirement(s) if not r: raise ValueError('Not valid: %r' % s) self.name = r.name self.key = self.name.lower() # for case-insensitive comparisons clist = [] if r.constraints: # import pdb; pdb.set_trace() for op, s in r.constraints: if s.endswith('.*'): if op not in ('==', '!='): raise ValueError('\'.*\' not allowed for ' '%r constraints' % op) # Could be a partial version (e.g. for '2.*') which # won't parse as a version, so keep it as a string vn, prefix = s[:-2], True # Just to check that vn is a valid version self.version_class(vn) else: # Should parse as a version, so we can create an # instance for the comparison vn, prefix = self.version_class(s), False clist.append((op, vn, prefix)) self._parts = tuple(clist) def match(self, version): """ Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. """ if isinstance(version, string_types): version = self.version_class(version) for operator, constraint, prefix in self._parts: f = self._operators.get(operator) if isinstance(f, string_types): f = getattr(self, f) if not f: msg = ('%r not implemented ' 'for %s' % (operator, self.__class__.__name__)) raise NotImplementedError(msg) if not f(version, constraint, prefix): return False return True @property def exact_version(self): result = None if len(self._parts) == 1 and self._parts[0][0] in ('==', '==='): result = self._parts[0][1] return result def _check_compatible(self, other): if type(self) != type(other) or self.name != other.name: raise TypeError('cannot compare %s and %s' % (self, other)) def __eq__(self, other): self._check_compatible(other) return self.key == other.key and self._parts == other._parts def __ne__(self, other): return not self.__eq__(other) # See http://docs.python.org/reference/datamodel#object.__hash__ def __hash__(self): return hash(self.key) + hash(self._parts) def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self._string) def __str__(self): return self._string PEP440_VERSION_RE = re.compile(r'^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?' r'(\.(post)(\d+))?(\.(dev)(\d+))?' r'(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$') def _pep_440_key(s): s = s.strip() m = PEP440_VERSION_RE.match(s) if not m: raise UnsupportedVersionError('Not a valid version: %s' % s) groups = m.groups() nums = tuple(int(v) for v in groups[1].split('.')) while len(nums) > 1 and nums[-1] == 0: nums = nums[:-1] if not groups[0]: epoch = 0 else: epoch = int(groups[0]) pre = groups[4:6] post = groups[7:9] dev = groups[10:12] local = groups[13] if pre == (None, None): pre = () else: pre = pre[0], int(pre[1]) if post == (None, None): post = () else: post = post[0], int(post[1]) if dev == (None, None): dev = () else: dev = dev[0], int(dev[1]) if local is None: local = () else: parts = [] for part in local.split('.'): # to ensure that numeric compares as > lexicographic, avoid # comparing them directly, but encode a tuple which ensures # correct sorting if part.isdigit(): part = (1, int(part)) else: part = (0, part) parts.append(part) local = tuple(parts) if not pre: # either before pre-release, or final release and after if not post and dev: # before pre-release pre = ('a', -1) # to sort before a0 else: pre = ('z',) # to sort after all pre-releases # now look at the state of post and dev. if not post: post = ('_',) # sort before 'a' if not dev: dev = ('final',) #print('%s -> %s' % (s, m.groups())) return epoch, nums, pre, post, dev, local _normalized_key = _pep_440_key class NormalizedVersion(Version): """A rational version. Good: 1.2 # equivalent to "1.2.0" 1.2.0 1.2a1 1.2.3a2 1.2.3b1 1.2.3c1 1.2.3.4 TODO: fill this out Bad: 1 # minimum two numbers 1.2a # release level must have a release serial 1.2.3b """ def parse(self, s): result = _normalized_key(s) # _normalized_key loses trailing zeroes in the release # clause, since that's needed to ensure that X.Y == X.Y.0 == X.Y.0.0 # However, PEP 440 prefix matching needs it: for example, # (~= 1.4.5.0) matches differently to (~= 1.4.5.0.0). m = PEP440_VERSION_RE.match(s) # must succeed groups = m.groups() self._release_clause = tuple(int(v) for v in groups[1].split('.')) return result PREREL_TAGS = set(['a', 'b', 'c', 'rc', 'dev']) @property def is_prerelease(self): return any(t[0] in self.PREREL_TAGS for t in self._parts if t) def _match_prefix(x, y): x = str(x) y = str(y) if x == y: return True if not x.startswith(y): return False n = len(y) return x[n] == '.' class NormalizedMatcher(Matcher): version_class = NormalizedVersion # value is either a callable or the name of a method _operators = { '~=': '_match_compatible', '<': '_match_lt', '>': '_match_gt', '<=': '_match_le', '>=': '_match_ge', '==': '_match_eq', '===': '_match_arbitrary', '!=': '_match_ne', } def _adjust_local(self, version, constraint, prefix): if prefix: strip_local = '+' not in constraint and version._parts[-1] else: # both constraint and version are # NormalizedVersion instances. # If constraint does not have a local component, # ensure the version doesn't, either. strip_local = not constraint._parts[-1] and version._parts[-1] if strip_local: s = version._string.split('+', 1)[0] version = self.version_class(s) return version, constraint def _match_lt(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if version >= constraint: return False release_clause = constraint._release_clause pfx = '.'.join([str(i) for i in release_clause]) return not _match_prefix(version, pfx) def _match_gt(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if version <= constraint: return False release_clause = constraint._release_clause pfx = '.'.join([str(i) for i in release_clause]) return not _match_prefix(version, pfx) def _match_le(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) return version <= constraint def _match_ge(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) return version >= constraint def _match_eq(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if not prefix: result = (version == constraint) else: result = _match_prefix(version, constraint) return result def _match_arbitrary(self, version, constraint, prefix): return str(version) == str(constraint) def _match_ne(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if not prefix: result = (version != constraint) else: result = not _match_prefix(version, constraint) return result def _match_compatible(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if version == constraint: return True if version < constraint: return False # if not prefix: # return True release_clause = constraint._release_clause if len(release_clause) > 1: release_clause = release_clause[:-1] pfx = '.'.join([str(i) for i in release_clause]) return _match_prefix(version, pfx) _REPLACEMENTS = ( (re.compile('[.+-]$'), ''), # remove trailing puncts (re.compile(r'^[.](\d)'), r'0.\1'), # .N -> 0.N at start (re.compile('^[.-]'), ''), # remove leading puncts (re.compile(r'^\((.*)\)$'), r'\1'), # remove parentheses (re.compile(r'^v(ersion)?\s*(\d+)'), r'\2'), # remove leading v(ersion) (re.compile(r'^r(ev)?\s*(\d+)'), r'\2'), # remove leading v(ersion) (re.compile('[.]{2,}'), '.'), # multiple runs of '.' (re.compile(r'\b(alfa|apha)\b'), 'alpha'), # misspelt alpha (re.compile(r'\b(pre-alpha|prealpha)\b'), 'pre.alpha'), # standardise (re.compile(r'\(beta\)$'), 'beta'), # remove parentheses ) _SUFFIX_REPLACEMENTS = ( (re.compile('^[:~._+-]+'), ''), # remove leading puncts (re.compile('[,*")([\\]]'), ''), # remove unwanted chars (re.compile('[~:+_ -]'), '.'), # replace illegal chars (re.compile('[.]{2,}'), '.'), # multiple runs of '.' (re.compile(r'\.$'), ''), # trailing '.' ) _NUMERIC_PREFIX = re.compile(r'(\d+(\.\d+)*)') def _suggest_semantic_version(s): """ Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. """ result = s.strip().lower() for pat, repl in _REPLACEMENTS: result = pat.sub(repl, result) if not result: result = '0.0.0' # Now look for numeric prefix, and separate it out from # the rest. #import pdb; pdb.set_trace() m = _NUMERIC_PREFIX.match(result) if not m: prefix = '0.0.0' suffix = result else: prefix = m.groups()[0].split('.') prefix = [int(i) for i in prefix] while len(prefix) < 3: prefix.append(0) if len(prefix) == 3: suffix = result[m.end():] else: suffix = '.'.join([str(i) for i in prefix[3:]]) + result[m.end():] prefix = prefix[:3] prefix = '.'.join([str(i) for i in prefix]) suffix = suffix.strip() if suffix: #import pdb; pdb.set_trace() # massage the suffix. for pat, repl in _SUFFIX_REPLACEMENTS: suffix = pat.sub(repl, suffix) if not suffix: result = prefix else: sep = '-' if 'dev' in suffix else '+' result = prefix + sep + suffix if not is_semver(result): result = None return result def _suggest_normalized_version(s): """Suggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given string, based on observation of versions currently in use on PyPI. Given a dump of those version during PyCon 2009, 4287 of them: - 2312 (53.93%) match NormalizedVersion without change with the automatic suggestion - 3474 (81.04%) match when using this suggestion method @param s {str} An irrational version string. @returns A rational version string, or None, if couldn't determine one. """ try: _normalized_key(s) return s # already rational except UnsupportedVersionError: pass rs = s.lower() # part of this could use maketrans for orig, repl in (('-alpha', 'a'), ('-beta', 'b'), ('alpha', 'a'), ('beta', 'b'), ('rc', 'c'), ('-final', ''), ('-pre', 'c'), ('-release', ''), ('.release', ''), ('-stable', ''), ('+', '.'), ('_', '.'), (' ', ''), ('.final', ''), ('final', '')): rs = rs.replace(orig, repl) # if something ends with dev or pre, we add a 0 rs = re.sub(r"pre$", r"pre0", rs) rs = re.sub(r"dev$", r"dev0", rs) # if we have something like "b-2" or "a.2" at the end of the # version, that is probably beta, alpha, etc # let's remove the dash or dot rs = re.sub(r"([abc]|rc)[\-\.](\d+)$", r"\1\2", rs) # 1.0-dev-r371 -> 1.0.dev371 # 0.1-dev-r79 -> 0.1.dev79 rs = re.sub(r"[\-\.](dev)[\-\.]?r?(\d+)$", r".\1\2", rs) # Clean: 2.0.a.3, 2.0.b1, 0.9.0~c1 rs = re.sub(r"[.~]?([abc])\.?", r"\1", rs) # Clean: v0.3, v1.0 if rs.startswith('v'): rs = rs[1:] # Clean leading '0's on numbers. #TODO: unintended side-effect on, e.g., "2003.05.09" # PyPI stats: 77 (~2%) better rs = re.sub(r"\b0+(\d+)(?!\d)", r"\1", rs) # Clean a/b/c with no version. E.g. "1.0a" -> "1.0a0". Setuptools infers # zero. # PyPI stats: 245 (7.56%) better rs = re.sub(r"(\d+[abc])$", r"\g<1>0", rs) # the 'dev-rNNN' tag is a dev tag rs = re.sub(r"\.?(dev-r|dev\.r)\.?(\d+)$", r".dev\2", rs) # clean the - when used as a pre delimiter rs = re.sub(r"-(a|b|c)(\d+)$", r"\1\2", rs) # a terminal "dev" or "devel" can be changed into ".dev0" rs = re.sub(r"[\.\-](dev|devel)$", r".dev0", rs) # a terminal "dev" can be changed into ".dev0" rs = re.sub(r"(?![\.\-])dev$", r".dev0", rs) # a terminal "final" or "stable" can be removed rs = re.sub(r"(final|stable)$", "", rs) # The 'r' and the '-' tags are post release tags # 0.4a1.r10 -> 0.4a1.post10 # 0.9.33-17222 -> 0.9.33.post17222 # 0.9.33-r17222 -> 0.9.33.post17222 rs = re.sub(r"\.?(r|-|-r)\.?(\d+)$", r".post\2", rs) # Clean 'r' instead of 'dev' usage: # 0.9.33+r17222 -> 0.9.33.dev17222 # 1.0dev123 -> 1.0.dev123 # 1.0.git123 -> 1.0.dev123 # 1.0.bzr123 -> 1.0.dev123 # 0.1a0dev.123 -> 0.1a0.dev123 # PyPI stats: ~150 (~4%) better rs = re.sub(r"\.?(dev|git|bzr)\.?(\d+)$", r".dev\2", rs) # Clean '.pre' (normalized from '-pre' above) instead of 'c' usage: # 0.2.pre1 -> 0.2c1 # 0.2-c1 -> 0.2c1 # 1.0preview123 -> 1.0c123 # PyPI stats: ~21 (0.62%) better rs = re.sub(r"\.?(pre|preview|-c)(\d+)$", r"c\g<2>", rs) # Tcl/Tk uses "px" for their post release markers rs = re.sub(r"p(\d+)$", r".post\1", rs) try: _normalized_key(rs) except UnsupportedVersionError: rs = None return rs # # Legacy version processing (distribute-compatible) # _VERSION_PART = re.compile(r'([a-z]+|\d+|[\.-])', re.I) _VERSION_REPLACE = { 'pre': 'c', 'preview': 'c', '-': 'final-', 'rc': 'c', 'dev': '@', '': None, '.': None, } def _legacy_key(s): def get_parts(s): result = [] for p in _VERSION_PART.split(s.lower()): p = _VERSION_REPLACE.get(p, p) if p: if '0' <= p[:1] <= '9': p = p.zfill(8) else: p = '*' + p result.append(p) result.append('*final') return result result = [] for p in get_parts(s): if p.startswith('*'): if p < '*final': while result and result[-1] == '*final-': result.pop() while result and result[-1] == '00000000': result.pop() result.append(p) return tuple(result) class LegacyVersion(Version): def parse(self, s): return _legacy_key(s) @property def is_prerelease(self): result = False for x in self._parts: if (isinstance(x, string_types) and x.startswith('*') and x < '*final'): result = True break return result class LegacyMatcher(Matcher): version_class = LegacyVersion _operators = dict(Matcher._operators) _operators['~='] = '_match_compatible' numeric_re = re.compile(r'^(\d+(\.\d+)*)') def _match_compatible(self, version, constraint, prefix): if version < constraint: return False m = self.numeric_re.match(str(constraint)) if not m: logger.warning('Cannot compute compatible match for version %s ' ' and constraint %s', version, constraint) return True s = m.groups()[0] if '.' in s: s = s.rsplit('.', 1)[0] return _match_prefix(version, s) # # Semantic versioning # _SEMVER_RE = re.compile(r'^(\d+)\.(\d+)\.(\d+)' r'(-[a-z0-9]+(\.[a-z0-9-]+)*)?' r'(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$', re.I) def is_semver(s): return _SEMVER_RE.match(s) def _semantic_key(s): def make_tuple(s, absent): if s is None: result = (absent,) else: parts = s[1:].split('.') # We can't compare ints and strings on Python 3, so fudge it # by zero-filling numeric values so simulate a numeric comparison result = tuple([p.zfill(8) if p.isdigit() else p for p in parts]) return result m = is_semver(s) if not m: raise UnsupportedVersionError(s) groups = m.groups() major, minor, patch = [int(i) for i in groups[:3]] # choose the '|' and '*' so that versions sort correctly pre, build = make_tuple(groups[3], '|'), make_tuple(groups[5], '*') return (major, minor, patch), pre, build class SemanticVersion(Version): def parse(self, s): return _semantic_key(s) @property def is_prerelease(self): return self._parts[1][0] != '|' class SemanticMatcher(Matcher): version_class = SemanticVersion class VersionScheme(object): def __init__(self, key, matcher, suggester=None): self.key = key self.matcher = matcher self.suggester = suggester def is_valid_version(self, s): try: self.matcher.version_class(s) result = True except UnsupportedVersionError: result = False return result def is_valid_matcher(self, s): try: self.matcher(s) result = True except UnsupportedVersionError: result = False return result def is_valid_constraint_list(self, s): """ Used for processing some metadata fields """ return self.is_valid_matcher('dummy_name (%s)' % s) def suggest(self, s): if self.suggester is None: result = None else: result = self.suggester(s) return result _SCHEMES = { 'normalized': VersionScheme(_normalized_key, NormalizedMatcher, _suggest_normalized_version), 'legacy': VersionScheme(_legacy_key, LegacyMatcher, lambda self, s: s), 'semantic': VersionScheme(_semantic_key, SemanticMatcher, _suggest_semantic_version), } _SCHEMES['default'] = _SCHEMES['normalized'] def get_scheme(name): if name not in _SCHEMES: raise ValueError('unknown scheme name: %r' % name) return _SCHEMES[name] distlib/compat.py000064400000120700152347724720010050 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import absolute_import import os import re import sys try: import ssl except ImportError: # pragma: no cover ssl = None if sys.version_info[0] < 3: # pragma: no cover from StringIO import StringIO string_types = basestring, text_type = unicode from types import FileType as file_type import __builtin__ as builtins import ConfigParser as configparser from ._backport import shutil from urlparse import urlparse, urlunparse, urljoin, urlsplit, urlunsplit from urllib import (urlretrieve, quote as _quote, unquote, url2pathname, pathname2url, ContentTooShortError, splittype) def quote(s): if isinstance(s, unicode): s = s.encode('utf-8') return _quote(s) import urllib2 from urllib2 import (Request, urlopen, URLError, HTTPError, HTTPBasicAuthHandler, HTTPPasswordMgr, HTTPHandler, HTTPRedirectHandler, build_opener) if ssl: from urllib2 import HTTPSHandler import httplib import xmlrpclib import Queue as queue from HTMLParser import HTMLParser import htmlentitydefs raw_input = raw_input from itertools import ifilter as filter from itertools import ifilterfalse as filterfalse _userprog = None def splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" global _userprog if _userprog is None: import re _userprog = re.compile('^(.*)@(.*)$') match = _userprog.match(host) if match: return match.group(1, 2) return None, host else: # pragma: no cover from io import StringIO string_types = str, text_type = str from io import TextIOWrapper as file_type import builtins import configparser import shutil from urllib.parse import (urlparse, urlunparse, urljoin, splituser, quote, unquote, urlsplit, urlunsplit, splittype) from urllib.request import (urlopen, urlretrieve, Request, url2pathname, pathname2url, HTTPBasicAuthHandler, HTTPPasswordMgr, HTTPHandler, HTTPRedirectHandler, build_opener) if ssl: from urllib.request import HTTPSHandler from urllib.error import HTTPError, URLError, ContentTooShortError import http.client as httplib import urllib.request as urllib2 import xmlrpc.client as xmlrpclib import queue from html.parser import HTMLParser import html.entities as htmlentitydefs raw_input = input from itertools import filterfalse filter = filter try: from ssl import match_hostname, CertificateError except ImportError: # pragma: no cover class CertificateError(ValueError): pass def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 """ pats = [] if not dn: return False parts = dn.split('.') leftmost, remainder = parts[0], parts[1:] wildcards = leftmost.count('*') if wildcards > max_wildcards: # Issue #17980: avoid denials of service by refusing more # than one wildcard per fragment. A survey of established # policy among SSL implementations showed it to be a # reasonable choice. raise CertificateError( "too many wildcards in certificate DNS name: " + repr(dn)) # speed up common case w/o wildcards if not wildcards: return dn.lower() == hostname.lower() # RFC 6125, section 6.4.3, subitem 1. # The client SHOULD NOT attempt to match a presented identifier in which # the wildcard character comprises a label other than the left-most label. if leftmost == '*': # When '*' is a fragment by itself, it matches a non-empty dotless # fragment. pats.append('[^.]+') elif leftmost.startswith('xn--') or hostname.startswith('xn--'): # RFC 6125, section 6.4.3, subitem 3. # The client SHOULD NOT attempt to match a presented identifier # where the wildcard character is embedded within an A-label or # U-label of an internationalized domain name. pats.append(re.escape(leftmost)) else: # Otherwise, '*' matches any dotless string, e.g. www* pats.append(re.escape(leftmost).replace(r'\*', '[^.]*')) # add the remaining fragments, ignore any wildcards for frag in remainder: pats.append(re.escape(frag)) pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE) return pat.match(hostname) def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. """ if not cert: raise ValueError("empty or no certificate, match_hostname needs a " "SSL socket or SSL context with either " "CERT_OPTIONAL or CERT_REQUIRED") dnsnames = [] san = cert.get('subjectAltName', ()) for key, value in san: if key == 'DNS': if _dnsname_match(value, hostname): return dnsnames.append(value) if not dnsnames: # The subject is only checked when there is no dNSName entry # in subjectAltName for sub in cert.get('subject', ()): for key, value in sub: # XXX according to RFC 2818, the most specific Common Name # must be used. if key == 'commonName': if _dnsname_match(value, hostname): return dnsnames.append(value) if len(dnsnames) > 1: raise CertificateError("hostname %r " "doesn't match either of %s" % (hostname, ', '.join(map(repr, dnsnames)))) elif len(dnsnames) == 1: raise CertificateError("hostname %r " "doesn't match %r" % (hostname, dnsnames[0])) else: raise CertificateError("no appropriate commonName or " "subjectAltName fields were found") try: from types import SimpleNamespace as Container except ImportError: # pragma: no cover class Container(object): """ A generic container for when multiple values need to be returned """ def __init__(self, **kwargs): self.__dict__.update(kwargs) try: from shutil import which except ImportError: # pragma: no cover # Implementation from Python 3.3 def which(cmd, mode=os.F_OK | os.X_OK, path=None): """Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. """ # Check that a given file can be accessed with the correct mode. # Additionally check that `file` is not a directory, as on Windows # directories pass the os.access check. def _access_check(fn, mode): return (os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn)) # If we're given a path with a directory part, look it up directly rather # than referring to PATH directories. This includes checking relative to the # current directory, e.g. ./script if os.path.dirname(cmd): if _access_check(cmd, mode): return cmd return None if path is None: path = os.environ.get("PATH", os.defpath) if not path: return None path = path.split(os.pathsep) if sys.platform == "win32": # The current directory takes precedence on Windows. if not os.curdir in path: path.insert(0, os.curdir) # PATHEXT is necessary to check on Windows. pathext = os.environ.get("PATHEXT", "").split(os.pathsep) # See if the given file matches any of the expected path extensions. # This will allow us to short circuit when given "python.exe". # If it does match, only test that one, otherwise we have to try # others. if any(cmd.lower().endswith(ext.lower()) for ext in pathext): files = [cmd] else: files = [cmd + ext for ext in pathext] else: # On other platforms you don't have things like PATHEXT to tell you # what file suffixes are executable, so just pass on cmd as-is. files = [cmd] seen = set() for dir in path: normdir = os.path.normcase(dir) if not normdir in seen: seen.add(normdir) for thefile in files: name = os.path.join(dir, thefile) if _access_check(name, mode): return name return None # ZipFile is a context manager in 2.7, but not in 2.6 from zipfile import ZipFile as BaseZipFile if hasattr(BaseZipFile, '__enter__'): # pragma: no cover ZipFile = BaseZipFile else: # pragma: no cover from zipfile import ZipExtFile as BaseZipExtFile class ZipExtFile(BaseZipExtFile): def __init__(self, base): self.__dict__.update(base.__dict__) def __enter__(self): return self def __exit__(self, *exc_info): self.close() # return None, so if an exception occurred, it will propagate class ZipFile(BaseZipFile): def __enter__(self): return self def __exit__(self, *exc_info): self.close() # return None, so if an exception occurred, it will propagate def open(self, *args, **kwargs): base = BaseZipFile.open(self, *args, **kwargs) return ZipExtFile(base) try: from platform import python_implementation except ImportError: # pragma: no cover def python_implementation(): """Return a string identifying the Python implementation.""" if 'PyPy' in sys.version: return 'PyPy' if os.name == 'java': return 'Jython' if sys.version.startswith('IronPython'): return 'IronPython' return 'CPython' try: import sysconfig except ImportError: # pragma: no cover from ._backport import sysconfig try: callable = callable except NameError: # pragma: no cover from collections.abc import Callable def callable(obj): return isinstance(obj, Callable) try: fsencode = os.fsencode fsdecode = os.fsdecode except AttributeError: # pragma: no cover # Issue #99: on some systems (e.g. containerised), # sys.getfilesystemencoding() returns None, and we need a real value, # so fall back to utf-8. From the CPython 2.7 docs relating to Unix and # sys.getfilesystemencoding(): the return value is "the user’s preference # according to the result of nl_langinfo(CODESET), or None if the # nl_langinfo(CODESET) failed." _fsencoding = sys.getfilesystemencoding() or 'utf-8' if _fsencoding == 'mbcs': _fserrors = 'strict' else: _fserrors = 'surrogateescape' def fsencode(filename): if isinstance(filename, bytes): return filename elif isinstance(filename, text_type): return filename.encode(_fsencoding, _fserrors) else: raise TypeError("expect bytes or str, not %s" % type(filename).__name__) def fsdecode(filename): if isinstance(filename, text_type): return filename elif isinstance(filename, bytes): return filename.decode(_fsencoding, _fserrors) else: raise TypeError("expect bytes or str, not %s" % type(filename).__name__) try: from tokenize import detect_encoding except ImportError: # pragma: no cover from codecs import BOM_UTF8, lookup import re cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)") def _get_normal_name(orig_enc): """Imitates get_normal_name in tokenizer.c.""" # Only care about the first 12 characters. enc = orig_enc[:12].lower().replace("_", "-") if enc == "utf-8" or enc.startswith("utf-8-"): return "utf-8" if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \ enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")): return "iso-8859-1" return orig_enc def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. """ try: filename = readline.__self__.name except AttributeError: filename = None bom_found = False encoding = None default = 'utf-8' def read_or_stop(): try: return readline() except StopIteration: return b'' def find_cookie(line): try: # Decode as UTF-8. Either the line is an encoding declaration, # in which case it should be pure ASCII, or it must be UTF-8 # per default encoding. line_string = line.decode('utf-8') except UnicodeDecodeError: msg = "invalid or missing encoding declaration" if filename is not None: msg = '{} for {!r}'.format(msg, filename) raise SyntaxError(msg) matches = cookie_re.findall(line_string) if not matches: return None encoding = _get_normal_name(matches[0]) try: codec = lookup(encoding) except LookupError: # This behaviour mimics the Python interpreter if filename is None: msg = "unknown encoding: " + encoding else: msg = "unknown encoding for {!r}: {}".format(filename, encoding) raise SyntaxError(msg) if bom_found: if codec.name != 'utf-8': # This behaviour mimics the Python interpreter if filename is None: msg = 'encoding problem: utf-8' else: msg = 'encoding problem for {!r}: utf-8'.format(filename) raise SyntaxError(msg) encoding += '-sig' return encoding first = read_or_stop() if first.startswith(BOM_UTF8): bom_found = True first = first[3:] default = 'utf-8-sig' if not first: return default, [] encoding = find_cookie(first) if encoding: return encoding, [first] second = read_or_stop() if not second: return default, [first] encoding = find_cookie(second) if encoding: return encoding, [first, second] return default, [first, second] # For converting & <-> & etc. try: from html import escape except ImportError: from cgi import escape if sys.version_info[:2] < (3, 4): unescape = HTMLParser().unescape else: from html import unescape try: from collections import ChainMap except ImportError: # pragma: no cover from collections import MutableMapping try: from reprlib import recursive_repr as _recursive_repr except ImportError: def _recursive_repr(fillvalue='...'): ''' Decorator to make a repr function return fillvalue for a recursive call ''' def decorating_function(user_function): repr_running = set() def wrapper(self): key = id(self), get_ident() if key in repr_running: return fillvalue repr_running.add(key) try: result = user_function(self) finally: repr_running.discard(key) return result # Can't use functools.wraps() here because of bootstrap issues wrapper.__module__ = getattr(user_function, '__module__') wrapper.__doc__ = getattr(user_function, '__doc__') wrapper.__name__ = getattr(user_function, '__name__') wrapper.__annotations__ = getattr(user_function, '__annotations__', {}) return wrapper return decorating_function class ChainMap(MutableMapping): ''' A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. ''' def __init__(self, *maps): '''Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. ''' self.maps = list(maps) or [{}] # always at least one map def __missing__(self, key): raise KeyError(key) def __getitem__(self, key): for mapping in self.maps: try: return mapping[key] # can't use 'key in mapping' with defaultdict except KeyError: pass return self.__missing__(key) # support subclasses that define __missing__ def get(self, key, default=None): return self[key] if key in self else default def __len__(self): return len(set().union(*self.maps)) # reuses stored hash values if possible def __iter__(self): return iter(set().union(*self.maps)) def __contains__(self, key): return any(key in m for m in self.maps) def __bool__(self): return any(self.maps) @_recursive_repr() def __repr__(self): return '{0.__class__.__name__}({1})'.format( self, ', '.join(map(repr, self.maps))) @classmethod def fromkeys(cls, iterable, *args): 'Create a ChainMap with a single dict created from the iterable.' return cls(dict.fromkeys(iterable, *args)) def copy(self): 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' return self.__class__(self.maps[0].copy(), *self.maps[1:]) __copy__ = copy def new_child(self): # like Django's Context.push() 'New ChainMap with a new dict followed by all previous maps.' return self.__class__({}, *self.maps) @property def parents(self): # like Django's Context.pop() 'New ChainMap from maps[1:].' return self.__class__(*self.maps[1:]) def __setitem__(self, key, value): self.maps[0][key] = value def __delitem__(self, key): try: del self.maps[0][key] except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def popitem(self): 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' try: return self.maps[0].popitem() except KeyError: raise KeyError('No keys found in the first mapping.') def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def clear(self): 'Clear maps[0], leaving maps[1:] intact.' self.maps[0].clear() try: from importlib.util import cache_from_source # Python >= 3.4 except ImportError: # pragma: no cover try: from imp import cache_from_source except ImportError: # pragma: no cover def cache_from_source(path, debug_override=None): assert path.endswith('.py') if debug_override is None: debug_override = __debug__ if debug_override: suffix = 'c' else: suffix = 'o' return path + suffix try: from collections import OrderedDict except ImportError: # pragma: no cover ## {{{ http://code.activestate.com/recipes/576693/ (r9) # Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy. # Passes Python2.7's test suite and incorporates all the latest updates. try: from thread import get_ident as _get_ident except ImportError: from dummy_thread import get_ident as _get_ident try: from _abcoll import KeysView, ValuesView, ItemsView except ImportError: pass class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. # Big-O running times for all methods are the same as for regular dictionaries. # The internal self.__map dictionary maps keys to links in a doubly linked list. # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # Each link is stored as a list of length three: [PREV, NEXT, KEY]. def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__root except AttributeError: self.__root = root = [] # sentinel node root[:] = [root, root, None] self.__map = {} self.__update(*args, **kwds) def __setitem__(self, key, value, dict_setitem=dict.__setitem__): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link which goes at the end of the linked # list, and the inherited dictionary is updated with the new key/value pair. if key not in self: root = self.__root last = root[0] last[1] = root[0] = self.__map[key] = [last, root, key] dict_setitem(self, key, value) def __delitem__(self, key, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which is # then removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link_prev, link_next, key = self.__map.pop(key) link_prev[1] = link_next link_next[0] = link_prev def __iter__(self): 'od.__iter__() <==> iter(od)' root = self.__root curr = root[1] while curr is not root: yield curr[2] curr = curr[1] def __reversed__(self): 'od.__reversed__() <==> reversed(od)' root = self.__root curr = root[0] while curr is not root: yield curr[2] curr = curr[0] def clear(self): 'od.clear() -> None. Remove all items from od.' try: for node in self.__map.itervalues(): del node[:] root = self.__root root[:] = [root, root, None] self.__map.clear() except AttributeError: pass dict.clear(self) def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: link = root[0] link_prev = link[0] link_prev[1] = root root[0] = link_prev else: link = root[1] link_next = link[1] root[1] = link_next link_next[0] = root key = link[2] del self.__map[key] value = dict.pop(self, key) return key, value # -- the following methods do not depend on the internal structure -- def keys(self): 'od.keys() -> list of keys in od' return list(self) def values(self): 'od.values() -> list of values in od' return [self[key] for key in self] def items(self): 'od.items() -> list of (key, value) pairs in od' return [(key, self[key]) for key in self] def iterkeys(self): 'od.iterkeys() -> an iterator over the keys in od' return iter(self) def itervalues(self): 'od.itervalues -> an iterator over the values in od' for k in self: yield self[k] def iteritems(self): 'od.iteritems -> an iterator over the (key, value) items in od' for k in self: yield (k, self[k]) def update(*args, **kwds): '''od.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v ''' if len(args) > 2: raise TypeError('update() takes at most 2 positional ' 'arguments (%d given)' % (len(args),)) elif not args: raise TypeError('update() takes at least 1 argument (0 given)') self = args[0] # Make progressively weaker assumptions about "other" other = () if len(args) == 2: other = args[1] if isinstance(other, dict): for key in other: self[key] = other[key] elif hasattr(other, 'keys'): for key in other.keys(): self[key] = other[key] else: for key, value in other: self[key] = value for key, value in kwds.items(): self[key] = value __update = update # let subclasses override update without breaking __init__ __marker = object() def pop(self, key, default=__marker): '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' if key in self: result = self[key] del self[key] return result if default is self.__marker: raise KeyError(key) return default def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default def __repr__(self, _repr_running=None): 'od.__repr__() <==> repr(od)' if not _repr_running: _repr_running = {} call_key = id(self), _get_ident() if call_key in _repr_running: return '...' _repr_running[call_key] = 1 try: if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, self.items()) finally: del _repr_running[call_key] def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items,), inst_dict) return self.__class__, (items,) def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). ''' d = cls() for key in iterable: d[key] = value return d def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return len(self)==len(other) and self.items() == other.items() return dict.__eq__(self, other) def __ne__(self, other): return not self == other # -- the following methods are only used in Python 2.7 -- def viewkeys(self): "od.viewkeys() -> a set-like object providing a view on od's keys" return KeysView(self) def viewvalues(self): "od.viewvalues() -> an object providing a view on od's values" return ValuesView(self) def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" return ItemsView(self) try: from logging.config import BaseConfigurator, valid_ident except ImportError: # pragma: no cover IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I) def valid_ident(s): m = IDENTIFIER.match(s) if not m: raise ValueError('Not a valid Python identifier: %r' % s) return True # The ConvertingXXX classes are wrappers around standard Python containers, # and they serve to convert any suitable values in the container. The # conversion converts base dicts, lists and tuples to their wrapped # equivalents, whereas strings which match a conversion format are converted # appropriately. # # Each wrapper should have a configurator attribute holding the actual # configurator to use for conversion. class ConvertingDict(dict): """A converting dictionary wrapper.""" def __getitem__(self, key): value = dict.__getitem__(self, key) result = self.configurator.convert(value) #If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def get(self, key, default=None): value = dict.get(self, key, default) result = self.configurator.convert(value) #If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def pop(self, key, default=None): value = dict.pop(self, key, default) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result class ConvertingList(list): """A converting list wrapper.""" def __getitem__(self, key): value = list.__getitem__(self, key) result = self.configurator.convert(value) #If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def pop(self, idx=-1): value = list.pop(self, idx) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self return result class ConvertingTuple(tuple): """A converting tuple wrapper.""" def __getitem__(self, key): value = tuple.__getitem__(self, key) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result class BaseConfigurator(object): """ The configurator base class which defines some useful defaults. """ CONVERT_PATTERN = re.compile(r'^(?P[a-z]+)://(?P.*)$') WORD_PATTERN = re.compile(r'^\s*(\w+)\s*') DOT_PATTERN = re.compile(r'^\.\s*(\w+)\s*') INDEX_PATTERN = re.compile(r'^\[\s*(\w+)\s*\]\s*') DIGIT_PATTERN = re.compile(r'^\d+$') value_converters = { 'ext' : 'ext_convert', 'cfg' : 'cfg_convert', } # We might want to use a different one, e.g. importlib importer = staticmethod(__import__) def __init__(self, config): self.config = ConvertingDict(config) self.config.configurator = self def resolve(self, s): """ Resolve strings to objects using standard import and attribute syntax. """ name = s.split('.') used = name.pop(0) try: found = self.importer(used) for frag in name: used += '.' + frag try: found = getattr(found, frag) except AttributeError: self.importer(used) found = getattr(found, frag) return found except ImportError: e, tb = sys.exc_info()[1:] v = ValueError('Cannot resolve %r: %s' % (s, e)) v.__cause__, v.__traceback__ = e, tb raise v def ext_convert(self, value): """Default converter for the ext:// protocol.""" return self.resolve(value) def cfg_convert(self, value): """Default converter for the cfg:// protocol.""" rest = value m = self.WORD_PATTERN.match(rest) if m is None: raise ValueError("Unable to convert %r" % value) else: rest = rest[m.end():] d = self.config[m.groups()[0]] #print d, rest while rest: m = self.DOT_PATTERN.match(rest) if m: d = d[m.groups()[0]] else: m = self.INDEX_PATTERN.match(rest) if m: idx = m.groups()[0] if not self.DIGIT_PATTERN.match(idx): d = d[idx] else: try: n = int(idx) # try as number first (most likely) d = d[n] except TypeError: d = d[idx] if m: rest = rest[m.end():] else: raise ValueError('Unable to convert ' '%r at %r' % (value, rest)) #rest should be empty return d def convert(self, value): """ Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. """ if not isinstance(value, ConvertingDict) and isinstance(value, dict): value = ConvertingDict(value) value.configurator = self elif not isinstance(value, ConvertingList) and isinstance(value, list): value = ConvertingList(value) value.configurator = self elif not isinstance(value, ConvertingTuple) and\ isinstance(value, tuple): value = ConvertingTuple(value) value.configurator = self elif isinstance(value, string_types): m = self.CONVERT_PATTERN.match(value) if m: d = m.groupdict() prefix = d['prefix'] converter = self.value_converters.get(prefix, None) if converter: suffix = d['suffix'] converter = getattr(self, converter) value = converter(suffix) return value def configure_custom(self, config): """Configure an object with a user-supplied factory.""" c = config.pop('()') if not callable(c): c = self.resolve(c) props = config.pop('.', None) # Check for valid identifiers kwargs = dict([(k, config[k]) for k in config if valid_ident(k)]) result = c(**kwargs) if props: for name, value in props.items(): setattr(result, name, value) return result def as_tuple(self, value): """Utility function which converts lists to tuples.""" if isinstance(value, list): value = tuple(value) return value distlib/metadata.py000064400000114062152347724720010351 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """Implementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, 1.3/2.1 and withdrawn 2.0). """ from __future__ import unicode_literals import codecs from email import message_from_file import json import logging import re from . import DistlibException, __version__ from .compat import StringIO, string_types, text_type from .markers import interpret from .util import extract_by_key, get_extras from .version import get_scheme, PEP440_VERSION_RE logger = logging.getLogger(__name__) class MetadataMissingError(DistlibException): """A required metadata is missing""" class MetadataConflictError(DistlibException): """Attempt to read or write metadata fields that are conflictual.""" class MetadataUnrecognizedVersionError(DistlibException): """Unknown metadata version number.""" class MetadataInvalidError(DistlibException): """A metadata value is invalid""" # public API of this module __all__ = ['Metadata', 'PKG_INFO_ENCODING', 'PKG_INFO_PREFERRED_VERSION'] # Encoding used for the PKG-INFO files PKG_INFO_ENCODING = 'utf-8' # preferred version. Hopefully will be changed # to 1.2 once PEP 345 is supported everywhere PKG_INFO_PREFERRED_VERSION = '1.1' _LINE_PREFIX_1_2 = re.compile('\n \\|') _LINE_PREFIX_PRE_1_2 = re.compile('\n ') _241_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'License') _314_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes', 'Provides', 'Requires') _314_MARKERS = ('Obsoletes', 'Provides', 'Requires', 'Classifier', 'Download-URL') _345_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes-Dist', 'Project-URL', 'Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Requires-External') _345_MARKERS = ('Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Obsoletes-Dist', 'Requires-External', 'Maintainer', 'Maintainer-email', 'Project-URL') _426_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', 'Supported-Platform', 'Summary', 'Description', 'Keywords', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Classifier', 'Download-URL', 'Obsoletes-Dist', 'Project-URL', 'Provides-Dist', 'Requires-Dist', 'Requires-Python', 'Requires-External', 'Private-Version', 'Obsoleted-By', 'Setup-Requires-Dist', 'Extension', 'Provides-Extra') _426_MARKERS = ('Private-Version', 'Provides-Extra', 'Obsoleted-By', 'Setup-Requires-Dist', 'Extension') # See issue #106: Sometimes 'Requires' and 'Provides' occur wrongly in # the metadata. Include them in the tuple literal below to allow them # (for now). _566_FIELDS = _426_FIELDS + ('Description-Content-Type', 'Requires', 'Provides') _566_MARKERS = ('Description-Content-Type',) _ALL_FIELDS = set() _ALL_FIELDS.update(_241_FIELDS) _ALL_FIELDS.update(_314_FIELDS) _ALL_FIELDS.update(_345_FIELDS) _ALL_FIELDS.update(_426_FIELDS) _ALL_FIELDS.update(_566_FIELDS) EXTRA_RE = re.compile(r'''extra\s*==\s*("([^"]+)"|'([^']+)')''') def _version2fieldlist(version): if version == '1.0': return _241_FIELDS elif version == '1.1': return _314_FIELDS elif version == '1.2': return _345_FIELDS elif version in ('1.3', '2.1'): return _345_FIELDS + _566_FIELDS elif version == '2.0': return _426_FIELDS raise MetadataUnrecognizedVersionError(version) def _best_version(fields): """Detect the best version depending on the fields used.""" def _has_marker(keys, markers): for marker in markers: if marker in keys: return True return False keys = [] for key, value in fields.items(): if value in ([], 'UNKNOWN', None): continue keys.append(key) possible_versions = ['1.0', '1.1', '1.2', '1.3', '2.0', '2.1'] # first let's try to see if a field is not part of one of the version for key in keys: if key not in _241_FIELDS and '1.0' in possible_versions: possible_versions.remove('1.0') logger.debug('Removed 1.0 due to %s', key) if key not in _314_FIELDS and '1.1' in possible_versions: possible_versions.remove('1.1') logger.debug('Removed 1.1 due to %s', key) if key not in _345_FIELDS and '1.2' in possible_versions: possible_versions.remove('1.2') logger.debug('Removed 1.2 due to %s', key) if key not in _566_FIELDS and '1.3' in possible_versions: possible_versions.remove('1.3') logger.debug('Removed 1.3 due to %s', key) if key not in _566_FIELDS and '2.1' in possible_versions: if key != 'Description': # In 2.1, description allowed after headers possible_versions.remove('2.1') logger.debug('Removed 2.1 due to %s', key) if key not in _426_FIELDS and '2.0' in possible_versions: possible_versions.remove('2.0') logger.debug('Removed 2.0 due to %s', key) # possible_version contains qualified versions if len(possible_versions) == 1: return possible_versions[0] # found ! elif len(possible_versions) == 0: logger.debug('Out of options - unknown metadata set: %s', fields) raise MetadataConflictError('Unknown metadata set') # let's see if one unique marker is found is_1_1 = '1.1' in possible_versions and _has_marker(keys, _314_MARKERS) is_1_2 = '1.2' in possible_versions and _has_marker(keys, _345_MARKERS) is_2_1 = '2.1' in possible_versions and _has_marker(keys, _566_MARKERS) is_2_0 = '2.0' in possible_versions and _has_marker(keys, _426_MARKERS) if int(is_1_1) + int(is_1_2) + int(is_2_1) + int(is_2_0) > 1: raise MetadataConflictError('You used incompatible 1.1/1.2/2.0/2.1 fields') # we have the choice, 1.0, or 1.2, or 2.0 # - 1.0 has a broken Summary field but works with all tools # - 1.1 is to avoid # - 1.2 fixes Summary but has little adoption # - 2.0 adds more features and is very new if not is_1_1 and not is_1_2 and not is_2_1 and not is_2_0: # we couldn't find any specific marker if PKG_INFO_PREFERRED_VERSION in possible_versions: return PKG_INFO_PREFERRED_VERSION if is_1_1: return '1.1' if is_1_2: return '1.2' if is_2_1: return '2.1' return '2.0' # This follows the rules about transforming keys as described in # https://www.python.org/dev/peps/pep-0566/#id17 _ATTR2FIELD = { name.lower().replace("-", "_"): name for name in _ALL_FIELDS } _FIELD2ATTR = {field: attr for attr, field in _ATTR2FIELD.items()} _PREDICATE_FIELDS = ('Requires-Dist', 'Obsoletes-Dist', 'Provides-Dist') _VERSIONS_FIELDS = ('Requires-Python',) _VERSION_FIELDS = ('Version',) _LISTFIELDS = ('Platform', 'Classifier', 'Obsoletes', 'Requires', 'Provides', 'Obsoletes-Dist', 'Provides-Dist', 'Requires-Dist', 'Requires-External', 'Project-URL', 'Supported-Platform', 'Setup-Requires-Dist', 'Provides-Extra', 'Extension') _LISTTUPLEFIELDS = ('Project-URL',) _ELEMENTSFIELD = ('Keywords',) _UNICODEFIELDS = ('Author', 'Maintainer', 'Summary', 'Description') _MISSING = object() _FILESAFE = re.compile('[^A-Za-z0-9.]+') def _get_name_and_version(name, version, for_filename=False): """Return the distribution name with version. If for_filename is true, return a filename-escaped form.""" if for_filename: # For both name and version any runs of non-alphanumeric or '.' # characters are replaced with a single '-'. Additionally any # spaces in the version string become '.' name = _FILESAFE.sub('-', name) version = _FILESAFE.sub('-', version.replace(' ', '.')) return '%s-%s' % (name, version) class LegacyMetadata(object): """The legacy metadata of a release. Supports versions 1.0, 1.1, 1.2, 2.0 and 1.3/2.1 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name """ # TODO document the mapping API and UNKNOWN default key def __init__(self, path=None, fileobj=None, mapping=None, scheme='default'): if [path, fileobj, mapping].count(None) < 2: raise TypeError('path, fileobj and mapping are exclusive') self._fields = {} self.requires_files = [] self._dependencies = None self.scheme = scheme if path is not None: self.read(path) elif fileobj is not None: self.read_file(fileobj) elif mapping is not None: self.update(mapping) self.set_metadata_version() def set_metadata_version(self): self._fields['Metadata-Version'] = _best_version(self._fields) def _write_field(self, fileobj, name, value): fileobj.write('%s: %s\n' % (name, value)) def __getitem__(self, name): return self.get(name) def __setitem__(self, name, value): return self.set(name, value) def __delitem__(self, name): field_name = self._convert_name(name) try: del self._fields[field_name] except KeyError: raise KeyError(name) def __contains__(self, name): return (name in self._fields or self._convert_name(name) in self._fields) def _convert_name(self, name): if name in _ALL_FIELDS: return name name = name.replace('-', '_').lower() return _ATTR2FIELD.get(name, name) def _default_value(self, name): if name in _LISTFIELDS or name in _ELEMENTSFIELD: return [] return 'UNKNOWN' def _remove_line_prefix(self, value): if self.metadata_version in ('1.0', '1.1'): return _LINE_PREFIX_PRE_1_2.sub('\n', value) else: return _LINE_PREFIX_1_2.sub('\n', value) def __getattr__(self, name): if name in _ATTR2FIELD: return self[name] raise AttributeError(name) # # Public API # # dependencies = property(_get_dependencies, _set_dependencies) def get_fullname(self, filesafe=False): """Return the distribution name with version. If filesafe is true, return a filename-escaped form.""" return _get_name_and_version(self['Name'], self['Version'], filesafe) def is_field(self, name): """return True if name is a valid metadata key""" name = self._convert_name(name) return name in _ALL_FIELDS def is_multi_field(self, name): name = self._convert_name(name) return name in _LISTFIELDS def read(self, filepath): """Read the metadata values from a file path.""" fp = codecs.open(filepath, 'r', encoding='utf-8') try: self.read_file(fp) finally: fp.close() def read_file(self, fileob): """Read the metadata values from a file object.""" msg = message_from_file(fileob) self._fields['Metadata-Version'] = msg['metadata-version'] # When reading, get all the fields we can for field in _ALL_FIELDS: if field not in msg: continue if field in _LISTFIELDS: # we can have multiple lines values = msg.get_all(field) if field in _LISTTUPLEFIELDS and values is not None: values = [tuple(value.split(',')) for value in values] self.set(field, values) else: # single line value = msg[field] if value is not None and value != 'UNKNOWN': self.set(field, value) # PEP 566 specifies that the body be used for the description, if # available body = msg.get_payload() self["Description"] = body if body else self["Description"] # logger.debug('Attempting to set metadata for %s', self) # self.set_metadata_version() def write(self, filepath, skip_unknown=False): """Write the metadata fields to filepath.""" fp = codecs.open(filepath, 'w', encoding='utf-8') try: self.write_file(fp, skip_unknown) finally: fp.close() def write_file(self, fileobject, skip_unknown=False): """Write the PKG-INFO format data to a file object.""" self.set_metadata_version() for field in _version2fieldlist(self['Metadata-Version']): values = self.get(field) if skip_unknown and values in ('UNKNOWN', [], ['UNKNOWN']): continue if field in _ELEMENTSFIELD: self._write_field(fileobject, field, ','.join(values)) continue if field not in _LISTFIELDS: if field == 'Description': if self.metadata_version in ('1.0', '1.1'): values = values.replace('\n', '\n ') else: values = values.replace('\n', '\n |') values = [values] if field in _LISTTUPLEFIELDS: values = [','.join(value) for value in values] for value in values: self._write_field(fileobject, field, value) def update(self, other=None, **kwargs): """Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. """ def _set(key, value): if key in _ATTR2FIELD and value: self.set(self._convert_name(key), value) if not other: # other is None or empty container pass elif hasattr(other, 'keys'): for k in other.keys(): _set(k, other[k]) else: for k, v in other: _set(k, v) if kwargs: for k, v in kwargs.items(): _set(k, v) def set(self, name, value): """Control then set a metadata field.""" name = self._convert_name(name) if ((name in _ELEMENTSFIELD or name == 'Platform') and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [v.strip() for v in value.split(',')] else: value = [] elif (name in _LISTFIELDS and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [value] else: value = [] if logger.isEnabledFor(logging.WARNING): project_name = self['Name'] scheme = get_scheme(self.scheme) if name in _PREDICATE_FIELDS and value is not None: for v in value: # check that the values are valid if not scheme.is_valid_matcher(v.split(';')[0]): logger.warning( "'%s': '%s' is not valid (field '%s')", project_name, v, name) # FIXME this rejects UNKNOWN, is that right? elif name in _VERSIONS_FIELDS and value is not None: if not scheme.is_valid_constraint_list(value): logger.warning("'%s': '%s' is not a valid version (field '%s')", project_name, value, name) elif name in _VERSION_FIELDS and value is not None: if not scheme.is_valid_version(value): logger.warning("'%s': '%s' is not a valid version (field '%s')", project_name, value, name) if name in _UNICODEFIELDS: if name == 'Description': value = self._remove_line_prefix(value) self._fields[name] = value def get(self, name, default=_MISSING): """Get a metadata field.""" name = self._convert_name(name) if name not in self._fields: if default is _MISSING: default = self._default_value(name) return default if name in _UNICODEFIELDS: value = self._fields[name] return value elif name in _LISTFIELDS: value = self._fields[name] if value is None: return [] res = [] for val in value: if name not in _LISTTUPLEFIELDS: res.append(val) else: # That's for Project-URL res.append((val[0], val[1])) return res elif name in _ELEMENTSFIELD: value = self._fields[name] if isinstance(value, string_types): return value.split(',') return self._fields[name] def check(self, strict=False): """Check if the metadata is compliant. If strict is True then raise if no Name or Version are provided""" self.set_metadata_version() # XXX should check the versions (if the file was loaded) missing, warnings = [], [] for attr in ('Name', 'Version'): # required by PEP 345 if attr not in self: missing.append(attr) if strict and missing != []: msg = 'missing required metadata: %s' % ', '.join(missing) raise MetadataMissingError(msg) for attr in ('Home-page', 'Author'): if attr not in self: missing.append(attr) # checking metadata 1.2 (XXX needs to check 1.1, 1.0) if self['Metadata-Version'] != '1.2': return missing, warnings scheme = get_scheme(self.scheme) def are_valid_constraints(value): for v in value: if not scheme.is_valid_matcher(v.split(';')[0]): return False return True for fields, controller in ((_PREDICATE_FIELDS, are_valid_constraints), (_VERSIONS_FIELDS, scheme.is_valid_constraint_list), (_VERSION_FIELDS, scheme.is_valid_version)): for field in fields: value = self.get(field, None) if value is not None and not controller(value): warnings.append("Wrong value for '%s': %s" % (field, value)) return missing, warnings def todict(self, skip_missing=False): """Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). This is as per https://www.python.org/dev/peps/pep-0566/#id17. """ self.set_metadata_version() fields = _version2fieldlist(self['Metadata-Version']) data = {} for field_name in fields: if not skip_missing or field_name in self._fields: key = _FIELD2ATTR[field_name] if key != 'project_url': data[key] = self[field_name] else: data[key] = [','.join(u) for u in self[field_name]] return data def add_requirements(self, requirements): if self['Metadata-Version'] == '1.1': # we can't have 1.1 metadata *and* Setuptools requires for field in ('Obsoletes', 'Requires', 'Provides'): if field in self: del self[field] self['Requires-Dist'] += requirements # Mapping API # TODO could add iter* variants def keys(self): return list(_version2fieldlist(self['Metadata-Version'])) def __iter__(self): for key in self.keys(): yield key def values(self): return [self[key] for key in self.keys()] def items(self): return [(key, self[key]) for key in self.keys()] def __repr__(self): return '<%s %s %s>' % (self.__class__.__name__, self.name, self.version) METADATA_FILENAME = 'pydist.json' WHEEL_METADATA_FILENAME = 'metadata.json' LEGACY_METADATA_FILENAME = 'METADATA' class Metadata(object): """ The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. """ METADATA_VERSION_MATCHER = re.compile(r'^\d+(\.\d+)*$') NAME_MATCHER = re.compile('^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$', re.I) VERSION_MATCHER = PEP440_VERSION_RE SUMMARY_MATCHER = re.compile('.{1,2047}') METADATA_VERSION = '2.0' GENERATOR = 'distlib (%s)' % __version__ MANDATORY_KEYS = { 'name': (), 'version': (), 'summary': ('legacy',), } INDEX_KEYS = ('name version license summary description author ' 'author_email keywords platform home_page classifiers ' 'download_url') DEPENDENCY_KEYS = ('extras run_requires test_requires build_requires ' 'dev_requires provides meta_requires obsoleted_by ' 'supports_environments') SYNTAX_VALIDATORS = { 'metadata_version': (METADATA_VERSION_MATCHER, ()), 'name': (NAME_MATCHER, ('legacy',)), 'version': (VERSION_MATCHER, ('legacy',)), 'summary': (SUMMARY_MATCHER, ('legacy',)), } __slots__ = ('_legacy', '_data', 'scheme') def __init__(self, path=None, fileobj=None, mapping=None, scheme='default'): if [path, fileobj, mapping].count(None) < 2: raise TypeError('path, fileobj and mapping are exclusive') self._legacy = None self._data = None self.scheme = scheme #import pdb; pdb.set_trace() if mapping is not None: try: self._validate_mapping(mapping, scheme) self._data = mapping except MetadataUnrecognizedVersionError: self._legacy = LegacyMetadata(mapping=mapping, scheme=scheme) self.validate() else: data = None if path: with open(path, 'rb') as f: data = f.read() elif fileobj: data = fileobj.read() if data is None: # Initialised with no args - to be added self._data = { 'metadata_version': self.METADATA_VERSION, 'generator': self.GENERATOR, } else: if not isinstance(data, text_type): data = data.decode('utf-8') try: self._data = json.loads(data) self._validate_mapping(self._data, scheme) except ValueError: # Note: MetadataUnrecognizedVersionError does not # inherit from ValueError (it's a DistlibException, # which should not inherit from ValueError). # The ValueError comes from the json.load - if that # succeeds and we get a validation error, we want # that to propagate self._legacy = LegacyMetadata(fileobj=StringIO(data), scheme=scheme) self.validate() common_keys = set(('name', 'version', 'license', 'keywords', 'summary')) none_list = (None, list) none_dict = (None, dict) mapped_keys = { 'run_requires': ('Requires-Dist', list), 'build_requires': ('Setup-Requires-Dist', list), 'dev_requires': none_list, 'test_requires': none_list, 'meta_requires': none_list, 'extras': ('Provides-Extra', list), 'modules': none_list, 'namespaces': none_list, 'exports': none_dict, 'commands': none_dict, 'classifiers': ('Classifier', list), 'source_url': ('Download-URL', None), 'metadata_version': ('Metadata-Version', None), } del none_list, none_dict def __getattribute__(self, key): common = object.__getattribute__(self, 'common_keys') mapped = object.__getattribute__(self, 'mapped_keys') if key in mapped: lk, maker = mapped[key] if self._legacy: if lk is None: result = None if maker is None else maker() else: result = self._legacy.get(lk) else: value = None if maker is None else maker() if key not in ('commands', 'exports', 'modules', 'namespaces', 'classifiers'): result = self._data.get(key, value) else: # special cases for PEP 459 sentinel = object() result = sentinel d = self._data.get('extensions') if d: if key == 'commands': result = d.get('python.commands', value) elif key == 'classifiers': d = d.get('python.details') if d: result = d.get(key, value) else: d = d.get('python.exports') if not d: d = self._data.get('python.exports') if d: result = d.get(key, value) if result is sentinel: result = value elif key not in common: result = object.__getattribute__(self, key) elif self._legacy: result = self._legacy.get(key) else: result = self._data.get(key) return result def _validate_value(self, key, value, scheme=None): if key in self.SYNTAX_VALIDATORS: pattern, exclusions = self.SYNTAX_VALIDATORS[key] if (scheme or self.scheme) not in exclusions: m = pattern.match(value) if not m: raise MetadataInvalidError("'%s' is an invalid value for " "the '%s' property" % (value, key)) def __setattr__(self, key, value): self._validate_value(key, value) common = object.__getattribute__(self, 'common_keys') mapped = object.__getattribute__(self, 'mapped_keys') if key in mapped: lk, _ = mapped[key] if self._legacy: if lk is None: raise NotImplementedError self._legacy[lk] = value elif key not in ('commands', 'exports', 'modules', 'namespaces', 'classifiers'): self._data[key] = value else: # special cases for PEP 459 d = self._data.setdefault('extensions', {}) if key == 'commands': d['python.commands'] = value elif key == 'classifiers': d = d.setdefault('python.details', {}) d[key] = value else: d = d.setdefault('python.exports', {}) d[key] = value elif key not in common: object.__setattr__(self, key, value) else: if key == 'keywords': if isinstance(value, string_types): value = value.strip() if value: value = value.split() else: value = [] if self._legacy: self._legacy[key] = value else: self._data[key] = value @property def name_and_version(self): return _get_name_and_version(self.name, self.version, True) @property def provides(self): if self._legacy: result = self._legacy['Provides-Dist'] else: result = self._data.setdefault('provides', []) s = '%s (%s)' % (self.name, self.version) if s not in result: result.append(s) return result @provides.setter def provides(self, value): if self._legacy: self._legacy['Provides-Dist'] = value else: self._data['provides'] = value def get_requirements(self, reqts, extras=None, env=None): """ Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. :param env: An optional environment for marker evaluation. """ if self._legacy: result = reqts else: result = [] extras = get_extras(extras or [], self.extras) for d in reqts: if 'extra' not in d and 'environment' not in d: # unconditional include = True else: if 'extra' not in d: # Not extra-dependent - only environment-dependent include = True else: include = d.get('extra') in extras if include: # Not excluded because of extras, check environment marker = d.get('environment') if marker: include = interpret(marker, env) if include: result.extend(d['requires']) for key in ('build', 'dev', 'test'): e = ':%s:' % key if e in extras: extras.remove(e) # A recursive call, but it should terminate since 'test' # has been removed from the extras reqts = self._data.get('%s_requires' % key, []) result.extend(self.get_requirements(reqts, extras=extras, env=env)) return result @property def dictionary(self): if self._legacy: return self._from_legacy() return self._data @property def dependencies(self): if self._legacy: raise NotImplementedError else: return extract_by_key(self._data, self.DEPENDENCY_KEYS) @dependencies.setter def dependencies(self, value): if self._legacy: raise NotImplementedError else: self._data.update(value) def _validate_mapping(self, mapping, scheme): if mapping.get('metadata_version') != self.METADATA_VERSION: raise MetadataUnrecognizedVersionError() missing = [] for key, exclusions in self.MANDATORY_KEYS.items(): if key not in mapping: if scheme not in exclusions: missing.append(key) if missing: msg = 'Missing metadata items: %s' % ', '.join(missing) raise MetadataMissingError(msg) for k, v in mapping.items(): self._validate_value(k, v, scheme) def validate(self): if self._legacy: missing, warnings = self._legacy.check(True) if missing or warnings: logger.warning('Metadata: missing: %s, warnings: %s', missing, warnings) else: self._validate_mapping(self._data, self.scheme) def todict(self): if self._legacy: return self._legacy.todict(True) else: result = extract_by_key(self._data, self.INDEX_KEYS) return result def _from_legacy(self): assert self._legacy and not self._data result = { 'metadata_version': self.METADATA_VERSION, 'generator': self.GENERATOR, } lmd = self._legacy.todict(True) # skip missing ones for k in ('name', 'version', 'license', 'summary', 'description', 'classifier'): if k in lmd: if k == 'classifier': nk = 'classifiers' else: nk = k result[nk] = lmd[k] kw = lmd.get('Keywords', []) if kw == ['']: kw = [] result['keywords'] = kw keys = (('requires_dist', 'run_requires'), ('setup_requires_dist', 'build_requires')) for ok, nk in keys: if ok in lmd and lmd[ok]: result[nk] = [{'requires': lmd[ok]}] result['provides'] = self.provides author = {} maintainer = {} return result LEGACY_MAPPING = { 'name': 'Name', 'version': 'Version', ('extensions', 'python.details', 'license'): 'License', 'summary': 'Summary', 'description': 'Description', ('extensions', 'python.project', 'project_urls', 'Home'): 'Home-page', ('extensions', 'python.project', 'contacts', 0, 'name'): 'Author', ('extensions', 'python.project', 'contacts', 0, 'email'): 'Author-email', 'source_url': 'Download-URL', ('extensions', 'python.details', 'classifiers'): 'Classifier', } def _to_legacy(self): def process_entries(entries): reqts = set() for e in entries: extra = e.get('extra') env = e.get('environment') rlist = e['requires'] for r in rlist: if not env and not extra: reqts.add(r) else: marker = '' if extra: marker = 'extra == "%s"' % extra if env: if marker: marker = '(%s) and %s' % (env, marker) else: marker = env reqts.add(';'.join((r, marker))) return reqts assert self._data and not self._legacy result = LegacyMetadata() nmd = self._data # import pdb; pdb.set_trace() for nk, ok in self.LEGACY_MAPPING.items(): if not isinstance(nk, tuple): if nk in nmd: result[ok] = nmd[nk] else: d = nmd found = True for k in nk: try: d = d[k] except (KeyError, IndexError): found = False break if found: result[ok] = d r1 = process_entries(self.run_requires + self.meta_requires) r2 = process_entries(self.build_requires + self.dev_requires) if self.extras: result['Provides-Extra'] = sorted(self.extras) result['Requires-Dist'] = sorted(r1) result['Setup-Requires-Dist'] = sorted(r2) # TODO: any other fields wanted return result def write(self, path=None, fileobj=None, legacy=False, skip_unknown=True): if [path, fileobj].count(None) != 1: raise ValueError('Exactly one of path and fileobj is needed') self.validate() if legacy: if self._legacy: legacy_md = self._legacy else: legacy_md = self._to_legacy() if path: legacy_md.write(path, skip_unknown=skip_unknown) else: legacy_md.write_file(fileobj, skip_unknown=skip_unknown) else: if self._legacy: d = self._from_legacy() else: d = self._data if fileobj: json.dump(d, fileobj, ensure_ascii=True, indent=2, sort_keys=True) else: with codecs.open(path, 'w', 'utf-8') as f: json.dump(d, f, ensure_ascii=True, indent=2, sort_keys=True) def add_requirements(self, requirements): if self._legacy: self._legacy.add_requirements(requirements) else: run_requires = self._data.setdefault('run_requires', []) always = None for entry in run_requires: if 'environment' not in entry and 'extra' not in entry: always = entry break if always is None: always = { 'requires': requirements } run_requires.insert(0, always) else: rset = set(always['requires']) | set(requirements) always['requires'] = sorted(rset) def __repr__(self): name = self.name or '(no name)' version = self.version or 'no version' return '<%s %s %s (%s)>' % (self.__class__.__name__, self.metadata_version, name, version) distlib/__init__.py000064400000001105152347724720010321 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2019 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import logging __version__ = '0.3.1' class DistlibException(Exception): pass try: from logging import NullHandler except ImportError: # pragma: no cover class NullHandler(logging.Handler): def handle(self, record): pass def emit(self, record): pass def createLock(self): self.lock = None logger = logging.getLogger(__name__) logger.addHandler(NullHandler()) distlib/markers.py000064400000010443152347724720010233 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2012-2017 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # """ Parser for the environment markers micro-language defined in PEP 508. """ # Note: In PEP 345, the micro-language was Python compatible, so the ast # module could be used to parse it. However, PEP 508 introduced operators such # as ~= and === which aren't in Python, necessitating a different approach. import os import sys import platform import re from .compat import python_implementation, urlparse, string_types from .util import in_venv, parse_marker __all__ = ['interpret'] def _is_literal(o): if not isinstance(o, string_types) or not o: return False return o[0] in '\'"' class Evaluator(object): """ This class is used to evaluate marker expessions. """ operations = { '==': lambda x, y: x == y, '===': lambda x, y: x == y, '~=': lambda x, y: x == y or x > y, '!=': lambda x, y: x != y, '<': lambda x, y: x < y, '<=': lambda x, y: x == y or x < y, '>': lambda x, y: x > y, '>=': lambda x, y: x == y or x > y, 'and': lambda x, y: x and y, 'or': lambda x, y: x or y, 'in': lambda x, y: x in y, 'not in': lambda x, y: x not in y, } def evaluate(self, expr, context): """ Evaluate a marker expression returned by the :func:`parse_requirement` function in the specified context. """ if isinstance(expr, string_types): if expr[0] in '\'"': result = expr[1:-1] else: if expr not in context: raise SyntaxError('unknown variable: %s' % expr) result = context[expr] else: assert isinstance(expr, dict) op = expr['op'] if op not in self.operations: raise NotImplementedError('op not implemented: %s' % op) elhs = expr['lhs'] erhs = expr['rhs'] if _is_literal(expr['lhs']) and _is_literal(expr['rhs']): raise SyntaxError('invalid comparison: %s %s %s' % (elhs, op, erhs)) lhs = self.evaluate(elhs, context) rhs = self.evaluate(erhs, context) result = self.operations[op](lhs, rhs) return result def default_context(): def format_full_version(info): version = '%s.%s.%s' % (info.major, info.minor, info.micro) kind = info.releaselevel if kind != 'final': version += kind[0] + str(info.serial) return version if hasattr(sys, 'implementation'): implementation_version = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: implementation_version = '0' implementation_name = '' result = { 'implementation_name': implementation_name, 'implementation_version': implementation_version, 'os_name': os.name, 'platform_machine': platform.machine(), 'platform_python_implementation': platform.python_implementation(), 'platform_release': platform.release(), 'platform_system': platform.system(), 'platform_version': platform.version(), 'platform_in_venv': str(in_venv()), 'python_full_version': platform.python_version(), 'python_version': platform.python_version()[:3], 'sys_platform': sys.platform, } return result DEFAULT_CONTEXT = default_context() del default_context evaluator = Evaluator() def interpret(marker, execution_context=None): """ Interpret a marker and return a result depending on environment. :param marker: The marker to interpret. :type marker: str :param execution_context: The context used for name lookup. :type execution_context: mapping """ try: expr, rest = parse_marker(marker) except Exception as e: raise SyntaxError('Unable to interpret marker syntax: %s: %s' % (marker, e)) if rest and rest[0] != '#': raise SyntaxError('unexpected trailing data in marker: %s: %s' % (marker, rest)) context = dict(DEFAULT_CONTEXT) if execution_context: context.update(execution_context) return evaluator.evaluate(expr, context) distlib/resources.py000064400000025016152347724720010603 0ustar00# -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import unicode_literals import bisect import io import logging import os import pkgutil import shutil import sys import types import zipimport from . import DistlibException from .util import cached_property, get_cache_base, path_to_cache_dir, Cache logger = logging.getLogger(__name__) cache = None # created when needed class ResourceCache(Cache): def __init__(self, base=None): if base is None: # Use native string to avoid issues on 2.x: see Python #20140. base = os.path.join(get_cache_base(), str('resource-cache')) super(ResourceCache, self).__init__(base) def is_stale(self, resource, path): """ Is the cache stale for the given resource? :param resource: The :class:`Resource` being cached. :param path: The path of the resource in the cache. :return: True if the cache is stale. """ # Cache invalidation is a hard problem :-) return True def get(self, resource): """ Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. """ prefix, path = resource.finder.get_cache_info(resource) if prefix is None: result = path else: result = os.path.join(self.base, self.prefix_to_dir(prefix), path) dirname = os.path.dirname(result) if not os.path.isdir(dirname): os.makedirs(dirname) if not os.path.exists(result): stale = True else: stale = self.is_stale(resource, path) if stale: # write the bytes of the resource to the cache location with open(result, 'wb') as f: f.write(resource.bytes) return result class ResourceBase(object): def __init__(self, finder, name): self.finder = finder self.name = name class Resource(ResourceBase): """ A class representing an in-package resource, such as a data file. This is not normally instantiated by user code, but rather by a :class:`ResourceFinder` which manages the resource. """ is_container = False # Backwards compatibility def as_stream(self): """ Get the resource as a stream. This is not a property to make it obvious that it returns a new stream each time. """ return self.finder.get_stream(self) @cached_property def file_path(self): global cache if cache is None: cache = ResourceCache() return cache.get(self) @cached_property def bytes(self): return self.finder.get_bytes(self) @cached_property def size(self): return self.finder.get_size(self) class ResourceContainer(ResourceBase): is_container = True # Backwards compatibility @cached_property def resources(self): return self.finder.get_resources(self) class ResourceFinder(object): """ Resource finder for file system resources. """ if sys.platform.startswith('java'): skipped_extensions = ('.pyc', '.pyo', '.class') else: skipped_extensions = ('.pyc', '.pyo') def __init__(self, module): self.module = module self.loader = getattr(module, '__loader__', None) self.base = os.path.dirname(getattr(module, '__file__', '')) def _adjust_path(self, path): return os.path.realpath(path) def _make_path(self, resource_name): # Issue #50: need to preserve type of path on Python 2.x # like os.path._get_sep if isinstance(resource_name, bytes): # should only happen on 2.x sep = b'/' else: sep = '/' parts = resource_name.split(sep) parts.insert(0, self.base) result = os.path.join(*parts) return self._adjust_path(result) def _find(self, path): return os.path.exists(path) def get_cache_info(self, resource): return None, resource.path def find(self, resource_name): path = self._make_path(resource_name) if not self._find(path): result = None else: if self._is_directory(path): result = ResourceContainer(self, resource_name) else: result = Resource(self, resource_name) result.path = path return result def get_stream(self, resource): return open(resource.path, 'rb') def get_bytes(self, resource): with open(resource.path, 'rb') as f: return f.read() def get_size(self, resource): return os.path.getsize(resource.path) def get_resources(self, resource): def allowed(f): return (f != '__pycache__' and not f.endswith(self.skipped_extensions)) return set([f for f in os.listdir(resource.path) if allowed(f)]) def is_container(self, resource): return self._is_directory(resource.path) _is_directory = staticmethod(os.path.isdir) def iterator(self, resource_name): resource = self.find(resource_name) if resource is not None: todo = [resource] while todo: resource = todo.pop(0) yield resource if resource.is_container: rname = resource.name for name in resource.resources: if not rname: new_name = name else: new_name = '/'.join([rname, name]) child = self.find(new_name) if child.is_container: todo.append(child) else: yield child class ZipResourceFinder(ResourceFinder): """ Resource finder for resources in .zip files. """ def __init__(self, module): super(ZipResourceFinder, self).__init__(module) archive = self.loader.archive self.prefix_len = 1 + len(archive) # PyPy doesn't have a _files attr on zipimporter, and you can't set one if hasattr(self.loader, '_files'): self._files = self.loader._files else: self._files = zipimport._zip_directory_cache[archive] self.index = sorted(self._files) def _adjust_path(self, path): return path def _find(self, path): path = path[self.prefix_len:] if path in self._files: result = True else: if path and path[-1] != os.sep: path = path + os.sep i = bisect.bisect(self.index, path) try: result = self.index[i].startswith(path) except IndexError: result = False if not result: logger.debug('_find failed: %r %r', path, self.loader.prefix) else: logger.debug('_find worked: %r %r', path, self.loader.prefix) return result def get_cache_info(self, resource): prefix = self.loader.archive path = resource.path[1 + len(prefix):] return prefix, path def get_bytes(self, resource): return self.loader.get_data(resource.path) def get_stream(self, resource): return io.BytesIO(self.get_bytes(resource)) def get_size(self, resource): path = resource.path[self.prefix_len:] return self._files[path][3] def get_resources(self, resource): path = resource.path[self.prefix_len:] if path and path[-1] != os.sep: path += os.sep plen = len(path) result = set() i = bisect.bisect(self.index, path) while i < len(self.index): if not self.index[i].startswith(path): break s = self.index[i][plen:] result.add(s.split(os.sep, 1)[0]) # only immediate children i += 1 return result def _is_directory(self, path): path = path[self.prefix_len:] if path and path[-1] != os.sep: path += os.sep i = bisect.bisect(self.index, path) try: result = self.index[i].startswith(path) except IndexError: result = False return result _finder_registry = { type(None): ResourceFinder, zipimport.zipimporter: ZipResourceFinder } try: # In Python 3.6, _frozen_importlib -> _frozen_importlib_external try: import _frozen_importlib_external as _fi except ImportError: import _frozen_importlib as _fi _finder_registry[_fi.SourceFileLoader] = ResourceFinder _finder_registry[_fi.FileFinder] = ResourceFinder del _fi except (ImportError, AttributeError): pass def register_finder(loader, finder_maker): _finder_registry[type(loader)] = finder_maker _finder_cache = {} def finder(package): """ Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. """ if package in _finder_cache: result = _finder_cache[package] else: if package not in sys.modules: __import__(package) module = sys.modules[package] path = getattr(module, '__path__', None) if path is None: raise DistlibException('You cannot get a finder for a module, ' 'only for a package') loader = getattr(module, '__loader__', None) finder_maker = _finder_registry.get(type(loader)) if finder_maker is None: raise DistlibException('Unable to locate finder for %r' % package) result = finder_maker(module) _finder_cache[package] = result return result _dummy_module = types.ModuleType(str('__dummy__')) def finder_for_path(path): """ Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. """ result = None # calls any path hooks, gets importer into cache pkgutil.get_importer(path) loader = sys.path_importer_cache.get(path) finder = _finder_registry.get(type(loader)) if finder: module = _dummy_module module.__file__ = os.path.join(path, '') module.__loader__ = loader result = finder(module) return result lockfile/sqlitelockfile.py000064400000012602152347724720011736 0ustar00from __future__ import absolute_import, division import time import os try: unicode except NameError: unicode = str from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked class SQLiteLockFile(LockBase): "Demonstrate SQL-based locking." testdb = None def __init__(self, path, threaded=True, timeout=None): """ >>> lock = SQLiteLockFile('somefile') >>> lock = SQLiteLockFile('somefile', threaded=False) """ LockBase.__init__(self, path, threaded, timeout) self.lock_file = unicode(self.lock_file) self.unique_name = unicode(self.unique_name) if SQLiteLockFile.testdb is None: import tempfile _fd, testdb = tempfile.mkstemp() os.close(_fd) os.unlink(testdb) del _fd, tempfile SQLiteLockFile.testdb = testdb import sqlite3 self.connection = sqlite3.connect(SQLiteLockFile.testdb) c = self.connection.cursor() try: c.execute("create table locks" "(" " lock_file varchar(32)," " unique_name varchar(32)" ")") except sqlite3.OperationalError: pass else: self.connection.commit() import atexit atexit.register(os.unlink, SQLiteLockFile.testdb) def acquire(self, timeout=None): timeout = timeout if timeout is not None else self.timeout end_time = time.time() if timeout is not None and timeout > 0: end_time += timeout if timeout is None: wait = 0.1 elif timeout <= 0: wait = 0 else: wait = timeout / 10 cursor = self.connection.cursor() while True: if not self.is_locked(): # Not locked. Try to lock it. cursor.execute("insert into locks" " (lock_file, unique_name)" " values" " (?, ?)", (self.lock_file, self.unique_name)) self.connection.commit() # Check to see if we are the only lock holder. cursor.execute("select * from locks" " where unique_name = ?", (self.unique_name,)) rows = cursor.fetchall() if len(rows) > 1: # Nope. Someone else got there. Remove our lock. cursor.execute("delete from locks" " where unique_name = ?", (self.unique_name,)) self.connection.commit() else: # Yup. We're done, so go home. return else: # Check to see if we are the only lock holder. cursor.execute("select * from locks" " where unique_name = ?", (self.unique_name,)) rows = cursor.fetchall() if len(rows) == 1: # We're the locker, so go home. return # Maybe we should wait a bit longer. if timeout is not None and time.time() > end_time: if timeout > 0: # No more waiting. raise LockTimeout("Timeout waiting to acquire" " lock for %s" % self.path) else: # Someone else has the lock and we are impatient.. raise AlreadyLocked("%s is already locked" % self.path) # Well, okay. We'll give it a bit longer. time.sleep(wait) def release(self): if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) if not self.i_am_locking(): raise NotMyLock("%s is locked, but not by me (by %s)" % (self.unique_name, self._who_is_locking())) cursor = self.connection.cursor() cursor.execute("delete from locks" " where unique_name = ?", (self.unique_name,)) self.connection.commit() def _who_is_locking(self): cursor = self.connection.cursor() cursor.execute("select unique_name from locks" " where lock_file = ?", (self.lock_file,)) return cursor.fetchone()[0] def is_locked(self): cursor = self.connection.cursor() cursor.execute("select * from locks" " where lock_file = ?", (self.lock_file,)) rows = cursor.fetchall() return not not rows def i_am_locking(self): cursor = self.connection.cursor() cursor.execute("select * from locks" " where lock_file = ?" " and unique_name = ?", (self.lock_file, self.unique_name)) return not not cursor.fetchall() def break_lock(self): cursor = self.connection.cursor() cursor.execute("delete from locks" " where lock_file = ?", (self.lock_file,)) self.connection.commit() lockfile/__pycache__/linklockfile.cpython-36.pyc000064400000004241152347724720015656 0ustar003 Pf\ @sPddlmZddlZddlZddlmZmZmZmZm Z m Z GdddeZ dS))absolute_importN)LockBase LockFailed NotLocked NotMyLock LockTimeout AlreadyLockedc@s:eZdZdZd ddZddZddZd d Zd d ZdS) LinkLockFilezLock access to a file using atomic property of link(2). >>> lock = LinkLockFile('somefile') >>> lock = LinkLockFile('somefile', threaded=False) NcCs"yt|jdjWn"tk r6td|jYnX|dk rD|n|j}tj}|dk rj|dkrj||7}xytj|j|j Wnt k rtj |jj }|dkrdS|dk rtj|krtj |j|dkrtd|jntd|jtj|dk r |dp dYqlXdSqlWdS) Nwbzfailed to create %srz&Timeout waiting to acquire lock for %sz%s is already locked g?)open unique_namecloseIOErrorrtimeouttimeoslink lock_fileOSErrorstatst_nlinkunlinkrpathr Zsleep)selfrZend_timeZnlinksr"/usr/lib/python3.6/linklockfile.pyacquires0   $zLinkLockFile.acquirecCsP|jstd|jntjj|js4td|jtj|jtj|jdS)Nz%s is not lockedz%s is locked, but not by me) is_lockedrrrexistsrrrr)rrrrrelease7s  zLinkLockFile.releasecCstjj|jS)N)rrr!r)rrrrr ?szLinkLockFile.is_lockedcCs(|jo&tjj|jo&tj|jjdkS)Nr )r rrr!rrr)rrrr i_am_lockingBszLinkLockFile.i_am_lockingcCstjj|jrtj|jdS)N)rrr!rr)rrrr break_lockGszLinkLockFile.break_lock)N) __name__ __module__ __qualname____doc__rr"r r#r$rrrrr s  &r ) Z __future__rrrrrrrrr r rrrrs  lockfile/__pycache__/pidlockfile.cpython-36.opt-1.pyc000064400000011243152347724720016434 0ustar003 Pf@stdZddlmZddlZddlZddlZddlmZmZm Z m Z m Z m Z GdddeZ dd Zd d Zd d ZdS)z8 Lockfile behaviour implemented via Unix PID files. )absolute_importN)LockBase AlreadyLocked LockFailed NotLocked NotMyLock LockTimeoutc@sLeZdZdZdddZddZdd Zd d Zdd d ZddZ ddZ dS) PIDLockFileaA Lockfile implemented as a Unix PID file. The lock file is a normal file named by the attribute `path`. A lock's PID file contains a single line of text, containing the process ID (PID) of the process that acquired the lock. >>> lock = PIDLockFile('somefile') >>> lock = PIDLockFile('somefile') FNcCstj||d||j|_dS)NF)r__init__pathZ unique_name)selfr Zthreadedtimeoutr!/usr/lib/python3.6/pidlockfile.pyr $szPIDLockFile.__init__cCs t|jS)z- Get the PID from the lock file. )read_pid_from_pidfiler )r rrrread_pid*szPIDLockFile.read_pidcCstjj|jS)zv Test if the lock is currently held. The lock is held if the PID file for this lock exists. )osr exists)r rrr is_locked/szPIDLockFile.is_lockedcCs|jotj|jkS)z Test if the lock is held by the current process. Returns ``True`` if the current process ID matches the number stored in the PID file. )rrgetpidr)r rrr i_am_locking7szPIDLockFile.i_am_lockingcCs|dk r |n|j}tj}|dk r2|dkr2||7}xyt|jWntk r}zv|jtjkrtj|kr|dk r|dkrtd|jntd|jtj |dk r|dpdnt d|jWYdd}~Xq4XdSq4WdS)z Acquire the lock. Creates the PID file for this lock, or raises an error if the lock could not be acquired. Nrz&Timeout waiting to acquire lock for %sz%s is already locked g?zfailed to create %s) rtimewrite_pid_to_pidfiler OSErrorerrnoZEEXISTr rZsleepr)r rZend_timeexcrrracquire?s$     zPIDLockFile.acquirecCs:|jstd|j|js,td|jt|jdS)z Release the lock. Removes the PID file to release the lock, or raises an error if the current process does not hold the lock. z%s is not lockedz%s is locked, but not by meN)rrr rrremove_existing_pidfile)r rrrrelease_s zPIDLockFile.releasecCst|jdS)z Break an existing lock. Removes the PID file if it already exists, otherwise does nothing. N)rr )r rrr break_locklszPIDLockFile.break_lock)FN)N) __name__ __module__ __qualname____doc__r rrrrr r!rrrrr s    r cCsbd}yt|d}Wntk r&Yn8X|jj}y t|}Wntk rTYnX|j|S)z Read the PID recorded in the named PID file. Read and return the numeric PID recorded as text in the named PID file. If the PID file cannot be read, or if the content is not a valid PID, return ``None``. Nr)openIOErrorreadlinestripint ValueErrorclose) pidfile_pathpidpidfilelinerrrrvs  rcCsRtjtjBtjB}d}tj|||}tj|d}tj}|jd||jdS)u Write the PID in the named PID file. Get the numeric process ID (“PID”) of the current process and write it to the named file as a line of text. iwz%s N) rO_CREATO_EXCLO_WRONLYr'fdopenrwriter-)r.Z open_flagsZ open_modeZ pidfile_fdr0r/rrrrs rcCsFytj|Wn2tk r@}z|jtjkr.nWYdd}~XnXdS)z Remove the named PID file if it exists. Removing a PID file that doesn't already exist puts us in the desired state, so we ignore the condition if the file does not exist. N)rremoverrENOENT)r.rrrrrs  r)r%Z __future__rrrrrrrrrr r rrrrrrr s  ]"lockfile/__pycache__/pidlockfile.cpython-36.pyc000064400000011243152347724720015475 0ustar003 Pf@stdZddlmZddlZddlZddlZddlmZmZm Z m Z m Z m Z GdddeZ dd Zd d Zd d ZdS)z8 Lockfile behaviour implemented via Unix PID files. )absolute_importN)LockBase AlreadyLocked LockFailed NotLocked NotMyLock LockTimeoutc@sLeZdZdZdddZddZdd Zd d Zdd d ZddZ ddZ dS) PIDLockFileaA Lockfile implemented as a Unix PID file. The lock file is a normal file named by the attribute `path`. A lock's PID file contains a single line of text, containing the process ID (PID) of the process that acquired the lock. >>> lock = PIDLockFile('somefile') >>> lock = PIDLockFile('somefile') FNcCstj||d||j|_dS)NF)r__init__pathZ unique_name)selfr Zthreadedtimeoutr!/usr/lib/python3.6/pidlockfile.pyr $szPIDLockFile.__init__cCs t|jS)z- Get the PID from the lock file. )read_pid_from_pidfiler )r rrrread_pid*szPIDLockFile.read_pidcCstjj|jS)zv Test if the lock is currently held. The lock is held if the PID file for this lock exists. )osr exists)r rrr is_locked/szPIDLockFile.is_lockedcCs|jotj|jkS)z Test if the lock is held by the current process. Returns ``True`` if the current process ID matches the number stored in the PID file. )rrgetpidr)r rrr i_am_locking7szPIDLockFile.i_am_lockingcCs|dk r |n|j}tj}|dk r2|dkr2||7}xyt|jWntk r}zv|jtjkrtj|kr|dk r|dkrtd|jntd|jtj |dk r|dpdnt d|jWYdd}~Xq4XdSq4WdS)z Acquire the lock. Creates the PID file for this lock, or raises an error if the lock could not be acquired. Nrz&Timeout waiting to acquire lock for %sz%s is already locked g?zfailed to create %s) rtimewrite_pid_to_pidfiler OSErrorerrnoZEEXISTr rZsleepr)r rZend_timeexcrrracquire?s$     zPIDLockFile.acquirecCs:|jstd|j|js,td|jt|jdS)z Release the lock. Removes the PID file to release the lock, or raises an error if the current process does not hold the lock. z%s is not lockedz%s is locked, but not by meN)rrr rrremove_existing_pidfile)r rrrrelease_s zPIDLockFile.releasecCst|jdS)z Break an existing lock. Removes the PID file if it already exists, otherwise does nothing. N)rr )r rrr break_locklszPIDLockFile.break_lock)FN)N) __name__ __module__ __qualname____doc__r rrrrr r!rrrrr s    r cCsbd}yt|d}Wntk r&Yn8X|jj}y t|}Wntk rTYnX|j|S)z Read the PID recorded in the named PID file. Read and return the numeric PID recorded as text in the named PID file. If the PID file cannot be read, or if the content is not a valid PID, return ``None``. Nr)openIOErrorreadlinestripint ValueErrorclose) pidfile_pathpidpidfilelinerrrrvs  rcCsRtjtjBtjB}d}tj|||}tj|d}tj}|jd||jdS)u Write the PID in the named PID file. Get the numeric process ID (“PID”) of the current process and write it to the named file as a line of text. iwz%s N) rO_CREATO_EXCLO_WRONLYr'fdopenrwriter-)r.Z open_flagsZ open_modeZ pidfile_fdr0r/rrrrs rcCsFytj|Wn2tk r@}z|jtjkr.nWYdd}~XnXdS)z Remove the named PID file if it exists. Removing a PID file that doesn't already exist puts us in the desired state, so we ignore the condition if the file does not exist. N)rremoverrENOENT)r.rrrrrs  r)r%Z __future__rrrrrrrrrr r rrrrrrr s  ]"lockfile/__pycache__/symlinklockfile.cpython-36.pyc000064400000004056152347724720016413 0ustar003 Pf8 @sLddlmZddlZddlZddlmZmZmZmZm Z GdddeZ dS))absolute_importN)LockBase NotLocked NotMyLock LockTimeout AlreadyLockedc@sDeZdZdZdddZdddZdd Zd d Zd d ZddZ dS)SymlinkLockFilez'Lock access to a file using symlink(2).TNcCs(tj||||tjj|jd|_dS)Nr)r__init__ospathsplit unique_name)selfr Zthreadedtimeoutr%/usr/lib/python3.6/symlinklockfile.pyr szSymlinkLockFile.__init__c Cs|dk r |n|j}tj}|dk r2|dkr2||7}xytj|j|jWnttk r|jrddS|dk rtj|kr|dkrtd|j nt d|j tj |dk r|dndYq4XdSq4WdS)Nrz&Timeout waiting to acquire lock for %sz%s is already locked g?) rtimer symlinkr lock_fileOSError i_am_lockingrr rZsleep)rrZend_timerrracquires$   zSymlinkLockFile.acquirecCs>|jstd|jn|js.td|jtj|jdS)Nz%s is not lockedz%s is locked, but not by me) is_lockedrr rrr unlinkr)rrrrrelease6s zSymlinkLockFile.releasecCstjj|jS)N)r r islinkr)rrrrr=szSymlinkLockFile.is_lockedcCs tjj|jotj|j|jkS)N)r r rrreadlinkr)rrrrr@szSymlinkLockFile.i_am_lockingcCstjj|jrtj|jdS)N)r r rrr)rrrr break_lockDszSymlinkLockFile.break_lock)TN)N) __name__ __module__ __qualname____doc__r rrrrrrrrrr s  #r ) Z __future__rr rrrrrrr rrrrs lockfile/__pycache__/sqlitelockfile.cpython-36.opt-1.pyc000064400000007126152347724720017166 0ustar003 Pf @srddlmZmZddlZddlZyeWnek r@eZYnXddlm Z m Z m Z m Z m Z Gddde ZdS))absolute_importdivisionN)LockBase NotLocked NotMyLock LockTimeout AlreadyLockedc@sPeZdZdZdZdddZdddZdd Zd d Zd d Z ddZ ddZ dS)SQLiteLockFilezDemonstrate SQL-based locking.NTc Cstj||||t|j|_t|j|_tjdkrdddl}|j\}}t j |t j |~~|t_ddl }|j tj|_|jj}y|jdWn|jk rYn$X|jjddl} | jt j tjdS)zu >>> lock = SQLiteLockFile('somefile') >>> lock = SQLiteLockFile('somefile', threaded=False) NrzGcreate table locks( lock_file varchar(32), unique_name varchar(32)))r__init__unicode lock_file unique_namer testdbtempfileZmkstemposcloseunlinksqlite3Zconnect connectioncursorexecuteZOperationalErrorcommitatexitregister) selfpathZthreadedtimeoutrZ_fdrrcrr$/usr/lib/python3.6/sqlitelockfile.pyr s(        zSQLiteLockFile.__init__cCsH|dk r |n|j}tj}|dk r2|dkr2||7}|dkr@d}n|dkrNd}n|d}|jj}x|js|jd|j|jf|jj|jd|jf|j }t |dkr|jd|jf|jjqdSn(|jd|jf|j }t |dkrdS|dk r6tj|kr6|dkr(t d|j nt d |j tj|qbWdS) Nrg? z;insert into locks (lock_file, unique_name) values (?, ?)z*select * from locks where unique_name = ?rz(delete from locks where unique_name = ?z&Timeout waiting to acquire lock for %sz%s is already locked)rtimerr is_lockedrr rrfetchalllenrrr Zsleep)rrZend_timewaitrrowsrrr acquire5sD          zSQLiteLockFile.acquirecCs\|jstd|j|js4td|j|jf|jj}|j d|jf|jj dS)Nz%s is not lockedz#%s is locked, but not by me (by %s)z(delete from locks where unique_name = ?) r#rr i_am_lockingrr_who_is_lockingrrrr)rrrrr releasets  zSQLiteLockFile.releasecCs&|jj}|jd|jf|jdS)Nz2select unique_name from locks where lock_file = ?r)rrrr Zfetchone)rrrrr r*s  zSQLiteLockFile._who_is_lockingcCs*|jj}|jd|jf|j}| S)Nz(select * from locks where lock_file = ?)rrrr r$)rrr'rrr r#s   zSQLiteLockFile.is_lockedcCs*|jj}|jd|j|jf|j S)Nz?select * from locks where lock_file = ? and unique_name = ?)rrrr rr$)rrrrr r)s zSQLiteLockFile.i_am_lockingcCs(|jj}|jd|jf|jjdS)Nz&delete from locks where lock_file = ?)rrrr r)rrrrr break_locks  zSQLiteLockFile.break_lock)TN)N) __name__ __module__ __qualname____doc__rr r(r+r*r#r)r,rrrr r s " ? r )Z __future__rrr"rr NameErrorstrrrrrr r rrrr s lockfile/__pycache__/__init__.cpython-36.pyc000064400000023146152347724720014754 0ustar003 Pf$ @sdZddlmZddlZddlZddlZddlZddlZeedsJej e_ eej dsbej j ej _ dddd d d d d dddddg ZGdddeZGdddeZGdddeZGdd d eZGdd d eZGdd d eZGdd d eZGdd d eZGdddeZGdddeZddZd dZd!dZd"dZd(d#dZeed$rjd%d&l m!Z"e"j#Z$nd%d'l m%Z&e&j'Z$e$Z(dS))a lockfile.py - Platform-independent advisory file locks. Requires Python 2.5 unless you apply 2.4.diff Locking is done on a per-thread basis instead of a per-process basis. Usage: >>> lock = LockFile('somefile') >>> try: ... lock.acquire() ... except AlreadyLocked: ... print 'somefile', 'is locked already.' ... except LockFailed: ... print 'somefile', 'can\'t be locked.' ... else: ... print 'got lock' got lock >>> print lock.is_locked() True >>> lock.release() >>> lock = LockFile('somefile') >>> print lock.is_locked() False >>> with lock: ... print lock.is_locked() True >>> print lock.is_locked() False >>> lock = LockFile('somefile') >>> # It is okay to lock twice from the same thread... >>> with lock: ... lock.acquire() ... >>> # Though no counter is kept, so you can't unlock multiple times... >>> print lock.is_locked() False Exceptions: Error - base class for other exceptions LockError - base class for all locking exceptions AlreadyLocked - Another thread or process already holds the lock LockFailed - Lock failed for some other reason UnlockError - base class for all unlocking exceptions AlreadyUnlocked - File was not locked. NotMyLock - File was locked but not by the current thread/process )absolute_importNcurrent_threadget_nameError LockError LockTimeout AlreadyLocked LockFailed UnlockError NotLocked NotMyLock LinkFileLock MkdirFileLockSQLiteFileLockLockBaselockedc@seZdZdZdS)rzw Base class for other exceptions. >>> try: ... raise Error ... except Exception: ... pass N)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/__init__.pyrJsc@seZdZdZdS)rz Base class for error arising from attempts to acquire the lock. >>> try: ... raise LockError ... except Error: ... pass N)rrrrrrrrrVsc@seZdZdZdS)rzRaised when lock creation fails within a user-defined period of time. >>> try: ... raise LockTimeout ... except LockError: ... pass N)rrrrrrrrrbsc@seZdZdZdS)rzSome other thread/process is locking the file. >>> try: ... raise AlreadyLocked ... except LockError: ... pass N)rrrrrrrrrmsc@seZdZdZdS)r zLock file creation failed for some other reason. >>> try: ... raise LockFailed ... except LockError: ... pass N)rrrrrrrrr xsc@seZdZdZdS)r z Base class for errors arising from attempts to release the lock. >>> try: ... raise UnlockError ... except Error: ... pass N)rrrrrrrrr sc@seZdZdZdS)r zRaised when an attempt is made to unlock an unlocked file. >>> try: ... raise NotLocked ... except UnlockError: ... pass N)rrrrrrrrr sc@seZdZdZdS)r zRaised when an attempt is made to unlock a file someone else locked. >>> try: ... raise NotMyLock ... except UnlockError: ... pass N)rrrrrrrrr sc@s>eZdZddZdddZddZdd Zd d Zd d ZdS) _SharedBasecCs ||_dS)N)path)selfrrrr__init__sz_SharedBase.__init__NcCs tddS)a Acquire the lock. * If timeout is omitted (or None), wait forever trying to lock the file. * If timeout > 0, try to acquire the lock for that many seconds. If the lock period expires and the file is still locked, raise LockTimeout. * If timeout <= 0, raise AlreadyLocked immediately if the file is already locked. zimplement in subclassN)NotImplemented)rtimeoutrrracquiresz_SharedBase.acquirecCs tddS)zX Release the lock. If the file is not locked, raise NotLocked. zimplement in subclassN)r)rrrrreleasesz_SharedBase.releasecCs |j|S)z* Context manager support. )r)rrrr __enter__sz_SharedBase.__enter__cGs |jdS)z* Context manager support. N)r)rZ_excrrr__exit__sz_SharedBase.__exit__cCsd|jj|jfS)Nz<%s: %r>) __class__rr)rrrr__repr__sz_SharedBase.__repr__)N) rrrrrrr r!r#rrrrrs  rcsBeZdZdZdfdd ZddZdd Zd d Zd d ZZ S)rz.Base class for platform-specific lock classes.TNcstt|j|tjj|d|_tj|_ tj |_ |rbt j }t|dt|}d|d@|_nd|_tjj|j}tjj|d|j |j|j t|jf|_||_dS)zi >>> lock = LockBase('somefile') >>> lock = LockBase('somefile', threaded=False) z.lockidentz-%xlz %s%s.%s%sN)superrrosrabspathZ lock_filesocketZ gethostnameZhostnamegetpidpid threadingrgetattrhashZtnamedirnamejoin unique_namer)rrthreadedrtr$r/)r"rrrs    zLockBase.__init__cCs tddS)z9 Tell whether or not the file is locked. zimplement in subclassN)r)rrrr is_lockedszLockBase.is_lockedcCs tddS)zA Return True if this object is locking the file. zimplement in subclassN)r)rrrr i_am_lockingszLockBase.i_am_lockingcCs tddS)zN Remove a lock. Useful if a locking thread failed to unlock. zimplement in subclassN)r)rrrr break_lockszLockBase.break_lockcCsd|jj|j|jfS)Nz<%s: %r -- %r>)r"rr1r)rrrrr#s zLockBase.__repr__)TN) rrrrrr4r5r6r# __classcell__rr)r"rrs !cOsRtjd|tddt|dts.|dd}t|dkrH| rHd|d<|||S)Nz1Import from %s module instead of lockfile package) stacklevelrTr2)warningswarnDeprecationWarning isinstancestrlen)clsmodargskwdsrrr _fl_helper s   rEcOs ddlm}t|jdf||S)zFactory function provided for backwards compatibility. Do not use in new code. Instead, import LinkLockFile from the lockfile.linklockfile module. r:) linklockfilezlockfile.linklockfile)r%rFrE LinkLockFile)rCrDrFrrrr s  cOs ddlm}t|jdf||S)zFactory function provided for backwards compatibility. Do not use in new code. Instead, import MkdirLockFile from the lockfile.mkdirlockfile module. r:) mkdirlockfilezlockfile.mkdirlockfile)r%rHrE MkdirLockFile)rCrDrHrrrr%s  cOs ddlm}t|jdf||S)zFactory function provided for backwards compatibility. Do not use in new code. Instead, import SQLiteLockFile from the lockfile.mkdirlockfile module. r:)sqlitelockfilezlockfile.sqlitelockfile)r%rJrEZSQLiteLockFile)rCrDrJrrrr0s  csfdd}|S)aDecorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ... cstjfdd}|S)Nc s.td}|jz ||S|jXdS)N)r)FileLockrr)rCkwargslock)funcrrrrwrapperHs   z&locked..decor..wrapper) functoolswraps)rNrO)rr)rNrdecorGszlocked..decorr)rrrRr)rrrr;s  linkr:)rF)rH)N))rZ __future__rrPr'r)r,r;hasattrZ currentThreadrZThreadZgetNamer__all__ Exceptionrrrrr r r r objectrrrEr rrrr%rFZ_llfrGZLockFilerHZ_mlfrIrKrrrr4sF            -:      lockfile/__pycache__/linklockfile.cpython-36.opt-1.pyc000064400000004241152347724720016615 0ustar003 Pf\ @sPddlmZddlZddlZddlmZmZmZmZm Z m Z GdddeZ dS))absolute_importN)LockBase LockFailed NotLocked NotMyLock LockTimeout AlreadyLockedc@s:eZdZdZd ddZddZddZd d Zd d ZdS) LinkLockFilezLock access to a file using atomic property of link(2). >>> lock = LinkLockFile('somefile') >>> lock = LinkLockFile('somefile', threaded=False) NcCs"yt|jdjWn"tk r6td|jYnX|dk rD|n|j}tj}|dk rj|dkrj||7}xytj|j|j Wnt k rtj |jj }|dkrdS|dk rtj|krtj |j|dkrtd|jntd|jtj|dk r |dp dYqlXdSqlWdS) Nwbzfailed to create %srz&Timeout waiting to acquire lock for %sz%s is already locked g?)open unique_namecloseIOErrorrtimeouttimeoslink lock_fileOSErrorstatst_nlinkunlinkrpathr Zsleep)selfrZend_timeZnlinksr"/usr/lib/python3.6/linklockfile.pyacquires0   $zLinkLockFile.acquirecCsP|jstd|jntjj|js4td|jtj|jtj|jdS)Nz%s is not lockedz%s is locked, but not by me) is_lockedrrrexistsrrrr)rrrrrelease7s  zLinkLockFile.releasecCstjj|jS)N)rrr!r)rrrrr ?szLinkLockFile.is_lockedcCs(|jo&tjj|jo&tj|jjdkS)Nr )r rrr!rrr)rrrr i_am_lockingBszLinkLockFile.i_am_lockingcCstjj|jrtj|jdS)N)rrr!rr)rrrr break_lockGszLinkLockFile.break_lock)N) __name__ __module__ __qualname____doc__rr"r r#r$rrrrr s  &r ) Z __future__rrrrrrrrr r rrrrs  lockfile/__pycache__/mkdirlockfile.cpython-36.opt-1.pyc000064400000005013152347724720016764 0ustar003 Pf @sdddlmZmZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z GdddeZdS))absolute_importdivisionN)LockBase LockFailed NotLocked NotMyLock LockTimeout AlreadyLockedc@sDeZdZdZdddZdddZdd Zd d Zd d ZddZ dS) MkdirLockFilez"Lock file by creating a directory.TNcCs6tj||||tjj|jd|j|j|jf|_ dS)zs >>> lock = MkdirLockFile('somefile') >>> lock = MkdirLockFile('somefile', threaded=False) z%s.%s%sN) r__init__ospathjoin lock_fileZhostnameZtnamepid unique_name)selfrZthreadedtimeoutr#/usr/lib/python3.6/mkdirlockfile.pyr s  zMkdirLockFile.__init__c Cs|dk r |n|j}tj}|dk r2|dkr2||7}|dkr@d}ntd|d}xytj|jWntk rtjd}|j t j krtj j |j rdS|dk rtj|kr|dkrtd|j ntd|j tj|ntd|jYqPXt|j djdSqPWdS) Nrg? rz&Timeout waiting to acquire lock for %sz%s is already lockedzfailed to create %swb)rtimemaxr mkdirrOSErrorsysexc_infoerrnoZEEXISTrexistsrr r Zsleepropenclose)rrZend_timewaiterrrrracquires2     zMkdirLockFile.acquirecCsP|jstd|jntjj|js4td|jtj|jtj|j dS)Nz%s is not lockedz%s is locked, but not by me) is_lockedrrr r rrunlinkrmdirr)rrrrreleaseAs  zMkdirLockFile.releasecCstjj|jS)N)r rr r)rrrrr&IszMkdirLockFile.is_lockedcCs|jotjj|jS)N)r&r rr r)rrrr i_am_lockingLszMkdirLockFile.i_am_lockingcCsJtjj|jrFx*tj|jD]}tjtjj|j|qWtj|jdS)N)r rr rlistdirr'rr()rnamerrr break_lockPszMkdirLockFile.break_lock)TN)N) __name__ __module__ __qualname____doc__r r%r)r&r*r-rrrrr s &r )Z __future__rrrr rrrrrrr r r rrrrs  lockfile/__pycache__/sqlitelockfile.cpython-36.pyc000064400000007126152347724720016227 0ustar003 Pf @srddlmZmZddlZddlZyeWnek r@eZYnXddlm Z m Z m Z m Z m Z Gddde ZdS))absolute_importdivisionN)LockBase NotLocked NotMyLock LockTimeout AlreadyLockedc@sPeZdZdZdZdddZdddZdd Zd d Zd d Z ddZ ddZ dS)SQLiteLockFilezDemonstrate SQL-based locking.NTc Cstj||||t|j|_t|j|_tjdkrdddl}|j\}}t j |t j |~~|t_ddl }|j tj|_|jj}y|jdWn|jk rYn$X|jjddl} | jt j tjdS)zu >>> lock = SQLiteLockFile('somefile') >>> lock = SQLiteLockFile('somefile', threaded=False) NrzGcreate table locks( lock_file varchar(32), unique_name varchar(32)))r__init__unicode lock_file unique_namer testdbtempfileZmkstemposcloseunlinksqlite3Zconnect connectioncursorexecuteZOperationalErrorcommitatexitregister) selfpathZthreadedtimeoutrZ_fdrrcrr$/usr/lib/python3.6/sqlitelockfile.pyr s(        zSQLiteLockFile.__init__cCsH|dk r |n|j}tj}|dk r2|dkr2||7}|dkr@d}n|dkrNd}n|d}|jj}x|js|jd|j|jf|jj|jd|jf|j }t |dkr|jd|jf|jjqdSn(|jd|jf|j }t |dkrdS|dk r6tj|kr6|dkr(t d|j nt d |j tj|qbWdS) Nrg? z;insert into locks (lock_file, unique_name) values (?, ?)z*select * from locks where unique_name = ?rz(delete from locks where unique_name = ?z&Timeout waiting to acquire lock for %sz%s is already locked)rtimerr is_lockedrr rrfetchalllenrrr Zsleep)rrZend_timewaitrrowsrrr acquire5sD          zSQLiteLockFile.acquirecCs\|jstd|j|js4td|j|jf|jj}|j d|jf|jj dS)Nz%s is not lockedz#%s is locked, but not by me (by %s)z(delete from locks where unique_name = ?) r#rr i_am_lockingrr_who_is_lockingrrrr)rrrrr releasets  zSQLiteLockFile.releasecCs&|jj}|jd|jf|jdS)Nz2select unique_name from locks where lock_file = ?r)rrrr Zfetchone)rrrrr r*s  zSQLiteLockFile._who_is_lockingcCs*|jj}|jd|jf|j}| S)Nz(select * from locks where lock_file = ?)rrrr r$)rrr'rrr r#s   zSQLiteLockFile.is_lockedcCs*|jj}|jd|j|jf|j S)Nz?select * from locks where lock_file = ? and unique_name = ?)rrrr rr$)rrrrr r)s zSQLiteLockFile.i_am_lockingcCs(|jj}|jd|jf|jjdS)Nz&delete from locks where lock_file = ?)rrrr r)rrrrr break_locks  zSQLiteLockFile.break_lock)TN)N) __name__ __module__ __qualname____doc__rr r(r+r*r#r)r,rrrr r s " ? r )Z __future__rrr"rr NameErrorstrrrrrr r rrrr s lockfile/__pycache__/__init__.cpython-36.opt-1.pyc000064400000023146152347724720015713 0ustar003 Pf$ @sdZddlmZddlZddlZddlZddlZddlZeedsJej e_ eej dsbej j ej _ dddd d d d d dddddg ZGdddeZGdddeZGdddeZGdd d eZGdd d eZGdd d eZGdd d eZGdd d eZGdddeZGdddeZddZd dZd!dZd"dZd(d#dZeed$rjd%d&l m!Z"e"j#Z$nd%d'l m%Z&e&j'Z$e$Z(dS))a lockfile.py - Platform-independent advisory file locks. Requires Python 2.5 unless you apply 2.4.diff Locking is done on a per-thread basis instead of a per-process basis. Usage: >>> lock = LockFile('somefile') >>> try: ... lock.acquire() ... except AlreadyLocked: ... print 'somefile', 'is locked already.' ... except LockFailed: ... print 'somefile', 'can\'t be locked.' ... else: ... print 'got lock' got lock >>> print lock.is_locked() True >>> lock.release() >>> lock = LockFile('somefile') >>> print lock.is_locked() False >>> with lock: ... print lock.is_locked() True >>> print lock.is_locked() False >>> lock = LockFile('somefile') >>> # It is okay to lock twice from the same thread... >>> with lock: ... lock.acquire() ... >>> # Though no counter is kept, so you can't unlock multiple times... >>> print lock.is_locked() False Exceptions: Error - base class for other exceptions LockError - base class for all locking exceptions AlreadyLocked - Another thread or process already holds the lock LockFailed - Lock failed for some other reason UnlockError - base class for all unlocking exceptions AlreadyUnlocked - File was not locked. NotMyLock - File was locked but not by the current thread/process )absolute_importNcurrent_threadget_nameError LockError LockTimeout AlreadyLocked LockFailed UnlockError NotLocked NotMyLock LinkFileLock MkdirFileLockSQLiteFileLockLockBaselockedc@seZdZdZdS)rzw Base class for other exceptions. >>> try: ... raise Error ... except Exception: ... pass N)__name__ __module__ __qualname____doc__rr/usr/lib/python3.6/__init__.pyrJsc@seZdZdZdS)rz Base class for error arising from attempts to acquire the lock. >>> try: ... raise LockError ... except Error: ... pass N)rrrrrrrrrVsc@seZdZdZdS)rzRaised when lock creation fails within a user-defined period of time. >>> try: ... raise LockTimeout ... except LockError: ... pass N)rrrrrrrrrbsc@seZdZdZdS)rzSome other thread/process is locking the file. >>> try: ... raise AlreadyLocked ... except LockError: ... pass N)rrrrrrrrrmsc@seZdZdZdS)r zLock file creation failed for some other reason. >>> try: ... raise LockFailed ... except LockError: ... pass N)rrrrrrrrr xsc@seZdZdZdS)r z Base class for errors arising from attempts to release the lock. >>> try: ... raise UnlockError ... except Error: ... pass N)rrrrrrrrr sc@seZdZdZdS)r zRaised when an attempt is made to unlock an unlocked file. >>> try: ... raise NotLocked ... except UnlockError: ... pass N)rrrrrrrrr sc@seZdZdZdS)r zRaised when an attempt is made to unlock a file someone else locked. >>> try: ... raise NotMyLock ... except UnlockError: ... pass N)rrrrrrrrr sc@s>eZdZddZdddZddZdd Zd d Zd d ZdS) _SharedBasecCs ||_dS)N)path)selfrrrr__init__sz_SharedBase.__init__NcCs tddS)a Acquire the lock. * If timeout is omitted (or None), wait forever trying to lock the file. * If timeout > 0, try to acquire the lock for that many seconds. If the lock period expires and the file is still locked, raise LockTimeout. * If timeout <= 0, raise AlreadyLocked immediately if the file is already locked. zimplement in subclassN)NotImplemented)rtimeoutrrracquiresz_SharedBase.acquirecCs tddS)zX Release the lock. If the file is not locked, raise NotLocked. zimplement in subclassN)r)rrrrreleasesz_SharedBase.releasecCs |j|S)z* Context manager support. )r)rrrr __enter__sz_SharedBase.__enter__cGs |jdS)z* Context manager support. N)r)rZ_excrrr__exit__sz_SharedBase.__exit__cCsd|jj|jfS)Nz<%s: %r>) __class__rr)rrrr__repr__sz_SharedBase.__repr__)N) rrrrrrr r!r#rrrrrs  rcsBeZdZdZdfdd ZddZdd Zd d Zd d ZZ S)rz.Base class for platform-specific lock classes.TNcstt|j|tjj|d|_tj|_ tj |_ |rbt j }t|dt|}d|d@|_nd|_tjj|j}tjj|d|j |j|j t|jf|_||_dS)zi >>> lock = LockBase('somefile') >>> lock = LockBase('somefile', threaded=False) z.lockidentz-%xlz %s%s.%s%sN)superrrosrabspathZ lock_filesocketZ gethostnameZhostnamegetpidpid threadingrgetattrhashZtnamedirnamejoin unique_namer)rrthreadedrtr$r/)r"rrrs    zLockBase.__init__cCs tddS)z9 Tell whether or not the file is locked. zimplement in subclassN)r)rrrr is_lockedszLockBase.is_lockedcCs tddS)zA Return True if this object is locking the file. zimplement in subclassN)r)rrrr i_am_lockingszLockBase.i_am_lockingcCs tddS)zN Remove a lock. Useful if a locking thread failed to unlock. zimplement in subclassN)r)rrrr break_lockszLockBase.break_lockcCsd|jj|j|jfS)Nz<%s: %r -- %r>)r"rr1r)rrrrr#s zLockBase.__repr__)TN) rrrrrr4r5r6r# __classcell__rr)r"rrs !cOsRtjd|tddt|dts.|dd}t|dkrH| rHd|d<|||S)Nz1Import from %s module instead of lockfile package) stacklevelrTr2)warningswarnDeprecationWarning isinstancestrlen)clsmodargskwdsrrr _fl_helper s   rEcOs ddlm}t|jdf||S)zFactory function provided for backwards compatibility. Do not use in new code. Instead, import LinkLockFile from the lockfile.linklockfile module. r:) linklockfilezlockfile.linklockfile)r%rFrE LinkLockFile)rCrDrFrrrr s  cOs ddlm}t|jdf||S)zFactory function provided for backwards compatibility. Do not use in new code. Instead, import MkdirLockFile from the lockfile.mkdirlockfile module. r:) mkdirlockfilezlockfile.mkdirlockfile)r%rHrE MkdirLockFile)rCrDrHrrrr%s  cOs ddlm}t|jdf||S)zFactory function provided for backwards compatibility. Do not use in new code. Instead, import SQLiteLockFile from the lockfile.mkdirlockfile module. r:)sqlitelockfilezlockfile.sqlitelockfile)r%rJrEZSQLiteLockFile)rCrDrJrrrr0s  csfdd}|S)aDecorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ... cstjfdd}|S)Nc s.td}|jz ||S|jXdS)N)r)FileLockrr)rCkwargslock)funcrrrrwrapperHs   z&locked..decor..wrapper) functoolswraps)rNrO)rr)rNrdecorGszlocked..decorr)rrrRr)rrrr;s  linkr:)rF)rH)N))rZ __future__rrPr'r)r,r;hasattrZ currentThreadrZThreadZgetNamer__all__ Exceptionrrrrr r r r objectrrrEr rrrr%rFZ_llfrGZLockFilerHZ_mlfrIrKrrrr4sF            -:      lockfile/__pycache__/symlinklockfile.cpython-36.opt-1.pyc000064400000004056152347724720017352 0ustar003 Pf8 @sLddlmZddlZddlZddlmZmZmZmZm Z GdddeZ dS))absolute_importN)LockBase NotLocked NotMyLock LockTimeout AlreadyLockedc@sDeZdZdZdddZdddZdd Zd d Zd d ZddZ dS)SymlinkLockFilez'Lock access to a file using symlink(2).TNcCs(tj||||tjj|jd|_dS)Nr)r__init__ospathsplit unique_name)selfr Zthreadedtimeoutr%/usr/lib/python3.6/symlinklockfile.pyr szSymlinkLockFile.__init__c Cs|dk r |n|j}tj}|dk r2|dkr2||7}xytj|j|jWnttk r|jrddS|dk rtj|kr|dkrtd|j nt d|j tj |dk r|dndYq4XdSq4WdS)Nrz&Timeout waiting to acquire lock for %sz%s is already locked g?) rtimer symlinkr lock_fileOSError i_am_lockingrr rZsleep)rrZend_timerrracquires$   zSymlinkLockFile.acquirecCs>|jstd|jn|js.td|jtj|jdS)Nz%s is not lockedz%s is locked, but not by me) is_lockedrr rrr unlinkr)rrrrrelease6s zSymlinkLockFile.releasecCstjj|jS)N)r r islinkr)rrrrr=szSymlinkLockFile.is_lockedcCs tjj|jotj|j|jkS)N)r r rrreadlinkr)rrrrr@szSymlinkLockFile.i_am_lockingcCstjj|jrtj|jdS)N)r r rrr)rrrr break_lockDszSymlinkLockFile.break_lock)TN)N) __name__ __module__ __qualname____doc__r rrrrrrrrrr s  #r ) Z __future__rr rrrrrrr rrrrs lockfile/__pycache__/mkdirlockfile.cpython-36.pyc000064400000005013152347724720016025 0ustar003 Pf @sdddlmZmZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z GdddeZdS))absolute_importdivisionN)LockBase LockFailed NotLocked NotMyLock LockTimeout AlreadyLockedc@sDeZdZdZdddZdddZdd Zd d Zd d ZddZ dS) MkdirLockFilez"Lock file by creating a directory.TNcCs6tj||||tjj|jd|j|j|jf|_ dS)zs >>> lock = MkdirLockFile('somefile') >>> lock = MkdirLockFile('somefile', threaded=False) z%s.%s%sN) r__init__ospathjoin lock_fileZhostnameZtnamepid unique_name)selfrZthreadedtimeoutr#/usr/lib/python3.6/mkdirlockfile.pyr s  zMkdirLockFile.__init__c Cs|dk r |n|j}tj}|dk r2|dkr2||7}|dkr@d}ntd|d}xytj|jWntk rtjd}|j t j krtj j |j rdS|dk rtj|kr|dkrtd|j ntd|j tj|ntd|jYqPXt|j djdSqPWdS) Nrg? rz&Timeout waiting to acquire lock for %sz%s is already lockedzfailed to create %swb)rtimemaxr mkdirrOSErrorsysexc_infoerrnoZEEXISTrexistsrr r Zsleepropenclose)rrZend_timewaiterrrrracquires2     zMkdirLockFile.acquirecCsP|jstd|jntjj|js4td|jtj|jtj|j dS)Nz%s is not lockedz%s is locked, but not by me) is_lockedrrr r rrunlinkrmdirr)rrrrreleaseAs  zMkdirLockFile.releasecCstjj|jS)N)r rr r)rrrrr&IszMkdirLockFile.is_lockedcCs|jotjj|jS)N)r&r rr r)rrrr i_am_lockingLszMkdirLockFile.i_am_lockingcCsJtjj|jrFx*tj|jD]}tjtjj|j|qWtj|jdS)N)r rr rlistdirr'rr()rnamerrr break_lockPszMkdirLockFile.break_lock)TN)N) __name__ __module__ __qualname____doc__r r%r)r&r*r-rrrrr s &r )Z __future__rrrr rrrrrrr r r rrrrs  lockfile/pidlockfile.py000064400000013712152347724720011214 0ustar00# -*- coding: utf-8 -*- # pidlockfile.py # # Copyright © 2008–2009 Ben Finney # # This is free software: you may copy, modify, and/or distribute this work # under the terms of the Python Software Foundation License, version 2 or # later as published by the Python Software Foundation. # No warranty expressed or implied. See the file LICENSE.PSF-2 for details. """ Lockfile behaviour implemented via Unix PID files. """ from __future__ import absolute_import import errno import os import time from . import (LockBase, AlreadyLocked, LockFailed, NotLocked, NotMyLock, LockTimeout) class PIDLockFile(LockBase): """ Lockfile implemented as a Unix PID file. The lock file is a normal file named by the attribute `path`. A lock's PID file contains a single line of text, containing the process ID (PID) of the process that acquired the lock. >>> lock = PIDLockFile('somefile') >>> lock = PIDLockFile('somefile') """ def __init__(self, path, threaded=False, timeout=None): # pid lockfiles don't support threaded operation, so always force # False as the threaded arg. LockBase.__init__(self, path, False, timeout) self.unique_name = self.path def read_pid(self): """ Get the PID from the lock file. """ return read_pid_from_pidfile(self.path) def is_locked(self): """ Test if the lock is currently held. The lock is held if the PID file for this lock exists. """ return os.path.exists(self.path) def i_am_locking(self): """ Test if the lock is held by the current process. Returns ``True`` if the current process ID matches the number stored in the PID file. """ return self.is_locked() and os.getpid() == self.read_pid() def acquire(self, timeout=None): """ Acquire the lock. Creates the PID file for this lock, or raises an error if the lock could not be acquired. """ timeout = timeout if timeout is not None else self.timeout end_time = time.time() if timeout is not None and timeout > 0: end_time += timeout while True: try: write_pid_to_pidfile(self.path) except OSError as exc: if exc.errno == errno.EEXIST: # The lock creation failed. Maybe sleep a bit. if time.time() > end_time: if timeout is not None and timeout > 0: raise LockTimeout("Timeout waiting to acquire" " lock for %s" % self.path) else: raise AlreadyLocked("%s is already locked" % self.path) time.sleep(timeout is not None and timeout / 10 or 0.1) else: raise LockFailed("failed to create %s" % self.path) else: return def release(self): """ Release the lock. Removes the PID file to release the lock, or raises an error if the current process does not hold the lock. """ if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) if not self.i_am_locking(): raise NotMyLock("%s is locked, but not by me" % self.path) remove_existing_pidfile(self.path) def break_lock(self): """ Break an existing lock. Removes the PID file if it already exists, otherwise does nothing. """ remove_existing_pidfile(self.path) def read_pid_from_pidfile(pidfile_path): """ Read the PID recorded in the named PID file. Read and return the numeric PID recorded as text in the named PID file. If the PID file cannot be read, or if the content is not a valid PID, return ``None``. """ pid = None try: pidfile = open(pidfile_path, 'r') except IOError: pass else: # According to the FHS 2.3 section on PID files in /var/run: # # The file must consist of the process identifier in # ASCII-encoded decimal, followed by a newline character. # # Programs that read PID files should be somewhat flexible # in what they accept; i.e., they should ignore extra # whitespace, leading zeroes, absence of the trailing # newline, or additional lines in the PID file. line = pidfile.readline().strip() try: pid = int(line) except ValueError: pass pidfile.close() return pid def write_pid_to_pidfile(pidfile_path): """ Write the PID in the named PID file. Get the numeric process ID (“PID”) of the current process and write it to the named file as a line of text. """ open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY) open_mode = 0o644 pidfile_fd = os.open(pidfile_path, open_flags, open_mode) pidfile = os.fdopen(pidfile_fd, 'w') # According to the FHS 2.3 section on PID files in /var/run: # # The file must consist of the process identifier in # ASCII-encoded decimal, followed by a newline character. For # example, if crond was process number 25, /var/run/crond.pid # would contain three characters: two, five, and newline. pid = os.getpid() pidfile.write("%s\n" % pid) pidfile.close() def remove_existing_pidfile(pidfile_path): """ Remove the named PID file if it exists. Removing a PID file that doesn't already exist puts us in the desired state, so we ignore the condition if the file does not exist. """ try: os.remove(pidfile_path) except OSError as exc: if exc.errno == errno.ENOENT: pass else: raise lockfile/symlinklockfile.py000064400000005070152347724720012124 0ustar00from __future__ import absolute_import import os import time from . import (LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked) class SymlinkLockFile(LockBase): """Lock access to a file using symlink(2).""" def __init__(self, path, threaded=True, timeout=None): # super(SymlinkLockFile).__init(...) LockBase.__init__(self, path, threaded, timeout) # split it back! self.unique_name = os.path.split(self.unique_name)[1] def acquire(self, timeout=None): # Hopefully unnecessary for symlink. # try: # open(self.unique_name, "wb").close() # except IOError: # raise LockFailed("failed to create %s" % self.unique_name) timeout = timeout if timeout is not None else self.timeout end_time = time.time() if timeout is not None and timeout > 0: end_time += timeout while True: # Try and create a symbolic link to it. try: os.symlink(self.unique_name, self.lock_file) except OSError: # Link creation failed. Maybe we've double-locked? if self.i_am_locking(): # Linked to out unique name. Proceed. return else: # Otherwise the lock creation failed. if timeout is not None and time.time() > end_time: if timeout > 0: raise LockTimeout("Timeout waiting to acquire" " lock for %s" % self.path) else: raise AlreadyLocked("%s is already locked" % self.path) time.sleep(timeout / 10 if timeout is not None else 0.1) else: # Link creation succeeded. We're good to go. return def release(self): if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) elif not self.i_am_locking(): raise NotMyLock("%s is locked, but not by me" % self.path) os.unlink(self.lock_file) def is_locked(self): return os.path.islink(self.lock_file) def i_am_locking(self): return (os.path.islink(self.lock_file) and os.readlink(self.lock_file) == self.unique_name) def break_lock(self): if os.path.islink(self.lock_file): # exists && link os.unlink(self.lock_file) lockfile/linklockfile.py000064400000005134152347724720011374 0ustar00from __future__ import absolute_import import time import os from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, AlreadyLocked) class LinkLockFile(LockBase): """Lock access to a file using atomic property of link(2). >>> lock = LinkLockFile('somefile') >>> lock = LinkLockFile('somefile', threaded=False) """ def acquire(self, timeout=None): try: open(self.unique_name, "wb").close() except IOError: raise LockFailed("failed to create %s" % self.unique_name) timeout = timeout if timeout is not None else self.timeout end_time = time.time() if timeout is not None and timeout > 0: end_time += timeout while True: # Try and create a hard link to it. try: os.link(self.unique_name, self.lock_file) except OSError: # Link creation failed. Maybe we've double-locked? nlinks = os.stat(self.unique_name).st_nlink if nlinks == 2: # The original link plus the one I created == 2. We're # good to go. return else: # Otherwise the lock creation failed. if timeout is not None and time.time() > end_time: os.unlink(self.unique_name) if timeout > 0: raise LockTimeout("Timeout waiting to acquire" " lock for %s" % self.path) else: raise AlreadyLocked("%s is already locked" % self.path) time.sleep(timeout is not None and timeout / 10 or 0.1) else: # Link creation succeeded. We're good to go. return def release(self): if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) elif not os.path.exists(self.unique_name): raise NotMyLock("%s is locked, but not by me" % self.path) os.unlink(self.unique_name) os.unlink(self.lock_file) def is_locked(self): return os.path.exists(self.lock_file) def i_am_locking(self): return (self.is_locked() and os.path.exists(self.unique_name) and os.stat(self.unique_name).st_nlink == 2) def break_lock(self): if os.path.exists(self.lock_file): os.unlink(self.lock_file) lockfile/__init__.py000064400000022233152347724720010464 0ustar00# -*- coding: utf-8 -*- """ lockfile.py - Platform-independent advisory file locks. Requires Python 2.5 unless you apply 2.4.diff Locking is done on a per-thread basis instead of a per-process basis. Usage: >>> lock = LockFile('somefile') >>> try: ... lock.acquire() ... except AlreadyLocked: ... print 'somefile', 'is locked already.' ... except LockFailed: ... print 'somefile', 'can\\'t be locked.' ... else: ... print 'got lock' got lock >>> print lock.is_locked() True >>> lock.release() >>> lock = LockFile('somefile') >>> print lock.is_locked() False >>> with lock: ... print lock.is_locked() True >>> print lock.is_locked() False >>> lock = LockFile('somefile') >>> # It is okay to lock twice from the same thread... >>> with lock: ... lock.acquire() ... >>> # Though no counter is kept, so you can't unlock multiple times... >>> print lock.is_locked() False Exceptions: Error - base class for other exceptions LockError - base class for all locking exceptions AlreadyLocked - Another thread or process already holds the lock LockFailed - Lock failed for some other reason UnlockError - base class for all unlocking exceptions AlreadyUnlocked - File was not locked. NotMyLock - File was locked but not by the current thread/process """ from __future__ import absolute_import import functools import os import socket import threading import warnings # Work with PEP8 and non-PEP8 versions of threading module. if not hasattr(threading, "current_thread"): threading.current_thread = threading.currentThread if not hasattr(threading.Thread, "get_name"): threading.Thread.get_name = threading.Thread.getName __all__ = ['Error', 'LockError', 'LockTimeout', 'AlreadyLocked', 'LockFailed', 'UnlockError', 'NotLocked', 'NotMyLock', 'LinkFileLock', 'MkdirFileLock', 'SQLiteFileLock', 'LockBase', 'locked'] class Error(Exception): """ Base class for other exceptions. >>> try: ... raise Error ... except Exception: ... pass """ pass class LockError(Error): """ Base class for error arising from attempts to acquire the lock. >>> try: ... raise LockError ... except Error: ... pass """ pass class LockTimeout(LockError): """Raised when lock creation fails within a user-defined period of time. >>> try: ... raise LockTimeout ... except LockError: ... pass """ pass class AlreadyLocked(LockError): """Some other thread/process is locking the file. >>> try: ... raise AlreadyLocked ... except LockError: ... pass """ pass class LockFailed(LockError): """Lock file creation failed for some other reason. >>> try: ... raise LockFailed ... except LockError: ... pass """ pass class UnlockError(Error): """ Base class for errors arising from attempts to release the lock. >>> try: ... raise UnlockError ... except Error: ... pass """ pass class NotLocked(UnlockError): """Raised when an attempt is made to unlock an unlocked file. >>> try: ... raise NotLocked ... except UnlockError: ... pass """ pass class NotMyLock(UnlockError): """Raised when an attempt is made to unlock a file someone else locked. >>> try: ... raise NotMyLock ... except UnlockError: ... pass """ pass class _SharedBase(object): def __init__(self, path): self.path = path def acquire(self, timeout=None): """ Acquire the lock. * If timeout is omitted (or None), wait forever trying to lock the file. * If timeout > 0, try to acquire the lock for that many seconds. If the lock period expires and the file is still locked, raise LockTimeout. * If timeout <= 0, raise AlreadyLocked immediately if the file is already locked. """ raise NotImplemented("implement in subclass") def release(self): """ Release the lock. If the file is not locked, raise NotLocked. """ raise NotImplemented("implement in subclass") def __enter__(self): """ Context manager support. """ self.acquire() return self def __exit__(self, *_exc): """ Context manager support. """ self.release() def __repr__(self): return "<%s: %r>" % (self.__class__.__name__, self.path) class LockBase(_SharedBase): """Base class for platform-specific lock classes.""" def __init__(self, path, threaded=True, timeout=None): """ >>> lock = LockBase('somefile') >>> lock = LockBase('somefile', threaded=False) """ super(LockBase, self).__init__(path) self.lock_file = os.path.abspath(path) + ".lock" self.hostname = socket.gethostname() self.pid = os.getpid() if threaded: t = threading.current_thread() # Thread objects in Python 2.4 and earlier do not have ident # attrs. Worm around that. ident = getattr(t, "ident", hash(t)) self.tname = "-%x" % (ident & 0xffffffff) else: self.tname = "" dirname = os.path.dirname(self.lock_file) # unique name is mostly about the current process, but must # also contain the path -- otherwise, two adjacent locked # files conflict (one file gets locked, creating lock-file and # unique file, the other one gets locked, creating lock-file # and overwriting the already existing lock-file, then one # gets unlocked, deleting both lock-file and unique file, # finally the last lock errors out upon releasing. self.unique_name = os.path.join(dirname, "%s%s.%s%s" % (self.hostname, self.tname, self.pid, hash(self.path))) self.timeout = timeout def is_locked(self): """ Tell whether or not the file is locked. """ raise NotImplemented("implement in subclass") def i_am_locking(self): """ Return True if this object is locking the file. """ raise NotImplemented("implement in subclass") def break_lock(self): """ Remove a lock. Useful if a locking thread failed to unlock. """ raise NotImplemented("implement in subclass") def __repr__(self): return "<%s: %r -- %r>" % (self.__class__.__name__, self.unique_name, self.path) def _fl_helper(cls, mod, *args, **kwds): warnings.warn("Import from %s module instead of lockfile package" % mod, DeprecationWarning, stacklevel=2) # This is a bit funky, but it's only for awhile. The way the unit tests # are constructed this function winds up as an unbound method, so it # actually takes three args, not two. We want to toss out self. if not isinstance(args[0], str): # We are testing, avoid the first arg args = args[1:] if len(args) == 1 and not kwds: kwds["threaded"] = True return cls(*args, **kwds) def LinkFileLock(*args, **kwds): """Factory function provided for backwards compatibility. Do not use in new code. Instead, import LinkLockFile from the lockfile.linklockfile module. """ from . import linklockfile return _fl_helper(linklockfile.LinkLockFile, "lockfile.linklockfile", *args, **kwds) def MkdirFileLock(*args, **kwds): """Factory function provided for backwards compatibility. Do not use in new code. Instead, import MkdirLockFile from the lockfile.mkdirlockfile module. """ from . import mkdirlockfile return _fl_helper(mkdirlockfile.MkdirLockFile, "lockfile.mkdirlockfile", *args, **kwds) def SQLiteFileLock(*args, **kwds): """Factory function provided for backwards compatibility. Do not use in new code. Instead, import SQLiteLockFile from the lockfile.mkdirlockfile module. """ from . import sqlitelockfile return _fl_helper(sqlitelockfile.SQLiteLockFile, "lockfile.sqlitelockfile", *args, **kwds) def locked(path, timeout=None): """Decorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ... """ def decor(func): @functools.wraps(func) def wrapper(*args, **kwargs): lock = FileLock(path, timeout=timeout) lock.acquire() try: return func(*args, **kwargs) finally: lock.release() return wrapper return decor if hasattr(os, "link"): from . import linklockfile as _llf LockFile = _llf.LinkLockFile else: from . import mkdirlockfile as _mlf LockFile = _mlf.MkdirLockFile FileLock = LockFile lockfile/mkdirlockfile.py000064400000006030152347724720011541 0ustar00from __future__ import absolute_import, division import time import os import sys import errno from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, AlreadyLocked) class MkdirLockFile(LockBase): """Lock file by creating a directory.""" def __init__(self, path, threaded=True, timeout=None): """ >>> lock = MkdirLockFile('somefile') >>> lock = MkdirLockFile('somefile', threaded=False) """ LockBase.__init__(self, path, threaded, timeout) # Lock file itself is a directory. Place the unique file name into # it. self.unique_name = os.path.join(self.lock_file, "%s.%s%s" % (self.hostname, self.tname, self.pid)) def acquire(self, timeout=None): timeout = timeout if timeout is not None else self.timeout end_time = time.time() if timeout is not None and timeout > 0: end_time += timeout if timeout is None: wait = 0.1 else: wait = max(0, timeout / 10) while True: try: os.mkdir(self.lock_file) except OSError: err = sys.exc_info()[1] if err.errno == errno.EEXIST: # Already locked. if os.path.exists(self.unique_name): # Already locked by me. return if timeout is not None and time.time() > end_time: if timeout > 0: raise LockTimeout("Timeout waiting to acquire" " lock for %s" % self.path) else: # Someone else has the lock. raise AlreadyLocked("%s is already locked" % self.path) time.sleep(wait) else: # Couldn't create the lock for some other reason raise LockFailed("failed to create %s" % self.lock_file) else: open(self.unique_name, "wb").close() return def release(self): if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) elif not os.path.exists(self.unique_name): raise NotMyLock("%s is locked, but not by me" % self.path) os.unlink(self.unique_name) os.rmdir(self.lock_file) def is_locked(self): return os.path.exists(self.lock_file) def i_am_locking(self): return (self.is_locked() and os.path.exists(self.unique_name)) def break_lock(self): if os.path.exists(self.lock_file): for name in os.listdir(self.lock_file): os.unlink(os.path.join(self.lock_file, name)) os.rmdir(self.lock_file) retrying.py000064400000023364152347724720007006 0ustar00## Copyright 2013-2014 Ray Holder ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, software ## distributed under the License is distributed on an "AS IS" BASIS, ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. import random from pip._vendor import six import sys import time import traceback # sys.maxint / 2, since Python 3.2 doesn't have a sys.maxint... MAX_WAIT = 1073741823 def retry(*dargs, **dkw): """ Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object """ # support both @retry and @retry() as valid syntax if len(dargs) == 1 and callable(dargs[0]): def wrap_simple(f): @six.wraps(f) def wrapped_f(*args, **kw): return Retrying().call(f, *args, **kw) return wrapped_f return wrap_simple(dargs[0]) else: def wrap(f): @six.wraps(f) def wrapped_f(*args, **kw): return Retrying(*dargs, **dkw).call(f, *args, **kw) return wrapped_f return wrap class Retrying(object): def __init__(self, stop=None, wait=None, stop_max_attempt_number=None, stop_max_delay=None, wait_fixed=None, wait_random_min=None, wait_random_max=None, wait_incrementing_start=None, wait_incrementing_increment=None, wait_exponential_multiplier=None, wait_exponential_max=None, retry_on_exception=None, retry_on_result=None, wrap_exception=False, stop_func=None, wait_func=None, wait_jitter_max=None): self._stop_max_attempt_number = 5 if stop_max_attempt_number is None else stop_max_attempt_number self._stop_max_delay = 100 if stop_max_delay is None else stop_max_delay self._wait_fixed = 1000 if wait_fixed is None else wait_fixed self._wait_random_min = 0 if wait_random_min is None else wait_random_min self._wait_random_max = 1000 if wait_random_max is None else wait_random_max self._wait_incrementing_start = 0 if wait_incrementing_start is None else wait_incrementing_start self._wait_incrementing_increment = 100 if wait_incrementing_increment is None else wait_incrementing_increment self._wait_exponential_multiplier = 1 if wait_exponential_multiplier is None else wait_exponential_multiplier self._wait_exponential_max = MAX_WAIT if wait_exponential_max is None else wait_exponential_max self._wait_jitter_max = 0 if wait_jitter_max is None else wait_jitter_max # TODO add chaining of stop behaviors # stop behavior stop_funcs = [] if stop_max_attempt_number is not None: stop_funcs.append(self.stop_after_attempt) if stop_max_delay is not None: stop_funcs.append(self.stop_after_delay) if stop_func is not None: self.stop = stop_func elif stop is None: self.stop = lambda attempts, delay: any(f(attempts, delay) for f in stop_funcs) else: self.stop = getattr(self, stop) # TODO add chaining of wait behaviors # wait behavior wait_funcs = [lambda *args, **kwargs: 0] if wait_fixed is not None: wait_funcs.append(self.fixed_sleep) if wait_random_min is not None or wait_random_max is not None: wait_funcs.append(self.random_sleep) if wait_incrementing_start is not None or wait_incrementing_increment is not None: wait_funcs.append(self.incrementing_sleep) if wait_exponential_multiplier is not None or wait_exponential_max is not None: wait_funcs.append(self.exponential_sleep) if wait_func is not None: self.wait = wait_func elif wait is None: self.wait = lambda attempts, delay: max(f(attempts, delay) for f in wait_funcs) else: self.wait = getattr(self, wait) # retry on exception filter if retry_on_exception is None: self._retry_on_exception = self.always_reject else: self._retry_on_exception = retry_on_exception # TODO simplify retrying by Exception types # retry on result filter if retry_on_result is None: self._retry_on_result = self.never_reject else: self._retry_on_result = retry_on_result self._wrap_exception = wrap_exception def stop_after_attempt(self, previous_attempt_number, delay_since_first_attempt_ms): """Stop after the previous attempt >= stop_max_attempt_number.""" return previous_attempt_number >= self._stop_max_attempt_number def stop_after_delay(self, previous_attempt_number, delay_since_first_attempt_ms): """Stop after the time from the first attempt >= stop_max_delay.""" return delay_since_first_attempt_ms >= self._stop_max_delay def no_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Don't sleep at all before retrying.""" return 0 def fixed_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a fixed amount of time between each retry.""" return self._wait_fixed def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a random amount of time between wait_random_min and wait_random_max""" return random.randint(self._wait_random_min, self._wait_random_max) def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """ Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment """ result = self._wait_incrementing_start + (self._wait_incrementing_increment * (previous_attempt_number - 1)) if result < 0: result = 0 return result def exponential_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): exp = 2 ** previous_attempt_number result = self._wait_exponential_multiplier * exp if result > self._wait_exponential_max: result = self._wait_exponential_max if result < 0: result = 0 return result def never_reject(self, result): return False def always_reject(self, result): return True def should_reject(self, attempt): reject = False if attempt.has_exception: reject |= self._retry_on_exception(attempt.value[1]) else: reject |= self._retry_on_result(attempt.value) return reject def call(self, fn, *args, **kwargs): start_time = int(round(time.time() * 1000)) attempt_number = 1 while True: try: attempt = Attempt(fn(*args, **kwargs), attempt_number, False) except: tb = sys.exc_info() attempt = Attempt(tb, attempt_number, True) if not self.should_reject(attempt): return attempt.get(self._wrap_exception) delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time if self.stop(attempt_number, delay_since_first_attempt_ms): if not self._wrap_exception and attempt.has_exception: # get() on an attempt with an exception should cause it to be raised, but raise just in case raise attempt.get() else: raise RetryError(attempt) else: sleep = self.wait(attempt_number, delay_since_first_attempt_ms) if self._wait_jitter_max: jitter = random.random() * self._wait_jitter_max sleep = sleep + max(0, jitter) time.sleep(sleep / 1000.0) attempt_number += 1 class Attempt(object): """ An Attempt encapsulates a call to a target function that may end as a normal return value from the function or an Exception depending on what occurred during the execution. """ def __init__(self, value, attempt_number, has_exception): self.value = value self.attempt_number = attempt_number self.has_exception = has_exception def get(self, wrap_exception=False): """ Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised. """ if self.has_exception: if wrap_exception: raise RetryError(self) else: six.reraise(self.value[0], self.value[1], self.value[2]) else: return self.value def __repr__(self): if self.has_exception: return "Attempts: {0}, Error:\n{1}".format(self.attempt_number, "".join(traceback.format_tb(self.value[2]))) else: return "Attempts: {0}, Value: {1}".format(self.attempt_number, self.value) class RetryError(Exception): """ A RetryError encapsulates the last Attempt instance right before giving up. """ def __init__(self, last_attempt): self.last_attempt = last_attempt def __str__(self): return "RetryError[{0}]".format(self.last_attempt) appdirs.py000064400000062463152347724720006610 0ustar00#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2005-2010 ActiveState Software Inc. # Copyright (c) 2013 Eddy Petrișor """Utilities for determining application-specific dirs. See for details and usage. """ # Dev Notes: # - MSDN on where to store app data files: # http://support.microsoft.com/default.aspx?scid=kb;en-us;310294#XSLTH3194121123120121120120 # - Mac OS X: http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/index.html # - XDG spec for Un*x: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html __version__ = "1.4.4" __version_info__ = tuple(int(segment) for segment in __version__.split(".")) import sys import os PY3 = sys.version_info[0] == 3 if PY3: unicode = str if sys.platform.startswith('java'): import platform os_name = platform.java_ver()[3][0] if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc. system = 'win32' elif os_name.startswith('Mac'): # "Mac OS X", etc. system = 'darwin' else: # "Linux", "SunOS", "FreeBSD", etc. # Setting this to "linux2" is not ideal, but only Windows or Mac # are actually checked for and the rest of the module expects # *sys.platform* style strings. system = 'linux2' elif sys.platform == 'cli' and os.name == 'nt': # Detect Windows in IronPython to match pip._internal.utils.compat.WINDOWS # Discussion: system = 'win32' else: system = sys.platform def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: Mac OS X: ~/Library/Application Support/ # or ~/.config/, if the other does not exist Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined Win XP (not roaming): C:\Documents and Settings\\Application Data\\ Win XP (roaming): C:\Documents and Settings\\Local Settings\Application Data\\ Win 7 (not roaming): C:\Users\\AppData\Local\\ Win 7 (roaming): C:\Users\\AppData\Roaming\\ For Unix, we follow the XDG spec and support $XDG_DATA_HOME. That means, by default "~/.local/share/". """ if system == "win32": if appauthor is None: appauthor = appname const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA" path = os.path.normpath(_get_win_folder(const)) if appname: if appauthor is not False: path = os.path.join(path, appauthor, appname) else: path = os.path.join(path, appname) elif system == 'darwin': path = os.path.expanduser('~/Library/Application Support/') if appname: path = os.path.join(path, appname) else: path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share")) if appname: path = os.path.join(path, appname) if appname and version: path = os.path.join(path, version) return path def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of data dirs should be returned. By default, the first item from XDG_DATA_DIRS is returned, or '/usr/local/share/', if XDG_DATA_DIRS is not set Typical site data directories are: Mac OS X: /Library/Application Support/ Unix: /usr/local/share/ or /usr/share/ Win XP: C:\Documents and Settings\All Users\Application Data\\ Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) Win 7: C:\ProgramData\\ # Hidden, but writeable on Win 7. For Unix, this is using the $XDG_DATA_DIRS[0] default. WARNING: Do not use this on Windows. See the Vista-Fail note above for why. """ if system == "win32": if appauthor is None: appauthor = appname path = os.path.normpath(_get_win_folder("CSIDL_COMMON_APPDATA")) if appname: if appauthor is not False: path = os.path.join(path, appauthor, appname) else: path = os.path.join(path, appname) elif system == 'darwin': path = os.path.expanduser('/Library/Application Support') if appname: path = os.path.join(path, appname) else: # XDG default for $XDG_DATA_DIRS # only first, if multipath is False path = os.getenv('XDG_DATA_DIRS', os.pathsep.join(['/usr/local/share', '/usr/share'])) pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)] if appname: if version: appname = os.path.join(appname, version) pathlist = [os.path.join(x, appname) for x in pathlist] if multipath: path = os.pathsep.join(pathlist) else: path = pathlist[0] return path if appname and version: path = os.path.join(path, version) return path def user_config_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific config dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user config directories are: Mac OS X: same as user_data_dir Unix: ~/.config/ # or in $XDG_CONFIG_HOME, if defined Win *: same as user_data_dir For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. That means, by default "~/.config/". """ if system in ["win32", "darwin"]: path = user_data_dir(appname, appauthor, None, roaming) else: path = os.getenv('XDG_CONFIG_HOME', os.path.expanduser("~/.config")) if appname: path = os.path.join(path, appname) if appname and version: path = os.path.join(path, version) return path # for the discussion regarding site_config_dir locations # see def site_config_dir(appname=None, appauthor=None, version=None, multipath=False): r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of config dirs should be returned. By default, the first item from XDG_CONFIG_DIRS is returned, or '/etc/xdg/', if XDG_CONFIG_DIRS is not set Typical site config directories are: Mac OS X: same as site_data_dir Unix: /etc/xdg/ or $XDG_CONFIG_DIRS[i]/ for each value in $XDG_CONFIG_DIRS Win *: same as site_data_dir Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False WARNING: Do not use this on Windows. See the Vista-Fail note above for why. """ if system in ["win32", "darwin"]: path = site_data_dir(appname, appauthor) if appname and version: path = os.path.join(path, version) else: # XDG default for $XDG_CONFIG_DIRS (missing or empty) # see # only first, if multipath is False path = os.getenv('XDG_CONFIG_DIRS') or '/etc/xdg' pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep) if x] if appname: if version: appname = os.path.join(appname, version) pathlist = [os.path.join(x, appname) for x in pathlist] if multipath: path = os.pathsep.join(pathlist) else: path = pathlist[0] return path def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True): r"""Return full path to the user-specific cache dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Cache" to the base app data dir for Windows. See discussion below. Typical user cache directories are: Mac OS X: ~/Library/Caches/ Unix: ~/.cache/ (XDG default) Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Cache Vista: C:\Users\\AppData\Local\\\Cache On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming app data dir (the default returned by `user_data_dir` above). Apps typically put cache data somewhere *under* the given dir here. Some examples: ...\Mozilla\Firefox\Profiles\\Cache ...\Acme\SuperApp\Cache\1.0 OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value. This can be disabled with the `opinion=False` option. """ if system == "win32": if appauthor is None: appauthor = appname path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA")) # When using Python 2, return paths as bytes on Windows like we do on # other operating systems. See helper function docs for more details. if not PY3 and isinstance(path, unicode): path = _win_path_to_bytes(path) if appname: if appauthor is not False: path = os.path.join(path, appauthor, appname) else: path = os.path.join(path, appname) if opinion: path = os.path.join(path, "Cache") elif system == 'darwin': path = os.path.expanduser('~/Library/Caches') if appname: path = os.path.join(path, appname) else: path = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache')) if appname: path = os.path.join(path, appname) if appname and version: path = os.path.join(path, version) return path def user_state_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific state dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user state directories are: Mac OS X: same as user_data_dir Unix: ~/.local/state/ # or in $XDG_STATE_HOME, if defined Win *: same as user_data_dir For Unix, we follow this Debian proposal to extend the XDG spec and support $XDG_STATE_HOME. That means, by default "~/.local/state/". """ if system in ["win32", "darwin"]: path = user_data_dir(appname, appauthor, None, roaming) else: path = os.getenv('XDG_STATE_HOME', os.path.expanduser("~/.local/state")) if appname: path = os.path.join(path, appname) if appname and version: path = os.path.join(path, version) return path def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): r"""Return full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Logs" to the base app data dir for Windows, and "log" to the base cache dir for Unix. See discussion below. Typical user log directories are: Mac OS X: ~/Library/Logs/ Unix: ~/.cache//log # or under $XDG_CACHE_HOME if defined Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Logs Vista: C:\Users\\AppData\Local\\\Logs On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in examples of what some windows apps use for a logs dir.) OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA` value for Windows and appends "log" to the user cache dir for Unix. This can be disabled with the `opinion=False` option. """ if system == "darwin": path = os.path.join( os.path.expanduser('~/Library/Logs'), appname) elif system == "win32": path = user_data_dir(appname, appauthor, version) version = False if opinion: path = os.path.join(path, "Logs") else: path = user_cache_dir(appname, appauthor, version) version = False if opinion: path = os.path.join(path, "log") if appname and version: path = os.path.join(path, version) return path class AppDirs(object): """Convenience wrapper for getting application dirs.""" def __init__(self, appname=None, appauthor=None, version=None, roaming=False, multipath=False): self.appname = appname self.appauthor = appauthor self.version = version self.roaming = roaming self.multipath = multipath @property def user_data_dir(self): return user_data_dir(self.appname, self.appauthor, version=self.version, roaming=self.roaming) @property def site_data_dir(self): return site_data_dir(self.appname, self.appauthor, version=self.version, multipath=self.multipath) @property def user_config_dir(self): return user_config_dir(self.appname, self.appauthor, version=self.version, roaming=self.roaming) @property def site_config_dir(self): return site_config_dir(self.appname, self.appauthor, version=self.version, multipath=self.multipath) @property def user_cache_dir(self): return user_cache_dir(self.appname, self.appauthor, version=self.version) @property def user_state_dir(self): return user_state_dir(self.appname, self.appauthor, version=self.version) @property def user_log_dir(self): return user_log_dir(self.appname, self.appauthor, version=self.version) #---- internal support stuff def _get_win_folder_from_registry(csidl_name): """This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. """ if PY3: import winreg as _winreg else: import _winreg shell_folder_name = { "CSIDL_APPDATA": "AppData", "CSIDL_COMMON_APPDATA": "Common AppData", "CSIDL_LOCAL_APPDATA": "Local AppData", }[csidl_name] key = _winreg.OpenKey( _winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" ) dir, type = _winreg.QueryValueEx(key, shell_folder_name) return dir def _get_win_folder_with_pywin32(csidl_name): from win32com.shell import shellcon, shell dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0) # Try to make this a unicode path because SHGetFolderPath does # not return unicode strings when there is unicode data in the # path. try: dir = unicode(dir) # Downgrade to short path name if have highbit chars. See # . has_high_char = False for c in dir: if ord(c) > 255: has_high_char = True break if has_high_char: try: import win32api dir = win32api.GetShortPathName(dir) except ImportError: pass except UnicodeError: pass return dir def _get_win_folder_with_ctypes(csidl_name): import ctypes csidl_const = { "CSIDL_APPDATA": 26, "CSIDL_COMMON_APPDATA": 35, "CSIDL_LOCAL_APPDATA": 28, }[csidl_name] buf = ctypes.create_unicode_buffer(1024) ctypes.windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf) # Downgrade to short path name if have highbit chars. See # . has_high_char = False for c in buf: if ord(c) > 255: has_high_char = True break if has_high_char: buf2 = ctypes.create_unicode_buffer(1024) if ctypes.windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024): buf = buf2 return buf.value def _get_win_folder_with_jna(csidl_name): import array from com.sun import jna from com.sun.jna.platform import win32 buf_size = win32.WinDef.MAX_PATH * 2 buf = array.zeros('c', buf_size) shell = win32.Shell32.INSTANCE shell.SHGetFolderPath(None, getattr(win32.ShlObj, csidl_name), None, win32.ShlObj.SHGFP_TYPE_CURRENT, buf) dir = jna.Native.toString(buf.tostring()).rstrip("\0") # Downgrade to short path name if have highbit chars. See # . has_high_char = False for c in dir: if ord(c) > 255: has_high_char = True break if has_high_char: buf = array.zeros('c', buf_size) kernel = win32.Kernel32.INSTANCE if kernel.GetShortPathName(dir, buf, buf_size): dir = jna.Native.toString(buf.tostring()).rstrip("\0") return dir if system == "win32": try: from ctypes import windll _get_win_folder = _get_win_folder_with_ctypes except ImportError: try: import com.sun.jna _get_win_folder = _get_win_folder_with_jna except ImportError: _get_win_folder = _get_win_folder_from_registry def _win_path_to_bytes(path): """Encode Windows paths to bytes. Only used on Python 2. Motivation is to be consistent with other operating systems where paths are also returned as bytes. This avoids problems mixing bytes and Unicode elsewhere in the codebase. For more details and discussion see . If encoding using ASCII and MBCS fails, return the original Unicode path. """ for encoding in ('ASCII', 'MBCS'): try: return path.encode(encoding) except (UnicodeEncodeError, LookupError): pass return path #---- self test code if __name__ == "__main__": appname = "MyApp" appauthor = "MyCompany" props = ("user_data_dir", "user_config_dir", "user_cache_dir", "user_state_dir", "user_log_dir", "site_data_dir", "site_config_dir") print("-- app dirs %s --" % __version__) print("-- app dirs (with optional 'version')") dirs = AppDirs(appname, appauthor, version="1.0") for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) print("\n-- app dirs (without optional 'version')") dirs = AppDirs(appname, appauthor) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) print("\n-- app dirs (without optional 'appauthor')") dirs = AppDirs(appname) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) print("\n-- app dirs (with disabled 'appauthor')") dirs = AppDirs(appname, appauthor=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) webencodings/__pycache__/labels.cpython-36.opt-1.pyc000064400000007646152347724720016304 0ustar003 Pf#@sdZddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd 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 dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd 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*Zd+S),z webencodings.labels ~~~~~~~~~~~~~~~~~~~ Map encoding labels to their name. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. zutf-8ibm866z iso-8859-2z iso-8859-3z iso-8859-4z iso-8859-5z iso-8859-6z iso-8859-7z iso-8859-8z iso-8859-8-iz iso-8859-10z iso-8859-13z iso-8859-14z iso-8859-15z iso-8859-16zkoi8-rzkoi8-u macintoshz windows-874z windows-1250z windows-1251z windows-1252z windows-1253z windows-1254z windows-1255z windows-1256z windows-1257z windows-1258zx-mac-cyrillicgbkgb18030z hz-gb-2312big5zeuc-jpz iso-2022-jp shift_jiszeuc-krz iso-2022-krzutf-16bezutf-16lezx-user-defined)zunicode-1-1-utf-8zutf-8utf8866cp866csibm866r csisolatin2z iso-8859-2z iso-ir-101z iso8859-2Ziso88592z iso_8859-2ziso_8859-2:1987l2latin2 csisolatin3z iso-8859-3z iso-ir-109z iso8859-3Ziso88593z iso_8859-3ziso_8859-3:1988l3latin3 csisolatin4z iso-8859-4z iso-ir-110z iso8859-4Ziso88594z iso_8859-4ziso_8859-4:1988l4latin4csisolatincyrilliccyrillicz iso-8859-5z iso-ir-144z iso8859-5Ziso88595z iso_8859-5ziso_8859-5:1988arabiczasmo-708Z csiso88596eZ csiso88596icsisolatinarabiczecma-114z iso-8859-6z iso-8859-6-ez iso-8859-6-iz iso-ir-127z iso8859-6Ziso88596z iso_8859-6ziso_8859-6:1987csisolatingreekzecma-118elot_928greekgreek8z iso-8859-7z iso-ir-126z iso8859-7Ziso88597z iso_8859-7ziso_8859-7:1987Z sun_eu_greekZ csiso88598ecsisolatinhebrewhebrewz iso-8859-8z iso-8859-8-ez iso-ir-138z iso8859-8Ziso88598z iso_8859-8ziso_8859-8:1988ZvisualZ csiso88598iz iso-8859-8-iZlogical csisolatin6z iso-8859-10z iso-ir-157z iso8859-10Z iso885910l6latin6z iso-8859-13z iso8859-13Z iso885913z iso-8859-14z iso8859-14Z iso885914Z csisolatin9z iso-8859-15z iso8859-15Z iso885915z iso_8859-15l9z iso-8859-16cskoi8rZkoiZkoi8zkoi8-rkoi8_rzkoi8-uZ csmacintoshZmacrz x-mac-romanzdos-874z iso-8859-11z iso8859-11Z iso885911ztis-620z windows-874cp1250z windows-1250zx-cp1250cp1251z windows-1251zx-cp1251zansi_x3.4-1968asciicp1252cp819 csisolatin1ibm819z iso-8859-1z iso-ir-100z iso8859-1Ziso88591z iso_8859-1ziso_8859-1:1987l1latin1zus-asciiz windows-1252zx-cp1252cp1253z windows-1253zx-cp1253cp1254 csisolatin5z iso-8859-9z iso-ir-148z iso8859-9Ziso88599z iso_8859-9ziso_8859-9:1989l5latin5z windows-1254zx-cp1254cp1255z windows-1255zx-cp1255cp1256z windows-1256zx-cp1256cp1257z windows-1257zx-cp1257cp1258z windows-1258zx-cp1258zx-mac-cyrilliczx-mac-ukrainianchineseZcsgb2312csiso58gb231280gb2312Zgb_2312z gb_2312-80rz iso-ir-58zx-gbkrz hz-gb-2312rz big5-hkscszcn-big5csbig5zx-x-big5Zcseucpkdfmtjapanesezeuc-jpzx-euc-jp csiso2022jpz iso-2022-jp csshiftjisms_kanjiz shift-jisrsjisz windows-31jzx-sjisZcseuckrZ csksc56011987zeuc-krz iso-ir-149koreanzks_c_5601-1987zks_c_5601-1989ksc5601Zksc_5601z windows-949 csiso2022krz iso-2022-krzutf-16bezutf-16zutf-16lezx-user-definedN)__doc__ZLABELSrBrB/usr/lib/python3.6/labels.py swebencodings/__pycache__/x_user_defined.cpython-36.opt-1.pyc000064400000005025152347724720020012 0ustar003 Pf @sdZddlmZddlZGdddejZGdddejZGdd d ejZGd d d eejZGd d d eejZej dej ej eeeedZ dZ eje ZdS)z webencodings.x_user_defined ~~~~~~~~~~~~~~~~~~~~~~~~~~~ An implementation of the x-user-defined encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. )unicode_literalsNc@s eZdZdddZdddZdS) CodecstrictcCstj||tS)N)codecscharmap_encodeencoding_table)selfinputerrorsr $/usr/lib/python3.6/x_user_defined.pyencodesz Codec.encodecCstj||tS)N)rcharmap_decodedecoding_table)rr r r r r decodesz Codec.decodeN)r)r)__name__ __module__ __qualname__r rr r r r rs rc@seZdZdddZdS)IncrementalEncoderFcCstj||jtdS)Nr)rrr r)rr finalr r r r szIncrementalEncoder.encodeN)F)rrrr r r r r rsrc@seZdZdddZdS)IncrementalDecoderFcCstj||jtdS)Nr)rrr r)rr rr r r r$szIncrementalDecoder.decodeN)F)rrrrr r r r r#src@s eZdZdS) StreamWriterN)rrrr r r r r(src@s eZdZdS) StreamReaderN)rrrr r r r r,srzx-user-defined)namer rincrementalencoderincrementaldecoder streamreader streamwriteru  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~)__doc__Z __future__rrrrrrr CodecInfor rZ codec_infor charmap_buildrr r r r  s&   webencodings/__pycache__/mklabels.cpython-36.pyc000064400000003444152347724720015665 0ustar003 Pf @sfdZddlZyddlmZWn ek r<ddlmZYnXddZddZedkrbe ed dS) z webencodings.mklabels ~~~~~~~~~~~~~~~~~~~~~ Regenarate the webencodings.labels module. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. N)urlopencCs||jkst|S)N)lowerAssertionError)stringr/usr/lib/python3.6/mklabels.py assert_lowersrcsfdg}ddtjt|jjdD}tdd|D|jfdd|D|jdd j|S) Na""" webencodings.labels ~~~~~~~~~~~~~~~~~~~ Map encoding labels to their name. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ # XXX Do not edit! # This file is automatically generated by mklabels.py LABELS = { cSsLg|]D}|dD]6}|dD](}tt|jdt|djdfqqqS)Z encodingslabelsuname)reprrlstrip).0categoryencodinglabelrrr -s zgenerate..asciicss|]\}}t|VqdS)N)len)rrr rrr 2szgenerate..c3s,|]$\}}d|dt||fVqdS)z %s:%s %s,  N)r)rrr )max_lenrrr4s}) jsonloadsrreaddecodemaxextendappendjoin)Zurlpartsr r)rrgenerates   r#__main__z.http://encoding.spec.whatwg.org/encodings.json) __doc__rZurllibr ImportErrorZurllib.requestrr#__name__printrrrr s!webencodings/__pycache__/tests.cpython-36.opt-1.pyc000064400000004443152347724720016174 0ustar003 Pf@sdZddlmZddlmZmZmZmZmZm Z m Z m Z m Z ddZ ddZd d Zd d Zd dZddZddZddZddZdS)z webencodings.tests ~~~~~~~~~~~~~~~~~~ A basic test suite for Encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. )unicode_literals) lookupLABELSdecodeencode iter_decode iter_encodeIncrementalDecoderIncrementalEncoderUTF8c Os4y|||Wn|k r"dSXtd|dS)NzDid not raise %s.)AssertionError)Z exceptionZfunctionargskwargsr/usr/lib/python3.6/tests.py assert_raisess rcCsdS)Nrrrrr test_labelssrcCsZx>tD]6}x dD]}tdg||\}}qWt|}t|}qWxttjD]}qNWdS)Nrr )rrr)rrr r setvalues)Zlabelrepeatoutput_decoderencodernamerrrtest_all_labels0s  rcCsTtttddtttddtttgdtttgdtttdtttddS)NséZinvalidé)r LookupErrorrrrr r r rrrrtest_invalid_labelCs  r!cCsdS)Nrrrrr test_decodeLsr"cCsdS)Nrrrrr test_encodebsr#cCs dd}dS)NcSst||\}}dj|S)N)rjoin)inputZfallback_encodingrZ _encodingrrriter_decode_to_stringlsz/test_iter_decode..iter_decode_to_stringr)r'rrrtest_iter_decodeksr(cCsdS)Nrrrrrtest_iter_encodesr)cCsd}d}d}d}dS)Ns2, O#ɻtϨu2, O#tsaaZaar)ZencodedZdecodedrrrtest_x_user_defineds r*N)__doc__Z __future__rr$rrrrrr r r r rrrr!r"r#r(r)r*rrrr s ,    webencodings/__pycache__/tests.cpython-36.pyc000064400000011570152347724720015234 0ustar003 Pf@sdZddlmZddlmZmZmZmZmZm Z m Z m Z m Z ddZ ddZd d Zd d Zd dZddZddZddZddZdS)z webencodings.tests ~~~~~~~~~~~~~~~~~~ A basic test suite for Encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. )unicode_literals) lookupLABELSdecodeencode iter_decode iter_encodeIncrementalDecoderIncrementalEncoderUTF8c Os4y|||Wn|k r"dSXtd|dS)NzDid not raise %s.)AssertionError)Z exceptionZfunctionargskwargsr/usr/lib/python3.6/tests.py assert_raisess rcCs tdjdksttdjdks$ttdjdks6ttdjdksHttdjdksZttdjdkslttdjdks~ttddksttddksttd jd ksttd jd ksttd jd ksttd jd ksttddksttddkstdS)Nzutf-8zUtf-8zUTF-8utf8zutf8 z utf8 u8uutf-8 zUS-ASCIIz windows-1252z iso-8859-1latin1ZLATIN1zlatin-1uLATİN1)rnamer rrrr test_labelssrcCsxtD]}td|dt|fks$ttd|dks6txLdD]D}tdg||\}}t|gksdtttdg||gks.iter_decode_to_stringrrrr+r%shelloZhellosheslloshelloséuésésaua�ssuï»sssshzx-user-defineduhllo)r )r/rrrtest_iter_decodeks.r7cCsdjtgddkstdjtdgddks2tdjtdgddksLtdjtddddgddksltdjtddddgddkstdjtddddgddkstdjtddddgd d kstdjtdd dd gd dkstdS)Nrrrr%r+zutf-16szutf-16lezutf-16besuhZllozx-user-definedshllo)r-r r rrrrtest_iter_encodes    r8cCs@d}d}d}d}t|d|tdfks*tt|d|ks s ,    webencodings/__pycache__/__init__.cpython-36.pyc000064400000022570152347724720015633 0ustar003 PfP)@sdZddlmZddlZddlmZdZddd d d ZiZd d Z ddZ ddZ Gddde Z e dZe dZe dZd+ddZddZedfddZd,dd Zd!d"Zedfd#d$Zd%d&ZGd'd(d(e ZGd)d*d*e ZdS)-a webencodings ~~~~~~~~~~~~ This is a Python implementation of the `WHATWG Encoding standard `. See README for details. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. )unicode_literalsN)LABELSz0.5z iso-8859-8z mac-cyrillicz mac-romanZcp874)z iso-8859-8-izx-mac-cyrillic macintoshz windows-874cCs|jdjjdS)a9Transform (only) ASCII letters to lower case: A-Z is mapped to a-z. :param string: An Unicode string. :returns: A new Unicode string. This is used for `ASCII case-insensitive `_ matching of encoding labels. The same matching is also used, among other things, for `CSS keywords `_. This is different from the :meth:`~py:str.lower` method of Unicode strings which also affect non-ASCII characters, sometimes mapping them into the ASCII range: >>> keyword = u'Bac\N{KELVIN SIGN}ground' >>> assert keyword.lower() == u'background' >>> assert ascii_lower(keyword) != keyword.lower() >>> assert ascii_lower(keyword) == u'bac\N{KELVIN SIGN}ground' utf8)encodelowerdecode)stringr /usr/lib/python3.6/__init__.py ascii_lower#sr cCsxt|jd}tj|}|dkr$dStj|}|dkrt|dkrLddlm}ntj||}tj |}t ||}|t|<|S)u< Look for an encoding by its label. This is the spec’s `get an encoding `_ algorithm. Supported labels are listed there. :param label: A string. :returns: An :class:`Encoding` object, or :obj:`None` for an unknown label. z Nzx-user-definedr) codec_info) r striprgetCACHEZx_user_definedr PYTHON_NAMEScodecslookupEncoding)ZlabelnameencodingrZ python_namer r r r=s      rcCs.t|dr|St|}|dkr*td||S)z Accept either an encoding object or label. :param encoding: An :class:`Encoding` object or a label string. :returns: An :class:`Encoding` object. :raises: :exc:`~exceptions.LookupError` for an unknown label. rNzUnknown encoding label: %r)hasattrr LookupError)Zencoding_or_labelrr r r _get_encoding[s  rc@s eZdZdZddZddZdS)raOReresents a character encoding such as UTF-8, that can be used for decoding or encoding. .. attribute:: name Canonical name of the encoding .. attribute:: codec_info The actual implementation of the encoding, a stdlib :class:`~codecs.CodecInfo` object. See :func:`codecs.register`. cCs||_||_dS)N)rr)selfrrr r r __init__|szEncoding.__init__cCs d|jS)Nz )r)rr r r __repr__szEncoding.__repr__N)__name__ __module__ __qualname____doc__rrr r r r rmsrzutf-8zutf-16lezutf-16bereplacecCs2t|}t|\}}|p|}|jj||d|fS)a Decode a single string. :param input: A byte string :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :return: A ``(output, encoding)`` tuple of an Unicode string and an :obj:`Encoding`. r)r _detect_bomrr )inputfallback_encodingerrorsZ bom_encodingrr r r r s r cCsV|jdrt|ddfS|jdr4t|ddfS|jdrNt|ddfSd|fS)zBReturn (bom_encoding, input), with any BOM removed from the input.sNss) startswith_UTF16LE_UTF16BEUTF8)r$r r r r#s   r#strictcCst|jj||dS)a; Encode a single string. :param input: An Unicode string. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :return: A byte string. r)rrr)r$rr&r r r rs rcCs$t||}t||}t|}||fS)a "Pull"-based decoder. :param input: An iterable of byte strings. The input is first consumed just enough to determine the encoding based on the precense of a BOM, then consumed on demand when the return value is. :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An ``(output, encoding)`` tuple. :obj:`output` is an iterable of Unicode strings, :obj:`encoding` is the :obj:`Encoding` that is being used. )IncrementalDecoder_iter_decode_generatornext)r$r%r&decoder generatorrr r r iter_decodes  r3ccs|j}t|}xf|D].}||}|r|jdk s2t|jV|VPqW|ddd}|jdk s`t|jV|rr|VdSx|D]}||}|r||Vq|W|ddd}|r|VdS)zqReturn a generator that first yields the :obj:`Encoding`, then yields output chukns as Unicode strings. NT)final)r iterrAssertionError)r$r1r chunckoutputr r r r/s,     r/cCst||j}t||S)uY “Pull”-based encoder. :param input: An iterable of Unicode strings. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An iterable of byte strings. )IncrementalEncoderr_iter_encode_generator)r$rr&rr r r iter_encodes r<ccs:x|D]}||}|r|VqW|ddd}|r6|VdS)NT)r5r )r$rr8r9r r r r;s   r;c@s$eZdZdZd ddZd ddZdS) r.uO “Push”-based decoder. :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. r"cCs&t||_||_d|_d|_d|_dS)Nr4)r_fallback_encoding_errors_buffer_decoderr)rr%r&r r r rs  zIncrementalDecoder.__init__FcCs~|j}|dk r|||S|j|}t|\}}|dkrXt|dkrR| rR||_dS|j}|jj|jj}||_||_ |||S)zDecode one chunk of the input. :param input: A byte string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: An Unicode string. Nr(r=) rAr@r#lenr>rincrementaldecoderr?r r)rr$r5r1rr r r r 's    zIncrementalDecoder.decodeN)r")F)rrr r!rr r r r r r.s  r.c@seZdZdZedfddZdS)r:u “Push”-based encoder. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. .. method:: encode(input, final=False) :param input: An Unicode string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: A byte string. r-cCst|}|jj|j|_dS)N)rrincrementalencoderr)rrr&r r r rTszIncrementalEncoder.__init__N)rrr r!r,rr r r r r:Csr:)r")r")r!Z __future__rrZlabelsrVERSIONrrr rrobjectrr,r*r+r r#rr3r/r<r;r.r:r r r r  s2       3webencodings/__pycache__/labels.cpython-36.pyc000064400000007646152347724720015345 0ustar003 Pf#@sdZddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd 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 dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd 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*Zd+S),z webencodings.labels ~~~~~~~~~~~~~~~~~~~ Map encoding labels to their name. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. zutf-8ibm866z iso-8859-2z iso-8859-3z iso-8859-4z iso-8859-5z iso-8859-6z iso-8859-7z iso-8859-8z iso-8859-8-iz iso-8859-10z iso-8859-13z iso-8859-14z iso-8859-15z iso-8859-16zkoi8-rzkoi8-u macintoshz windows-874z windows-1250z windows-1251z windows-1252z windows-1253z windows-1254z windows-1255z windows-1256z windows-1257z windows-1258zx-mac-cyrillicgbkgb18030z hz-gb-2312big5zeuc-jpz iso-2022-jp shift_jiszeuc-krz iso-2022-krzutf-16bezutf-16lezx-user-defined)zunicode-1-1-utf-8zutf-8utf8866cp866csibm866r csisolatin2z iso-8859-2z iso-ir-101z iso8859-2Ziso88592z iso_8859-2ziso_8859-2:1987l2latin2 csisolatin3z iso-8859-3z iso-ir-109z iso8859-3Ziso88593z iso_8859-3ziso_8859-3:1988l3latin3 csisolatin4z iso-8859-4z iso-ir-110z iso8859-4Ziso88594z iso_8859-4ziso_8859-4:1988l4latin4csisolatincyrilliccyrillicz iso-8859-5z iso-ir-144z iso8859-5Ziso88595z iso_8859-5ziso_8859-5:1988arabiczasmo-708Z csiso88596eZ csiso88596icsisolatinarabiczecma-114z iso-8859-6z iso-8859-6-ez iso-8859-6-iz iso-ir-127z iso8859-6Ziso88596z iso_8859-6ziso_8859-6:1987csisolatingreekzecma-118elot_928greekgreek8z iso-8859-7z iso-ir-126z iso8859-7Ziso88597z iso_8859-7ziso_8859-7:1987Z sun_eu_greekZ csiso88598ecsisolatinhebrewhebrewz iso-8859-8z iso-8859-8-ez iso-ir-138z iso8859-8Ziso88598z iso_8859-8ziso_8859-8:1988ZvisualZ csiso88598iz iso-8859-8-iZlogical csisolatin6z iso-8859-10z iso-ir-157z iso8859-10Z iso885910l6latin6z iso-8859-13z iso8859-13Z iso885913z iso-8859-14z iso8859-14Z iso885914Z csisolatin9z iso-8859-15z iso8859-15Z iso885915z iso_8859-15l9z iso-8859-16cskoi8rZkoiZkoi8zkoi8-rkoi8_rzkoi8-uZ csmacintoshZmacrz x-mac-romanzdos-874z iso-8859-11z iso8859-11Z iso885911ztis-620z windows-874cp1250z windows-1250zx-cp1250cp1251z windows-1251zx-cp1251zansi_x3.4-1968asciicp1252cp819 csisolatin1ibm819z iso-8859-1z iso-ir-100z iso8859-1Ziso88591z iso_8859-1ziso_8859-1:1987l1latin1zus-asciiz windows-1252zx-cp1252cp1253z windows-1253zx-cp1253cp1254 csisolatin5z iso-8859-9z iso-ir-148z iso8859-9Ziso88599z iso_8859-9ziso_8859-9:1989l5latin5z windows-1254zx-cp1254cp1255z windows-1255zx-cp1255cp1256z windows-1256zx-cp1256cp1257z windows-1257zx-cp1257cp1258z windows-1258zx-cp1258zx-mac-cyrilliczx-mac-ukrainianchineseZcsgb2312csiso58gb231280gb2312Zgb_2312z gb_2312-80rz iso-ir-58zx-gbkrz hz-gb-2312rz big5-hkscszcn-big5csbig5zx-x-big5Zcseucpkdfmtjapanesezeuc-jpzx-euc-jp csiso2022jpz iso-2022-jp csshiftjisms_kanjiz shift-jisrsjisz windows-31jzx-sjisZcseuckrZ csksc56011987zeuc-krz iso-ir-149koreanzks_c_5601-1987zks_c_5601-1989ksc5601Zksc_5601z windows-949 csiso2022krz iso-2022-krzutf-16bezutf-16zutf-16lezx-user-definedN)__doc__ZLABELSrBrB/usr/lib/python3.6/labels.py swebencodings/__pycache__/x_user_defined.cpython-36.pyc000064400000005025152347724720017053 0ustar003 Pf @sdZddlmZddlZGdddejZGdddejZGdd d ejZGd d d eejZGd d d eejZej dej ej eeeedZ dZ eje ZdS)z webencodings.x_user_defined ~~~~~~~~~~~~~~~~~~~~~~~~~~~ An implementation of the x-user-defined encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. )unicode_literalsNc@s eZdZdddZdddZdS) CodecstrictcCstj||tS)N)codecscharmap_encodeencoding_table)selfinputerrorsr $/usr/lib/python3.6/x_user_defined.pyencodesz Codec.encodecCstj||tS)N)rcharmap_decodedecoding_table)rr r r r r decodesz Codec.decodeN)r)r)__name__ __module__ __qualname__r rr r r r rs rc@seZdZdddZdS)IncrementalEncoderFcCstj||jtdS)Nr)rrr r)rr finalr r r r szIncrementalEncoder.encodeN)F)rrrr r r r r rsrc@seZdZdddZdS)IncrementalDecoderFcCstj||jtdS)Nr)rrr r)rr rr r r r$szIncrementalDecoder.decodeN)F)rrrrr r r r r#src@s eZdZdS) StreamWriterN)rrrr r r r r(src@s eZdZdS) StreamReaderN)rrrr r r r r,srzx-user-defined)namer rincrementalencoderincrementaldecoder streamreader streamwriteru  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~)__doc__Z __future__rrrrrrr CodecInfor rZ codec_infor charmap_buildrr r r r  s&   webencodings/__pycache__/__init__.cpython-36.opt-1.pyc000064400000022510152347724720016564 0ustar003 PfP)@sdZddlmZddlZddlmZdZddd d d ZiZd d Z ddZ ddZ Gddde Z e dZe dZe dZd+ddZddZedfddZd,dd Zd!d"Zedfd#d$Zd%d&ZGd'd(d(e ZGd)d*d*e ZdS)-a webencodings ~~~~~~~~~~~~ This is a Python implementation of the `WHATWG Encoding standard `. See README for details. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. )unicode_literalsN)LABELSz0.5z iso-8859-8z mac-cyrillicz mac-romanZcp874)z iso-8859-8-izx-mac-cyrillic macintoshz windows-874cCs|jdjjdS)a9Transform (only) ASCII letters to lower case: A-Z is mapped to a-z. :param string: An Unicode string. :returns: A new Unicode string. This is used for `ASCII case-insensitive `_ matching of encoding labels. The same matching is also used, among other things, for `CSS keywords `_. This is different from the :meth:`~py:str.lower` method of Unicode strings which also affect non-ASCII characters, sometimes mapping them into the ASCII range: >>> keyword = u'Bac\N{KELVIN SIGN}ground' >>> assert keyword.lower() == u'background' >>> assert ascii_lower(keyword) != keyword.lower() >>> assert ascii_lower(keyword) == u'bac\N{KELVIN SIGN}ground' utf8)encodelowerdecode)stringr /usr/lib/python3.6/__init__.py ascii_lower#sr cCsxt|jd}tj|}|dkr$dStj|}|dkrt|dkrLddlm}ntj||}tj |}t ||}|t|<|S)u< Look for an encoding by its label. This is the spec’s `get an encoding `_ algorithm. Supported labels are listed there. :param label: A string. :returns: An :class:`Encoding` object, or :obj:`None` for an unknown label. z Nzx-user-definedr) codec_info) r striprgetCACHEZx_user_definedr PYTHON_NAMEScodecslookupEncoding)ZlabelnameencodingrZ python_namer r r r=s      rcCs.t|dr|St|}|dkr*td||S)z Accept either an encoding object or label. :param encoding: An :class:`Encoding` object or a label string. :returns: An :class:`Encoding` object. :raises: :exc:`~exceptions.LookupError` for an unknown label. rNzUnknown encoding label: %r)hasattrr LookupError)Zencoding_or_labelrr r r _get_encoding[s  rc@s eZdZdZddZddZdS)raOReresents a character encoding such as UTF-8, that can be used for decoding or encoding. .. attribute:: name Canonical name of the encoding .. attribute:: codec_info The actual implementation of the encoding, a stdlib :class:`~codecs.CodecInfo` object. See :func:`codecs.register`. cCs||_||_dS)N)rr)selfrrr r r __init__|szEncoding.__init__cCs d|jS)Nz )r)rr r r __repr__szEncoding.__repr__N)__name__ __module__ __qualname____doc__rrr r r r rmsrzutf-8zutf-16lezutf-16bereplacecCs2t|}t|\}}|p|}|jj||d|fS)a Decode a single string. :param input: A byte string :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :return: A ``(output, encoding)`` tuple of an Unicode string and an :obj:`Encoding`. r)r _detect_bomrr )inputfallback_encodingerrorsZ bom_encodingrr r r r s r cCsV|jdrt|ddfS|jdr4t|ddfS|jdrNt|ddfSd|fS)zBReturn (bom_encoding, input), with any BOM removed from the input.sNss) startswith_UTF16LE_UTF16BEUTF8)r$r r r r#s   r#strictcCst|jj||dS)a; Encode a single string. :param input: An Unicode string. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :return: A byte string. r)rrr)r$rr&r r r rs rcCs$t||}t||}t|}||fS)a "Pull"-based decoder. :param input: An iterable of byte strings. The input is first consumed just enough to determine the encoding based on the precense of a BOM, then consumed on demand when the return value is. :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An ``(output, encoding)`` tuple. :obj:`output` is an iterable of Unicode strings, :obj:`encoding` is the :obj:`Encoding` that is being used. )IncrementalDecoder_iter_decode_generatornext)r$r%r&decoder generatorrr r r iter_decodes  r3ccs|j}t|}xJ|D] }||}|r|jV|VPqW|ddd}|jV|rV|VdSx|D]}||}|r`|Vq`W|ddd}|r|VdS)zqReturn a generator that first yields the :obj:`Encoding`, then yields output chukns as Unicode strings. T)finalN)r iterr)r$r1r chunckoutputr r r r/s(     r/cCst||j}t||S)uY “Pull”-based encoder. :param input: An iterable of Unicode strings. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An iterable of byte strings. )IncrementalEncoderr_iter_encode_generator)r$rr&rr r r iter_encodes r;ccs:x|D]}||}|r|VqW|ddd}|r6|VdS)NT)r5r )r$rr7r8r r r r:s   r:c@s$eZdZdZd ddZd ddZdS) r.uO “Push”-based decoder. :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. r"cCs&t||_||_d|_d|_d|_dS)Nr4)r_fallback_encoding_errors_buffer_decoderr)rr%r&r r r rs  zIncrementalDecoder.__init__FcCs~|j}|dk r|||S|j|}t|\}}|dkrXt|dkrR| rR||_dS|j}|jj|jj}||_||_ |||S)zDecode one chunk of the input. :param input: A byte string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: An Unicode string. Nr(r<) r@r?r#lenr=rincrementaldecoderr>r r)rr$r5r1rr r r r 's    zIncrementalDecoder.decodeN)r")F)rrr r!rr r r r r r.s  r.c@seZdZdZedfddZdS)r9u “Push”-based encoder. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. .. method:: encode(input, final=False) :param input: An Unicode string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: A byte string. r-cCst|}|jj|j|_dS)N)rrincrementalencoderr)rrr&r r r rTszIncrementalEncoder.__init__N)rrr r!r,rr r r r r9Csr9)r")r")r!Z __future__rrZlabelsrVERSIONrrr rrobjectrr,r*r+r r#rr3r/r;r:r.r9r r r r  s2       3webencodings/__pycache__/mklabels.cpython-36.opt-1.pyc000064400000003376152347724720016630 0ustar003 Pf @sfdZddlZyddlmZWn ek r<ddlmZYnXddZddZedkrbe ed dS) z webencodings.mklabels ~~~~~~~~~~~~~~~~~~~~~ Regenarate the webencodings.labels module. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. N)urlopencCs|S)N)stringrr/usr/lib/python3.6/mklabels.py assert_lowersrcsfdg}ddtjt|jjdD}tdd|D|jfdd|D|jdd j|S) Na""" webencodings.labels ~~~~~~~~~~~~~~~~~~~ Map encoding labels to their name. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ # XXX Do not edit! # This file is automatically generated by mklabels.py LABELS = { cSsLg|]D}|dD]6}|dD](}tt|jdt|djdfqqqS)Z encodingslabelsuname)reprrlstrip).0categoryencodinglabelrrr -s zgenerate..asciicss|]\}}t|VqdS)N)len)r rr rrr 2szgenerate..c3s,|]$\}}d|dt||fVqdS)z %s:%s %s,  N)r)r rr )max_lenrrr4s}) jsonloadsrreaddecodemaxextendappendjoin)Zurlpartsrr)rrgenerates   r!__main__z.http://encoding.spec.whatwg.org/encodings.json) __doc__rZurllibr ImportErrorZurllib.requestrr!__name__printrrrr s!webencodings/mklabels.py000064400000002431152347724720011374 0ustar00""" webencodings.mklabels ~~~~~~~~~~~~~~~~~~~~~ Regenarate the webencodings.labels module. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ import json try: from urllib import urlopen except ImportError: from urllib.request import urlopen def assert_lower(string): assert string == string.lower() return string def generate(url): parts = ['''\ """ webencodings.labels ~~~~~~~~~~~~~~~~~~~ Map encoding labels to their name. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ # XXX Do not edit! # This file is automatically generated by mklabels.py LABELS = { '''] labels = [ (repr(assert_lower(label)).lstrip('u'), repr(encoding['name']).lstrip('u')) for category in json.loads(urlopen(url).read().decode('ascii')) for encoding in category['encodings'] for label in encoding['labels']] max_len = max(len(label) for label, name in labels) parts.extend( ' %s:%s %s,\n' % (label, ' ' * (max_len - len(label)), name) for label, name in labels) parts.append('}') return ''.join(parts) if __name__ == '__main__': print(generate('http://encoding.spec.whatwg.org/encodings.json')) webencodings/tests.py000064400000014643152347724720010754 0ustar00# coding: utf-8 """ webencodings.tests ~~~~~~~~~~~~~~~~~~ A basic test suite for Encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ from __future__ import unicode_literals from . import (lookup, LABELS, decode, encode, iter_decode, iter_encode, IncrementalDecoder, IncrementalEncoder, UTF8) def assert_raises(exception, function, *args, **kwargs): try: function(*args, **kwargs) except exception: return else: # pragma: no cover raise AssertionError('Did not raise %s.' % exception) def test_labels(): assert lookup('utf-8').name == 'utf-8' assert lookup('Utf-8').name == 'utf-8' assert lookup('UTF-8').name == 'utf-8' assert lookup('utf8').name == 'utf-8' assert lookup('utf8').name == 'utf-8' assert lookup('utf8 ').name == 'utf-8' assert lookup(' \r\nutf8\t').name == 'utf-8' assert lookup('u8') is None # Python label. assert lookup('utf-8 ') is None # Non-ASCII white space. assert lookup('US-ASCII').name == 'windows-1252' assert lookup('iso-8859-1').name == 'windows-1252' assert lookup('latin1').name == 'windows-1252' assert lookup('LATIN1').name == 'windows-1252' assert lookup('latin-1') is None assert lookup('LATİN1') is None # ASCII-only case insensitivity. def test_all_labels(): for label in LABELS: assert decode(b'', label) == ('', lookup(label)) assert encode('', label) == b'' for repeat in [0, 1, 12]: output, _ = iter_decode([b''] * repeat, label) assert list(output) == [] assert list(iter_encode([''] * repeat, label)) == [] decoder = IncrementalDecoder(label) assert decoder.decode(b'') == '' assert decoder.decode(b'', final=True) == '' encoder = IncrementalEncoder(label) assert encoder.encode('') == b'' assert encoder.encode('', final=True) == b'' # All encoding names are valid labels too: for name in set(LABELS.values()): assert lookup(name).name == name def test_invalid_label(): assert_raises(LookupError, decode, b'\xEF\xBB\xBF\xc3\xa9', 'invalid') assert_raises(LookupError, encode, 'é', 'invalid') assert_raises(LookupError, iter_decode, [], 'invalid') assert_raises(LookupError, iter_encode, [], 'invalid') assert_raises(LookupError, IncrementalDecoder, 'invalid') assert_raises(LookupError, IncrementalEncoder, 'invalid') def test_decode(): assert decode(b'\x80', 'latin1') == ('€', lookup('latin1')) assert decode(b'\x80', lookup('latin1')) == ('€', lookup('latin1')) assert decode(b'\xc3\xa9', 'utf8') == ('é', lookup('utf8')) assert decode(b'\xc3\xa9', UTF8) == ('é', lookup('utf8')) assert decode(b'\xc3\xa9', 'ascii') == ('é', lookup('ascii')) assert decode(b'\xEF\xBB\xBF\xc3\xa9', 'ascii') == ('é', lookup('utf8')) # UTF-8 with BOM assert decode(b'\xFE\xFF\x00\xe9', 'ascii') == ('é', lookup('utf-16be')) # UTF-16-BE with BOM assert decode(b'\xFF\xFE\xe9\x00', 'ascii') == ('é', lookup('utf-16le')) # UTF-16-LE with BOM assert decode(b'\xFE\xFF\xe9\x00', 'ascii') == ('\ue900', lookup('utf-16be')) assert decode(b'\xFF\xFE\x00\xe9', 'ascii') == ('\ue900', lookup('utf-16le')) assert decode(b'\x00\xe9', 'UTF-16BE') == ('é', lookup('utf-16be')) assert decode(b'\xe9\x00', 'UTF-16LE') == ('é', lookup('utf-16le')) assert decode(b'\xe9\x00', 'UTF-16') == ('é', lookup('utf-16le')) assert decode(b'\xe9\x00', 'UTF-16BE') == ('\ue900', lookup('utf-16be')) assert decode(b'\x00\xe9', 'UTF-16LE') == ('\ue900', lookup('utf-16le')) assert decode(b'\x00\xe9', 'UTF-16') == ('\ue900', lookup('utf-16le')) def test_encode(): assert encode('é', 'latin1') == b'\xe9' assert encode('é', 'utf8') == b'\xc3\xa9' assert encode('é', 'utf8') == b'\xc3\xa9' assert encode('é', 'utf-16') == b'\xe9\x00' assert encode('é', 'utf-16le') == b'\xe9\x00' assert encode('é', 'utf-16be') == b'\x00\xe9' def test_iter_decode(): def iter_decode_to_string(input, fallback_encoding): output, _encoding = iter_decode(input, fallback_encoding) return ''.join(output) assert iter_decode_to_string([], 'latin1') == '' assert iter_decode_to_string([b''], 'latin1') == '' assert iter_decode_to_string([b'\xe9'], 'latin1') == 'é' assert iter_decode_to_string([b'hello'], 'latin1') == 'hello' assert iter_decode_to_string([b'he', b'llo'], 'latin1') == 'hello' assert iter_decode_to_string([b'hell', b'o'], 'latin1') == 'hello' assert iter_decode_to_string([b'\xc3\xa9'], 'latin1') == 'é' assert iter_decode_to_string([b'\xEF\xBB\xBF\xc3\xa9'], 'latin1') == 'é' assert iter_decode_to_string([ b'\xEF\xBB\xBF', b'\xc3', b'\xa9'], 'latin1') == 'é' assert iter_decode_to_string([ b'\xEF\xBB\xBF', b'a', b'\xc3'], 'latin1') == 'a\uFFFD' assert iter_decode_to_string([ b'', b'\xEF', b'', b'', b'\xBB\xBF\xc3', b'\xa9'], 'latin1') == 'é' assert iter_decode_to_string([b'\xEF\xBB\xBF'], 'latin1') == '' assert iter_decode_to_string([b'\xEF\xBB'], 'latin1') == 'ï»' assert iter_decode_to_string([b'\xFE\xFF\x00\xe9'], 'latin1') == 'é' assert iter_decode_to_string([b'\xFF\xFE\xe9\x00'], 'latin1') == 'é' assert iter_decode_to_string([ b'', b'\xFF', b'', b'', b'\xFE\xe9', b'\x00'], 'latin1') == 'é' assert iter_decode_to_string([ b'', b'h\xe9', b'llo'], 'x-user-defined') == 'h\uF7E9llo' def test_iter_encode(): assert b''.join(iter_encode([], 'latin1')) == b'' assert b''.join(iter_encode([''], 'latin1')) == b'' assert b''.join(iter_encode(['é'], 'latin1')) == b'\xe9' assert b''.join(iter_encode(['', 'é', '', ''], 'latin1')) == b'\xe9' assert b''.join(iter_encode(['', 'é', '', ''], 'utf-16')) == b'\xe9\x00' assert b''.join(iter_encode(['', 'é', '', ''], 'utf-16le')) == b'\xe9\x00' assert b''.join(iter_encode(['', 'é', '', ''], 'utf-16be')) == b'\x00\xe9' assert b''.join(iter_encode([ '', 'h\uF7E9', '', 'llo'], 'x-user-defined')) == b'h\xe9llo' def test_x_user_defined(): encoded = b'2,\x0c\x0b\x1aO\xd9#\xcb\x0f\xc9\xbbt\xcf\xa8\xca' decoded = '2,\x0c\x0b\x1aO\uf7d9#\uf7cb\x0f\uf7c9\uf7bbt\uf7cf\uf7a8\uf7ca' encoded = b'aa' decoded = 'aa' assert decode(encoded, 'x-user-defined') == (decoded, lookup('x-user-defined')) assert encode(decoded, 'x-user-defined') == encoded webencodings/x_user_defined.py000064400000010323152347724720012564 0ustar00# coding: utf-8 """ webencodings.x_user_defined ~~~~~~~~~~~~~~~~~~~~~~~~~~~ An implementation of the x-user-defined encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ from __future__ import unicode_literals import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self, input, errors='strict'): return codecs.charmap_encode(input, errors, encoding_table) def decode(self, input, errors='strict'): return codecs.charmap_decode(input, errors, decoding_table) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input, self.errors, encoding_table)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input, self.errors, decoding_table)[0] class StreamWriter(Codec, codecs.StreamWriter): pass class StreamReader(Codec, codecs.StreamReader): pass ### encodings module API codec_info = codecs.CodecInfo( name='x-user-defined', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, ) ### Decoding Table # Python 3: # for c in range(256): print(' %r' % chr(c if c < 128 else c + 0xF700)) decoding_table = ( '\x00' '\x01' '\x02' '\x03' '\x04' '\x05' '\x06' '\x07' '\x08' '\t' '\n' '\x0b' '\x0c' '\r' '\x0e' '\x0f' '\x10' '\x11' '\x12' '\x13' '\x14' '\x15' '\x16' '\x17' '\x18' '\x19' '\x1a' '\x1b' '\x1c' '\x1d' '\x1e' '\x1f' ' ' '!' '"' '#' '$' '%' '&' "'" '(' ')' '*' '+' ',' '-' '.' '/' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' ':' ';' '<' '=' '>' '?' '@' 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' '[' '\\' ']' '^' '_' '`' 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' '{' '|' '}' '~' '\x7f' '\uf780' '\uf781' '\uf782' '\uf783' '\uf784' '\uf785' '\uf786' '\uf787' '\uf788' '\uf789' '\uf78a' '\uf78b' '\uf78c' '\uf78d' '\uf78e' '\uf78f' '\uf790' '\uf791' '\uf792' '\uf793' '\uf794' '\uf795' '\uf796' '\uf797' '\uf798' '\uf799' '\uf79a' '\uf79b' '\uf79c' '\uf79d' '\uf79e' '\uf79f' '\uf7a0' '\uf7a1' '\uf7a2' '\uf7a3' '\uf7a4' '\uf7a5' '\uf7a6' '\uf7a7' '\uf7a8' '\uf7a9' '\uf7aa' '\uf7ab' '\uf7ac' '\uf7ad' '\uf7ae' '\uf7af' '\uf7b0' '\uf7b1' '\uf7b2' '\uf7b3' '\uf7b4' '\uf7b5' '\uf7b6' '\uf7b7' '\uf7b8' '\uf7b9' '\uf7ba' '\uf7bb' '\uf7bc' '\uf7bd' '\uf7be' '\uf7bf' '\uf7c0' '\uf7c1' '\uf7c2' '\uf7c3' '\uf7c4' '\uf7c5' '\uf7c6' '\uf7c7' '\uf7c8' '\uf7c9' '\uf7ca' '\uf7cb' '\uf7cc' '\uf7cd' '\uf7ce' '\uf7cf' '\uf7d0' '\uf7d1' '\uf7d2' '\uf7d3' '\uf7d4' '\uf7d5' '\uf7d6' '\uf7d7' '\uf7d8' '\uf7d9' '\uf7da' '\uf7db' '\uf7dc' '\uf7dd' '\uf7de' '\uf7df' '\uf7e0' '\uf7e1' '\uf7e2' '\uf7e3' '\uf7e4' '\uf7e5' '\uf7e6' '\uf7e7' '\uf7e8' '\uf7e9' '\uf7ea' '\uf7eb' '\uf7ec' '\uf7ed' '\uf7ee' '\uf7ef' '\uf7f0' '\uf7f1' '\uf7f2' '\uf7f3' '\uf7f4' '\uf7f5' '\uf7f6' '\uf7f7' '\uf7f8' '\uf7f9' '\uf7fa' '\uf7fb' '\uf7fc' '\uf7fd' '\uf7fe' '\uf7ff' ) ### Encoding table encoding_table = codecs.charmap_build(decoding_table) webencodings/labels.py000064400000021423152347724720011046 0ustar00""" webencodings.labels ~~~~~~~~~~~~~~~~~~~ Map encoding labels to their name. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ # XXX Do not edit! # This file is automatically generated by mklabels.py LABELS = { 'unicode-1-1-utf-8': 'utf-8', 'utf-8': 'utf-8', 'utf8': 'utf-8', '866': 'ibm866', 'cp866': 'ibm866', 'csibm866': 'ibm866', 'ibm866': 'ibm866', 'csisolatin2': 'iso-8859-2', 'iso-8859-2': 'iso-8859-2', 'iso-ir-101': 'iso-8859-2', 'iso8859-2': 'iso-8859-2', 'iso88592': 'iso-8859-2', 'iso_8859-2': 'iso-8859-2', 'iso_8859-2:1987': 'iso-8859-2', 'l2': 'iso-8859-2', 'latin2': 'iso-8859-2', 'csisolatin3': 'iso-8859-3', 'iso-8859-3': 'iso-8859-3', 'iso-ir-109': 'iso-8859-3', 'iso8859-3': 'iso-8859-3', 'iso88593': 'iso-8859-3', 'iso_8859-3': 'iso-8859-3', 'iso_8859-3:1988': 'iso-8859-3', 'l3': 'iso-8859-3', 'latin3': 'iso-8859-3', 'csisolatin4': 'iso-8859-4', 'iso-8859-4': 'iso-8859-4', 'iso-ir-110': 'iso-8859-4', 'iso8859-4': 'iso-8859-4', 'iso88594': 'iso-8859-4', 'iso_8859-4': 'iso-8859-4', 'iso_8859-4:1988': 'iso-8859-4', 'l4': 'iso-8859-4', 'latin4': 'iso-8859-4', 'csisolatincyrillic': 'iso-8859-5', 'cyrillic': 'iso-8859-5', 'iso-8859-5': 'iso-8859-5', 'iso-ir-144': 'iso-8859-5', 'iso8859-5': 'iso-8859-5', 'iso88595': 'iso-8859-5', 'iso_8859-5': 'iso-8859-5', 'iso_8859-5:1988': 'iso-8859-5', 'arabic': 'iso-8859-6', 'asmo-708': 'iso-8859-6', 'csiso88596e': 'iso-8859-6', 'csiso88596i': 'iso-8859-6', 'csisolatinarabic': 'iso-8859-6', 'ecma-114': 'iso-8859-6', 'iso-8859-6': 'iso-8859-6', 'iso-8859-6-e': 'iso-8859-6', 'iso-8859-6-i': 'iso-8859-6', 'iso-ir-127': 'iso-8859-6', 'iso8859-6': 'iso-8859-6', 'iso88596': 'iso-8859-6', 'iso_8859-6': 'iso-8859-6', 'iso_8859-6:1987': 'iso-8859-6', 'csisolatingreek': 'iso-8859-7', 'ecma-118': 'iso-8859-7', 'elot_928': 'iso-8859-7', 'greek': 'iso-8859-7', 'greek8': 'iso-8859-7', 'iso-8859-7': 'iso-8859-7', 'iso-ir-126': 'iso-8859-7', 'iso8859-7': 'iso-8859-7', 'iso88597': 'iso-8859-7', 'iso_8859-7': 'iso-8859-7', 'iso_8859-7:1987': 'iso-8859-7', 'sun_eu_greek': 'iso-8859-7', 'csiso88598e': 'iso-8859-8', 'csisolatinhebrew': 'iso-8859-8', 'hebrew': 'iso-8859-8', 'iso-8859-8': 'iso-8859-8', 'iso-8859-8-e': 'iso-8859-8', 'iso-ir-138': 'iso-8859-8', 'iso8859-8': 'iso-8859-8', 'iso88598': 'iso-8859-8', 'iso_8859-8': 'iso-8859-8', 'iso_8859-8:1988': 'iso-8859-8', 'visual': 'iso-8859-8', 'csiso88598i': 'iso-8859-8-i', 'iso-8859-8-i': 'iso-8859-8-i', 'logical': 'iso-8859-8-i', 'csisolatin6': 'iso-8859-10', 'iso-8859-10': 'iso-8859-10', 'iso-ir-157': 'iso-8859-10', 'iso8859-10': 'iso-8859-10', 'iso885910': 'iso-8859-10', 'l6': 'iso-8859-10', 'latin6': 'iso-8859-10', 'iso-8859-13': 'iso-8859-13', 'iso8859-13': 'iso-8859-13', 'iso885913': 'iso-8859-13', 'iso-8859-14': 'iso-8859-14', 'iso8859-14': 'iso-8859-14', 'iso885914': 'iso-8859-14', 'csisolatin9': 'iso-8859-15', 'iso-8859-15': 'iso-8859-15', 'iso8859-15': 'iso-8859-15', 'iso885915': 'iso-8859-15', 'iso_8859-15': 'iso-8859-15', 'l9': 'iso-8859-15', 'iso-8859-16': 'iso-8859-16', 'cskoi8r': 'koi8-r', 'koi': 'koi8-r', 'koi8': 'koi8-r', 'koi8-r': 'koi8-r', 'koi8_r': 'koi8-r', 'koi8-u': 'koi8-u', 'csmacintosh': 'macintosh', 'mac': 'macintosh', 'macintosh': 'macintosh', 'x-mac-roman': 'macintosh', 'dos-874': 'windows-874', 'iso-8859-11': 'windows-874', 'iso8859-11': 'windows-874', 'iso885911': 'windows-874', 'tis-620': 'windows-874', 'windows-874': 'windows-874', 'cp1250': 'windows-1250', 'windows-1250': 'windows-1250', 'x-cp1250': 'windows-1250', 'cp1251': 'windows-1251', 'windows-1251': 'windows-1251', 'x-cp1251': 'windows-1251', 'ansi_x3.4-1968': 'windows-1252', 'ascii': 'windows-1252', 'cp1252': 'windows-1252', 'cp819': 'windows-1252', 'csisolatin1': 'windows-1252', 'ibm819': 'windows-1252', 'iso-8859-1': 'windows-1252', 'iso-ir-100': 'windows-1252', 'iso8859-1': 'windows-1252', 'iso88591': 'windows-1252', 'iso_8859-1': 'windows-1252', 'iso_8859-1:1987': 'windows-1252', 'l1': 'windows-1252', 'latin1': 'windows-1252', 'us-ascii': 'windows-1252', 'windows-1252': 'windows-1252', 'x-cp1252': 'windows-1252', 'cp1253': 'windows-1253', 'windows-1253': 'windows-1253', 'x-cp1253': 'windows-1253', 'cp1254': 'windows-1254', 'csisolatin5': 'windows-1254', 'iso-8859-9': 'windows-1254', 'iso-ir-148': 'windows-1254', 'iso8859-9': 'windows-1254', 'iso88599': 'windows-1254', 'iso_8859-9': 'windows-1254', 'iso_8859-9:1989': 'windows-1254', 'l5': 'windows-1254', 'latin5': 'windows-1254', 'windows-1254': 'windows-1254', 'x-cp1254': 'windows-1254', 'cp1255': 'windows-1255', 'windows-1255': 'windows-1255', 'x-cp1255': 'windows-1255', 'cp1256': 'windows-1256', 'windows-1256': 'windows-1256', 'x-cp1256': 'windows-1256', 'cp1257': 'windows-1257', 'windows-1257': 'windows-1257', 'x-cp1257': 'windows-1257', 'cp1258': 'windows-1258', 'windows-1258': 'windows-1258', 'x-cp1258': 'windows-1258', 'x-mac-cyrillic': 'x-mac-cyrillic', 'x-mac-ukrainian': 'x-mac-cyrillic', 'chinese': 'gbk', 'csgb2312': 'gbk', 'csiso58gb231280': 'gbk', 'gb2312': 'gbk', 'gb_2312': 'gbk', 'gb_2312-80': 'gbk', 'gbk': 'gbk', 'iso-ir-58': 'gbk', 'x-gbk': 'gbk', 'gb18030': 'gb18030', 'hz-gb-2312': 'hz-gb-2312', 'big5': 'big5', 'big5-hkscs': 'big5', 'cn-big5': 'big5', 'csbig5': 'big5', 'x-x-big5': 'big5', 'cseucpkdfmtjapanese': 'euc-jp', 'euc-jp': 'euc-jp', 'x-euc-jp': 'euc-jp', 'csiso2022jp': 'iso-2022-jp', 'iso-2022-jp': 'iso-2022-jp', 'csshiftjis': 'shift_jis', 'ms_kanji': 'shift_jis', 'shift-jis': 'shift_jis', 'shift_jis': 'shift_jis', 'sjis': 'shift_jis', 'windows-31j': 'shift_jis', 'x-sjis': 'shift_jis', 'cseuckr': 'euc-kr', 'csksc56011987': 'euc-kr', 'euc-kr': 'euc-kr', 'iso-ir-149': 'euc-kr', 'korean': 'euc-kr', 'ks_c_5601-1987': 'euc-kr', 'ks_c_5601-1989': 'euc-kr', 'ksc5601': 'euc-kr', 'ksc_5601': 'euc-kr', 'windows-949': 'euc-kr', 'csiso2022kr': 'iso-2022-kr', 'iso-2022-kr': 'iso-2022-kr', 'utf-16be': 'utf-16be', 'utf-16': 'utf-16le', 'utf-16le': 'utf-16le', 'x-user-defined': 'x-user-defined', } webencodings/__init__.py000064400000024523152347724720011347 0ustar00# coding: utf-8 """ webencodings ~~~~~~~~~~~~ This is a Python implementation of the `WHATWG Encoding standard `. See README for details. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ from __future__ import unicode_literals import codecs from .labels import LABELS VERSION = '0.5.1' # Some names in Encoding are not valid Python aliases. Remap these. PYTHON_NAMES = { 'iso-8859-8-i': 'iso-8859-8', 'x-mac-cyrillic': 'mac-cyrillic', 'macintosh': 'mac-roman', 'windows-874': 'cp874'} CACHE = {} def ascii_lower(string): r"""Transform (only) ASCII letters to lower case: A-Z is mapped to a-z. :param string: An Unicode string. :returns: A new Unicode string. This is used for `ASCII case-insensitive `_ matching of encoding labels. The same matching is also used, among other things, for `CSS keywords `_. This is different from the :meth:`~py:str.lower` method of Unicode strings which also affect non-ASCII characters, sometimes mapping them into the ASCII range: >>> keyword = u'Bac\N{KELVIN SIGN}ground' >>> assert keyword.lower() == u'background' >>> assert ascii_lower(keyword) != keyword.lower() >>> assert ascii_lower(keyword) == u'bac\N{KELVIN SIGN}ground' """ # This turns out to be faster than unicode.translate() return string.encode('utf8').lower().decode('utf8') def lookup(label): """ Look for an encoding by its label. This is the spec’s `get an encoding `_ algorithm. Supported labels are listed there. :param label: A string. :returns: An :class:`Encoding` object, or :obj:`None` for an unknown label. """ # Only strip ASCII whitespace: U+0009, U+000A, U+000C, U+000D, and U+0020. label = ascii_lower(label.strip('\t\n\f\r ')) name = LABELS.get(label) if name is None: return None encoding = CACHE.get(name) if encoding is None: if name == 'x-user-defined': from .x_user_defined import codec_info else: python_name = PYTHON_NAMES.get(name, name) # Any python_name value that gets to here should be valid. codec_info = codecs.lookup(python_name) encoding = Encoding(name, codec_info) CACHE[name] = encoding return encoding def _get_encoding(encoding_or_label): """ Accept either an encoding object or label. :param encoding: An :class:`Encoding` object or a label string. :returns: An :class:`Encoding` object. :raises: :exc:`~exceptions.LookupError` for an unknown label. """ if hasattr(encoding_or_label, 'codec_info'): return encoding_or_label encoding = lookup(encoding_or_label) if encoding is None: raise LookupError('Unknown encoding label: %r' % encoding_or_label) return encoding class Encoding(object): """Reresents a character encoding such as UTF-8, that can be used for decoding or encoding. .. attribute:: name Canonical name of the encoding .. attribute:: codec_info The actual implementation of the encoding, a stdlib :class:`~codecs.CodecInfo` object. See :func:`codecs.register`. """ def __init__(self, name, codec_info): self.name = name self.codec_info = codec_info def __repr__(self): return '' % self.name #: The UTF-8 encoding. Should be used for new content and formats. UTF8 = lookup('utf-8') _UTF16LE = lookup('utf-16le') _UTF16BE = lookup('utf-16be') def decode(input, fallback_encoding, errors='replace'): """ Decode a single string. :param input: A byte string :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :return: A ``(output, encoding)`` tuple of an Unicode string and an :obj:`Encoding`. """ # Fail early if `encoding` is an invalid label. fallback_encoding = _get_encoding(fallback_encoding) bom_encoding, input = _detect_bom(input) encoding = bom_encoding or fallback_encoding return encoding.codec_info.decode(input, errors)[0], encoding def _detect_bom(input): """Return (bom_encoding, input), with any BOM removed from the input.""" if input.startswith(b'\xFF\xFE'): return _UTF16LE, input[2:] if input.startswith(b'\xFE\xFF'): return _UTF16BE, input[2:] if input.startswith(b'\xEF\xBB\xBF'): return UTF8, input[3:] return None, input def encode(input, encoding=UTF8, errors='strict'): """ Encode a single string. :param input: An Unicode string. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :return: A byte string. """ return _get_encoding(encoding).codec_info.encode(input, errors)[0] def iter_decode(input, fallback_encoding, errors='replace'): """ "Pull"-based decoder. :param input: An iterable of byte strings. The input is first consumed just enough to determine the encoding based on the precense of a BOM, then consumed on demand when the return value is. :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An ``(output, encoding)`` tuple. :obj:`output` is an iterable of Unicode strings, :obj:`encoding` is the :obj:`Encoding` that is being used. """ decoder = IncrementalDecoder(fallback_encoding, errors) generator = _iter_decode_generator(input, decoder) encoding = next(generator) return generator, encoding def _iter_decode_generator(input, decoder): """Return a generator that first yields the :obj:`Encoding`, then yields output chukns as Unicode strings. """ decode = decoder.decode input = iter(input) for chunck in input: output = decode(chunck) if output: assert decoder.encoding is not None yield decoder.encoding yield output break else: # Input exhausted without determining the encoding output = decode(b'', final=True) assert decoder.encoding is not None yield decoder.encoding if output: yield output return for chunck in input: output = decode(chunck) if output: yield output output = decode(b'', final=True) if output: yield output def iter_encode(input, encoding=UTF8, errors='strict'): """ “Pull”-based encoder. :param input: An iterable of Unicode strings. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. :returns: An iterable of byte strings. """ # Fail early if `encoding` is an invalid label. encode = IncrementalEncoder(encoding, errors).encode return _iter_encode_generator(input, encode) def _iter_encode_generator(input, encode): for chunck in input: output = encode(chunck) if output: yield output output = encode('', final=True) if output: yield output class IncrementalDecoder(object): """ “Push”-based decoder. :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. """ def __init__(self, fallback_encoding, errors='replace'): # Fail early if `encoding` is an invalid label. self._fallback_encoding = _get_encoding(fallback_encoding) self._errors = errors self._buffer = b'' self._decoder = None #: The actual :class:`Encoding` that is being used, #: or :obj:`None` if that is not determined yet. #: (Ie. if there is not enough input yet to determine #: if there is a BOM.) self.encoding = None # Not known yet. def decode(self, input, final=False): """Decode one chunk of the input. :param input: A byte string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: An Unicode string. """ decoder = self._decoder if decoder is not None: return decoder(input, final) input = self._buffer + input encoding, input = _detect_bom(input) if encoding is None: if len(input) < 3 and not final: # Not enough data yet. self._buffer = input return '' else: # No BOM encoding = self._fallback_encoding decoder = encoding.codec_info.incrementaldecoder(self._errors).decode self._decoder = decoder self.encoding = encoding return decoder(input, final) class IncrementalEncoder(object): """ “Push”-based encoder. :param encoding: An :class:`Encoding` object or a label string. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupError` for an unknown encoding label. .. method:: encode(input, final=False) :param input: An Unicode string. :param final: Indicate that no more input is available. Must be :obj:`True` if this is the last call. :returns: A byte string. """ def __init__(self, encoding=UTF8, errors='strict'): encoding = _get_encoding(encoding) self.encode = encoding.codec_info.incrementalencoder(errors).encode progress/__pycache__/helpers.cpython-36.pyc000064400000005517152347724720014735 0ustar003 Pf& @sdddlmZdZdZGdddeZGdddeZddlmZmZdd l m Z Gd d d eZ d S) )print_functionz[?25lz[?25hcs2eZdZdZd fdd ZddZddZZS) WriteMixinFNc sbtt|jf|d|_|r"||_|jjr^|jrBtt d|jdt|jd|jd|jj dS)Nr)endfile) superr__init___widthmessagerisatty hide_cursorprint HIDE_CURSORflush)selfr kwargs) __class__/usr/lib/python3.6/helpers.pyrs zWriteMixin.__init__cCsT|jjrPd|j}|j|j}t||d|jdt|jt||_|jjdS)Nr)rr)rr r ljustr maxlenr)rsbcrrrwrite%s    zWriteMixin.writecCs$|jjr |jr ttd|jddS)Nr)rr)rr r r SHOW_CURSOR)rrrrfinish-szWriteMixin.finish)N)__name__ __module__ __qualname__r rrr __classcell__rr)rrrs rcs:eZdZdZd fdd ZddZddZd d ZZS) WritelnMixinFNc s@tt|jf||r||_|jjr<|jrs  progress/__pycache__/spinner.cpython-36.pyc000064400000002177152347724720014750 0ustar003 Pf"@s^ddlmZddlmZGdddeeZGdddeZGdddeZGd d d eZd S) )Infinite) WriteMixinc@s eZdZdZd ZdZddZd S) Spinner-\|/TcCs$|jt|j}|j|j|dS)N)indexlenphaseswrite)selfir/usr/lib/python3.6/spinner.pyupdateszSpinner.updateN)rrrr )__name__ __module__ __qualname__messager Z hide_cursorrrrrrrsrc@seZdZddddgZdS) PieSpinneru◷u◶u◵u◴N)rrrr rrrrrsrc@seZdZddddgZdS) MoonSpinneru◑u◒u◐u◓N)rrrr rrrrr#src@seZdZddddddgZdS) LineSpinneru⎺u⎻u⎼u⎽N)rrrr rrrrr'srN)rrZhelpersrrrrrrrrrs   progress/__pycache__/counter.cpython-36.opt-1.pyc000064400000002745152347724720015711 0ustar003 Pf@sfddlmZmZddlmZGdddeeZGdddeeZGdddeeZGd d d eZd S) )InfiniteProgress) WriteMixinc@seZdZdZdZddZdS)CounterTcCs|jt|jdS)N)writestrindex)selfr /usr/lib/python3.6/counter.pyupdateszCounter.updateN)__name__ __module__ __qualname__message hide_cursorr r r r r rsrc@seZdZdZddZdS) CountdownTcCs|jt|jdS)N)rrZ remaining)r r r r r szCountdown.updateN)rrrrr r r r r rsrc @seZdZdZd Zd d Zd S)Stack ▁▂▃▄▅▆▇█TcCs6t|j}t|dt|j|}|j|j|dS)Nr)lenphasesminintZprogressr)r Znphasesir r r r (s z Stack.updateN) rrrrrrrrr)rrrrrr r r r r r$src@seZdZdZdS)Pie○◔◑◕●N)r$r%r&r'r()rrrrr r r r r#.sr#N) rrrZhelpersrrrrr#r r r r s   progress/__pycache__/__init__.cpython-36.pyc000064400000007266152347724720015035 0ustar003 Pf @spddlmZddlmZddlmZddlmZddlm Z ddl m Z dZ Gdd d e Z Gd d d e Zd S) )division)deque) timedelta)ceil)stderr)timez1.2c@sreZdZeZdZddZddZeddZ edd Z ed d Z d d Z ddZ ddZdddZddZdS)Infinite cOsJd|_t|_|j|_t|jd|_x |jD]\}}t|||q.WdS)Nr)maxlen) indexrstart_ts_tsr sma_window_dtitemssetattr)selfargskwargskeyvalr/usr/lib/python3.6/__init__.py__init__s zInfinite.__init__cCs|jdrdSt||dS)N_) startswithgetattr)rrrrr __getitem__'s zInfinite.__getitem__cCs|jrt|jt|jSdS)Nr)rsumlen)rrrravg,sz Infinite.avgcCstt|jS)N)intrr )rrrrelapsed0szInfinite.elapsedcCs t|jdS)N)seconds)rr")rrrr elapsed_td4szInfinite.elapsed_tdcCsdS)Nr)rrrrupdate8szInfinite.updatecCsdS)Nr)rrrrstart;szInfinite.startcCsdS)Nr)rrrrfinish>szInfinite.finishcCsF|dkr.t}||j|}|jj|||_|j||_|jdS)Nr)rr rappendr r%)rnZnowZdtrrrnextAs  z Infinite.nextccs(x|D]}|V|jqW|jdS)N)r+r')ritxrrriterKs  z Infinite.iterN)r()__name__ __module__ __qualname__rfilerrrpropertyr r"r$r%r&r'r+r.rrrrrs    rcspeZdZfddZeddZeddZeddZed d Zed d Z d dZ ddZ ddZ Z S)Progresscs$tt|j|||jdd|_dS)Nmaxd)superr4rgetr5)rrr) __class__rrrSszProgress.__init__cCstt|j|jS)N)r!rr remaining)rrrretaWsz Progress.etacCs t|jdS)N)r#)rr;)rrrreta_td[szProgress.eta_tdcCs |jdS)Nr6)progress)rrrrpercent_szProgress.percentcCstd|j|jS)Nr()minr r5)rrrrr=cszProgress.progresscCst|j|jdS)Nr)r5r )rrrrr:gszProgress.remainingcCs |jdS)N)r%)rrrrr&kszProgress.startcCs||j}|j|dS)N)r r+)rr Zincrrrrgotons z Progress.gotoc csLyt||_Wntk r"YnXx|D]}|V|jq*W|jdS)N)rr5 TypeErrorr+r')rr,r-rrrr.rs  z Progress.iter)r/r0r1rr3r;r<r>r=r:r&r@r. __classcell__rr)r9rr4Rs      r4N)Z __future__r collectionsrZdatetimerZmathrsysrr __version__objectrr4rrrrs      7progress/__pycache__/spinner.cpython-36.opt-1.pyc000064400000002177152347724720015707 0ustar003 Pf"@s^ddlmZddlmZGdddeeZGdddeZGdddeZGd d d eZd S) )Infinite) WriteMixinc@s eZdZdZd ZdZddZd S) Spinner-\|/TcCs$|jt|j}|j|j|dS)N)indexlenphaseswrite)selfir/usr/lib/python3.6/spinner.pyupdateszSpinner.updateN)rrrr )__name__ __module__ __qualname__messager Z hide_cursorrrrrrrsrc@seZdZddddgZdS) PieSpinneru◷u◶u◵u◴N)rrrr rrrrrsrc@seZdZddddgZdS) MoonSpinneru◑u◒u◐u◓N)rrrr rrrrr#src@seZdZddddddgZdS) LineSpinneru⎺u⎻u⎼u⎽N)rrrr rrrrr'srN)rrZhelpersrrrrrrrrrs   progress/__pycache__/helpers.cpython-36.opt-1.pyc000064400000005517152347724720015674 0ustar003 Pf& @sdddlmZdZdZGdddeZGdddeZddlmZmZdd l m Z Gd d d eZ d S) )print_functionz[?25lz[?25hcs2eZdZdZd fdd ZddZddZZS) WriteMixinFNc sbtt|jf|d|_|r"||_|jjr^|jrBtt d|jdt|jd|jd|jj dS)Nr)endfile) superr__init___widthmessagerisatty hide_cursorprint HIDE_CURSORflush)selfr kwargs) __class__/usr/lib/python3.6/helpers.pyrs zWriteMixin.__init__cCsT|jjrPd|j}|j|j}t||d|jdt|jt||_|jjdS)Nr)rr)rr r ljustr maxlenr)rsbcrrrwrite%s    zWriteMixin.writecCs$|jjr |jr ttd|jddS)Nr)rr)rr r r SHOW_CURSOR)rrrrfinish-szWriteMixin.finish)N)__name__ __module__ __qualname__r rrr __classcell__rr)rrrs rcs:eZdZdZd fdd ZddZddZd d ZZS) WritelnMixinFNc s@tt|jf||r||_|jjr<|jrs  progress/__pycache__/bar.cpython-36.pyc000064400000004521152347724720014031 0ustar003 Pf} @s~ddlmZddlmZGdddeeZGdddeZGdddeZGd d d eZGd d d eZGd ddeZ dS))Progress) WritelnMixinc@s4eZdZdZdZdZdZdZdZdZ dZ d d Z d S) Bar z%(index)d/%(max)dz |z|  #TcCsjt|j|j}|j|}|j|}|j|}|j|}|j|}dj||j|||j |g}|j |dS)Nr) intwidthprogressmessagefill empty_fillsuffixjoin bar_prefix bar_suffixwriteln)self filled_length empty_lengthr baremptyrliner/usr/lib/python3.6/bar.pyupdates     z Bar.updateN) __name__ __module__ __qualname__r r rrrrr Z hide_cursorrrrrrrsrc@s eZdZdZdZdZdZdZdS) ChargingBarz %(percent)d%%ru∙u█N)rrrrrrrr rrrrr ,s r c@seZdZdZdZdS)FillingSquaresBaru▢u▣N)rrrrr rrrrr!4sr!c@seZdZdZdZdS)FillingCirclesBaru◯u◉N)rrrrr rrrrr"9sr"c @seZdZd Zd d Zd S)IncrementalBarr▏▎▍▌▋▊▉█c Cst|j}t||j|j}t|j|j}|j|}|||}|j|}|jd|}|dkrn|j|nd}|jtd|t|} |j|} dj ||j ||| |j | g} |j | dS)Nrr) lenphasesr r r r rmaxrrrrr) rZnphasesZexpanded_lengthrrZphaser rZcurrentrrrrrrrAs      zIncrementalBar.updateN) rr$r%r&r'r(r)r*r+)rrrr/rrrrrr#>sr#c@seZdZdZdS)ShadyBarr░▒▓█N)rr2r3r4r5)rrrr/rrrrr1Rsr1N) rrZhelpersrrr r!r"r#r1rrrrs  progress/__pycache__/counter.cpython-36.pyc000064400000002745152347724720014752 0ustar003 Pf@sfddlmZmZddlmZGdddeeZGdddeeZGdddeeZGd d d eZd S) )InfiniteProgress) WriteMixinc@seZdZdZdZddZdS)CounterTcCs|jt|jdS)N)writestrindex)selfr /usr/lib/python3.6/counter.pyupdateszCounter.updateN)__name__ __module__ __qualname__message hide_cursorr r r r r rsrc@seZdZdZddZdS) CountdownTcCs|jt|jdS)N)rrZ remaining)r r r r r szCountdown.updateN)rrrrr r r r r rsrc @seZdZdZd Zd d Zd S)Stack ▁▂▃▄▅▆▇█TcCs6t|j}t|dt|j|}|j|j|dS)Nr)lenphasesminintZprogressr)r Znphasesir r r r (s z Stack.updateN) rrrrrrrrr)rrrrrr r r r r r$src@seZdZdZdS)Pie○◔◑◕●N)r$r%r&r'r()rrrrr r r r r#.sr#N) rrrZhelpersrrrrr#r r r r s   progress/__pycache__/__init__.cpython-36.opt-1.pyc000064400000007266152347724720015774 0ustar003 Pf @spddlmZddlmZddlmZddlmZddlm Z ddl m Z dZ Gdd d e Z Gd d d e Zd S) )division)deque) timedelta)ceil)stderr)timez1.2c@sreZdZeZdZddZddZeddZ edd Z ed d Z d d Z ddZ ddZdddZddZdS)Infinite cOsJd|_t|_|j|_t|jd|_x |jD]\}}t|||q.WdS)Nr)maxlen) indexrstart_ts_tsr sma_window_dtitemssetattr)selfargskwargskeyvalr/usr/lib/python3.6/__init__.py__init__s zInfinite.__init__cCs|jdrdSt||dS)N_) startswithgetattr)rrrrr __getitem__'s zInfinite.__getitem__cCs|jrt|jt|jSdS)Nr)rsumlen)rrrravg,sz Infinite.avgcCstt|jS)N)intrr )rrrrelapsed0szInfinite.elapsedcCs t|jdS)N)seconds)rr")rrrr elapsed_td4szInfinite.elapsed_tdcCsdS)Nr)rrrrupdate8szInfinite.updatecCsdS)Nr)rrrrstart;szInfinite.startcCsdS)Nr)rrrrfinish>szInfinite.finishcCsF|dkr.t}||j|}|jj|||_|j||_|jdS)Nr)rr rappendr r%)rnZnowZdtrrrnextAs  z Infinite.nextccs(x|D]}|V|jqW|jdS)N)r+r')ritxrrriterKs  z Infinite.iterN)r()__name__ __module__ __qualname__rfilerrrpropertyr r"r$r%r&r'r+r.rrrrrs    rcspeZdZfddZeddZeddZeddZed d Zed d Z d dZ ddZ ddZ Z S)Progresscs$tt|j|||jdd|_dS)Nmaxd)superr4rgetr5)rrr) __class__rrrSszProgress.__init__cCstt|j|jS)N)r!rr remaining)rrrretaWsz Progress.etacCs t|jdS)N)r#)rr;)rrrreta_td[szProgress.eta_tdcCs |jdS)Nr6)progress)rrrrpercent_szProgress.percentcCstd|j|jS)Nr()minr r5)rrrrr=cszProgress.progresscCst|j|jdS)Nr)r5r )rrrrr:gszProgress.remainingcCs |jdS)N)r%)rrrrr&kszProgress.startcCs||j}|j|dS)N)r r+)rr Zincrrrrgotons z Progress.gotoc csLyt||_Wntk r"YnXx|D]}|V|jq*W|jdS)N)rr5 TypeErrorr+r')rr,r-rrrr.rs  z Progress.iter)r/r0r1rr3r;r<r>r=r:r&r@r. __classcell__rr)r9rr4Rs      r4N)Z __future__r collectionsrZdatetimerZmathrsysrr __version__objectrr4rrrrs      7progress/__pycache__/bar.cpython-36.opt-1.pyc000064400000004521152347724720014770 0ustar003 Pf} @s~ddlmZddlmZGdddeeZGdddeZGdddeZGd d d eZGd d d eZGd ddeZ dS))Progress) WritelnMixinc@s4eZdZdZdZdZdZdZdZdZ dZ d d Z d S) Bar z%(index)d/%(max)dz |z|  #TcCsjt|j|j}|j|}|j|}|j|}|j|}|j|}dj||j|||j |g}|j |dS)Nr) intwidthprogressmessagefill empty_fillsuffixjoin bar_prefix bar_suffixwriteln)self filled_length empty_lengthr baremptyrliner/usr/lib/python3.6/bar.pyupdates     z Bar.updateN) __name__ __module__ __qualname__r r rrrrr Z hide_cursorrrrrrrsrc@s eZdZdZdZdZdZdZdS) ChargingBarz %(percent)d%%ru∙u█N)rrrrrrrr rrrrr ,s r c@seZdZdZdZdS)FillingSquaresBaru▢u▣N)rrrrr rrrrr!4sr!c@seZdZdZdZdS)FillingCirclesBaru◯u◉N)rrrrr rrrrr"9sr"c @seZdZd Zd d Zd S)IncrementalBarr▏▎▍▌▋▊▉█c Cst|j}t||j|j}t|j|j}|j|}|||}|j|}|jd|}|dkrn|j|nd}|jtd|t|} |j|} dj ||j ||| |j | g} |j | dS)Nrr) lenphasesr r r r rmaxrrrrr) rZnphasesZexpanded_lengthrrZphaser rZcurrentrrrrrrrAs      zIncrementalBar.updateN) rr$r%r&r'r(r)r*r+)rrrr/rrrrrr#>sr#c@seZdZdZdS)ShadyBarr░▒▓█N)rr2r3r4r5)rrrr/rrrrr1Rsr1N) rrZhelpersrrr r!r"r#r1rrrrs  progress/bar.py000064400000005446152347724720007554 0ustar00# -*- coding: utf-8 -*- # Copyright (c) 2012 Giorgos Verigakis # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. from __future__ import unicode_literals import sys from . import Progress class Bar(Progress): width = 32 suffix = '%(index)d/%(max)d' bar_prefix = ' |' bar_suffix = '| ' empty_fill = ' ' fill = '#' def update(self): filled_length = int(self.width * self.progress) empty_length = self.width - filled_length message = self.message % self bar = self.fill * filled_length empty = self.empty_fill * empty_length suffix = self.suffix % self line = ''.join([message, self.bar_prefix, bar, empty, self.bar_suffix, suffix]) self.writeln(line) class ChargingBar(Bar): suffix = '%(percent)d%%' bar_prefix = ' ' bar_suffix = ' ' empty_fill = '∙' fill = '█' class FillingSquaresBar(ChargingBar): empty_fill = '▢' fill = '▣' class FillingCirclesBar(ChargingBar): empty_fill = '◯' fill = '◉' class IncrementalBar(Bar): if sys.platform.startswith('win'): phases = (u' ', u'▌', u'█') else: phases = (' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█') def update(self): nphases = len(self.phases) filled_len = self.width * self.progress nfull = int(filled_len) # Number of full chars phase = int((filled_len - nfull) * nphases) # Phase of last char nempty = self.width - nfull # Number of empty chars message = self.message % self bar = self.phases[-1] * nfull current = self.phases[phase] if phase > 0 else '' empty = self.empty_fill * max(0, nempty - len(current)) suffix = self.suffix % self line = ''.join([message, self.bar_prefix, bar, current, empty, self.bar_suffix, suffix]) self.writeln(line) class PixelBar(IncrementalBar): phases = ('⡀', '⡄', '⡆', '⡇', '⣇', '⣧', '⣷', '⣿') class ShadyBar(IncrementalBar): phases = (' ', '░', '▒', '▓', '█') progress/spinner.py000064400000002544152347724720010462 0ustar00# -*- coding: utf-8 -*- # Copyright (c) 2012 Giorgos Verigakis # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. from __future__ import unicode_literals from . import Infinite class Spinner(Infinite): phases = ('-', '\\', '|', '/') hide_cursor = True def update(self): i = self.index % len(self.phases) self.write(self.phases[i]) class PieSpinner(Spinner): phases = ['◷', '◶', '◵', '◴'] class MoonSpinner(Spinner): phases = ['◑', '◒', '◐', '◓'] class LineSpinner(Spinner): phases = ['⎺', '⎻', '⎼', '⎽', '⎼', '⎻'] class PixelSpinner(Spinner): phases = ['⣾', '⣷', '⣯', '⣟', '⡿', '⢿', '⣻', '⣽'] progress/helpers.py000064400000005446152347724720010452 0ustar00# Copyright (c) 2012 Giorgos Verigakis # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. from __future__ import print_function HIDE_CURSOR = '\x1b[?25l' SHOW_CURSOR = '\x1b[?25h' class WriteMixin(object): hide_cursor = False def __init__(self, message=None, **kwargs): super(WriteMixin, self).__init__(**kwargs) self._width = 0 if message: self.message = message if self.file.isatty(): if self.hide_cursor: print(HIDE_CURSOR, end='', file=self.file) print(self.message, end='', file=self.file) self.file.flush() def write(self, s): if self.file.isatty(): b = '\b' * self._width c = s.ljust(self._width) print(b + c, end='', file=self.file) self._width = max(self._width, len(s)) self.file.flush() def finish(self): if self.file.isatty() and self.hide_cursor: print(SHOW_CURSOR, end='', file=self.file) class WritelnMixin(object): hide_cursor = False def __init__(self, message=None, **kwargs): super(WritelnMixin, self).__init__(**kwargs) if message: self.message = message if self.file.isatty() and self.hide_cursor: print(HIDE_CURSOR, end='', file=self.file) def clearln(self): if self.file.isatty(): print('\r\x1b[K', end='', file=self.file) def writeln(self, line): if self.file.isatty(): self.clearln() print(line, end='', file=self.file) self.file.flush() def finish(self): if self.file.isatty(): print(file=self.file) if self.hide_cursor: print(SHOW_CURSOR, end='', file=self.file) from signal import signal, SIGINT from sys import exit class SigIntMixin(object): """Registers a signal handler that calls finish on SIGINT""" def __init__(self, *args, **kwargs): super(SigIntMixin, self).__init__(*args, **kwargs) signal(SIGINT, self._sigint_handler) def _sigint_handler(self, signum, frame): self.finish() exit(0) progress/__init__.py000064400000011371152347724720010541 0ustar00# Copyright (c) 2012 Giorgos Verigakis # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. from __future__ import division, print_function from collections import deque from datetime import timedelta from math import ceil from sys import stderr try: from time import monotonic except ImportError: from time import time as monotonic __version__ = '1.5' HIDE_CURSOR = '\x1b[?25l' SHOW_CURSOR = '\x1b[?25h' class Infinite(object): file = stderr sma_window = 10 # Simple Moving Average window check_tty = True hide_cursor = True def __init__(self, message='', **kwargs): self.index = 0 self.start_ts = monotonic() self.avg = 0 self._avg_update_ts = self.start_ts self._ts = self.start_ts self._xput = deque(maxlen=self.sma_window) for key, val in kwargs.items(): setattr(self, key, val) self._width = 0 self.message = message if self.file and self.is_tty(): if self.hide_cursor: print(HIDE_CURSOR, end='', file=self.file) print(self.message, end='', file=self.file) self.file.flush() def __getitem__(self, key): if key.startswith('_'): return None return getattr(self, key, None) @property def elapsed(self): return int(monotonic() - self.start_ts) @property def elapsed_td(self): return timedelta(seconds=self.elapsed) def update_avg(self, n, dt): if n > 0: xput_len = len(self._xput) self._xput.append(dt / n) now = monotonic() # update when we're still filling _xput, then after every second if (xput_len < self.sma_window or now - self._avg_update_ts > 1): self.avg = sum(self._xput) / len(self._xput) self._avg_update_ts = now def update(self): pass def start(self): pass def clearln(self): if self.file and self.is_tty(): print('\r\x1b[K', end='', file=self.file) def write(self, s): if self.file and self.is_tty(): line = self.message + s.ljust(self._width) print('\r' + line, end='', file=self.file) self._width = max(self._width, len(s)) self.file.flush() def writeln(self, line): if self.file and self.is_tty(): self.clearln() print(line, end='', file=self.file) self.file.flush() def finish(self): if self.file and self.is_tty(): print(file=self.file) if self.hide_cursor: print(SHOW_CURSOR, end='', file=self.file) def is_tty(self): return self.file.isatty() if self.check_tty else True def next(self, n=1): now = monotonic() dt = now - self._ts self.update_avg(n, dt) self._ts = now self.index = self.index + n self.update() def iter(self, it): with self: for x in it: yield x self.next() def __enter__(self): self.start() return self def __exit__(self, exc_type, exc_val, exc_tb): self.finish() class Progress(Infinite): def __init__(self, *args, **kwargs): super(Progress, self).__init__(*args, **kwargs) self.max = kwargs.get('max', 100) @property def eta(self): return int(ceil(self.avg * self.remaining)) @property def eta_td(self): return timedelta(seconds=self.eta) @property def percent(self): return self.progress * 100 @property def progress(self): return min(1, self.index / self.max) @property def remaining(self): return max(self.max - self.index, 0) def start(self): self.update() def goto(self, index): incr = index - self.index self.next(incr) def iter(self, it): try: self.max = len(it) except TypeError: pass with self: for x in it: yield x self.next() progress/counter.py000064400000002534152347724720010462 0ustar00# -*- coding: utf-8 -*- # Copyright (c) 2012 Giorgos Verigakis # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. from __future__ import unicode_literals from . import Infinite, Progress class Counter(Infinite): def update(self): self.write(str(self.index)) class Countdown(Progress): def update(self): self.write(str(self.remaining)) class Stack(Progress): phases = (' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█') def update(self): nphases = len(self.phases) i = min(nphases - 1, int(self.progress * nphases)) self.write(self.phases[i]) class Pie(Stack): phases = ('○', '◔', '◑', '◕', '●') html5lib/__pycache__/constants.cpython-36.pyc000064400000201300152347724720015147 0ustar003 PfE@s-ddlmZmZmZddlZdZddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d,d,d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddZdddddddZeeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfgZ eeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfgZ eeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfgNZ eeddfeddfeddfeddfgZ eeddfeddfeddfeddfeddfgZ ddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/>Zd0d1iZd2d3ed2fd2d4ed2fd2d5ed2fd2d6ed2fd2d7ed2fd2ded2fd2d8ed2fd9ded9fd9d:ed9fd9d;ed9fddd?ejDZed@dAdBdCdDgZedddddgZeejZeejZeejZeejZeejZedEd?ejDZd|Z edddFddddddddddԐdGdHgZ!eddgZ"edddddddgZ#edIgedJgedKgedLdMgedLdMgedNdOgedPgedQdRgedSdRdTdUgedVgedWgedRdXgedRdXdYgedRdXgedRdZgedRdXd[dZdTdKgedRdXdZdQgedRdXgd\Z$d}Z%edydzd{d|d}gZ&d~d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddÐdĐdŐdƐdǐdȐdɐdʐdːd̐d͐dΐdϐdАdѐdҐdӐddѐdԐdՐd֐dÐdאdؐdِdڐdېdܐdݐdސdߐdddddddddddddԐddddddddddddddddddddddddddddddddddd d d d d d dddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d(d+dd,d-d.d/d0d0d1d1d2d3d4d5d5d4d6d7dڐd8d9d:d;d<d=d>d?d@dAdBdCdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdՐd֐dudvdwdxdydzd{d|d}d~ddddאdؐdِddddXdddddddddddddddddddddd"ddAddddddddddddddddddddddddddddddddddddddddddddddÐ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ߐdddddddddddddddddd'ddddddddddddddddddddddddddddddd dd d d d ddddddddddddddddddd dڐd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0dߐd^d d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d?d@dAdBdCdDddEdFdGdHdFdIdIdJdKdLd@dMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d^d_d`dadbdcdcdddedfdgdgdhdidjdkdldmdndodpd1dqdrdsdtdudvdܐdݐdwdxdydzd{d|d}d~d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddɐdɐddddddddddddddddddddddddddÐdĐdŐdƐdǐdȐdɐdʐdːd̐dd͐dΐdϐdYdАdѐdҐdӐdԐdYdҐdՐdՐd֐dאdYddؐdؐdِdِddڐdېdܐdݐdސdߐdddddkddܐddddddݐdddddd:ddmddddddddddddd ddddddddddddddududdddddd d d d d dddddddddddddddd*dddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.dސdd/d/d0d1dߐdd2d3d4d5d5dd6d,d,d7d8d9d:d;d<d=d>d?d$d@dAdBdBdCdDdEdFdddGdHdHddIdJdKdKdLdMdNdOdPdQdRddSdTdUdVdPdWdXdYdZdZd[ddd\d]d^d3d^ddXd_dd`ddddadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdldmdydzd{d{dndwdydzdd|d}dԐd~dddߐddiddːdddϐdddddddddddddΐdΐdddѐdddddddddddddʐdӐddddddߐdddddddddddddddd ddddddddddddddddddddddddddddddddddddddddddÐdĐdĐdŐddddddƐdǐddȐdɐdʐdːd̐dӐdd͐dΐdΐdϐdϐdАdѐdddddҐdӐdԐdՐd֐dאdؐdِdڐdېdܐdݐdސd dߐddddddddddddddddddddddddddddddddddddddddddddddd"ddddddddd d d d dd d d̐d d dddddddddddddddd ddd֐ddd(ddgdddddddddd d!d"d#d$d%d&d'd(dd)d*dd+d+d;d,d,d-d.d/d/d֐d0d1d1d7d2d3d4d5d6d7d4d@d4d8d9d:dd;d<d=d8d9d>dd>d?d@dAdBdCdDd@dEdEdFddGdHdIdJdd<dKdLdMdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d}dՐd`dadvdbdcdddedXdfd]dgd]dhdidid^d_djdkd$dldmdndodpdqdrdsdtdudvdwdxdydzd{d|dadvd}d~dܐdddddd^doddsddgd`dddduddvdydydddddddhddudbdwdzddfddwdddsdddddddddddddddddddddbdddddldddddddidddddd`dddddddddzdddwdݐdddTdTddddddddddndddddddddddddddjdvddddddddÐdÐddאdĐdddŐd!ddƐdǐdddȐdɐddʐddːd̐d̐d͐dΐddϐdАdѐdҐddӐdԐdՐdƐd֐dאd̐dؐdِdڐd̐dېdېddddddܐdݐdސdːdߐdddddddxdxdddddddddddddddddАddddddddϐdddddddddddddddd͐ddddddddddddddddddddddddӐdddddddÐdŐdĐdd͐ddɐdʐdʐd͐ddddddddddÐdĐdddȐdǐdȐddddddddddddddd d d d d dddddddddddwdwddSdddTdUddddVdddddd d!d"d#d#d$d%dِddQd&d'dd(d)d*d+d,dd-d.d/dd0dRd1d2d2d3d3d4d4d5d6d7d8d2d9d9d:d;d;dd<d=d=d>dސd?d?dސd@dAddBdCdDdEdudFdGdHdIddJdKdߐdLddMddNdOd"dPddQdRdddSdTddUdVdWdWddXdYddddYdddZd[d\dd]dd[dZd\dd^d_d`ddddadbdcddded2dfdgdhd)didjdǐddd#dڐdkddldmdnd5dod dpdqd drdrd dsd dtdudvd%ddwdxdydzd{d|ddd}d~dddddddd~dddddddd$dd!dddddddddddd dyddddddzdddʐdddddddddddddddddddd%ddddddddddddddAddddCdBdddddddDdddddd ddddddddddddddddސddddddVddWdWdddddÐdĐdŐd^ddƐdǐddȐdɐdʐdːd̐d͐dΐdϐdАdѐdѐdސd7dҐd<dӐd8d9d8d9d:d;d:d;d6d6d d d dԐddȐd>dՐddŐdIdd֐dאdؐd@dِdڐdېdܐdݐdސd֐d@dאdܐdېdߐdddAddCdBddddDdEddddddddGddddHdddddddddGdHdddddddd!dddddddddddd[dddRdRddddYdVdUdYdVddd͐ddd#ddd3dddddddddJd dddnd ddd d d d dddddddddYddܐdddd1ddddddrddtdddddqddd d d!d"d#dѐdѐd$d%d1dsdqddnd&dyd&d'd(d(d)d*d+d,d-d.d dd'd/d/d0dݐd1d2dېd3dŐdWddIdLddsddd4d5d6d7ddldd8dd0d9d:d;ddd<dlddǐd=ddd>d5d4d7d6d?d@dAddBdCdDdEdCdddFd:ddmddGdؐddHdאdddIddJdddِddKddddddLdLdMdNdOdPdPdQdRdSdTdUdVdVdWdXdYdZdd[d\d]d^d_d`dadbdcZ'dddDdАdeddݐdddddOdEd,ddѐdfddgdhdݐddܐdd5ddd͐dJddddidXddj"Z(ddkdldmdndodpdqdrZ)ee)dse)dte)dugZ*edvd?ejDZ+dwe+d<Gdxdydye,Z-Gdzd{d{e.Z/dS(~)absolute_importdivisionunicode_literalsNz5Null character in input stream, replaced with U+FFFD.zInvalid codepoint in stream.z&Solidus (/) incorrectly placed in tag.z.Incorrect CR newline entity, replaced with LF.z9Entity used with illegal number (windows-1252 reference).zPNumeric entity couldn't be converted to character (codepoint U+%(charAsInt)08x).zBNumeric entity represents an illegal codepoint: U+%(charAsInt)08x.z#Numeric entity didn't end with ';'.z1Numeric entity expected. Got end of file instead.z'Numeric entity expected but none found.z!Named entity didn't end with ';'.z Named entity expected. Got none.z'End tag contains unexpected attributes.z.End tag contains unexpected self-closing flag.z#Expected tag name. Got '>' instead.zSExpected tag name. Got '?' instead. (HTML doesn't support processing instructions.)z-Expected tag name. Got something else insteadz6Expected closing tag. Got '>' instead. Ignoring ''.z-Expected closing tag. Unexpected end of file.z' instead.z"Unexpected = in unquoted attributez*Unexpected character in unquoted attributez*Unexpected character after attribute name.z+Unexpected character after attribute value.z.Unexpected end of file in attribute value (").z.Unexpected end of file in attribute value (').z*Unexpected end of file in attribute value.z)Unexpected end of file in tag. Expected >z/Unexpected character after / in tag. Expected >z&Expected '--' or 'DOCTYPE'. Not found.z Unexpected ! after -- in commentz$Unexpected space after -- in commentzIncorrect comment.z"Unexpected end of file in comment.z%Unexpected end of file in comment (-)z+Unexpected '-' after '--' found in comment.z'Unexpected end of file in comment (--).z&Unexpected character in comment found.z(No space after literal string 'DOCTYPE'.z.Unexpected > character. Expected DOCTYPE name.z.Unexpected end of file. Expected DOCTYPE name.z'Unexpected end of file in DOCTYPE name.z"Unexpected end of file in DOCTYPE.z%Expected space or '>'. Got '%(data)s'zUnexpected end of DOCTYPE.z Unexpected character in DOCTYPE.zXXX innerHTML EOFzUnexpected DOCTYPE. Ignored.z%html needs to be the first start tag.z)Unexpected End of file. Expected DOCTYPE.zErroneous DOCTYPE.z2Unexpected non-space characters. Expected DOCTYPE.z2Unexpected start tag (%(name)s). Expected DOCTYPE.z0Unexpected end tag (%(name)s). Expected DOCTYPE.z?Unexpected end tag (%(name)s) after the (implied) root element.z4Unexpected end of file. Expected end tag (%(name)s).z4Unexpected start tag head in existing head. Ignored.z'Unexpected end tag (%(name)s). Ignored.z;Unexpected start tag (%(name)s) that can be in head. Moved.z Unexpected start tag (%(name)s).zMissing end tag (%(name)s).zMissing end tags (%(name)s).zCUnexpected start tag (%(startName)s) implies end tag (%(endName)s).z@Unexpected start tag (%(originalName)s). Treated as %(newName)s.z,Unexpected start tag %(name)s. Don't use it!z'Unexpected start tag %(name)s. Ignored.zEUnexpected end tag (%(gotName)s). Missing end tag (%(expectedName)s).z:End tag (%(name)s) seen too early. Expected other end tag.zFUnexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).z+End tag (%(name)s) seen too early. Ignored.zQEnd tag (%(name)s) violates step 1, paragraph 1 of the adoption agency algorithm.zQEnd tag (%(name)s) violates step 1, paragraph 2 of the adoption agency algorithm.zQEnd tag (%(name)s) violates step 1, paragraph 3 of the adoption agency algorithm.zQEnd tag (%(name)s) violates step 4, paragraph 4 of the adoption agency algorithm.z>Unexpected end tag (%(originalName)s). Treated as %(newName)s.z'This element (%(name)s) has no end tag.z9Unexpected implied end tag (%(name)s) in the table phase.z>Unexpected implied end tag (%(name)s) in the table body phase.zDUnexpected non-space characters in table context caused voodoo mode.z3Unexpected input with type hidden in table context.z!Unexpected form in table context.zDUnexpected start tag (%(name)s) in table context caused voodoo mode.zBUnexpected end tag (%(name)s) in table context caused voodoo mode.zCUnexpected table cell start tag (%(name)s) in the table body phase.zFGot table cell end tag (%(name)s) while required end tags are missing.z?Unexpected end tag (%(name)s) in the table body phase. Ignored.z=Unexpected implied end tag (%(name)s) in the table row phase.z>Unexpected end tag (%(name)s) in the table row phase. Ignored.zJUnexpected select start tag in the select phase treated as select end tag.z/Unexpected input start tag in the select phase.zBUnexpected start tag token (%(name)s in the select phase. Ignored.z;Unexpected end tag (%(name)s) in the select phase. Ignored.zKUnexpected table element start tag (%(name)s) in the select in table phase.zIUnexpected table element end tag (%(name)s) in the select in table phase.z8Unexpected non-space characters in the after body phase.z>Unexpected start tag token (%(name)s) in the after body phase.zZ attributenameZ attributetypeZ basefrequencyZ baseprofileZcalcmodeZ clippathunitsZcontentscripttypeZcontentstyletypeZdiffuseconstantZedgemodeZexternalresourcesrequiredZ filterresZ filterunitsZglyphrefZgradienttransformZ gradientunitsZ kernelmatrixZkernelunitlengthZ keypointsZ keysplinesZkeytimesZ lengthadjustZlimitingconeangleZ markerheightZ markerunitsZ markerwidthZmaskcontentunitsZ maskunitsZ numoctavesZ pathlengthZpatterncontentunitsZpatterntransformZ patternunitsZ pointsatxZ pointsatyZ pointsatzZ preservealphaZpreserveaspectratioZprimitiveunitsZrefxZrefyZ repeatcountZ repeatdurZrequiredextensionsZrequiredfeaturesZspecularconstantZspecularexponentZ spreadmethodZ startoffsetZ stddeviationZ stitchtilesZ surfacescaleZsystemlanguageZ tablevaluesZtargetxZtargetyZ textlengthZviewboxZ viewtargetZxchannelselectorZychannelselectorZ zoomandpanZ definitionurlZ definitionURLrZactuateZarcroleZhrefZroleZshowtyper ZlangZspacer ) z xlink:actuatez xlink:arcrolez xlink:hrefz xlink:rolez xlink:showz xlink:titlez xlink:typezxml:basezxml:langz xml:spacer z xmlns:xlinkcCs"g|]\}\}}}||f|fqSr2).0ZqnameprefixZlocalnsr2r2/usr/lib/python3.6/constants.py sr7     cCs g|]}t|t|jfqSr2)ordlower)r3cr2r2r6r7#sz event-sourcesourceZtrackZ irrelevantZscopedZismapZautoplayZcontrolsZdeferasyncopenZmultipleZdisabledZhiddenZcheckeddefaultZnoshadeZ autosubmitreadonlyZselectedZ autofocusZrequired)r0r(ZaudioZvideor.rZdatagridrr'r+rZoptionZoptgrouprr)r/output   & ! 0 `9 R}    "   "!a: S~xzlt;zgt;zamp;zapos;zquot;Æ&ÁuĂÂuАu𝔄ÀuΑuĀu⩓uĄu𝔸u⁡Åu𝒜u≔ÃÄu∖u⫧u⌆uБu∵uℬuΒu𝔅u𝔹u˘u≎uЧ©uĆu⋒uⅅuℭuČÇuĈu∰uĊ¸·uΧu⊙u⊖u⊕u⊗u∲u”u’u∷u⩴u≡u∯u∮uℂu∐u∳u⨯u𝒞u⋓u≍u⤑uЂuЅuЏu‡u↡u⫤uĎuДu∇uΔu𝔇´u˙u˝`u˜u⋄uⅆu𝔻¨u⃜u≐u⇓u⇐u⇔u⟸u⟺u⟹u⇒u⊨u⇑u⇕u∥u↓u⤓u⇵ȗu⥐u⥞u↽u⥖u⥟u⇁u⥗u⊤u↧u𝒟uĐuŊÐÉuĚÊuЭuĖu𝔈Èu∈uĒu◻u▫uĘu𝔼uΕu⩵u≂u⇌uℰu⩳uΗËu∃uⅇuФu𝔉u◼u▪u𝔽u∀uℱuЃ>uΓuϜuĞuĢuĜuГuĠu𝔊u⋙u𝔾u≥u⋛u≧u⪢u≷u⩾u≳u𝒢u≫uЪuˇ^uĤuℌuℋuℍu─uĦu≏uЕuIJuЁÍÎuИuİuℑÌuĪuⅈu∬u∫u⋂u⁣u⁢uĮu𝕀uΙuℐuĨuІÏuĴuЙu𝔍u𝕁u𝒥uЈuЄuХuЌuΚuĶuКu𝔎u𝕂u𝒦uЉ⃒u⧞u⤂u≤⃒u<⃒u⊴⃒u⤃u⊵⃒u∼⃒u⇖u⤣u⤧óôuоuőu⨸u⦼uœu⦿u𝔬u˛òu⧁u⦵u⦾u⦻u⧀uōuωuοu⦶u𝕠u⦷u⦹u∨u⩝uℴªºu⊶u⩖u⩗u⩛øu⊘õu⨶öu⌽¶u⫳u⫽uп%.u‰u‱u𝔭uφuϕu☎uπuϖuℎ+u⨣u⨢u⨥u⩲u⨦u⨧u⨕u𝕡£u⪳u⪷u⪹u⪵u⋨u′u⌮u⌒u⌓u⊰u𝓅uψu u𝔮u𝕢u⁗u𝓆u⨖?u⤜u⥤u∽̱uŕu⦳u⦒u⦥»u⥵u⤠u⤳u⤞u⥅u⥴u↣u↝u⤚u∶u❳}]u⦌u⦎u⦐uřuŗuрu⤷u⥩u↳u▭u⥽u𝔯u⥬uρuϱu⇉u⋌u˚u‏u⎱u⫮u⟭u⇾u⦆u𝕣u⨮u⨵)u⦔u⨒u›u𝓇u⋊u▹u⧎u⥨u℞uśu⪴u⪸ušuşuŝu⪶u⪺u⋩u⨓uсu⋅u⩦u⇘§;u⤩u✶u𝔰u♯uщuш­uσuςu⩪u⪞u⪠u⪝u⪟u≆u⨤u⥲u⨳u⧤u⌣u⪪u⪬u⪬︀uь/u⧄u⌿u𝕤u♠u⊓︀u⊔︀u𝓈u☆u⊂u⫅u⪽u⫃u⫁u⫋u⊊u⪿u⥹u⫇u⫕u⫓u♪¹²³u⫆u⪾u⫘u⫄u⟉u⫗u⥻u⫂u⫌u⊋u⫀u⫈u⫔u⫖u⇙u⤪ßu⌖uτuťuţuтu⌕u𝔱uθuϑþ×u⨱u⨰u⌶u⫱u𝕥u⫚u‴u▵u≜u◬u⨺u⨹u⧍u⨻u⏢u𝓉uцuћuŧu⥣úuўuŭûuуuűu⥾u𝔲ùu▀u⌜u⌏u◸uūuųu𝕦uυu⇈u⌝u⌎uůu◹u𝓊u⋰uũüu⦧u⫨u⫩u⦜u⊊︀u⫋︀u⊋︀u⫌︀uвu⊻u≚u⋮u𝔳u𝕧u𝓋u⦚uŵu⩟u≙u℘u𝔴u𝕨u𝓌u𝔵uξu⋻u𝕩u𝓍ýuяuŷuы¥u𝔶uїu𝕪u𝓎uюÿuźužuзużuζu𝔷uжu⇝u𝕫u𝓏u‍u‌(ZAEligzAElig;ZAMPzAMP;ZAacutezAacute;zAbreve;ZAcirczAcirc;zAcy;zAfr;ZAgravezAgrave;zAlpha;zAmacr;zAnd;zAogon;zAopf;zApplyFunction;ZAringzAring;zAscr;zAssign;ZAtildezAtilde;ZAumlzAuml;z Backslash;zBarv;zBarwed;zBcy;zBecause;z Bernoullis;zBeta;zBfr;zBopf;zBreve;zBscr;zBumpeq;zCHcy;ZCOPYzCOPY;zCacute;zCap;zCapitalDifferentialD;zCayleys;zCcaron;ZCcedilzCcedil;zCcirc;zCconint;zCdot;zCedilla;z CenterDot;zCfr;zChi;z CircleDot;z CircleMinus;z CirclePlus;z CircleTimes;zClockwiseContourIntegral;zCloseCurlyDoubleQuote;zCloseCurlyQuote;zColon;zColone;z Congruent;zConint;zContourIntegral;zCopf;z Coproduct;z CounterClockwiseContourIntegral;zCross;zCscr;zCup;zCupCap;zDD;z DDotrahd;zDJcy;zDScy;zDZcy;zDagger;zDarr;zDashv;zDcaron;zDcy;zDel;zDelta;zDfr;zDiacriticalAcute;zDiacriticalDot;zDiacriticalDoubleAcute;zDiacriticalGrave;zDiacriticalTilde;zDiamond;zDifferentialD;zDopf;zDot;zDotDot;z DotEqual;zDoubleContourIntegral;z DoubleDot;zDoubleDownArrow;zDoubleLeftArrow;zDoubleLeftRightArrow;zDoubleLeftTee;zDoubleLongLeftArrow;zDoubleLongLeftRightArrow;zDoubleLongRightArrow;zDoubleRightArrow;zDoubleRightTee;zDoubleUpArrow;zDoubleUpDownArrow;zDoubleVerticalBar;z DownArrow;z DownArrowBar;zDownArrowUpArrow;z DownBreve;zDownLeftRightVector;zDownLeftTeeVector;zDownLeftVector;zDownLeftVectorBar;zDownRightTeeVector;zDownRightVector;zDownRightVectorBar;zDownTee;z DownTeeArrow;z Downarrow;zDscr;zDstrok;zENG;ZETHzETH;ZEacutezEacute;zEcaron;ZEcirczEcirc;zEcy;zEdot;zEfr;ZEgravezEgrave;zElement;zEmacr;zEmptySmallSquare;zEmptyVerySmallSquare;zEogon;zEopf;zEpsilon;zEqual;z EqualTilde;z Equilibrium;zEscr;zEsim;zEta;ZEumlzEuml;zExists;z ExponentialE;zFcy;zFfr;zFilledSmallSquare;zFilledVerySmallSquare;zFopf;zForAll;z Fouriertrf;zFscr;zGJcy;ZGTzGT;zGamma;zGammad;zGbreve;zGcedil;zGcirc;zGcy;zGdot;zGfr;zGg;zGopf;z GreaterEqual;zGreaterEqualLess;zGreaterFullEqual;zGreaterGreater;z GreaterLess;zGreaterSlantEqual;z GreaterTilde;zGscr;zGt;zHARDcy;zHacek;zHat;zHcirc;zHfr;z HilbertSpace;zHopf;zHorizontalLine;zHscr;zHstrok;z HumpDownHump;z HumpEqual;zIEcy;zIJlig;zIOcy;ZIacutezIacute;ZIcirczIcirc;zIcy;zIdot;zIfr;ZIgravezIgrave;zIm;zImacr;z ImaginaryI;zImplies;zInt;z Integral;z Intersection;zInvisibleComma;zInvisibleTimes;zIogon;zIopf;zIota;zIscr;zItilde;zIukcy;ZIumlzIuml;zJcirc;zJcy;zJfr;zJopf;zJscr;zJsercy;zJukcy;zKHcy;zKJcy;zKappa;zKcedil;zKcy;zKfr;zKopf;zKscr;zLJcy;ZLTzLT;zLacute;zLambda;zLang;z Laplacetrf;zLarr;zLcaron;zLcedil;zLcy;zLeftAngleBracket;z LeftArrow;z LeftArrowBar;zLeftArrowRightArrow;z LeftCeiling;zLeftDoubleBracket;zLeftDownTeeVector;zLeftDownVector;zLeftDownVectorBar;z LeftFloor;zLeftRightArrow;zLeftRightVector;zLeftTee;z LeftTeeArrow;zLeftTeeVector;z LeftTriangle;zLeftTriangleBar;zLeftTriangleEqual;zLeftUpDownVector;zLeftUpTeeVector;z LeftUpVector;zLeftUpVectorBar;z LeftVector;zLeftVectorBar;z Leftarrow;zLeftrightarrow;zLessEqualGreater;zLessFullEqual;z LessGreater;z LessLess;zLessSlantEqual;z LessTilde;zLfr;zLl;z Lleftarrow;zLmidot;zLongLeftArrow;zLongLeftRightArrow;zLongRightArrow;zLongleftarrow;zLongleftrightarrow;zLongrightarrow;zLopf;zLowerLeftArrow;zLowerRightArrow;zLscr;zLsh;zLstrok;zLt;zMap;zMcy;z MediumSpace;z Mellintrf;zMfr;z MinusPlus;zMopf;zMscr;zMu;zNJcy;zNacute;zNcaron;zNcedil;zNcy;zNegativeMediumSpace;zNegativeThickSpace;zNegativeThinSpace;zNegativeVeryThinSpace;zNestedGreaterGreater;zNestedLessLess;zNewLine;zNfr;zNoBreak;zNonBreakingSpace;zNopf;zNot;z NotCongruent;z NotCupCap;zNotDoubleVerticalBar;z NotElement;z NotEqual;zNotEqualTilde;z NotExists;z NotGreater;zNotGreaterEqual;zNotGreaterFullEqual;zNotGreaterGreater;zNotGreaterLess;zNotGreaterSlantEqual;zNotGreaterTilde;zNotHumpDownHump;z NotHumpEqual;zNotLeftTriangle;zNotLeftTriangleBar;zNotLeftTriangleEqual;zNotLess;z NotLessEqual;zNotLessGreater;z NotLessLess;zNotLessSlantEqual;z NotLessTilde;zNotNestedGreaterGreater;zNotNestedLessLess;z NotPrecedes;zNotPrecedesEqual;zNotPrecedesSlantEqual;zNotReverseElement;zNotRightTriangle;zNotRightTriangleBar;zNotRightTriangleEqual;zNotSquareSubset;zNotSquareSubsetEqual;zNotSquareSuperset;zNotSquareSupersetEqual;z NotSubset;zNotSubsetEqual;z NotSucceeds;zNotSucceedsEqual;zNotSucceedsSlantEqual;zNotSucceedsTilde;z NotSuperset;zNotSupersetEqual;z NotTilde;zNotTildeEqual;zNotTildeFullEqual;zNotTildeTilde;zNotVerticalBar;zNscr;ZNtildezNtilde;zNu;zOElig;ZOacutezOacute;ZOcirczOcirc;zOcy;zOdblac;zOfr;ZOgravezOgrave;zOmacr;zOmega;zOmicron;zOopf;zOpenCurlyDoubleQuote;zOpenCurlyQuote;zOr;zOscr;ZOslashzOslash;ZOtildezOtilde;zOtimes;ZOumlzOuml;zOverBar;z OverBrace;z OverBracket;zOverParenthesis;z PartialD;zPcy;zPfr;zPhi;zPi;z PlusMinus;zPoincareplane;zPopf;zPr;z Precedes;zPrecedesEqual;zPrecedesSlantEqual;zPrecedesTilde;zPrime;zProduct;z Proportion;z Proportional;zPscr;zPsi;ZQUOTzQUOT;zQfr;zQopf;zQscr;zRBarr;ZREGzREG;zRacute;zRang;zRarr;zRarrtl;zRcaron;zRcedil;zRcy;zRe;zReverseElement;zReverseEquilibrium;zReverseUpEquilibrium;zRfr;zRho;zRightAngleBracket;z RightArrow;zRightArrowBar;zRightArrowLeftArrow;z RightCeiling;zRightDoubleBracket;zRightDownTeeVector;zRightDownVector;zRightDownVectorBar;z RightFloor;z RightTee;zRightTeeArrow;zRightTeeVector;zRightTriangle;zRightTriangleBar;zRightTriangleEqual;zRightUpDownVector;zRightUpTeeVector;zRightUpVector;zRightUpVectorBar;z RightVector;zRightVectorBar;z Rightarrow;zRopf;z RoundImplies;z Rrightarrow;zRscr;zRsh;z RuleDelayed;zSHCHcy;zSHcy;zSOFTcy;zSacute;zSc;zScaron;zScedil;zScirc;zScy;zSfr;zShortDownArrow;zShortLeftArrow;zShortRightArrow;z ShortUpArrow;zSigma;z SmallCircle;zSopf;zSqrt;zSquare;zSquareIntersection;z SquareSubset;zSquareSubsetEqual;zSquareSuperset;zSquareSupersetEqual;z SquareUnion;zSscr;zStar;zSub;zSubset;z SubsetEqual;z Succeeds;zSucceedsEqual;zSucceedsSlantEqual;zSucceedsTilde;z SuchThat;zSum;zSup;z Superset;zSupersetEqual;zSupset;ZTHORNzTHORN;zTRADE;zTSHcy;zTScy;zTab;zTau;zTcaron;zTcedil;zTcy;zTfr;z Therefore;zTheta;z ThickSpace;z ThinSpace;zTilde;z TildeEqual;zTildeFullEqual;z TildeTilde;zTopf;z TripleDot;zTscr;zTstrok;ZUacutezUacute;zUarr;z Uarrocir;zUbrcy;zUbreve;ZUcirczUcirc;zUcy;zUdblac;zUfr;ZUgravezUgrave;zUmacr;z UnderBar;z UnderBrace;z UnderBracket;zUnderParenthesis;zUnion;z UnionPlus;zUogon;zUopf;zUpArrow;z UpArrowBar;zUpArrowDownArrow;z UpDownArrow;zUpEquilibrium;zUpTee;z UpTeeArrow;zUparrow;z Updownarrow;zUpperLeftArrow;zUpperRightArrow;zUpsi;zUpsilon;zUring;zUscr;zUtilde;ZUumlzUuml;zVDash;zVbar;zVcy;zVdash;zVdashl;zVee;zVerbar;zVert;z VerticalBar;z VerticalLine;zVerticalSeparator;zVerticalTilde;zVeryThinSpace;zVfr;zVopf;zVscr;zVvdash;zWcirc;zWedge;zWfr;zWopf;zWscr;zXfr;zXi;zXopf;zXscr;zYAcy;zYIcy;zYUcy;ZYacutezYacute;zYcirc;zYcy;zYfr;zYopf;zYscr;zYuml;zZHcy;zZacute;zZcaron;zZcy;zZdot;zZeroWidthSpace;zZeta;zZfr;zZopf;zZscr;Zaacutezaacute;zabreve;zac;zacE;zacd;Zacirczacirc;Zacutezacute;zacy;Zaeligzaelig;zaf;zafr;Zagravezagrave;zalefsym;zaleph;zalpha;zamacr;zamalg;Zampzamp;zand;zandand;zandd;z andslope;zandv;zang;zange;zangle;zangmsd;z angmsdaa;z angmsdab;z angmsdac;z angmsdad;z angmsdae;z angmsdaf;z angmsdag;z angmsdah;zangrt;zangrtvb;z angrtvbd;zangsph;zangst;zangzarr;zaogon;zaopf;zap;zapE;zapacir;zape;zapid;zapos;zapprox;z approxeq;Zaringzaring;zascr;zast;zasymp;zasympeq;Zatildezatilde;Zaumlzauml;z awconint;zawint;zbNot;z backcong;z backepsilon;z backprime;zbacksim;z backsimeq;zbarvee;zbarwed;z barwedge;zbbrk;z bbrktbrk;zbcong;zbcy;zbdquo;zbecaus;zbecause;zbemptyv;zbepsi;zbernou;zbeta;zbeth;zbetween;zbfr;zbigcap;zbigcirc;zbigcup;zbigodot;z bigoplus;z bigotimes;z bigsqcup;zbigstar;zbigtriangledown;zbigtriangleup;z biguplus;zbigvee;z bigwedge;zbkarow;z blacklozenge;z blacksquare;zblacktriangle;zblacktriangledown;zblacktriangleleft;zblacktriangleright;zblank;zblk12;zblk14;zblk34;zblock;zbne;zbnequiv;zbnot;zbopf;zbot;zbottom;zbowtie;zboxDL;zboxDR;zboxDl;zboxDr;zboxH;zboxHD;zboxHU;zboxHd;zboxHu;zboxUL;zboxUR;zboxUl;zboxUr;zboxV;zboxVH;zboxVL;zboxVR;zboxVh;zboxVl;zboxVr;zboxbox;zboxdL;zboxdR;zboxdl;zboxdr;zboxh;zboxhD;zboxhU;zboxhd;zboxhu;z boxminus;zboxplus;z boxtimes;zboxuL;zboxuR;zboxul;zboxur;zboxv;zboxvH;zboxvL;zboxvR;zboxvh;zboxvl;zboxvr;zbprime;zbreve;Zbrvbarzbrvbar;zbscr;zbsemi;zbsim;zbsime;zbsol;zbsolb;z bsolhsub;zbull;zbullet;zbump;zbumpE;zbumpe;zbumpeq;zcacute;zcap;zcapand;z capbrcup;zcapcap;zcapcup;zcapdot;zcaps;zcaret;zcaron;zccaps;zccaron;Zccedilzccedil;zccirc;zccups;zccupssm;zcdot;Zcedilzcedil;zcemptyv;Zcentzcent;z centerdot;zcfr;zchcy;zcheck;z checkmark;zchi;zcir;zcirE;zcirc;zcirceq;zcirclearrowleft;zcirclearrowright;z circledR;z circledS;z circledast;z circledcirc;z circleddash;zcire;z cirfnint;zcirmid;zcirscir;zclubs;z clubsuit;zcolon;zcolone;zcoloneq;zcomma;zcommat;zcomp;zcompfn;z complement;z complexes;zcong;zcongdot;zconint;zcopf;zcoprod;copyzcopy;zcopysr;zcrarr;zcross;zcscr;zcsub;zcsube;zcsup;zcsupe;zctdot;zcudarrl;zcudarrr;zcuepr;zcuesc;zcularr;zcularrp;zcup;z cupbrcap;zcupcap;zcupcup;zcupdot;zcupor;zcups;zcurarr;zcurarrm;z curlyeqprec;z curlyeqsucc;z curlyvee;z curlywedge;Zcurrenzcurren;zcurvearrowleft;zcurvearrowright;zcuvee;zcuwed;z cwconint;zcwint;zcylcty;zdArr;zdHar;zdagger;zdaleth;zdarr;zdash;zdashv;zdbkarow;zdblac;zdcaron;zdcy;zdd;zddagger;zddarr;zddotseq;Zdegzdeg;zdelta;zdemptyv;zdfisht;zdfr;zdharl;zdharr;zdiam;zdiamond;z diamondsuit;zdiams;zdie;zdigamma;zdisin;zdiv;Zdividezdivide;zdivideontimes;zdivonx;zdjcy;zdlcorn;zdlcrop;zdollar;zdopf;zdot;zdoteq;z doteqdot;z dotminus;zdotplus;z dotsquare;zdoublebarwedge;z downarrow;zdowndownarrows;zdownharpoonleft;zdownharpoonright;z drbkarow;zdrcorn;zdrcrop;zdscr;zdscy;zdsol;zdstrok;zdtdot;zdtri;zdtrif;zduarr;zduhar;zdwangle;zdzcy;z dzigrarr;zeDDot;zeDot;Zeacutezeacute;zeaster;zecaron;zecir;Zecirczecirc;zecolon;zecy;zedot;zee;zefDot;zefr;zeg;Zegravezegrave;zegs;zegsdot;zel;z elinters;zell;zels;zelsdot;zemacr;zempty;z emptyset;zemptyv;zemsp13;zemsp14;zemsp;zeng;zensp;zeogon;zeopf;zepar;zeparsl;zeplus;zepsi;zepsilon;zepsiv;zeqcirc;zeqcolon;zeqsim;z eqslantgtr;z eqslantless;zequals;zequest;zequiv;zequivDD;z eqvparsl;zerDot;zerarr;zescr;zesdot;zesim;zeta;Zethzeth;Zeumlzeuml;zeuro;zexcl;zexist;z expectation;z exponentiale;zfallingdotseq;zfcy;zfemale;zffilig;zfflig;zffllig;zffr;zfilig;zfjlig;zflat;zfllig;zfltns;zfnof;zfopf;zforall;zfork;zforkv;z fpartint;Zfrac12zfrac12;zfrac13;Zfrac14zfrac14;zfrac15;zfrac16;zfrac18;zfrac23;zfrac25;Zfrac34zfrac34;zfrac35;zfrac38;zfrac45;zfrac56;zfrac58;zfrac78;zfrasl;zfrown;zfscr;zgE;zgEl;zgacute;zgamma;zgammad;zgap;zgbreve;zgcirc;zgcy;zgdot;zge;zgel;zgeq;zgeqq;z geqslant;zges;zgescc;zgesdot;zgesdoto;z gesdotol;zgesl;zgesles;zgfr;zgg;zggg;zgimel;zgjcy;zgl;zglE;zgla;zglj;zgnE;zgnap;z gnapprox;zgne;zgneq;zgneqq;zgnsim;zgopf;zgrave;zgscr;zgsim;zgsime;zgsiml;gtzgt;zgtcc;zgtcir;zgtdot;zgtlPar;zgtquest;z gtrapprox;zgtrarr;zgtrdot;z gtreqless;z gtreqqless;zgtrless;zgtrsim;z gvertneqq;zgvnE;zhArr;zhairsp;zhalf;zhamilt;zhardcy;zharr;zharrcir;zharrw;zhbar;zhcirc;zhearts;z heartsuit;zhellip;zhercon;zhfr;z hksearow;z hkswarow;zhoarr;zhomtht;zhookleftarrow;zhookrightarrow;zhopf;zhorbar;zhscr;zhslash;zhstrok;zhybull;zhyphen;Ziacuteziacute;zic;Zicirczicirc;zicy;ziecy;Ziexclziexcl;ziff;zifr;Zigravezigrave;zii;ziiiint;ziiint;ziinfin;ziiota;zijlig;zimacr;zimage;z imagline;z imagpart;zimath;zimof;zimped;zin;zincare;zinfin;z infintie;zinodot;zint;zintcal;z integers;z intercal;z intlarhk;zintprod;ziocy;ziogon;ziopf;ziota;ziprod;Ziquestziquest;ziscr;zisin;zisinE;zisindot;zisins;zisinsv;zisinv;zit;zitilde;ziukcy;Ziumlziuml;zjcirc;zjcy;zjfr;zjmath;zjopf;zjscr;zjsercy;zjukcy;zkappa;zkappav;zkcedil;zkcy;zkfr;zkgreen;zkhcy;zkjcy;zkopf;zkscr;zlAarr;zlArr;zlAtail;zlBarr;zlE;zlEg;zlHar;zlacute;z laemptyv;zlagran;zlambda;zlang;zlangd;zlangle;zlap;Zlaquozlaquo;zlarr;zlarrb;zlarrbfs;zlarrfs;zlarrhk;zlarrlp;zlarrpl;zlarrsim;zlarrtl;zlat;zlatail;zlate;zlates;zlbarr;zlbbrk;zlbrace;zlbrack;zlbrke;zlbrksld;zlbrkslu;zlcaron;zlcedil;zlceil;zlcub;zlcy;zldca;zldquo;zldquor;zldrdhar;z ldrushar;zldsh;zle;z leftarrow;zleftarrowtail;zleftharpoondown;zleftharpoonup;zleftleftarrows;zleftrightarrow;zleftrightarrows;zleftrightharpoons;zleftrightsquigarrow;zleftthreetimes;zleg;zleq;zleqq;z leqslant;zles;zlescc;zlesdot;zlesdoto;z lesdotor;zlesg;zlesges;z lessapprox;zlessdot;z lesseqgtr;z lesseqqgtr;zlessgtr;zlesssim;zlfisht;zlfloor;zlfr;zlg;zlgE;zlhard;zlharu;zlharul;zlhblk;zljcy;zll;zllarr;z llcorner;zllhard;zlltri;zlmidot;zlmoust;z lmoustache;zlnE;zlnap;z lnapprox;zlne;zlneq;zlneqq;zlnsim;zloang;zloarr;zlobrk;zlongleftarrow;zlongleftrightarrow;z longmapsto;zlongrightarrow;zlooparrowleft;zlooparrowright;zlopar;zlopf;zloplus;zlotimes;zlowast;zlowbar;zloz;zlozenge;zlozf;zlpar;zlparlt;zlrarr;z lrcorner;zlrhar;zlrhard;zlrm;zlrtri;zlsaquo;zlscr;zlsh;zlsim;zlsime;zlsimg;zlsqb;zlsquo;zlsquor;zlstrok;ltzlt;zltcc;zltcir;zltdot;zlthree;zltimes;zltlarr;zltquest;zltrPar;zltri;zltrie;zltrif;z lurdshar;zluruhar;z lvertneqq;zlvnE;zmDDot;Zmacrzmacr;zmale;zmalt;zmaltese;zmap;zmapsto;z mapstodown;z mapstoleft;z mapstoup;zmarker;zmcomma;zmcy;zmdash;zmeasuredangle;zmfr;zmho;microzmicro;zmid;zmidast;zmidcir;Zmiddotzmiddot;zminus;zminusb;zminusd;zminusdu;zmlcp;zmldr;zmnplus;zmodels;zmopf;zmp;zmscr;zmstpos;zmu;z multimap;zmumap;znGg;znGt;znGtv;z nLeftarrow;znLeftrightarrow;znLl;znLt;znLtv;z nRightarrow;znVDash;znVdash;znabla;znacute;znang;znap;znapE;znapid;znapos;znapprox;znatur;znatural;z naturals;Znbspznbsp;znbump;znbumpe;zncap;zncaron;zncedil;zncong;z ncongdot;zncup;zncy;zndash;zne;zneArr;znearhk;znearr;znearrow;znedot;znequiv;znesear;znesim;znexist;znexists;znfr;zngE;znge;zngeq;zngeqq;z ngeqslant;znges;zngsim;zngt;zngtr;znhArr;znharr;znhpar;zni;znis;znisd;zniv;znjcy;znlArr;znlE;znlarr;znldr;znle;z nleftarrow;znleftrightarrow;znleq;znleqq;z nleqslant;znles;znless;znlsim;znlt;znltri;znltrie;znmid;znopf;notznot;znotin;znotinE;z notindot;znotinva;znotinvb;znotinvc;znotni;znotniva;znotnivb;znotnivc;znpar;z nparallel;znparsl;znpart;znpolint;znpr;znprcue;znpre;znprec;znpreceq;znrArr;znrarr;znrarrc;znrarrw;z nrightarrow;znrtri;znrtrie;znsc;znsccue;znsce;znscr;z nshortmid;znshortparallel;znsim;znsime;znsimeq;znsmid;znspar;znsqsube;znsqsupe;znsub;znsubE;znsube;znsubset;z nsubseteq;z nsubseteqq;znsucc;znsucceq;znsup;znsupE;znsupe;znsupset;z nsupseteq;z nsupseteqq;zntgl;Zntildezntilde;zntlg;zntriangleleft;zntrianglelefteq;zntriangleright;zntrianglerighteq;znu;znum;znumero;znumsp;znvDash;znvHarr;znvap;znvdash;znvge;znvgt;znvinfin;znvlArr;znvle;znvlt;znvltrie;znvrArr;znvrtrie;znvsim;znwArr;znwarhk;znwarr;znwarrow;znwnear;zoS;Zoacutezoacute;zoast;zocir;Zocirczocirc;zocy;zodash;zodblac;zodiv;zodot;zodsold;zoelig;zofcir;zofr;zogon;Zogravezograve;zogt;zohbar;zohm;zoint;zolarr;zolcir;zolcross;zoline;zolt;zomacr;zomega;zomicron;zomid;zominus;zoopf;zopar;zoperp;zoplus;zor;zorarr;zord;zorder;zorderof;Zordfzordf;Zordmzordm;zorigof;zoror;zorslope;zorv;zoscr;Zoslashzoslash;zosol;Zotildezotilde;zotimes;z otimesas;Zoumlzouml;zovbar;zpar;Zparazpara;z parallel;zparsim;zparsl;zpart;zpcy;zpercnt;zperiod;zpermil;zperp;zpertenk;zpfr;zphi;zphiv;zphmmat;zphone;zpi;z pitchfork;zpiv;zplanck;zplanckh;zplankv;zplus;z plusacir;zplusb;zpluscir;zplusdo;zplusdu;zpluse;Zplusmnzplusmn;zplussim;zplustwo;zpm;z pointint;zpopf;Zpoundzpound;zpr;zprE;zprap;zprcue;zpre;zprec;z precapprox;z preccurlyeq;zpreceq;z precnapprox;z precneqq;z precnsim;zprecsim;zprime;zprimes;zprnE;zprnap;zprnsim;zprod;z profalar;z profline;z profsurf;zprop;zpropto;zprsim;zprurel;zpscr;zpsi;zpuncsp;zqfr;zqint;zqopf;zqprime;zqscr;z quaternions;zquatint;zquest;zquesteq;Zquotzquot;zrAarr;zrArr;zrAtail;zrBarr;zrHar;zrace;zracute;zradic;z raemptyv;zrang;zrangd;zrange;zrangle;Zraquozraquo;zrarr;zrarrap;zrarrb;zrarrbfs;zrarrc;zrarrfs;zrarrhk;zrarrlp;zrarrpl;zrarrsim;zrarrtl;zrarrw;zratail;zratio;z rationals;zrbarr;zrbbrk;zrbrace;zrbrack;zrbrke;zrbrksld;zrbrkslu;zrcaron;zrcedil;zrceil;zrcub;zrcy;zrdca;zrdldhar;zrdquo;zrdquor;zrdsh;zreal;zrealine;z realpart;zreals;zrect;Zregzreg;zrfisht;zrfloor;zrfr;zrhard;zrharu;zrharul;zrho;zrhov;z rightarrow;zrightarrowtail;zrightharpoondown;zrightharpoonup;zrightleftarrows;zrightleftharpoons;zrightrightarrows;zrightsquigarrow;zrightthreetimes;zring;z risingdotseq;zrlarr;zrlhar;zrlm;zrmoust;z rmoustache;zrnmid;zroang;zroarr;zrobrk;zropar;zropf;zroplus;zrotimes;zrpar;zrpargt;z rppolint;zrrarr;zrsaquo;zrscr;zrsh;zrsqb;zrsquo;zrsquor;zrthree;zrtimes;zrtri;zrtrie;zrtrif;z rtriltri;zruluhar;zrx;zsacute;zsbquo;zsc;zscE;zscap;zscaron;zsccue;zsce;zscedil;zscirc;zscnE;zscnap;zscnsim;z scpolint;zscsim;zscy;zsdot;zsdotb;zsdote;zseArr;zsearhk;zsearr;zsearrow;Zsectzsect;zsemi;zseswar;z setminus;zsetmn;zsext;zsfr;zsfrown;zsharp;zshchcy;zshcy;z shortmid;zshortparallel;Zshyzshy;zsigma;zsigmaf;zsigmav;zsim;zsimdot;zsime;zsimeq;zsimg;zsimgE;zsiml;zsimlE;zsimne;zsimplus;zsimrarr;zslarr;zsmallsetminus;zsmashp;z smeparsl;zsmid;zsmile;zsmt;zsmte;zsmtes;zsoftcy;zsol;zsolb;zsolbar;zsopf;zspades;z spadesuit;zspar;zsqcap;zsqcaps;zsqcup;zsqcups;zsqsub;zsqsube;z sqsubset;z sqsubseteq;zsqsup;zsqsupe;z sqsupset;z sqsupseteq;zsqu;zsquare;zsquarf;zsquf;zsrarr;zsscr;zssetmn;zssmile;zsstarf;zstar;zstarf;zstraightepsilon;z straightphi;zstrns;zsub;zsubE;zsubdot;zsube;zsubedot;zsubmult;zsubnE;zsubne;zsubplus;zsubrarr;zsubset;z subseteq;z subseteqq;z subsetneq;z subsetneqq;zsubsim;zsubsub;zsubsup;zsucc;z succapprox;z succcurlyeq;zsucceq;z succnapprox;z succneqq;z succnsim;zsuccsim;zsum;zsung;Zsup1zsup1;Zsup2zsup2;Zsup3zsup3;zsup;zsupE;zsupdot;zsupdsub;zsupe;zsupedot;zsuphsol;zsuphsub;zsuplarr;zsupmult;zsupnE;zsupne;zsupplus;zsupset;z supseteq;z supseteqq;z supsetneq;z supsetneqq;zsupsim;zsupsub;zsupsup;zswArr;zswarhk;zswarr;zswarrow;zswnwar;Zszligzszlig;ztarget;ztau;ztbrk;ztcaron;ztcedil;ztcy;ztdot;ztelrec;ztfr;zthere4;z therefore;ztheta;z thetasym;zthetav;z thickapprox;z thicksim;zthinsp;zthkap;zthksim;Zthornzthorn;ztilde;timesztimes;ztimesb;z timesbar;ztimesd;ztint;ztoea;ztop;ztopbot;ztopcir;ztopf;ztopfork;ztosa;ztprime;ztrade;z triangle;z triangledown;z triangleleft;ztrianglelefteq;z triangleq;ztriangleright;ztrianglerighteq;ztridot;ztrie;z triminus;ztriplus;ztrisb;ztritime;z trpezium;ztscr;ztscy;ztshcy;ztstrok;ztwixt;ztwoheadleftarrow;ztwoheadrightarrow;zuArr;zuHar;Zuacutezuacute;zuarr;zubrcy;zubreve;Zucirczucirc;zucy;zudarr;zudblac;zudhar;zufisht;zufr;Zugravezugrave;zuharl;zuharr;zuhblk;zulcorn;z ulcorner;zulcrop;zultri;zumacr;Zumlzuml;zuogon;zuopf;zuparrow;z updownarrow;zupharpoonleft;zupharpoonright;zuplus;zupsi;zupsih;zupsilon;z upuparrows;zurcorn;z urcorner;zurcrop;zuring;zurtri;zuscr;zutdot;zutilde;zutri;zutrif;zuuarr;Zuumlzuuml;zuwangle;zvArr;zvBar;zvBarv;zvDash;zvangrt;z varepsilon;z varkappa;z varnothing;zvarphi;zvarpi;z varpropto;zvarr;zvarrho;z varsigma;z varsubsetneq;zvarsubsetneqq;z varsupsetneq;zvarsupsetneqq;z vartheta;zvartriangleleft;zvartriangleright;zvcy;zvdash;zvee;zveebar;zveeeq;zvellip;zverbar;zvert;zvfr;zvltri;zvnsub;zvnsup;zvopf;zvprop;zvrtri;zvscr;zvsubnE;zvsubne;zvsupnE;zvsupne;zvzigzag;zwcirc;zwedbar;zwedge;zwedgeq;zweierp;zwfr;zwopf;zwp;zwr;zwreath;zwscr;zxcap;zxcirc;zxcup;zxdtri;zxfr;zxhArr;zxharr;zxi;zxlArr;zxlarr;zxmap;zxnis;zxodot;zxopf;zxoplus;zxotime;zxrArr;zxrarr;zxscr;zxsqcup;zxuplus;zxutri;zxvee;zxwedge;Zyacutezyacute;zyacy;zycirc;zycy;Zyenzyen;zyfr;zyicy;zyopf;zyscr;zyucy;Zyumlzyuml;zzacute;zzcaron;zzcy;zzdot;zzeetrf;zzeta;zzfr;zzhcy;zzigrarr;zzopf;zzscr;zzwj;zzwnj;u�)"r )ZDoctypeZ CharactersZSpaceCharactersStartTagEndTagEmptyTagCommentZ ParseErrorrrrcCsg|]\}}||fqSr2r2)r3kvr2r2r6r7x sZmathc@s eZdZdS)DataLossWarningN)__name__ __module__ __qualname__r2r2r2r6r| src@s eZdZdS)ReparseExceptionN)rrrr2r2r2r6r sr)rr r!r"r#r$) rGrHrIrJrKrLrMrNrOrPrQrRrSrHrTrHrHrUrVrWrXrYrZr[r\r]r^r_r`rHrarb)0Z __future__rrrstringZEOFEZ namespaces frozensetZscopingElementsZformattingElementsZspecialElementsZhtmlIntegrationPointElementsZ"mathmlTextIntegrationPointElementsZadjustSVGAttributesZadjustMathMLAttributesZadjustForeignAttributesdictitemsZunadjustForeignAttributesZspaceCharactersZtableInsertModeElementsZascii_lowercaseZasciiLowercaseZascii_uppercaseZasciiUppercaseZ ascii_lettersZ asciiLettersZdigitsZ hexdigitsZ hexDigitsZasciiUpper2LowerZheadingElementsZ voidElementsZ cdataElementsZrcdataElementsZbooleanAttributesZentitiesWindows1252Z xmlEntitiesZentitiesZreplacementCharactersZ tokenTypesZ tagTokenTypesprefixes UserWarningr Exceptionrr2r2r2r6s<                                                                                                                                       html5lib/__pycache__/_utils.cpython-36.pyc000064400000006332152347724720014442 0ustar003 Pf@s ddlmZmZmZddlZddlmZddlmZyddl j j Z Wn e k rdddlj jZ YnXddddd d d gZejdd koejd dkZy,edZeeesedZeeestWndZYnXdZGdddeZddZddZdd ZddZdS))absolute_importdivisionunicode_literalsN) ModuleType) text_type default_etreeMethodDispatcherisSurrogatePairsurrogatePairToCodepointmoduleFactoryFactorysupports_lone_surrogatesPY27z"\uD800"z u"\uD800"FTc@s$eZdZdZffddZddZdS)rapDict 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. cCs~g}xN|D]F\}}t|ttttfrBx*|D]}|j||fq*Wq |j||fq Wtj||t|t|kstt d|_ dS)N) isinstancelisttuple frozensetsetappenddict__init__lenAssertionErrordefault)selfitemsZ _dictEntriesnamevalueitemr!/usr/lib/python3.6/_utils.pyr4s  zMethodDispatcher.__init__cCstj|||jS)N)rgetr)rkeyr!r!r" __getitem__CszMethodDispatcher.__getitem__N)__name__ __module__ __qualname____doc__rr%r!r!r!r"r's  cCsLt|dkoJt|ddkoJt|ddkoJt|ddkoJt|ddkS)Nrriirii)rord)datar!r!r"r Js  cCs,dt|dddt|dd}|S)Niriiri)r*)r+Zchar_valr!r!r"r Pscsifdd}|S)Nc sttjtdrd|j}n d|j}t|j}y|||Stk rt|}|f||}|jj|dkri|<d|kri||<d||kri|||<||||<|SXdS)Nz _%s_factorys _%s_factoryrargskwargs) rrr&typerrKeyError__dict__update)Z baseModuler-r.rZ kwargs_tuplemodZobjs)factory moduleCacher!r" moduleFactory\s$      z+moduleFactoryFactory..moduleFactoryr!)r4r6r!)r4r5r"r Yscsifdd}|S)Ncs2t|t|jf}|kr*|||<|S)N)rr)r-r.r$)cachefuncr!r"wrappedyszmemoize..wrappedr!)r8r9r!)r7r8r"memoizevsr:)Z __future__rrrsystypesrZpip._vendor.sixrZxml.etree.cElementTreeZetreeZ cElementTreer ImportErrorZxml.etree.ElementTreeZ ElementTree__all__ version_infor evalZ_xrrr rrr r r r:r!r!r!r"s0    # html5lib/__pycache__/html5parser.cpython-36.opt-1.pyc000064400000275615152347724720016364 0ustar003 Pf @sFddlmZmZmZddlmZmZmZddlZyddl m Z Wn e k r`ddl m Z YnXddl mZddl mZddl mZdd lmZdd l mZdd lmZmZmZmZmZmZmZmZmZmZmZm Z!m"Z"m#Z#m$Z$m%Z%d!ddZ&d"ddZ'ddZ(Gddde)Z*ej+ddZ,ddZ-d#ddZ.Gdd d e/Z0dS)$)absolute_importdivisionunicode_literals)with_metaclassviewkeysPY3N) OrderedDict) _inputstream) _tokenizer) treebuilders)Marker)_utils)spaceCharactersasciiUpper2LowerspecialElementsheadingElements cdataElementsrcdataElements tokenTypes tagTokenTypes namespaceshtmlIntegrationPointElements"mathmlTextIntegrationPointElementsadjustForeignAttributesadjustMathMLAttributesadjustSVGAttributesEReparseExceptionetreeTcKs$tj|}t||d}|j|f|S)z.Parse a string or file-like object into a tree)namespaceHTMLElements)r getTreeBuilder HTMLParserparse)doc treebuilderr kwargstbpr)!/usr/lib/python3.6/html5parser.pyr#s  r#divcKs,tj|}t||d}|j|fd|i|S)N)r container)r r!r" parseFragment)r$r,r%r r&r'r(r)r)r*r-&s  r-csGfdddt}|S)NcseZdZfddZdS)z-method_decorator_metaclass..DecoratedcsBx0|jD]$\}}t|tjr&|}|||<q Wtj||||S)N)items isinstancetypes FunctionTypetype__new__)metaZ classnamebasesZ classDictZ attributeNameZ attribute)functionr)r*r3.s   z5method_decorator_metaclass..Decorated.__new__N)__name__ __module__ __qualname__r3r))r6r)r* Decorated-sr:)r2)r6r:r))r6r*method_decorator_metaclass,sr;c@seZdZdZd+ddZd,dd Zd d Zed d ZddZ ddZ ddZ ddZ ddZ ddZd-ddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*ZdS).r"zZHTML parser. Generates a tree structure from a stream of (possibly malformed) HTMLNFTcsL|_|dkrtjd}||_g_tfddt|jD_dS)a strict - raise an exception when a parse error is encountered tree - a treebuilder class controlling the type of tree that will be returned. Built in treebuilders can be accessed through html5lib.treebuilders.getTreeBuilder(treeType) Nrcs g|]\}}||jfqSr))tree).0namecls)selfr)r* Msz'HTMLParser.__init__..) strictr r!r<errorsdict getPhasesr.phases)r@r<rBr debugr))r@r*__init__<s    zHTMLParser.__init__r+c Ksh||_||_||_tj|fd|i||_|jy |jWn$tk rb|j|jYnXdS)Nparser) innerHTMLModer, scriptingr Z HTMLTokenizer tokenizerresetmainLoopr)r@stream innerHTMLr,rKr&r)r)r*_parsePs zHTMLParser._parsecCs|jjd|_g|_g|_d|_|jr|jj|_ |j t krL|j j |j _ n0|j tkrd|j j|j _ n|j dkr||j j|j _ n|jd|_|jj|jnd|_ |jd|_d|_d|_d|_dS)NFz no quirks plaintext beforeHtmlinitialT)r<rM firstStartTagrClog compatModerJr,lowerrPrrL rcdataStatestater rawtextStateplaintextStaterFphaseinsertHtmlElementresetInsertionModeZ lastPhaseZbeforeRCDataPhase framesetOK)r@r)r)r*rM^s*         zHTMLParser.resetcCst|dsdS|jjjdjS)zThe name of the character encoding that was used to decode the input stream, or :obj:`None` if that is not determined yet. rLNr)hasattrrLrO charEncodingr>)r@r)r)r*documentEncodings zHTMLParser.documentEncodingcCsJ|jdkr6|jtdkr6d|jko4|jdjtdkS|j|jftkSdS)Nzannotation-xmlmathmlencoding text/htmlapplication/xhtml+xml)rfrg)r> namespacer attributes translaterr)r@elementr)r)r*isHTMLIntegrationPoints   z!HTMLParser.isHTMLIntegrationPointcCs|j|jftkS)N)rhr>r)r@rkr)r)r*isMathMLTextIntegrationPointsz'HTMLParser.isMathMLTextIntegrationPointcCsjtd}td}td}td}td}td}td}x|jD]}d} |} x| dk r| } |jjrx|jjdnd} | r| jnd} | r| jnd} | d }||kr|j| d | jd id} qVt|jjd ksl| |jj ksl|j | r ||kr|d t ddgksl|||fksl| t dkrP| dkrP||krP|d dksl|j | rt||||fkrt|j}n |jd}||kr|j| } qV||kr|j| } qV||kr|j| } qV||kr|j| } qV||kr|j| } qV||krV|j| } qVW||krD| drD| d rD|jdd | d iqDWd}g}x(|rd|j|j|jj}|r>q>WdS)N CharactersZSpaceCharactersStartTagEndTagCommentZDoctype ParseErrorr r2datadatavarsrr>ZmglyphZ malignmarkrdzannotation-xmlsvginForeignContent selfClosingselfClosingAcknowledgedz&non-void-element-with-trailing-solidusT)rnormalizedTokensr< openElementsrhr> parseErrorgetlendefaultNamespacerm frozensetrrlr]rFprocessCharactersprocessSpaceCharactersprocessStartTag processEndTagprocessCommentprocessDoctypeappend processEOF)r@ZCharactersTokenZSpaceCharactersTokenZ StartTagTokenZ EndTagTokenZ CommentTokenZ DoctypeTokenZParseErrorTokentokenZ prev_token new_token currentNodeZcurrentNodeNamespaceZcurrentNodeNamer2r]Z reprocessrFr)r)r*rNsp                   zHTMLParser.mainLoopccs x|jD]}|j|VqWdS)N)rLnormalizeToken)r@rr)r)r*rzs zHTMLParser.normalizedTokenscOs |j|ddf|||jjS)aParse a HTML document into a well-formed tree stream - a filelike object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) scripting - treat noscript elements as if javascript was turned on FN)rQr<Z getDocument)r@rOargsr&r)r)r*r#s zHTMLParser.parsecOs|j|df|||jjS)a2Parse a HTML fragment into a well-formed tree fragment container - name of the element we're setting the innerHTML property if set to None, default to 'div' stream - a filelike object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) scripting - treat noscript elements as if javascript was turned on T)rQr<Z getFragment)r@rOrr&r)r)r*r-szHTMLParser.parseFragmentXXX-undefined-errorcCs@|dkr i}|jj|jjj||f|jrrPrhrrFr])r@ZlastZnewModesnodeZnodeNameZ new_phaser)r)r*r_!s> zHTMLParser.resetInsertionModecCsF|jj||dkr"|jj|j_n |jj|j_|j|_|jd|_dS)zYGeneric RCDATA/RAWTEXT Parsing algorithm contentType - RCDATA or RAWTEXT RAWTEXTtextN) r< insertElementrLr[rZrYr] originalPhaserF)r@rZ contentTyper)r)r*parseRCDataRawtextMs   zHTMLParser.parseRCDataRawtext)NFTF)Fr+F)rN)r7r8r9__doc__rHrQrMpropertyrcrlrmrNrzr#r-r|rrrrrr_rr)r)r)r*r"8s&  "  C  ,r"cs"dd}dd}Gdddt|||Gddd}Gd d d }Gfd d d }Gfd dd}Gfddd}Gfddd}Gfddd} Gfddd} Gfddd} Gfddd} Gfddd} Gfddd}Gfdd d }Gfd!d"d"}Gfd#d$d$}Gfd%d&d&}Gfd'd(d(}Gfd)d*d*}Gfd+d,d,}Gfd-d.d.}Gfd/d0d0}Gfd1d2d2}Gfd3d4d4}||||||| | | | | ||||||||||||d5S)6Ncs(tddtjDfdd}|S)z4Logger that records which phase processes each tokencss|]\}}||fVqdS)Nr))r=keyvaluer)r)r* csz)getPhases..log..c sjjdrt|dkr|d}yd|di}WnYnX|dtkr\|d|d<|jjj|jjjj|jj j j|j jj|f|f||S|f||SdS)NZprocessrr2r>) r7 startswithr~rrIrVrrLrZr] __class__)r@rr&rinfo)r6 type_namesr)r*wrappedfs   z'getPhases..log..wrapped)rDrr.)r6rr))r6rr*rVaszgetPhases..logcSs|r t|StSdS)N)r;r2)Z use_metaclassZmetaclass_funcr)r)r* getMetaclasszszgetPhases..getMetaclassc@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dS)zgetPhases..PhasezNBase class for helper object that implements each phase of processing cSs||_||_dS)N)rIr<)r@rIr<r)r)r*rHsz!getPhases..Phase.__init__cSstdS)N)NotImplementedError)r@r)r)r*rsz#getPhases..Phase.processEOFcSs|jj||jjddS)Nr ry)r< insertCommentr{)r@rr)r)r*rsz'getPhases..Phase.processCommentcSs|jjddS)Nzunexpected-doctype)rIr|)r@rr)r)r*rsz'getPhases..Phase.processDoctypecSs|jj|ddS)Nrs)r< insertText)r@rr)r)r*rsz*getPhases..Phase.processCharacterscSs|jj|ddS)Nrs)r<r)r@rr)r)r*rsz/getPhases..Phase.processSpaceCharacterscSs|j|d|S)Nr>)startTagHandler)r@rr)r)r*rsz(getPhases..Phase.processStartTagcSsl|jj r"|ddkr"|jjdx<|djD],\}}||jjdjkr0||jjdj|<q0Wd|j_dS)Nr>rz non-html-rootrsrF)rIrUr|r.r<r{ri)r@rattrrr)r)r* startTagHtmls  z%getPhases..Phase.startTagHtmlcSs|j|d|S)Nr>) endTagHandler)r@rr)r)r*rsz&getPhases..Phase.processEndTagN) r7r8r9rrHrrrrrrrrr)r)r)r*Phases rc@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS)zgetPhases..InitialPhasecSsdS)Nr))r@rr)r)r*rsz6getPhases..InitialPhase.processSpaceCharacterscSs|jj||jjdS)N)r<rdocument)r@rr)r)r*rsz.getPhases..InitialPhase.processCommentc8Ss|d}|d}|d}|d}|dks@|dk s@|dk rL|dkrL|jjd|dkrXd}|jj||dkrv|jt}| s|ddks|jdJs|dKks|jdLr|dks|r|jdDkrdE|j_n*|jdMs|jdNr|dk rdH|j_|jj dI|j_ dS)ONr>publicIdsystemIdcorrectrzabout:legacy-compatzunknown-doctype*+//silmaril//dtd html pro v0r11 19970101//4-//advasoft ltd//dtd html 3.0 aswedit + extensions//*-//as//dtd html 3.0 aswedit + extensions//-//ietf//dtd html 2.0 level 1//-//ietf//dtd html 2.0 level 2//&-//ietf//dtd html 2.0 strict level 1//&-//ietf//dtd html 2.0 strict level 2//-//ietf//dtd html 2.0 strict//-//ietf//dtd html 2.0//-//ietf//dtd html 2.1e//-//ietf//dtd html 3.0//-//ietf//dtd html 3.2 final//-//ietf//dtd html 3.2//-//ietf//dtd html 3//-//ietf//dtd html level 0//-//ietf//dtd html level 1//-//ietf//dtd html level 2//-//ietf//dtd html level 3//"-//ietf//dtd html strict level 0//"-//ietf//dtd html strict level 1//"-//ietf//dtd html strict level 2//"-//ietf//dtd html strict level 3//-//ietf//dtd html strict//-//ietf//dtd html//(-//metrius//dtd metrius presentational//5-//microsoft//dtd internet explorer 2.0 html strict//.-//microsoft//dtd internet explorer 2.0 html//0-//microsoft//dtd internet explorer 2.0 tables//5-//microsoft//dtd internet explorer 3.0 html strict//.-//microsoft//dtd internet explorer 3.0 html//0-//microsoft//dtd internet explorer 3.0 tables//#-//netscape comm. corp.//dtd html//*-//netscape comm. corp.//dtd strict html//*-//o'reilly and associates//dtd html 2.0//3-//o'reilly and associates//dtd html extended 1.0//;-//o'reilly and associates//dtd html extended relaxed 1.0//N-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//E-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//$-//spyglass//dtd html 2.0 extended//+-//sq//dtd html 2.0 hotmetal + extensions//--//sun microsystems corp.//dtd hotjava html//4-//sun microsystems corp.//dtd hotjava strict html//-//w3c//dtd html 3 1995-03-24//-//w3c//dtd html 3.2 draft//-//w3c//dtd html 3.2 final//-//w3c//dtd html 3.2//-//w3c//dtd html 3.2s draft//-//w3c//dtd html 4.0 frameset//#-//w3c//dtd html 4.0 transitional//(-//w3c//dtd html experimental 19960712//&-//w3c//dtd html experimental 970421//-//w3c//dtd w3 html//-//w3o//dtd w3 html 3.0//#-//webtechs//dtd mozilla html 2.0//-//webtechs//dtd mozilla html//$-//w3o//dtd w3 html strict 3.0//en//"-/w3c/dtd html 4.0 transitional/en -//w3c//dtd html 4.01 frameset//$-//w3c//dtd html 4.01 transitional//z:http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtdquirks -//w3c//dtd xhtml 1.0 frameset//$-//w3c//dtd xhtml 1.0 transitional//zlimited quirksrS)7rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrr)rr)rr)rr) rIr|r<Z insertDoctyperjrrrXrWrFr])r@rr>rrrr)r)r*rs      z.getPhases..InitialPhase.processDoctypecSsd|j_|jjd|j_dS)NrrS)rIrWrFr])r@r)r)r* anythingElsesz,getPhases..InitialPhase.anythingElsecSs|jjd|j|S)Nzexpected-doctype-but-got-chars)rIr|r )r@rr)r)r*rs z1getPhases..InitialPhase.processCharacterscSs"|jjdd|di|j|S)Nz"expected-doctype-but-got-start-tagr>)rIr|r )r@rr)r)r*rsz/getPhases..InitialPhase.processStartTagcSs"|jjdd|di|j|S)Nz expected-doctype-but-got-end-tagr>)rIr|r )r@rr)r)r*rsz-getPhases..InitialPhase.processEndTagcSs|jjd|jdS)Nzexpected-doctype-but-got-eofT)rIr|r )r@r)r)r*r%s z*getPhases..InitialPhase.processEOFN) r7r8r9rrrr rrrrr)r)r)r* InitialPhases_r c@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)z"getPhases..BeforeHtmlPhasecSs&|jjtdd|jjd|j_dS)Nrror)r<Z insertRootimpliedTagTokenrIrFr])r@r)r)r*r^,sz4getPhases..BeforeHtmlPhase.insertHtmlElementcSs |jdS)NT)r^)r@r)r)r*r1sz-getPhases..BeforeHtmlPhase.processEOFcSs|jj||jjdS)N)r<rr)r@rr)r)r*r5sz1getPhases..BeforeHtmlPhase.processCommentcSsdS)Nr))r@rr)r)r*r8sz9getPhases..BeforeHtmlPhase.processSpaceCharacterscSs |j|S)N)r^)r@rr)r)r*r;sz4getPhases..BeforeHtmlPhase.processCharacterscSs |ddkrd|j_|j|S)Nr>rT)rIrUr^)r@rr)r)r*r?s z2getPhases..BeforeHtmlPhase.processStartTagcSs4|ddkr$|jjdd|din |j|SdS)Nr>rrrbrzunexpected-end-tag-before-html)rrrr )rIr|r^)r@rr)r)r*rEs  z0getPhases..BeforeHtmlPhase.processEndTagN) r7r8r9r^rrrrrrr)r)r)r*BeforeHtmlPhase*sr csXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z"getPhases..BeforeHeadPhasecsVj|||tjd|jfd|jfg|_|j|j_tjd|jfg|_ |j |j _dS)Nrrrr )rrrr ) rHrMethodDispatcherr startTagHeadr startTagOtherdefaultendTagImplyHeadr endTagOther)r@rIr<)rr)r*rHNs z+getPhases..BeforeHeadPhase.__init__cSs|jtdddS)NrroT)rr )r@r)r)r*r\sz-getPhases..BeforeHeadPhase.processEOFcSsdS)Nr))r@rr)r)r*r`sz9getPhases..BeforeHeadPhase.processSpaceCharacterscSs|jtdd|S)Nrro)rr )r@rr)r)r*rcsz4getPhases..BeforeHeadPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rgsz/getPhases..BeforeHeadPhase.startTagHtmlcSs0|jj||jjd|j_|jjd|j_dS)Nr inHeadry)r<rr{ headPointerrIrFr])r@rr)r)r*rjs z/getPhases..BeforeHeadPhase.startTagHeadcSs|jtdd|S)Nrro)rr )r@rr)r)r*rosz0getPhases..BeforeHeadPhase.startTagOthercSs|jtdd|S)Nrro)rr )r@rr)r)r*rssz2getPhases..BeforeHeadPhase.endTagImplyHeadcSs|jjdd|didS)Nzend-tag-after-implied-rootr>)rIr|)r@rr)r)r*rwsz.getPhases..BeforeHeadPhase.endTagOtherN) r7r8r9rHrrrrrrrrr))rr)r*BeforeHeadPhaseMs rcseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!S)"zgetPhases..InHeadPhasec sj|||tjd|jfd|jfd|jfd|jfd|jfd|jfd |j fd |j fg|_ |j |j _ tjd |jfd|jfg|_|j|j_ dS)Nrtitlenoframesstylenoscriptscriptbasebasefontbgsoundcommandlinkr4rr r)rr)rrrrr )r rr)rHrrr startTagTitlestartTagNoFramesStylestartTagNoscriptstartTagScriptstartTagBaseLinkCommand startTagMetarrrr endTagHeadendTagHtmlBodyBrrr)r@rIr<)rr)r*rH|s  z'getPhases..InHeadPhase.__init__cSs |jdS)NT)r )r@r)r)r*rsz)getPhases..InHeadPhase.processEOFcSs |j|S)N)r )r@rr)r)r*rsz0getPhases..InHeadPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz+getPhases..InHeadPhase.startTagHtmlcSs|jjddS)Nz!two-heads-are-not-better-than-one)rIr|)r@rr)r)r*rsz+getPhases..InHeadPhase.startTagHeadcSs$|jj||jjjd|d<dS)NTrx)r<rr{pop)r@rr)r)r*r%s  z6getPhases..InHeadPhase.startTagBaseLinkCommandcSs|jj||jjjd|d<|d}|jjjjddkrd|krZ|jjjj|dnVd|krd|kr|dj d krt j |dj d }t j |}|j}|jjjj|dS) NTrxrsr Z tentativecharsetZcontentz http-equivz content-typezutf-8)r<rr{r)rIrLrOrbZchangeEncodingrXr Z EncodingBytesencodeZContentAttrParserr#)r@rrirsrIcodecr)r)r*r&s   z+getPhases..InHeadPhase.startTagMetacSs|jj|ddS)NZRCDATA)rIr)r@rr)r)r*r!sz,getPhases..InHeadPhase.startTagTitlecSs|jj|ddS)Nr)rIr)r@rr)r)r*r"sz4getPhases..InHeadPhase.startTagNoFramesStylecSs8|jjr|jj|dn|jj||jjd|j_dS)NrinHeadNoscript)rIrKrr<rrFr])r@rr)r)r*r#s z/getPhases..InHeadPhase.startTagNoscriptcSs<|jj||jjj|jj_|jj|j_|jjd|j_dS)Nr) r<rrIrLZscriptDataStaterZr]rrF)r@rr)r)r*r$s  z-getPhases..InHeadPhase.startTagScriptcSs |j|S)N)r )r@rr)r)r*rsz,getPhases..InHeadPhase.startTagOthercSs"|jjjj}|jjd|j_dS)N afterHead)rIr<r{r)rFr])r@rrr)r)r*r'sz)getPhases..InHeadPhase.endTagHeadcSs |j|S)N)r )r@rr)r)r*r(sz/getPhases..InHeadPhase.endTagHtmlBodyBrcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz*getPhases..InHeadPhase.endTagOthercSs|jtddS)Nr)r'r )r@r)r)r*r sz+getPhases..InHeadPhase.anythingElseN)r7r8r9rHrrrrr%r&r!r"r#r$rr'r(rr r))rr)r* InHeadPhase{s  r/csxeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS)z&getPhases..InHeadNoscriptPhasecsfj|||tjd|jfd |jfd |jfg|_|j|j_tjd |j fd |j fg|_ |j |j _dS) Nrrrr r4rrrrr )rrr r4rr)rr) rHrrrr%startTagHeadNoscriptrrrendTagNoscriptendTagBrrr)r@rIr<)rr)r*rHs z/getPhases..InHeadNoscriptPhase.__init__cSs|jjd|jdS)Nzeof-in-head-noscriptT)rIr|r )r@r)r)r*rs z1getPhases..InHeadNoscriptPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz5getPhases..InHeadNoscriptPhase.processCommentcSs|jjd|j|S)Nzchar-in-head-noscript)rIr|r )r@rr)r)r*rs z8getPhases..InHeadNoscriptPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz=getPhases..InHeadNoscriptPhase.processSpaceCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz3getPhases..InHeadNoscriptPhase.startTagHtmlcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r%sz>getPhases..InHeadNoscriptPhase.startTagBaseLinkCommandcSs|jjdd|didS)Nzunexpected-start-tagr>)rIr|)r@rr)r)r*r0 sz;getPhases..InHeadNoscriptPhase.startTagHeadNoscriptcSs"|jjdd|di|j|S)Nzunexpected-inhead-noscript-tagr>)rIr|r )r@rr)r)r*r sz4getPhases..InHeadNoscriptPhase.startTagOthercSs"|jjjj}|jjd|j_dS)Nr)rIr<r{r)rFr])r@rrr)r)r*r1sz5getPhases..InHeadNoscriptPhase.endTagNoscriptcSs"|jjdd|di|j|S)Nzunexpected-inhead-noscript-tagr>)rIr|r )r@rr)r)r*r2sz/getPhases..InHeadNoscriptPhase.endTagBrcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz2getPhases..InHeadNoscriptPhase.endTagOthercSs|jtddS)Nr)r1r )r@r)r)r*r sz3getPhases..InHeadNoscriptPhase.anythingElseN)r7r8r9rHrrrrrr%r0rr1r2rr r))rr)r*InHeadNoscriptPhases r3cspeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS)z!getPhases..AfterHeadPhasec snj|||tjd|jfd|jfd|jfd|jfd |jfg|_|j |j_ tjd|j fg|_ |j |j _ dS)Nrrrrrrr r4rrrrrr ) rrrr r4rrrr)rrr )rHrrr startTagBodystartTagFramesetstartTagFromHeadrrrrr(rr)r@rIr<)rr)r*rH#s z*getPhases..AfterHeadPhase.__init__cSs |jdS)NT)r )r@r)r)r*r4sz,getPhases..AfterHeadPhase.processEOFcSs |j|S)N)r )r@rr)r)r*r8sz3getPhases..AfterHeadPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r<sz.getPhases..AfterHeadPhase.startTagHtmlcSs(d|j_|jj||jjd|j_dS)NFr)rIr`r<rrFr])r@rr)r)r*r4?s z.getPhases..AfterHeadPhase.startTagBodycSs |jj||jjd|j_dS)Nr)r<rrIrFr])r@rr)r)r*r5Ds z2getPhases..AfterHeadPhase.startTagFramesetcSst|jjdd|di|jjj|jj|jjdj|x4|jjdddD]}|jdkrN|jjj |PqNWdS)Nz#unexpected-start-tag-out-of-my-headr>rr rry) rIr|r<r{rrrFrr>remove)r@rrr)r)r*r6Hs z2getPhases..AfterHeadPhase.startTagFromHeadcSs|jjdd|didS)Nzunexpected-start-tagr>)rIr|)r@rr)r)r*rRsz.getPhases..AfterHeadPhase.startTagHeadcSs |j|S)N)r )r@rr)r)r*rUsz/getPhases..AfterHeadPhase.startTagOthercSs |j|S)N)r )r@rr)r)r*r(Ysz2getPhases..AfterHeadPhase.endTagHtmlBodyBrcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*r]sz-getPhases..AfterHeadPhase.endTagOthercSs.|jjtdd|jjd|j_d|j_dS)NrrorT)r<rr rIrFr]r`)r@r)r)r*r `sz.getPhases..AfterHeadPhase.anythingElseN)r7r8r9rHrrrr4r5r6rrr(rr r))rr)r*AfterHeadPhase"s  r8cseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dSdTZ,dUdVZ-dWdXZ.dYdZZ/d[d\Z0d]d^Z1d_d`Z2dadbZ3dcddZ4dedfZ5dgS)hzgetPhases..InBodyPhasec,sj||||j|_tjd|jfdd|jfd |jfd |jfde|j ft |j fdf|j fd&|j fdg|jfd*|jfd+|jfdh|jfd8|jfd9|jfdi|jfd=|jfd>|jfdj|jfdk|jfdH|jfdI|jfdJ|jfdK|jfdL|jfdM|jfdN|jfdl|j fdQ|j!fdm|j"fdn|j#fdV|j$fdW|j%fdo|j&fg!|_'|j(|j'_)tjd |j*fd|j+fdp|j,fd&|j-fd |j.fdq|j/ft |j0fdr|j1fds|j2fd@|j3fg |_4|j5|j4_)dS)tNrrrrrr r4rrrrraddressarticleaside blockquotecenterdetailsdirr+dlfieldset figcaptionfigurefooterheaderhgroupmainmenunavolr(sectionsummaryulprelistingformlidddtrRabbigcodeemfontissmallstrikestrongttunobrbuttonappletmarqueeobjectZxmprarear embedimgkeygenwbrparamsourcetrackinputhrimageisindextextareaZiframernoembedrrrprtoptionoptgroupZmathrurcolrframerrrrrrrdialog) rrrrr r4rrr)r9r:r;r<r=r>r?r+r@rArBrCrDrErFrGrHrIrJr(rKrLrM)rNrO)rQrRrS) rUrVrWrXrYrZr[r\r]r^r_r`)rcrdre)rfr rgrhrirj)rkrlrm)rsr)rtru)rvrw) rrxrryrrrrrrr)r9r:r;r<rbr=r>rzr?r+r@rArBrCrDrErFrOrGrHrIrJrNrKrLrM)rRrSrQ)rTrUrVrWrXrYrZrar[r\r]r^r_r`)rcrdre)6rHprocessSpaceCharactersNonPrerrrrstartTagProcessInHeadr4r5startTagClosePrstartTagHeadingstartTagPreListing startTagFormstartTagListItemstartTagPlaintext startTagAstartTagFormatting startTagNobrstartTagButtonstartTagAppletMarqueeObject startTagXmp startTagTablestartTagVoidFormattingstartTagParamSource startTagInput startTagHr startTagImagestartTagIsIndexstartTagTextareastartTagIFramer#startTagRawtextstartTagSelect startTagRpRt startTagOpt startTagMath startTagSvgstartTagMisplacedrrr endTagBody endTagHtml endTagBlock endTagFormendTagPendTagListItem endTagHeadingendTagFormattingendTagAppletMarqueeObjectr2rr)r@rIr<)rr)r*rHhs~ z'getPhases..InBodyPhase.__init__cSs$|j|jko"|j|jko"|j|jkS)N)r>rhri)r@Znode1Znode2r)r)r*isMatchingFormattingElements  z:getPhases..InBodyPhase.isMatchingFormattingElementcSs|jj||jjd}g}x<|jjdddD]&}|tkr@Pq0|j||r0|j|q0Wt|dkrx|jjj|d|jjj|dS)Nr ryryry) r<rr{activeFormattingElementsr rrr~r7)r@rrkZmatchingElementsrr)r)r*addFormattingElements    z3getPhases..InBodyPhase.addFormattingElementc Ss@td}x2|jjdddD]}|j|kr|jjdPqWdS)NrRrSrQr(rrrrrrrrr z expected-closing-tag-but-got-eof) rRrSrQr(rrrrrrrrry)rr<r{r>rIr|)r@Zallowed_elementsrr)r)r*rs  z)getPhases..InBodyPhase.processEOFcSsh|d}|j|_|jdrJ|jjdjdkrJ|jjd j rJ|dd}|rd|jj|jj|dS) Nrs r rNrOrrry)rNrOrrry) r{rrr<r{r>Z hasContent#reconstructActiveFormattingElementsr)r@rrsr)r)r*!processSpaceCharactersDropNewlines   z@getPhases..InBodyPhase.processSpaceCharactersDropNewlinecSsT|ddkrdS|jj|jj|d|jjrPtdd|dDrPd|j_dS)NrscSsg|] }|tkqSr))r)r=charr)r)r*rAszDgetPhases..InBodyPhase.processCharacters..F)r<rrrIr`any)r@rr)r)r*rs  z0getPhases..InBodyPhase.processCharacterscSs|jj|jj|ddS)Nrs)r<rr)r@rr)r)r*r{s z;getPhases..InBodyPhase.processSpaceCharactersNonPrecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r|sz4getPhases..InBodyPhase.startTagProcessInHeadcSs|jjdddit|jjdks||jjdjdkr6nFd|j_x<|djD],\}}||jjdjkrL||jjdj|<qLWdS)Nzunexpected-start-tagr>rr Frs) rIr|r~r<r{r>r`r.ri)r@rrrr)r)r*r4sz+getPhases..InBodyPhase.startTagBodycSs|jjdddit|jjdks|jjdjdkr6nt|jjs@nj|jjdjrj|jjdjj|jjdx"|jjdjdkr|jjj qlW|jj ||jj d|j_ dS) Nzunexpected-start-tagr>rr rrrry) rIr|r~r<r{r>r`parent removeChildr)rrFr])r@rr)r)r*r5s" z/getPhases..InBodyPhase.startTagFramesetcSs.|jjdddr|jtd|jj|dS)Nr(rb)variant)r<elementInScoperr r)r@rr)r)r*r} sz-getPhases..InBodyPhase.startTagClosePcSs>|jjdddr|jtd|jj|d|j_|j|_dS)Nr(rb)rF) r<rrr rrIr`rr)r@rr)r)r*rs  z1getPhases..InBodyPhase.startTagPreListingcSsZ|jjr|jjdddin:|jjdddr:|jtd|jj||jjd|j_dS) Nzunexpected-start-tagr>rPr(rb)rr ry) r< formPointerrIr|rrr rr{)r@rr)r)r*rs  z+getPhases..InBodyPhase.startTagFormcSsd|j_dgddgddgd}||d}xLt|jjD]<}|j|kr^|jjjt|jdP|j t kr8|jd kr8Pq8W|jj d d d r|jjjtd d|jj |dS)NFrQrSrR)rQrSrRr>rpr9r+r(rb)r)r9r+r() rIr`reversedr<r{r>r]rr  nameTuplerrr)r@rZ stopNamesMapZ stopNamesrr)r)r*rs"      z/getPhases..InBodyPhase.startTagListItemcSs>|jjdddr|jtd|jj||jjj|jj_dS)Nr(rb)r) r<rrr rrIrLr\rZ)r@rr)r)r*r4s z0getPhases..InBodyPhase.startTagPlaintextcSsb|jjdddr|jtd|jjdjtkrR|jjdd|di|jjj |jj |dS)Nr(rb)rr zunexpected-start-tagr>ry) r<rrr r{r>rrIr|r)r)r@rr)r)r*r~:s  z.getPhases..InBodyPhase.startTagHeadingcSs~|jjd}|rf|jjdddd|jtd||jjkrL|jjj|||jjkrf|jjj||jj |j |dS)NrTz$unexpected-start-tag-implies-end-tag) startNameendName) r<!elementInActiveFormattingElementsrIr|rr r{r7rrr)r@rZ afeAElementr)r)r*rBs     z(getPhases..InBodyPhase.startTagAcSs|jj|j|dS)N)r<rr)r@rr)r)r*rOs z1getPhases..InBodyPhase.startTagFormattingcSsP|jj|jjdrB|jjdddd|jtd|jj|j|dS)Nraz$unexpected-start-tag-implies-end-tag)rr)r<rrrIr|rr r)r@rr)r)r*rSs    z+getPhases..InBodyPhase.startTagNobrcSsT|jjdr2|jjdddd|jtd|S|jj|jj|d|j_dS)Nrbz$unexpected-start-tag-implies-end-tag)rrF) r<rrIr|rr rrr`)r@rr)r)r*r]s    z-getPhases..InBodyPhase.startTagButtoncSs0|jj|jj||jjjtd|j_dS)NF)r<rrrrr rIr`)r@rr)r)r*rhs  z:getPhases..InBodyPhase.startTagAppletMarqueeObjectcSsB|jjdddr|jtd|jjd|j_|jj|ddS)Nr(rb)rFr)r<rrr rrIr`r)r@rr)r)r*rns  z*getPhases..InBodyPhase.startTagXmpcSsR|jjdkr*|jjdddr*|jtd|jj|d|j_|jjd|j_ dS)Nrr(rb)rFr) rIrWr<rrr rr`rFr])r@rr)r)r*rus   z,getPhases..InBodyPhase.startTagTablecSs6|jj|jj||jjjd|d<d|j_dS)NTrxF)r<rrr{r)rIr`)r@rr)r)r*r}s    z5getPhases..InBodyPhase.startTagVoidFormattingcSs@|jj}|j|d|dkr<|ddjtdkr<||j_dS)Nr2rshidden)rIr`rrjr)r@rr`r)r)r*rs   z,getPhases..InBodyPhase.startTagInputcSs$|jj||jjjd|d<dS)NTrx)r<rr{r))r@rr)r)r*rs  z2getPhases..InBodyPhase.startTagParamSourcecSsJ|jjdddr|jtd|jj||jjjd|d<d|j_dS)Nr(rb)rTrxF) r<rrr rr{r)rIr`)r@rr)r)r*rs   z)getPhases..InBodyPhase.startTagHrcSs6|jjdddd|jtdd|d|dddS) Nzunexpected-start-tag-treated-asrprh) originalNamenewNamerorsrw)rirw)rIr|rr )r@rr)r)r*rs   z,getPhases..InBodyPhase.startTagImagecSs|jjdddi|jjrdSi}d|dkr>|dd|d<|jtdd|d|jtd d|jtd dd |dkr|dd }nd }|jtd |d|dj}d|kr|d=d |kr|d =d|d<|jtdd||dd|j td |jtd d|j tddS)Nzdeprecated-tagr>rqactionrsrPro)riroZlabelpromptz3This is a searchable index. Enter search keywords: rn)r2rsrnrw)rirw) rIr|r<rrr rrcopyr)r@rZ form_attrsrrir)r)r*rs6      z.getPhases..InBodyPhase.startTagIsIndexcSs0|jj||jjj|jj_|j|_d|j_dS)NF) r<rrIrLrYrZrrr`)r@rr)r)r*rs z/getPhases..InBodyPhase.startTagTextareacSsd|j_|j|dS)NF)rIr`r)r@rr)r)r*rsz-getPhases..InBodyPhase.startTagIFramecSs"|jjr|j|n |j|dS)N)rIrKrr)r@rr)r)r*r#s z/getPhases..InBodyPhase.startTagNoscriptcSs|jj|ddS)z8iframe, noembed noframes, noscript(if scripting enabled)rN)rIr)r@rr)r)r*rsz.getPhases..InBodyPhase.startTagRawtextcSs@|jjdjdkr$|jjjtd|jj|jjj|dS)Nr rvry) r<r{r>rIr]rr rr)r@rr)r)r*rs z*getPhases..InBodyPhase.startTagOptcSs|jj|jj|d|j_|jj|jjd|jjd|jjd|jjd|jjd|jjdfkrx|jjd|j_n|jjd |j_dS) NFrrrrrrinSelectInTabler)r<rrrIr`r]rF)r@rr)r)r*rs      z-getPhases..InBodyPhase.startTagSelectcSsB|jjdr2|jj|jjdjdkr2|jj|jj|dS)Nrubyr ry)r<rgenerateImpliedEndTagsr{r>rIr|r)r@rr)r)r*rs    z+getPhases..InBodyPhase.startTagRpRtcSsZ|jj|jj||jj|td|d<|jj||drV|jjjd|d<dS)NrdrhrwTrx) r<rrIrrrrr{r))r@rr)r)r*rs      z+getPhases..InBodyPhase.startTagMathcSsZ|jj|jj||jj|td|d<|jj||drV|jjjd|d<dS)NrurhrwTrx) r<rrIrrrrr{r))r@rr)r)r*rs      z*getPhases..InBodyPhase.startTagSvgcSs|jjdd|didS)a5 Elements that should be children of other elements that have a different insertion mode; here they are ignored "caption", "col", "colgroup", "frame", "frameset", "head", "option", "optgroup", "tbody", "td", "tfoot", "th", "thead", "tr", "noscript" zunexpected-start-tag-ignoredr>N)rIr|)r@rr)r)r*rsz0getPhases..InBodyPhase.startTagMisplacedcSs|jj|jj|dS)N)r<rr)r@rr)r)r*rs z,getPhases..InBodyPhase.startTagOthercSs|jjdddsD|jtdd|jjdddi|jtddnX|jjd|jjd j dkrt|jjdddi|jjj }x|j dkr|jjj }qWdS) Nr(rb)rrozunexpected-end-tagr>rpr ry) r<rr}r rIr|rrr{r>r))r@rrr)r)r*rs   z&getPhases..InBodyPhase.endTagPcSs|jjds|jjdS|jjdjdkrlx>|jjddD]*}|jtdkr>|jjdd|jdPq>W|jjd|j_dS)Nrr rRrSrQrwrvr(rtrurrrrrrrz$expected-one-end-tag-but-got-another)gotName expectedName afterBodyry)rRrSrQrwrvr(rtrurrrrrrrr) r<rrIr|r{r>rrFr])r@rrr)r)r*r!s  z)getPhases..InBodyPhase.endTagBodycSs"|jjdr|jtd|SdS)Nr)r<rrr )r@rr)r)r*r3s z)getPhases..InBodyPhase.endTagHtmlcSs|ddkr|j|_|jj|d}|r2|jj|jjdj|dkr^|jjdd|di|r|jjj }x|j|dkr|jjj }qpWdS)Nr>rNr zend-tag-too-earlyry) r{rr<rrr{r>rIr|r))r@rZinScoperr)r)r*r9s   z*getPhases..InBodyPhase.endTagBlockcSsx|jj}d|j_|dks&|jj| r:|jjdddin:|jj|jjd|krf|jjdddi|jjj|dS)Nzunexpected-end-tagr>rPr zend-tag-too-early-ignoredry)r<rrrIr|rr{r7)r@rrr)r)r*rGs   z)getPhases..InBodyPhase.endTagFormcSs|ddkrd}nd}|jj|d|dsB|jjdd|dinj|jj|dd|jjd j|dkr|jjdd|di|jjj}x|j|dkr|jjj}qWdS) Nr>rQlist)rzunexpected-end-tag)excluder zend-tag-too-earlyry)r<rrIr|rr{r>r))r@rrrr)r)r*rTs  z-getPhases..InBodyPhase.endTagListItemcSsx$tD]}|jj|r|jjPqW|jjdj|dkrR|jjdd|dixBtD]:}|jj|rX|jjj}x|jtkr|jjj}qvWPqXWdS)Nr r>zend-tag-too-earlyry) rr<rrr{r>rIr|r))r@ritemr)r)r*res       z,getPhases..InBodyPhase.endTagHeadingcSs"d}x|dkr|d7}|jj|d}| sL||jjkrZ|jj|j rZ|j|dS||jjkr|jjdd|di|jjj |dS|jj|js|jjdd|didS||jjdkr|jjdd|di|jjj |}d}x,|jj|dD]}|j t kr|}PqW|dkrb|jjj }x||krN|jjj }q4W|jjj |dS|jj|d}|jjj |}|} } d} |jjj | } x| d krh| d7} | d8} |jj| } | |jjkr|jjj | q| |krP| |kr |jjj | d}| j} | |jj|jjj | <| |jj|jjj | <| } | jrV| jj| | j| | } qW| jr~| jj| |jtdkr|jj\}}|j| |n |j| |j} |j| |j| |jjj ||jjj|| |jjj ||jjj|jjj |d| qWdS)z)The much-feared adoption agency algorithmrr r>Nzadoption-agency-1.2zadoption-agency-4.4zadoption-agency-1.3rrrrrrry)rrrrr)r<rr{rr>rrIr|rr7indexrrr)Z cloneNoderrZ appendChildrZgetTableMisnestedNodePosition insertBeforeZreparentChildreninsert)r@rZouterLoopCounterZformattingElementZafeIndexZ furthestBlockrkZcommonAncestorZbookmarkZlastNoderZinnerLoopCounterrZclonerrr)r)r*rts                    z/getPhases..InBodyPhase.endTagFormattingcSs|jj|dr|jj|jjdj|dkrF|jjdd|di|jj|dr|jjj}x|j|dkr|jjj}qdW|jjdS)Nr>r zend-tag-too-earlyry) r<rrr{r>rIr|r)clearActiveFormattingElements)r@rrkr)r)r*rs  z8getPhases..InBodyPhase.endTagAppletMarqueeObjectcSs@|jjdddd|jj|jjtdd|jjjdS)Nzunexpected-end-tag-treated-asr z br element)rrro)rIr|r<rrr r{r))r@rr)r)r*r2#s   z'getPhases..InBodyPhase.endTagBrcSsx|jjdddD]}|j|dkr~|jj|dd|jjdj|dkrd|jjdd|dix|jjj|krxqfWPq|jtkr|jjdd|diPqWdS)Nr r>)rzunexpected-end-tagryry) r<r{r>rrIr|r)rr)r@rrr)r)r*r*s z*getPhases..InBodyPhase.endTagOtherN)6r7r8r9rHrrrrrr{r|r4r5r}rrrrr~rrrrrrrrrrrrrrrr#rrrrrrrrrrrrrrrrrr2rr))rr)r* InBodyPhaseesh G             $ rcs@eZdZfddZddZddZddZd d Zd d Zd S)zgetPhases..TextPhasecsFj|||tjg|_|j|j_tjd|jfg|_|j|j_dS)Nr) rHrrrrr endTagScriptrr)r@rIr<)rr)r*rH9s   z%getPhases..TextPhase.__init__cSs|jj|ddS)Nrs)r<r)r@rr)r)r*rAsz.getPhases..TextPhase.processCharacterscSs8|jjdd|jjdji|jjj|jj|j_dS)Nz&expected-named-closing-tag-but-got-eofr>r Try)rIr|r<r{r>r)rr])r@r)r)r*rDs   z'getPhases..TextPhase.processEOFcSsdS)Nr))r@rr)r)r*rKsz*getPhases..TextPhase.startTagOthercSs|jjj}|jj|j_dS)N)r<r{r)rIrr])r@rrr)r)r*rNs z)getPhases..TextPhase.endTagScriptcSs|jjj|jj|j_dS)N)r<r{r)rIrr])r@rr)r)r*rUs z(getPhases..TextPhase.endTagOtherN) r7r8r9rHrrrrrr))rr)r* TextPhase8s  rcseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'S)(zgetPhases..InTablePhasec sj|||tjd|jfd|jfd|jfd|jfd|jfd|jfd |j fd|j fd|j fd|j fg |_ |j|j _tjd |jfd|jfg|_|j|j_dS)NrrrrxrrrrrrrrrrnrPr)rrr)rrr)rr) rrrxrrrrrrrr)rHrrrstartTagCaptionstartTagColgroup startTagColstartTagRowGroupstartTagImplyTbodyrstartTagStyleScriptrrrrr endTagTable endTagIgnorerr)r@rIr<)rr)r*rH[s$ z(getPhases..InTablePhase.__init__cSs(x"|jjdjdkr"|jjjqWdS)Nr rrry)rr)r<r{r>r))r@r)r)r*clearStackToTableContextssz8getPhases..InTablePhase.clearStackToTableContextcSs$|jjdjdkr |jjdndS)Nr rz eof-in-tablery)r<r{r>rIr|)r@r)r)r*r|sz*getPhases..InTablePhase.processEOFcSs4|jj}|jjd|j_||jj_|jjj|dS)N inTableText)rIr]rFrr)r@rrr)r)r*rs z6getPhases..InTablePhase.processSpaceCharacterscSs4|jj}|jjd|j_||jj_|jjj|dS)Nr)rIr]rFrr)r@rrr)r)r*rs z1getPhases..InTablePhase.processCharacterscSs&d|j_|jjdj|d|j_dS)NTrF)r<insertFromTablerIrFr)r@rr)r)r*rsz*getPhases..InTablePhase.insertTextcSs6|j|jjjt|jj||jjd|j_dS)Nr) rr<rrr rrIrFr])r@rr)r)r*rs z/getPhases..InTablePhase.startTagCaptioncSs(|j|jj||jjd|j_dS)Nr)rr<rrIrFr])r@rr)r)r*rs z0getPhases..InTablePhase.startTagColgroupcSs|jtdd|S)Nrro)rr )r@rr)r)r*rsz+getPhases..InTablePhase.startTagColcSs(|j|jj||jjd|j_dS)Nr)rr<rrIrFr])r@rr)r)r*rs z0getPhases..InTablePhase.startTagRowGroupcSs|jtdd|S)Nrro)rr )r@rr)r)r*rsz2getPhases..InTablePhase.startTagImplyTbodycSs6|jjdddd|jjjtd|jjs2|SdS)Nz$unexpected-start-tag-implies-end-tagr)rr)rIr|r]rr rP)r@rr)r)r*rs  z-getPhases..InTablePhase.startTagTablecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz3getPhases..InTablePhase.startTagStyleScriptcSsVd|dkrH|ddjtdkrH|jjd|jj||jjjn |j|dS)Nr2rsrz unexpected-hidden-input-in-table) rjrrIr|r<rr{r)r)r@rr)r)r*rs    z-getPhases..InTablePhase.startTagInputcSsD|jjd|jjdkr@|jj||jjd|j_|jjjdS)Nzunexpected-form-in-tabler ry)rIr|r<rrr{r))r@rr)r)r*rs    z,getPhases..InTablePhase.startTagFormcSs<|jjdd|did|j_|jjdj|d|j_dS)Nz)unexpected-start-tag-implies-table-voodoor>TrF)rIr|r<rrFr)r@rr)r)r*rsz-getPhases..InTablePhase.startTagOthercSs|jjdddr|jj|jjdjdkrJ|jjdd|jjdjdx"|jjdjdkrl|jjjqLW|jjj|jjn |jjdS) Nr)rr zend-tag-too-early-named)rrryryry) r<rrr{r>rIr|r)r_)r@rr)r)r*rs   z+getPhases..InTablePhase.endTagTablecSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz,getPhases..InTablePhase.endTagIgnorecSs<|jjdd|did|j_|jjdj|d|j_dS)Nz'unexpected-end-tag-implies-table-voodoor>TrF)rIr|r<rrFr)r@rr)r)r*rsz+getPhases..InTablePhase.endTagOtherN)r7r8r9rHrrrrrrrrrrrrrrrrrrr))rr)r* InTablePhaseYs&   rcsPeZdZfddZddZddZddZd d Zd d Zd dZ ddZ dS)z#getPhases..InTableTextPhasecsj|||d|_g|_dS)N)rHrcharacterTokens)r@rIr<)rr)r*rHsz,getPhases..InTableTextPhase.__init__cSsddjdd|jD}tdd|DrJtd|d}|jjdj|n|rZ|jj|g|_dS)NrcSsg|] }|dqS)rsr))r=rr)r)r*rAszGgetPhases..InTableTextPhase.flushCharacters..cSsg|] }|tkqSr))r)r=rr)r)r*rAsrn)r2rsr)joinrrrrIrFrr<)r@rsrr)r)r*flushCharacterss z3getPhases..InTableTextPhase.flushCharacterscSs|j|j|j_|S)N)rrrIr])r@rr)r)r*rs z2getPhases..InTableTextPhase.processCommentcSs|j|j|j_dS)NT)rrrIr])r@r)r)r*rs z.getPhases..InTableTextPhase.processEOFcSs |ddkrdS|jj|dS)Nrsr)rr)r@rr)r)r*rs z5getPhases..InTableTextPhase.processCharacterscSs|jj|dS)N)rr)r@rr)r)r*rsz:getPhases..InTableTextPhase.processSpaceCharacterscSs|j|j|j_|S)N)rrrIr])r@rr)r)r*r s z3getPhases..InTableTextPhase.processStartTagcSs|j|j|j_|S)N)rrrIr])r@rr)r)r*rs z1getPhases..InTableTextPhase.processEndTagN) r7r8r9rHrrrrrrrr))rr)r*InTableTextPhases  rcs`eZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)z!getPhases..InCaptionPhasec sfj|||tjd|jfd |jfg|_|j|j_tjd|jfd |j fd|j fg|_ |j |j _dS)Nrrrxrrrrrrrrr) rrxrrrrrrr) rrxrrrrrrrr) rHrrrstartTagTableElementrrr endTagCaptionrrrr)r@rIr<)rr)r*rHs z*getPhases..InCaptionPhase.__init__cSs|jjddd S)Nrr)r)r<r)r@r)r)r*ignoreEndTagCaption+sz5getPhases..InCaptionPhase.ignoreEndTagCaptioncSs|jjdjdS)Nr)rIrFr)r@r)r)r*r.sz,getPhases..InCaptionPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r1sz3getPhases..InCaptionPhase.processCharacterscSs0|jj|j}|jjjtd|s,|SdS)Nr)rIr|rr]rr )r@r ignoreEndTagr)r)r*r4s  z6getPhases..InCaptionPhase.startTagTableElementcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r<sz/getPhases..InCaptionPhase.startTagOthercSs|js|jj|jjdjdkrB|jjdd|jjdjdx"|jjdjdkrd|jjjqDW|jjj|jj|jj d|j_ n |jjdS) Nr rz$expected-one-end-tag-but-got-another)rrrryryry) rr<rr{r>rIr|r)rrFr])r@rr)r)r*r?s   z/getPhases..InCaptionPhase.endTagCaptioncSs0|jj|j}|jjjtd|s,|SdS)Nr)rIr|rr]rr )r@rrr)r)r*rQs  z-getPhases..InCaptionPhase.endTagTablecSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rXsz.getPhases..InCaptionPhase.endTagIgnorecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r[sz-getPhases..InCaptionPhase.endTagOtherN) r7r8r9rHrrrrrrrrrr))rr)r*InCaptionPhases rcsXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z%getPhases..InColumnGroupPhasecs^j|||tjd|jfd|jfg|_|j|j_tjd|jfd|j fg|_ |j |j _dS)Nrrxr) rHrrrrrrrendTagColgroup endTagColrr)r@rIr<)rr)r*rHas z.getPhases..InColumnGroupPhase.__init__cSs|jjdjdkS)Nr rry)r<r{r>)r@r)r)r*ignoreEndTagColgrouppsz:getPhases..InColumnGroupPhase.ignoreEndTagColgroupcSs8|jjdjdkrdS|j}|jtd|s4dSdS)Nr rrTry)r<r{r>rrr )r@rr)r)r*rss z0getPhases..InColumnGroupPhase.processEOFcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*r}sz7getPhases..InColumnGroupPhase.processCharacterscSs$|jj||jjjd|d<dS)NTrx)r<rr{r))r@rr)r)r*rs  z1getPhases..InColumnGroupPhase.startTagColcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*rsz3getPhases..InColumnGroupPhase.startTagOthercSs4|jr|jjn|jjj|jjd|j_dS)Nr)rrIr|r<r{r)rFr])r@rr)r)r*rs  z4getPhases..InColumnGroupPhase.endTagColgroupcSs|jjdddidS)Nz no-end-tagr>rx)rIr|)r@rr)r)r*rsz/getPhases..InColumnGroupPhase.endTagColcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*rsz1getPhases..InColumnGroupPhase.endTagOtherN) r7r8r9rHrrrrrrrrr))rr)r*InColumnGroupPhase^s   rcsxeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS)z#getPhases..InTableBodyPhasec svj|||tjd|jfd|jfd |jfd|jfg|_|j|j_ tjd|j fd |j fd|j fg|_ |j|j _ dS)Nrrrrrrxrrrrrr)rr)rrxrrrr)rrr)rrrxrrrrr)rHrrr startTagTrstartTagTableCellstartTagTableOtherrrrendTagTableRowGrouprrrr)r@rIr<)rr)r*rHs z,getPhases..InTableBodyPhase.__init__cSs:x"|jjdjdkr"|jjjqW|jjdjdkr6dS) Nr rrrrry)rrrrry)r<r{r>r))r@r)r)r*clearStackToTableBodyContexts z@getPhases..InTableBodyPhase.clearStackToTableBodyContextcSs|jjdjdS)Nr)rIrFr)r@r)r)r*rsz.getPhases..InTableBodyPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz:getPhases..InTableBodyPhase.processSpaceCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz5getPhases..InTableBodyPhase.processCharacterscSs(|j|jj||jjd|j_dS)Nr)rr<rrIrFr])r@rr)r)r*rs z.getPhases..InTableBodyPhase.startTagTrcSs*|jjdd|di|jtdd|S)Nzunexpected-cell-in-table-bodyr>rro)rIr|rr )r@rr)r)r*rsz5getPhases..InTableBodyPhase.startTagTableCellcSsb|jjddds0|jjddds0|jjdddrT|j|jt|jjdj|S|jjdS)Nrr)rrrr ry) r<rrrr r{r>rIr|)r@rr)r)r*rsz6getPhases..InTableBodyPhase.startTagTableOthercSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz1getPhases..InTableBodyPhase.startTagOthercSsT|jj|dddr:|j|jjj|jjd|j_n|jjdd|didS)Nr>r)rrz unexpected-end-tag-in-table-body) r<rrr{r)rIrFr]r|)r@rr)r)r*rs  z7getPhases..InTableBodyPhase.endTagTableRowGroupcSsb|jjddds0|jjddds0|jjdddrT|j|jt|jjdj|S|jjdS)Nrr)rrrr ry) r<rrrr r{r>rIr|)r@rr)r)r*rsz/getPhases..InTableBodyPhase.endTagTablecSs|jjdd|didS)Nz unexpected-end-tag-in-table-bodyr>)rIr|)r@rr)r)r*rsz0getPhases..InTableBodyPhase.endTagIgnorecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz/getPhases..InTableBodyPhase.endTagOtherN)r7r8r9rHrrrrrrrrrrrrr))rr)r*InTableBodyPhases    rcseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)zgetPhases..InRowPhasec svj|||tjd|jfd |jfd|jfg|_|j|j_tjd |j fd |j fd|j fd|j fg|_ |j|j _dS)Nrrrrrxrrrrrrr)rr)rrxrrrrr)rrr)rrrxrrrr)rHrrrrrrrrendTagTrrrrrr)r@rIr<)rr)r*rHs z&getPhases..InRowPhase.__init__cSsDx>|jjdjdkr>|jjdd|jjdji|jjjqWdS) Nr rrz'unexpected-implied-end-tag-in-table-rowr>ry)rrry)r<r{r>rIr|r))r@r)r)r*clearStackToTableRowContextsz9getPhases..InRowPhase.clearStackToTableRowContextcSs|jjddd S)Nrr)r)r<r)r@r)r)r*ignoreEndTagTrsz,getPhases..InRowPhase.ignoreEndTagTrcSs|jjdjdS)Nr)rIrFr)r@r)r)r*r"sz(getPhases..InRowPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r%sz4getPhases..InRowPhase.processSpaceCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r(sz/getPhases..InRowPhase.processCharacterscSs6|j|jj||jjd|j_|jjjtdS)Nr) rr<rrIrFr]rrr )r@rr)r)r*r+s z/getPhases..InRowPhase.startTagTableCellcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*r1sz0getPhases..InRowPhase.startTagTableOthercSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r8sz+getPhases..InRowPhase.startTagOthercSs<|js.|j|jjj|jjd|j_n |jjdS)Nr) rrr<r{r)rIrFr]r|)r@rr)r)r*r;s  z&getPhases..InRowPhase.endTagTrcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*rEsz)getPhases..InRowPhase.endTagTablecSs4|jj|dddr&|jtd|S|jjdS)Nr>r)rr)r<rrr rIr|)r@rr)r)r*rMsz1getPhases..InRowPhase.endTagTableRowGroupcSs|jjdd|didS)Nzunexpected-end-tag-in-table-rowr>)rIr|)r@rr)r)r*rTsz*getPhases..InRowPhase.endTagIgnorecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rXsz)getPhases..InRowPhase.endTagOtherN)r7r8r9rHrrrrrrrrrrrrrr))rr)r* InRowPhases  rcs`eZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)zgetPhases..InCellPhasec sfj|||tjd|jfd |jfg|_|j|j_tjd|jfd|j fd|j fg|_ |j |j _dS)Nrrrxrrrrrrrrr) rrxrrrrrrr)rr)rrrxrr)rrrrr) rHrrrrrrrendTagTableCellr endTagImplyrr)r@rIr<)rr)r*rH]s z'getPhases..InCellPhase.__init__cSsB|jjdddr |jtdn|jjdddr>|jtddS)Nrr)rr)r<rrr )r@r)r)r* closeCellnsz(getPhases..InCellPhase.closeCellcSs|jjdjdS)Nr)rIrFr)r@r)r)r*rusz)getPhases..InCellPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rxsz0getPhases..InCellPhase.processCharacterscSs:|jjddds |jjdddr,|j|S|jjdS)Nrr)rr)r<rrrIr|)r@rr)r)r*r{s z1getPhases..InCellPhase.startTagTableOthercSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz,getPhases..InCellPhase.startTagOthercSs|jj|dddr|jj|d|jjdj|dkrt|jjdd|dix.|jjj}|j|dkrRPqRWn |jjj|jj|jj d|j_ n|jjdd|didS) Nr>r)rr zunexpected-cell-end-tagrzunexpected-end-tagry) r<rrr{r>rIr|r)rrFr])r@rrr)r)r*rs   z.getPhases..InCellPhase.endTagTableCellcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz+getPhases..InCellPhase.endTagIgnorecSs.|jj|dddr |j|S|jjdS)Nr>r)r)r<rrrIr|)r@rr)r)r*rsz*getPhases..InCellPhase.endTagImplycSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz*getPhases..InCellPhase.endTagOtherN) r7r8r9rHrrrrrrrrrr))rr)r* InCellPhase[s  rcsxeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS)z getPhases..InSelectPhasecsj|||tjd|jfd|jfd|jfd|jfd |jfd|jfg|_ |j |j _ tjd|j fd|j fd|jfg|_|j|j_ dS) Nrrvrwrrnrirrr)rnrirr)rHrrrstartTagOptionstartTagOptgrouprrr$rrr endTagOptionendTagOptgroup endTagSelectrr)r@rIr<)rr)r*rHs z)getPhases..InSelectPhase.__init__cSs$|jjdjdkr |jjdndS)Nr rz eof-in-selectry)r<r{r>rIr|)r@r)r)r*rsz+getPhases..InSelectPhase.processEOFcSs$|ddkrdS|jj|ddS)Nrsr)r<r)r@rr)r)r*rs z2getPhases..InSelectPhase.processCharacterscSs.|jjdjdkr|jjj|jj|dS)Nr rvry)r<r{r>r)r)r@rr)r)r*rs z/getPhases..InSelectPhase.startTagOptioncSsL|jjdjdkr|jjj|jjdjdkr<|jjj|jj|dS)Nr rvrwryry)r<r{r>r)r)r@rr)r)r*rs   z1getPhases..InSelectPhase.startTagOptgroupcSs|jjd|jtddS)Nzunexpected-select-in-selectr)rIr|rr )r@rr)r)r*rs z/getPhases..InSelectPhase.startTagSelectcSs2|jjd|jjdddr.|jtd|SdS)Nzunexpected-input-in-selectr)r)rIr|r<rrr )r@rr)r)r*rs  z.getPhases..InSelectPhase.startTagInputcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r$sz/getPhases..InSelectPhase.startTagScriptcSs|jjdd|didS)Nzunexpected-start-tag-in-selectr>)rIr|)r@rr)r)r*rsz.getPhases..InSelectPhase.startTagOthercSs6|jjdjdkr |jjjn|jjdddidS)Nr rvzunexpected-end-tag-in-selectr>ry)r<r{r>r)rIr|)r@rr)r)r*rsz-getPhases..InSelectPhase.endTagOptioncSsf|jjdjdkr0|jjdjdkr0|jjj|jjd jdkrP|jjjn|jjdddidS) Nr rvrrwzunexpected-end-tag-in-selectr>ryry)r<r{r>r)rIr|)r@rr)r)r*rs z/getPhases..InSelectPhase.endTagOptgroupcSsR|jjdddrD|jjj}x|jdkr6|jjj}qW|jjn |jjdS)Nr)r)r<rr{r)r>rIr_r|)r@rrr)r)r*rs    z-getPhases..InSelectPhase.endTagSelectcSs|jjdd|didS)Nzunexpected-end-tag-in-selectr>)rIr|)r@rr)r)r*r sz,getPhases..InSelectPhase.endTagOtherN)r7r8r9rHrrrrrrr$rrrrrr))rr)r* InSelectPhases   rcsHeZdZfddZddZddZddZd d Zd d Zd dZ dS)z'getPhases..InSelectInTablePhasec sNj|||tjd |jfg|_|j|j_tjd |jfg|_|j |j_dS) Nrrrrrrrr)rrrrrrrr)rrrrrrrr) rHrrrrrrrrr)r@rIr<)rr)r*rH s z0getPhases..InSelectInTablePhase.__init__cSs|jjdjdS)Nr)rIrFr)r@r)r)r*r sz2getPhases..InSelectInTablePhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r sz9getPhases..InSelectInTablePhase.processCharacterscSs(|jjdd|di|jtd|S)Nz5unexpected-table-element-start-tag-in-select-in-tabler>r)rIr|rr )r@rr)r)r*r! sz5getPhases..InSelectInTablePhase.startTagTablecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r& sz5getPhases..InSelectInTablePhase.startTagOthercSs@|jjdd|di|jj|dddr<|jtd|SdS)Nz3unexpected-table-element-end-tag-in-select-in-tabler>r)rr)rIr|r<rrr )r@rr)r)r*r) sz3getPhases..InSelectInTablePhase.endTagTablecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r/ sz3getPhases..InSelectInTablePhase.endTagOtherN) r7r8r9rHrrrrrrr))rr)r*InSelectInTablePhase s rc-seZdZeddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,g,Zfd-d.Zd/d0Zfd1d2Zd3d4Zd5d6Z d7S)8z(getPhases..InForeignContentPhaserUrVr<rr r=rWrRr+r@rSrXrgZh1Zh2Zh3Zh4Zh5Zh6rrorZrhrQrOrHr4rarJr(rNrr[r\spanr^r]subZsuprr_r`rMvarcsj|||dS)N)rH)r@rIr<)rr)r*rH< sz1getPhases..InForeignContentPhase.__init__c%Ssnddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%$}|d&|krj||d&|d&<dS)'NZaltGlyphZ altGlyphDefZ altGlyphItemZ animateColorZ animateMotionZanimateTransformZclipPathZfeBlendZ feColorMatrixZfeComponentTransferZ feCompositeZfeConvolveMatrixZfeDiffuseLightingZfeDisplacementMapZfeDistantLightZfeFloodZfeFuncAZfeFuncBZfeFuncGZfeFuncRZfeGaussianBlurZfeImageZfeMergeZ feMergeNodeZ feMorphologyZfeOffsetZ fePointLightZfeSpecularLightingZ feSpotLightZfeTileZ feTurbulenceZ foreignObjectZglyphRefZlinearGradientZradialGradientZtextPath)$ZaltglyphZ altglyphdefZ altglyphitemZ animatecolorZ animatemotionZanimatetransformZclippathZfeblendZ fecolormatrixZfecomponenttransferZ fecompositeZfeconvolvematrixZfediffuselightingZfedisplacementmapZfedistantlightZfefloodZfefuncaZfefuncbZfefuncgZfefuncrZfegaussianblurZfeimageZfemergeZ femergenodeZ femorphologyZfeoffsetZ fepointlightZfespecularlightingZ fespotlightZfetileZ feturbulenceZ foreignobjectZglyphrefZlineargradientZradialgradientZtextpathr>r))r@r replacementsr)r)r*adjustSVGTagNames? sL z:getPhases..InForeignContentPhase.adjustSVGTagNamescsL|ddkrd|d<n&|jjr.InForeignContentPhase.processCharacters..F)rIr`rr)r@r)rr)r*rh s   z:getPhases..InForeignContentPhase.processCharacterscSs6|jjd}|d|jksD|ddkrt|djtdddg@r|jjdd|dixR|jjdj|jjkr|jj |jjd r|jj |jjd r|jjj q\W|S|jt d kr|jj |n$|jt d kr|j||jj||jj||j|d <|jj||d r2|jjj d |d<dS)Nr r>rYrsZcolorZfacesizez*unexpected-html-element-in-foreign-contentrdrurhrwTrxryryryry)r<r{breakoutElementssetkeysrIr|rhrrlrmr)rrrrrr)r@rrr)r)r*rp s.          z8getPhases..InForeignContentPhase.processStartTagcSst|jjd}|jjd}|jjt|dkrF|jjdd|dix|jjt|dkr|jj|jj dkr|jjj |jjj |j_x|jjj |krqWd}P|d8}|jj|}|j |jjkrqHqH|jjj|}PqHW|S)Nr r>zunexpected-end-tagrry)r~r<r{r>rjrrIr|r]rFrrr)rhrr)r@rZ nodeIndexrrr)r)r*r s(   z6getPhases..InForeignContentPhase.processEndTagN) r7r8r9rrrHrrrrr))rr)r*InForeignContentPhase2 s       ) rcsPeZdZfddZddZddZddZd d Zd d Zd dZ ddZ dS)z!getPhases..AfterBodyPhasecsNj|||tjd|jfg|_|j|j_tjd|jfg|_|j |j_dS)Nr) rHrrrrrrrrr)r@rIr<)rr)r*rH s  z*getPhases..AfterBodyPhase.__init__cSsdS)Nr))r@r)r)r*r sz,getPhases..AfterBodyPhase.processEOFcSs|jj||jjddS)Nr)r<rr{)r@rr)r)r*r sz0getPhases..AfterBodyPhase.processCommentcSs |jjd|jjd|j_|S)Nzunexpected-char-after-bodyr)rIr|rFr])r@rr)r)r*r s z3getPhases..AfterBodyPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r sz.getPhases..AfterBodyPhase.startTagHtmlcSs*|jjdd|di|jjd|j_|S)Nzunexpected-start-tag-after-bodyr>r)rIr|rFr])r@rr)r)r*r sz/getPhases..AfterBodyPhase.startTagOthercSs*|jjr|jjdn|jjd|j_dS)Nz'unexpected-end-tag-after-body-innerhtmlafterAfterBody)rIrPr|rFr])r@r>r)r)r*r sz,getPhases..AfterBodyPhase.endTagHtmlcSs*|jjdd|di|jjd|j_|S)Nzunexpected-end-tag-after-bodyr>r)rIr|rFr])r@rr)r)r*r sz-getPhases..AfterBodyPhase.endTagOtherN) r7r8r9rHrrrrrrrr))rr)r*AfterBodyPhase s rcsXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z"getPhases..InFramesetPhasecsfj|||tjd|jfd|jfd|jfd|jfg|_|j|j_ tjd|j fg|_ |j |j _ dS)Nrrryr) rHrrrr5 startTagFramestartTagNoframesrrrendTagFramesetrr)r@rIr<)rr)r*rH s z+getPhases..InFramesetPhase.__init__cSs$|jjdjdkr |jjdndS)Nr rzeof-in-framesetry)r<r{r>rIr|)r@r)r)r*r sz-getPhases..InFramesetPhase.processEOFcSs|jjddS)Nzunexpected-char-in-frameset)rIr|)r@rr)r)r*r sz4getPhases..InFramesetPhase.processCharacterscSs|jj|dS)N)r<r)r@rr)r)r*r5 sz3getPhases..InFramesetPhase.startTagFramesetcSs|jj||jjjdS)N)r<rr{r))r@rr)r)r*r  s z0getPhases..InFramesetPhase.startTagFramecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r  sz3getPhases..InFramesetPhase.startTagNoframescSs|jjdd|didS)Nz unexpected-start-tag-in-framesetr>)rIr|)r@rr)r)r*r sz0getPhases..InFramesetPhase.startTagOthercSs\|jjdjdkr |jjdn |jjj|jj rX|jjdjdkrX|jjd|j_dS)Nr rz)unexpected-frameset-in-frameset-innerhtmlr afterFramesetryry) r<r{r>rIr|r)rPrFr])r@rr)r)r*r  s   z1getPhases..InFramesetPhase.endTagFramesetcSs|jjdd|didS)Nzunexpected-end-tag-in-framesetr>)rIr|)r@rr)r)r*r sz.getPhases..InFramesetPhase.endTagOtherN) r7r8r9rHrrr5r r rr rr))rr)r*InFramesetPhase s  r csHeZdZfddZddZddZddZd d Zd d Zd dZ dS)z%getPhases..AfterFramesetPhasecsVj|||tjd|jfd|jfg|_|j|j_tjd|jfg|_ |j |j _dS)Nrr) rHrrrr rrrrrr)r@rIr<)rr)r*rH s z.getPhases..AfterFramesetPhase.__init__cSsdS)Nr))r@r)r)r*r sz0getPhases..AfterFramesetPhase.processEOFcSs|jjddS)Nzunexpected-char-after-frameset)rIr|)r@rr)r)r*r! sz7getPhases..AfterFramesetPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r $ sz6getPhases..AfterFramesetPhase.startTagNoframescSs|jjdd|didS)Nz#unexpected-start-tag-after-framesetr>)rIr|)r@rr)r)r*r' sz3getPhases..AfterFramesetPhase.startTagOthercSs|jjd|j_dS)NafterAfterFrameset)rIrFr])r@rr)r)r*r+ sz0getPhases..AfterFramesetPhase.endTagHtmlcSs|jjdd|didS)Nz!unexpected-end-tag-after-framesetr>)rIr|)r@rr)r)r*r. sz1getPhases..AfterFramesetPhase.endTagOtherN) r7r8r9rHrrr rrrr))rr)r*AfterFramesetPhase s rcsPeZdZfddZddZddZddZd d Zd d Zd dZ ddZ dS)z&getPhases..AfterAfterBodyPhasecs0j|||tjd|jfg|_|j|j_dS)Nr)rHrrrrrr)r@rIr<)rr)r*rH3 sz/getPhases..AfterAfterBodyPhase.__init__cSsdS)Nr))r@r)r)r*r; sz1getPhases..AfterAfterBodyPhase.processEOFcSs|jj||jjdS)N)r<rr)r@rr)r)r*r> sz5getPhases..AfterAfterBodyPhase.processCommentcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rA sz=getPhases..AfterAfterBodyPhase.processSpaceCharacterscSs |jjd|jjd|j_|S)Nzexpected-eof-but-got-charr)rIr|rFr])r@rr)r)r*rD s z8getPhases..AfterAfterBodyPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rI sz3getPhases..AfterAfterBodyPhase.startTagHtmlcSs*|jjdd|di|jjd|j_|S)Nzexpected-eof-but-got-start-tagr>r)rIr|rFr])r@rr)r)r*rL sz4getPhases..AfterAfterBodyPhase.startTagOthercSs*|jjdd|di|jjd|j_|S)Nzexpected-eof-but-got-end-tagr>r)rIr|rFr])r@rr)r)r*rR sz4getPhases..AfterAfterBodyPhase.processEndTagN) r7r8r9rHrrrrrrrr))rr)r*AfterAfterBodyPhase2 s rcsXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z*getPhases..AfterAfterFramesetPhasecs8j|||tjd|jfd|jfg|_|j|j_dS)Nrr)rHrrrstartTagNoFramesrrr)r@rIr<)rr)r*rHY s z3getPhases..AfterAfterFramesetPhase.__init__cSsdS)Nr))r@r)r)r*rb sz5getPhases..AfterAfterFramesetPhase.processEOFcSs|jj||jjdS)N)r<rr)r@rr)r)r*re sz9getPhases..AfterAfterFramesetPhase.processCommentcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rh szAgetPhases..AfterAfterFramesetPhase.processSpaceCharacterscSs|jjddS)Nzexpected-eof-but-got-char)rIr|)r@rr)r)r*rk sz.AfterAfterFramesetPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rn sz7getPhases..AfterAfterFramesetPhase.startTagHtmlcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rq sz;getPhases..AfterAfterFramesetPhase.startTagNoFramescSs|jjdd|didS)Nzexpected-eof-but-got-start-tagr>)rIr|)r@rr)r)r*rt sz8getPhases..AfterAfterFramesetPhase.startTagOthercSs|jjdd|didS)Nzexpected-eof-but-got-end-tagr>)rIr|)r@rr)r)r*rx sz8getPhases..AfterAfterFramesetPhase.processEndTagN) r7r8r9rHrrrrrrrrr))rr)r*AfterAfterFramesetPhaseX s r)rTrSrrr-r.rrrrrrrrrrrrvrrr rr)r)rGrVrr r rr/r3r8rrrrrrrrrrrrrr rrrr))rr*rE_sp)#.g@CX!-GBbYLd's/9%&&rEcs^ts tjr t|dt@}nt|dt@}|rZtfdd|djD|d<dS)Nrsc3s"|]\}}j|||fVqdS)N)r})r=kv)rr)r*r sz$adjust_attributes..)rrZPY27rrrr.)rrZneeds_adjustmentr))rr*r s   rrpFcCs|dkr i}t||||dS)N)r2r>rsrw)r)r>r2rirwr)r)r*r  s r c@seZdZdZdS)rrzError in parsed documentN)r7r8r9rr)r)r)r*rr srr)rT)r+rT)rpNF)1Z __future__rrrZpip._vendor.sixrrrr0 collectionsr ImportErrorZpip._vendor.ordereddictrr r r Ztreebuilders.baser rZ constantsrrrrrrrrrrrrrrrrrr#r-r;rer"ZmemoizerErr  Exceptionrrr)r)r)r*sR     H   )L  html5lib/__pycache__/_ihatexml.cpython-36.pyc000064400000032721152347724720015116 0ustar003 PfAA@sddlmZmZmZddlZddlZddlmZdZdZ dZ dZ d Z d j ee gZd j ee d d d e e gZd j ed gZejdZejdZddZddZeddZddZddZddZddZejdZejdZejd ZGd!d"d"eZ dS)#)absolute_importdivisionunicode_literalsN)DataLossWarninga^ [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]z*[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]a [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] | [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC | [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] | #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] | [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] | [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] | [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] | [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] | [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] | #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099 | #x309Aa  [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] | [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] | [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]z} #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | #[#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]z | .-_z#x([\d|A-F]{4,4})z'\[#x([\d|A-F]{4,4})-#x([\d|A-F]{4,4})\]cCsdd|jdD}g}x|D]}d}x`ttfD]T}|j|}|dk r0|jdd|jDt|d dkr~|d d|d <d}Pq0W|st|dkst|jt|gdqWt |}|S) NcSsg|] }|jqS)strip).0itemr r /usr/lib/python3.6/_ihatexml.py hsz$charStringToList..z | FcSsg|] }t|qSr )hexToInt)r r r r rrosrTrr) splitreChar reCharRangematchappendgroupslenAssertionErrorordnormaliseCharList)charsZ charRangesrvr Z foundMatchZregexprr r rcharStringToListgs"  rcCst|}x |D]}|d|dkstqWg}d}x|t|krd}|j||xT||t|kr|||d|dddkr|||d|dd<|d7}qTW||7}q4W|S)Nrrrr)sortedrrr)charListr rijr r rr|s 2  rZFFFFcCsg}|ddkr*|jd|dddgxBt|ddD].\}}|j|dd||dddgq|dkr>tjdtdS|j|SdS)Nzxmlns:z"Attributes cannot begin with xmlnszhttp://www.w3.org/2000/xmlns/z)Attributes cannot be in the xml namespace)r? startswithwarningswarnrr@ toXmlName)rFname namespacer r rcoerceAttributes  zInfosetFilter.coerceAttributecCs |j|S)N)rK)rFrLr r r coerceElementszInfosetFilter.coerceElementcCsN|jrJx$d|kr*tjdt|jdd}qW|jdrJtjdt|d7}|S)Nz--z'Comments cannot contain adjacent dashesz- -rzComments cannot end in a dash )rArIrJrr;endswith)rFdatar r r coerceComments    zInfosetFilter.coerceCommentcCs:|jr6x"t|jdD]}tjdtqW|jdd}|S)N zText cannot contain U+000CrP)rCrangecountrIrJrr;)rFrRr r r rcoerceCharacterss  zInfosetFilter.coerceCharacterscCsp|}x4tj|D]&}tjdt|j|}|j||}qW|jrl|jddkrltjdt|jd|jd}|S)NzCoercing non-XML pubid'rz!Pubid cannot contain single quote) nonPubidCharRegexpfindallrIrJrgetReplacementCharacterr;rDfind)rFrRZ dataOutputr= replacementr r r coercePubids   zInfosetFilter.coercePubidc Cs|d}|dd}tj|}|r:tjdt|j|}n|}|}ttj|}x.|D]&}tjdt|j|} |j || }qVW||S)NrrzCoercing non-XML name) nonXmlNameFirstBMPRegexprrIrJrr[setnonXmlNameBMPRegexprZr;) rFrL nameFirstZnameRestmZnameFirstOutputZnameRestOutputZ replaceCharsr=r]r r rrKs       zInfosetFilter.toXmlNamecCs$||jkr|j|}n |j|}|S)N)rE escapeChar)rFr=r]r r rr[s   z%InfosetFilter.getReplacementCharactercCs0x*t|jj|D]}|j||j|}qW|S)N)r`replacementRegexprZr; unescapeChar)rFrLr r r r fromXmlNameszInfosetFilter.fromXmlNamecCsdt|}||j|<|S)NzU%05X)rrE)rFr=r]r r rrds  zInfosetFilter.escapeCharcCstt|dddS)Nrr$)r*r-)rFZcharcoder r rrfszInfosetFilter.unescapeChar)FFFFTF)N)__name__ __module__ __qualname__recompilererGrNrOrSrWr^rKr[rgrdrfr r r rr>s"     r>)!Z __future__rrrrkrIZ constantsrZbaseCharZ ideographicZcombiningCharacterZdigitZextenderr+ZletterrLrbrlrrrrr-r&r'r,rr)rar_rYobjectr>r r r rs2 0        html5lib/__pycache__/serializer.cpython-36.pyc000064400000022106152347724720015311 0ustar003 Pfa7@sddlmZmZmZddlmZddlZddlmZm Z ddl m Z m Z m Z ddl mZmZmZddlmZmZdd lmZd je d Zejd ed Zejd edZiZeddkZxeejD]p\Z Z!eree!dkse ree!dkrqe!dkree!dkrej"e!Z!ne#e!Z!e!eks4e j$re ee!<qWddZ%ede%dddZ&Gddde'Z(Gddde)Z*dS))absolute_importdivisionunicode_literals) text_typeN)register_errorxmlcharrefreplace_errors) voidElementsbooleanAttributesspaceCharacters)rcdataElementsentities xmlEntities) treewalkers_utils)escapez"'=<>`[]u_  /`  ᠎᠏           

   ]u􏿿&c Cs"t|ttfrg}g}d}xt|j|j|jD]n\}}|rFd}q4||j}tj|j|t |j|dgrtj |j||d}d}nt |}|j |q4Wx^|D]V}t j|} | r|j d|j | | jds|j dq|j dt|ddqWdj||jfSt|SdS)NFrTr;z&#x%s;r) isinstanceUnicodeEncodeErrorUnicodeTranslateError enumerateobjectstartendrZisSurrogatePairminsurrogatePairToCodepointordappend_encode_entity_mapgetendswithhexjoinr) excresZ codepointsskipicindexZ codepointZcper/ /usr/lib/python3.6/serializer.pyhtmlentityreplace_errors*s0  "      r1htmlentityreplaceetreecKs$tj|}tf|}|j|||S)N)rZ getTreeWalkerHTMLSerializerrender)inputZtreeencodingZserializer_optsZwalkersr/r/r0 serializeJs  r9c@s~eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZd!ZddZddZddZd"ddZd#ddZd$dd ZdS)%r4legacy"TFquote_attr_values quote_charuse_best_quote_charomit_optional_tagsminimize_boolean_attributesuse_trailing_solidusspace_before_trailing_solidusescape_lt_in_attrs escape_rcdataresolve_entitiesalphabetical_attributesinject_meta_charsetstrip_whitespacesanitizec Kszt|t|j}t|dkr2tdtt|d|kr@d|_x(|jD]}t|||j|t ||qHWg|_ d|_ dS)a6 Initialize HTMLSerializer. Keyword options (default given first unless specified) include: inject_meta_charset=True|False Whether it insert a meta element to define the character set of the document. quote_attr_values="legacy"|"spec"|"always" Whether to quote attribute values that don't require quoting per legacy browser behaviour, when required by the standard, or always. quote_char=u'"'|u"'" Use given quote character for attribute quoting. Default is to use double quote unless attribute value contains a double quote, in which case single quotes are used instead. escape_lt_in_attrs=False|True Whether to escape < in attribute values. escape_rcdata=False|True Whether to escape characters that need to be escaped within normal elements within rcdata elements such as style. resolve_entities=True|False Whether to resolve named character entities that appear in the source tree. The XML predefined entities < > & " ' are unaffected by this setting. strip_whitespace=False|True Whether to remove semantically meaningless whitespace. (This compresses all whitespace to a single space except within pre.) minimize_boolean_attributes=True|False Shortens boolean attributes to give just the attribute value, for example becomes . use_trailing_solidus=False|True Includes a close-tag slash at the end of the start tag of void elements (empty elements whose end tag is forbidden). E.g.
. space_before_trailing_solidus=True|False Places a space immediately before the closing slash in a tag using a trailing solidus. E.g.
. Requires use_trailing_solidus. sanitize=False|True Strip all unsafe or unknown constructs from output. See `html5lib user documentation`_ omit_optional_tags=True|False Omit start/end tags that are optional. alphabetical_attributes=False|True Reorder attributes to be in alphabetical order. .. _html5lib user documentation: http://code.google.com/p/html5lib/wiki/UserDocumentation rz2__init__() got an unexpected keyword argument '%s'r=FN) frozensetoptionslen TypeErrornextiterr>setattrr$getattrerrorsstrict)selfkwargsZunexpected_argsattrr/r/r0__init__ps.  zHTMLSerializer.__init__cCs*t|tst|jr"|j|jdS|SdS)Nr2)rrAssertionErrorr7encode)rTstringr/r/r0rYszHTMLSerializer.encodecCs*t|tst|jr"|j|jdS|SdS)NrS)rrrXr7rY)rTrZr/r/r0 encodeStrictszHTMLSerializer.encodeStrictNccs||_d}g|_|r0|jr0ddlm}|||}|jrJddlm}||}|jrdddlm}||}|j r~ddl m}||}|j rddl m}||}xR|D]H}|d}|dkr`d|d}|dr|d |d7}n|d r|d 7}|d rJ|d j d d kr0|d j dd kr*|jdd}nd }|d||d |f7}|d7}|j|Vq|d5kr|dksz|r|r|dj dd kr|jd|j|dVn|jt|dVq|d6kr|d} |jd| V| tkr|j rd}n|r|jdx|djD]\\} } } | } | }|jdV|j| V|j s| tj| tkr"| tjdtkr"|jdV|jdkst|d krd}n@|jd krtj|dk }n$|jd!krtj|dk }ntd"|jd#d$}|j r|jd%d&}|r|j!}|j"rTd|kr CharactersSpaceCharactersdatazCommentz--zComment contains --z ZEntityrzEntity %s not recognizedz&%s;)rarb)rdre))r7rRrGZfilters.inject_meta_charsetr\rFZfilters.alphabeticalattributesrHZfilters.whitespacerIZfilters.sanitizerr?Zfilters.optionaltagsfindserializeErrorr[rYrr rDitemsr@r r$tupler<rL_quoteAttributeSpecsearch_quoteAttributeLegacy ValueErrorreplacerCr=r>r rArBr rEr)rT treewalkerr7Zin_cdatar\tokenr]Zdoctyper=r^_Z attr_nameZ attr_valuekvZ quote_attrrckeyr/r/r0r9s                                    zHTMLSerializer.serializecCs2|rdjt|j||Sdjt|j|SdS)Nr)r'listr9)rTrvr7r/r/r0r5?szHTMLSerializer.renderXXX ERROR MESSAGE NEEDEDcCs|jj||jrtdS)N)rRr"rSSerializeError)rTrcr/r/r0rnEs zHTMLSerializer.serializeError)r<r=r>r?r@rArBrCrDrErFrGrHrI)N)N)r~)__name__ __module__ __qualname__r<r=r>r?r@rArBrCrDrErFrGrHrIrKrWrYr[r9r5rnr/r/r/r0r4Qs68  r4c@seZdZdZdS)rzError in serialized treeN)rrr__doc__r/r/r/r0rLsr)r3N)+Z __future__rrrZpip._vendor.sixrrecodecsrrZ constantsr r r r r rrrrZxml.sax.saxutilsrr'Z_quoteAttributeSpecCharscompilerqrsr#rLZ_is_ucs4r}roryrzr r!islowerr1r9rr4 Exceptionrr/r/r/r0s:         |html5lib/__pycache__/_ihatexml.cpython-36.opt-1.pyc000064400000032626152347724720016061 0ustar003 PfAA@sddlmZmZmZddlZddlZddlmZdZdZ dZ dZ d Z d j ee gZd j ee d d d e e gZd j ed gZejdZejdZddZddZeddZddZddZddZddZejdZejdZejd ZGd!d"d"eZ dS)#)absolute_importdivisionunicode_literalsN)DataLossWarninga^ [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]z*[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]a [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] | [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC | [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] | #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] | [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] | [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] | [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] | [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] | [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] | #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099 | #x309Aa  [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] | [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] | [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]z} #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | #[#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]z | .-_z#x([\d|A-F]{4,4})z'\[#x([\d|A-F]{4,4})-#x([\d|A-F]{4,4})\]cCsdd|jdD}g}x|D]}d}x`ttfD]T}|j|}|dk r0|jdd|jDt|d dkr~|d d|d <d}Pq0W|s|jt|gdqWt|}|S) NcSsg|] }|jqS)strip).0itemr r /usr/lib/python3.6/_ihatexml.py hsz$charStringToList..z | FcSsg|] }t|qSr )hexToInt)r r r r rrosrTrr) splitreChar reCharRangematchappendgroupslenordnormaliseCharList)charsZ charRangesrvr Z foundMatchZregexprr r rcharStringToListgs   rcCst|}x |D]}qWg}d}x|t|krd}|j||xT||t|kr|||d|dddkr|||d|dd<|d7}q@W||7}q W|S)Nrrrr)sortedrr)charListr rijr r rr|s 2  rZFFFFcCsg}|ddkr*|jd|dddgxBt|ddD].\}}|j|dd||dddgqr?r@rArBrCr r r__init__szInfosetFilter.__init__NcCsL|jr |jdr tjdtdS|jr>|dkr>tjdtdS|j|SdS)Nzxmlns:z"Attributes cannot begin with xmlnszhttp://www.w3.org/2000/xmlns/z)Attributes cannot be in the xml namespace)r> startswithwarningswarnrr? toXmlName)rEname namespacer r rcoerceAttributes  zInfosetFilter.coerceAttributecCs |j|S)N)rJ)rErKr r r coerceElementszInfosetFilter.coerceElementcCsN|jrJx$d|kr*tjdt|jdd}qW|jdrJtjdt|d7}|S)Nz--z'Comments cannot contain adjacent dashesz- -rzComments cannot end in a dash )r@rHrIrr:endswith)rEdatar r r coerceComments    zInfosetFilter.coerceCommentcCs:|jr6x"t|jdD]}tjdtqW|jdd}|S)N zText cannot contain U+000CrO)rBrangecountrHrIrr:)rErQr r r rcoerceCharacterss  zInfosetFilter.coerceCharacterscCsp|}x4tj|D]&}tjdt|j|}|j||}qW|jrl|jddkrltjdt|jd|jd}|S)NzCoercing non-XML pubid'rz!Pubid cannot contain single quote) nonPubidCharRegexpfindallrHrIrgetReplacementCharacterr:rCfind)rErQZ dataOutputr< replacementr r r coercePubids   zInfosetFilter.coercePubidc Cs|d}|dd}tj|}|r:tjdt|j|}n|}|}ttj|}x.|D]&}tjdt|j|} |j || }qVW||S)NrrzCoercing non-XML name) nonXmlNameFirstBMPRegexprrHrIrrZsetnonXmlNameBMPRegexprYr:) rErK nameFirstZnameRestmZnameFirstOutputZnameRestOutputZ replaceCharsr<r\r r rrJs       zInfosetFilter.toXmlNamecCs$||jkr|j|}n |j|}|S)N)rD escapeChar)rEr<r\r r rrZs   z%InfosetFilter.getReplacementCharactercCs0x*t|jj|D]}|j||j|}qW|S)N)r_replacementRegexprYr: unescapeChar)rErKr r r r fromXmlNameszInfosetFilter.fromXmlNamecCsdt|}||j|<|S)NzU%05X)rrD)rEr<r\r r rrcs  zInfosetFilter.escapeCharcCstt|dddS)Nrr#)r)r,)rEZcharcoder r rreszInfosetFilter.unescapeChar)FFFFTF)N)__name__ __module__ __qualname__recompilerdrFrMrNrRrVr]rJrZrfrcrer r r rr=s"     r=)!Z __future__rrrrjrHZ constantsrZbaseCharZ ideographicZcombiningCharacterZdigitZextenderr*ZletterrKrarkrrrrr,r%r&r+rr(r`r^rXobjectr=r r r rs2 0        html5lib/__pycache__/__init__.cpython-36.pyc000064400000001563152347724720014703 0ustar003 Pf @shdZddlmZmZmZddlmZmZmZddl m Z ddl m Z ddl mZdd d d d d gZdZdS)aM HTML parsing library based on the WHATWG "HTML5" specification. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage: import html5lib f = open("my_document.html") tree = html5lib.parse(f) )absolute_importdivisionunicode_literals) HTMLParserparse parseFragment)getTreeBuilder) getTreeWalker) serializerrrr r r z1.0b10N)__doc__Z __future__rrrZ html5parserrrrZ treebuildersr Z treewalkersr Z serializerr __all__ __version__rr/usr/lib/python3.6/__init__.py s   html5lib/__pycache__/_tokenizer.cpython-36.opt-1.pyc000064400000122103152347724720016246 0ustar003 Pf$+@sddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl m Z m Z ddl mZmZmZdd l mZmZdd l mZdd lmZdd lmZee ZGd ddeZdS))absolute_importdivisionunicode_literals)unichr)deque)spaceCharacters)entities) asciiLettersasciiUpper2Lower)digits hexDigitsEOF) tokenTypes tagTokenTypes)replacementCharacters)HTMLInputStream)TriecsdeZdZdZdfdd ZddZddZdd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z!d@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&dJdKZ'dLdMZ(dNdOZ)dPdQZ*dRdSZ+dTdUZ,dVdWZ-dXdYZ.dZd[Z/d\d]Z0d^d_Z1d`daZ2dbdcZ3dddeZ4dfdgZ5dhdiZ6djdkZ7dldmZ8dndoZ9dpdqZ:drdsZ;dtduZdzd{Z?d|d}Z@d~dZAddZBddZCddZDddZEddZFddZGddZHddZIddZJddZKddZLZMS) HTMLTokenizera  This class takes care of tokenizing HTML. * self.currentToken Holds the token that is currently being processed. * self.state Holds a reference to the method to be invoked... XXX * self.stream Points to HTMLInputStream object. Nc sFt|f||_||_d|_g|_|j|_d|_d|_t t |j dS)NF) rstreamparserZ escapeFlagZ lastFourChars dataStatestateescape currentTokensuperr__init__)selfrrkwargs) __class__ /usr/lib/python3.6/_tokenizer.pyr"szHTMLTokenizer.__init__ccs\tg|_xL|jrVx&|jjr:td|jjjddVqWx|jrR|jjVq>Wq WdS)z This is where the magic happens. We do our usually processing through the states and when we have a token to return we yield the token which pauses processing until the next token is requested. ParseErrorr)typedataN)r tokenQueuerrerrorsrpoppopleft)rr r r!__iter__1s    zHTMLTokenizer.__iter__c %Cs(t}d}|rt}d}g}|jj}x(||krJ|tk rJ|j||jj}q$Wtdj||}|tkrt|}|j jt ddd|idnld|kod kns|d krd }|j jt ddd|idn(d |kod knsd|kodknsd|kodknsd|ko4dkns|t ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d g#kr|j jt ddd|idy t |}Wn>t k r|d6}t d|d?Bt d7|d8@B}YnX|d9kr$|j jt dd:d;|jj||S)r"z'expected-tag-name-but-got-right-bracket)r#r$rJz<>?z'expected-tag-name-but-got-question-markzexpected-tag-namerDT)rr6markupDeclarationOpenStatercloseTagOpenStater rr tagNameStater%r7rr=bogusCommentState)rr$r r r!r]is6               zHTMLTokenizer.tagOpenStatecCs|jj}|tkr0td|gdd|_|j|_n|dkrX|jjtddd|j |_nn|t kr|jjtddd|jjtd d d|j |_n0|jjtdd d |id |jj ||j |_dS)NrVF)r#rUr$rWrjr"z*expected-closing-tag-but-got-right-bracket)r#r$z expected-closing-tag-but-got-eofrJz|tkr|jjtdd d|j |_n|jjtd|dd S) Nr|rJ)r#r$rDr[r"zinvalid-codepointu�zeof-in-script-in-scriptT) rr6r%r7r scriptDataDoubleEscapedDashStater(scriptDataDoubleEscapedLessThanSignStaterr)rr$r r r!rs$          z*HTMLTokenizer.scriptDataDoubleEscapedStatecCs|jj}|dkr2|jjtddd|j|_n|dkrZ|jjtddd|j|_n|dkr|jjtddd|jjtddd|j|_nF|t kr|jjtdd d|j |_n|jjtd|d|j|_d S) Nr|rJ)r#r$rDr[r"zinvalid-codepointu�zeof-in-script-in-scriptT) rr6r%r7r$scriptDataDoubleEscapedDashDashStaterrrrr)rr$r r r!rs(           z.HTMLTokenizer.scriptDataDoubleEscapedDashStatecCs|jj}|dkr*|jjtdddn|dkrR|jjtddd|j|_n|dkrz|jjtddd|j|_n|dkr|jjtddd|jjtdd d|j|_nF|t kr|jjtdd d|j |_n|jjtd|d|j|_d S) Nr|rJ)r#r$rDrjr[r"zinvalid-codepointu�zeof-in-script-in-scriptT) rr6r%r7rrrrfrrr)rr$r r r!rs,           z2HTMLTokenizer.scriptDataDoubleEscapedDashDashStatecCsP|jj}|dkr8|jjtdddd|_|j|_n|jj||j |_dS)NrirJ)r#r$r,T) rr6r%r7rrrscriptDataDoubleEscapeEndStaterr=r)rr$r r r!r0s   z6HTMLTokenizer.scriptDataDoubleEscapedLessThanSignStatecCs|jj}|ttdBkrR|jjtd|d|jjdkrH|j |_ q|j |_ nB|t kr|jjtd|d|j|7_n|jj ||j |_ dS)NrirjrJ)r#r$rT)rirj)rr6rr:r%r7rrrrurrrr r=)rr$r r r!r;s    z,HTMLTokenizer.scriptDataDoubleEscapeEndStatecCs0|jj}|tkr$|jjtdn|tkrJ|jdj|dg|j|_n|dkr\|j n|dkrn|j |_n|dkr|j jt d d d |jdj|dg|j|_n|d kr|j jt d dd |jdjddg|j|_nF|t kr|j jt d dd |j|_n|jdj|dg|j|_dS)NTr$r,rjri'"rHrDr"z#invalid-character-in-attribute-name)r#r$r[zinvalid-codepointu�z#expected-attribute-name-but-got-eof)rrrHrD)rr6rr^r rr7attributeNameStaterrZrqr%rrr)rr$r r r!rpKs6              z&HTMLTokenizer.beforeAttributeNameStatecCs|jj}d}d}|dkr&|j|_n0|tkr^|jddd||jjtd7<d}n|dkrld}n|tkr~|j|_n|dkr|j |_n|d kr|j j t d d d |jdddd 7<d}n|dkr|j j t d dd |jddd|7<d}nH|t kr8|j j t d dd |j|_n|jddd|7<d}|r|jdddjt|jddd<xP|jdddD]:\}}|jddd|kr|j j t d dd PqW|r|jdS)NTFrHr$rrrjrir[r"zinvalid-codepoint)r#r$u�rrrDz#invalid-character-in-attribute-namezeof-in-attribute-namezduplicate-attributerKrK)rrrDrKrKrKrKrKrK)rr6beforeAttributeValueStaterr rr^rafterAttributeNameStaterqr%r7rrrrXr rZ)rr$ZleavingThisStateZ emitTokenrU_r r r!risR             &  z HTMLTokenizer.attributeNameStatecCsF|jj}|tkr$|jjtdn|dkr8|j|_n |dkrJ|jn|tkrp|jdj |dg|j |_n|dkr|j |_n|dkr|j j t dd d |jdj d dg|j |_n|dkr|j j t ddd |jdj |dg|j |_nF|tkr&|j j t ddd |j|_n|jdj |dg|j |_dS)NTrHrjr$r,rir[r"zinvalid-codepoint)r#r$u�rrrDz&invalid-character-after-attribute-namezexpected-end-of-tag-but-got-eof)rrrD)rr6rr^rrrZr rr7rrqr%rrr)rr$r r r!rs:                z%HTMLTokenizer.afterAttributeNameStatecCsj|jj}|tkr$|jjtdnB|dkr8|j|_n.|dkrX|j|_|jj|n|dkrl|j|_n|dkr|j j t ddd|j n|d kr|j j t dd d|j d dd d 7<|j|_n|dkr|j j t ddd|j d dd |7<|j|_nL|tkrD|j j t ddd|j|_n"|j d dd |7<|j|_dS)NTrrCrrjr"z.expected-attribute-value-but-got-right-bracket)r#r$r[zinvalid-codepointr$ru�rHrD`z"equals-in-unquoted-attribute-valuez$expected-attribute-value-but-got-eofrK)rHrDrrKrK)rr6rr^attributeValueDoubleQuotedStaterattributeValueUnQuotedStater=attributeValueSingleQuotedStater%r7rrZrrr)rr$r r r!rs>                 z'HTMLTokenizer.beforeAttributeValueStatecCs|jj}|dkr|j|_n|dkr0|jdn|dkrj|jjtddd|jdd dd 7<nN|t kr|jjtdd d|j |_n&|jdd d||jj d7<d S)NrrCr[r"zinvalid-codepoint)r#r$r$ru�z#eof-in-attribute-value-double-quoteTrKrK)rrCr[) rr6afterAttributeValueStaterrTr%r7rrrrr^)rr$r r r!rs         z-HTMLTokenizer.attributeValueDoubleQuotedStatecCs|jj}|dkr|j|_n|dkr0|jdn|dkrj|jjtddd|jdd dd 7<nN|t kr|jjtdd d|j |_n&|jdd d||jj d7<d S)NrrCr[r"zinvalid-codepoint)r#r$r$ru�z#eof-in-attribute-value-single-quoteTrKrK)rrCr[) rr6rrrTr%r7rrrrr^)rr$r r r!rs         z-HTMLTokenizer.attributeValueSingleQuotedStatecCs|jj}|tkr|j|_n|dkr2|jdn|dkrD|jn|dkr~|jjt dd d |j d dd |7<n|d kr|jjt ddd |j d dd d7<nV|t kr|jjt ddd |j |_n.|j d dd ||jj tdtB7<dS)NrCrjrrrHrDrr"z0unexpected-character-in-unquoted-attribute-value)r#r$r$rr[zinvalid-codepointu�z eof-in-attribute-value-no-quotesT)rrrHrDrrKrKrK)rCrjrrrHrDrr[)rr6rrprrTrZr%r7rrrrr^r:)rr$r r r!rs,           z)HTMLTokenizer.attributeValueUnQuotedStatecCs|jj}|tkr|j|_n|dkr.|jnp|dkr@|j|_n^|tkrt|jj t ddd|jj ||j |_n*|jj t ddd|jj ||j|_dS)Nrjrir"z$unexpected-EOF-after-attribute-value)r#r$z*unexpected-character-after-attribute-valueT) rr6rrprrZrqrr%r7rr=r)rr$r r r!r s"           z&HTMLTokenizer.afterAttributeValueStatecCs|jj}|dkr&d|jd<|jn^|tkrZ|jjtddd|jj||j |_ n*|jjtddd|jj||j |_ dS)NrjTrWr"z#unexpected-EOF-after-solidus-in-tag)r#r$z)unexpected-character-after-solidus-in-tag) rr6rrZrr%r7rr=rrrp)rr$r r r!rq4s          z&HTMLTokenizer.selfClosingStartTagStatecCsD|jjd}|jdd}|jjtd|d|jj|j|_dS)Nrjr[u�Comment)r#r$T) rr^replacer%r7rr6rr)rr$r r r!roFs   zHTMLTokenizer.bogusCommentStatecCs|jjg}|ddkrT|j|jj|ddkrPtddd|_|j|_dSn|ddkrd}x.d&D]&}|j|jj|d'|krjd}PqjW|rtdddddd|_|j|_dSn|d(dkrH|jdk rH|jj j rH|jj j d)j |jj j krHd}x2d*D]*}|j|jj|d+|krd}PqW|rH|j |_dS|jjtdddx|rz|jj|jq`W|j|_dS),Nrr|rr,)r#r$TdDoOr@CtTyYpPeEFZDoctype)r#rUpublicIdsystemIdcorrect[Ar"zexpected-dashes-or-doctyperKrKrK)rrrrr@rrrrrrrrr)rrrrrrrKrKrK)rrrrrrrK)rr6r7rrcommentStartStater doctypeStaterZtreeZ openElements namespaceZdefaultNamespacecdataSectionStater%r=r'ro)rr?matchedexpectedr r r!rlUsR           z(HTMLTokenizer.markupDeclarationOpenStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd d|jj|j|j|_nP|t kr|jjtdd d|jj|j|j|_n|jd|7<|j |_d S) Nr|r[r"zinvalid-codepoint)r#r$r$u�rjzincorrect-commentzeof-in-commentT) rr6commentStartDashStaterr%r7rrrr commentState)rr$r r r!rs(          zHTMLTokenizer.commentStartStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd d|jj|j|j|_nT|t kr|jjtdd d|jj|j|j|_n|jdd|7<|j |_d S) Nr|r[r"zinvalid-codepoint)r#r$r$u-�rjzincorrect-commentzeof-in-commentT) rr6commentEndStaterr%r7rrrrr)rr$r r r!rs(          z#HTMLTokenizer.commentStartDashStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<nT|tkr|jjtddd|jj|j|j |_n|jd||jj d 7<d S) Nr|r[r"zinvalid-codepoint)r#r$r$u�zeof-in-commentT)r|r[) rr6commentEndDashStaterr%r7rrrrr^)rr$r r r!rs        zHTMLTokenizer.commentStatecCs|jj}|dkr|j|_n|dkrV|jjtddd|jdd7<|j|_nT|t kr|jjtddd|jj|j|j |_n|jdd|7<|j|_d S) Nr|r[r"zinvalid-codepoint)r#r$r$u-�zeof-in-comment-end-dashT) rr6rrr%r7rrrrr)rr$r r r!rs         z!HTMLTokenizer.commentEndDashStatecCs,|jj}|dkr*|jj|j|j|_n|dkrd|jjtddd|jdd7<|j|_n|dkr|jjtdd d|j |_n|d kr|jjtdd d|jd|7<nj|t kr|jjtdd d|jj|j|j|_n4|jjtdd d|jdd|7<|j|_dS)Nrjr[r"zinvalid-codepoint)r#r$r$u--�rhz,unexpected-bang-after-double-dash-in-commentr|z,unexpected-dash-after-double-dash-in-commentzeof-in-comment-double-dashzunexpected-char-in-commentz--T) rr6r%r7rrrrrcommentEndBangStater)rr$r r r!rs6               zHTMLTokenizer.commentEndStatecCs|jj}|dkr*|jj|j|j|_n|dkrN|jdd7<|j|_n|dkr|jjtddd|jdd 7<|j |_nT|t kr|jjtdd d|jj|j|j|_n|jdd|7<|j |_d S) Nrjr|r$z--!r[r"zinvalid-codepoint)r#r$u--!�zeof-in-comment-end-bang-stateT) rr6r%r7rrrrrrr)rr$r r r!rs(         z!HTMLTokenizer.commentEndBangStatecCs|jj}|tkr|j|_nj|tkr\|jjtdddd|j d<|jj|j |j |_n*|jjtddd|jj ||j|_dS)Nr"z!expected-doctype-name-but-got-eof)r#r$Frzneed-space-after-doctypeT) rr6rbeforeDoctypeNameStaterrr%r7rrrr=)rr$r r r!r s         zHTMLTokenizer.doctypeStatecCs|jj}|tkrn|dkrT|jjtdddd|jd<|jj|j|j|_n|dkr|jjtdddd |jd <|j |_nR|t kr|jjtdd dd|jd<|jj|j|j|_n||jd <|j |_d S) Nrjr"z+expected-doctype-name-but-got-right-bracket)r#r$Frr[zinvalid-codepointu�rUz!expected-doctype-name-but-got-eofT) rr6rr%r7rrrrdoctypeNameStater)rr$r r r!rs.              z$HTMLTokenizer.beforeDoctypeNameStatecCs|jj}|tkr2|jdjt|jd<|j|_n|dkrh|jdjt|jd<|jj |j|j |_n|dkr|jj t ddd|jdd7<|j |_nh|t kr|jj t dddd |jd <|jdjt|jd<|jj |j|j |_n|jd|7<d S) NrUrjr[r"zinvalid-codepoint)r#r$u�zeof-in-doctype-nameFrT)rr6rrrXr afterDoctypeNameStaterr%r7rrrr)rr$r r r!r6s,          zHTMLTokenizer.doctypeNameStatecCsR|jj}|tkrn8|dkr8|jj|j|j|_n|tkrd|jd<|jj ||jjt ddd|jj|j|j|_n|d!krd }x$d'D]}|jj}||krd}PqW|r|j |_d SnJ|d(krd }x(d.D] }|jj}||krd}PqW|r|j |_d S|jj ||jjt ddd|id d|jd<|j |_d S)/NrjFrr"zeof-in-doctype)r#r$rrTuUbBlLiIr@rsSrrrrrrmMz*expected-space-or-right-bracket-in-doctyper$)r#r$r.)rrrrrrrrrrr@r)rrrrr)rrrrrrrrrrrr)rrrrr)rr6rr%r7rrrrr=rafterDoctypePublicKeywordStateafterDoctypeSystemKeywordStatebogusDoctypeState)rr$rrr r r!rOsT              z#HTMLTokenizer.afterDoctypeNameStatecCs|jj}|tkr|j|_n|d krP|jjtddd|jj||j|_nT|t kr|jjtdddd|j d<|jj|j |j |_n|jj||j|_d S) Nrrr"zunexpected-char-in-doctype)r#r$zeof-in-doctypeFrT)rr) rr6r"beforeDoctypePublicIdentifierStaterr%r7rr=rrr)rr$r r r!rs"           z,HTMLTokenizer.afterDoctypePublicKeywordStatecCs|jj}|tkrn|dkr0d|jd<|j|_n|dkrLd|jd<|j|_n|dkr|jjt dddd |jd <|jj|j|j |_nh|t kr|jjt dd dd |jd <|jj|j|j |_n(|jjt dd dd |jd <|j |_d S)Nrr,rrrjr"zunexpected-end-of-doctype)r#r$Frzeof-in-doctypezunexpected-char-in-doctypeT) rr6rr(doctypePublicIdentifierDoubleQuotedStater(doctypePublicIdentifierSingleQuotedStater%r7rrrr)rr$r r r!rs4                z0HTMLTokenizer.beforeDoctypePublicIdentifierStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6!afterDoctypePublicIdentifierStaterr%r7rrrr)rr$r r r!rs*            z6HTMLTokenizer.doctypePublicIdentifierDoubleQuotedStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6rrr%r7rrrr)rr$r r r!rs*            z6HTMLTokenizer.doctypePublicIdentifierSingleQuotedStatecCs |jj}|tkr|j|_n|dkr<|jj|j|j|_n|dkrn|jjt dddd|jd<|j |_n|dkr|jjt dddd|jd<|j |_nh|t kr|jjt dd dd |jd <|jj|j|j|_n(|jjt dddd |jd <|j |_d S) Nrjrr"zunexpected-char-in-doctype)r#r$r,rrzeof-in-doctypeFrT)rr6r-betweenDoctypePublicAndSystemIdentifiersStaterr%r7rrr(doctypeSystemIdentifierDoubleQuotedState(doctypeSystemIdentifierSingleQuotedStaterr)rr$r r r!rs6                  z/HTMLTokenizer.afterDoctypePublicIdentifierStatecCs|jj}|tkrn|dkr4|jj|j|j|_n|dkrPd|jd<|j|_n|dkrld|jd<|j |_nh|t kr|jjt dddd |jd <|jj|j|j|_n(|jjt dd dd |jd <|j |_d S) Nrjrr,rrr"zeof-in-doctype)r#r$Frzunexpected-char-in-doctypeT) rr6rr%r7rrrrrrrr)rr$r r r!rs.             z;HTMLTokenizer.betweenDoctypePublicAndSystemIdentifiersStatecCs|jj}|tkr|j|_n|d krP|jjtddd|jj||j|_nT|t kr|jjtdddd|j d<|jj|j |j |_n|jj||j|_d S) Nrrr"zunexpected-char-in-doctype)r#r$zeof-in-doctypeFrT)rr) rr6r"beforeDoctypeSystemIdentifierStaterr%r7rr=rrr)rr$r r r!rs"           z,HTMLTokenizer.afterDoctypeSystemKeywordStatecCs|jj}|tkrn|dkr0d|jd<|j|_n|dkrLd|jd<|j|_n|dkr|jjt dddd |jd <|jj|j|j |_nh|t kr|jjt dd dd |jd <|jj|j|j |_n(|jjt dddd |jd <|j |_d S) Nrr,rrrjr"zunexpected-char-in-doctype)r#r$Frzeof-in-doctypeT) rr6rrrrrr%r7rrrr)rr$r r r!r/s4                z0HTMLTokenizer.beforeDoctypeSystemIdentifierStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6!afterDoctypeSystemIdentifierStaterr%r7rrrr)rr$r r r!rLs*            z6HTMLTokenizer.doctypeSystemIdentifierDoubleQuotedStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6rrr%r7rrrr)rr$r r r!rds*            z6HTMLTokenizer.doctypeSystemIdentifierSingleQuotedStatecCs|jj}|tkrn~|dkr4|jj|j|j|_n^|tkrt|jjt dddd|jd<|jj|j|j|_n|jjt ddd|j |_dS) Nrjr"zeof-in-doctype)r#r$Frzunexpected-char-in-doctypeT) rr6rr%r7rrrrrr)rr$r r r!r|s         z/HTMLTokenizer.afterDoctypeSystemIdentifierStatecCsZ|jj}|dkr*|jj|j|j|_n,|tkrV|jj||jj|j|j|_ndS)NrjT) rr6r%r7rrrrr=)rr$r r r!rs    zHTMLTokenizer.bogusDoctypeStatecCsg}xt|j|jjd|j|jjd|jj}|tkr@Pq|ddddkrl|ddd|d<Pq|j|qWdj|}|jd}|dkrx&t|D]}|jjt d d d qW|j dd }|r|jjt d |d |j |_ dS)N]rjrz]]r,r[rr"zinvalid-codepoint)r#r$u�rJTrKrKrrK) r7rr^r6rr9countranger%rrrr)rr$r6Z nullCountrr r r!rs.       zHTMLTokenizer.cdataSectionState)N)NF)N__name__ __module__ __qualname____doc__rr)rBrSrTrZrr\rbr`rdrfrgr]rmrnrarsrtrcrwrxreryr{rzr}rrr~rrrrrrrrrrprrrrrrrrqrorlrrrrrrrrrrrrrrrrrrrrrrr __classcell__r r )rr!rs H P#         6 "-3rN)Z __future__rrrZpip._vendor.sixrr; collectionsrZ constantsrr r r r r rrrrZ _inputstreamrZ_trierrLobjectrr r r r!s       html5lib/__pycache__/_inputstream.cpython-36.pyc000064400000054147152347724720015664 0ustar003 Pf)@sddlmZmZmZddlmZmZddlmZm Z ddl Z ddl Z ddl m Z ddlmZmZmZmZddlmZdd lmZdd lmZydd lmZWnek reZYnXed d eDZedd eDZedd eDZeeddgBZdZej rJedFdkr&ej!ddks*t"e j#eddGe$ddZ%n e j#eZ%e&dddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4g Z'e j#d5Z(iZ)Gd6d7d7e*Z+d8d9Z,Gd:d;d;e*Z-Gdd?d?e/Z0Gd@dAdAe*Z1GdBdCdCe*Z2dDdEZ3dS)H)absolute_importdivisionunicode_literals) text_type binary_type) http_clienturllibN) webencodings)EOFspaceCharacters asciiLettersasciiUppercase)ReparseException)_utils)StringIO)BytesIOcCsg|]}|jdqS)ascii)encode).0itemr"/usr/lib/python3.6/_inputstream.py srcCsg|]}|jdqS)r)r)rrrrrrscCsg|]}|jdqS)r)r)rrrrrrs>.)sumr )r"rrrr(^szBufferedStream._bufferedBytescCs<|jj|}|jj||jdd7<t||jd<|S)Nrr )rr0r appendr!r$)r"r/datarrrr-as   zBufferedStream._readStreamcCs|}g}|jd}|jd}x|t|jkr|dkr|dks@t|j|}|t||krn|}|||g|_n"t||}|t|g|_|d7}|j||||||8}d}qW|r|j|j|dj|S)Nrr )r!r$r r)r2r-join)r"r/ZremainingBytesrvZ bufferIndexZ bufferOffsetZ bufferedDataZ bytesToReadrrrr.hs&     zBufferedStream._readFromBufferN) __name__ __module__ __qualname____doc__r#r'r,r0r(r-r.rrrrr9s  rcKst|tjs(t|tjjr.t|jtjr.d}n&t|drJt|jdt }n t|t }|rdd|D}|rvt d|t |f|St |f|SdS)NFr0rcSsg|]}|jdr|qS)Z _encoding)endswith)rxrrrrsz#HTMLInputStream..z3Cannot set an encoding with a unicode input, set %r) isinstancerZ HTTPResponserZresponseZaddbasefphasattrr0r TypeErrorHTMLUnicodeInputStreamHTMLBinaryInputStream)sourcekwargsZ isUnicodeZ encodingsrrrHTMLInputStreams     rEc@speZdZdZdZddZddZddZd d Zd d Z d dZ dddZ ddZ ddZ dddZddZdS)rAzProvides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. i(cCsZtjsd|_ntddkr$|j|_n|j|_dg|_tddf|_|j ||_ |j dS)aInitialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) Nu􏿿r rzutf-8certain) rsupports_lone_surrogatesreportCharacterErrorsr$characterErrorsUCS4characterErrorsUCS2ZnewLineslookupEncoding charEncoding openStream dataStreamreset)r"rCrrrr#s   zHTMLUnicodeInputStream.__init__cCs.d|_d|_d|_g|_d|_d|_d|_dS)Nr)r& chunkSize chunkOffseterrors prevNumLines prevNumCols_bufferedCharacter)r"rrrrOszHTMLUnicodeInputStream.resetcCst|dr|}nt|}|S)zvProduces a file object from source. source can be either a file object, local filename or a string. r0)r?r)r"rCrrrrrMs z!HTMLUnicodeInputStream.openStreamcCsT|j}|jdd|}|j|}|jdd|}|dkr@|j|}n ||d}||fS)N rr r)r&countrTrfindrU)r"r*r&ZnLinesZ positionLineZ lastLinePosZpositionColumnrrr _positions   z HTMLUnicodeInputStream._positioncCs|j|j\}}|d|fS)z:Returns (line, col) of the current position in the stream.r )rZrR)r"linecolrrrr!szHTMLUnicodeInputStream.positioncCs6|j|jkr|jstS|j}|j|}|d|_|S)zo Read one character from the stream or queue if available. Return EOF when EOF is reached. r )rRrQ readChunkr r&)r"rRcharrrrr^s   zHTMLUnicodeInputStream.charNcCs|dkr|j}|j|j\|_|_d|_d|_d|_|jj|}|j rX|j |}d|_ n|s`dSt |dkrt |d }|dksd|kodknr|d |_ |dd}|j r|j ||j dd }|j d d }||_t ||_d S)NrPrFr iiz rW Trrr)_defaultChunkSizerZrQrTrUr&rRrNr0rVr$ordrHreplace)r"rQr3Zlastvrrrr]s0           z HTMLUnicodeInputStream.readChunkcCs,x&tttj|D]}|jjdqWdS)Nzinvalid-codepoint)ranger$invalid_unicode_refindallrSr2)r"r3_rrrrI%sz*HTMLUnicodeInputStream.characterErrorsUCS4cCsd}xtj|D]}|rqt|j}|j}tj|||drttj|||d}|tkrn|j j dd}q|dkr|dkr|t |dkr|j j dqd}|j j dqWdS)NFzinvalid-codepointTiir ) refinditerrbgroupstartrZisSurrogatePairZsurrogatePairToCodepointnon_bmp_invalid_codepointsrSr2r$)r"r3skipmatchZ codepointr%Zchar_valrrrrJ)s   z*HTMLUnicodeInputStream.characterErrorsUCS2Fc Csyt||f}Wnltk r|x|D]}t|dks&tq&Wdjdd|D}|s^d|}tjd|}t||f<YnXg}x||j|j|j }|dkr|j |j krPn0|j }||j kr|j |j|j |||_ P|j |j|j d|j sPqWdj|} | S)z Returns a string of characters from the stream up to but not including any character in 'characters' or EOF. 'characters' must be a container that supports the 'in' method and iteration over its characters. rPcSsg|]}dt|qS)z\x%02x)rb)rcrrrrNsz5HTMLUnicodeInputStream.charsUntil..z^%sz[%s]+N)charsUntilRegExKeyErrorrbr)r5recompilernr&rRrQendr2r]) r"Z charactersZoppositecharsrpZregexr6mrurrrr charsUntil@s2     z!HTMLUnicodeInputStream.charsUntilcCsT|dk rP|jdkr.||j|_|jd7_n"|jd8_|j|j|ksPtdS)Nrr )rRr&rQr))r"r^rrrungetos   zHTMLUnicodeInputStream.unget)N)F)r7r8r9r:rar#rOrMrZr!r^r]rIrJryrzrrrrrAs   & /rAc@sLeZdZdZdddZddZd d Zdd d Zd dZddZ ddZ dS)rBzProvides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. N windows-1252TcCsn|j||_tj||jd|_d|_||_||_||_||_ ||_ |j ||_ |j ddk sbt |jdS)aInitialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) idrN)rM rawStreamrAr# numBytesMetanumBytesChardetoverride_encodingtransport_encodingsame_origin_parent_encodinglikely_encodingdefault_encodingdetermineEncodingrLr)rO)r"rCrrrrrZ useChardetrrrr#s  zHTMLBinaryInputStream.__init__cCs&|jdjj|jd|_tj|dS)Nrrc)rLZ codec_info streamreaderr}rNrArO)r"rrrrOszHTMLBinaryInputStream.resetc CsDt|dr|}nt|}y|j|jWnt|}YnX|S)zvProduces a file object from source. source can be either a file object, local filename or a string. r0)r?rr,r'r)r"rCrrrrrMs z HTMLBinaryInputStream.openStreamc Cs|jdf}|ddk r|St|jdf}|ddk r:|St|jdf}|ddk rX|S|jdf}|ddk rt|St|jdf}|ddk r|djjd r|St|jdf}|ddk r|S|rtyddl m }Wnt k rYnXg}|}xF|j s>|j j|j}t|ts t|s(P|j||j|qW|jt|jd}|j jd|dk rt|dfSt|jdf}|ddk r|StddfS)NrFrZ tentativezutf-16)UniversalDetectorencodingz windows-1252) detectBOMrKrrdetectEncodingMetarname startswithrZchardet.universaldetectorr ImportErrordoner}r0rr=r/r)r2Zfeedcloseresultr,r)r"ZchardetrLrZbuffersZdetectorr rrrrrsR           z'HTMLBinaryInputStream.determineEncodingcCs|jddkstt|}|dkr&dS|jdkrFtd}|dk stnT||jdkrf|jddf|_n4|jjd|df|_|jtd|jd|fdS) Nr rFutf-16beutf-16lezutf-8rzEncoding changed from %s to %s)rr)rLr)rKrr}r,rOr)r"Z newEncodingrrrchangeEncodings   z$HTMLBinaryInputStream.changeEncodingc Cstjdtjdtjdtjdtjdi}|jjd}t|t s"rBc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e e e Z ddZe eZefddZddZddZddZdS) EncodingByteszString-like object with an associated position and various extra methods If the position is ever greater than the string length then an exception is raisedcCst|tsttj||jS)N)r=r/r)__new__lower)r"valuerrrrLszEncodingBytes.__new__cCs d|_dS)Nr r)rZ)r"rrrrr#PszEncodingBytes.__init__cCs|S)Nr)r"rrr__iter__TszEncodingBytes.__iter__cCs>|jd}|_|t|kr"tn |dkr.t|||dS)Nr r)rZr$ StopIterationr@)r"prrr__next__Ws  zEncodingBytes.__next__cCs|jS)N)r)r"rrrnext_szEncodingBytes.nextcCsB|j}|t|krtn |dkr$t|d|_}|||dS)Nrr )rZr$rr@)r"rrrrpreviouscs zEncodingBytes.previouscCs|jt|krt||_dS)N)rZr$r)r"r!rrr setPositionlszEncodingBytes.setPositioncCs*|jt|krt|jdkr"|jSdSdS)Nr)rZr$r)r"rrr getPositionqs  zEncodingBytes.getPositioncCs||j|jdS)Nr )r!)r"rrrgetCurrentByte{szEncodingBytes.getCurrentBytecCsL|j}x:|t|kr@|||d}||kr6||_|S|d7}qW||_dS)zSkip past a list of charactersr N)r!r$rZ)r"rvrrprrrrms zEncodingBytes.skipcCsL|j}x:|t|kr@|||d}||kr6||_|S|d7}qW||_dS)Nr )r!r$rZ)r"rvrrprrr skipUntils zEncodingBytes.skipUntilcCs>|j}|||t|}|j|}|r:|jt|7_|S)zLook for a sequence of bytes at the start of a string. If the bytes are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone)r!r$r)r"r/rr3r6rrr matchBytess  zEncodingBytes.matchBytescCsR||jdj|}|dkrJ|jdkr,d|_|j|t|d7_dStdS)zLook for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the matchNr rTrr)r!findrZr$r)r"r/Z newPositionrrrjumpTos zEncodingBytes.jumpToN)r7r8r9r:rr#rrrrrrpropertyr!r currentBytespaceCharactersBytesrmrrrrrrrrHs      rc@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dS)rz?Mini parser for detecting character encoding from meta elementscCst||_d|_dS)z3string - the data to work on for encoding detectionN)rr3r)r"r3rrrr#s zEncodingParser.__init__c Csd|jfd|jfd|jfd|jfd|jfd|jff}x^|jD]T}d}xD|D]<\}}|jj|rJy |}PWqJtk rd}PYqJXqJW|s)r3r)r"rrrrszEncodingParser.handleCommentcCs|jjtkrdSd}d}x|j}|dkr.dS|ddkr^|ddk}|r|dk r||_dSq|ddkr|d}t|}|dk r||_dSq|ddkrtt|d}|j}|dk rt|}|dk r|r||_dS|}qWdS) NTFrs http-equivr s content-typescharsetscontent) r3rr getAttributerrKContentAttrParserrparse)r"Z hasPragmaZpendingEncodingattrZtentativeEncodingcodecZ contentParserrrrrs:      zEncodingParser.handleMetacCs |jdS)NF)handlePossibleTag)r"rrrrsz%EncodingParser.handlePossibleStartTagcCst|j|jdS)NT)rr3r)r"rrrrs z#EncodingParser.handlePossibleEndTagcCsf|j}|jtkr(|r$|j|jdS|jt}|dkrD|jn|j}x|dk r`|j}qNWdS)NTr)r3rasciiLettersBytesrrrspacesAngleBracketsr)r"ZendTagr3rprrrrrs     z EncodingParser.handlePossibleTagcCs |jjdS)Nr)r3r)r"rrrrszEncodingParser.handleOthercCs|j}|jttdgB}|dks2t|dks2t|d kr>dSg}g}xt|dkrX|rXPnX|tkrl|j}PnD|d krdj|dfS|tkr|j|j n|dkrdS|j|t |}qHW|dkr|j dj|dfSt ||j}|d krT|}xt |}||kr(t |dj|dj|fS|tkrB|j|j n |j|qWnJ|dkrldj|dfS|tkr|j|j n|dkrdS|j|x^t |}|t krdj|dj|fS|tkr|j|j n|dkrdS|j|qWdS) z_Return a name,value pair for the next attribute in the stream, if one is found, or None/Nr r=r4'")rN)rr)rr) r3rmr frozensetr$r)r5asciiUppercaseBytesr2rrrr)r"r3rpZattrNameZ attrValueZ quoteCharrrrrsh             zEncodingParser.getAttributeN) r7r8r9r:r#rrrrrrrrrrrrrs$rc@seZdZddZddZdS)rcCst|tst||_dS)N)r=r/r)r3)r"r3rrrr#fszContentAttrParser.__init__cCsy|jjd|jjd7_|jj|jjdks8dS|jjd7_|jj|jjdkr|jj}|jjd7_|jj}|jj|r|j||jjSdSnF|jj}y|jjt|j||jjStk r|j|dSXWntk rdSXdS)Nscharsetr rrr)rr)r3rr!rmrrrr)r"Z quoteMarkZ oldPositionrrrrjs.       zContentAttrParser.parseN)r7r8r9r#rrrrrresrcCs`t|tr.y|jd}Wntk r,dSX|dk rXy tj|Stk rTdSXndSdS)z{Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.rN)r=rdecodeUnicodeDecodeErrorr lookupAttributeError)rrrrrKs  rKrr)4Z __future__rrrZpip._vendor.sixrrZpip._vendor.six.movesrrrrsZ pip._vendorr Z constantsr r r rrrPriorrrrrrrrZinvalid_unicode_no_surrogaterGrXr)rtevalresetrlZascii_punctuation_rerqobjectrrErArBr/rrrrKrrrrsX     "          JgIh6'html5lib/__pycache__/html5parser.cpython-36.pyc000064400000277205152347724720015422 0ustar003 Pf @sFddlmZmZmZddlmZmZmZddlZyddl m Z Wn e k r`ddl m Z YnXddl mZddl mZddl mZdd lmZdd l mZdd lmZmZmZmZmZmZmZmZmZmZmZm Z!m"Z"m#Z#m$Z$m%Z%d!ddZ&d"ddZ'ddZ(Gddde)Z*ej+ddZ,ddZ-d#ddZ.Gdd d e/Z0dS)$)absolute_importdivisionunicode_literals)with_metaclassviewkeysPY3N) OrderedDict) _inputstream) _tokenizer) treebuilders)Marker)_utils)spaceCharactersasciiUpper2LowerspecialElementsheadingElements cdataElementsrcdataElements tokenTypes tagTokenTypes namespaceshtmlIntegrationPointElements"mathmlTextIntegrationPointElementsadjustForeignAttributesadjustMathMLAttributesadjustSVGAttributesEReparseExceptionetreeTcKs$tj|}t||d}|j|f|S)z.Parse a string or file-like object into a tree)namespaceHTMLElements)r getTreeBuilder HTMLParserparse)doc treebuilderr kwargstbpr)!/usr/lib/python3.6/html5parser.pyr#s  r#divcKs,tj|}t||d}|j|fd|i|S)N)r container)r r!r" parseFragment)r$r,r%r r&r'r(r)r)r*r-&s  r-csGfdddt}|S)NcseZdZfddZdS)z-method_decorator_metaclass..DecoratedcsBx0|jD]$\}}t|tjr&|}|||<q Wtj||||S)N)items isinstancetypes FunctionTypetype__new__)metaZ classnamebasesZ classDictZ attributeNameZ attribute)functionr)r*r3.s   z5method_decorator_metaclass..Decorated.__new__N)__name__ __module__ __qualname__r3r))r6r)r* Decorated-sr:)r2)r6r:r))r6r*method_decorator_metaclass,sr;c@seZdZdZd+ddZd,dd Zd d Zed d ZddZ ddZ ddZ ddZ ddZ ddZd-ddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*ZdS).r"zZHTML parser. Generates a tree structure from a stream of (possibly malformed) HTMLNFTcsL|_|dkrtjd}||_g_tfddt|jD_dS)a strict - raise an exception when a parse error is encountered tree - a treebuilder class controlling the type of tree that will be returned. Built in treebuilders can be accessed through html5lib.treebuilders.getTreeBuilder(treeType) Nrcs g|]\}}||jfqSr))tree).0namecls)selfr)r* Msz'HTMLParser.__init__..) strictr r!r<errorsdict getPhasesr.phases)r@r<rBr debugr))r@r*__init__<s    zHTMLParser.__init__r+c Ksh||_||_||_tj|fd|i||_|jy |jWn$tk rb|j|jYnXdS)Nparser) innerHTMLModer, scriptingr Z HTMLTokenizer tokenizerresetmainLoopr)r@stream innerHTMLr,rKr&r)r)r*_parsePs zHTMLParser._parsecCs|jjd|_g|_g|_d|_|jr|jj|_ |j t krL|j j |j _ n0|j tkrd|j j|j _ n|j dkr||j j|j _ n|jd|_|jj|jnd|_ |jd|_d|_d|_d|_dS)NFz no quirks plaintext beforeHtmlinitialT)r<rM firstStartTagrClog compatModerJr,lowerrPrrL rcdataStatestater rawtextStateplaintextStaterFphaseinsertHtmlElementresetInsertionModeZ lastPhaseZbeforeRCDataPhase framesetOK)r@r)r)r*rM^s*         zHTMLParser.resetcCst|dsdS|jjjdjS)zThe name of the character encoding that was used to decode the input stream, or :obj:`None` if that is not determined yet. rLNr)hasattrrLrO charEncodingr>)r@r)r)r*documentEncodings zHTMLParser.documentEncodingcCsJ|jdkr6|jtdkr6d|jko4|jdjtdkS|j|jftkSdS)Nzannotation-xmlmathmlencoding text/htmlapplication/xhtml+xml)rfrg)r> namespacer attributes translaterr)r@elementr)r)r*isHTMLIntegrationPoints   z!HTMLParser.isHTMLIntegrationPointcCs|j|jftkS)N)rhr>r)r@rkr)r)r*isMathMLTextIntegrationPointsz'HTMLParser.isMathMLTextIntegrationPointcCsztd}td}td}td}td}td}td}x|jD]}d} |} x| dk r| } |jjrx|jjdnd} | r| jnd} | r| jnd} | d }||kr|j| d | jd id} qVt|jjd ksl| |jj ksl|j | r ||kr|d t ddgksl|||fksl| t dkrP| dkrP||krP|d dksl|j | rt||||fkrt|j}n |jd}||kr|j| } qV||kr|j| } qV||kr|j| } qV||kr|j| } qV||kr|j| } qV||krV|j| } qVW||krD| drD| d rD|jdd | d iqDWd}g}x8|rt|j|j|jj}|r>|j|ks>tq>WdS)N CharactersZSpaceCharactersStartTagEndTagCommentZDoctype ParseErrorr r2datadatavarsrr>ZmglyphZ malignmarkrdzannotation-xmlsvginForeignContent selfClosingselfClosingAcknowledgedz&non-void-element-with-trailing-solidusT)rnormalizedTokensr< openElementsrhr> parseErrorgetlendefaultNamespacerm frozensetrrlr]rFprocessCharactersprocessSpaceCharactersprocessStartTag processEndTagprocessCommentprocessDoctypeappend processEOFAssertionError)r@ZCharactersTokenZSpaceCharactersTokenZ StartTagTokenZ EndTagTokenZ CommentTokenZ DoctypeTokenZParseErrorTokentokenZ prev_token new_token currentNodeZcurrentNodeNamespaceZcurrentNodeNamer2r]Z reprocessrFr)r)r*rNsp                   zHTMLParser.mainLoopccs x|jD]}|j|VqWdS)N)rLnormalizeToken)r@rr)r)r*rzs zHTMLParser.normalizedTokenscOs |j|ddf|||jjS)aParse a HTML document into a well-formed tree stream - a filelike object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) scripting - treat noscript elements as if javascript was turned on FN)rQr<Z getDocument)r@rOargsr&r)r)r*r#s zHTMLParser.parsecOs|j|df|||jjS)a2Parse a HTML fragment into a well-formed tree fragment container - name of the element we're setting the innerHTML property if set to None, default to 'div' stream - a filelike object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) scripting - treat noscript elements as if javascript was turned on T)rQr<Z getFragment)r@rOrr&r)r)r*r-szHTMLParser.parseFragmentXXX-undefined-errorcCs@|dkr i}|jj|jjj||f|jrrPrrhrrFr])r@ZlastZnewModesnodeZnodeNameZ new_phaser)r)r*r_!sB   zHTMLParser.resetInsertionModecCsR|dks t|jj||dkr.|jj|j_n |jj|j_|j|_|j d|_dS)zYGeneric RCDATA/RAWTEXT Parsing algorithm contentType - RCDATA or RAWTEXT RAWTEXTRCDATAtextN)rr) rr< insertElementrLr[rZrYr] originalPhaserF)r@rZ contentTyper)r)r*parseRCDataRawtextMs   zHTMLParser.parseRCDataRawtext)NFTF)Fr+F)rN)r7r8r9__doc__rHrQrMpropertyrcrlrmrNrzr#r-r|rrrrrr_rr)r)r)r*r"8s&  "  C  ,r"cs"dd}dd}Gdddt|||Gddd}Gd d d }Gfd d d }Gfd dd}Gfddd}Gfddd}Gfddd} Gfddd} Gfddd} Gfddd} Gfddd} Gfddd}Gfdd d }Gfd!d"d"}Gfd#d$d$}Gfd%d&d&}Gfd'd(d(}Gfd)d*d*}Gfd+d,d,}Gfd-d.d.}Gfd/d0d0}Gfd1d2d2}Gfd3d4d4}||||||| | | | | ||||||||||||d5S)6Ncs(tddtjDfdd}|S)z4Logger that records which phase processes each tokencss|]\}}||fVqdS)Nr))r=keyvaluer)r)r* csz)getPhases..log..c sjjdrt|dkr|d}yd|di}WnYnX|dtkr\|d|d<|jjj|jjjj|jj j j|j jj|f|f||S|f||SdS)NZprocessrr2r>) r7 startswithr~rrIrVrrLrZr] __class__)r@rr&rinfo)r6 type_namesr)r*wrappedfs   z'getPhases..log..wrapped)rDrr.)r6rr))r6rr*rVaszgetPhases..logcSs|r t|StSdS)N)r;r2)Z use_metaclassZmetaclass_funcr)r)r* getMetaclasszszgetPhases..getMetaclassc@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dS)zgetPhases..PhasezNBase class for helper object that implements each phase of processing cSs||_||_dS)N)rIr<)r@rIr<r)r)r*rHsz!getPhases..Phase.__init__cSstdS)N)NotImplementedError)r@r)r)r*rsz#getPhases..Phase.processEOFcSs|jj||jjddS)Nr ry)r< insertCommentr{)r@rr)r)r*rsz'getPhases..Phase.processCommentcSs|jjddS)Nzunexpected-doctype)rIr|)r@rr)r)r*rsz'getPhases..Phase.processDoctypecSs|jj|ddS)Nrs)r< insertText)r@rr)r)r*rsz*getPhases..Phase.processCharacterscSs|jj|ddS)Nrs)r<r)r@rr)r)r*rsz/getPhases..Phase.processSpaceCharacterscSs|j|d|S)Nr>)startTagHandler)r@rr)r)r*rsz(getPhases..Phase.processStartTagcSsl|jj r"|ddkr"|jjdx<|djD],\}}||jjdjkr0||jjdj|<q0Wd|j_dS)Nr>rz non-html-rootrsrF)rIrUr|r.r<r{ri)r@rattrrr)r)r* startTagHtmls  z%getPhases..Phase.startTagHtmlcSs|j|d|S)Nr>) endTagHandler)r@rr)r)r*rsz&getPhases..Phase.processEndTagN) r7r8r9rrHrrrrrrrrr)r)r)r*Phases rc@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS)zgetPhases..InitialPhasecSsdS)Nr))r@rr)r)r*rsz6getPhases..InitialPhase.processSpaceCharacterscSs|jj||jjdS)N)r<rdocument)r@rr)r)r*rsz.getPhases..InitialPhase.processCommentc8Ss|d}|d}|d}|d}|dks@|dk s@|dk rL|dkrL|jjd|dkrXd}|jj||dkrv|jt}| s|ddks|jdJs|dKks|jdLr|dks|r|jdDkrdE|j_n*|jdMs|jdNr|dk rdH|j_|jj dI|j_ dS)ONr>publicIdsystemIdcorrectrzabout:legacy-compatzunknown-doctype*+//silmaril//dtd html pro v0r11 19970101//4-//advasoft ltd//dtd html 3.0 aswedit + extensions//*-//as//dtd html 3.0 aswedit + extensions//-//ietf//dtd html 2.0 level 1//-//ietf//dtd html 2.0 level 2//&-//ietf//dtd html 2.0 strict level 1//&-//ietf//dtd html 2.0 strict level 2//-//ietf//dtd html 2.0 strict//-//ietf//dtd html 2.0//-//ietf//dtd html 2.1e//-//ietf//dtd html 3.0//-//ietf//dtd html 3.2 final//-//ietf//dtd html 3.2//-//ietf//dtd html 3//-//ietf//dtd html level 0//-//ietf//dtd html level 1//-//ietf//dtd html level 2//-//ietf//dtd html level 3//"-//ietf//dtd html strict level 0//"-//ietf//dtd html strict level 1//"-//ietf//dtd html strict level 2//"-//ietf//dtd html strict level 3//-//ietf//dtd html strict//-//ietf//dtd html//(-//metrius//dtd metrius presentational//5-//microsoft//dtd internet explorer 2.0 html strict//.-//microsoft//dtd internet explorer 2.0 html//0-//microsoft//dtd internet explorer 2.0 tables//5-//microsoft//dtd internet explorer 3.0 html strict//.-//microsoft//dtd internet explorer 3.0 html//0-//microsoft//dtd internet explorer 3.0 tables//#-//netscape comm. corp.//dtd html//*-//netscape comm. corp.//dtd strict html//*-//o'reilly and associates//dtd html 2.0//3-//o'reilly and associates//dtd html extended 1.0//;-//o'reilly and associates//dtd html extended relaxed 1.0//N-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//E-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//$-//spyglass//dtd html 2.0 extended//+-//sq//dtd html 2.0 hotmetal + extensions//--//sun microsystems corp.//dtd hotjava html//4-//sun microsystems corp.//dtd hotjava strict html//-//w3c//dtd html 3 1995-03-24//-//w3c//dtd html 3.2 draft//-//w3c//dtd html 3.2 final//-//w3c//dtd html 3.2//-//w3c//dtd html 3.2s draft//-//w3c//dtd html 4.0 frameset//#-//w3c//dtd html 4.0 transitional//(-//w3c//dtd html experimental 19960712//&-//w3c//dtd html experimental 970421//-//w3c//dtd w3 html//-//w3o//dtd w3 html 3.0//#-//webtechs//dtd mozilla html 2.0//-//webtechs//dtd mozilla html//$-//w3o//dtd w3 html strict 3.0//en//"-/w3c/dtd html 4.0 transitional/en -//w3c//dtd html 4.01 frameset//$-//w3c//dtd html 4.01 transitional//z:http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtdquirks -//w3c//dtd xhtml 1.0 frameset//$-//w3c//dtd xhtml 1.0 transitional//zlimited quirksrS)7rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrr)rr)r r )rr) rIr|r<Z insertDoctyperjrrrXrWrFr])r@rr>rrrr)r)r*rs      z.getPhases..InitialPhase.processDoctypecSsd|j_|jjd|j_dS)NrrS)rIrWrFr])r@r)r)r* anythingElsesz,getPhases..InitialPhase.anythingElsecSs|jjd|j|S)Nzexpected-doctype-but-got-chars)rIr|r )r@rr)r)r*rs z1getPhases..InitialPhase.processCharacterscSs"|jjdd|di|j|S)Nz"expected-doctype-but-got-start-tagr>)rIr|r )r@rr)r)r*rsz/getPhases..InitialPhase.processStartTagcSs"|jjdd|di|j|S)Nz expected-doctype-but-got-end-tagr>)rIr|r )r@rr)r)r*rsz-getPhases..InitialPhase.processEndTagcSs|jjd|jdS)Nzexpected-doctype-but-got-eofT)rIr|r )r@r)r)r*r%s z*getPhases..InitialPhase.processEOFN) r7r8r9rrrr rrrrr)r)r)r* InitialPhases_r c@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)z"getPhases..BeforeHtmlPhasecSs&|jjtdd|jjd|j_dS)Nrror)r<Z insertRootimpliedTagTokenrIrFr])r@r)r)r*r^,sz4getPhases..BeforeHtmlPhase.insertHtmlElementcSs |jdS)NT)r^)r@r)r)r*r1sz-getPhases..BeforeHtmlPhase.processEOFcSs|jj||jjdS)N)r<rr)r@rr)r)r*r5sz1getPhases..BeforeHtmlPhase.processCommentcSsdS)Nr))r@rr)r)r*r8sz9getPhases..BeforeHtmlPhase.processSpaceCharacterscSs |j|S)N)r^)r@rr)r)r*r;sz4getPhases..BeforeHtmlPhase.processCharacterscSs |ddkrd|j_|j|S)Nr>rT)rIrUr^)r@rr)r)r*r?s z2getPhases..BeforeHtmlPhase.processStartTagcSs4|ddkr$|jjdd|din |j|SdS)Nr>rrrbrzunexpected-end-tag-before-html)rrrr)rIr|r^)r@rr)r)r*rEs  z0getPhases..BeforeHtmlPhase.processEndTagN) r7r8r9r^rrrrrrr)r)r)r*BeforeHtmlPhase*srcsXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z"getPhases..BeforeHeadPhasecsVj|||tjd|jfd|jfg|_|j|j_tjd|jfg|_ |j |j _dS)Nrrrr)rrrr) rHrMethodDispatcherr startTagHeadr startTagOtherdefaultendTagImplyHeadr endTagOther)r@rIr<)rr)r*rHNs z+getPhases..BeforeHeadPhase.__init__cSs|jtdddS)NrroT)rr )r@r)r)r*r\sz-getPhases..BeforeHeadPhase.processEOFcSsdS)Nr))r@rr)r)r*r`sz9getPhases..BeforeHeadPhase.processSpaceCharacterscSs|jtdd|S)Nrro)rr )r@rr)r)r*rcsz4getPhases..BeforeHeadPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rgsz/getPhases..BeforeHeadPhase.startTagHtmlcSs0|jj||jjd|j_|jjd|j_dS)Nr inHeadry)r<rr{ headPointerrIrFr])r@rr)r)r*rjs z/getPhases..BeforeHeadPhase.startTagHeadcSs|jtdd|S)Nrro)rr )r@rr)r)r*rosz0getPhases..BeforeHeadPhase.startTagOthercSs|jtdd|S)Nrro)rr )r@rr)r)r*rssz2getPhases..BeforeHeadPhase.endTagImplyHeadcSs|jjdd|didS)Nzend-tag-after-implied-rootr>)rIr|)r@rr)r)r*rwsz.getPhases..BeforeHeadPhase.endTagOtherN) r7r8r9rHrrrrrrrrr))rr)r*BeforeHeadPhaseMs rcseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!S)"zgetPhases..InHeadPhasec sj|||tjd|jfd|jfd|jfd|jfd|jfd|jfd |j fd |j fg|_ |j |j _ tjd |jfd|jfg|_|j|j_ dS)Nrtitlenoframesstylenoscriptscriptbasebasefontbgsoundcommandlinkr4rrr)rr)rrr r!r")rrr)rHrrr startTagTitlestartTagNoFramesStylestartTagNoscriptstartTagScriptstartTagBaseLinkCommand startTagMetarrrr endTagHeadendTagHtmlBodyBrrr)r@rIr<)rr)r*rH|s  z'getPhases..InHeadPhase.__init__cSs |jdS)NT)r )r@r)r)r*rsz)getPhases..InHeadPhase.processEOFcSs |j|S)N)r )r@rr)r)r*rsz0getPhases..InHeadPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz+getPhases..InHeadPhase.startTagHtmlcSs|jjddS)Nz!two-heads-are-not-better-than-one)rIr|)r@rr)r)r*rsz+getPhases..InHeadPhase.startTagHeadcSs$|jj||jjjd|d<dS)NTrx)r<rr{pop)r@rr)r)r*r's  z6getPhases..InHeadPhase.startTagBaseLinkCommandcSs|jj||jjjd|d<|d}|jjjjddkrd|krZ|jjjj|dnVd|krd|kr|dj d krt j |dj d }t j |}|j}|jjjj|dS) NTrxrsr Z tentativecharsetZcontentz http-equivz content-typezutf-8)r<rr{r+rIrLrOrbZchangeEncodingrXr Z EncodingBytesencodeZContentAttrParserr#)r@rrirsrIcodecr)r)r*r(s   z+getPhases..InHeadPhase.startTagMetacSs|jj|ddS)Nr)rIr)r@rr)r)r*r#sz,getPhases..InHeadPhase.startTagTitlecSs|jj|ddS)Nr)rIr)r@rr)r)r*r$sz4getPhases..InHeadPhase.startTagNoFramesStylecSs8|jjr|jj|dn|jj||jjd|j_dS)NrinHeadNoscript)rIrKrr<rrFr])r@rr)r)r*r%s z/getPhases..InHeadPhase.startTagNoscriptcSs<|jj||jjj|jj_|jj|j_|jjd|j_dS)Nr) r<rrIrLZscriptDataStaterZr]rrF)r@rr)r)r*r&s  z-getPhases..InHeadPhase.startTagScriptcSs |j|S)N)r )r@rr)r)r*rsz,getPhases..InHeadPhase.startTagOthercSs:|jjjj}|jdks&td|j|jjd|j_dS)NrzExpected head got %s afterHead)rIr<r{r+r>rrFr])r@rrr)r)r*r)sz)getPhases..InHeadPhase.endTagHeadcSs |j|S)N)r )r@rr)r)r*r*sz/getPhases..InHeadPhase.endTagHtmlBodyBrcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz*getPhases..InHeadPhase.endTagOthercSs|jtddS)Nr)r)r )r@r)r)r*r sz+getPhases..InHeadPhase.anythingElseN)r7r8r9rHrrrrr'r(r#r$r%r&rr)r*rr r))rr)r* InHeadPhase{s  r1csxeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS)z&getPhases..InHeadNoscriptPhasecsfj|||tjd|jfd |jfd |jfg|_|j|j_tjd |j fd |j fg|_ |j |j _dS) Nrrr r"r4rrrrr)rr r"r4rr)rr) rHrrrr'startTagHeadNoscriptrrrendTagNoscriptendTagBrrr)r@rIr<)rr)r*rHs z/getPhases..InHeadNoscriptPhase.__init__cSs|jjd|jdS)Nzeof-in-head-noscriptT)rIr|r )r@r)r)r*rs z1getPhases..InHeadNoscriptPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz5getPhases..InHeadNoscriptPhase.processCommentcSs|jjd|j|S)Nzchar-in-head-noscript)rIr|r )r@rr)r)r*rs z8getPhases..InHeadNoscriptPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz=getPhases..InHeadNoscriptPhase.processSpaceCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz3getPhases..InHeadNoscriptPhase.startTagHtmlcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r'sz>getPhases..InHeadNoscriptPhase.startTagBaseLinkCommandcSs|jjdd|didS)Nzunexpected-start-tagr>)rIr|)r@rr)r)r*r2 sz;getPhases..InHeadNoscriptPhase.startTagHeadNoscriptcSs"|jjdd|di|j|S)Nzunexpected-inhead-noscript-tagr>)rIr|r )r@rr)r)r*r sz4getPhases..InHeadNoscriptPhase.startTagOthercSs:|jjjj}|jdks&td|j|jjd|j_dS)NrzExpected noscript got %sr)rIr<r{r+r>rrFr])r@rrr)r)r*r3sz5getPhases..InHeadNoscriptPhase.endTagNoscriptcSs"|jjdd|di|j|S)Nzunexpected-inhead-noscript-tagr>)rIr|r )r@rr)r)r*r4sz/getPhases..InHeadNoscriptPhase.endTagBrcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz2getPhases..InHeadNoscriptPhase.endTagOthercSs|jtddS)Nr)r3r )r@r)r)r*r sz3getPhases..InHeadNoscriptPhase.anythingElseN)r7r8r9rHrrrrrr'r2rr3r4rr r))rr)r*InHeadNoscriptPhases r5cspeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS)z!getPhases..AfterHeadPhasec snj|||tjd|jfd|jfd|jfd|jfd |jfg|_|j |j_ tjd|j fg|_ |j |j _ dS)Nrrrrrr r"r4rrrrrr) rrr r"r4rrrr)rrr)rHrrr startTagBodystartTagFramesetstartTagFromHeadrrrrr*rr)r@rIr<)rr)r*rH#s z*getPhases..AfterHeadPhase.__init__cSs |jdS)NT)r )r@r)r)r*r4sz,getPhases..AfterHeadPhase.processEOFcSs |j|S)N)r )r@rr)r)r*r8sz3getPhases..AfterHeadPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r<sz.getPhases..AfterHeadPhase.startTagHtmlcSs(d|j_|jj||jjd|j_dS)NFr)rIr`r<rrFr])r@rr)r)r*r6?s z.getPhases..AfterHeadPhase.startTagBodycSs |jj||jjd|j_dS)Nr)r<rrIrFr])r@rr)r)r*r7Ds z2getPhases..AfterHeadPhase.startTagFramesetcSst|jjdd|di|jjj|jj|jjdj|x4|jjdddD]}|jdkrN|jjj |PqNWdS)Nz#unexpected-start-tag-out-of-my-headr>rr rry) rIr|r<r{rrrFrr>remove)r@rrr)r)r*r8Hs z2getPhases..AfterHeadPhase.startTagFromHeadcSs|jjdd|didS)Nzunexpected-start-tagr>)rIr|)r@rr)r)r*rRsz.getPhases..AfterHeadPhase.startTagHeadcSs |j|S)N)r )r@rr)r)r*rUsz/getPhases..AfterHeadPhase.startTagOthercSs |j|S)N)r )r@rr)r)r*r*Ysz2getPhases..AfterHeadPhase.endTagHtmlBodyBrcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*r]sz-getPhases..AfterHeadPhase.endTagOthercSs.|jjtdd|jjd|j_d|j_dS)NrrorT)r<rr rIrFr]r`)r@r)r)r*r `sz.getPhases..AfterHeadPhase.anythingElseN)r7r8r9rHrrrr6r7r8rrr*rr r))rr)r*AfterHeadPhase"s  r:cseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dSdTZ,dUdVZ-dWdXZ.dYdZZ/d[d\Z0d]d^Z1d_d`Z2dadbZ3dcddZ4dedfZ5dgS)hzgetPhases..InBodyPhasec,sj||||j|_tjd|jfdd|jfd |jfd |jfde|j ft |j fdf|j fd&|j fdg|jfd*|jfd+|jfdh|jfd8|jfd9|jfdi|jfd=|jfd>|jfdj|jfdk|jfdH|jfdI|jfdJ|jfdK|jfdL|jfdM|jfdN|jfdl|j fdQ|j!fdm|j"fdn|j#fdV|j$fdW|j%fdo|j&fg!|_'|j(|j'_)tjd |j*fd|j+fdp|j,fd&|j-fd |j.fdq|j/ft |j0fdr|j1fds|j2fd@|j3fg |_4|j5|j4_)dS)tNrrrr r!r"r4rrrrraddressarticleaside blockquotecenterdetailsdirr+dlfieldset figcaptionfigurefooterheaderhgroupmainmenunavolr(sectionsummaryulprelistingformlidddtrRabbigcodeemfontissmallstrikestrongttunobrbuttonappletmarqueeobjectZxmprarearembedimgkeygenwbrparamsourcetrackinputhrimageisindextextareaZiframernoembedrrrprtoptionoptgroupZmathrurcolrframerrrrrrrdialog) rrr r!r"r4rrr)r;r<r=r>r?r@rAr+rBrCrDrErFrGrHrIrJrKrLr(rMrNrO)rPrQ)rSrTrU) rWrXrYrZr[r\r]r^r_r`rarb)rerfrg)rhrrirjrkrl)rmrnro)rur)rvrw)rxry) rrzrr{rrrrrrr)r;r<r=r>rdr?r@r|rAr+rBrCrDrErFrGrHrQrIrJrKrLrPrMrNrO)rTrUrS)rVrWrXrYrZr[r\rcr]r^r_r`rarb)rerfrg)6rHprocessSpaceCharactersNonPrerrrrstartTagProcessInHeadr6r7startTagClosePrstartTagHeadingstartTagPreListing startTagFormstartTagListItemstartTagPlaintext startTagAstartTagFormatting startTagNobrstartTagButtonstartTagAppletMarqueeObject startTagXmp startTagTablestartTagVoidFormattingstartTagParamSource startTagInput startTagHr startTagImagestartTagIsIndexstartTagTextareastartTagIFramer%startTagRawtextstartTagSelect startTagRpRt startTagOpt startTagMath startTagSvgstartTagMisplacedrrr endTagBody endTagHtml endTagBlock endTagFormendTagPendTagListItem endTagHeadingendTagFormattingendTagAppletMarqueeObjectr4rr)r@rIr<)rr)r*rHhs~ z'getPhases..InBodyPhase.__init__cSs$|j|jko"|j|jko"|j|jkS)N)r>rhri)r@Znode1Znode2r)r)r*isMatchingFormattingElements  z:getPhases..InBodyPhase.isMatchingFormattingElementcSs|jj||jjd}g}x<|jjdddD]&}|tkr@Pq0|j||r0|j|q0Wt|dksjtt|dkr|jjj |d|jjj|dS)Nr ryryry) r<rr{activeFormattingElementsr rrr~rr9)r@rrkZmatchingElementsrr)r)r*addFormattingElements    z3getPhases..InBodyPhase.addFormattingElementc Ss@td}x2|jjdddD]}|j|kr|jjdPqWdS)NrTrUrSr(rrrrrrrrr z expected-closing-tag-but-got-eof) rTrUrSr(rrrrrrrrry)rr<r{r>rIr|)r@Zallowed_elementsrr)r)r*rs  z)getPhases..InBodyPhase.processEOFcSsh|d}|j|_|jdrJ|jjdjdkrJ|jjd j rJ|dd}|rd|jj|jj|dS) Nrs r rPrQrtry)rPrQrtry) r}rrr<r{r>Z hasContent#reconstructActiveFormattingElementsr)r@rrsr)r)r*!processSpaceCharactersDropNewlines   z@getPhases..InBodyPhase.processSpaceCharactersDropNewlinecSsT|ddkrdS|jj|jj|d|jjrPtdd|dDrPd|j_dS)NrscSsg|] }|tkqSr))r)r=charr)r)r*rAszDgetPhases..InBodyPhase.processCharacters..F)r<rrrIr`any)r@rr)r)r*rs  z0getPhases..InBodyPhase.processCharacterscSs|jj|jj|ddS)Nrs)r<rr)r@rr)r)r*r}s z;getPhases..InBodyPhase.processSpaceCharactersNonPrecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r~sz4getPhases..InBodyPhase.startTagProcessInHeadcSs|jjdddit|jjdks4|jjdjdkrB|jjstnFd|j_x<|dj D],\}}||jjdj krX||jjdj |<qXWdS)Nzunexpected-start-tagr>rr Frs) rIr|r~r<r{r>rPrr`r.ri)r@rrrr)r)r*r6sz+getPhases..InBodyPhase.startTagBodycSs|jjdddit|jjdks4|jjdjdkrB|jjstnt|jjsLnj|jjdj rv|jjdj j |jjdx"|jjdjdkr|jjj qxW|jj ||jj d|j_dS) Nzunexpected-start-tagr>rr rrrry)rIr|r~r<r{r>rPrr`parent removeChildr+rrFr])r@rr)r)r*r7s" z/getPhases..InBodyPhase.startTagFramesetcSs.|jjdddr|jtd|jj|dS)Nr(rd)variant)r<elementInScoperr r)r@rr)r)r*r sz-getPhases..InBodyPhase.startTagClosePcSs>|jjdddr|jtd|jj|d|j_|j|_dS)Nr(rd)rF) r<rrr rrIr`rr)r@rr)r)r*rs  z1getPhases..InBodyPhase.startTagPreListingcSsZ|jjr|jjdddin:|jjdddr:|jtd|jj||jjd|j_dS) Nzunexpected-start-tagr>rRr(rd)rr ry) r< formPointerrIr|rrr rr{)r@rr)r)r*rs  z+getPhases..InBodyPhase.startTagFormcSsd|j_dgddgddgd}||d}xLt|jjD]<}|j|kr^|jjjt|jdP|j t kr8|jd kr8Pq8W|jj d d d r|jjjtd d|jj |dS)NFrSrUrT)rSrUrTr>rpr;r+r(rd)r)r;r+r() rIr`reversedr<r{r>r]rr  nameTuplerrr)r@rZ stopNamesMapZ stopNamesrr)r)r*rs"      z/getPhases..InBodyPhase.startTagListItemcSs>|jjdddr|jtd|jj||jjj|jj_dS)Nr(rd)r) r<rrr rrIrLr\rZ)r@rr)r)r*r4s z0getPhases..InBodyPhase.startTagPlaintextcSsb|jjdddr|jtd|jjdjtkrR|jjdd|di|jjj |jj |dS)Nr(rd)rr zunexpected-start-tagr>ry) r<rrr r{r>rrIr|r+r)r@rr)r)r*r:s  z.getPhases..InBodyPhase.startTagHeadingcSs~|jjd}|rf|jjdddd|jtd||jjkrL|jjj|||jjkrf|jjj||jj |j |dS)NrVz$unexpected-start-tag-implies-end-tag) startNameendName) r<!elementInActiveFormattingElementsrIr|rr r{r9rrr)r@rZ afeAElementr)r)r*rBs     z(getPhases..InBodyPhase.startTagAcSs|jj|j|dS)N)r<rr)r@rr)r)r*rOs z1getPhases..InBodyPhase.startTagFormattingcSsP|jj|jjdrB|jjdddd|jtd|jj|j|dS)Nrcz$unexpected-start-tag-implies-end-tag)rr)r<rrrIr|rr r)r@rr)r)r*rSs    z+getPhases..InBodyPhase.startTagNobrcSsT|jjdr2|jjdddd|jtd|S|jj|jj|d|j_dS)Nrdz$unexpected-start-tag-implies-end-tag)rrF) r<rrIr|rr rrr`)r@rr)r)r*r]s    z-getPhases..InBodyPhase.startTagButtoncSs0|jj|jj||jjjtd|j_dS)NF)r<rrrrr rIr`)r@rr)r)r*rhs  z:getPhases..InBodyPhase.startTagAppletMarqueeObjectcSsB|jjdddr|jtd|jjd|j_|jj|ddS)Nr(rd)rFr)r<rrr rrIr`r)r@rr)r)r*rns  z*getPhases..InBodyPhase.startTagXmpcSsR|jjdkr*|jjdddr*|jtd|jj|d|j_|jjd|j_ dS)Nrr(rd)rFr) rIrWr<rrr rr`rFr])r@rr)r)r*rus   z,getPhases..InBodyPhase.startTagTablecSs6|jj|jj||jjjd|d<d|j_dS)NTrxF)r<rrr{r+rIr`)r@rr)r)r*r}s    z5getPhases..InBodyPhase.startTagVoidFormattingcSs@|jj}|j|d|dkr<|ddjtdkr<||j_dS)Nr2rshidden)rIr`rrjr)r@rr`r)r)r*rs   z,getPhases..InBodyPhase.startTagInputcSs$|jj||jjjd|d<dS)NTrx)r<rr{r+)r@rr)r)r*rs  z2getPhases..InBodyPhase.startTagParamSourcecSsJ|jjdddr|jtd|jj||jjjd|d<d|j_dS)Nr(rd)rTrxF) r<rrr rr{r+rIr`)r@rr)r)r*rs   z)getPhases..InBodyPhase.startTagHrcSs6|jjdddd|jtdd|d|dddS) Nzunexpected-start-tag-treated-asrrrj) originalNamenewNamerorsrw)rirw)rIr|rr )r@rr)r)r*rs   z,getPhases..InBodyPhase.startTagImagecSs|jjdddi|jjrdSi}d|dkr>|dd|d<|jtdd|d|jtd d|jtd dd |dkr|dd }nd }|jtd |d|dj}d|kr|d=d |kr|d =d|d<|jtdd||dd|j td |jtd d|j tddS)Nzdeprecated-tagr>rsactionrsrRro)rirqZlabelpromptz3This is a searchable index. Enter search keywords: rn)r2rsrprw)rirw) rIr|r<rrr rrcopyr)r@rZ form_attrsrrir)r)r*rs6      z.getPhases..InBodyPhase.startTagIsIndexcSs0|jj||jjj|jj_|j|_d|j_dS)NF) r<rrIrLrYrZrrr`)r@rr)r)r*rs z/getPhases..InBodyPhase.startTagTextareacSsd|j_|j|dS)NF)rIr`r)r@rr)r)r*rsz-getPhases..InBodyPhase.startTagIFramecSs"|jjr|j|n |j|dS)N)rIrKrr)r@rr)r)r*r%s z/getPhases..InBodyPhase.startTagNoscriptcSs|jj|ddS)z8iframe, noembed noframes, noscript(if scripting enabled)rN)rIr)r@rr)r)r*rsz.getPhases..InBodyPhase.startTagRawtextcSs@|jjdjdkr$|jjjtd|jj|jjj|dS)Nr rxry) r<r{r>rIr]rr rr)r@rr)r)r*rs z*getPhases..InBodyPhase.startTagOptcSs|jj|jj|d|j_|jj|jjd|jjd|jjd|jjd|jjd|jjdfkrx|jjd|j_n|jjd |j_dS) NFrrrrrrinSelectInTabler)r<rrrIr`r]rF)r@rr)r)r*rs      z-getPhases..InBodyPhase.startTagSelectcSsB|jjdr2|jj|jjdjdkr2|jj|jj|dS)Nrubyr ry)r<rgenerateImpliedEndTagsr{r>rIr|r)r@rr)r)r*rs    z+getPhases..InBodyPhase.startTagRpRtcSsZ|jj|jj||jj|td|d<|jj||drV|jjjd|d<dS)NrdrhrwTrx) r<rrIrrrrr{r+)r@rr)r)r*rs      z+getPhases..InBodyPhase.startTagMathcSsZ|jj|jj||jj|td|d<|jj||drV|jjjd|d<dS)NrurhrwTrx) r<rrIrrrrr{r+)r@rr)r)r*rs      z*getPhases..InBodyPhase.startTagSvgcSs|jjdd|didS)a5 Elements that should be children of other elements that have a different insertion mode; here they are ignored "caption", "col", "colgroup", "frame", "frameset", "head", "option", "optgroup", "tbody", "td", "tfoot", "th", "thead", "tr", "noscript" zunexpected-start-tag-ignoredr>N)rIr|)r@rr)r)r*rsz0getPhases..InBodyPhase.startTagMisplacedcSs|jj|jj|dS)N)r<rr)r@rr)r)r*rs z,getPhases..InBodyPhase.startTagOthercSs|jjdddsD|jtdd|jjdddi|jtddnX|jjd|jjd j dkrt|jjdddi|jjj }x|j dkr|jjj }qWdS) Nr(rd)rrozunexpected-end-tagr>rpr ry) r<rrr rIr|rrr{r>r+)r@rrr)r)r*rs   z&getPhases..InBodyPhase.endTagPcSs|jjds|jjdS|jjdjdkrlx>|jjddD]*}|jtdkr>|jjdd|jdPq>W|jjd|j_dS)Nrr rTrUrSryrxr(rvrwrrrrrrrz$expected-one-end-tag-but-got-another)gotName expectedName afterBodyry)rTrUrSryrxr(rvrwrrrrrrrr) r<rrIr|r{r>rrFr])r@rrr)r)r*r!s  z)getPhases..InBodyPhase.endTagBodycSs"|jjdr|jtd|SdS)Nr)r<rrr )r@rr)r)r*r3s z)getPhases..InBodyPhase.endTagHtmlcSs|ddkr|j|_|jj|d}|r2|jj|jjdj|dkr^|jjdd|di|r|jjj }x|j|dkr|jjj }qpWdS)Nr>rPr zend-tag-too-earlyry) r}rr<rrr{r>rIr|r+)r@rZinScoperr)r)r*r9s   z*getPhases..InBodyPhase.endTagBlockcSsx|jj}d|j_|dks&|jj| r:|jjdddin:|jj|jjd|krf|jjdddi|jjj|dS)Nzunexpected-end-tagr>rRr zend-tag-too-early-ignoredry)r<rrrIr|rr{r9)r@rrr)r)r*rGs   z)getPhases..InBodyPhase.endTagFormcSs|ddkrd}nd}|jj|d|dsB|jjdd|dinj|jj|dd|jjd j|dkr|jjdd|di|jjj}x|j|dkr|jjj}qWdS) Nr>rSlist)rzunexpected-end-tag)excluder zend-tag-too-earlyry)r<rrIr|rr{r>r+)r@rrrr)r)r*rTs  z-getPhases..InBodyPhase.endTagListItemcSsx$tD]}|jj|r|jjPqW|jjdj|dkrR|jjdd|dixBtD]:}|jj|rX|jjj}x|jtkr|jjj}qvWPqXWdS)Nr r>zend-tag-too-earlyry) rr<rrr{r>rIr|r+)r@ritemr)r)r*res       z,getPhases..InBodyPhase.endTagHeadingcSs"d}x|dkr|d7}|jj|d}| sL||jjkrZ|jj|j rZ|j|dS||jjkr|jjdd|di|jjj |dS|jj|js|jjdd|didS||jjdkr|jjdd|di|jjj |}d}x,|jj|dD]}|j t kr|}PqW|dkrb|jjj }x||krN|jjj }q4W|jjj |dS|jj|d}|jjj |}|} } d} |jjj | } x| d krh| d7} | d8} |jj| } | |jjkr|jjj | q| |krP| |kr |jjj | d}| j} | |jj|jjj | <| |jj|jjj | <| } | jrV| jj| | j| | } qW| jr~| jj| |jtdkr|jj\}}|j| |n |j| |j} |j| |j| |jjj ||jjj|| |jjj ||jjj|jjj |d| qWdS)z)The much-feared adoption agency algorithmrr r>Nzadoption-agency-1.2zadoption-agency-4.4zadoption-agency-1.3rrrrrrry)rrrrr)r<rr{rr>rrIr|rr9indexrrr+Z cloneNoderrZ appendChildrZgetTableMisnestedNodePosition insertBeforeZreparentChildreninsert)r@rZouterLoopCounterZformattingElementZafeIndexZ furthestBlockrkZcommonAncestorZbookmarkZlastNoderZinnerLoopCounterrZclonerrr)r)r*rts                    z/getPhases..InBodyPhase.endTagFormattingcSs|jj|dr|jj|jjdj|dkrF|jjdd|di|jj|dr|jjj}x|j|dkr|jjj}qdW|jjdS)Nr>r zend-tag-too-earlyry) r<rrr{r>rIr|r+clearActiveFormattingElements)r@rrkr)r)r*rs  z8getPhases..InBodyPhase.endTagAppletMarqueeObjectcSs@|jjdddd|jj|jjtdd|jjjdS)Nzunexpected-end-tag-treated-asrz br element)rrro)rIr|r<rrr r{r+)r@rr)r)r*r4#s   z'getPhases..InBodyPhase.endTagBrcSsx|jjdddD]}|j|dkr~|jj|dd|jjdj|dkrd|jjdd|dix|jjj|krxqfWPq|jtkr|jjdd|diPqWdS)Nr r>)rzunexpected-end-tagryry) r<r{r>rrIr|r+rr)r@rrr)r)r*r*s z*getPhases..InBodyPhase.endTagOtherN)6r7r8r9rHrrrrrr}r~r6r7rrrrrrrrrrrrrrrrrrrrrr%rrrrrrrrrrrrrrrrrr4rr))rr)r* InBodyPhaseesh G             $ rcs@eZdZfddZddZddZddZd d Zd d Zd S)zgetPhases..TextPhasecsFj|||tjg|_|j|j_tjd|jfg|_|j|j_dS)Nr) rHrrrrr endTagScriptrr)r@rIr<)rr)r*rH9s   z%getPhases..TextPhase.__init__cSs|jj|ddS)Nrs)r<r)r@rr)r)r*rAsz.getPhases..TextPhase.processCharacterscSs8|jjdd|jjdji|jjj|jj|j_dS)Nz&expected-named-closing-tag-but-got-eofr>r Try)rIr|r<r{r>r+rr])r@r)r)r*rDs   z'getPhases..TextPhase.processEOFcSsdstd|ddS)NFz4Tried to process start tag %s in RCDATA/RAWTEXT moder>)r)r@rr)r)r*rKsz*getPhases..TextPhase.startTagOthercSs*|jjj}|jdkst|jj|j_dS)Nr)r<r{r+r>rrIrr])r@rrr)r)r*rNs z)getPhases..TextPhase.endTagScriptcSs|jjj|jj|j_dS)N)r<r{r+rIrr])r@rr)r)r*rUs z(getPhases..TextPhase.endTagOtherN) r7r8r9rHrrrrrr))rr)r* TextPhase8s  rcseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'S)(zgetPhases..InTablePhasec sj|||tjd|jfd|jfd|jfd|jfd|jfd|jfd |j fd|j fd|j fd|j fg |_ |j|j _tjd |jfd|jfg|_|j|j_dS)NrrrrzrrrrrrrrrrprRr)rrr)rrr)rr) rrrzrrrrrrrr)rHrrrstartTagCaptionstartTagColgroup startTagColstartTagRowGroupstartTagImplyTbodyrstartTagStyleScriptrrrrr endTagTable endTagIgnorerr)r@rIr<)rr)r*rH[s$ z(getPhases..InTablePhase.__init__cSs(x"|jjdjdkr"|jjjqWdS)Nr rrry)rr)r<r{r>r+)r@r)r)r*clearStackToTableContextssz8getPhases..InTablePhase.clearStackToTableContextcSs0|jjdjdkr |jjdn |jjs,tdS)Nr rz eof-in-tablery)r<r{r>rIr|rPr)r@r)r)r*r|sz*getPhases..InTablePhase.processEOFcSs4|jj}|jjd|j_||jj_|jjj|dS)N inTableText)rIr]rFrr)r@rrr)r)r*rs z6getPhases..InTablePhase.processSpaceCharacterscSs4|jj}|jjd|j_||jj_|jjj|dS)Nr)rIr]rFrr)r@rrr)r)r*rs z1getPhases..InTablePhase.processCharacterscSs&d|j_|jjdj|d|j_dS)NTrF)r<insertFromTablerIrFr)r@rr)r)r*rsz*getPhases..InTablePhase.insertTextcSs6|j|jjjt|jj||jjd|j_dS)Nr) rr<rrr rrIrFr])r@rr)r)r*rs z/getPhases..InTablePhase.startTagCaptioncSs(|j|jj||jjd|j_dS)Nr)rr<rrIrFr])r@rr)r)r*rs z0getPhases..InTablePhase.startTagColgroupcSs|jtdd|S)Nrro)rr )r@rr)r)r*rsz+getPhases..InTablePhase.startTagColcSs(|j|jj||jjd|j_dS)Nr)rr<rrIrFr])r@rr)r)r*rs z0getPhases..InTablePhase.startTagRowGroupcSs|jtdd|S)Nrro)rr )r@rr)r)r*rsz2getPhases..InTablePhase.startTagImplyTbodycSs6|jjdddd|jjjtd|jjs2|SdS)Nz$unexpected-start-tag-implies-end-tagr)rr)rIr|r]rr rP)r@rr)r)r*rs  z-getPhases..InTablePhase.startTagTablecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz3getPhases..InTablePhase.startTagStyleScriptcSsVd|dkrH|ddjtdkrH|jjd|jj||jjjn |j|dS)Nr2rsrz unexpected-hidden-input-in-table) rjrrIr|r<rr{r+r)r@rr)r)r*rs    z-getPhases..InTablePhase.startTagInputcSsD|jjd|jjdkr@|jj||jjd|j_|jjjdS)Nzunexpected-form-in-tabler ry)rIr|r<rrr{r+)r@rr)r)r*rs    z,getPhases..InTablePhase.startTagFormcSs<|jjdd|did|j_|jjdj|d|j_dS)Nz)unexpected-start-tag-implies-table-voodoor>TrF)rIr|r<rrFr)r@rr)r)r*rsz-getPhases..InTablePhase.startTagOthercSs|jjdddr|jj|jjdjdkrJ|jjdd|jjdjdx"|jjdjdkrl|jjjqLW|jjj|jjn|jj st |jjdS) Nr)rr zend-tag-too-early-named)rrryryry) r<rrr{r>rIr|r+r_rPr)r@rr)r)r*rs    z+getPhases..InTablePhase.endTagTablecSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz,getPhases..InTablePhase.endTagIgnorecSs<|jjdd|did|j_|jjdj|d|j_dS)Nz'unexpected-end-tag-implies-table-voodoor>TrF)rIr|r<rrFr)r@rr)r)r*rsz+getPhases..InTablePhase.endTagOtherN)r7r8r9rHrrrrrrrrrrrrrrrrrrr))rr)r* InTablePhaseYs&   rcsPeZdZfddZddZddZddZd d Zd d Zd dZ ddZ dS)z#getPhases..InTableTextPhasecsj|||d|_g|_dS)N)rHrcharacterTokens)r@rIr<)rr)r*rHsz,getPhases..InTableTextPhase.__init__cSsddjdd|jD}tdd|DrJtd|d}|jjdj|n|rZ|jj|g|_dS)NrcSsg|] }|dqS)rsr))r=rr)r)r*rAszGgetPhases..InTableTextPhase.flushCharacters..cSsg|] }|tkqSr))r)r=rr)r)r*rAsrn)r2rsr)joinrrrrIrFrr<)r@rsrr)r)r*flushCharacterss z3getPhases..InTableTextPhase.flushCharacterscSs|j|j|j_|S)N)rrrIr])r@rr)r)r*rs z2getPhases..InTableTextPhase.processCommentcSs|j|j|j_dS)NT)rrrIr])r@r)r)r*rs z.getPhases..InTableTextPhase.processEOFcSs |ddkrdS|jj|dS)Nrsr)rr)r@rr)r)r*rs z5getPhases..InTableTextPhase.processCharacterscSs|jj|dS)N)rr)r@rr)r)r*rsz:getPhases..InTableTextPhase.processSpaceCharacterscSs|j|j|j_|S)N)rrrIr])r@rr)r)r*r s z3getPhases..InTableTextPhase.processStartTagcSs|j|j|j_|S)N)rrrIr])r@rr)r)r*rs z1getPhases..InTableTextPhase.processEndTagN) r7r8r9rHrrrrrrrr))rr)r*InTableTextPhases  rcs`eZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)z!getPhases..InCaptionPhasec sfj|||tjd|jfd |jfg|_|j|j_tjd|jfd |j fd|j fg|_ |j |j _dS)Nrrrzrrrrrrrrr) rrzrrrrrrr) rrzrrrrrrrr) rHrrrstartTagTableElementrrr endTagCaptionrrrr)r@rIr<)rr)r*rHs z*getPhases..InCaptionPhase.__init__cSs|jjddd S)Nrr)r)r<r)r@r)r)r*ignoreEndTagCaption+sz5getPhases..InCaptionPhase.ignoreEndTagCaptioncSs|jjdjdS)Nr)rIrFr)r@r)r)r*r.sz,getPhases..InCaptionPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r1sz3getPhases..InCaptionPhase.processCharacterscSs0|jj|j}|jjjtd|s,|SdS)Nr)rIr|rr]rr )r@r ignoreEndTagr)r)r*r4s  z6getPhases..InCaptionPhase.startTagTableElementcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r<sz/getPhases..InCaptionPhase.startTagOthercSs|js|jj|jjdjdkrB|jjdd|jjdjdx"|jjdjdkrd|jjjqDW|jjj|jj|jj d|j_ n|jj st |jjdS) Nr rz$expected-one-end-tag-but-got-another)rrrryryry) rr<rr{r>rIr|r+rrFr]rPr)r@rr)r)r*r?s    z/getPhases..InCaptionPhase.endTagCaptioncSs0|jj|j}|jjjtd|s,|SdS)Nr)rIr|rr]rr )r@rrr)r)r*rQs  z-getPhases..InCaptionPhase.endTagTablecSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rXsz.getPhases..InCaptionPhase.endTagIgnorecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r[sz-getPhases..InCaptionPhase.endTagOtherN) r7r8r9rHrrrrrrrrrr))rr)r*InCaptionPhases rcsXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z%getPhases..InColumnGroupPhasecs^j|||tjd|jfd|jfg|_|j|j_tjd|jfd|j fg|_ |j |j _dS)Nrrzr) rHrrrrrrrendTagColgroup endTagColrr)r@rIr<)rr)r*rHas z.getPhases..InColumnGroupPhase.__init__cSs|jjdjdkS)Nr rry)r<r{r>)r@r)r)r*ignoreEndTagColgrouppsz:getPhases..InColumnGroupPhase.ignoreEndTagColgroupcSsD|jjdjdkr"|jjstdS|j}|jtd|s@dSdS)Nr rrTry) r<r{r>rIrPrrrr )r@rr)r)r*rss z0getPhases..InColumnGroupPhase.processEOFcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*r}sz7getPhases..InColumnGroupPhase.processCharacterscSs$|jj||jjjd|d<dS)NTrx)r<rr{r+)r@rr)r)r*rs  z1getPhases..InColumnGroupPhase.startTagColcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*rsz3getPhases..InColumnGroupPhase.startTagOthercSs@|jr |jjst|jjn|jjj|jjd|j_ dS)Nr) rrIrPrr|r<r{r+rFr])r@rr)r)r*rs    z4getPhases..InColumnGroupPhase.endTagColgroupcSs|jjdddidS)Nz no-end-tagr>rz)rIr|)r@rr)r)r*rsz/getPhases..InColumnGroupPhase.endTagColcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*rsz1getPhases..InColumnGroupPhase.endTagOtherN) r7r8r9rHrrrrrrrrr))rr)r*InColumnGroupPhase^s   rcsxeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS)z#getPhases..InTableBodyPhasec svj|||tjd|jfd|jfd |jfd|jfg|_|j|j_ tjd|j fd |j fd|j fg|_ |j|j _ dS)Nrrrrrrzrrrrrr)rr)rrzrrrr)rrr)rrrzrrrrr)rHrrr startTagTrstartTagTableCellstartTagTableOtherrrrendTagTableRowGrouprrrr)r@rIr<)rr)r*rHs z,getPhases..InTableBodyPhase.__init__cSsFx"|jjdjdkr"|jjjqW|jjdjdkrB|jjsBtdS) Nr rrrrry)rrrrry)r<r{r>r+rIrPr)r@r)r)r*clearStackToTableBodyContexts z@getPhases..InTableBodyPhase.clearStackToTableBodyContextcSs|jjdjdS)Nr)rIrFr)r@r)r)r*rsz.getPhases..InTableBodyPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz:getPhases..InTableBodyPhase.processSpaceCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz5getPhases..InTableBodyPhase.processCharacterscSs(|j|jj||jjd|j_dS)Nr)rr<rrIrFr])r@rr)r)r*rs z.getPhases..InTableBodyPhase.startTagTrcSs*|jjdd|di|jtdd|S)Nzunexpected-cell-in-table-bodyr>rro)rIr|rr )r@rr)r)r*rsz5getPhases..InTableBodyPhase.startTagTableCellcSsn|jjddds0|jjddds0|jjdddrT|j|jt|jjdj|S|jjs`t |jj dS)Nrr)rrrr ry) r<rrrr r{r>rIrPrr|)r@rr)r)r*rs z6getPhases..InTableBodyPhase.startTagTableOthercSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz1getPhases..InTableBodyPhase.startTagOthercSsT|jj|dddr:|j|jjj|jjd|j_n|jjdd|didS)Nr>r)rrz unexpected-end-tag-in-table-body) r<rrr{r+rIrFr]r|)r@rr)r)r*rs  z7getPhases..InTableBodyPhase.endTagTableRowGroupcSsn|jjddds0|jjddds0|jjdddrT|j|jt|jjdj|S|jjs`t |jj dS)Nrr)rrrr ry) r<rrrr r{r>rIrPrr|)r@rr)r)r*rs z/getPhases..InTableBodyPhase.endTagTablecSs|jjdd|didS)Nz unexpected-end-tag-in-table-bodyr>)rIr|)r@rr)r)r*rsz0getPhases..InTableBodyPhase.endTagIgnorecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz/getPhases..InTableBodyPhase.endTagOtherN)r7r8r9rHrrrrrrrrrrrrr))rr)r*InTableBodyPhases    rcseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)zgetPhases..InRowPhasec svj|||tjd|jfd |jfd|jfg|_|j|j_tjd |j fd |j fd|j fd|j fg|_ |j|j _dS)Nrrrrrzrrrrrrr)rr)rrzrrrrr)rrr)rrrzrrrr)rHrrrrrrrrendTagTrrrrrr)r@rIr<)rr)r*rHs z&getPhases..InRowPhase.__init__cSsDx>|jjdjdkr>|jjdd|jjdji|jjjqWdS) Nr rrz'unexpected-implied-end-tag-in-table-rowr>ry)rrry)r<r{r>rIr|r+)r@r)r)r*clearStackToTableRowContextsz9getPhases..InRowPhase.clearStackToTableRowContextcSs|jjddd S)Nrr)r)r<r)r@r)r)r*ignoreEndTagTrsz,getPhases..InRowPhase.ignoreEndTagTrcSs|jjdjdS)Nr)rIrFr)r@r)r)r*r"sz(getPhases..InRowPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r%sz4getPhases..InRowPhase.processSpaceCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r(sz/getPhases..InRowPhase.processCharacterscSs6|j|jj||jjd|j_|jjjtdS)Nr) rr<rrIrFr]rrr )r@rr)r)r*r+s z/getPhases..InRowPhase.startTagTableCellcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*r1sz0getPhases..InRowPhase.startTagTableOthercSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r8sz+getPhases..InRowPhase.startTagOthercSsH|js.|j|jjj|jjd|j_n|jjs:t |jj dS)Nr) rrr<r{r+rIrFr]rPrr|)r@rr)r)r*r;s   z&getPhases..InRowPhase.endTagTrcSs"|j}|jtd|s|SdS)Nr)rrr )r@rrr)r)r*rEsz)getPhases..InRowPhase.endTagTablecSs4|jj|dddr&|jtd|S|jjdS)Nr>r)rr)r<rrr rIr|)r@rr)r)r*rMsz1getPhases..InRowPhase.endTagTableRowGroupcSs|jjdd|didS)Nzunexpected-end-tag-in-table-rowr>)rIr|)r@rr)r)r*rTsz*getPhases..InRowPhase.endTagIgnorecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rXsz)getPhases..InRowPhase.endTagOtherN)r7r8r9rHrrrrrrrrrrrrrr))rr)r* InRowPhases  rcs`eZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)zgetPhases..InCellPhasec sfj|||tjd|jfd |jfg|_|j|j_tjd|jfd|j fd|j fg|_ |j |j _dS)Nrrrzrrrrrrrrr) rrzrrrrrrr)rr)rrrzrr)rrrrr) rHrrrrrrrendTagTableCellr endTagImplyrr)r@rIr<)rr)r*rH]s z'getPhases..InCellPhase.__init__cSsB|jjdddr |jtdn|jjdddr>|jtddS)Nrr)rr)r<rrr )r@r)r)r* closeCellnsz(getPhases..InCellPhase.closeCellcSs|jjdjdS)Nr)rIrFr)r@r)r)r*rusz)getPhases..InCellPhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rxsz0getPhases..InCellPhase.processCharacterscSsF|jjddds |jjdddr,|j|S|jjs8t|jjdS)Nrr)rr)r<rrrIrPrr|)r@rr)r)r*r{s  z1getPhases..InCellPhase.startTagTableOthercSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz,getPhases..InCellPhase.startTagOthercSs|jj|dddr|jj|d|jjdj|dkrt|jjdd|dix.|jjj}|j|dkrRPqRWn |jjj|jj|jj d|j_ n|jjdd|didS) Nr>r)rr zunexpected-cell-end-tagrzunexpected-end-tagry) r<rrr{r>rIr|r+rrFr])r@rrr)r)r*rs   z.getPhases..InCellPhase.endTagTableCellcSs|jjdd|didS)Nzunexpected-end-tagr>)rIr|)r@rr)r)r*rsz+getPhases..InCellPhase.endTagIgnorecSs.|jj|dddr |j|S|jjdS)Nr>r)r)r<rrrIr|)r@rr)r)r*rsz*getPhases..InCellPhase.endTagImplycSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rsz*getPhases..InCellPhase.endTagOtherN) r7r8r9rHrrrrrrrrrr))rr)r* InCellPhase[s  rcsxeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS)z getPhases..InSelectPhasecsj|||tjd|jfd|jfd|jfd|jfd |jfd|jfg|_ |j |j _ tjd|j fd|j fd|jfg|_|j|j_ dS) Nrrxryrrprkrtr)rprkrt)rHrrrstartTagOptionstartTagOptgrouprrr&rrr endTagOptionendTagOptgroup endTagSelectrr)r@rIr<)rr)r*rHs z)getPhases..InSelectPhase.__init__cSs0|jjdjdkr |jjdn |jjs,tdS)Nr rz eof-in-selectry)r<r{r>rIr|rPr)r@r)r)r*rsz+getPhases..InSelectPhase.processEOFcSs$|ddkrdS|jj|ddS)Nrsr)r<r)r@rr)r)r*rs z2getPhases..InSelectPhase.processCharacterscSs.|jjdjdkr|jjj|jj|dS)Nr rxry)r<r{r>r+r)r@rr)r)r*rs z/getPhases..InSelectPhase.startTagOptioncSsL|jjdjdkr|jjj|jjdjdkr<|jjj|jj|dS)Nr rxryryry)r<r{r>r+r)r@rr)r)r*rs   z1getPhases..InSelectPhase.startTagOptgroupcSs|jjd|jtddS)Nzunexpected-select-in-selectr)rIr|rr )r@rr)r)r*rs z/getPhases..InSelectPhase.startTagSelectcSs>|jjd|jjdddr.|jtd|S|jjs:tdS)Nzunexpected-input-in-selectr)r)rIr|r<rrr rPr)r@rr)r)r*rs  z.getPhases..InSelectPhase.startTagInputcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r&sz/getPhases..InSelectPhase.startTagScriptcSs|jjdd|didS)Nzunexpected-start-tag-in-selectr>)rIr|)r@rr)r)r*rsz.getPhases..InSelectPhase.startTagOthercSs6|jjdjdkr |jjjn|jjdddidS)Nr rxzunexpected-end-tag-in-selectr>ry)r<r{r>r+rIr|)r@rr)r)r*rsz-getPhases..InSelectPhase.endTagOptioncSsf|jjdjdkr0|jjdjdkr0|jjj|jjd jdkrP|jjjn|jjdddidS) Nr rxrryzunexpected-end-tag-in-selectr>ryry)r<r{r>r+rIr|)r@rr)r)r*rs z/getPhases..InSelectPhase.endTagOptgroupcSs^|jjdddrD|jjj}x|jdkr6|jjj}qW|jjn|jjsPt|jj dS)Nr)r) r<rr{r+r>rIr_rPrr|)r@rrr)r)r*rs    z-getPhases..InSelectPhase.endTagSelectcSs|jjdd|didS)Nzunexpected-end-tag-in-selectr>)rIr|)r@rr)r)r*r sz,getPhases..InSelectPhase.endTagOtherN)r7r8r9rHrrrrrrr&rrrrrr))rr)r* InSelectPhases   rcsHeZdZfddZddZddZddZd d Zd d Zd dZ dS)z'getPhases..InSelectInTablePhasec sNj|||tjd |jfg|_|j|j_tjd |jfg|_|j |j_dS) Nrrrrrrrr)rrrrrrrr)rrrrrrrr) rHrrrrrrrrr)r@rIr<)rr)r*rH s z0getPhases..InSelectInTablePhase.__init__cSs|jjdjdS)Nr)rIrFr)r@r)r)r*r sz2getPhases..InSelectInTablePhase.processEOFcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r sz9getPhases..InSelectInTablePhase.processCharacterscSs(|jjdd|di|jtd|S)Nz5unexpected-table-element-start-tag-in-select-in-tabler>r)rIr|rr )r@rr)r)r*r! sz5getPhases..InSelectInTablePhase.startTagTablecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r& sz5getPhases..InSelectInTablePhase.startTagOthercSs@|jjdd|di|jj|dddr<|jtd|SdS)Nz3unexpected-table-element-end-tag-in-select-in-tabler>r)rr)rIr|r<rrr )r@rr)r)r*r) sz3getPhases..InSelectInTablePhase.endTagTablecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r/ sz3getPhases..InSelectInTablePhase.endTagOtherN) r7r8r9rHrrrrrrr))rr)r*InSelectInTablePhase s rc-seZdZeddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,g,Zfd-d.Zd/d0Zfd1d2Zd3d4Zd5d6Z d7S)8z(getPhases..InForeignContentPhaserWrXr>rrr?rYrTr+rBrUrZriZh1Zh2Zh3Zh4Zh5Zh6rrqr\rjrSrQrJr4rcrLr(rPrr]r^spanr`r_subZsuprrarbrOvarcsj|||dS)N)rH)r@rIr<)rr)r*rH< sz1getPhases..InForeignContentPhase.__init__c%Ssnddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%$}|d&|krj||d&|d&<dS)'NZaltGlyphZ altGlyphDefZ altGlyphItemZ animateColorZ animateMotionZanimateTransformZclipPathZfeBlendZ feColorMatrixZfeComponentTransferZ feCompositeZfeConvolveMatrixZfeDiffuseLightingZfeDisplacementMapZfeDistantLightZfeFloodZfeFuncAZfeFuncBZfeFuncGZfeFuncRZfeGaussianBlurZfeImageZfeMergeZ feMergeNodeZ feMorphologyZfeOffsetZ fePointLightZfeSpecularLightingZ feSpotLightZfeTileZ feTurbulenceZ foreignObjectZglyphRefZlinearGradientZradialGradientZtextPath)$ZaltglyphZ altglyphdefZ altglyphitemZ animatecolorZ animatemotionZanimatetransformZclippathZfeblendZ fecolormatrixZfecomponenttransferZ fecompositeZfeconvolvematrixZfediffuselightingZfedisplacementmapZfedistantlightZfefloodZfefuncaZfefuncbZfefuncgZfefuncrZfegaussianblurZfeimageZfemergeZ femergenodeZ femorphologyZfeoffsetZ fepointlightZfespecularlightingZ fespotlightZfetileZ feturbulenceZ foreignobjectZglyphrefZlineargradientZradialgradientZtextpathr>r))r@r replacementsr)r)r*adjustSVGTagNames? sL z:getPhases..InForeignContentPhase.adjustSVGTagNamescsL|ddkrd|d<n&|jjr.InForeignContentPhase.processCharacters..F)rIr`rr)r@r)rr)r*rh s   z:getPhases..InForeignContentPhase.processCharacterscSs6|jjd}|d|jksD|ddkrt|djtdddg@r|jjdd|dixR|jjdj|jjkr|jj |jjd r|jj |jjd r|jjj q\W|S|jt d kr|jj |n$|jt d kr|j||jj||jj||j|d <|jj||d r2|jjj d |d<dS)Nr r>r[rsZcolorZfacesizez*unexpected-html-element-in-foreign-contentrdrurhrwTrxryryryry)r<r{breakoutElementssetkeysrIr|rhrrlrmr+rrrrrr)r@rrr)r)r*rp s.          z8getPhases..InForeignContentPhase.processStartTagcSst|jjd}|jjd}|jjt|dkrF|jjdd|dix|jjt|dkr|jj|jj dkr|jjj |jjj |j_x |jjj |kr|jjst qWd}P|d8}|jj|}|j|jjkrqHqH|jjj|}PqHW|S)Nr r>zunexpected-end-tagrry)r~r<r{r>rjrrIr|r]rFrrr+rrhrr)r@rZ nodeIndexrrr)r)r*r s(   z6getPhases..InForeignContentPhase.processEndTagN) r7r8r9rrrHrrrrr))rr)r*InForeignContentPhase2 s       ) rcsPeZdZfddZddZddZddZd d Zd d Zd dZ ddZ dS)z!getPhases..AfterBodyPhasecsNj|||tjd|jfg|_|j|j_tjd|jfg|_|j |j_dS)Nr) rHrrrrrrrrr)r@rIr<)rr)r*rH s  z*getPhases..AfterBodyPhase.__init__cSsdS)Nr))r@r)r)r*r sz,getPhases..AfterBodyPhase.processEOFcSs|jj||jjddS)Nr)r<rr{)r@rr)r)r*r sz0getPhases..AfterBodyPhase.processCommentcSs |jjd|jjd|j_|S)Nzunexpected-char-after-bodyr)rIr|rFr])r@rr)r)r*r s z3getPhases..AfterBodyPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r sz.getPhases..AfterBodyPhase.startTagHtmlcSs*|jjdd|di|jjd|j_|S)Nzunexpected-start-tag-after-bodyr>r)rIr|rFr])r@rr)r)r*r sz/getPhases..AfterBodyPhase.startTagOthercSs*|jjr|jjdn|jjd|j_dS)Nz'unexpected-end-tag-after-body-innerhtmlafterAfterBody)rIrPr|rFr])r@r>r)r)r*r sz,getPhases..AfterBodyPhase.endTagHtmlcSs*|jjdd|di|jjd|j_|S)Nzunexpected-end-tag-after-bodyr>r)rIr|rFr])r@rr)r)r*r sz-getPhases..AfterBodyPhase.endTagOtherN) r7r8r9rHrrrrrrrr))rr)r*AfterBodyPhase s r csXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z"getPhases..InFramesetPhasecsfj|||tjd|jfd|jfd|jfd|jfg|_|j|j_ tjd|j fg|_ |j |j _ dS)Nrrr{r) rHrrrr7 startTagFramestartTagNoframesrrrendTagFramesetrr)r@rIr<)rr)r*rH s z+getPhases..InFramesetPhase.__init__cSs0|jjdjdkr |jjdn |jjs,tdS)Nr rzeof-in-framesetry)r<r{r>rIr|rPr)r@r)r)r*r sz-getPhases..InFramesetPhase.processEOFcSs|jjddS)Nzunexpected-char-in-frameset)rIr|)r@rr)r)r*r sz4getPhases..InFramesetPhase.processCharacterscSs|jj|dS)N)r<r)r@rr)r)r*r7 sz3getPhases..InFramesetPhase.startTagFramesetcSs|jj||jjjdS)N)r<rr{r+)r@rr)r)r*r  s z0getPhases..InFramesetPhase.startTagFramecSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r  sz3getPhases..InFramesetPhase.startTagNoframescSs|jjdd|didS)Nz unexpected-start-tag-in-framesetr>)rIr|)r@rr)r)r*r sz0getPhases..InFramesetPhase.startTagOthercSs\|jjdjdkr |jjdn |jjj|jj rX|jjdjdkrX|jjd|j_dS)Nr rz)unexpected-frameset-in-frameset-innerhtmlr afterFramesetryry) r<r{r>rIr|r+rPrFr])r@rr)r)r*r  s   z1getPhases..InFramesetPhase.endTagFramesetcSs|jjdd|didS)Nzunexpected-end-tag-in-framesetr>)rIr|)r@rr)r)r*r sz.getPhases..InFramesetPhase.endTagOtherN) r7r8r9rHrrr7r r rr rr))rr)r*InFramesetPhase s  rcsHeZdZfddZddZddZddZd d Zd d Zd dZ dS)z%getPhases..AfterFramesetPhasecsVj|||tjd|jfd|jfg|_|j|j_tjd|jfg|_ |j |j _dS)Nrr) rHrrrr rrrrrr)r@rIr<)rr)r*rH s z.getPhases..AfterFramesetPhase.__init__cSsdS)Nr))r@r)r)r*r sz0getPhases..AfterFramesetPhase.processEOFcSs|jjddS)Nzunexpected-char-after-frameset)rIr|)r@rr)r)r*r! sz7getPhases..AfterFramesetPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*r $ sz6getPhases..AfterFramesetPhase.startTagNoframescSs|jjdd|didS)Nz#unexpected-start-tag-after-framesetr>)rIr|)r@rr)r)r*r' sz3getPhases..AfterFramesetPhase.startTagOthercSs|jjd|j_dS)NafterAfterFrameset)rIrFr])r@rr)r)r*r+ sz0getPhases..AfterFramesetPhase.endTagHtmlcSs|jjdd|didS)Nz!unexpected-end-tag-after-framesetr>)rIr|)r@rr)r)r*r. sz1getPhases..AfterFramesetPhase.endTagOtherN) r7r8r9rHrrr rrrr))rr)r*AfterFramesetPhase s rcsPeZdZfddZddZddZddZd d Zd d Zd dZ ddZ dS)z&getPhases..AfterAfterBodyPhasecs0j|||tjd|jfg|_|j|j_dS)Nr)rHrrrrrr)r@rIr<)rr)r*rH3 sz/getPhases..AfterAfterBodyPhase.__init__cSsdS)Nr))r@r)r)r*r; sz1getPhases..AfterAfterBodyPhase.processEOFcSs|jj||jjdS)N)r<rr)r@rr)r)r*r> sz5getPhases..AfterAfterBodyPhase.processCommentcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rA sz=getPhases..AfterAfterBodyPhase.processSpaceCharacterscSs |jjd|jjd|j_|S)Nzexpected-eof-but-got-charr)rIr|rFr])r@rr)r)r*rD s z8getPhases..AfterAfterBodyPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rI sz3getPhases..AfterAfterBodyPhase.startTagHtmlcSs*|jjdd|di|jjd|j_|S)Nzexpected-eof-but-got-start-tagr>r)rIr|rFr])r@rr)r)r*rL sz4getPhases..AfterAfterBodyPhase.startTagOthercSs*|jjdd|di|jjd|j_|S)Nzexpected-eof-but-got-end-tagr>r)rIr|rFr])r@rr)r)r*rR sz4getPhases..AfterAfterBodyPhase.processEndTagN) r7r8r9rHrrrrrrrr))rr)r*AfterAfterBodyPhase2 s rcsXeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)z*getPhases..AfterAfterFramesetPhasecs8j|||tjd|jfd|jfg|_|j|j_dS)Nrr)rHrrrstartTagNoFramesrrr)r@rIr<)rr)r*rHY s z3getPhases..AfterAfterFramesetPhase.__init__cSsdS)Nr))r@r)r)r*rb sz5getPhases..AfterAfterFramesetPhase.processEOFcSs|jj||jjdS)N)r<rr)r@rr)r)r*re sz9getPhases..AfterAfterFramesetPhase.processCommentcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rh szAgetPhases..AfterAfterFramesetPhase.processSpaceCharacterscSs|jjddS)Nzexpected-eof-but-got-char)rIr|)r@rr)r)r*rk sz.AfterAfterFramesetPhase.processCharacterscSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rn sz7getPhases..AfterAfterFramesetPhase.startTagHtmlcSs|jjdj|S)Nr)rIrFr)r@rr)r)r*rq sz;getPhases..AfterAfterFramesetPhase.startTagNoFramescSs|jjdd|didS)Nzexpected-eof-but-got-start-tagr>)rIr|)r@rr)r)r*rt sz8getPhases..AfterAfterFramesetPhase.startTagOthercSs|jjdd|didS)Nzexpected-eof-but-got-end-tagr>)rIr|)r@rr)r)r*rx sz8getPhases..AfterAfterFramesetPhase.processEndTagN) r7r8r9rHrrrrrrrrr))rr)r*AfterAfterFramesetPhaseX s r)rTrSrrr/r0rrrrrrrrrrrrvrrrr r)r)rGrVrr rrr1r5r:rrrrrrrrrrrrr rrrrr))rr*rE_sp)#.g@CX!-GBbYLd's/9%&&rEcs^ts tjr t|dt@}nt|dt@}|rZtfdd|djD|d<dS)Nrsc3s"|]\}}j|||fVqdS)N)r})r=kv)rr)r*r sz$adjust_attributes..)rrZPY27rrrr.)rrZneeds_adjustmentr))rr*r s   rrpFcCs|dkr i}t||||dS)N)r2r>rsrw)r)r>r2rirwr)r)r*r  s r c@seZdZdZdS)rrzError in parsed documentN)r7r8r9rr)r)r)r*rr srr)rT)r+rT)rpNF)1Z __future__rrrZpip._vendor.sixrrrr0 collectionsr ImportErrorZpip._vendor.ordereddictrr r r Ztreebuilders.baser rZ constantsrrrrrrrrrrrrrrrrrr#r-r;rgr"ZmemoizerErr  Exceptionrrr)r)r)r*sR     H   )L  html5lib/__pycache__/__init__.cpython-36.opt-1.pyc000064400000001563152347724720015642 0ustar003 Pf @shdZddlmZmZmZddlmZmZmZddl m Z ddl m Z ddl mZdd d d d d gZdZdS)aM HTML parsing library based on the WHATWG "HTML5" specification. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage: import html5lib f = open("my_document.html") tree = html5lib.parse(f) )absolute_importdivisionunicode_literals) HTMLParserparse parseFragment)getTreeBuilder) getTreeWalker) serializerrrr r r z1.0b10N)__doc__Z __future__rrrZ html5parserrrrZ treebuildersr Z treewalkersr Z serializerr __all__ __version__rr/usr/lib/python3.6/__init__.py s   html5lib/__pycache__/_tokenizer.cpython-36.pyc000064400000122141152347724720015311 0ustar003 Pf$+@sddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl m Z m Z ddl mZmZmZdd l mZmZdd l mZdd lmZdd lmZee ZGd ddeZdS))absolute_importdivisionunicode_literals)unichr)deque)spaceCharacters)entities) asciiLettersasciiUpper2Lower)digits hexDigitsEOF) tokenTypes tagTokenTypes)replacementCharacters)HTMLInputStream)TriecsdeZdZdZdfdd ZddZddZdd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z!d@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&dJdKZ'dLdMZ(dNdOZ)dPdQZ*dRdSZ+dTdUZ,dVdWZ-dXdYZ.dZd[Z/d\d]Z0d^d_Z1d`daZ2dbdcZ3dddeZ4dfdgZ5dhdiZ6djdkZ7dldmZ8dndoZ9dpdqZ:drdsZ;dtduZdzd{Z?d|d}Z@d~dZAddZBddZCddZDddZEddZFddZGddZHddZIddZJddZKddZLZMS) HTMLTokenizera  This class takes care of tokenizing HTML. * self.currentToken Holds the token that is currently being processed. * self.state Holds a reference to the method to be invoked... XXX * self.stream Points to HTMLInputStream object. Nc sFt|f||_||_d|_g|_|j|_d|_d|_t t |j dS)NF) rstreamparserZ escapeFlagZ lastFourChars dataStatestateescape currentTokensuperr__init__)selfrrkwargs) __class__ /usr/lib/python3.6/_tokenizer.pyr"szHTMLTokenizer.__init__ccs\tg|_xL|jrVx&|jjr:td|jjjddVqWx|jrR|jjVq>Wq WdS)z This is where the magic happens. We do our usually processing through the states and when we have a token to return we yield the token which pauses processing until the next token is requested. ParseErrorr)typedataN)r tokenQueuerrerrorsrpoppopleft)rr r r!__iter__1s    zHTMLTokenizer.__iter__c %Cs(t}d}|rt}d}g}|jj}x(||krJ|tk rJ|j||jj}q$Wtdj||}|tkrt|}|j jt ddd|idnld|kod kns|d krd }|j jt ddd|idn(d |kod knsd|kodknsd|kodknsd|ko4dkns|t ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d g#kr|j jt ddd|idy t |}Wn>t k r|d6}t d|d?Bt d7|d8@B}YnX|d9kr$|j jt dd:d;|jj||S)r"z'expected-tag-name-but-got-right-bracket)r#r$rJz<>?z'expected-tag-name-but-got-question-markzexpected-tag-namerDT)rr6markupDeclarationOpenStatercloseTagOpenStater rr tagNameStater%r7rr=bogusCommentState)rr$r r r!r]is6               zHTMLTokenizer.tagOpenStatecCs|jj}|tkr0td|gdd|_|j|_n|dkrX|jjtddd|j |_nn|t kr|jjtddd|jjtd d d|j |_n0|jjtdd d |id |jj ||j |_dS)NrVF)r#rUr$rWrjr"z*expected-closing-tag-but-got-right-bracket)r#r$z expected-closing-tag-but-got-eofrJz|tkr|jjtdd d|j |_n|jjtd|dd S) Nr|rJ)r#r$rDr[r"zinvalid-codepointu�zeof-in-script-in-scriptT) rr6r%r7r scriptDataDoubleEscapedDashStater(scriptDataDoubleEscapedLessThanSignStaterr)rr$r r r!rs$          z*HTMLTokenizer.scriptDataDoubleEscapedStatecCs|jj}|dkr2|jjtddd|j|_n|dkrZ|jjtddd|j|_n|dkr|jjtddd|jjtddd|j|_nF|t kr|jjtdd d|j |_n|jjtd|d|j|_d S) Nr|rJ)r#r$rDr[r"zinvalid-codepointu�zeof-in-script-in-scriptT) rr6r%r7r$scriptDataDoubleEscapedDashDashStaterrrrr)rr$r r r!rs(           z.HTMLTokenizer.scriptDataDoubleEscapedDashStatecCs|jj}|dkr*|jjtdddn|dkrR|jjtddd|j|_n|dkrz|jjtddd|j|_n|dkr|jjtddd|jjtdd d|j|_nF|t kr|jjtdd d|j |_n|jjtd|d|j|_d S) Nr|rJ)r#r$rDrjr[r"zinvalid-codepointu�zeof-in-script-in-scriptT) rr6r%r7rrrrfrrr)rr$r r r!rs,           z2HTMLTokenizer.scriptDataDoubleEscapedDashDashStatecCsP|jj}|dkr8|jjtdddd|_|j|_n|jj||j |_dS)NrirJ)r#r$r,T) rr6r%r7rrrscriptDataDoubleEscapeEndStaterr=r)rr$r r r!r0s   z6HTMLTokenizer.scriptDataDoubleEscapedLessThanSignStatecCs|jj}|ttdBkrR|jjtd|d|jjdkrH|j |_ q|j |_ nB|t kr|jjtd|d|j|7_n|jj ||j |_ dS)NrirjrJ)r#r$rT)rirj)rr6rr:r%r7rrrrurrrr r=)rr$r r r!r;s    z,HTMLTokenizer.scriptDataDoubleEscapeEndStatecCs0|jj}|tkr$|jjtdn|tkrJ|jdj|dg|j|_n|dkr\|j n|dkrn|j |_n|dkr|j jt d d d |jdj|dg|j|_n|d kr|j jt d dd |jdjddg|j|_nF|t kr|j jt d dd |j|_n|jdj|dg|j|_dS)NTr$r,rjri'"rHrDr"z#invalid-character-in-attribute-name)r#r$r[zinvalid-codepointu�z#expected-attribute-name-but-got-eof)rrrHrD)rr6rr^r rr7attributeNameStaterrZrqr%rrr)rr$r r r!rpKs6              z&HTMLTokenizer.beforeAttributeNameStatecCs|jj}d}d}|dkr&|j|_n0|tkr^|jddd||jjtd7<d}n|dkrld}n|tkr~|j|_n|dkr|j |_n|d kr|j j t d d d |jdddd 7<d}n|dkr|j j t d dd |jddd|7<d}nH|t kr8|j j t d dd |j|_n|jddd|7<d}|r|jdddjt|jddd<xP|jdddD]:\}}|jddd|kr|j j t d dd PqW|r|jdS)NTFrHr$rrrjrir[r"zinvalid-codepoint)r#r$u�rrrDz#invalid-character-in-attribute-namezeof-in-attribute-namezduplicate-attributerKrK)rrrDrKrKrKrKrKrK)rr6beforeAttributeValueStaterr rr^rafterAttributeNameStaterqr%r7rrrrXr rZ)rr$ZleavingThisStateZ emitTokenrU_r r r!risR             &  z HTMLTokenizer.attributeNameStatecCsF|jj}|tkr$|jjtdn|dkr8|j|_n |dkrJ|jn|tkrp|jdj |dg|j |_n|dkr|j |_n|dkr|j j t dd d |jdj d dg|j |_n|dkr|j j t ddd |jdj |dg|j |_nF|tkr&|j j t ddd |j|_n|jdj |dg|j |_dS)NTrHrjr$r,rir[r"zinvalid-codepoint)r#r$u�rrrDz&invalid-character-after-attribute-namezexpected-end-of-tag-but-got-eof)rrrD)rr6rr^rrrZr rr7rrqr%rrr)rr$r r r!rs:                z%HTMLTokenizer.afterAttributeNameStatecCsj|jj}|tkr$|jjtdnB|dkr8|j|_n.|dkrX|j|_|jj|n|dkrl|j|_n|dkr|j j t ddd|j n|d kr|j j t dd d|j d dd d 7<|j|_n|dkr|j j t ddd|j d dd |7<|j|_nL|tkrD|j j t ddd|j|_n"|j d dd |7<|j|_dS)NTrrCrrjr"z.expected-attribute-value-but-got-right-bracket)r#r$r[zinvalid-codepointr$ru�rHrD`z"equals-in-unquoted-attribute-valuez$expected-attribute-value-but-got-eofrK)rHrDrrKrK)rr6rr^attributeValueDoubleQuotedStaterattributeValueUnQuotedStater=attributeValueSingleQuotedStater%r7rrZrrr)rr$r r r!rs>                 z'HTMLTokenizer.beforeAttributeValueStatecCs|jj}|dkr|j|_n|dkr0|jdn|dkrj|jjtddd|jdd dd 7<nN|t kr|jjtdd d|j |_n&|jdd d||jj d7<d S)NrrCr[r"zinvalid-codepoint)r#r$r$ru�z#eof-in-attribute-value-double-quoteTrKrK)rrCr[) rr6afterAttributeValueStaterrTr%r7rrrrr^)rr$r r r!rs         z-HTMLTokenizer.attributeValueDoubleQuotedStatecCs|jj}|dkr|j|_n|dkr0|jdn|dkrj|jjtddd|jdd dd 7<nN|t kr|jjtdd d|j |_n&|jdd d||jj d7<d S)NrrCr[r"zinvalid-codepoint)r#r$r$ru�z#eof-in-attribute-value-single-quoteTrKrK)rrCr[) rr6rrrTr%r7rrrrr^)rr$r r r!rs         z-HTMLTokenizer.attributeValueSingleQuotedStatecCs|jj}|tkr|j|_n|dkr2|jdn|dkrD|jn|dkr~|jjt dd d |j d dd |7<n|d kr|jjt ddd |j d dd d7<nV|t kr|jjt ddd |j |_n.|j d dd ||jj tdtB7<dS)NrCrjrrrHrDrr"z0unexpected-character-in-unquoted-attribute-value)r#r$r$rr[zinvalid-codepointu�z eof-in-attribute-value-no-quotesT)rrrHrDrrKrKrK)rCrjrrrHrDrr[)rr6rrprrTrZr%r7rrrrr^r:)rr$r r r!rs,           z)HTMLTokenizer.attributeValueUnQuotedStatecCs|jj}|tkr|j|_n|dkr.|jnp|dkr@|j|_n^|tkrt|jj t ddd|jj ||j |_n*|jj t ddd|jj ||j|_dS)Nrjrir"z$unexpected-EOF-after-attribute-value)r#r$z*unexpected-character-after-attribute-valueT) rr6rrprrZrqrr%r7rr=r)rr$r r r!r s"           z&HTMLTokenizer.afterAttributeValueStatecCs|jj}|dkr&d|jd<|jn^|tkrZ|jjtddd|jj||j |_ n*|jjtddd|jj||j |_ dS)NrjTrWr"z#unexpected-EOF-after-solidus-in-tag)r#r$z)unexpected-character-after-solidus-in-tag) rr6rrZrr%r7rr=rrrp)rr$r r r!rq4s          z&HTMLTokenizer.selfClosingStartTagStatecCsD|jjd}|jdd}|jjtd|d|jj|j|_dS)Nrjr[u�Comment)r#r$T) rr^replacer%r7rr6rr)rr$r r r!roFs   zHTMLTokenizer.bogusCommentStatecCs|jjg}|ddkrT|j|jj|ddkrPtddd|_|j|_dSn|ddkrd}x.d&D]&}|j|jj|d'|krjd}PqjW|rtdddddd|_|j|_dSn|d(dkrH|jdk rH|jj j rH|jj j d)j |jj j krHd}x2d*D]*}|j|jj|d+|krd}PqW|rH|j |_dS|jjtdddx|rz|jj|jq`W|j|_dS),Nrr|rr,)r#r$TdDoOr@CtTyYpPeEFZDoctype)r#rUpublicIdsystemIdcorrect[Ar"zexpected-dashes-or-doctyperKrKrK)rrrrr@rrrrrrrrr)rrrrrrrKrKrK)rrrrrrrK)rr6r7rrcommentStartStater doctypeStaterZtreeZ openElements namespaceZdefaultNamespacecdataSectionStater%r=r'ro)rr?matchedexpectedr r r!rlUsR           z(HTMLTokenizer.markupDeclarationOpenStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd d|jj|j|j|_nP|t kr|jjtdd d|jj|j|j|_n|jd|7<|j |_d S) Nr|r[r"zinvalid-codepoint)r#r$r$u�rjzincorrect-commentzeof-in-commentT) rr6commentStartDashStaterr%r7rrrr commentState)rr$r r r!rs(          zHTMLTokenizer.commentStartStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd d|jj|j|j|_nT|t kr|jjtdd d|jj|j|j|_n|jdd|7<|j |_d S) Nr|r[r"zinvalid-codepoint)r#r$r$u-�rjzincorrect-commentzeof-in-commentT) rr6commentEndStaterr%r7rrrrr)rr$r r r!rs(          z#HTMLTokenizer.commentStartDashStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<nT|tkr|jjtddd|jj|j|j |_n|jd||jj d 7<d S) Nr|r[r"zinvalid-codepoint)r#r$r$u�zeof-in-commentT)r|r[) rr6commentEndDashStaterr%r7rrrrr^)rr$r r r!rs        zHTMLTokenizer.commentStatecCs|jj}|dkr|j|_n|dkrV|jjtddd|jdd7<|j|_nT|t kr|jjtddd|jj|j|j |_n|jdd|7<|j|_d S) Nr|r[r"zinvalid-codepoint)r#r$r$u-�zeof-in-comment-end-dashT) rr6rrr%r7rrrrr)rr$r r r!rs         z!HTMLTokenizer.commentEndDashStatecCs,|jj}|dkr*|jj|j|j|_n|dkrd|jjtddd|jdd7<|j|_n|dkr|jjtdd d|j |_n|d kr|jjtdd d|jd|7<nj|t kr|jjtdd d|jj|j|j|_n4|jjtdd d|jdd|7<|j|_dS)Nrjr[r"zinvalid-codepoint)r#r$r$u--�rhz,unexpected-bang-after-double-dash-in-commentr|z,unexpected-dash-after-double-dash-in-commentzeof-in-comment-double-dashzunexpected-char-in-commentz--T) rr6r%r7rrrrrcommentEndBangStater)rr$r r r!rs6               zHTMLTokenizer.commentEndStatecCs|jj}|dkr*|jj|j|j|_n|dkrN|jdd7<|j|_n|dkr|jjtddd|jdd 7<|j |_nT|t kr|jjtdd d|jj|j|j|_n|jdd|7<|j |_d S) Nrjr|r$z--!r[r"zinvalid-codepoint)r#r$u--!�zeof-in-comment-end-bang-stateT) rr6r%r7rrrrrrr)rr$r r r!rs(         z!HTMLTokenizer.commentEndBangStatecCs|jj}|tkr|j|_nj|tkr\|jjtdddd|j d<|jj|j |j |_n*|jjtddd|jj ||j|_dS)Nr"z!expected-doctype-name-but-got-eof)r#r$Frzneed-space-after-doctypeT) rr6rbeforeDoctypeNameStaterrr%r7rrrr=)rr$r r r!r s         zHTMLTokenizer.doctypeStatecCs|jj}|tkrn|dkrT|jjtdddd|jd<|jj|j|j|_n|dkr|jjtdddd |jd <|j |_nR|t kr|jjtdd dd|jd<|jj|j|j|_n||jd <|j |_d S) Nrjr"z+expected-doctype-name-but-got-right-bracket)r#r$Frr[zinvalid-codepointu�rUz!expected-doctype-name-but-got-eofT) rr6rr%r7rrrrdoctypeNameStater)rr$r r r!rs.              z$HTMLTokenizer.beforeDoctypeNameStatecCs|jj}|tkr2|jdjt|jd<|j|_n|dkrh|jdjt|jd<|jj |j|j |_n|dkr|jj t ddd|jdd7<|j |_nh|t kr|jj t dddd |jd <|jdjt|jd<|jj |j|j |_n|jd|7<d S) NrUrjr[r"zinvalid-codepoint)r#r$u�zeof-in-doctype-nameFrT)rr6rrrXr afterDoctypeNameStaterr%r7rrrr)rr$r r r!r6s,          zHTMLTokenizer.doctypeNameStatecCsR|jj}|tkrn8|dkr8|jj|j|j|_n|tkrd|jd<|jj ||jjt ddd|jj|j|j|_n|d!krd }x$d'D]}|jj}||krd}PqW|r|j |_d SnJ|d(krd }x(d.D] }|jj}||krd}PqW|r|j |_d S|jj ||jjt ddd|id d|jd<|j |_d S)/NrjFrr"zeof-in-doctype)r#r$rrTuUbBlLiIr@rsSrrrrrrmMz*expected-space-or-right-bracket-in-doctyper$)r#r$r.)rrrrrrrrrrr@r)rrrrr)rrrrrrrrrrrr)rrrrr)rr6rr%r7rrrrr=rafterDoctypePublicKeywordStateafterDoctypeSystemKeywordStatebogusDoctypeState)rr$rrr r r!rOsT              z#HTMLTokenizer.afterDoctypeNameStatecCs|jj}|tkr|j|_n|d krP|jjtddd|jj||j|_nT|t kr|jjtdddd|j d<|jj|j |j |_n|jj||j|_d S) Nrrr"zunexpected-char-in-doctype)r#r$zeof-in-doctypeFrT)rr) rr6r"beforeDoctypePublicIdentifierStaterr%r7rr=rrr)rr$r r r!rs"           z,HTMLTokenizer.afterDoctypePublicKeywordStatecCs|jj}|tkrn|dkr0d|jd<|j|_n|dkrLd|jd<|j|_n|dkr|jjt dddd |jd <|jj|j|j |_nh|t kr|jjt dd dd |jd <|jj|j|j |_n(|jjt dd dd |jd <|j |_d S)Nrr,rrrjr"zunexpected-end-of-doctype)r#r$Frzeof-in-doctypezunexpected-char-in-doctypeT) rr6rr(doctypePublicIdentifierDoubleQuotedStater(doctypePublicIdentifierSingleQuotedStater%r7rrrr)rr$r r r!rs4                z0HTMLTokenizer.beforeDoctypePublicIdentifierStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6!afterDoctypePublicIdentifierStaterr%r7rrrr)rr$r r r!rs*            z6HTMLTokenizer.doctypePublicIdentifierDoubleQuotedStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6rrr%r7rrrr)rr$r r r!rs*            z6HTMLTokenizer.doctypePublicIdentifierSingleQuotedStatecCs |jj}|tkr|j|_n|dkr<|jj|j|j|_n|dkrn|jjt dddd|jd<|j |_n|dkr|jjt dddd|jd<|j |_nh|t kr|jjt dd dd |jd <|jj|j|j|_n(|jjt dddd |jd <|j |_d S) Nrjrr"zunexpected-char-in-doctype)r#r$r,rrzeof-in-doctypeFrT)rr6r-betweenDoctypePublicAndSystemIdentifiersStaterr%r7rrr(doctypeSystemIdentifierDoubleQuotedState(doctypeSystemIdentifierSingleQuotedStaterr)rr$r r r!rs6                  z/HTMLTokenizer.afterDoctypePublicIdentifierStatecCs|jj}|tkrn|dkr4|jj|j|j|_n|dkrPd|jd<|j|_n|dkrld|jd<|j |_nh|t kr|jjt dddd |jd <|jj|j|j|_n(|jjt dd dd |jd <|j |_d S) Nrjrr,rrr"zeof-in-doctype)r#r$Frzunexpected-char-in-doctypeT) rr6rr%r7rrrrrrrr)rr$r r r!rs.             z;HTMLTokenizer.betweenDoctypePublicAndSystemIdentifiersStatecCs|jj}|tkr|j|_n|d krP|jjtddd|jj||j|_nT|t kr|jjtdddd|j d<|jj|j |j |_n|jj||j|_d S) Nrrr"zunexpected-char-in-doctype)r#r$zeof-in-doctypeFrT)rr) rr6r"beforeDoctypeSystemIdentifierStaterr%r7rr=rrr)rr$r r r!rs"           z,HTMLTokenizer.afterDoctypeSystemKeywordStatecCs|jj}|tkrn|dkr0d|jd<|j|_n|dkrLd|jd<|j|_n|dkr|jjt dddd |jd <|jj|j|j |_nh|t kr|jjt dd dd |jd <|jj|j|j |_n(|jjt dddd |jd <|j |_d S) Nrr,rrrjr"zunexpected-char-in-doctype)r#r$Frzeof-in-doctypeT) rr6rrrrrr%r7rrrr)rr$r r r!r/s4                z0HTMLTokenizer.beforeDoctypeSystemIdentifierStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6!afterDoctypeSystemIdentifierStaterr%r7rrrr)rr$r r r!rLs*            z6HTMLTokenizer.doctypeSystemIdentifierDoubleQuotedStatecCs|jj}|dkr|j|_n|dkrN|jjtddd|jdd7<n|dkr|jjtdd dd |jd <|jj|j|j|_nR|t kr|jjtdd dd |jd <|jj|j|j|_n|jd|7<d S)Nrr[r"zinvalid-codepoint)r#r$ru�rjzunexpected-end-of-doctypeFrzeof-in-doctypeT) rr6rrr%r7rrrr)rr$r r r!rds*            z6HTMLTokenizer.doctypeSystemIdentifierSingleQuotedStatecCs|jj}|tkrn~|dkr4|jj|j|j|_n^|tkrt|jjt dddd|jd<|jj|j|j|_n|jjt ddd|j |_dS) Nrjr"zeof-in-doctype)r#r$Frzunexpected-char-in-doctypeT) rr6rr%r7rrrrrr)rr$r r r!r|s         z/HTMLTokenizer.afterDoctypeSystemIdentifierStatecCsZ|jj}|dkr*|jj|j|j|_n,|tkrV|jj||jj|j|j|_ndS)NrjT) rr6r%r7rrrrr=)rr$r r r!rs    zHTMLTokenizer.bogusDoctypeStatecCsg}x|j|jjd|j|jjd|jj}|tkr@Pq|dksLt|ddddkrx|ddd|d<Pq|j|qWdj|}|jd}|dkrx&t|D]}|j jt d d d qW|j dd }|r|j jt d |d |j |_ dS)N]rjrz]]r,r[rr"zinvalid-codepoint)r#r$u�rJTrKrKrrK)r7rr^r6rAssertionErrorr9countranger%rrrr)rr$r6Z nullCountrr r r!rs0        zHTMLTokenizer.cdataSectionState)N)NF)N__name__ __module__ __qualname____doc__rr)rBrSrTrZrr\rbr`rdrfrgr]rmrnrarsrtrcrwrxreryr{rzr}rrr~rrrrrrrrrrprrrrrrrrqrorlrrrrrrrrrrrrrrrrrrrrrrr __classcell__r r )rr!rs H P#         6 "-3rN)Z __future__rrrZpip._vendor.sixrr; collectionsrZ constantsrr r r r r rrrrZ _inputstreamrZ_trierrLobjectrr r r r!s       html5lib/__pycache__/_utils.cpython-36.opt-1.pyc000064400000006234152347724720015402 0ustar003 Pf@sddlmZmZmZddlZddlmZddlmZyddl j j Z Wn e k rdddlj jZ YnXddddd d d gZejdd koejd dkZyedZeeesedZWndZYnXdZGdddeZddZddZdd ZddZdS))absolute_importdivisionunicode_literalsN) ModuleType) text_type default_etreeMethodDispatcherisSurrogatePairsurrogatePairToCodepointmoduleFactoryFactorysupports_lone_surrogatesPY27z"\uD800"z u"\uD800"FTc@s$eZdZdZffddZddZdS)rapDict 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. cCsjg}xN|D]F\}}t|ttttfrBx*|D]}|j||fq*Wq |j||fq Wtj||d|_dS)N) isinstancelisttuple frozensetsetappenddict__init__default)selfitemsZ _dictEntriesnamevalueitemr/usr/lib/python3.6/_utils.pyr4s  zMethodDispatcher.__init__cCstj|||jS)N)rgetr)rkeyrrr __getitem__CszMethodDispatcher.__getitem__N)__name__ __module__ __qualname____doc__rr#rrrr r's  cCsLt|dkoJt|ddkoJt|ddkoJt|ddkoJt|ddkS)Nrriirii)lenord)datarrr r Js  cCs,dt|dddt|dd}|S)Niriiri)r))r*Zchar_valrrr r Pscsifdd}|S)Nc sttjtdrd|j}n d|j}t|j}y|||Stk rt|}|f||}|jj|dkri|<d|kri||<d||kri|||<||||<|SXdS)Nz _%s_factorys _%s_factoryrargskwargs) rrr$typerrKeyError__dict__update)Z baseModuler,r-rZ kwargs_tuplemodZobjs)factory moduleCacherr moduleFactory\s$      z+moduleFactoryFactory..moduleFactoryr)r3r5r)r3r4r r Yscsifdd}|S)Ncs2t|t|jf}|kr*|||<|S)N)rr)r,r-r")cachefuncrr wrappedyszmemoize..wrappedr)r7r8r)r6r7r memoizevsr9)Z __future__rrrsystypesrZpip._vendor.sixrZxml.etree.cElementTreeZetreeZ cElementTreer ImportErrorZxml.etree.ElementTreeZ ElementTree__all__ version_infor evalZ_xrr rrr r r r9rrrr s0    # html5lib/__pycache__/_inputstream.cpython-36.opt-1.pyc000064400000053240152347724720016614 0ustar003 Pf)@sddlmZmZmZddlmZmZddlmZm Z ddl Z ddl Z ddl m Z ddlmZmZmZmZddlmZdd lmZdd lmZydd lmZWnek reZYnXed d eDZedd eDZedd eDZeeddgBZdZej r(e j!eddFe"ddZ#n e j!eZ#e$dddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4g Z%e j!d5Z&iZ'Gd6d7d7e(Z)d8d9Z*Gd:d;d;e(Z+Gdd?d?e-Z.Gd@dAdAe(Z/GdBdCdCe(Z0dDdEZ1dS)G)absolute_importdivisionunicode_literals) text_type binary_type) http_clienturllibN) webencodings)EOFspaceCharacters asciiLettersasciiUppercase)ReparseException)_utils)StringIO)BytesIOcCsg|]}|jdqS)ascii)encode).0itemr"/usr/lib/python3.6/_inputstream.py srcCsg|]}|jdqS)r)r)rrrrrrscCsg|]}|jdqS)r)r)rrrrrrs>.)sumr )r"rrr_bufferedBytes^szBufferedStream._bufferedBytescCs<|jj|}|jj||jdd7<t||jd<|S)Nrr )rr.r appendr!r$)r"r-datarrrr+as   zBufferedStream._readStreamcCs|}g}|jd}|jd}x|t|jkr|dkr|j|}|t||krb|}|||g|_n"t||}|t|g|_|d7}|j||||||8}d}qW|r|j|j|dj|S)Nrr )r!r$r r1r+join)r"r-ZremainingBytesrvZ bufferIndexZ bufferOffsetZ bufferedDataZ bytesToReadrrrr,hs$    zBufferedStream._readFromBufferN) __name__ __module__ __qualname____doc__r#r'r*r.r0r+r,rrrrr9s  rcKst|tjs(t|tjjr.t|jtjr.d}n&t|drJt|jdt }n t|t }|rdd|D}|rvt d|t |f|St |f|SdS)NFr.rcSsg|]}|jdr|qS)Z _encoding)endswith)rxrrrrsz#HTMLInputStream..z3Cannot set an encoding with a unicode input, set %r) isinstancerZ HTTPResponserZresponseZaddbasefphasattrr.r TypeErrorHTMLUnicodeInputStreamHTMLBinaryInputStream)sourcekwargsZ isUnicodeZ encodingsrrrHTMLInputStreams     rDc@speZdZdZdZddZddZddZd d Zd d Z d dZ dddZ ddZ ddZ dddZddZdS)r@zProvides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. i(cCsZtjsd|_ntddkr$|j|_n|j|_dg|_tddf|_|j ||_ |j dS)aInitialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) Nu􏿿r rzutf-8certain) rsupports_lone_surrogatesreportCharacterErrorsr$characterErrorsUCS4characterErrorsUCS2ZnewLineslookupEncoding charEncoding openStream dataStreamreset)r"rBrrrr#s   zHTMLUnicodeInputStream.__init__cCs.d|_d|_d|_g|_d|_d|_d|_dS)Nr)r& chunkSize chunkOffseterrors prevNumLines prevNumCols_bufferedCharacter)r"rrrrNszHTMLUnicodeInputStream.resetcCst|dr|}nt|}|S)zvProduces a file object from source. source can be either a file object, local filename or a string. r.)r>r)r"rBrrrrrLs z!HTMLUnicodeInputStream.openStreamcCsT|j}|jdd|}|j|}|jdd|}|dkr@|j|}n ||d}||fS)N rr r)r&countrSrfindrT)r"r(r&ZnLinesZ positionLineZ lastLinePosZpositionColumnrrr _positions   z HTMLUnicodeInputStream._positioncCs|j|j\}}|d|fS)z:Returns (line, col) of the current position in the stream.r )rYrQ)r"linecolrrrr!szHTMLUnicodeInputStream.positioncCs6|j|jkr|jstS|j}|j|}|d|_|S)zo Read one character from the stream or queue if available. Return EOF when EOF is reached. r )rQrP readChunkr r&)r"rQcharrrrr]s   zHTMLUnicodeInputStream.charNcCs|dkr|j}|j|j\|_|_d|_d|_d|_|jj|}|j rX|j |}d|_ n|s`dSt |dkrt |d }|dksd|kodknr|d |_ |dd}|j r|j ||j dd }|j d d }||_t ||_d S)NrOrFr iiz rV Trrr)_defaultChunkSizerYrPrSrTr&rQrMr.rUr$ordrGreplace)r"rPr2Zlastvrrrr\s0           z HTMLUnicodeInputStream.readChunkcCs,x&tttj|D]}|jjdqWdS)Nzinvalid-codepoint)ranger$invalid_unicode_refindallrRr1)r"r2_rrrrH%sz*HTMLUnicodeInputStream.characterErrorsUCS4cCsd}xtj|D]}|rqt|j}|j}tj|||drttj|||d}|tkrn|j j dd}q|dkr|dkr|t |dkr|j j dqd}|j j dqWdS)NFzinvalid-codepointTiir ) rdfinditerragroupstartrZisSurrogatePairZsurrogatePairToCodepointnon_bmp_invalid_codepointsrRr1r$)r"r2skipmatchZ codepointr%Zchar_valrrrrI)s   z*HTMLUnicodeInputStream.characterErrorsUCS2Fc Csyt||f}WnNtk r^djdd|D}|s@d|}tjd|}t||f<YnXg}x||j|j|j}|dkr|j|jkrPn0|j }||jkr|j |j|j|||_P|j |j|jd|j sfPqfWdj|}|S)z Returns a string of characters from the stream up to but not including any character in 'characters' or EOF. 'characters' must be a container that supports the 'in' method and iteration over its characters. rOcSsg|]}dt|qS)z\x%02x)ra)rcrrrrNsz5HTMLUnicodeInputStream.charsUntil..z^%sz[%s]+N) charsUntilRegExKeyErrorr4recompilermr&rQrPendr1r\) r"Z charactersZoppositecharsZregexr5mrsrrrr charsUntil@s.    z!HTMLUnicodeInputStream.charsUntilcCs@|dk r<|jdkr.||j|_|jd7_n|jd8_dS)Nrr )rQr&rP)r"r]rrrungetos   zHTMLUnicodeInputStream.unget)N)F)r6r7r8r9r`r#rNrLrYr!r]r\rHrIrwrxrrrrr@s   & /r@c@sLeZdZdZdddZddZd d Zdd d Zd dZddZ ddZ dS)rAzProvides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. N windows-1252TcCs\|j||_tj||jd|_d|_||_||_||_||_ ||_ |j ||_ |j dS)aInitialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) idN)rL rawStreamr@r# numBytesMetanumBytesChardetoverride_encodingtransport_encodingsame_origin_parent_encodinglikely_encodingdefault_encodingdetermineEncodingrKrN)r"rBr~rrrrZ useChardetrrrr#s  zHTMLBinaryInputStream.__init__cCs&|jdjj|jd|_tj|dS)Nrrb)rKZ codec_info streamreaderr{rMr@rN)r"rrrrNszHTMLBinaryInputStream.resetc CsDt|dr|}nt|}y|j|jWnt|}YnX|S)zvProduces a file object from source. source can be either a file object, local filename or a string. r.)r>rr*r'r)r"rBrrrrrLs z HTMLBinaryInputStream.openStreamc Cs|jdf}|ddk r|St|jdf}|ddk r:|St|jdf}|ddk rX|S|jdf}|ddk rt|St|jdf}|ddk r|djjd r|St|jdf}|ddk r|S|rdyddl m }Wnt k rYnxXg}|}x6|j s.|j j|j}|sP|j||j|qW|jt|jd}|j jd|dk rd|dfSt|jdf}|ddk r|StddfS)NrErZ tentativezutf-16)UniversalDetectorencodingz windows-1252) detectBOMrJr~rdetectEncodingMetarname startswithrZchardet.universaldetectorr ImportErrordoner{r.r}r1Zfeedcloseresultr*r)r"ZchardetrKrZbuffersZdetectorr rrrrrsP           z'HTMLBinaryInputStream.determineEncodingcCst|}|dkrdS|jdkr(td}nT||jdkrH|jddf|_n4|jjd|df|_|jtd|jd|fdS)Nutf-16beutf-16lezutf-8rrEzEncoding changed from %s to %s)rr)rJrrKr{r*rNr)r"Z newEncodingrrrchangeEncodings   z$HTMLBinaryInputStream.changeEncodingc Cstjdtjdtjdtjdtjdi}|jjd}|j|dd}d}|sp|j|}d}|sp|j|dd }d }|r|jj |t |S|jj d dSdS) zAttempts to detect at BOM at the start of the stream. If an encoding can be determined from the BOM return the name of the encoding otherwise return Nonezutf-8zutf-16lezutf-16bezutf-32lezutf-32beNrgr) codecsBOM_UTF8 BOM_UTF16_LE BOM_UTF16_BE BOM_UTF32_LE BOM_UTF32_BEr{r.getr*rJ)r"ZbomDictstringrr*rrrrs"     zHTMLBinaryInputStream.detectBOMcCsH|jj|j}t|}|jjd|j}|dk rD|jdkrDtd}|S)z9Report the encoding declared by the meta element rNutf-16beutf-16lezutf-8)rr)r{r.r|EncodingParserr* getEncodingrrJ)r"r parserrrrrr9s z(HTMLBinaryInputStream.detectEncodingMeta)NNNNryT)T) r6r7r8r9r#rNrLrrrrrrrrrAs ( >"rAc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e e e Z ddZe eZefddZddZddZddZdS) EncodingByteszString-like object with an associated position and various extra methods If the position is ever greater than the string length then an exception is raisedcCstj||jS)N)r-__new__lower)r"valuerrrrLszEncodingBytes.__new__cCs d|_dS)Nr r)rY)r"rrrrr#PszEncodingBytes.__init__cCs|S)Nr)r"rrr__iter__TszEncodingBytes.__iter__cCs>|jd}|_|t|kr"tn |dkr.t|||dS)Nr r)rYr$ StopIterationr?)r"prrr__next__Ws  zEncodingBytes.__next__cCs|jS)N)r)r"rrrnext_szEncodingBytes.nextcCsB|j}|t|krtn |dkr$t|d|_}|||dS)Nrr )rYr$rr?)r"rrrrpreviouscs zEncodingBytes.previouscCs|jt|krt||_dS)N)rYr$r)r"r!rrr setPositionlszEncodingBytes.setPositioncCs*|jt|krt|jdkr"|jSdSdS)Nr)rYr$r)r"rrr getPositionqs  zEncodingBytes.getPositioncCs||j|jdS)Nr )r!)r"rrrgetCurrentByte{szEncodingBytes.getCurrentBytecCsL|j}x:|t|kr@|||d}||kr6||_|S|d7}qW||_dS)zSkip past a list of charactersr N)r!r$rY)r"rtrrnrrrrls zEncodingBytes.skipcCsL|j}x:|t|kr@|||d}||kr6||_|S|d7}qW||_dS)Nr )r!r$rY)r"rtrrnrrr skipUntils zEncodingBytes.skipUntilcCs>|j}|||t|}|j|}|r:|jt|7_|S)zLook for a sequence of bytes at the start of a string. If the bytes are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone)r!r$r)r"r-rr2r5rrr matchBytess  zEncodingBytes.matchBytescCsR||jdj|}|dkrJ|jdkr,d|_|j|t|d7_dStdS)zLook for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the matchNr rTrr)r!findrYr$r)r"r-Z newPositionrrrjumpTos zEncodingBytes.jumpToN)r6r7r8r9rr#rrrrrrpropertyr!r currentBytespaceCharactersBytesrlrrrrrrrrHs      rc@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dS)rz?Mini parser for detecting character encoding from meta elementscCst||_d|_dS)z3string - the data to work on for encoding detectionN)rr2r)r"r2rrrr#s zEncodingParser.__init__c Csd|jfd|jfd|jfd|jfd|jfd|jff}x^|jD]T}d}xD|D]<\}}|jj|rJy |}PWqJtk rd}PYqJXqJW|s)r2r)r"rrrrszEncodingParser.handleCommentcCs|jjtkrdSd}d}x|j}|dkr.dS|ddkr^|ddk}|r|dk r||_dSq|ddkr|d}t|}|dk r||_dSq|ddkrtt|d}|j}|dk rt|}|dk r|r||_dS|}qWdS) NTFrs http-equivr s content-typescharsetscontent) r2rr getAttributerrJContentAttrParserrparse)r"Z hasPragmaZpendingEncodingattrZtentativeEncodingcodecZ contentParserrrrrs:      zEncodingParser.handleMetacCs |jdS)NF)handlePossibleTag)r"rrrrsz%EncodingParser.handlePossibleStartTagcCst|j|jdS)NT)rr2r)r"rrrrs z#EncodingParser.handlePossibleEndTagcCsf|j}|jtkr(|r$|j|jdS|jt}|dkrD|jn|j}x|dk r`|j}qNWdS)NTr)r2rasciiLettersBytesrrrspacesAngleBracketsr)r"ZendTagr2rnrrrrrs     z EncodingParser.handlePossibleTagcCs |jjdS)Nr)r2r)r"rrrrszEncodingParser.handleOthercCs|j}|jttdgB}|dkr&dSg}g}xt|dkr@|r@PnX|tkrT|j}PnD|d krjdj|dfS|tkr|j|jn|dkrdS|j|t|}q0W|dkr|j dj|dfSt||j}|d kr:|}xt|}||krt|dj|dj|fS|tkr*|j|jq|j|qWnJ|dkrRdj|dfS|tkrl|j|jn|dkrzdS|j|x^t|}|t krdj|dj|fS|tkr|j|jn|dkrdS|j|qWdS) z_Return a name,value pair for the next attribute in the stream, if one is found, or None/rN=r3'")rN)rr)rr) r2rlr frozensetr4asciiUppercaseBytesr1rrrr)r"r2rnZattrNameZ attrValueZ quoteCharrrrrsf             zEncodingParser.getAttributeN) r6r7r8r9r#rrrrrrrrrrrrrs$rc@seZdZddZddZdS)rcCs ||_dS)N)r2)r"r2rrrr#fszContentAttrParser.__init__cCsy|jjd|jjd7_|jj|jjdks8dS|jjd7_|jj|jjdkr|jj}|jjd7_|jj}|jj|r|j||jjSdSnF|jj}y|jjt|j||jjStk r|j|dSXWntk rdSXdS)Nscharsetr rrr)rr)r2rr!rlrrrr)r"Z quoteMarkZ oldPositionrrrrjs.       zContentAttrParser.parseN)r6r7r8r#rrrrrresrcCs`t|tr.y|jd}Wntk r,dSX|dk rXy tj|Stk rTdSXndSdS)z{Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.rN)r<rdecodeUnicodeDecodeErrorr lookupAttributeError)rrrrrJs  rJr)2Z __future__rrrZpip._vendor.sixrrZpip._vendor.six.movesrrrrqZ pip._vendorr Z constantsr r r rrrOriorrrrrrrrZinvalid_unicode_no_surrogaterFrrevalrdsetrkZascii_punctuation_reroobjectrrDr@rAr-rrrrJrrrrsV               JgIh6'html5lib/__pycache__/constants.cpython-36.opt-1.pyc000064400000201300152347724720016106 0ustar003 PfE@s-ddlmZmZmZddlZdZddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d,d,d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddZdddddddZeeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfgZ eeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfgZ eeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfgNZ eeddfeddfeddfeddfgZ eeddfeddfeddfeddfeddfgZ ddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/>Zd0d1iZd2d3ed2fd2d4ed2fd2d5ed2fd2d6ed2fd2d7ed2fd2ded2fd2d8ed2fd9ded9fd9d:ed9fd9d;ed9fddd?ejDZed@dAdBdCdDgZedddddgZeejZeejZeejZeejZeejZedEd?ejDZd|Z edddFddddddddddԐdGdHgZ!eddgZ"edddddddgZ#edIgedJgedKgedLdMgedLdMgedNdOgedPgedQdRgedSdRdTdUgedVgedWgedRdXgedRdXdYgedRdXgedRdZgedRdXd[dZdTdKgedRdXdZdQgedRdXgd\Z$d}Z%edydzd{d|d}gZ&d~d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddÐdĐdŐdƐdǐdȐdɐdʐdːd̐d͐dΐdϐdАdѐdҐdӐddѐdԐdՐd֐dÐdאdؐdِdڐdېdܐdݐdސdߐdddddddddddddԐddddddddddddddddddddddddddddddddddd d d d d d dddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d(d+dd,d-d.d/d0d0d1d1d2d3d4d5d5d4d6d7dڐd8d9d:d;d<d=d>d?d@dAdBdCdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdՐd֐dudvdwdxdydzd{d|d}d~ddddאdؐdِddddXdddddddddddddddddddddd"ddAddddddddddddddddddddddddddddddddddddddddddddddÐ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ߐdddddddddddddddddd'ddddddddddddddddddddddddddddddd dd d d d ddddddddddddddddddd dڐd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0dߐd^d d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d?d@dAdBdCdDddEdFdGdHdFdIdIdJdKdLd@dMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d^d_d`dadbdcdcdddedfdgdgdhdidjdkdldmdndodpd1dqdrdsdtdudvdܐdݐdwdxdydzd{d|d}d~d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddɐdɐddddddddddddddddddddddddddÐdĐdŐdƐdǐdȐdɐdʐdːd̐dd͐dΐdϐdYdАdѐdҐdӐdԐdYdҐdՐdՐd֐dאdYddؐdؐdِdِddڐdېdܐdݐdސdߐdddddkddܐddddddݐdddddd:ddmddddddddddddd ddddddddddddddududdddddd d d d d dddddddddddddddd*dddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.dސdd/d/d0d1dߐdd2d3d4d5d5dd6d,d,d7d8d9d:d;d<d=d>d?d$d@dAdBdBdCdDdEdFdddGdHdHddIdJdKdKdLdMdNdOdPdQdRddSdTdUdVdPdWdXdYdZdZd[ddd\d]d^d3d^ddXd_dd`ddddadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdldmdydzd{d{dndwdydzdd|d}dԐd~dddߐddiddːdddϐdddddddddddddΐdΐdddѐdddddddddddddʐdӐddddddߐdddddddddddddddd ddddddddddddddddddddddddddddddddddddddddddÐdĐdĐdŐddddddƐdǐddȐdɐdʐdːd̐dӐdd͐dΐdΐdϐdϐdАdѐdddddҐdӐdԐdՐd֐dאdؐdِdڐdېdܐdݐdސd dߐddddddddddddddddddddddddddddddddddddddddddddddd"ddddddddd d d d dd d d̐d d dddddddddddddddd ddd֐ddd(ddgdddddddddd d!d"d#d$d%d&d'd(dd)d*dd+d+d;d,d,d-d.d/d/d֐d0d1d1d7d2d3d4d5d6d7d4d@d4d8d9d:dd;d<d=d8d9d>dd>d?d@dAdBdCdDd@dEdEdFddGdHdIdJdd<dKdLdMdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d}dՐd`dadvdbdcdddedXdfd]dgd]dhdidid^d_djdkd$dldmdndodpdqdrdsdtdudvdwdxdydzd{d|dadvd}d~dܐdddddd^doddsddgd`dddduddvdydydddddddhddudbdwdzddfddwdddsdddddddddddddddddddddbdddddldddddddidddddd`dddddddddzdddwdݐdddTdTddddddddddndddddddddddddddjdvddddddddÐdÐddאdĐdddŐd!ddƐdǐdddȐdɐddʐddːd̐d̐d͐dΐddϐdАdѐdҐddӐdԐdՐdƐd֐dאd̐dؐdِdڐd̐dېdېddddddܐdݐdސdːdߐdddddddxdxdddddddddddddddddАddddddddϐdddddddddddddddd͐ddddddddddddddddddddddddӐdddddddÐdŐdĐdd͐ddɐdʐdʐd͐ddddddddddÐdĐdddȐdǐdȐddddddddddddddd d d d d dddddddddddwdwddSdddTdUddddVdddddd d!d"d#d#d$d%dِddQd&d'dd(d)d*d+d,dd-d.d/dd0dRd1d2d2d3d3d4d4d5d6d7d8d2d9d9d:d;d;dd<d=d=d>dސd?d?dސd@dAddBdCdDdEdudFdGdHdIddJdKdߐdLddMddNdOd"dPddQdRdddSdTddUdVdWdWddXdYddddYdddZd[d\dd]dd[dZd\dd^d_d`ddddadbdcddded2dfdgdhd)didjdǐddd#dڐdkddldmdnd5dod dpdqd drdrd dsd dtdudvd%ddwdxdydzd{d|ddd}d~dddddddd~dddddddd$dd!dddddddddddd dyddddddzdddʐdddddddddddddddddddd%ddddddddddddddAddddCdBdddddddDdddddd ddddddddddddddddސddddddVddWdWdddddÐdĐdŐd^ddƐdǐddȐdɐdʐdːd̐d͐dΐdϐdАdѐdѐdސd7dҐd<dӐd8d9d8d9d:d;d:d;d6d6d d d dԐddȐd>dՐddŐdIdd֐dאdؐd@dِdڐdېdܐdݐdސd֐d@dאdܐdېdߐdddAddCdBddddDdEddddddddGddddHdddddddddGdHdddddddd!dddddddddddd[dddRdRddddYdVdUdYdVddd͐ddd#ddd3dddddddddJd dddnd ddd d d d dddddddddYddܐdddd1ddddddrddtdddddqddd d d!d"d#dѐdѐd$d%d1dsdqddnd&dyd&d'd(d(d)d*d+d,d-d.d dd'd/d/d0dݐd1d2dېd3dŐdWddIdLddsddd4d5d6d7ddldd8dd0d9d:d;ddd<dlddǐd=ddd>d5d4d7d6d?d@dAddBdCdDdEdCdddFd:ddmddGdؐddHdאdddIddJdddِddKddddddLdLdMdNdOdPdPdQdRdSdTdUdVdVdWdXdYdZdd[d\d]d^d_d`dadbdcZ'dddDdАdeddݐdddddOdEd,ddѐdfddgdhdݐddܐdd5ddd͐dJddddidXddj"Z(ddkdldmdndodpdqdrZ)ee)dse)dte)dugZ*edvd?ejDZ+dwe+d<Gdxdydye,Z-Gdzd{d{e.Z/dS(~)absolute_importdivisionunicode_literalsNz5Null character in input stream, replaced with U+FFFD.zInvalid codepoint in stream.z&Solidus (/) incorrectly placed in tag.z.Incorrect CR newline entity, replaced with LF.z9Entity used with illegal number (windows-1252 reference).zPNumeric entity couldn't be converted to character (codepoint U+%(charAsInt)08x).zBNumeric entity represents an illegal codepoint: U+%(charAsInt)08x.z#Numeric entity didn't end with ';'.z1Numeric entity expected. Got end of file instead.z'Numeric entity expected but none found.z!Named entity didn't end with ';'.z Named entity expected. Got none.z'End tag contains unexpected attributes.z.End tag contains unexpected self-closing flag.z#Expected tag name. Got '>' instead.zSExpected tag name. Got '?' instead. (HTML doesn't support processing instructions.)z-Expected tag name. Got something else insteadz6Expected closing tag. Got '>' instead. Ignoring ''.z-Expected closing tag. Unexpected end of file.z' instead.z"Unexpected = in unquoted attributez*Unexpected character in unquoted attributez*Unexpected character after attribute name.z+Unexpected character after attribute value.z.Unexpected end of file in attribute value (").z.Unexpected end of file in attribute value (').z*Unexpected end of file in attribute value.z)Unexpected end of file in tag. Expected >z/Unexpected character after / in tag. Expected >z&Expected '--' or 'DOCTYPE'. Not found.z Unexpected ! after -- in commentz$Unexpected space after -- in commentzIncorrect comment.z"Unexpected end of file in comment.z%Unexpected end of file in comment (-)z+Unexpected '-' after '--' found in comment.z'Unexpected end of file in comment (--).z&Unexpected character in comment found.z(No space after literal string 'DOCTYPE'.z.Unexpected > character. Expected DOCTYPE name.z.Unexpected end of file. Expected DOCTYPE name.z'Unexpected end of file in DOCTYPE name.z"Unexpected end of file in DOCTYPE.z%Expected space or '>'. Got '%(data)s'zUnexpected end of DOCTYPE.z Unexpected character in DOCTYPE.zXXX innerHTML EOFzUnexpected DOCTYPE. Ignored.z%html needs to be the first start tag.z)Unexpected End of file. Expected DOCTYPE.zErroneous DOCTYPE.z2Unexpected non-space characters. Expected DOCTYPE.z2Unexpected start tag (%(name)s). Expected DOCTYPE.z0Unexpected end tag (%(name)s). Expected DOCTYPE.z?Unexpected end tag (%(name)s) after the (implied) root element.z4Unexpected end of file. Expected end tag (%(name)s).z4Unexpected start tag head in existing head. Ignored.z'Unexpected end tag (%(name)s). Ignored.z;Unexpected start tag (%(name)s) that can be in head. Moved.z Unexpected start tag (%(name)s).zMissing end tag (%(name)s).zMissing end tags (%(name)s).zCUnexpected start tag (%(startName)s) implies end tag (%(endName)s).z@Unexpected start tag (%(originalName)s). Treated as %(newName)s.z,Unexpected start tag %(name)s. Don't use it!z'Unexpected start tag %(name)s. Ignored.zEUnexpected end tag (%(gotName)s). Missing end tag (%(expectedName)s).z:End tag (%(name)s) seen too early. Expected other end tag.zFUnexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).z+End tag (%(name)s) seen too early. Ignored.zQEnd tag (%(name)s) violates step 1, paragraph 1 of the adoption agency algorithm.zQEnd tag (%(name)s) violates step 1, paragraph 2 of the adoption agency algorithm.zQEnd tag (%(name)s) violates step 1, paragraph 3 of the adoption agency algorithm.zQEnd tag (%(name)s) violates step 4, paragraph 4 of the adoption agency algorithm.z>Unexpected end tag (%(originalName)s). Treated as %(newName)s.z'This element (%(name)s) has no end tag.z9Unexpected implied end tag (%(name)s) in the table phase.z>Unexpected implied end tag (%(name)s) in the table body phase.zDUnexpected non-space characters in table context caused voodoo mode.z3Unexpected input with type hidden in table context.z!Unexpected form in table context.zDUnexpected start tag (%(name)s) in table context caused voodoo mode.zBUnexpected end tag (%(name)s) in table context caused voodoo mode.zCUnexpected table cell start tag (%(name)s) in the table body phase.zFGot table cell end tag (%(name)s) while required end tags are missing.z?Unexpected end tag (%(name)s) in the table body phase. Ignored.z=Unexpected implied end tag (%(name)s) in the table row phase.z>Unexpected end tag (%(name)s) in the table row phase. Ignored.zJUnexpected select start tag in the select phase treated as select end tag.z/Unexpected input start tag in the select phase.zBUnexpected start tag token (%(name)s in the select phase. Ignored.z;Unexpected end tag (%(name)s) in the select phase. Ignored.zKUnexpected table element start tag (%(name)s) in the select in table phase.zIUnexpected table element end tag (%(name)s) in the select in table phase.z8Unexpected non-space characters in the after body phase.z>Unexpected start tag token (%(name)s) in the after body phase.zZ attributenameZ attributetypeZ basefrequencyZ baseprofileZcalcmodeZ clippathunitsZcontentscripttypeZcontentstyletypeZdiffuseconstantZedgemodeZexternalresourcesrequiredZ filterresZ filterunitsZglyphrefZgradienttransformZ gradientunitsZ kernelmatrixZkernelunitlengthZ keypointsZ keysplinesZkeytimesZ lengthadjustZlimitingconeangleZ markerheightZ markerunitsZ markerwidthZmaskcontentunitsZ maskunitsZ numoctavesZ pathlengthZpatterncontentunitsZpatterntransformZ patternunitsZ pointsatxZ pointsatyZ pointsatzZ preservealphaZpreserveaspectratioZprimitiveunitsZrefxZrefyZ repeatcountZ repeatdurZrequiredextensionsZrequiredfeaturesZspecularconstantZspecularexponentZ spreadmethodZ startoffsetZ stddeviationZ stitchtilesZ surfacescaleZsystemlanguageZ tablevaluesZtargetxZtargetyZ textlengthZviewboxZ viewtargetZxchannelselectorZychannelselectorZ zoomandpanZ definitionurlZ definitionURLrZactuateZarcroleZhrefZroleZshowtyper ZlangZspacer ) z xlink:actuatez xlink:arcrolez xlink:hrefz xlink:rolez xlink:showz xlink:titlez xlink:typezxml:basezxml:langz xml:spacer z xmlns:xlinkcCs"g|]\}\}}}||f|fqSr2).0ZqnameprefixZlocalnsr2r2/usr/lib/python3.6/constants.py sr7     cCs g|]}t|t|jfqSr2)ordlower)r3cr2r2r6r7#sz event-sourcesourceZtrackZ irrelevantZscopedZismapZautoplayZcontrolsZdeferasyncopenZmultipleZdisabledZhiddenZcheckeddefaultZnoshadeZ autosubmitreadonlyZselectedZ autofocusZrequired)r0r(ZaudioZvideor.rZdatagridrr'r+rZoptionZoptgrouprr)r/output   & ! 0 `9 R}    "   "!a: S~xzlt;zgt;zamp;zapos;zquot;Æ&ÁuĂÂuАu𝔄ÀuΑuĀu⩓uĄu𝔸u⁡Åu𝒜u≔ÃÄu∖u⫧u⌆uБu∵uℬuΒu𝔅u𝔹u˘u≎uЧ©uĆu⋒uⅅuℭuČÇuĈu∰uĊ¸·uΧu⊙u⊖u⊕u⊗u∲u”u’u∷u⩴u≡u∯u∮uℂu∐u∳u⨯u𝒞u⋓u≍u⤑uЂuЅuЏu‡u↡u⫤uĎuДu∇uΔu𝔇´u˙u˝`u˜u⋄uⅆu𝔻¨u⃜u≐u⇓u⇐u⇔u⟸u⟺u⟹u⇒u⊨u⇑u⇕u∥u↓u⤓u⇵ȗu⥐u⥞u↽u⥖u⥟u⇁u⥗u⊤u↧u𝒟uĐuŊÐÉuĚÊuЭuĖu𝔈Èu∈uĒu◻u▫uĘu𝔼uΕu⩵u≂u⇌uℰu⩳uΗËu∃uⅇuФu𝔉u◼u▪u𝔽u∀uℱuЃ>uΓuϜuĞuĢuĜuГuĠu𝔊u⋙u𝔾u≥u⋛u≧u⪢u≷u⩾u≳u𝒢u≫uЪuˇ^uĤuℌuℋuℍu─uĦu≏uЕuIJuЁÍÎuИuİuℑÌuĪuⅈu∬u∫u⋂u⁣u⁢uĮu𝕀uΙuℐuĨuІÏuĴuЙu𝔍u𝕁u𝒥uЈuЄuХuЌuΚuĶuКu𝔎u𝕂u𝒦uЉ⃒u⧞u⤂u≤⃒u<⃒u⊴⃒u⤃u⊵⃒u∼⃒u⇖u⤣u⤧óôuоuőu⨸u⦼uœu⦿u𝔬u˛òu⧁u⦵u⦾u⦻u⧀uōuωuοu⦶u𝕠u⦷u⦹u∨u⩝uℴªºu⊶u⩖u⩗u⩛øu⊘õu⨶öu⌽¶u⫳u⫽uп%.u‰u‱u𝔭uφuϕu☎uπuϖuℎ+u⨣u⨢u⨥u⩲u⨦u⨧u⨕u𝕡£u⪳u⪷u⪹u⪵u⋨u′u⌮u⌒u⌓u⊰u𝓅uψu u𝔮u𝕢u⁗u𝓆u⨖?u⤜u⥤u∽̱uŕu⦳u⦒u⦥»u⥵u⤠u⤳u⤞u⥅u⥴u↣u↝u⤚u∶u❳}]u⦌u⦎u⦐uřuŗuрu⤷u⥩u↳u▭u⥽u𝔯u⥬uρuϱu⇉u⋌u˚u‏u⎱u⫮u⟭u⇾u⦆u𝕣u⨮u⨵)u⦔u⨒u›u𝓇u⋊u▹u⧎u⥨u℞uśu⪴u⪸ušuşuŝu⪶u⪺u⋩u⨓uсu⋅u⩦u⇘§;u⤩u✶u𝔰u♯uщuш­uσuςu⩪u⪞u⪠u⪝u⪟u≆u⨤u⥲u⨳u⧤u⌣u⪪u⪬u⪬︀uь/u⧄u⌿u𝕤u♠u⊓︀u⊔︀u𝓈u☆u⊂u⫅u⪽u⫃u⫁u⫋u⊊u⪿u⥹u⫇u⫕u⫓u♪¹²³u⫆u⪾u⫘u⫄u⟉u⫗u⥻u⫂u⫌u⊋u⫀u⫈u⫔u⫖u⇙u⤪ßu⌖uτuťuţuтu⌕u𝔱uθuϑþ×u⨱u⨰u⌶u⫱u𝕥u⫚u‴u▵u≜u◬u⨺u⨹u⧍u⨻u⏢u𝓉uцuћuŧu⥣úuўuŭûuуuűu⥾u𝔲ùu▀u⌜u⌏u◸uūuųu𝕦uυu⇈u⌝u⌎uůu◹u𝓊u⋰uũüu⦧u⫨u⫩u⦜u⊊︀u⫋︀u⊋︀u⫌︀uвu⊻u≚u⋮u𝔳u𝕧u𝓋u⦚uŵu⩟u≙u℘u𝔴u𝕨u𝓌u𝔵uξu⋻u𝕩u𝓍ýuяuŷuы¥u𝔶uїu𝕪u𝓎uюÿuźužuзużuζu𝔷uжu⇝u𝕫u𝓏u‍u‌(ZAEligzAElig;ZAMPzAMP;ZAacutezAacute;zAbreve;ZAcirczAcirc;zAcy;zAfr;ZAgravezAgrave;zAlpha;zAmacr;zAnd;zAogon;zAopf;zApplyFunction;ZAringzAring;zAscr;zAssign;ZAtildezAtilde;ZAumlzAuml;z Backslash;zBarv;zBarwed;zBcy;zBecause;z Bernoullis;zBeta;zBfr;zBopf;zBreve;zBscr;zBumpeq;zCHcy;ZCOPYzCOPY;zCacute;zCap;zCapitalDifferentialD;zCayleys;zCcaron;ZCcedilzCcedil;zCcirc;zCconint;zCdot;zCedilla;z CenterDot;zCfr;zChi;z CircleDot;z CircleMinus;z CirclePlus;z CircleTimes;zClockwiseContourIntegral;zCloseCurlyDoubleQuote;zCloseCurlyQuote;zColon;zColone;z Congruent;zConint;zContourIntegral;zCopf;z Coproduct;z CounterClockwiseContourIntegral;zCross;zCscr;zCup;zCupCap;zDD;z DDotrahd;zDJcy;zDScy;zDZcy;zDagger;zDarr;zDashv;zDcaron;zDcy;zDel;zDelta;zDfr;zDiacriticalAcute;zDiacriticalDot;zDiacriticalDoubleAcute;zDiacriticalGrave;zDiacriticalTilde;zDiamond;zDifferentialD;zDopf;zDot;zDotDot;z DotEqual;zDoubleContourIntegral;z DoubleDot;zDoubleDownArrow;zDoubleLeftArrow;zDoubleLeftRightArrow;zDoubleLeftTee;zDoubleLongLeftArrow;zDoubleLongLeftRightArrow;zDoubleLongRightArrow;zDoubleRightArrow;zDoubleRightTee;zDoubleUpArrow;zDoubleUpDownArrow;zDoubleVerticalBar;z DownArrow;z DownArrowBar;zDownArrowUpArrow;z DownBreve;zDownLeftRightVector;zDownLeftTeeVector;zDownLeftVector;zDownLeftVectorBar;zDownRightTeeVector;zDownRightVector;zDownRightVectorBar;zDownTee;z DownTeeArrow;z Downarrow;zDscr;zDstrok;zENG;ZETHzETH;ZEacutezEacute;zEcaron;ZEcirczEcirc;zEcy;zEdot;zEfr;ZEgravezEgrave;zElement;zEmacr;zEmptySmallSquare;zEmptyVerySmallSquare;zEogon;zEopf;zEpsilon;zEqual;z EqualTilde;z Equilibrium;zEscr;zEsim;zEta;ZEumlzEuml;zExists;z ExponentialE;zFcy;zFfr;zFilledSmallSquare;zFilledVerySmallSquare;zFopf;zForAll;z Fouriertrf;zFscr;zGJcy;ZGTzGT;zGamma;zGammad;zGbreve;zGcedil;zGcirc;zGcy;zGdot;zGfr;zGg;zGopf;z GreaterEqual;zGreaterEqualLess;zGreaterFullEqual;zGreaterGreater;z GreaterLess;zGreaterSlantEqual;z GreaterTilde;zGscr;zGt;zHARDcy;zHacek;zHat;zHcirc;zHfr;z HilbertSpace;zHopf;zHorizontalLine;zHscr;zHstrok;z HumpDownHump;z HumpEqual;zIEcy;zIJlig;zIOcy;ZIacutezIacute;ZIcirczIcirc;zIcy;zIdot;zIfr;ZIgravezIgrave;zIm;zImacr;z ImaginaryI;zImplies;zInt;z Integral;z Intersection;zInvisibleComma;zInvisibleTimes;zIogon;zIopf;zIota;zIscr;zItilde;zIukcy;ZIumlzIuml;zJcirc;zJcy;zJfr;zJopf;zJscr;zJsercy;zJukcy;zKHcy;zKJcy;zKappa;zKcedil;zKcy;zKfr;zKopf;zKscr;zLJcy;ZLTzLT;zLacute;zLambda;zLang;z Laplacetrf;zLarr;zLcaron;zLcedil;zLcy;zLeftAngleBracket;z LeftArrow;z LeftArrowBar;zLeftArrowRightArrow;z LeftCeiling;zLeftDoubleBracket;zLeftDownTeeVector;zLeftDownVector;zLeftDownVectorBar;z LeftFloor;zLeftRightArrow;zLeftRightVector;zLeftTee;z LeftTeeArrow;zLeftTeeVector;z LeftTriangle;zLeftTriangleBar;zLeftTriangleEqual;zLeftUpDownVector;zLeftUpTeeVector;z LeftUpVector;zLeftUpVectorBar;z LeftVector;zLeftVectorBar;z Leftarrow;zLeftrightarrow;zLessEqualGreater;zLessFullEqual;z LessGreater;z LessLess;zLessSlantEqual;z LessTilde;zLfr;zLl;z Lleftarrow;zLmidot;zLongLeftArrow;zLongLeftRightArrow;zLongRightArrow;zLongleftarrow;zLongleftrightarrow;zLongrightarrow;zLopf;zLowerLeftArrow;zLowerRightArrow;zLscr;zLsh;zLstrok;zLt;zMap;zMcy;z MediumSpace;z Mellintrf;zMfr;z MinusPlus;zMopf;zMscr;zMu;zNJcy;zNacute;zNcaron;zNcedil;zNcy;zNegativeMediumSpace;zNegativeThickSpace;zNegativeThinSpace;zNegativeVeryThinSpace;zNestedGreaterGreater;zNestedLessLess;zNewLine;zNfr;zNoBreak;zNonBreakingSpace;zNopf;zNot;z NotCongruent;z NotCupCap;zNotDoubleVerticalBar;z NotElement;z NotEqual;zNotEqualTilde;z NotExists;z NotGreater;zNotGreaterEqual;zNotGreaterFullEqual;zNotGreaterGreater;zNotGreaterLess;zNotGreaterSlantEqual;zNotGreaterTilde;zNotHumpDownHump;z NotHumpEqual;zNotLeftTriangle;zNotLeftTriangleBar;zNotLeftTriangleEqual;zNotLess;z NotLessEqual;zNotLessGreater;z NotLessLess;zNotLessSlantEqual;z NotLessTilde;zNotNestedGreaterGreater;zNotNestedLessLess;z NotPrecedes;zNotPrecedesEqual;zNotPrecedesSlantEqual;zNotReverseElement;zNotRightTriangle;zNotRightTriangleBar;zNotRightTriangleEqual;zNotSquareSubset;zNotSquareSubsetEqual;zNotSquareSuperset;zNotSquareSupersetEqual;z NotSubset;zNotSubsetEqual;z NotSucceeds;zNotSucceedsEqual;zNotSucceedsSlantEqual;zNotSucceedsTilde;z NotSuperset;zNotSupersetEqual;z NotTilde;zNotTildeEqual;zNotTildeFullEqual;zNotTildeTilde;zNotVerticalBar;zNscr;ZNtildezNtilde;zNu;zOElig;ZOacutezOacute;ZOcirczOcirc;zOcy;zOdblac;zOfr;ZOgravezOgrave;zOmacr;zOmega;zOmicron;zOopf;zOpenCurlyDoubleQuote;zOpenCurlyQuote;zOr;zOscr;ZOslashzOslash;ZOtildezOtilde;zOtimes;ZOumlzOuml;zOverBar;z OverBrace;z OverBracket;zOverParenthesis;z PartialD;zPcy;zPfr;zPhi;zPi;z PlusMinus;zPoincareplane;zPopf;zPr;z Precedes;zPrecedesEqual;zPrecedesSlantEqual;zPrecedesTilde;zPrime;zProduct;z Proportion;z Proportional;zPscr;zPsi;ZQUOTzQUOT;zQfr;zQopf;zQscr;zRBarr;ZREGzREG;zRacute;zRang;zRarr;zRarrtl;zRcaron;zRcedil;zRcy;zRe;zReverseElement;zReverseEquilibrium;zReverseUpEquilibrium;zRfr;zRho;zRightAngleBracket;z RightArrow;zRightArrowBar;zRightArrowLeftArrow;z RightCeiling;zRightDoubleBracket;zRightDownTeeVector;zRightDownVector;zRightDownVectorBar;z RightFloor;z RightTee;zRightTeeArrow;zRightTeeVector;zRightTriangle;zRightTriangleBar;zRightTriangleEqual;zRightUpDownVector;zRightUpTeeVector;zRightUpVector;zRightUpVectorBar;z RightVector;zRightVectorBar;z Rightarrow;zRopf;z RoundImplies;z Rrightarrow;zRscr;zRsh;z RuleDelayed;zSHCHcy;zSHcy;zSOFTcy;zSacute;zSc;zScaron;zScedil;zScirc;zScy;zSfr;zShortDownArrow;zShortLeftArrow;zShortRightArrow;z ShortUpArrow;zSigma;z SmallCircle;zSopf;zSqrt;zSquare;zSquareIntersection;z SquareSubset;zSquareSubsetEqual;zSquareSuperset;zSquareSupersetEqual;z SquareUnion;zSscr;zStar;zSub;zSubset;z SubsetEqual;z Succeeds;zSucceedsEqual;zSucceedsSlantEqual;zSucceedsTilde;z SuchThat;zSum;zSup;z Superset;zSupersetEqual;zSupset;ZTHORNzTHORN;zTRADE;zTSHcy;zTScy;zTab;zTau;zTcaron;zTcedil;zTcy;zTfr;z Therefore;zTheta;z ThickSpace;z ThinSpace;zTilde;z TildeEqual;zTildeFullEqual;z TildeTilde;zTopf;z TripleDot;zTscr;zTstrok;ZUacutezUacute;zUarr;z Uarrocir;zUbrcy;zUbreve;ZUcirczUcirc;zUcy;zUdblac;zUfr;ZUgravezUgrave;zUmacr;z UnderBar;z UnderBrace;z UnderBracket;zUnderParenthesis;zUnion;z UnionPlus;zUogon;zUopf;zUpArrow;z UpArrowBar;zUpArrowDownArrow;z UpDownArrow;zUpEquilibrium;zUpTee;z UpTeeArrow;zUparrow;z Updownarrow;zUpperLeftArrow;zUpperRightArrow;zUpsi;zUpsilon;zUring;zUscr;zUtilde;ZUumlzUuml;zVDash;zVbar;zVcy;zVdash;zVdashl;zVee;zVerbar;zVert;z VerticalBar;z VerticalLine;zVerticalSeparator;zVerticalTilde;zVeryThinSpace;zVfr;zVopf;zVscr;zVvdash;zWcirc;zWedge;zWfr;zWopf;zWscr;zXfr;zXi;zXopf;zXscr;zYAcy;zYIcy;zYUcy;ZYacutezYacute;zYcirc;zYcy;zYfr;zYopf;zYscr;zYuml;zZHcy;zZacute;zZcaron;zZcy;zZdot;zZeroWidthSpace;zZeta;zZfr;zZopf;zZscr;Zaacutezaacute;zabreve;zac;zacE;zacd;Zacirczacirc;Zacutezacute;zacy;Zaeligzaelig;zaf;zafr;Zagravezagrave;zalefsym;zaleph;zalpha;zamacr;zamalg;Zampzamp;zand;zandand;zandd;z andslope;zandv;zang;zange;zangle;zangmsd;z angmsdaa;z angmsdab;z angmsdac;z angmsdad;z angmsdae;z angmsdaf;z angmsdag;z angmsdah;zangrt;zangrtvb;z angrtvbd;zangsph;zangst;zangzarr;zaogon;zaopf;zap;zapE;zapacir;zape;zapid;zapos;zapprox;z approxeq;Zaringzaring;zascr;zast;zasymp;zasympeq;Zatildezatilde;Zaumlzauml;z awconint;zawint;zbNot;z backcong;z backepsilon;z backprime;zbacksim;z backsimeq;zbarvee;zbarwed;z barwedge;zbbrk;z bbrktbrk;zbcong;zbcy;zbdquo;zbecaus;zbecause;zbemptyv;zbepsi;zbernou;zbeta;zbeth;zbetween;zbfr;zbigcap;zbigcirc;zbigcup;zbigodot;z bigoplus;z bigotimes;z bigsqcup;zbigstar;zbigtriangledown;zbigtriangleup;z biguplus;zbigvee;z bigwedge;zbkarow;z blacklozenge;z blacksquare;zblacktriangle;zblacktriangledown;zblacktriangleleft;zblacktriangleright;zblank;zblk12;zblk14;zblk34;zblock;zbne;zbnequiv;zbnot;zbopf;zbot;zbottom;zbowtie;zboxDL;zboxDR;zboxDl;zboxDr;zboxH;zboxHD;zboxHU;zboxHd;zboxHu;zboxUL;zboxUR;zboxUl;zboxUr;zboxV;zboxVH;zboxVL;zboxVR;zboxVh;zboxVl;zboxVr;zboxbox;zboxdL;zboxdR;zboxdl;zboxdr;zboxh;zboxhD;zboxhU;zboxhd;zboxhu;z boxminus;zboxplus;z boxtimes;zboxuL;zboxuR;zboxul;zboxur;zboxv;zboxvH;zboxvL;zboxvR;zboxvh;zboxvl;zboxvr;zbprime;zbreve;Zbrvbarzbrvbar;zbscr;zbsemi;zbsim;zbsime;zbsol;zbsolb;z bsolhsub;zbull;zbullet;zbump;zbumpE;zbumpe;zbumpeq;zcacute;zcap;zcapand;z capbrcup;zcapcap;zcapcup;zcapdot;zcaps;zcaret;zcaron;zccaps;zccaron;Zccedilzccedil;zccirc;zccups;zccupssm;zcdot;Zcedilzcedil;zcemptyv;Zcentzcent;z centerdot;zcfr;zchcy;zcheck;z checkmark;zchi;zcir;zcirE;zcirc;zcirceq;zcirclearrowleft;zcirclearrowright;z circledR;z circledS;z circledast;z circledcirc;z circleddash;zcire;z cirfnint;zcirmid;zcirscir;zclubs;z clubsuit;zcolon;zcolone;zcoloneq;zcomma;zcommat;zcomp;zcompfn;z complement;z complexes;zcong;zcongdot;zconint;zcopf;zcoprod;copyzcopy;zcopysr;zcrarr;zcross;zcscr;zcsub;zcsube;zcsup;zcsupe;zctdot;zcudarrl;zcudarrr;zcuepr;zcuesc;zcularr;zcularrp;zcup;z cupbrcap;zcupcap;zcupcup;zcupdot;zcupor;zcups;zcurarr;zcurarrm;z curlyeqprec;z curlyeqsucc;z curlyvee;z curlywedge;Zcurrenzcurren;zcurvearrowleft;zcurvearrowright;zcuvee;zcuwed;z cwconint;zcwint;zcylcty;zdArr;zdHar;zdagger;zdaleth;zdarr;zdash;zdashv;zdbkarow;zdblac;zdcaron;zdcy;zdd;zddagger;zddarr;zddotseq;Zdegzdeg;zdelta;zdemptyv;zdfisht;zdfr;zdharl;zdharr;zdiam;zdiamond;z diamondsuit;zdiams;zdie;zdigamma;zdisin;zdiv;Zdividezdivide;zdivideontimes;zdivonx;zdjcy;zdlcorn;zdlcrop;zdollar;zdopf;zdot;zdoteq;z doteqdot;z dotminus;zdotplus;z dotsquare;zdoublebarwedge;z downarrow;zdowndownarrows;zdownharpoonleft;zdownharpoonright;z drbkarow;zdrcorn;zdrcrop;zdscr;zdscy;zdsol;zdstrok;zdtdot;zdtri;zdtrif;zduarr;zduhar;zdwangle;zdzcy;z dzigrarr;zeDDot;zeDot;Zeacutezeacute;zeaster;zecaron;zecir;Zecirczecirc;zecolon;zecy;zedot;zee;zefDot;zefr;zeg;Zegravezegrave;zegs;zegsdot;zel;z elinters;zell;zels;zelsdot;zemacr;zempty;z emptyset;zemptyv;zemsp13;zemsp14;zemsp;zeng;zensp;zeogon;zeopf;zepar;zeparsl;zeplus;zepsi;zepsilon;zepsiv;zeqcirc;zeqcolon;zeqsim;z eqslantgtr;z eqslantless;zequals;zequest;zequiv;zequivDD;z eqvparsl;zerDot;zerarr;zescr;zesdot;zesim;zeta;Zethzeth;Zeumlzeuml;zeuro;zexcl;zexist;z expectation;z exponentiale;zfallingdotseq;zfcy;zfemale;zffilig;zfflig;zffllig;zffr;zfilig;zfjlig;zflat;zfllig;zfltns;zfnof;zfopf;zforall;zfork;zforkv;z fpartint;Zfrac12zfrac12;zfrac13;Zfrac14zfrac14;zfrac15;zfrac16;zfrac18;zfrac23;zfrac25;Zfrac34zfrac34;zfrac35;zfrac38;zfrac45;zfrac56;zfrac58;zfrac78;zfrasl;zfrown;zfscr;zgE;zgEl;zgacute;zgamma;zgammad;zgap;zgbreve;zgcirc;zgcy;zgdot;zge;zgel;zgeq;zgeqq;z geqslant;zges;zgescc;zgesdot;zgesdoto;z gesdotol;zgesl;zgesles;zgfr;zgg;zggg;zgimel;zgjcy;zgl;zglE;zgla;zglj;zgnE;zgnap;z gnapprox;zgne;zgneq;zgneqq;zgnsim;zgopf;zgrave;zgscr;zgsim;zgsime;zgsiml;gtzgt;zgtcc;zgtcir;zgtdot;zgtlPar;zgtquest;z gtrapprox;zgtrarr;zgtrdot;z gtreqless;z gtreqqless;zgtrless;zgtrsim;z gvertneqq;zgvnE;zhArr;zhairsp;zhalf;zhamilt;zhardcy;zharr;zharrcir;zharrw;zhbar;zhcirc;zhearts;z heartsuit;zhellip;zhercon;zhfr;z hksearow;z hkswarow;zhoarr;zhomtht;zhookleftarrow;zhookrightarrow;zhopf;zhorbar;zhscr;zhslash;zhstrok;zhybull;zhyphen;Ziacuteziacute;zic;Zicirczicirc;zicy;ziecy;Ziexclziexcl;ziff;zifr;Zigravezigrave;zii;ziiiint;ziiint;ziinfin;ziiota;zijlig;zimacr;zimage;z imagline;z imagpart;zimath;zimof;zimped;zin;zincare;zinfin;z infintie;zinodot;zint;zintcal;z integers;z intercal;z intlarhk;zintprod;ziocy;ziogon;ziopf;ziota;ziprod;Ziquestziquest;ziscr;zisin;zisinE;zisindot;zisins;zisinsv;zisinv;zit;zitilde;ziukcy;Ziumlziuml;zjcirc;zjcy;zjfr;zjmath;zjopf;zjscr;zjsercy;zjukcy;zkappa;zkappav;zkcedil;zkcy;zkfr;zkgreen;zkhcy;zkjcy;zkopf;zkscr;zlAarr;zlArr;zlAtail;zlBarr;zlE;zlEg;zlHar;zlacute;z laemptyv;zlagran;zlambda;zlang;zlangd;zlangle;zlap;Zlaquozlaquo;zlarr;zlarrb;zlarrbfs;zlarrfs;zlarrhk;zlarrlp;zlarrpl;zlarrsim;zlarrtl;zlat;zlatail;zlate;zlates;zlbarr;zlbbrk;zlbrace;zlbrack;zlbrke;zlbrksld;zlbrkslu;zlcaron;zlcedil;zlceil;zlcub;zlcy;zldca;zldquo;zldquor;zldrdhar;z ldrushar;zldsh;zle;z leftarrow;zleftarrowtail;zleftharpoondown;zleftharpoonup;zleftleftarrows;zleftrightarrow;zleftrightarrows;zleftrightharpoons;zleftrightsquigarrow;zleftthreetimes;zleg;zleq;zleqq;z leqslant;zles;zlescc;zlesdot;zlesdoto;z lesdotor;zlesg;zlesges;z lessapprox;zlessdot;z lesseqgtr;z lesseqqgtr;zlessgtr;zlesssim;zlfisht;zlfloor;zlfr;zlg;zlgE;zlhard;zlharu;zlharul;zlhblk;zljcy;zll;zllarr;z llcorner;zllhard;zlltri;zlmidot;zlmoust;z lmoustache;zlnE;zlnap;z lnapprox;zlne;zlneq;zlneqq;zlnsim;zloang;zloarr;zlobrk;zlongleftarrow;zlongleftrightarrow;z longmapsto;zlongrightarrow;zlooparrowleft;zlooparrowright;zlopar;zlopf;zloplus;zlotimes;zlowast;zlowbar;zloz;zlozenge;zlozf;zlpar;zlparlt;zlrarr;z lrcorner;zlrhar;zlrhard;zlrm;zlrtri;zlsaquo;zlscr;zlsh;zlsim;zlsime;zlsimg;zlsqb;zlsquo;zlsquor;zlstrok;ltzlt;zltcc;zltcir;zltdot;zlthree;zltimes;zltlarr;zltquest;zltrPar;zltri;zltrie;zltrif;z lurdshar;zluruhar;z lvertneqq;zlvnE;zmDDot;Zmacrzmacr;zmale;zmalt;zmaltese;zmap;zmapsto;z mapstodown;z mapstoleft;z mapstoup;zmarker;zmcomma;zmcy;zmdash;zmeasuredangle;zmfr;zmho;microzmicro;zmid;zmidast;zmidcir;Zmiddotzmiddot;zminus;zminusb;zminusd;zminusdu;zmlcp;zmldr;zmnplus;zmodels;zmopf;zmp;zmscr;zmstpos;zmu;z multimap;zmumap;znGg;znGt;znGtv;z nLeftarrow;znLeftrightarrow;znLl;znLt;znLtv;z nRightarrow;znVDash;znVdash;znabla;znacute;znang;znap;znapE;znapid;znapos;znapprox;znatur;znatural;z naturals;Znbspznbsp;znbump;znbumpe;zncap;zncaron;zncedil;zncong;z ncongdot;zncup;zncy;zndash;zne;zneArr;znearhk;znearr;znearrow;znedot;znequiv;znesear;znesim;znexist;znexists;znfr;zngE;znge;zngeq;zngeqq;z ngeqslant;znges;zngsim;zngt;zngtr;znhArr;znharr;znhpar;zni;znis;znisd;zniv;znjcy;znlArr;znlE;znlarr;znldr;znle;z nleftarrow;znleftrightarrow;znleq;znleqq;z nleqslant;znles;znless;znlsim;znlt;znltri;znltrie;znmid;znopf;notznot;znotin;znotinE;z notindot;znotinva;znotinvb;znotinvc;znotni;znotniva;znotnivb;znotnivc;znpar;z nparallel;znparsl;znpart;znpolint;znpr;znprcue;znpre;znprec;znpreceq;znrArr;znrarr;znrarrc;znrarrw;z nrightarrow;znrtri;znrtrie;znsc;znsccue;znsce;znscr;z nshortmid;znshortparallel;znsim;znsime;znsimeq;znsmid;znspar;znsqsube;znsqsupe;znsub;znsubE;znsube;znsubset;z nsubseteq;z nsubseteqq;znsucc;znsucceq;znsup;znsupE;znsupe;znsupset;z nsupseteq;z nsupseteqq;zntgl;Zntildezntilde;zntlg;zntriangleleft;zntrianglelefteq;zntriangleright;zntrianglerighteq;znu;znum;znumero;znumsp;znvDash;znvHarr;znvap;znvdash;znvge;znvgt;znvinfin;znvlArr;znvle;znvlt;znvltrie;znvrArr;znvrtrie;znvsim;znwArr;znwarhk;znwarr;znwarrow;znwnear;zoS;Zoacutezoacute;zoast;zocir;Zocirczocirc;zocy;zodash;zodblac;zodiv;zodot;zodsold;zoelig;zofcir;zofr;zogon;Zogravezograve;zogt;zohbar;zohm;zoint;zolarr;zolcir;zolcross;zoline;zolt;zomacr;zomega;zomicron;zomid;zominus;zoopf;zopar;zoperp;zoplus;zor;zorarr;zord;zorder;zorderof;Zordfzordf;Zordmzordm;zorigof;zoror;zorslope;zorv;zoscr;Zoslashzoslash;zosol;Zotildezotilde;zotimes;z otimesas;Zoumlzouml;zovbar;zpar;Zparazpara;z parallel;zparsim;zparsl;zpart;zpcy;zpercnt;zperiod;zpermil;zperp;zpertenk;zpfr;zphi;zphiv;zphmmat;zphone;zpi;z pitchfork;zpiv;zplanck;zplanckh;zplankv;zplus;z plusacir;zplusb;zpluscir;zplusdo;zplusdu;zpluse;Zplusmnzplusmn;zplussim;zplustwo;zpm;z pointint;zpopf;Zpoundzpound;zpr;zprE;zprap;zprcue;zpre;zprec;z precapprox;z preccurlyeq;zpreceq;z precnapprox;z precneqq;z precnsim;zprecsim;zprime;zprimes;zprnE;zprnap;zprnsim;zprod;z profalar;z profline;z profsurf;zprop;zpropto;zprsim;zprurel;zpscr;zpsi;zpuncsp;zqfr;zqint;zqopf;zqprime;zqscr;z quaternions;zquatint;zquest;zquesteq;Zquotzquot;zrAarr;zrArr;zrAtail;zrBarr;zrHar;zrace;zracute;zradic;z raemptyv;zrang;zrangd;zrange;zrangle;Zraquozraquo;zrarr;zrarrap;zrarrb;zrarrbfs;zrarrc;zrarrfs;zrarrhk;zrarrlp;zrarrpl;zrarrsim;zrarrtl;zrarrw;zratail;zratio;z rationals;zrbarr;zrbbrk;zrbrace;zrbrack;zrbrke;zrbrksld;zrbrkslu;zrcaron;zrcedil;zrceil;zrcub;zrcy;zrdca;zrdldhar;zrdquo;zrdquor;zrdsh;zreal;zrealine;z realpart;zreals;zrect;Zregzreg;zrfisht;zrfloor;zrfr;zrhard;zrharu;zrharul;zrho;zrhov;z rightarrow;zrightarrowtail;zrightharpoondown;zrightharpoonup;zrightleftarrows;zrightleftharpoons;zrightrightarrows;zrightsquigarrow;zrightthreetimes;zring;z risingdotseq;zrlarr;zrlhar;zrlm;zrmoust;z rmoustache;zrnmid;zroang;zroarr;zrobrk;zropar;zropf;zroplus;zrotimes;zrpar;zrpargt;z rppolint;zrrarr;zrsaquo;zrscr;zrsh;zrsqb;zrsquo;zrsquor;zrthree;zrtimes;zrtri;zrtrie;zrtrif;z rtriltri;zruluhar;zrx;zsacute;zsbquo;zsc;zscE;zscap;zscaron;zsccue;zsce;zscedil;zscirc;zscnE;zscnap;zscnsim;z scpolint;zscsim;zscy;zsdot;zsdotb;zsdote;zseArr;zsearhk;zsearr;zsearrow;Zsectzsect;zsemi;zseswar;z setminus;zsetmn;zsext;zsfr;zsfrown;zsharp;zshchcy;zshcy;z shortmid;zshortparallel;Zshyzshy;zsigma;zsigmaf;zsigmav;zsim;zsimdot;zsime;zsimeq;zsimg;zsimgE;zsiml;zsimlE;zsimne;zsimplus;zsimrarr;zslarr;zsmallsetminus;zsmashp;z smeparsl;zsmid;zsmile;zsmt;zsmte;zsmtes;zsoftcy;zsol;zsolb;zsolbar;zsopf;zspades;z spadesuit;zspar;zsqcap;zsqcaps;zsqcup;zsqcups;zsqsub;zsqsube;z sqsubset;z sqsubseteq;zsqsup;zsqsupe;z sqsupset;z sqsupseteq;zsqu;zsquare;zsquarf;zsquf;zsrarr;zsscr;zssetmn;zssmile;zsstarf;zstar;zstarf;zstraightepsilon;z straightphi;zstrns;zsub;zsubE;zsubdot;zsube;zsubedot;zsubmult;zsubnE;zsubne;zsubplus;zsubrarr;zsubset;z subseteq;z subseteqq;z subsetneq;z subsetneqq;zsubsim;zsubsub;zsubsup;zsucc;z succapprox;z succcurlyeq;zsucceq;z succnapprox;z succneqq;z succnsim;zsuccsim;zsum;zsung;Zsup1zsup1;Zsup2zsup2;Zsup3zsup3;zsup;zsupE;zsupdot;zsupdsub;zsupe;zsupedot;zsuphsol;zsuphsub;zsuplarr;zsupmult;zsupnE;zsupne;zsupplus;zsupset;z supseteq;z supseteqq;z supsetneq;z supsetneqq;zsupsim;zsupsub;zsupsup;zswArr;zswarhk;zswarr;zswarrow;zswnwar;Zszligzszlig;ztarget;ztau;ztbrk;ztcaron;ztcedil;ztcy;ztdot;ztelrec;ztfr;zthere4;z therefore;ztheta;z thetasym;zthetav;z thickapprox;z thicksim;zthinsp;zthkap;zthksim;Zthornzthorn;ztilde;timesztimes;ztimesb;z timesbar;ztimesd;ztint;ztoea;ztop;ztopbot;ztopcir;ztopf;ztopfork;ztosa;ztprime;ztrade;z triangle;z triangledown;z triangleleft;ztrianglelefteq;z triangleq;ztriangleright;ztrianglerighteq;ztridot;ztrie;z triminus;ztriplus;ztrisb;ztritime;z trpezium;ztscr;ztscy;ztshcy;ztstrok;ztwixt;ztwoheadleftarrow;ztwoheadrightarrow;zuArr;zuHar;Zuacutezuacute;zuarr;zubrcy;zubreve;Zucirczucirc;zucy;zudarr;zudblac;zudhar;zufisht;zufr;Zugravezugrave;zuharl;zuharr;zuhblk;zulcorn;z ulcorner;zulcrop;zultri;zumacr;Zumlzuml;zuogon;zuopf;zuparrow;z updownarrow;zupharpoonleft;zupharpoonright;zuplus;zupsi;zupsih;zupsilon;z upuparrows;zurcorn;z urcorner;zurcrop;zuring;zurtri;zuscr;zutdot;zutilde;zutri;zutrif;zuuarr;Zuumlzuuml;zuwangle;zvArr;zvBar;zvBarv;zvDash;zvangrt;z varepsilon;z varkappa;z varnothing;zvarphi;zvarpi;z varpropto;zvarr;zvarrho;z varsigma;z varsubsetneq;zvarsubsetneqq;z varsupsetneq;zvarsupsetneqq;z vartheta;zvartriangleleft;zvartriangleright;zvcy;zvdash;zvee;zveebar;zveeeq;zvellip;zverbar;zvert;zvfr;zvltri;zvnsub;zvnsup;zvopf;zvprop;zvrtri;zvscr;zvsubnE;zvsubne;zvsupnE;zvsupne;zvzigzag;zwcirc;zwedbar;zwedge;zwedgeq;zweierp;zwfr;zwopf;zwp;zwr;zwreath;zwscr;zxcap;zxcirc;zxcup;zxdtri;zxfr;zxhArr;zxharr;zxi;zxlArr;zxlarr;zxmap;zxnis;zxodot;zxopf;zxoplus;zxotime;zxrArr;zxrarr;zxscr;zxsqcup;zxuplus;zxutri;zxvee;zxwedge;Zyacutezyacute;zyacy;zycirc;zycy;Zyenzyen;zyfr;zyicy;zyopf;zyscr;zyucy;Zyumlzyuml;zzacute;zzcaron;zzcy;zzdot;zzeetrf;zzeta;zzfr;zzhcy;zzigrarr;zzopf;zzscr;zzwj;zzwnj;u�)"r )ZDoctypeZ CharactersZSpaceCharactersStartTagEndTagEmptyTagCommentZ ParseErrorrrrcCsg|]\}}||fqSr2r2)r3kvr2r2r6r7x sZmathc@s eZdZdS)DataLossWarningN)__name__ __module__ __qualname__r2r2r2r6r| src@s eZdZdS)ReparseExceptionN)rrrr2r2r2r6r sr)rr r!r"r#r$) rGrHrIrJrKrLrMrNrOrPrQrRrSrHrTrHrHrUrVrWrXrYrZr[r\r]r^r_r`rHrarb)0Z __future__rrrstringZEOFEZ namespaces frozensetZscopingElementsZformattingElementsZspecialElementsZhtmlIntegrationPointElementsZ"mathmlTextIntegrationPointElementsZadjustSVGAttributesZadjustMathMLAttributesZadjustForeignAttributesdictitemsZunadjustForeignAttributesZspaceCharactersZtableInsertModeElementsZascii_lowercaseZasciiLowercaseZascii_uppercaseZasciiUppercaseZ ascii_lettersZ asciiLettersZdigitsZ hexdigitsZ hexDigitsZasciiUpper2LowerZheadingElementsZ voidElementsZ cdataElementsZrcdataElementsZbooleanAttributesZentitiesWindows1252Z xmlEntitiesZentitiesZreplacementCharactersZ tokenTypesZ tagTokenTypesprefixes UserWarningr Exceptionrr2r2r2r6s<                                                                                                                                       html5lib/__pycache__/serializer.cpython-36.opt-1.pyc000064400000021775152347724720016263 0ustar003 Pfa7@sddlmZmZmZddlmZddlZddlmZm Z ddl m Z m Z m Z ddl mZmZmZddlmZmZdd lmZd je d Zejd ed Zejd edZiZeddkZxeejD]p\Z Z!eree!dkse ree!dkrqe!dkree!dkrej"e!Z!ne#e!Z!e!eks4e j$re ee!<qWddZ%ede%dddZ&Gddde'Z(Gddde)Z*dS))absolute_importdivisionunicode_literals) text_typeN)register_errorxmlcharrefreplace_errors) voidElementsbooleanAttributesspaceCharacters)rcdataElementsentities xmlEntities) treewalkers_utils)escapez"'=<>`[]u_  /`  ᠎᠏           

   ]u􏿿&c Cs"t|ttfrg}g}d}xt|j|j|jD]n\}}|rFd}q4||j}tj|j|t |j|dgrtj |j||d}d}nt |}|j |q4Wx^|D]V}t j|} | r|j d|j | | jds|j dq|j dt|ddqWdj||jfSt|SdS)NFrTr;z&#x%s;r) isinstanceUnicodeEncodeErrorUnicodeTranslateError enumerateobjectstartendrZisSurrogatePairminsurrogatePairToCodepointordappend_encode_entity_mapgetendswithhexjoinr) excresZ codepointsskipicindexZ codepointZcper/ /usr/lib/python3.6/serializer.pyhtmlentityreplace_errors*s0  "      r1htmlentityreplaceetreecKs$tj|}tf|}|j|||S)N)rZ getTreeWalkerHTMLSerializerrender)inputZtreeencodingZserializer_optsZwalkersr/r/r0 serializeJs  r9c@s~eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZd!ZddZddZddZd"ddZd#ddZd$dd ZdS)%r4legacy"TFquote_attr_values quote_charuse_best_quote_charomit_optional_tagsminimize_boolean_attributesuse_trailing_solidusspace_before_trailing_solidusescape_lt_in_attrs escape_rcdataresolve_entitiesalphabetical_attributesinject_meta_charsetstrip_whitespacesanitizec Kszt|t|j}t|dkr2tdtt|d|kr@d|_x(|jD]}t|||j|t ||qHWg|_ d|_ dS)a6 Initialize HTMLSerializer. Keyword options (default given first unless specified) include: inject_meta_charset=True|False Whether it insert a meta element to define the character set of the document. quote_attr_values="legacy"|"spec"|"always" Whether to quote attribute values that don't require quoting per legacy browser behaviour, when required by the standard, or always. quote_char=u'"'|u"'" Use given quote character for attribute quoting. Default is to use double quote unless attribute value contains a double quote, in which case single quotes are used instead. escape_lt_in_attrs=False|True Whether to escape < in attribute values. escape_rcdata=False|True Whether to escape characters that need to be escaped within normal elements within rcdata elements such as style. resolve_entities=True|False Whether to resolve named character entities that appear in the source tree. The XML predefined entities < > & " ' are unaffected by this setting. strip_whitespace=False|True Whether to remove semantically meaningless whitespace. (This compresses all whitespace to a single space except within pre.) minimize_boolean_attributes=True|False Shortens boolean attributes to give just the attribute value, for example becomes . use_trailing_solidus=False|True Includes a close-tag slash at the end of the start tag of void elements (empty elements whose end tag is forbidden). E.g.
. space_before_trailing_solidus=True|False Places a space immediately before the closing slash in a tag using a trailing solidus. E.g.
. Requires use_trailing_solidus. sanitize=False|True Strip all unsafe or unknown constructs from output. See `html5lib user documentation`_ omit_optional_tags=True|False Omit start/end tags that are optional. alphabetical_attributes=False|True Reorder attributes to be in alphabetical order. .. _html5lib user documentation: http://code.google.com/p/html5lib/wiki/UserDocumentation rz2__init__() got an unexpected keyword argument '%s'r=FN) frozensetoptionslen TypeErrornextiterr>setattrr$getattrerrorsstrict)selfkwargsZunexpected_argsattrr/r/r0__init__ps.  zHTMLSerializer.__init__cCs|jr|j|jdS|SdS)Nr2)r7encode)rTstringr/r/r0rXszHTMLSerializer.encodecCs|jr|j|jdS|SdS)NrS)r7rX)rTrYr/r/r0 encodeStrictszHTMLSerializer.encodeStrictNccs||_d}g|_|r0|jr0ddlm}|||}|jrJddlm}||}|jrdddlm}||}|j r~ddl m}||}|j rddl m}||}xR|D]H}|d}|dkr`d|d}|dr|d |d7}n|d r|d 7}|d rJ|d j d d kr0|d j dd kr*|jdd}nd }|d||d |f7}|d7}|j|Vq|d5kr|dksz|r|r|dj dd kr|jd|j|dVn|jt|dVq|d6kr|d} |jd| V| tkr|j rd}n|r|jdx|djD]\\} } } | } | }|jdV|j| V|j s| tj| tkr"| tjdtkr"|jdV|jdkst|d krd}n@|jd krtj|dk }n$|jd!krtj|dk }ntd"|jd#d$}|j r|jd%d&}|r|j!}|j"rTd|kr CharactersSpaceCharactersdatazCommentz--zComment contains --z ZEntityrzEntity %s not recognizedz&%s;)r`ra)rcrd))r7rRrGZfilters.inject_meta_charsetr[rFZfilters.alphabeticalattributesrHZfilters.whitespacerIZfilters.sanitizerr?Zfilters.optionaltagsfindserializeErrorrZrXrr rDitemsr@r r$tupler<rL_quoteAttributeSpecsearch_quoteAttributeLegacy ValueErrorreplacerCr=r>r rArBr rEr)rT treewalkerr7Zin_cdatar[tokenr\Zdoctyper=r]_Z attr_nameZ attr_valuekvZ quote_attrrbkeyr/r/r0r9s                                    zHTMLSerializer.serializecCs2|rdjt|j||Sdjt|j|SdS)Nr)r'listr9)rTrur7r/r/r0r5?szHTMLSerializer.renderXXX ERROR MESSAGE NEEDEDcCs|jj||jrtdS)N)rRr"rSSerializeError)rTrbr/r/r0rmEs zHTMLSerializer.serializeError)r<r=r>r?r@rArBrCrDrErFrGrHrI)N)N)r})__name__ __module__ __qualname__r<r=r>r?r@rArBrCrDrErFrGrHrIrKrWrXrZr9r5rmr/r/r/r0r4Qs68  r4c@seZdZdZdS)r~zError in serialized treeN)rrr__doc__r/r/r/r0r~Lsr~)r3N)+Z __future__rrrZpip._vendor.sixrrecodecsrrZ constantsr r r r r rrrrZxml.sax.saxutilsrr'Z_quoteAttributeSpecCharscompilerprrr#rLZ_is_ucs4r|rnrxryr r!islowerr1r9rr4 Exceptionr~r/r/r/r0s:         |html5lib/constants.py000064400000243010152347724720010667 0ustar00from __future__ import absolute_import, division, unicode_literals import string EOF = None E = { "null-character": "Null character in input stream, replaced with U+FFFD.", "invalid-codepoint": "Invalid codepoint in stream.", "incorrectly-placed-solidus": "Solidus (/) incorrectly placed in tag.", "incorrect-cr-newline-entity": "Incorrect CR newline entity, replaced with LF.", "illegal-windows-1252-entity": "Entity used with illegal number (windows-1252 reference).", "cant-convert-numeric-entity": "Numeric entity couldn't be converted to character " "(codepoint U+%(charAsInt)08x).", "illegal-codepoint-for-numeric-entity": "Numeric entity represents an illegal codepoint: " "U+%(charAsInt)08x.", "numeric-entity-without-semicolon": "Numeric entity didn't end with ';'.", "expected-numeric-entity-but-got-eof": "Numeric entity expected. Got end of file instead.", "expected-numeric-entity": "Numeric entity expected but none found.", "named-entity-without-semicolon": "Named entity didn't end with ';'.", "expected-named-entity": "Named entity expected. Got none.", "attributes-in-end-tag": "End tag contains unexpected attributes.", 'self-closing-flag-on-end-tag': "End tag contains unexpected self-closing flag.", "expected-tag-name-but-got-right-bracket": "Expected tag name. Got '>' instead.", "expected-tag-name-but-got-question-mark": "Expected tag name. Got '?' instead. (HTML doesn't " "support processing instructions.)", "expected-tag-name": "Expected tag name. Got something else instead", "expected-closing-tag-but-got-right-bracket": "Expected closing tag. Got '>' instead. Ignoring ''.", "expected-closing-tag-but-got-eof": "Expected closing tag. Unexpected end of file.", "expected-closing-tag-but-got-char": "Expected closing tag. Unexpected character '%(data)s' found.", "eof-in-tag-name": "Unexpected end of file in the tag name.", "expected-attribute-name-but-got-eof": "Unexpected end of file. Expected attribute name instead.", "eof-in-attribute-name": "Unexpected end of file in attribute name.", "invalid-character-in-attribute-name": "Invalid character in attribute name", "duplicate-attribute": "Dropped duplicate attribute on tag.", "expected-end-of-tag-name-but-got-eof": "Unexpected end of file. Expected = or end of tag.", "expected-attribute-value-but-got-eof": "Unexpected end of file. Expected attribute value.", "expected-attribute-value-but-got-right-bracket": "Expected attribute value. Got '>' instead.", 'equals-in-unquoted-attribute-value': "Unexpected = in unquoted attribute", 'unexpected-character-in-unquoted-attribute-value': "Unexpected character in unquoted attribute", "invalid-character-after-attribute-name": "Unexpected character after attribute name.", "unexpected-character-after-attribute-value": "Unexpected character after attribute value.", "eof-in-attribute-value-double-quote": "Unexpected end of file in attribute value (\").", "eof-in-attribute-value-single-quote": "Unexpected end of file in attribute value (').", "eof-in-attribute-value-no-quotes": "Unexpected end of file in attribute value.", "unexpected-EOF-after-solidus-in-tag": "Unexpected end of file in tag. Expected >", "unexpected-character-after-solidus-in-tag": "Unexpected character after / in tag. Expected >", "expected-dashes-or-doctype": "Expected '--' or 'DOCTYPE'. Not found.", "unexpected-bang-after-double-dash-in-comment": "Unexpected ! after -- in comment", "unexpected-space-after-double-dash-in-comment": "Unexpected space after -- in comment", "incorrect-comment": "Incorrect comment.", "eof-in-comment": "Unexpected end of file in comment.", "eof-in-comment-end-dash": "Unexpected end of file in comment (-)", "unexpected-dash-after-double-dash-in-comment": "Unexpected '-' after '--' found in comment.", "eof-in-comment-double-dash": "Unexpected end of file in comment (--).", "eof-in-comment-end-space-state": "Unexpected end of file in comment.", "eof-in-comment-end-bang-state": "Unexpected end of file in comment.", "unexpected-char-in-comment": "Unexpected character in comment found.", "need-space-after-doctype": "No space after literal string 'DOCTYPE'.", "expected-doctype-name-but-got-right-bracket": "Unexpected > character. Expected DOCTYPE name.", "expected-doctype-name-but-got-eof": "Unexpected end of file. Expected DOCTYPE name.", "eof-in-doctype-name": "Unexpected end of file in DOCTYPE name.", "eof-in-doctype": "Unexpected end of file in DOCTYPE.", "expected-space-or-right-bracket-in-doctype": "Expected space or '>'. Got '%(data)s'", "unexpected-end-of-doctype": "Unexpected end of DOCTYPE.", "unexpected-char-in-doctype": "Unexpected character in DOCTYPE.", "eof-in-innerhtml": "XXX innerHTML EOF", "unexpected-doctype": "Unexpected DOCTYPE. Ignored.", "non-html-root": "html needs to be the first start tag.", "expected-doctype-but-got-eof": "Unexpected End of file. Expected DOCTYPE.", "unknown-doctype": "Erroneous DOCTYPE.", "expected-doctype-but-got-chars": "Unexpected non-space characters. Expected DOCTYPE.", "expected-doctype-but-got-start-tag": "Unexpected start tag (%(name)s). Expected DOCTYPE.", "expected-doctype-but-got-end-tag": "Unexpected end tag (%(name)s). Expected DOCTYPE.", "end-tag-after-implied-root": "Unexpected end tag (%(name)s) after the (implied) root element.", "expected-named-closing-tag-but-got-eof": "Unexpected end of file. Expected end tag (%(name)s).", "two-heads-are-not-better-than-one": "Unexpected start tag head in existing head. Ignored.", "unexpected-end-tag": "Unexpected end tag (%(name)s). Ignored.", "unexpected-start-tag-out-of-my-head": "Unexpected start tag (%(name)s) that can be in head. Moved.", "unexpected-start-tag": "Unexpected start tag (%(name)s).", "missing-end-tag": "Missing end tag (%(name)s).", "missing-end-tags": "Missing end tags (%(name)s).", "unexpected-start-tag-implies-end-tag": "Unexpected start tag (%(startName)s) " "implies end tag (%(endName)s).", "unexpected-start-tag-treated-as": "Unexpected start tag (%(originalName)s). Treated as %(newName)s.", "deprecated-tag": "Unexpected start tag %(name)s. Don't use it!", "unexpected-start-tag-ignored": "Unexpected start tag %(name)s. Ignored.", "expected-one-end-tag-but-got-another": "Unexpected end tag (%(gotName)s). " "Missing end tag (%(expectedName)s).", "end-tag-too-early": "End tag (%(name)s) seen too early. Expected other end tag.", "end-tag-too-early-named": "Unexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).", "end-tag-too-early-ignored": "End tag (%(name)s) seen too early. Ignored.", "adoption-agency-1.1": "End tag (%(name)s) violates step 1, " "paragraph 1 of the adoption agency algorithm.", "adoption-agency-1.2": "End tag (%(name)s) violates step 1, " "paragraph 2 of the adoption agency algorithm.", "adoption-agency-1.3": "End tag (%(name)s) violates step 1, " "paragraph 3 of the adoption agency algorithm.", "adoption-agency-4.4": "End tag (%(name)s) violates step 4, " "paragraph 4 of the adoption agency algorithm.", "unexpected-end-tag-treated-as": "Unexpected end tag (%(originalName)s). Treated as %(newName)s.", "no-end-tag": "This element (%(name)s) has no end tag.", "unexpected-implied-end-tag-in-table": "Unexpected implied end tag (%(name)s) in the table phase.", "unexpected-implied-end-tag-in-table-body": "Unexpected implied end tag (%(name)s) in the table body phase.", "unexpected-char-implies-table-voodoo": "Unexpected non-space characters in " "table context caused voodoo mode.", "unexpected-hidden-input-in-table": "Unexpected input with type hidden in table context.", "unexpected-form-in-table": "Unexpected form in table context.", "unexpected-start-tag-implies-table-voodoo": "Unexpected start tag (%(name)s) in " "table context caused voodoo mode.", "unexpected-end-tag-implies-table-voodoo": "Unexpected end tag (%(name)s) in " "table context caused voodoo mode.", "unexpected-cell-in-table-body": "Unexpected table cell start tag (%(name)s) " "in the table body phase.", "unexpected-cell-end-tag": "Got table cell end tag (%(name)s) " "while required end tags are missing.", "unexpected-end-tag-in-table-body": "Unexpected end tag (%(name)s) in the table body phase. Ignored.", "unexpected-implied-end-tag-in-table-row": "Unexpected implied end tag (%(name)s) in the table row phase.", "unexpected-end-tag-in-table-row": "Unexpected end tag (%(name)s) in the table row phase. Ignored.", "unexpected-select-in-select": "Unexpected select start tag in the select phase " "treated as select end tag.", "unexpected-input-in-select": "Unexpected input start tag in the select phase.", "unexpected-start-tag-in-select": "Unexpected start tag token (%(name)s in the select phase. " "Ignored.", "unexpected-end-tag-in-select": "Unexpected end tag (%(name)s) in the select phase. Ignored.", "unexpected-table-element-start-tag-in-select-in-table": "Unexpected table element start tag (%(name)s) in the select in table phase.", "unexpected-table-element-end-tag-in-select-in-table": "Unexpected table element end tag (%(name)s) in the select in table phase.", "unexpected-char-after-body": "Unexpected non-space characters in the after body phase.", "unexpected-start-tag-after-body": "Unexpected start tag token (%(name)s)" " in the after body phase.", "unexpected-end-tag-after-body": "Unexpected end tag token (%(name)s)" " in the after body phase.", "unexpected-char-in-frameset": "Unexpected characters in the frameset phase. Characters ignored.", "unexpected-start-tag-in-frameset": "Unexpected start tag token (%(name)s)" " in the frameset phase. Ignored.", "unexpected-frameset-in-frameset-innerhtml": "Unexpected end tag token (frameset) " "in the frameset phase (innerHTML).", "unexpected-end-tag-in-frameset": "Unexpected end tag token (%(name)s)" " in the frameset phase. Ignored.", "unexpected-char-after-frameset": "Unexpected non-space characters in the " "after frameset phase. Ignored.", "unexpected-start-tag-after-frameset": "Unexpected start tag (%(name)s)" " in the after frameset phase. Ignored.", "unexpected-end-tag-after-frameset": "Unexpected end tag (%(name)s)" " in the after frameset phase. Ignored.", "unexpected-end-tag-after-body-innerhtml": "Unexpected end tag after body(innerHtml)", "expected-eof-but-got-char": "Unexpected non-space characters. Expected end of file.", "expected-eof-but-got-start-tag": "Unexpected start tag (%(name)s)" ". Expected end of file.", "expected-eof-but-got-end-tag": "Unexpected end tag (%(name)s)" ". Expected end of file.", "eof-in-table": "Unexpected end of file. Expected table content.", "eof-in-select": "Unexpected end of file. Expected select content.", "eof-in-frameset": "Unexpected end of file. Expected frameset content.", "eof-in-script-in-script": "Unexpected end of file. Expected script content.", "eof-in-foreign-lands": "Unexpected end of file. Expected foreign content", "non-void-element-with-trailing-solidus": "Trailing solidus not allowed on element %(name)s", "unexpected-html-element-in-foreign-content": "Element %(name)s not allowed in a non-html context", "unexpected-end-tag-before-html": "Unexpected end tag (%(name)s) before html.", "unexpected-inhead-noscript-tag": "Element %(name)s not allowed in a inhead-noscript context", "eof-in-head-noscript": "Unexpected end of file. Expected inhead-noscript content", "char-in-head-noscript": "Unexpected non-space character. Expected inhead-noscript content", "XXX-undefined-error": "Undefined error (this sucks and should be fixed)", } namespaces = { "html": "http://www.w3.org/1999/xhtml", "mathml": "http://www.w3.org/1998/Math/MathML", "svg": "http://www.w3.org/2000/svg", "xlink": "http://www.w3.org/1999/xlink", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/" } scopingElements = frozenset([ (namespaces["html"], "applet"), (namespaces["html"], "caption"), (namespaces["html"], "html"), (namespaces["html"], "marquee"), (namespaces["html"], "object"), (namespaces["html"], "table"), (namespaces["html"], "td"), (namespaces["html"], "th"), (namespaces["mathml"], "mi"), (namespaces["mathml"], "mo"), (namespaces["mathml"], "mn"), (namespaces["mathml"], "ms"), (namespaces["mathml"], "mtext"), (namespaces["mathml"], "annotation-xml"), (namespaces["svg"], "foreignObject"), (namespaces["svg"], "desc"), (namespaces["svg"], "title"), ]) formattingElements = frozenset([ (namespaces["html"], "a"), (namespaces["html"], "b"), (namespaces["html"], "big"), (namespaces["html"], "code"), (namespaces["html"], "em"), (namespaces["html"], "font"), (namespaces["html"], "i"), (namespaces["html"], "nobr"), (namespaces["html"], "s"), (namespaces["html"], "small"), (namespaces["html"], "strike"), (namespaces["html"], "strong"), (namespaces["html"], "tt"), (namespaces["html"], "u") ]) specialElements = frozenset([ (namespaces["html"], "address"), (namespaces["html"], "applet"), (namespaces["html"], "area"), (namespaces["html"], "article"), (namespaces["html"], "aside"), (namespaces["html"], "base"), (namespaces["html"], "basefont"), (namespaces["html"], "bgsound"), (namespaces["html"], "blockquote"), (namespaces["html"], "body"), (namespaces["html"], "br"), (namespaces["html"], "button"), (namespaces["html"], "caption"), (namespaces["html"], "center"), (namespaces["html"], "col"), (namespaces["html"], "colgroup"), (namespaces["html"], "command"), (namespaces["html"], "dd"), (namespaces["html"], "details"), (namespaces["html"], "dir"), (namespaces["html"], "div"), (namespaces["html"], "dl"), (namespaces["html"], "dt"), (namespaces["html"], "embed"), (namespaces["html"], "fieldset"), (namespaces["html"], "figure"), (namespaces["html"], "footer"), (namespaces["html"], "form"), (namespaces["html"], "frame"), (namespaces["html"], "frameset"), (namespaces["html"], "h1"), (namespaces["html"], "h2"), (namespaces["html"], "h3"), (namespaces["html"], "h4"), (namespaces["html"], "h5"), (namespaces["html"], "h6"), (namespaces["html"], "head"), (namespaces["html"], "header"), (namespaces["html"], "hr"), (namespaces["html"], "html"), (namespaces["html"], "iframe"), # Note that image is commented out in the spec as "this isn't an # element that can end up on the stack, so it doesn't matter," (namespaces["html"], "image"), (namespaces["html"], "img"), (namespaces["html"], "input"), (namespaces["html"], "isindex"), (namespaces["html"], "li"), (namespaces["html"], "link"), (namespaces["html"], "listing"), (namespaces["html"], "marquee"), (namespaces["html"], "menu"), (namespaces["html"], "meta"), (namespaces["html"], "nav"), (namespaces["html"], "noembed"), (namespaces["html"], "noframes"), (namespaces["html"], "noscript"), (namespaces["html"], "object"), (namespaces["html"], "ol"), (namespaces["html"], "p"), (namespaces["html"], "param"), (namespaces["html"], "plaintext"), (namespaces["html"], "pre"), (namespaces["html"], "script"), (namespaces["html"], "section"), (namespaces["html"], "select"), (namespaces["html"], "style"), (namespaces["html"], "table"), (namespaces["html"], "tbody"), (namespaces["html"], "td"), (namespaces["html"], "textarea"), (namespaces["html"], "tfoot"), (namespaces["html"], "th"), (namespaces["html"], "thead"), (namespaces["html"], "title"), (namespaces["html"], "tr"), (namespaces["html"], "ul"), (namespaces["html"], "wbr"), (namespaces["html"], "xmp"), (namespaces["svg"], "foreignObject") ]) htmlIntegrationPointElements = frozenset([ (namespaces["mathml"], "annotation-xml"), (namespaces["svg"], "foreignObject"), (namespaces["svg"], "desc"), (namespaces["svg"], "title") ]) mathmlTextIntegrationPointElements = frozenset([ (namespaces["mathml"], "mi"), (namespaces["mathml"], "mo"), (namespaces["mathml"], "mn"), (namespaces["mathml"], "ms"), (namespaces["mathml"], "mtext") ]) adjustSVGAttributes = { "attributename": "attributeName", "attributetype": "attributeType", "basefrequency": "baseFrequency", "baseprofile": "baseProfile", "calcmode": "calcMode", "clippathunits": "clipPathUnits", "contentscripttype": "contentScriptType", "contentstyletype": "contentStyleType", "diffuseconstant": "diffuseConstant", "edgemode": "edgeMode", "externalresourcesrequired": "externalResourcesRequired", "filterres": "filterRes", "filterunits": "filterUnits", "glyphref": "glyphRef", "gradienttransform": "gradientTransform", "gradientunits": "gradientUnits", "kernelmatrix": "kernelMatrix", "kernelunitlength": "kernelUnitLength", "keypoints": "keyPoints", "keysplines": "keySplines", "keytimes": "keyTimes", "lengthadjust": "lengthAdjust", "limitingconeangle": "limitingConeAngle", "markerheight": "markerHeight", "markerunits": "markerUnits", "markerwidth": "markerWidth", "maskcontentunits": "maskContentUnits", "maskunits": "maskUnits", "numoctaves": "numOctaves", "pathlength": "pathLength", "patterncontentunits": "patternContentUnits", "patterntransform": "patternTransform", "patternunits": "patternUnits", "pointsatx": "pointsAtX", "pointsaty": "pointsAtY", "pointsatz": "pointsAtZ", "preservealpha": "preserveAlpha", "preserveaspectratio": "preserveAspectRatio", "primitiveunits": "primitiveUnits", "refx": "refX", "refy": "refY", "repeatcount": "repeatCount", "repeatdur": "repeatDur", "requiredextensions": "requiredExtensions", "requiredfeatures": "requiredFeatures", "specularconstant": "specularConstant", "specularexponent": "specularExponent", "spreadmethod": "spreadMethod", "startoffset": "startOffset", "stddeviation": "stdDeviation", "stitchtiles": "stitchTiles", "surfacescale": "surfaceScale", "systemlanguage": "systemLanguage", "tablevalues": "tableValues", "targetx": "targetX", "targety": "targetY", "textlength": "textLength", "viewbox": "viewBox", "viewtarget": "viewTarget", "xchannelselector": "xChannelSelector", "ychannelselector": "yChannelSelector", "zoomandpan": "zoomAndPan" } adjustMathMLAttributes = {"definitionurl": "definitionURL"} adjustForeignAttributes = { "xlink:actuate": ("xlink", "actuate", namespaces["xlink"]), "xlink:arcrole": ("xlink", "arcrole", namespaces["xlink"]), "xlink:href": ("xlink", "href", namespaces["xlink"]), "xlink:role": ("xlink", "role", namespaces["xlink"]), "xlink:show": ("xlink", "show", namespaces["xlink"]), "xlink:title": ("xlink", "title", namespaces["xlink"]), "xlink:type": ("xlink", "type", namespaces["xlink"]), "xml:base": ("xml", "base", namespaces["xml"]), "xml:lang": ("xml", "lang", namespaces["xml"]), "xml:space": ("xml", "space", namespaces["xml"]), "xmlns": (None, "xmlns", namespaces["xmlns"]), "xmlns:xlink": ("xmlns", "xlink", namespaces["xmlns"]) } unadjustForeignAttributes = {(ns, local): qname for qname, (prefix, local, ns) in adjustForeignAttributes.items()} spaceCharacters = frozenset([ "\t", "\n", "\u000C", " ", "\r" ]) tableInsertModeElements = frozenset([ "table", "tbody", "tfoot", "thead", "tr" ]) asciiLowercase = frozenset(string.ascii_lowercase) asciiUppercase = frozenset(string.ascii_uppercase) asciiLetters = frozenset(string.ascii_letters) digits = frozenset(string.digits) hexDigits = frozenset(string.hexdigits) asciiUpper2Lower = {ord(c): ord(c.lower()) for c in string.ascii_uppercase} # Heading elements need to be ordered headingElements = ( "h1", "h2", "h3", "h4", "h5", "h6" ) voidElements = frozenset([ "base", "command", "event-source", "link", "meta", "hr", "br", "img", "embed", "param", "area", "col", "input", "source", "track" ]) cdataElements = frozenset(['title', 'textarea']) rcdataElements = frozenset([ 'style', 'script', 'xmp', 'iframe', 'noembed', 'noframes', 'noscript' ]) booleanAttributes = { "": frozenset(["irrelevant", "itemscope"]), "style": frozenset(["scoped"]), "img": frozenset(["ismap"]), "audio": frozenset(["autoplay", "controls"]), "video": frozenset(["autoplay", "controls"]), "script": frozenset(["defer", "async"]), "details": frozenset(["open"]), "datagrid": frozenset(["multiple", "disabled"]), "command": frozenset(["hidden", "disabled", "checked", "default"]), "hr": frozenset(["noshade"]), "menu": frozenset(["autosubmit"]), "fieldset": frozenset(["disabled", "readonly"]), "option": frozenset(["disabled", "readonly", "selected"]), "optgroup": frozenset(["disabled", "readonly"]), "button": frozenset(["disabled", "autofocus"]), "input": frozenset(["disabled", "readonly", "required", "autofocus", "checked", "ismap"]), "select": frozenset(["disabled", "readonly", "autofocus", "multiple"]), "output": frozenset(["disabled", "readonly"]), "iframe": frozenset(["seamless"]), } # entitiesWindows1252 has to be _ordered_ and needs to have an index. It # therefore can't be a frozenset. entitiesWindows1252 = ( 8364, # 0x80 0x20AC EURO SIGN 65533, # 0x81 UNDEFINED 8218, # 0x82 0x201A SINGLE LOW-9 QUOTATION MARK 402, # 0x83 0x0192 LATIN SMALL LETTER F WITH HOOK 8222, # 0x84 0x201E DOUBLE LOW-9 QUOTATION MARK 8230, # 0x85 0x2026 HORIZONTAL ELLIPSIS 8224, # 0x86 0x2020 DAGGER 8225, # 0x87 0x2021 DOUBLE DAGGER 710, # 0x88 0x02C6 MODIFIER LETTER CIRCUMFLEX ACCENT 8240, # 0x89 0x2030 PER MILLE SIGN 352, # 0x8A 0x0160 LATIN CAPITAL LETTER S WITH CARON 8249, # 0x8B 0x2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK 338, # 0x8C 0x0152 LATIN CAPITAL LIGATURE OE 65533, # 0x8D UNDEFINED 381, # 0x8E 0x017D LATIN CAPITAL LETTER Z WITH CARON 65533, # 0x8F UNDEFINED 65533, # 0x90 UNDEFINED 8216, # 0x91 0x2018 LEFT SINGLE QUOTATION MARK 8217, # 0x92 0x2019 RIGHT SINGLE QUOTATION MARK 8220, # 0x93 0x201C LEFT DOUBLE QUOTATION MARK 8221, # 0x94 0x201D RIGHT DOUBLE QUOTATION MARK 8226, # 0x95 0x2022 BULLET 8211, # 0x96 0x2013 EN DASH 8212, # 0x97 0x2014 EM DASH 732, # 0x98 0x02DC SMALL TILDE 8482, # 0x99 0x2122 TRADE MARK SIGN 353, # 0x9A 0x0161 LATIN SMALL LETTER S WITH CARON 8250, # 0x9B 0x203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 339, # 0x9C 0x0153 LATIN SMALL LIGATURE OE 65533, # 0x9D UNDEFINED 382, # 0x9E 0x017E LATIN SMALL LETTER Z WITH CARON 376 # 0x9F 0x0178 LATIN CAPITAL LETTER Y WITH DIAERESIS ) xmlEntities = frozenset(['lt;', 'gt;', 'amp;', 'apos;', 'quot;']) entities = { "AElig": "\xc6", "AElig;": "\xc6", "AMP": "&", "AMP;": "&", "Aacute": "\xc1", "Aacute;": "\xc1", "Abreve;": "\u0102", "Acirc": "\xc2", "Acirc;": "\xc2", "Acy;": "\u0410", "Afr;": "\U0001d504", "Agrave": "\xc0", "Agrave;": "\xc0", "Alpha;": "\u0391", "Amacr;": "\u0100", "And;": "\u2a53", "Aogon;": "\u0104", "Aopf;": "\U0001d538", "ApplyFunction;": "\u2061", "Aring": "\xc5", "Aring;": "\xc5", "Ascr;": "\U0001d49c", "Assign;": "\u2254", "Atilde": "\xc3", "Atilde;": "\xc3", "Auml": "\xc4", "Auml;": "\xc4", "Backslash;": "\u2216", "Barv;": "\u2ae7", "Barwed;": "\u2306", "Bcy;": "\u0411", "Because;": "\u2235", "Bernoullis;": "\u212c", "Beta;": "\u0392", "Bfr;": "\U0001d505", "Bopf;": "\U0001d539", "Breve;": "\u02d8", "Bscr;": "\u212c", "Bumpeq;": "\u224e", "CHcy;": "\u0427", "COPY": "\xa9", "COPY;": "\xa9", "Cacute;": "\u0106", "Cap;": "\u22d2", "CapitalDifferentialD;": "\u2145", "Cayleys;": "\u212d", "Ccaron;": "\u010c", "Ccedil": "\xc7", "Ccedil;": "\xc7", "Ccirc;": "\u0108", "Cconint;": "\u2230", "Cdot;": "\u010a", "Cedilla;": "\xb8", "CenterDot;": "\xb7", "Cfr;": "\u212d", "Chi;": "\u03a7", "CircleDot;": "\u2299", "CircleMinus;": "\u2296", "CirclePlus;": "\u2295", "CircleTimes;": "\u2297", "ClockwiseContourIntegral;": "\u2232", "CloseCurlyDoubleQuote;": "\u201d", "CloseCurlyQuote;": "\u2019", "Colon;": "\u2237", "Colone;": "\u2a74", "Congruent;": "\u2261", "Conint;": "\u222f", "ContourIntegral;": "\u222e", "Copf;": "\u2102", "Coproduct;": "\u2210", "CounterClockwiseContourIntegral;": "\u2233", "Cross;": "\u2a2f", "Cscr;": "\U0001d49e", "Cup;": "\u22d3", "CupCap;": "\u224d", "DD;": "\u2145", "DDotrahd;": "\u2911", "DJcy;": "\u0402", "DScy;": "\u0405", "DZcy;": "\u040f", "Dagger;": "\u2021", "Darr;": "\u21a1", "Dashv;": "\u2ae4", "Dcaron;": "\u010e", "Dcy;": "\u0414", "Del;": "\u2207", "Delta;": "\u0394", "Dfr;": "\U0001d507", "DiacriticalAcute;": "\xb4", "DiacriticalDot;": "\u02d9", "DiacriticalDoubleAcute;": "\u02dd", "DiacriticalGrave;": "`", "DiacriticalTilde;": "\u02dc", "Diamond;": "\u22c4", "DifferentialD;": "\u2146", "Dopf;": "\U0001d53b", "Dot;": "\xa8", "DotDot;": "\u20dc", "DotEqual;": "\u2250", "DoubleContourIntegral;": "\u222f", "DoubleDot;": "\xa8", "DoubleDownArrow;": "\u21d3", "DoubleLeftArrow;": "\u21d0", "DoubleLeftRightArrow;": "\u21d4", "DoubleLeftTee;": "\u2ae4", "DoubleLongLeftArrow;": "\u27f8", "DoubleLongLeftRightArrow;": "\u27fa", "DoubleLongRightArrow;": "\u27f9", "DoubleRightArrow;": "\u21d2", "DoubleRightTee;": "\u22a8", "DoubleUpArrow;": "\u21d1", "DoubleUpDownArrow;": "\u21d5", "DoubleVerticalBar;": "\u2225", "DownArrow;": "\u2193", "DownArrowBar;": "\u2913", "DownArrowUpArrow;": "\u21f5", "DownBreve;": "\u0311", "DownLeftRightVector;": "\u2950", "DownLeftTeeVector;": "\u295e", "DownLeftVector;": "\u21bd", "DownLeftVectorBar;": "\u2956", "DownRightTeeVector;": "\u295f", "DownRightVector;": "\u21c1", "DownRightVectorBar;": "\u2957", "DownTee;": "\u22a4", "DownTeeArrow;": "\u21a7", "Downarrow;": "\u21d3", "Dscr;": "\U0001d49f", "Dstrok;": "\u0110", "ENG;": "\u014a", "ETH": "\xd0", "ETH;": "\xd0", "Eacute": "\xc9", "Eacute;": "\xc9", "Ecaron;": "\u011a", "Ecirc": "\xca", "Ecirc;": "\xca", "Ecy;": "\u042d", "Edot;": "\u0116", "Efr;": "\U0001d508", "Egrave": "\xc8", "Egrave;": "\xc8", "Element;": "\u2208", "Emacr;": "\u0112", "EmptySmallSquare;": "\u25fb", "EmptyVerySmallSquare;": "\u25ab", "Eogon;": "\u0118", "Eopf;": "\U0001d53c", "Epsilon;": "\u0395", "Equal;": "\u2a75", "EqualTilde;": "\u2242", "Equilibrium;": "\u21cc", "Escr;": "\u2130", "Esim;": "\u2a73", "Eta;": "\u0397", "Euml": "\xcb", "Euml;": "\xcb", "Exists;": "\u2203", "ExponentialE;": "\u2147", "Fcy;": "\u0424", "Ffr;": "\U0001d509", "FilledSmallSquare;": "\u25fc", "FilledVerySmallSquare;": "\u25aa", "Fopf;": "\U0001d53d", "ForAll;": "\u2200", "Fouriertrf;": "\u2131", "Fscr;": "\u2131", "GJcy;": "\u0403", "GT": ">", "GT;": ">", "Gamma;": "\u0393", "Gammad;": "\u03dc", "Gbreve;": "\u011e", "Gcedil;": "\u0122", "Gcirc;": "\u011c", "Gcy;": "\u0413", "Gdot;": "\u0120", "Gfr;": "\U0001d50a", "Gg;": "\u22d9", "Gopf;": "\U0001d53e", "GreaterEqual;": "\u2265", "GreaterEqualLess;": "\u22db", "GreaterFullEqual;": "\u2267", "GreaterGreater;": "\u2aa2", "GreaterLess;": "\u2277", "GreaterSlantEqual;": "\u2a7e", "GreaterTilde;": "\u2273", "Gscr;": "\U0001d4a2", "Gt;": "\u226b", "HARDcy;": "\u042a", "Hacek;": "\u02c7", "Hat;": "^", "Hcirc;": "\u0124", "Hfr;": "\u210c", "HilbertSpace;": "\u210b", "Hopf;": "\u210d", "HorizontalLine;": "\u2500", "Hscr;": "\u210b", "Hstrok;": "\u0126", "HumpDownHump;": "\u224e", "HumpEqual;": "\u224f", "IEcy;": "\u0415", "IJlig;": "\u0132", "IOcy;": "\u0401", "Iacute": "\xcd", "Iacute;": "\xcd", "Icirc": "\xce", "Icirc;": "\xce", "Icy;": "\u0418", "Idot;": "\u0130", "Ifr;": "\u2111", "Igrave": "\xcc", "Igrave;": "\xcc", "Im;": "\u2111", "Imacr;": "\u012a", "ImaginaryI;": "\u2148", "Implies;": "\u21d2", "Int;": "\u222c", "Integral;": "\u222b", "Intersection;": "\u22c2", "InvisibleComma;": "\u2063", "InvisibleTimes;": "\u2062", "Iogon;": "\u012e", "Iopf;": "\U0001d540", "Iota;": "\u0399", "Iscr;": "\u2110", "Itilde;": "\u0128", "Iukcy;": "\u0406", "Iuml": "\xcf", "Iuml;": "\xcf", "Jcirc;": "\u0134", "Jcy;": "\u0419", "Jfr;": "\U0001d50d", "Jopf;": "\U0001d541", "Jscr;": "\U0001d4a5", "Jsercy;": "\u0408", "Jukcy;": "\u0404", "KHcy;": "\u0425", "KJcy;": "\u040c", "Kappa;": "\u039a", "Kcedil;": "\u0136", "Kcy;": "\u041a", "Kfr;": "\U0001d50e", "Kopf;": "\U0001d542", "Kscr;": "\U0001d4a6", "LJcy;": "\u0409", "LT": "<", "LT;": "<", "Lacute;": "\u0139", "Lambda;": "\u039b", "Lang;": "\u27ea", "Laplacetrf;": "\u2112", "Larr;": "\u219e", "Lcaron;": "\u013d", "Lcedil;": "\u013b", "Lcy;": "\u041b", "LeftAngleBracket;": "\u27e8", "LeftArrow;": "\u2190", "LeftArrowBar;": "\u21e4", "LeftArrowRightArrow;": "\u21c6", "LeftCeiling;": "\u2308", "LeftDoubleBracket;": "\u27e6", "LeftDownTeeVector;": "\u2961", "LeftDownVector;": "\u21c3", "LeftDownVectorBar;": "\u2959", "LeftFloor;": "\u230a", "LeftRightArrow;": "\u2194", "LeftRightVector;": "\u294e", "LeftTee;": "\u22a3", "LeftTeeArrow;": "\u21a4", "LeftTeeVector;": "\u295a", "LeftTriangle;": "\u22b2", "LeftTriangleBar;": "\u29cf", "LeftTriangleEqual;": "\u22b4", "LeftUpDownVector;": "\u2951", "LeftUpTeeVector;": "\u2960", "LeftUpVector;": "\u21bf", "LeftUpVectorBar;": "\u2958", "LeftVector;": "\u21bc", "LeftVectorBar;": "\u2952", "Leftarrow;": "\u21d0", "Leftrightarrow;": "\u21d4", "LessEqualGreater;": "\u22da", "LessFullEqual;": "\u2266", "LessGreater;": "\u2276", "LessLess;": "\u2aa1", "LessSlantEqual;": "\u2a7d", "LessTilde;": "\u2272", "Lfr;": "\U0001d50f", "Ll;": "\u22d8", "Lleftarrow;": "\u21da", "Lmidot;": "\u013f", "LongLeftArrow;": "\u27f5", "LongLeftRightArrow;": "\u27f7", "LongRightArrow;": "\u27f6", "Longleftarrow;": "\u27f8", "Longleftrightarrow;": "\u27fa", "Longrightarrow;": "\u27f9", "Lopf;": "\U0001d543", "LowerLeftArrow;": "\u2199", "LowerRightArrow;": "\u2198", "Lscr;": "\u2112", "Lsh;": "\u21b0", "Lstrok;": "\u0141", "Lt;": "\u226a", "Map;": "\u2905", "Mcy;": "\u041c", "MediumSpace;": "\u205f", "Mellintrf;": "\u2133", "Mfr;": "\U0001d510", "MinusPlus;": "\u2213", "Mopf;": "\U0001d544", "Mscr;": "\u2133", "Mu;": "\u039c", "NJcy;": "\u040a", "Nacute;": "\u0143", "Ncaron;": "\u0147", "Ncedil;": "\u0145", "Ncy;": "\u041d", "NegativeMediumSpace;": "\u200b", "NegativeThickSpace;": "\u200b", "NegativeThinSpace;": "\u200b", "NegativeVeryThinSpace;": "\u200b", "NestedGreaterGreater;": "\u226b", "NestedLessLess;": "\u226a", "NewLine;": "\n", "Nfr;": "\U0001d511", "NoBreak;": "\u2060", "NonBreakingSpace;": "\xa0", "Nopf;": "\u2115", "Not;": "\u2aec", "NotCongruent;": "\u2262", "NotCupCap;": "\u226d", "NotDoubleVerticalBar;": "\u2226", "NotElement;": "\u2209", "NotEqual;": "\u2260", "NotEqualTilde;": "\u2242\u0338", "NotExists;": "\u2204", "NotGreater;": "\u226f", "NotGreaterEqual;": "\u2271", "NotGreaterFullEqual;": "\u2267\u0338", "NotGreaterGreater;": "\u226b\u0338", "NotGreaterLess;": "\u2279", "NotGreaterSlantEqual;": "\u2a7e\u0338", "NotGreaterTilde;": "\u2275", "NotHumpDownHump;": "\u224e\u0338", "NotHumpEqual;": "\u224f\u0338", "NotLeftTriangle;": "\u22ea", "NotLeftTriangleBar;": "\u29cf\u0338", "NotLeftTriangleEqual;": "\u22ec", "NotLess;": "\u226e", "NotLessEqual;": "\u2270", "NotLessGreater;": "\u2278", "NotLessLess;": "\u226a\u0338", "NotLessSlantEqual;": "\u2a7d\u0338", "NotLessTilde;": "\u2274", "NotNestedGreaterGreater;": "\u2aa2\u0338", "NotNestedLessLess;": "\u2aa1\u0338", "NotPrecedes;": "\u2280", "NotPrecedesEqual;": "\u2aaf\u0338", "NotPrecedesSlantEqual;": "\u22e0", "NotReverseElement;": "\u220c", "NotRightTriangle;": "\u22eb", "NotRightTriangleBar;": "\u29d0\u0338", "NotRightTriangleEqual;": "\u22ed", "NotSquareSubset;": "\u228f\u0338", "NotSquareSubsetEqual;": "\u22e2", "NotSquareSuperset;": "\u2290\u0338", "NotSquareSupersetEqual;": "\u22e3", "NotSubset;": "\u2282\u20d2", "NotSubsetEqual;": "\u2288", "NotSucceeds;": "\u2281", "NotSucceedsEqual;": "\u2ab0\u0338", "NotSucceedsSlantEqual;": "\u22e1", "NotSucceedsTilde;": "\u227f\u0338", "NotSuperset;": "\u2283\u20d2", "NotSupersetEqual;": "\u2289", "NotTilde;": "\u2241", "NotTildeEqual;": "\u2244", "NotTildeFullEqual;": "\u2247", "NotTildeTilde;": "\u2249", "NotVerticalBar;": "\u2224", "Nscr;": "\U0001d4a9", "Ntilde": "\xd1", "Ntilde;": "\xd1", "Nu;": "\u039d", "OElig;": "\u0152", "Oacute": "\xd3", "Oacute;": "\xd3", "Ocirc": "\xd4", "Ocirc;": "\xd4", "Ocy;": "\u041e", "Odblac;": "\u0150", "Ofr;": "\U0001d512", "Ograve": "\xd2", "Ograve;": "\xd2", "Omacr;": "\u014c", "Omega;": "\u03a9", "Omicron;": "\u039f", "Oopf;": "\U0001d546", "OpenCurlyDoubleQuote;": "\u201c", "OpenCurlyQuote;": "\u2018", "Or;": "\u2a54", "Oscr;": "\U0001d4aa", "Oslash": "\xd8", "Oslash;": "\xd8", "Otilde": "\xd5", "Otilde;": "\xd5", "Otimes;": "\u2a37", "Ouml": "\xd6", "Ouml;": "\xd6", "OverBar;": "\u203e", "OverBrace;": "\u23de", "OverBracket;": "\u23b4", "OverParenthesis;": "\u23dc", "PartialD;": "\u2202", "Pcy;": "\u041f", "Pfr;": "\U0001d513", "Phi;": "\u03a6", "Pi;": "\u03a0", "PlusMinus;": "\xb1", "Poincareplane;": "\u210c", "Popf;": "\u2119", "Pr;": "\u2abb", "Precedes;": "\u227a", "PrecedesEqual;": "\u2aaf", "PrecedesSlantEqual;": "\u227c", "PrecedesTilde;": "\u227e", "Prime;": "\u2033", "Product;": "\u220f", "Proportion;": "\u2237", "Proportional;": "\u221d", "Pscr;": "\U0001d4ab", "Psi;": "\u03a8", "QUOT": "\"", "QUOT;": "\"", "Qfr;": "\U0001d514", "Qopf;": "\u211a", "Qscr;": "\U0001d4ac", "RBarr;": "\u2910", "REG": "\xae", "REG;": "\xae", "Racute;": "\u0154", "Rang;": "\u27eb", "Rarr;": "\u21a0", "Rarrtl;": "\u2916", "Rcaron;": "\u0158", "Rcedil;": "\u0156", "Rcy;": "\u0420", "Re;": "\u211c", "ReverseElement;": "\u220b", "ReverseEquilibrium;": "\u21cb", "ReverseUpEquilibrium;": "\u296f", "Rfr;": "\u211c", "Rho;": "\u03a1", "RightAngleBracket;": "\u27e9", "RightArrow;": "\u2192", "RightArrowBar;": "\u21e5", "RightArrowLeftArrow;": "\u21c4", "RightCeiling;": "\u2309", "RightDoubleBracket;": "\u27e7", "RightDownTeeVector;": "\u295d", "RightDownVector;": "\u21c2", "RightDownVectorBar;": "\u2955", "RightFloor;": "\u230b", "RightTee;": "\u22a2", "RightTeeArrow;": "\u21a6", "RightTeeVector;": "\u295b", "RightTriangle;": "\u22b3", "RightTriangleBar;": "\u29d0", "RightTriangleEqual;": "\u22b5", "RightUpDownVector;": "\u294f", "RightUpTeeVector;": "\u295c", "RightUpVector;": "\u21be", "RightUpVectorBar;": "\u2954", "RightVector;": "\u21c0", "RightVectorBar;": "\u2953", "Rightarrow;": "\u21d2", "Ropf;": "\u211d", "RoundImplies;": "\u2970", "Rrightarrow;": "\u21db", "Rscr;": "\u211b", "Rsh;": "\u21b1", "RuleDelayed;": "\u29f4", "SHCHcy;": "\u0429", "SHcy;": "\u0428", "SOFTcy;": "\u042c", "Sacute;": "\u015a", "Sc;": "\u2abc", "Scaron;": "\u0160", "Scedil;": "\u015e", "Scirc;": "\u015c", "Scy;": "\u0421", "Sfr;": "\U0001d516", "ShortDownArrow;": "\u2193", "ShortLeftArrow;": "\u2190", "ShortRightArrow;": "\u2192", "ShortUpArrow;": "\u2191", "Sigma;": "\u03a3", "SmallCircle;": "\u2218", "Sopf;": "\U0001d54a", "Sqrt;": "\u221a", "Square;": "\u25a1", "SquareIntersection;": "\u2293", "SquareSubset;": "\u228f", "SquareSubsetEqual;": "\u2291", "SquareSuperset;": "\u2290", "SquareSupersetEqual;": "\u2292", "SquareUnion;": "\u2294", "Sscr;": "\U0001d4ae", "Star;": "\u22c6", "Sub;": "\u22d0", "Subset;": "\u22d0", "SubsetEqual;": "\u2286", "Succeeds;": "\u227b", "SucceedsEqual;": "\u2ab0", "SucceedsSlantEqual;": "\u227d", "SucceedsTilde;": "\u227f", "SuchThat;": "\u220b", "Sum;": "\u2211", "Sup;": "\u22d1", "Superset;": "\u2283", "SupersetEqual;": "\u2287", "Supset;": "\u22d1", "THORN": "\xde", "THORN;": "\xde", "TRADE;": "\u2122", "TSHcy;": "\u040b", "TScy;": "\u0426", "Tab;": "\t", "Tau;": "\u03a4", "Tcaron;": "\u0164", "Tcedil;": "\u0162", "Tcy;": "\u0422", "Tfr;": "\U0001d517", "Therefore;": "\u2234", "Theta;": "\u0398", "ThickSpace;": "\u205f\u200a", "ThinSpace;": "\u2009", "Tilde;": "\u223c", "TildeEqual;": "\u2243", "TildeFullEqual;": "\u2245", "TildeTilde;": "\u2248", "Topf;": "\U0001d54b", "TripleDot;": "\u20db", "Tscr;": "\U0001d4af", "Tstrok;": "\u0166", "Uacute": "\xda", "Uacute;": "\xda", "Uarr;": "\u219f", "Uarrocir;": "\u2949", "Ubrcy;": "\u040e", "Ubreve;": "\u016c", "Ucirc": "\xdb", "Ucirc;": "\xdb", "Ucy;": "\u0423", "Udblac;": "\u0170", "Ufr;": "\U0001d518", "Ugrave": "\xd9", "Ugrave;": "\xd9", "Umacr;": "\u016a", "UnderBar;": "_", "UnderBrace;": "\u23df", "UnderBracket;": "\u23b5", "UnderParenthesis;": "\u23dd", "Union;": "\u22c3", "UnionPlus;": "\u228e", "Uogon;": "\u0172", "Uopf;": "\U0001d54c", "UpArrow;": "\u2191", "UpArrowBar;": "\u2912", "UpArrowDownArrow;": "\u21c5", "UpDownArrow;": "\u2195", "UpEquilibrium;": "\u296e", "UpTee;": "\u22a5", "UpTeeArrow;": "\u21a5", "Uparrow;": "\u21d1", "Updownarrow;": "\u21d5", "UpperLeftArrow;": "\u2196", "UpperRightArrow;": "\u2197", "Upsi;": "\u03d2", "Upsilon;": "\u03a5", "Uring;": "\u016e", "Uscr;": "\U0001d4b0", "Utilde;": "\u0168", "Uuml": "\xdc", "Uuml;": "\xdc", "VDash;": "\u22ab", "Vbar;": "\u2aeb", "Vcy;": "\u0412", "Vdash;": "\u22a9", "Vdashl;": "\u2ae6", "Vee;": "\u22c1", "Verbar;": "\u2016", "Vert;": "\u2016", "VerticalBar;": "\u2223", "VerticalLine;": "|", "VerticalSeparator;": "\u2758", "VerticalTilde;": "\u2240", "VeryThinSpace;": "\u200a", "Vfr;": "\U0001d519", "Vopf;": "\U0001d54d", "Vscr;": "\U0001d4b1", "Vvdash;": "\u22aa", "Wcirc;": "\u0174", "Wedge;": "\u22c0", "Wfr;": "\U0001d51a", "Wopf;": "\U0001d54e", "Wscr;": "\U0001d4b2", "Xfr;": "\U0001d51b", "Xi;": "\u039e", "Xopf;": "\U0001d54f", "Xscr;": "\U0001d4b3", "YAcy;": "\u042f", "YIcy;": "\u0407", "YUcy;": "\u042e", "Yacute": "\xdd", "Yacute;": "\xdd", "Ycirc;": "\u0176", "Ycy;": "\u042b", "Yfr;": "\U0001d51c", "Yopf;": "\U0001d550", "Yscr;": "\U0001d4b4", "Yuml;": "\u0178", "ZHcy;": "\u0416", "Zacute;": "\u0179", "Zcaron;": "\u017d", "Zcy;": "\u0417", "Zdot;": "\u017b", "ZeroWidthSpace;": "\u200b", "Zeta;": "\u0396", "Zfr;": "\u2128", "Zopf;": "\u2124", "Zscr;": "\U0001d4b5", "aacute": "\xe1", "aacute;": "\xe1", "abreve;": "\u0103", "ac;": "\u223e", "acE;": "\u223e\u0333", "acd;": "\u223f", "acirc": "\xe2", "acirc;": "\xe2", "acute": "\xb4", "acute;": "\xb4", "acy;": "\u0430", "aelig": "\xe6", "aelig;": "\xe6", "af;": "\u2061", "afr;": "\U0001d51e", "agrave": "\xe0", "agrave;": "\xe0", "alefsym;": "\u2135", "aleph;": "\u2135", "alpha;": "\u03b1", "amacr;": "\u0101", "amalg;": "\u2a3f", "amp": "&", "amp;": "&", "and;": "\u2227", "andand;": "\u2a55", "andd;": "\u2a5c", "andslope;": "\u2a58", "andv;": "\u2a5a", "ang;": "\u2220", "ange;": "\u29a4", "angle;": "\u2220", "angmsd;": "\u2221", "angmsdaa;": "\u29a8", "angmsdab;": "\u29a9", "angmsdac;": "\u29aa", "angmsdad;": "\u29ab", "angmsdae;": "\u29ac", "angmsdaf;": "\u29ad", "angmsdag;": "\u29ae", "angmsdah;": "\u29af", "angrt;": "\u221f", "angrtvb;": "\u22be", "angrtvbd;": "\u299d", "angsph;": "\u2222", "angst;": "\xc5", "angzarr;": "\u237c", "aogon;": "\u0105", "aopf;": "\U0001d552", "ap;": "\u2248", "apE;": "\u2a70", "apacir;": "\u2a6f", "ape;": "\u224a", "apid;": "\u224b", "apos;": "'", "approx;": "\u2248", "approxeq;": "\u224a", "aring": "\xe5", "aring;": "\xe5", "ascr;": "\U0001d4b6", "ast;": "*", "asymp;": "\u2248", "asympeq;": "\u224d", "atilde": "\xe3", "atilde;": "\xe3", "auml": "\xe4", "auml;": "\xe4", "awconint;": "\u2233", "awint;": "\u2a11", "bNot;": "\u2aed", "backcong;": "\u224c", "backepsilon;": "\u03f6", "backprime;": "\u2035", "backsim;": "\u223d", "backsimeq;": "\u22cd", "barvee;": "\u22bd", "barwed;": "\u2305", "barwedge;": "\u2305", "bbrk;": "\u23b5", "bbrktbrk;": "\u23b6", "bcong;": "\u224c", "bcy;": "\u0431", "bdquo;": "\u201e", "becaus;": "\u2235", "because;": "\u2235", "bemptyv;": "\u29b0", "bepsi;": "\u03f6", "bernou;": "\u212c", "beta;": "\u03b2", "beth;": "\u2136", "between;": "\u226c", "bfr;": "\U0001d51f", "bigcap;": "\u22c2", "bigcirc;": "\u25ef", "bigcup;": "\u22c3", "bigodot;": "\u2a00", "bigoplus;": "\u2a01", "bigotimes;": "\u2a02", "bigsqcup;": "\u2a06", "bigstar;": "\u2605", "bigtriangledown;": "\u25bd", "bigtriangleup;": "\u25b3", "biguplus;": "\u2a04", "bigvee;": "\u22c1", "bigwedge;": "\u22c0", "bkarow;": "\u290d", "blacklozenge;": "\u29eb", "blacksquare;": "\u25aa", "blacktriangle;": "\u25b4", "blacktriangledown;": "\u25be", "blacktriangleleft;": "\u25c2", "blacktriangleright;": "\u25b8", "blank;": "\u2423", "blk12;": "\u2592", "blk14;": "\u2591", "blk34;": "\u2593", "block;": "\u2588", "bne;": "=\u20e5", "bnequiv;": "\u2261\u20e5", "bnot;": "\u2310", "bopf;": "\U0001d553", "bot;": "\u22a5", "bottom;": "\u22a5", "bowtie;": "\u22c8", "boxDL;": "\u2557", "boxDR;": "\u2554", "boxDl;": "\u2556", "boxDr;": "\u2553", "boxH;": "\u2550", "boxHD;": "\u2566", "boxHU;": "\u2569", "boxHd;": "\u2564", "boxHu;": "\u2567", "boxUL;": "\u255d", "boxUR;": "\u255a", "boxUl;": "\u255c", "boxUr;": "\u2559", "boxV;": "\u2551", "boxVH;": "\u256c", "boxVL;": "\u2563", "boxVR;": "\u2560", "boxVh;": "\u256b", "boxVl;": "\u2562", "boxVr;": "\u255f", "boxbox;": "\u29c9", "boxdL;": "\u2555", "boxdR;": "\u2552", "boxdl;": "\u2510", "boxdr;": "\u250c", "boxh;": "\u2500", "boxhD;": "\u2565", "boxhU;": "\u2568", "boxhd;": "\u252c", "boxhu;": "\u2534", "boxminus;": "\u229f", "boxplus;": "\u229e", "boxtimes;": "\u22a0", "boxuL;": "\u255b", "boxuR;": "\u2558", "boxul;": "\u2518", "boxur;": "\u2514", "boxv;": "\u2502", "boxvH;": "\u256a", "boxvL;": "\u2561", "boxvR;": "\u255e", "boxvh;": "\u253c", "boxvl;": "\u2524", "boxvr;": "\u251c", "bprime;": "\u2035", "breve;": "\u02d8", "brvbar": "\xa6", "brvbar;": "\xa6", "bscr;": "\U0001d4b7", "bsemi;": "\u204f", "bsim;": "\u223d", "bsime;": "\u22cd", "bsol;": "\\", "bsolb;": "\u29c5", "bsolhsub;": "\u27c8", "bull;": "\u2022", "bullet;": "\u2022", "bump;": "\u224e", "bumpE;": "\u2aae", "bumpe;": "\u224f", "bumpeq;": "\u224f", "cacute;": "\u0107", "cap;": "\u2229", "capand;": "\u2a44", "capbrcup;": "\u2a49", "capcap;": "\u2a4b", "capcup;": "\u2a47", "capdot;": "\u2a40", "caps;": "\u2229\ufe00", "caret;": "\u2041", "caron;": "\u02c7", "ccaps;": "\u2a4d", "ccaron;": "\u010d", "ccedil": "\xe7", "ccedil;": "\xe7", "ccirc;": "\u0109", "ccups;": "\u2a4c", "ccupssm;": "\u2a50", "cdot;": "\u010b", "cedil": "\xb8", "cedil;": "\xb8", "cemptyv;": "\u29b2", "cent": "\xa2", "cent;": "\xa2", "centerdot;": "\xb7", "cfr;": "\U0001d520", "chcy;": "\u0447", "check;": "\u2713", "checkmark;": "\u2713", "chi;": "\u03c7", "cir;": "\u25cb", "cirE;": "\u29c3", "circ;": "\u02c6", "circeq;": "\u2257", "circlearrowleft;": "\u21ba", "circlearrowright;": "\u21bb", "circledR;": "\xae", "circledS;": "\u24c8", "circledast;": "\u229b", "circledcirc;": "\u229a", "circleddash;": "\u229d", "cire;": "\u2257", "cirfnint;": "\u2a10", "cirmid;": "\u2aef", "cirscir;": "\u29c2", "clubs;": "\u2663", "clubsuit;": "\u2663", "colon;": ":", "colone;": "\u2254", "coloneq;": "\u2254", "comma;": ",", "commat;": "@", "comp;": "\u2201", "compfn;": "\u2218", "complement;": "\u2201", "complexes;": "\u2102", "cong;": "\u2245", "congdot;": "\u2a6d", "conint;": "\u222e", "copf;": "\U0001d554", "coprod;": "\u2210", "copy": "\xa9", "copy;": "\xa9", "copysr;": "\u2117", "crarr;": "\u21b5", "cross;": "\u2717", "cscr;": "\U0001d4b8", "csub;": "\u2acf", "csube;": "\u2ad1", "csup;": "\u2ad0", "csupe;": "\u2ad2", "ctdot;": "\u22ef", "cudarrl;": "\u2938", "cudarrr;": "\u2935", "cuepr;": "\u22de", "cuesc;": "\u22df", "cularr;": "\u21b6", "cularrp;": "\u293d", "cup;": "\u222a", "cupbrcap;": "\u2a48", "cupcap;": "\u2a46", "cupcup;": "\u2a4a", "cupdot;": "\u228d", "cupor;": "\u2a45", "cups;": "\u222a\ufe00", "curarr;": "\u21b7", "curarrm;": "\u293c", "curlyeqprec;": "\u22de", "curlyeqsucc;": "\u22df", "curlyvee;": "\u22ce", "curlywedge;": "\u22cf", "curren": "\xa4", "curren;": "\xa4", "curvearrowleft;": "\u21b6", "curvearrowright;": "\u21b7", "cuvee;": "\u22ce", "cuwed;": "\u22cf", "cwconint;": "\u2232", "cwint;": "\u2231", "cylcty;": "\u232d", "dArr;": "\u21d3", "dHar;": "\u2965", "dagger;": "\u2020", "daleth;": "\u2138", "darr;": "\u2193", "dash;": "\u2010", "dashv;": "\u22a3", "dbkarow;": "\u290f", "dblac;": "\u02dd", "dcaron;": "\u010f", "dcy;": "\u0434", "dd;": "\u2146", "ddagger;": "\u2021", "ddarr;": "\u21ca", "ddotseq;": "\u2a77", "deg": "\xb0", "deg;": "\xb0", "delta;": "\u03b4", "demptyv;": "\u29b1", "dfisht;": "\u297f", "dfr;": "\U0001d521", "dharl;": "\u21c3", "dharr;": "\u21c2", "diam;": "\u22c4", "diamond;": "\u22c4", "diamondsuit;": "\u2666", "diams;": "\u2666", "die;": "\xa8", "digamma;": "\u03dd", "disin;": "\u22f2", "div;": "\xf7", "divide": "\xf7", "divide;": "\xf7", "divideontimes;": "\u22c7", "divonx;": "\u22c7", "djcy;": "\u0452", "dlcorn;": "\u231e", "dlcrop;": "\u230d", "dollar;": "$", "dopf;": "\U0001d555", "dot;": "\u02d9", "doteq;": "\u2250", "doteqdot;": "\u2251", "dotminus;": "\u2238", "dotplus;": "\u2214", "dotsquare;": "\u22a1", "doublebarwedge;": "\u2306", "downarrow;": "\u2193", "downdownarrows;": "\u21ca", "downharpoonleft;": "\u21c3", "downharpoonright;": "\u21c2", "drbkarow;": "\u2910", "drcorn;": "\u231f", "drcrop;": "\u230c", "dscr;": "\U0001d4b9", "dscy;": "\u0455", "dsol;": "\u29f6", "dstrok;": "\u0111", "dtdot;": "\u22f1", "dtri;": "\u25bf", "dtrif;": "\u25be", "duarr;": "\u21f5", "duhar;": "\u296f", "dwangle;": "\u29a6", "dzcy;": "\u045f", "dzigrarr;": "\u27ff", "eDDot;": "\u2a77", "eDot;": "\u2251", "eacute": "\xe9", "eacute;": "\xe9", "easter;": "\u2a6e", "ecaron;": "\u011b", "ecir;": "\u2256", "ecirc": "\xea", "ecirc;": "\xea", "ecolon;": "\u2255", "ecy;": "\u044d", "edot;": "\u0117", "ee;": "\u2147", "efDot;": "\u2252", "efr;": "\U0001d522", "eg;": "\u2a9a", "egrave": "\xe8", "egrave;": "\xe8", "egs;": "\u2a96", "egsdot;": "\u2a98", "el;": "\u2a99", "elinters;": "\u23e7", "ell;": "\u2113", "els;": "\u2a95", "elsdot;": "\u2a97", "emacr;": "\u0113", "empty;": "\u2205", "emptyset;": "\u2205", "emptyv;": "\u2205", "emsp13;": "\u2004", "emsp14;": "\u2005", "emsp;": "\u2003", "eng;": "\u014b", "ensp;": "\u2002", "eogon;": "\u0119", "eopf;": "\U0001d556", "epar;": "\u22d5", "eparsl;": "\u29e3", "eplus;": "\u2a71", "epsi;": "\u03b5", "epsilon;": "\u03b5", "epsiv;": "\u03f5", "eqcirc;": "\u2256", "eqcolon;": "\u2255", "eqsim;": "\u2242", "eqslantgtr;": "\u2a96", "eqslantless;": "\u2a95", "equals;": "=", "equest;": "\u225f", "equiv;": "\u2261", "equivDD;": "\u2a78", "eqvparsl;": "\u29e5", "erDot;": "\u2253", "erarr;": "\u2971", "escr;": "\u212f", "esdot;": "\u2250", "esim;": "\u2242", "eta;": "\u03b7", "eth": "\xf0", "eth;": "\xf0", "euml": "\xeb", "euml;": "\xeb", "euro;": "\u20ac", "excl;": "!", "exist;": "\u2203", "expectation;": "\u2130", "exponentiale;": "\u2147", "fallingdotseq;": "\u2252", "fcy;": "\u0444", "female;": "\u2640", "ffilig;": "\ufb03", "fflig;": "\ufb00", "ffllig;": "\ufb04", "ffr;": "\U0001d523", "filig;": "\ufb01", "fjlig;": "fj", "flat;": "\u266d", "fllig;": "\ufb02", "fltns;": "\u25b1", "fnof;": "\u0192", "fopf;": "\U0001d557", "forall;": "\u2200", "fork;": "\u22d4", "forkv;": "\u2ad9", "fpartint;": "\u2a0d", "frac12": "\xbd", "frac12;": "\xbd", "frac13;": "\u2153", "frac14": "\xbc", "frac14;": "\xbc", "frac15;": "\u2155", "frac16;": "\u2159", "frac18;": "\u215b", "frac23;": "\u2154", "frac25;": "\u2156", "frac34": "\xbe", "frac34;": "\xbe", "frac35;": "\u2157", "frac38;": "\u215c", "frac45;": "\u2158", "frac56;": "\u215a", "frac58;": "\u215d", "frac78;": "\u215e", "frasl;": "\u2044", "frown;": "\u2322", "fscr;": "\U0001d4bb", "gE;": "\u2267", "gEl;": "\u2a8c", "gacute;": "\u01f5", "gamma;": "\u03b3", "gammad;": "\u03dd", "gap;": "\u2a86", "gbreve;": "\u011f", "gcirc;": "\u011d", "gcy;": "\u0433", "gdot;": "\u0121", "ge;": "\u2265", "gel;": "\u22db", "geq;": "\u2265", "geqq;": "\u2267", "geqslant;": "\u2a7e", "ges;": "\u2a7e", "gescc;": "\u2aa9", "gesdot;": "\u2a80", "gesdoto;": "\u2a82", "gesdotol;": "\u2a84", "gesl;": "\u22db\ufe00", "gesles;": "\u2a94", "gfr;": "\U0001d524", "gg;": "\u226b", "ggg;": "\u22d9", "gimel;": "\u2137", "gjcy;": "\u0453", "gl;": "\u2277", "glE;": "\u2a92", "gla;": "\u2aa5", "glj;": "\u2aa4", "gnE;": "\u2269", "gnap;": "\u2a8a", "gnapprox;": "\u2a8a", "gne;": "\u2a88", "gneq;": "\u2a88", "gneqq;": "\u2269", "gnsim;": "\u22e7", "gopf;": "\U0001d558", "grave;": "`", "gscr;": "\u210a", "gsim;": "\u2273", "gsime;": "\u2a8e", "gsiml;": "\u2a90", "gt": ">", "gt;": ">", "gtcc;": "\u2aa7", "gtcir;": "\u2a7a", "gtdot;": "\u22d7", "gtlPar;": "\u2995", "gtquest;": "\u2a7c", "gtrapprox;": "\u2a86", "gtrarr;": "\u2978", "gtrdot;": "\u22d7", "gtreqless;": "\u22db", "gtreqqless;": "\u2a8c", "gtrless;": "\u2277", "gtrsim;": "\u2273", "gvertneqq;": "\u2269\ufe00", "gvnE;": "\u2269\ufe00", "hArr;": "\u21d4", "hairsp;": "\u200a", "half;": "\xbd", "hamilt;": "\u210b", "hardcy;": "\u044a", "harr;": "\u2194", "harrcir;": "\u2948", "harrw;": "\u21ad", "hbar;": "\u210f", "hcirc;": "\u0125", "hearts;": "\u2665", "heartsuit;": "\u2665", "hellip;": "\u2026", "hercon;": "\u22b9", "hfr;": "\U0001d525", "hksearow;": "\u2925", "hkswarow;": "\u2926", "hoarr;": "\u21ff", "homtht;": "\u223b", "hookleftarrow;": "\u21a9", "hookrightarrow;": "\u21aa", "hopf;": "\U0001d559", "horbar;": "\u2015", "hscr;": "\U0001d4bd", "hslash;": "\u210f", "hstrok;": "\u0127", "hybull;": "\u2043", "hyphen;": "\u2010", "iacute": "\xed", "iacute;": "\xed", "ic;": "\u2063", "icirc": "\xee", "icirc;": "\xee", "icy;": "\u0438", "iecy;": "\u0435", "iexcl": "\xa1", "iexcl;": "\xa1", "iff;": "\u21d4", "ifr;": "\U0001d526", "igrave": "\xec", "igrave;": "\xec", "ii;": "\u2148", "iiiint;": "\u2a0c", "iiint;": "\u222d", "iinfin;": "\u29dc", "iiota;": "\u2129", "ijlig;": "\u0133", "imacr;": "\u012b", "image;": "\u2111", "imagline;": "\u2110", "imagpart;": "\u2111", "imath;": "\u0131", "imof;": "\u22b7", "imped;": "\u01b5", "in;": "\u2208", "incare;": "\u2105", "infin;": "\u221e", "infintie;": "\u29dd", "inodot;": "\u0131", "int;": "\u222b", "intcal;": "\u22ba", "integers;": "\u2124", "intercal;": "\u22ba", "intlarhk;": "\u2a17", "intprod;": "\u2a3c", "iocy;": "\u0451", "iogon;": "\u012f", "iopf;": "\U0001d55a", "iota;": "\u03b9", "iprod;": "\u2a3c", "iquest": "\xbf", "iquest;": "\xbf", "iscr;": "\U0001d4be", "isin;": "\u2208", "isinE;": "\u22f9", "isindot;": "\u22f5", "isins;": "\u22f4", "isinsv;": "\u22f3", "isinv;": "\u2208", "it;": "\u2062", "itilde;": "\u0129", "iukcy;": "\u0456", "iuml": "\xef", "iuml;": "\xef", "jcirc;": "\u0135", "jcy;": "\u0439", "jfr;": "\U0001d527", "jmath;": "\u0237", "jopf;": "\U0001d55b", "jscr;": "\U0001d4bf", "jsercy;": "\u0458", "jukcy;": "\u0454", "kappa;": "\u03ba", "kappav;": "\u03f0", "kcedil;": "\u0137", "kcy;": "\u043a", "kfr;": "\U0001d528", "kgreen;": "\u0138", "khcy;": "\u0445", "kjcy;": "\u045c", "kopf;": "\U0001d55c", "kscr;": "\U0001d4c0", "lAarr;": "\u21da", "lArr;": "\u21d0", "lAtail;": "\u291b", "lBarr;": "\u290e", "lE;": "\u2266", "lEg;": "\u2a8b", "lHar;": "\u2962", "lacute;": "\u013a", "laemptyv;": "\u29b4", "lagran;": "\u2112", "lambda;": "\u03bb", "lang;": "\u27e8", "langd;": "\u2991", "langle;": "\u27e8", "lap;": "\u2a85", "laquo": "\xab", "laquo;": "\xab", "larr;": "\u2190", "larrb;": "\u21e4", "larrbfs;": "\u291f", "larrfs;": "\u291d", "larrhk;": "\u21a9", "larrlp;": "\u21ab", "larrpl;": "\u2939", "larrsim;": "\u2973", "larrtl;": "\u21a2", "lat;": "\u2aab", "latail;": "\u2919", "late;": "\u2aad", "lates;": "\u2aad\ufe00", "lbarr;": "\u290c", "lbbrk;": "\u2772", "lbrace;": "{", "lbrack;": "[", "lbrke;": "\u298b", "lbrksld;": "\u298f", "lbrkslu;": "\u298d", "lcaron;": "\u013e", "lcedil;": "\u013c", "lceil;": "\u2308", "lcub;": "{", "lcy;": "\u043b", "ldca;": "\u2936", "ldquo;": "\u201c", "ldquor;": "\u201e", "ldrdhar;": "\u2967", "ldrushar;": "\u294b", "ldsh;": "\u21b2", "le;": "\u2264", "leftarrow;": "\u2190", "leftarrowtail;": "\u21a2", "leftharpoondown;": "\u21bd", "leftharpoonup;": "\u21bc", "leftleftarrows;": "\u21c7", "leftrightarrow;": "\u2194", "leftrightarrows;": "\u21c6", "leftrightharpoons;": "\u21cb", "leftrightsquigarrow;": "\u21ad", "leftthreetimes;": "\u22cb", "leg;": "\u22da", "leq;": "\u2264", "leqq;": "\u2266", "leqslant;": "\u2a7d", "les;": "\u2a7d", "lescc;": "\u2aa8", "lesdot;": "\u2a7f", "lesdoto;": "\u2a81", "lesdotor;": "\u2a83", "lesg;": "\u22da\ufe00", "lesges;": "\u2a93", "lessapprox;": "\u2a85", "lessdot;": "\u22d6", "lesseqgtr;": "\u22da", "lesseqqgtr;": "\u2a8b", "lessgtr;": "\u2276", "lesssim;": "\u2272", "lfisht;": "\u297c", "lfloor;": "\u230a", "lfr;": "\U0001d529", "lg;": "\u2276", "lgE;": "\u2a91", "lhard;": "\u21bd", "lharu;": "\u21bc", "lharul;": "\u296a", "lhblk;": "\u2584", "ljcy;": "\u0459", "ll;": "\u226a", "llarr;": "\u21c7", "llcorner;": "\u231e", "llhard;": "\u296b", "lltri;": "\u25fa", "lmidot;": "\u0140", "lmoust;": "\u23b0", "lmoustache;": "\u23b0", "lnE;": "\u2268", "lnap;": "\u2a89", "lnapprox;": "\u2a89", "lne;": "\u2a87", "lneq;": "\u2a87", "lneqq;": "\u2268", "lnsim;": "\u22e6", "loang;": "\u27ec", "loarr;": "\u21fd", "lobrk;": "\u27e6", "longleftarrow;": "\u27f5", "longleftrightarrow;": "\u27f7", "longmapsto;": "\u27fc", "longrightarrow;": "\u27f6", "looparrowleft;": "\u21ab", "looparrowright;": "\u21ac", "lopar;": "\u2985", "lopf;": "\U0001d55d", "loplus;": "\u2a2d", "lotimes;": "\u2a34", "lowast;": "\u2217", "lowbar;": "_", "loz;": "\u25ca", "lozenge;": "\u25ca", "lozf;": "\u29eb", "lpar;": "(", "lparlt;": "\u2993", "lrarr;": "\u21c6", "lrcorner;": "\u231f", "lrhar;": "\u21cb", "lrhard;": "\u296d", "lrm;": "\u200e", "lrtri;": "\u22bf", "lsaquo;": "\u2039", "lscr;": "\U0001d4c1", "lsh;": "\u21b0", "lsim;": "\u2272", "lsime;": "\u2a8d", "lsimg;": "\u2a8f", "lsqb;": "[", "lsquo;": "\u2018", "lsquor;": "\u201a", "lstrok;": "\u0142", "lt": "<", "lt;": "<", "ltcc;": "\u2aa6", "ltcir;": "\u2a79", "ltdot;": "\u22d6", "lthree;": "\u22cb", "ltimes;": "\u22c9", "ltlarr;": "\u2976", "ltquest;": "\u2a7b", "ltrPar;": "\u2996", "ltri;": "\u25c3", "ltrie;": "\u22b4", "ltrif;": "\u25c2", "lurdshar;": "\u294a", "luruhar;": "\u2966", "lvertneqq;": "\u2268\ufe00", "lvnE;": "\u2268\ufe00", "mDDot;": "\u223a", "macr": "\xaf", "macr;": "\xaf", "male;": "\u2642", "malt;": "\u2720", "maltese;": "\u2720", "map;": "\u21a6", "mapsto;": "\u21a6", "mapstodown;": "\u21a7", "mapstoleft;": "\u21a4", "mapstoup;": "\u21a5", "marker;": "\u25ae", "mcomma;": "\u2a29", "mcy;": "\u043c", "mdash;": "\u2014", "measuredangle;": "\u2221", "mfr;": "\U0001d52a", "mho;": "\u2127", "micro": "\xb5", "micro;": "\xb5", "mid;": "\u2223", "midast;": "*", "midcir;": "\u2af0", "middot": "\xb7", "middot;": "\xb7", "minus;": "\u2212", "minusb;": "\u229f", "minusd;": "\u2238", "minusdu;": "\u2a2a", "mlcp;": "\u2adb", "mldr;": "\u2026", "mnplus;": "\u2213", "models;": "\u22a7", "mopf;": "\U0001d55e", "mp;": "\u2213", "mscr;": "\U0001d4c2", "mstpos;": "\u223e", "mu;": "\u03bc", "multimap;": "\u22b8", "mumap;": "\u22b8", "nGg;": "\u22d9\u0338", "nGt;": "\u226b\u20d2", "nGtv;": "\u226b\u0338", "nLeftarrow;": "\u21cd", "nLeftrightarrow;": "\u21ce", "nLl;": "\u22d8\u0338", "nLt;": "\u226a\u20d2", "nLtv;": "\u226a\u0338", "nRightarrow;": "\u21cf", "nVDash;": "\u22af", "nVdash;": "\u22ae", "nabla;": "\u2207", "nacute;": "\u0144", "nang;": "\u2220\u20d2", "nap;": "\u2249", "napE;": "\u2a70\u0338", "napid;": "\u224b\u0338", "napos;": "\u0149", "napprox;": "\u2249", "natur;": "\u266e", "natural;": "\u266e", "naturals;": "\u2115", "nbsp": "\xa0", "nbsp;": "\xa0", "nbump;": "\u224e\u0338", "nbumpe;": "\u224f\u0338", "ncap;": "\u2a43", "ncaron;": "\u0148", "ncedil;": "\u0146", "ncong;": "\u2247", "ncongdot;": "\u2a6d\u0338", "ncup;": "\u2a42", "ncy;": "\u043d", "ndash;": "\u2013", "ne;": "\u2260", "neArr;": "\u21d7", "nearhk;": "\u2924", "nearr;": "\u2197", "nearrow;": "\u2197", "nedot;": "\u2250\u0338", "nequiv;": "\u2262", "nesear;": "\u2928", "nesim;": "\u2242\u0338", "nexist;": "\u2204", "nexists;": "\u2204", "nfr;": "\U0001d52b", "ngE;": "\u2267\u0338", "nge;": "\u2271", "ngeq;": "\u2271", "ngeqq;": "\u2267\u0338", "ngeqslant;": "\u2a7e\u0338", "nges;": "\u2a7e\u0338", "ngsim;": "\u2275", "ngt;": "\u226f", "ngtr;": "\u226f", "nhArr;": "\u21ce", "nharr;": "\u21ae", "nhpar;": "\u2af2", "ni;": "\u220b", "nis;": "\u22fc", "nisd;": "\u22fa", "niv;": "\u220b", "njcy;": "\u045a", "nlArr;": "\u21cd", "nlE;": "\u2266\u0338", "nlarr;": "\u219a", "nldr;": "\u2025", "nle;": "\u2270", "nleftarrow;": "\u219a", "nleftrightarrow;": "\u21ae", "nleq;": "\u2270", "nleqq;": "\u2266\u0338", "nleqslant;": "\u2a7d\u0338", "nles;": "\u2a7d\u0338", "nless;": "\u226e", "nlsim;": "\u2274", "nlt;": "\u226e", "nltri;": "\u22ea", "nltrie;": "\u22ec", "nmid;": "\u2224", "nopf;": "\U0001d55f", "not": "\xac", "not;": "\xac", "notin;": "\u2209", "notinE;": "\u22f9\u0338", "notindot;": "\u22f5\u0338", "notinva;": "\u2209", "notinvb;": "\u22f7", "notinvc;": "\u22f6", "notni;": "\u220c", "notniva;": "\u220c", "notnivb;": "\u22fe", "notnivc;": "\u22fd", "npar;": "\u2226", "nparallel;": "\u2226", "nparsl;": "\u2afd\u20e5", "npart;": "\u2202\u0338", "npolint;": "\u2a14", "npr;": "\u2280", "nprcue;": "\u22e0", "npre;": "\u2aaf\u0338", "nprec;": "\u2280", "npreceq;": "\u2aaf\u0338", "nrArr;": "\u21cf", "nrarr;": "\u219b", "nrarrc;": "\u2933\u0338", "nrarrw;": "\u219d\u0338", "nrightarrow;": "\u219b", "nrtri;": "\u22eb", "nrtrie;": "\u22ed", "nsc;": "\u2281", "nsccue;": "\u22e1", "nsce;": "\u2ab0\u0338", "nscr;": "\U0001d4c3", "nshortmid;": "\u2224", "nshortparallel;": "\u2226", "nsim;": "\u2241", "nsime;": "\u2244", "nsimeq;": "\u2244", "nsmid;": "\u2224", "nspar;": "\u2226", "nsqsube;": "\u22e2", "nsqsupe;": "\u22e3", "nsub;": "\u2284", "nsubE;": "\u2ac5\u0338", "nsube;": "\u2288", "nsubset;": "\u2282\u20d2", "nsubseteq;": "\u2288", "nsubseteqq;": "\u2ac5\u0338", "nsucc;": "\u2281", "nsucceq;": "\u2ab0\u0338", "nsup;": "\u2285", "nsupE;": "\u2ac6\u0338", "nsupe;": "\u2289", "nsupset;": "\u2283\u20d2", "nsupseteq;": "\u2289", "nsupseteqq;": "\u2ac6\u0338", "ntgl;": "\u2279", "ntilde": "\xf1", "ntilde;": "\xf1", "ntlg;": "\u2278", "ntriangleleft;": "\u22ea", "ntrianglelefteq;": "\u22ec", "ntriangleright;": "\u22eb", "ntrianglerighteq;": "\u22ed", "nu;": "\u03bd", "num;": "#", "numero;": "\u2116", "numsp;": "\u2007", "nvDash;": "\u22ad", "nvHarr;": "\u2904", "nvap;": "\u224d\u20d2", "nvdash;": "\u22ac", "nvge;": "\u2265\u20d2", "nvgt;": ">\u20d2", "nvinfin;": "\u29de", "nvlArr;": "\u2902", "nvle;": "\u2264\u20d2", "nvlt;": "<\u20d2", "nvltrie;": "\u22b4\u20d2", "nvrArr;": "\u2903", "nvrtrie;": "\u22b5\u20d2", "nvsim;": "\u223c\u20d2", "nwArr;": "\u21d6", "nwarhk;": "\u2923", "nwarr;": "\u2196", "nwarrow;": "\u2196", "nwnear;": "\u2927", "oS;": "\u24c8", "oacute": "\xf3", "oacute;": "\xf3", "oast;": "\u229b", "ocir;": "\u229a", "ocirc": "\xf4", "ocirc;": "\xf4", "ocy;": "\u043e", "odash;": "\u229d", "odblac;": "\u0151", "odiv;": "\u2a38", "odot;": "\u2299", "odsold;": "\u29bc", "oelig;": "\u0153", "ofcir;": "\u29bf", "ofr;": "\U0001d52c", "ogon;": "\u02db", "ograve": "\xf2", "ograve;": "\xf2", "ogt;": "\u29c1", "ohbar;": "\u29b5", "ohm;": "\u03a9", "oint;": "\u222e", "olarr;": "\u21ba", "olcir;": "\u29be", "olcross;": "\u29bb", "oline;": "\u203e", "olt;": "\u29c0", "omacr;": "\u014d", "omega;": "\u03c9", "omicron;": "\u03bf", "omid;": "\u29b6", "ominus;": "\u2296", "oopf;": "\U0001d560", "opar;": "\u29b7", "operp;": "\u29b9", "oplus;": "\u2295", "or;": "\u2228", "orarr;": "\u21bb", "ord;": "\u2a5d", "order;": "\u2134", "orderof;": "\u2134", "ordf": "\xaa", "ordf;": "\xaa", "ordm": "\xba", "ordm;": "\xba", "origof;": "\u22b6", "oror;": "\u2a56", "orslope;": "\u2a57", "orv;": "\u2a5b", "oscr;": "\u2134", "oslash": "\xf8", "oslash;": "\xf8", "osol;": "\u2298", "otilde": "\xf5", "otilde;": "\xf5", "otimes;": "\u2297", "otimesas;": "\u2a36", "ouml": "\xf6", "ouml;": "\xf6", "ovbar;": "\u233d", "par;": "\u2225", "para": "\xb6", "para;": "\xb6", "parallel;": "\u2225", "parsim;": "\u2af3", "parsl;": "\u2afd", "part;": "\u2202", "pcy;": "\u043f", "percnt;": "%", "period;": ".", "permil;": "\u2030", "perp;": "\u22a5", "pertenk;": "\u2031", "pfr;": "\U0001d52d", "phi;": "\u03c6", "phiv;": "\u03d5", "phmmat;": "\u2133", "phone;": "\u260e", "pi;": "\u03c0", "pitchfork;": "\u22d4", "piv;": "\u03d6", "planck;": "\u210f", "planckh;": "\u210e", "plankv;": "\u210f", "plus;": "+", "plusacir;": "\u2a23", "plusb;": "\u229e", "pluscir;": "\u2a22", "plusdo;": "\u2214", "plusdu;": "\u2a25", "pluse;": "\u2a72", "plusmn": "\xb1", "plusmn;": "\xb1", "plussim;": "\u2a26", "plustwo;": "\u2a27", "pm;": "\xb1", "pointint;": "\u2a15", "popf;": "\U0001d561", "pound": "\xa3", "pound;": "\xa3", "pr;": "\u227a", "prE;": "\u2ab3", "prap;": "\u2ab7", "prcue;": "\u227c", "pre;": "\u2aaf", "prec;": "\u227a", "precapprox;": "\u2ab7", "preccurlyeq;": "\u227c", "preceq;": "\u2aaf", "precnapprox;": "\u2ab9", "precneqq;": "\u2ab5", "precnsim;": "\u22e8", "precsim;": "\u227e", "prime;": "\u2032", "primes;": "\u2119", "prnE;": "\u2ab5", "prnap;": "\u2ab9", "prnsim;": "\u22e8", "prod;": "\u220f", "profalar;": "\u232e", "profline;": "\u2312", "profsurf;": "\u2313", "prop;": "\u221d", "propto;": "\u221d", "prsim;": "\u227e", "prurel;": "\u22b0", "pscr;": "\U0001d4c5", "psi;": "\u03c8", "puncsp;": "\u2008", "qfr;": "\U0001d52e", "qint;": "\u2a0c", "qopf;": "\U0001d562", "qprime;": "\u2057", "qscr;": "\U0001d4c6", "quaternions;": "\u210d", "quatint;": "\u2a16", "quest;": "?", "questeq;": "\u225f", "quot": "\"", "quot;": "\"", "rAarr;": "\u21db", "rArr;": "\u21d2", "rAtail;": "\u291c", "rBarr;": "\u290f", "rHar;": "\u2964", "race;": "\u223d\u0331", "racute;": "\u0155", "radic;": "\u221a", "raemptyv;": "\u29b3", "rang;": "\u27e9", "rangd;": "\u2992", "range;": "\u29a5", "rangle;": "\u27e9", "raquo": "\xbb", "raquo;": "\xbb", "rarr;": "\u2192", "rarrap;": "\u2975", "rarrb;": "\u21e5", "rarrbfs;": "\u2920", "rarrc;": "\u2933", "rarrfs;": "\u291e", "rarrhk;": "\u21aa", "rarrlp;": "\u21ac", "rarrpl;": "\u2945", "rarrsim;": "\u2974", "rarrtl;": "\u21a3", "rarrw;": "\u219d", "ratail;": "\u291a", "ratio;": "\u2236", "rationals;": "\u211a", "rbarr;": "\u290d", "rbbrk;": "\u2773", "rbrace;": "}", "rbrack;": "]", "rbrke;": "\u298c", "rbrksld;": "\u298e", "rbrkslu;": "\u2990", "rcaron;": "\u0159", "rcedil;": "\u0157", "rceil;": "\u2309", "rcub;": "}", "rcy;": "\u0440", "rdca;": "\u2937", "rdldhar;": "\u2969", "rdquo;": "\u201d", "rdquor;": "\u201d", "rdsh;": "\u21b3", "real;": "\u211c", "realine;": "\u211b", "realpart;": "\u211c", "reals;": "\u211d", "rect;": "\u25ad", "reg": "\xae", "reg;": "\xae", "rfisht;": "\u297d", "rfloor;": "\u230b", "rfr;": "\U0001d52f", "rhard;": "\u21c1", "rharu;": "\u21c0", "rharul;": "\u296c", "rho;": "\u03c1", "rhov;": "\u03f1", "rightarrow;": "\u2192", "rightarrowtail;": "\u21a3", "rightharpoondown;": "\u21c1", "rightharpoonup;": "\u21c0", "rightleftarrows;": "\u21c4", "rightleftharpoons;": "\u21cc", "rightrightarrows;": "\u21c9", "rightsquigarrow;": "\u219d", "rightthreetimes;": "\u22cc", "ring;": "\u02da", "risingdotseq;": "\u2253", "rlarr;": "\u21c4", "rlhar;": "\u21cc", "rlm;": "\u200f", "rmoust;": "\u23b1", "rmoustache;": "\u23b1", "rnmid;": "\u2aee", "roang;": "\u27ed", "roarr;": "\u21fe", "robrk;": "\u27e7", "ropar;": "\u2986", "ropf;": "\U0001d563", "roplus;": "\u2a2e", "rotimes;": "\u2a35", "rpar;": ")", "rpargt;": "\u2994", "rppolint;": "\u2a12", "rrarr;": "\u21c9", "rsaquo;": "\u203a", "rscr;": "\U0001d4c7", "rsh;": "\u21b1", "rsqb;": "]", "rsquo;": "\u2019", "rsquor;": "\u2019", "rthree;": "\u22cc", "rtimes;": "\u22ca", "rtri;": "\u25b9", "rtrie;": "\u22b5", "rtrif;": "\u25b8", "rtriltri;": "\u29ce", "ruluhar;": "\u2968", "rx;": "\u211e", "sacute;": "\u015b", "sbquo;": "\u201a", "sc;": "\u227b", "scE;": "\u2ab4", "scap;": "\u2ab8", "scaron;": "\u0161", "sccue;": "\u227d", "sce;": "\u2ab0", "scedil;": "\u015f", "scirc;": "\u015d", "scnE;": "\u2ab6", "scnap;": "\u2aba", "scnsim;": "\u22e9", "scpolint;": "\u2a13", "scsim;": "\u227f", "scy;": "\u0441", "sdot;": "\u22c5", "sdotb;": "\u22a1", "sdote;": "\u2a66", "seArr;": "\u21d8", "searhk;": "\u2925", "searr;": "\u2198", "searrow;": "\u2198", "sect": "\xa7", "sect;": "\xa7", "semi;": ";", "seswar;": "\u2929", "setminus;": "\u2216", "setmn;": "\u2216", "sext;": "\u2736", "sfr;": "\U0001d530", "sfrown;": "\u2322", "sharp;": "\u266f", "shchcy;": "\u0449", "shcy;": "\u0448", "shortmid;": "\u2223", "shortparallel;": "\u2225", "shy": "\xad", "shy;": "\xad", "sigma;": "\u03c3", "sigmaf;": "\u03c2", "sigmav;": "\u03c2", "sim;": "\u223c", "simdot;": "\u2a6a", "sime;": "\u2243", "simeq;": "\u2243", "simg;": "\u2a9e", "simgE;": "\u2aa0", "siml;": "\u2a9d", "simlE;": "\u2a9f", "simne;": "\u2246", "simplus;": "\u2a24", "simrarr;": "\u2972", "slarr;": "\u2190", "smallsetminus;": "\u2216", "smashp;": "\u2a33", "smeparsl;": "\u29e4", "smid;": "\u2223", "smile;": "\u2323", "smt;": "\u2aaa", "smte;": "\u2aac", "smtes;": "\u2aac\ufe00", "softcy;": "\u044c", "sol;": "/", "solb;": "\u29c4", "solbar;": "\u233f", "sopf;": "\U0001d564", "spades;": "\u2660", "spadesuit;": "\u2660", "spar;": "\u2225", "sqcap;": "\u2293", "sqcaps;": "\u2293\ufe00", "sqcup;": "\u2294", "sqcups;": "\u2294\ufe00", "sqsub;": "\u228f", "sqsube;": "\u2291", "sqsubset;": "\u228f", "sqsubseteq;": "\u2291", "sqsup;": "\u2290", "sqsupe;": "\u2292", "sqsupset;": "\u2290", "sqsupseteq;": "\u2292", "squ;": "\u25a1", "square;": "\u25a1", "squarf;": "\u25aa", "squf;": "\u25aa", "srarr;": "\u2192", "sscr;": "\U0001d4c8", "ssetmn;": "\u2216", "ssmile;": "\u2323", "sstarf;": "\u22c6", "star;": "\u2606", "starf;": "\u2605", "straightepsilon;": "\u03f5", "straightphi;": "\u03d5", "strns;": "\xaf", "sub;": "\u2282", "subE;": "\u2ac5", "subdot;": "\u2abd", "sube;": "\u2286", "subedot;": "\u2ac3", "submult;": "\u2ac1", "subnE;": "\u2acb", "subne;": "\u228a", "subplus;": "\u2abf", "subrarr;": "\u2979", "subset;": "\u2282", "subseteq;": "\u2286", "subseteqq;": "\u2ac5", "subsetneq;": "\u228a", "subsetneqq;": "\u2acb", "subsim;": "\u2ac7", "subsub;": "\u2ad5", "subsup;": "\u2ad3", "succ;": "\u227b", "succapprox;": "\u2ab8", "succcurlyeq;": "\u227d", "succeq;": "\u2ab0", "succnapprox;": "\u2aba", "succneqq;": "\u2ab6", "succnsim;": "\u22e9", "succsim;": "\u227f", "sum;": "\u2211", "sung;": "\u266a", "sup1": "\xb9", "sup1;": "\xb9", "sup2": "\xb2", "sup2;": "\xb2", "sup3": "\xb3", "sup3;": "\xb3", "sup;": "\u2283", "supE;": "\u2ac6", "supdot;": "\u2abe", "supdsub;": "\u2ad8", "supe;": "\u2287", "supedot;": "\u2ac4", "suphsol;": "\u27c9", "suphsub;": "\u2ad7", "suplarr;": "\u297b", "supmult;": "\u2ac2", "supnE;": "\u2acc", "supne;": "\u228b", "supplus;": "\u2ac0", "supset;": "\u2283", "supseteq;": "\u2287", "supseteqq;": "\u2ac6", "supsetneq;": "\u228b", "supsetneqq;": "\u2acc", "supsim;": "\u2ac8", "supsub;": "\u2ad4", "supsup;": "\u2ad6", "swArr;": "\u21d9", "swarhk;": "\u2926", "swarr;": "\u2199", "swarrow;": "\u2199", "swnwar;": "\u292a", "szlig": "\xdf", "szlig;": "\xdf", "target;": "\u2316", "tau;": "\u03c4", "tbrk;": "\u23b4", "tcaron;": "\u0165", "tcedil;": "\u0163", "tcy;": "\u0442", "tdot;": "\u20db", "telrec;": "\u2315", "tfr;": "\U0001d531", "there4;": "\u2234", "therefore;": "\u2234", "theta;": "\u03b8", "thetasym;": "\u03d1", "thetav;": "\u03d1", "thickapprox;": "\u2248", "thicksim;": "\u223c", "thinsp;": "\u2009", "thkap;": "\u2248", "thksim;": "\u223c", "thorn": "\xfe", "thorn;": "\xfe", "tilde;": "\u02dc", "times": "\xd7", "times;": "\xd7", "timesb;": "\u22a0", "timesbar;": "\u2a31", "timesd;": "\u2a30", "tint;": "\u222d", "toea;": "\u2928", "top;": "\u22a4", "topbot;": "\u2336", "topcir;": "\u2af1", "topf;": "\U0001d565", "topfork;": "\u2ada", "tosa;": "\u2929", "tprime;": "\u2034", "trade;": "\u2122", "triangle;": "\u25b5", "triangledown;": "\u25bf", "triangleleft;": "\u25c3", "trianglelefteq;": "\u22b4", "triangleq;": "\u225c", "triangleright;": "\u25b9", "trianglerighteq;": "\u22b5", "tridot;": "\u25ec", "trie;": "\u225c", "triminus;": "\u2a3a", "triplus;": "\u2a39", "trisb;": "\u29cd", "tritime;": "\u2a3b", "trpezium;": "\u23e2", "tscr;": "\U0001d4c9", "tscy;": "\u0446", "tshcy;": "\u045b", "tstrok;": "\u0167", "twixt;": "\u226c", "twoheadleftarrow;": "\u219e", "twoheadrightarrow;": "\u21a0", "uArr;": "\u21d1", "uHar;": "\u2963", "uacute": "\xfa", "uacute;": "\xfa", "uarr;": "\u2191", "ubrcy;": "\u045e", "ubreve;": "\u016d", "ucirc": "\xfb", "ucirc;": "\xfb", "ucy;": "\u0443", "udarr;": "\u21c5", "udblac;": "\u0171", "udhar;": "\u296e", "ufisht;": "\u297e", "ufr;": "\U0001d532", "ugrave": "\xf9", "ugrave;": "\xf9", "uharl;": "\u21bf", "uharr;": "\u21be", "uhblk;": "\u2580", "ulcorn;": "\u231c", "ulcorner;": "\u231c", "ulcrop;": "\u230f", "ultri;": "\u25f8", "umacr;": "\u016b", "uml": "\xa8", "uml;": "\xa8", "uogon;": "\u0173", "uopf;": "\U0001d566", "uparrow;": "\u2191", "updownarrow;": "\u2195", "upharpoonleft;": "\u21bf", "upharpoonright;": "\u21be", "uplus;": "\u228e", "upsi;": "\u03c5", "upsih;": "\u03d2", "upsilon;": "\u03c5", "upuparrows;": "\u21c8", "urcorn;": "\u231d", "urcorner;": "\u231d", "urcrop;": "\u230e", "uring;": "\u016f", "urtri;": "\u25f9", "uscr;": "\U0001d4ca", "utdot;": "\u22f0", "utilde;": "\u0169", "utri;": "\u25b5", "utrif;": "\u25b4", "uuarr;": "\u21c8", "uuml": "\xfc", "uuml;": "\xfc", "uwangle;": "\u29a7", "vArr;": "\u21d5", "vBar;": "\u2ae8", "vBarv;": "\u2ae9", "vDash;": "\u22a8", "vangrt;": "\u299c", "varepsilon;": "\u03f5", "varkappa;": "\u03f0", "varnothing;": "\u2205", "varphi;": "\u03d5", "varpi;": "\u03d6", "varpropto;": "\u221d", "varr;": "\u2195", "varrho;": "\u03f1", "varsigma;": "\u03c2", "varsubsetneq;": "\u228a\ufe00", "varsubsetneqq;": "\u2acb\ufe00", "varsupsetneq;": "\u228b\ufe00", "varsupsetneqq;": "\u2acc\ufe00", "vartheta;": "\u03d1", "vartriangleleft;": "\u22b2", "vartriangleright;": "\u22b3", "vcy;": "\u0432", "vdash;": "\u22a2", "vee;": "\u2228", "veebar;": "\u22bb", "veeeq;": "\u225a", "vellip;": "\u22ee", "verbar;": "|", "vert;": "|", "vfr;": "\U0001d533", "vltri;": "\u22b2", "vnsub;": "\u2282\u20d2", "vnsup;": "\u2283\u20d2", "vopf;": "\U0001d567", "vprop;": "\u221d", "vrtri;": "\u22b3", "vscr;": "\U0001d4cb", "vsubnE;": "\u2acb\ufe00", "vsubne;": "\u228a\ufe00", "vsupnE;": "\u2acc\ufe00", "vsupne;": "\u228b\ufe00", "vzigzag;": "\u299a", "wcirc;": "\u0175", "wedbar;": "\u2a5f", "wedge;": "\u2227", "wedgeq;": "\u2259", "weierp;": "\u2118", "wfr;": "\U0001d534", "wopf;": "\U0001d568", "wp;": "\u2118", "wr;": "\u2240", "wreath;": "\u2240", "wscr;": "\U0001d4cc", "xcap;": "\u22c2", "xcirc;": "\u25ef", "xcup;": "\u22c3", "xdtri;": "\u25bd", "xfr;": "\U0001d535", "xhArr;": "\u27fa", "xharr;": "\u27f7", "xi;": "\u03be", "xlArr;": "\u27f8", "xlarr;": "\u27f5", "xmap;": "\u27fc", "xnis;": "\u22fb", "xodot;": "\u2a00", "xopf;": "\U0001d569", "xoplus;": "\u2a01", "xotime;": "\u2a02", "xrArr;": "\u27f9", "xrarr;": "\u27f6", "xscr;": "\U0001d4cd", "xsqcup;": "\u2a06", "xuplus;": "\u2a04", "xutri;": "\u25b3", "xvee;": "\u22c1", "xwedge;": "\u22c0", "yacute": "\xfd", "yacute;": "\xfd", "yacy;": "\u044f", "ycirc;": "\u0177", "ycy;": "\u044b", "yen": "\xa5", "yen;": "\xa5", "yfr;": "\U0001d536", "yicy;": "\u0457", "yopf;": "\U0001d56a", "yscr;": "\U0001d4ce", "yucy;": "\u044e", "yuml": "\xff", "yuml;": "\xff", "zacute;": "\u017a", "zcaron;": "\u017e", "zcy;": "\u0437", "zdot;": "\u017c", "zeetrf;": "\u2128", "zeta;": "\u03b6", "zfr;": "\U0001d537", "zhcy;": "\u0436", "zigrarr;": "\u21dd", "zopf;": "\U0001d56b", "zscr;": "\U0001d4cf", "zwj;": "\u200d", "zwnj;": "\u200c", } replacementCharacters = { 0x0: "\uFFFD", 0x0d: "\u000D", 0x80: "\u20AC", 0x81: "\u0081", 0x82: "\u201A", 0x83: "\u0192", 0x84: "\u201E", 0x85: "\u2026", 0x86: "\u2020", 0x87: "\u2021", 0x88: "\u02C6", 0x89: "\u2030", 0x8A: "\u0160", 0x8B: "\u2039", 0x8C: "\u0152", 0x8D: "\u008D", 0x8E: "\u017D", 0x8F: "\u008F", 0x90: "\u0090", 0x91: "\u2018", 0x92: "\u2019", 0x93: "\u201C", 0x94: "\u201D", 0x95: "\u2022", 0x96: "\u2013", 0x97: "\u2014", 0x98: "\u02DC", 0x99: "\u2122", 0x9A: "\u0161", 0x9B: "\u203A", 0x9C: "\u0153", 0x9D: "\u009D", 0x9E: "\u017E", 0x9F: "\u0178", } tokenTypes = { "Doctype": 0, "Characters": 1, "SpaceCharacters": 2, "StartTag": 3, "EndTag": 4, "EmptyTag": 5, "Comment": 6, "ParseError": 7 } tagTokenTypes = frozenset([tokenTypes["StartTag"], tokenTypes["EndTag"], tokenTypes["EmptyTag"]]) prefixes = {v: k for k, v in namespaces.items()} prefixes["http://www.w3.org/1998/Math/MathML"] = "math" class DataLossWarning(UserWarning): """Raised when the current tree is unable to represent the input data""" pass class _ReparseException(Exception): pass html5lib/_tokenizer.py000064400000226360152347724720011035 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import unichr as chr from collections import deque, OrderedDict from sys import version_info from .constants import spaceCharacters from .constants import entities from .constants import asciiLetters, asciiUpper2Lower from .constants import digits, hexDigits, EOF from .constants import tokenTypes, tagTokenTypes from .constants import replacementCharacters from ._inputstream import HTMLInputStream from ._trie import Trie entitiesTrie = Trie(entities) if version_info >= (3, 7): attributeMap = dict else: attributeMap = OrderedDict class HTMLTokenizer(object): """ This class takes care of tokenizing HTML. * self.currentToken Holds the token that is currently being processed. * self.state Holds a reference to the method to be invoked... XXX * self.stream Points to HTMLInputStream object. """ def __init__(self, stream, parser=None, **kwargs): self.stream = HTMLInputStream(stream, **kwargs) self.parser = parser # Setup the initial tokenizer state self.escapeFlag = False self.lastFourChars = [] self.state = self.dataState self.escape = False # The current token being created self.currentToken = None super(HTMLTokenizer, self).__init__() def __iter__(self): """ This is where the magic happens. We do our usually processing through the states and when we have a token to return we yield the token which pauses processing until the next token is requested. """ self.tokenQueue = deque([]) # Start processing. When EOF is reached self.state will return False # instead of True and the loop will terminate. while self.state(): while self.stream.errors: yield {"type": tokenTypes["ParseError"], "data": self.stream.errors.pop(0)} while self.tokenQueue: yield self.tokenQueue.popleft() def consumeNumberEntity(self, isHex): """This function returns either U+FFFD or the character based on the decimal or hexadecimal representation. It also discards ";" if present. If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked. """ allowed = digits radix = 10 if isHex: allowed = hexDigits radix = 16 charStack = [] # Consume all the characters that are in range while making sure we # don't hit an EOF. c = self.stream.char() while c in allowed and c is not EOF: charStack.append(c) c = self.stream.char() # Convert the set of characters consumed to an int. charAsInt = int("".join(charStack), radix) # Certain characters get replaced with others if charAsInt in replacementCharacters: char = replacementCharacters[charAsInt] self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "illegal-codepoint-for-numeric-entity", "datavars": {"charAsInt": charAsInt}}) elif ((0xD800 <= charAsInt <= 0xDFFF) or (charAsInt > 0x10FFFF)): char = "\uFFFD" self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "illegal-codepoint-for-numeric-entity", "datavars": {"charAsInt": charAsInt}}) else: # Should speed up this check somehow (e.g. move the set to a constant) if ((0x0001 <= charAsInt <= 0x0008) or (0x000E <= charAsInt <= 0x001F) or (0x007F <= charAsInt <= 0x009F) or (0xFDD0 <= charAsInt <= 0xFDEF) or charAsInt in frozenset([0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF, 0x10FFFE, 0x10FFFF])): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "illegal-codepoint-for-numeric-entity", "datavars": {"charAsInt": charAsInt}}) try: # Try/except needed as UCS-2 Python builds' unichar only works # within the BMP. char = chr(charAsInt) except ValueError: v = charAsInt - 0x10000 char = chr(0xD800 | (v >> 10)) + chr(0xDC00 | (v & 0x3FF)) # Discard the ; if present. Otherwise, put it back on the queue and # invoke parseError on parser. if c != ";": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "numeric-entity-without-semicolon"}) self.stream.unget(c) return char def consumeEntity(self, allowedChar=None, fromAttribute=False): # Initialise to the default output for when no entity is matched output = "&" charStack = [self.stream.char()] if (charStack[0] in spaceCharacters or charStack[0] in (EOF, "<", "&") or (allowedChar is not None and allowedChar == charStack[0])): self.stream.unget(charStack[0]) elif charStack[0] == "#": # Read the next character to see if it's hex or decimal hex = False charStack.append(self.stream.char()) if charStack[-1] in ("x", "X"): hex = True charStack.append(self.stream.char()) # charStack[-1] should be the first digit if (hex and charStack[-1] in hexDigits) \ or (not hex and charStack[-1] in digits): # At least one digit found, so consume the whole number self.stream.unget(charStack[-1]) output = self.consumeNumberEntity(hex) else: # No digits found self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-numeric-entity"}) self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) else: # At this point in the process might have named entity. Entities # are stored in the global variable "entities". # # Consume characters and compare to these to a substring of the # entity names in the list until the substring no longer matches. while (charStack[-1] is not EOF): if not entitiesTrie.has_keys_with_prefix("".join(charStack)): break charStack.append(self.stream.char()) # At this point we have a string that starts with some characters # that may match an entity # Try to find the longest entity the string will match to take care # of ¬i for instance. try: entityName = entitiesTrie.longest_prefix("".join(charStack[:-1])) entityLength = len(entityName) except KeyError: entityName = None if entityName is not None: if entityName[-1] != ";": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "named-entity-without-semicolon"}) if (entityName[-1] != ";" and fromAttribute and (charStack[entityLength] in asciiLetters or charStack[entityLength] in digits or charStack[entityLength] == "=")): self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) else: output = entities[entityName] self.stream.unget(charStack.pop()) output += "".join(charStack[entityLength:]) else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-named-entity"}) self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) if fromAttribute: self.currentToken["data"][-1][1] += output else: if output in spaceCharacters: tokenType = "SpaceCharacters" else: tokenType = "Characters" self.tokenQueue.append({"type": tokenTypes[tokenType], "data": output}) def processEntityInAttribute(self, allowedChar): """This method replaces the need for "entityInAttributeValueState". """ self.consumeEntity(allowedChar=allowedChar, fromAttribute=True) def emitCurrentToken(self): """This method is a generic handler for emitting the tags. It also sets the state to "data" because that's what's needed after a token has been emitted. """ token = self.currentToken # Add token to the queue to be yielded if (token["type"] in tagTokenTypes): token["name"] = token["name"].translate(asciiUpper2Lower) if token["type"] == tokenTypes["StartTag"]: raw = token["data"] data = attributeMap(raw) if len(raw) > len(data): # we had some duplicated attribute, fix so first wins data.update(raw[::-1]) token["data"] = data if token["type"] == tokenTypes["EndTag"]: if token["data"]: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "attributes-in-end-tag"}) if token["selfClosing"]: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "self-closing-flag-on-end-tag"}) self.tokenQueue.append(token) self.state = self.dataState # Below are the various tokenizer states worked out. def dataState(self): data = self.stream.char() if data == "&": self.state = self.entityDataState elif data == "<": self.state = self.tagOpenState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\u0000"}) elif data is EOF: # Tokenization ends. return False elif data in spaceCharacters: # Directly after emitting a token you switch back to the "data # state". At that point spaceCharacters are important so they are # emitted separately. self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data": data + self.stream.charsUntil(spaceCharacters, True)}) # No need to update lastFourChars here, since the first space will # have already been appended to lastFourChars and will have broken # any sequences else: chars = self.stream.charsUntil(("&", "<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def entityDataState(self): self.consumeEntity() self.state = self.dataState return True def rcdataState(self): data = self.stream.char() if data == "&": self.state = self.characterReferenceInRcdata elif data == "<": self.state = self.rcdataLessThanSignState elif data == EOF: # Tokenization ends. return False elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data in spaceCharacters: # Directly after emitting a token you switch back to the "data # state". At that point spaceCharacters are important so they are # emitted separately. self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data": data + self.stream.charsUntil(spaceCharacters, True)}) # No need to update lastFourChars here, since the first space will # have already been appended to lastFourChars and will have broken # any sequences else: chars = self.stream.charsUntil(("&", "<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def characterReferenceInRcdata(self): self.consumeEntity() self.state = self.rcdataState return True def rawtextState(self): data = self.stream.char() if data == "<": self.state = self.rawtextLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: # Tokenization ends. return False else: chars = self.stream.charsUntil(("<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def scriptDataState(self): data = self.stream.char() if data == "<": self.state = self.scriptDataLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: # Tokenization ends. return False else: chars = self.stream.charsUntil(("<", "\u0000")) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + chars}) return True def plaintextState(self): data = self.stream.char() if data == EOF: # Tokenization ends. return False elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data + self.stream.charsUntil("\u0000")}) return True def tagOpenState(self): data = self.stream.char() if data == "!": self.state = self.markupDeclarationOpenState elif data == "/": self.state = self.closeTagOpenState elif data in asciiLetters: self.currentToken = {"type": tokenTypes["StartTag"], "name": data, "data": [], "selfClosing": False, "selfClosingAcknowledged": False} self.state = self.tagNameState elif data == ">": # XXX In theory it could be something besides a tag name. But # do we really care? self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-tag-name-but-got-right-bracket"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<>"}) self.state = self.dataState elif data == "?": # XXX In theory it could be something besides a tag name. But # do we really care? self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-tag-name-but-got-question-mark"}) self.stream.unget(data) self.state = self.bogusCommentState else: # XXX self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-tag-name"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.stream.unget(data) self.state = self.dataState return True def closeTagOpenState(self): data = self.stream.char() if data in asciiLetters: self.currentToken = {"type": tokenTypes["EndTag"], "name": data, "data": [], "selfClosing": False} self.state = self.tagNameState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-closing-tag-but-got-right-bracket"}) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-closing-tag-but-got-eof"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "": self.emitCurrentToken() elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-tag-name"}) self.state = self.dataState elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["name"] += "\uFFFD" else: self.currentToken["name"] += data # (Don't use charsUntil here, because tag names are # very short and it's faster to not do anything fancy) return True def rcdataLessThanSignState(self): data = self.stream.char() if data == "/": self.temporaryBuffer = "" self.state = self.rcdataEndTagOpenState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.stream.unget(data) self.state = self.rcdataState return True def rcdataEndTagOpenState(self): data = self.stream.char() if data in asciiLetters: self.temporaryBuffer += data self.state = self.rcdataEndTagNameState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ">"}) self.state = self.scriptDataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataEscapedState elif data == EOF: self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.scriptDataEscapedState return True def scriptDataEscapedLessThanSignState(self): data = self.stream.char() if data == "/": self.temporaryBuffer = "" self.state = self.scriptDataEscapedEndTagOpenState elif data in asciiLetters: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<" + data}) self.temporaryBuffer = data self.state = self.scriptDataDoubleEscapeStartState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.stream.unget(data) self.state = self.scriptDataEscapedState return True def scriptDataEscapedEndTagOpenState(self): data = self.stream.char() if data in asciiLetters: self.temporaryBuffer = data self.state = self.scriptDataEscapedEndTagNameState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "" and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], "name": self.temporaryBuffer, "data": [], "selfClosing": False} self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ""))): self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) if self.temporaryBuffer.lower() == "script": self.state = self.scriptDataDoubleEscapedState else: self.state = self.scriptDataEscapedState elif data in asciiLetters: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.temporaryBuffer += data else: self.stream.unget(data) self.state = self.scriptDataEscapedState return True def scriptDataDoubleEscapedState(self): data = self.stream.char() if data == "-": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"}) self.state = self.scriptDataDoubleEscapedDashState elif data == "<": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.state = self.scriptDataDoubleEscapedLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-script-in-script"}) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) return True def scriptDataDoubleEscapedDashState(self): data = self.stream.char() if data == "-": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"}) self.state = self.scriptDataDoubleEscapedDashDashState elif data == "<": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.state = self.scriptDataDoubleEscapedLessThanSignState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataDoubleEscapedState elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-script-in-script"}) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.scriptDataDoubleEscapedState return True def scriptDataDoubleEscapedDashDashState(self): data = self.stream.char() if data == "-": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "-"}) elif data == "<": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.state = self.scriptDataDoubleEscapedLessThanSignState elif data == ">": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": ">"}) self.state = self.scriptDataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataDoubleEscapedState elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-script-in-script"}) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.scriptDataDoubleEscapedState return True def scriptDataDoubleEscapedLessThanSignState(self): data = self.stream.char() if data == "/": self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "/"}) self.temporaryBuffer = "" self.state = self.scriptDataDoubleEscapeEndState else: self.stream.unget(data) self.state = self.scriptDataDoubleEscapedState return True def scriptDataDoubleEscapeEndState(self): data = self.stream.char() if data in (spaceCharacters | frozenset(("/", ">"))): self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) if self.temporaryBuffer.lower() == "script": self.state = self.scriptDataEscapedState else: self.state = self.scriptDataDoubleEscapedState elif data in asciiLetters: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.temporaryBuffer += data else: self.stream.unget(data) self.state = self.scriptDataDoubleEscapedState return True def beforeAttributeNameState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data in asciiLetters: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data == ">": self.emitCurrentToken() elif data == "/": self.state = self.selfClosingStartTagState elif data in ("'", '"', "=", "<"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-character-in-attribute-name"}) self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"].append(["\uFFFD", ""]) self.state = self.attributeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-attribute-name-but-got-eof"}) self.state = self.dataState else: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState return True def attributeNameState(self): data = self.stream.char() leavingThisState = True emitToken = False if data == "=": self.state = self.beforeAttributeValueState elif data in asciiLetters: self.currentToken["data"][-1][0] += data +\ self.stream.charsUntil(asciiLetters, True) leavingThisState = False elif data == ">": # XXX If we emit here the attributes are converted to a dict # without being checked and when the code below runs we error # because data is a dict not a list emitToken = True elif data in spaceCharacters: self.state = self.afterAttributeNameState elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][0] += "\uFFFD" leavingThisState = False elif data in ("'", '"', "<"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-character-in-attribute-name"}) self.currentToken["data"][-1][0] += data leavingThisState = False elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-name"}) self.state = self.dataState else: self.currentToken["data"][-1][0] += data leavingThisState = False if leavingThisState: # Attributes are not dropped at this stage. That happens when the # start tag token is emitted so values can still be safely appended # to attributes, but we do want to report the parse error in time. self.currentToken["data"][-1][0] = ( self.currentToken["data"][-1][0].translate(asciiUpper2Lower)) for name, _ in self.currentToken["data"][:-1]: if self.currentToken["data"][-1][0] == name: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "duplicate-attribute"}) break # XXX Fix for above XXX if emitToken: self.emitCurrentToken() return True def afterAttributeNameState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data == "=": self.state = self.beforeAttributeValueState elif data == ">": self.emitCurrentToken() elif data in asciiLetters: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"].append(["\uFFFD", ""]) self.state = self.attributeNameState elif data in ("'", '"', "<"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-character-after-attribute-name"}) self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-end-of-tag-but-got-eof"}) self.state = self.dataState else: self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState return True def beforeAttributeValueState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) elif data == "\"": self.state = self.attributeValueDoubleQuotedState elif data == "&": self.state = self.attributeValueUnQuotedState self.stream.unget(data) elif data == "'": self.state = self.attributeValueSingleQuotedState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-attribute-value-but-got-right-bracket"}) self.emitCurrentToken() elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" self.state = self.attributeValueUnQuotedState elif data in ("=", "<", "`"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "equals-in-unquoted-attribute-value"}) self.currentToken["data"][-1][1] += data self.state = self.attributeValueUnQuotedState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-attribute-value-but-got-eof"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data self.state = self.attributeValueUnQuotedState return True def attributeValueDoubleQuotedState(self): data = self.stream.char() if data == "\"": self.state = self.afterAttributeValueState elif data == "&": self.processEntityInAttribute('"') elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-value-double-quote"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data +\ self.stream.charsUntil(("\"", "&", "\u0000")) return True def attributeValueSingleQuotedState(self): data = self.stream.char() if data == "'": self.state = self.afterAttributeValueState elif data == "&": self.processEntityInAttribute("'") elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-value-single-quote"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data +\ self.stream.charsUntil(("'", "&", "\u0000")) return True def attributeValueUnQuotedState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeAttributeNameState elif data == "&": self.processEntityInAttribute(">") elif data == ">": self.emitCurrentToken() elif data in ('"', "'", "=", "<", "`"): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-character-in-unquoted-attribute-value"}) self.currentToken["data"][-1][1] += data elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-attribute-value-no-quotes"}) self.state = self.dataState else: self.currentToken["data"][-1][1] += data + self.stream.charsUntil( frozenset(("&", ">", '"', "'", "=", "<", "`", "\u0000")) | spaceCharacters) return True def afterAttributeValueState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeAttributeNameState elif data == ">": self.emitCurrentToken() elif data == "/": self.state = self.selfClosingStartTagState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-EOF-after-attribute-value"}) self.stream.unget(data) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-character-after-attribute-value"}) self.stream.unget(data) self.state = self.beforeAttributeNameState return True def selfClosingStartTagState(self): data = self.stream.char() if data == ">": self.currentToken["selfClosing"] = True self.emitCurrentToken() elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-EOF-after-solidus-in-tag"}) self.stream.unget(data) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-character-after-solidus-in-tag"}) self.stream.unget(data) self.state = self.beforeAttributeNameState return True def bogusCommentState(self): # Make a new comment token and give it as value all the characters # until the first > or EOF (charsUntil checks for EOF automatically) # and emit it. data = self.stream.charsUntil(">") data = data.replace("\u0000", "\uFFFD") self.tokenQueue.append( {"type": tokenTypes["Comment"], "data": data}) # Eat the character directly after the bogus comment which is either a # ">" or an EOF. self.stream.char() self.state = self.dataState return True def markupDeclarationOpenState(self): charStack = [self.stream.char()] if charStack[-1] == "-": charStack.append(self.stream.char()) if charStack[-1] == "-": self.currentToken = {"type": tokenTypes["Comment"], "data": ""} self.state = self.commentStartState return True elif charStack[-1] in ('d', 'D'): matched = True for expected in (('o', 'O'), ('c', 'C'), ('t', 'T'), ('y', 'Y'), ('p', 'P'), ('e', 'E')): charStack.append(self.stream.char()) if charStack[-1] not in expected: matched = False break if matched: self.currentToken = {"type": tokenTypes["Doctype"], "name": "", "publicId": None, "systemId": None, "correct": True} self.state = self.doctypeState return True elif (charStack[-1] == "[" and self.parser is not None and self.parser.tree.openElements and self.parser.tree.openElements[-1].namespace != self.parser.tree.defaultNamespace): matched = True for expected in ["C", "D", "A", "T", "A", "["]: charStack.append(self.stream.char()) if charStack[-1] != expected: matched = False break if matched: self.state = self.cdataSectionState return True self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-dashes-or-doctype"}) while charStack: self.stream.unget(charStack.pop()) self.state = self.bogusCommentState return True def commentStartState(self): data = self.stream.char() if data == "-": self.state = self.commentStartDashState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "incorrect-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += data self.state = self.commentState return True def commentStartDashState(self): data = self.stream.char() if data == "-": self.state = self.commentEndState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "-\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "incorrect-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += "-" + data self.state = self.commentState return True def commentState(self): data = self.stream.char() if data == "-": self.state = self.commentEndDashState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "\uFFFD" elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += data + \ self.stream.charsUntil(("-", "\u0000")) return True def commentEndDashState(self): data = self.stream.char() if data == "-": self.state = self.commentEndState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "-\uFFFD" self.state = self.commentState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment-end-dash"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += "-" + data self.state = self.commentState return True def commentEndState(self): data = self.stream.char() if data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "--\uFFFD" self.state = self.commentState elif data == "!": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-bang-after-double-dash-in-comment"}) self.state = self.commentEndBangState elif data == "-": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-dash-after-double-dash-in-comment"}) self.currentToken["data"] += data elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment-double-dash"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: # XXX self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-comment"}) self.currentToken["data"] += "--" + data self.state = self.commentState return True def commentEndBangState(self): data = self.stream.char() if data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "-": self.currentToken["data"] += "--!" self.state = self.commentEndDashState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["data"] += "--!\uFFFD" self.state = self.commentState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-comment-end-bang-state"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["data"] += "--!" + data self.state = self.commentState return True def doctypeState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeDoctypeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-doctype-name-but-got-eof"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "need-space-after-doctype"}) self.stream.unget(data) self.state = self.beforeDoctypeNameState return True def beforeDoctypeNameState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-doctype-name-but-got-right-bracket"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["name"] = "\uFFFD" self.state = self.doctypeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-doctype-name-but-got-eof"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["name"] = data self.state = self.doctypeNameState return True def doctypeNameState(self): data = self.stream.char() if data in spaceCharacters: self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) self.state = self.afterDoctypeNameState elif data == ">": self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["name"] += "\uFFFD" self.state = self.doctypeNameState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype-name"}) self.currentToken["correct"] = False self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["name"] += data return True def afterDoctypeNameState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.currentToken["correct"] = False self.stream.unget(data) self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: if data in ("p", "P"): matched = True for expected in (("u", "U"), ("b", "B"), ("l", "L"), ("i", "I"), ("c", "C")): data = self.stream.char() if data not in expected: matched = False break if matched: self.state = self.afterDoctypePublicKeywordState return True elif data in ("s", "S"): matched = True for expected in (("y", "Y"), ("s", "S"), ("t", "T"), ("e", "E"), ("m", "M")): data = self.stream.char() if data not in expected: matched = False break if matched: self.state = self.afterDoctypeSystemKeywordState return True # All the characters read before the current 'data' will be # [a-zA-Z], so they're garbage in the bogus doctype and can be # discarded; only the latest character might be '>' or EOF # and needs to be ungetted self.stream.unget(data) self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "expected-space-or-right-bracket-in-doctype", "datavars": {"data": data}}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def afterDoctypePublicKeywordState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeDoctypePublicIdentifierState elif data in ("'", '"'): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.stream.unget(data) self.state = self.beforeDoctypePublicIdentifierState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.stream.unget(data) self.state = self.beforeDoctypePublicIdentifierState return True def beforeDoctypePublicIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == "\"": self.currentToken["publicId"] = "" self.state = self.doctypePublicIdentifierDoubleQuotedState elif data == "'": self.currentToken["publicId"] = "" self.state = self.doctypePublicIdentifierSingleQuotedState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def doctypePublicIdentifierDoubleQuotedState(self): data = self.stream.char() if data == "\"": self.state = self.afterDoctypePublicIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["publicId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["publicId"] += data return True def doctypePublicIdentifierSingleQuotedState(self): data = self.stream.char() if data == "'": self.state = self.afterDoctypePublicIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["publicId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["publicId"] += data return True def afterDoctypePublicIdentifierState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.betweenDoctypePublicAndSystemIdentifiersState elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == '"': self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def betweenDoctypePublicAndSystemIdentifiersState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == '"': self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data == EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def afterDoctypeSystemKeywordState(self): data = self.stream.char() if data in spaceCharacters: self.state = self.beforeDoctypeSystemIdentifierState elif data in ("'", '"'): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.stream.unget(data) self.state = self.beforeDoctypeSystemIdentifierState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.stream.unget(data) self.state = self.beforeDoctypeSystemIdentifierState return True def beforeDoctypeSystemIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == "\"": self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def doctypeSystemIdentifierDoubleQuotedState(self): data = self.stream.char() if data == "\"": self.state = self.afterDoctypeSystemIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["systemId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["systemId"] += data return True def doctypeSystemIdentifierSingleQuotedState(self): data = self.stream.char() if data == "'": self.state = self.afterDoctypeSystemIdentifierState elif data == "\u0000": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) self.currentToken["systemId"] += "\uFFFD" elif data == ">": self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.currentToken["systemId"] += data return True def afterDoctypeSystemIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass elif data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "eof-in-doctype"}) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"}) self.state = self.bogusDoctypeState return True def bogusDoctypeState(self): data = self.stream.char() if data == ">": self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: # XXX EMIT self.stream.unget(data) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: pass return True def cdataSectionState(self): data = [] while True: data.append(self.stream.charsUntil("]")) data.append(self.stream.charsUntil(">")) char = self.stream.char() if char == EOF: break else: assert char == ">" if data[-1][-2:] == "]]": data[-1] = data[-1][:-2] break else: data.append(char) data = "".join(data) # pylint:disable=redefined-variable-type # Deal with null here rather than in the parser nullCount = data.count("\u0000") if nullCount > 0: for _ in range(nullCount): self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": "invalid-codepoint"}) data = data.replace("\u0000", "\uFFFD") if data: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.dataState return True html5lib/_ihatexml.py000064400000040530152347724720010627 0ustar00from __future__ import absolute_import, division, unicode_literals import re import warnings from .constants import DataLossWarning baseChar = """ [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D | [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] | [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] | [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] | [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] | [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] | [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] | [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] | [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] | [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE | [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] | [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 | [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 | [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 | #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]""" ideographic = """[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]""" combiningCharacter = """ [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] | [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC | [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] | #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] | [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] | [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] | [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] | [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] | [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] | #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099 | #x309A""" digit = """ [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] | [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] | [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]""" extender = """ #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | #[#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]""" letter = " | ".join([baseChar, ideographic]) # Without the name = " | ".join([letter, digit, ".", "-", "_", combiningCharacter, extender]) nameFirst = " | ".join([letter, "_"]) reChar = re.compile(r"#x([\d|A-F]{4,4})") reCharRange = re.compile(r"\[#x([\d|A-F]{4,4})-#x([\d|A-F]{4,4})\]") def charStringToList(chars): charRanges = [item.strip() for item in chars.split(" | ")] rv = [] for item in charRanges: foundMatch = False for regexp in (reChar, reCharRange): match = regexp.match(item) if match is not None: rv.append([hexToInt(item) for item in match.groups()]) if len(rv[-1]) == 1: rv[-1] = rv[-1] * 2 foundMatch = True break if not foundMatch: assert len(item) == 1 rv.append([ord(item)] * 2) rv = normaliseCharList(rv) return rv def normaliseCharList(charList): charList = sorted(charList) for item in charList: assert item[1] >= item[0] rv = [] i = 0 while i < len(charList): j = 1 rv.append(charList[i]) while i + j < len(charList) and charList[i + j][0] <= rv[-1][1] + 1: rv[-1][1] = charList[i + j][1] j += 1 i += j return rv # We don't really support characters above the BMP :( max_unicode = int("FFFF", 16) def missingRanges(charList): rv = [] if charList[0] != 0: rv.append([0, charList[0][0] - 1]) for i, item in enumerate(charList[:-1]): rv.append([item[1] + 1, charList[i + 1][0] - 1]) if charList[-1][1] != max_unicode: rv.append([charList[-1][1] + 1, max_unicode]) return rv def listToRegexpStr(charList): rv = [] for item in charList: if item[0] == item[1]: rv.append(escapeRegexp(chr(item[0]))) else: rv.append(escapeRegexp(chr(item[0])) + "-" + escapeRegexp(chr(item[1]))) return "[%s]" % "".join(rv) def hexToInt(hex_str): return int(hex_str, 16) def escapeRegexp(string): specialCharacters = (".", "^", "$", "*", "+", "?", "{", "}", "[", "]", "|", "(", ")", "-") for char in specialCharacters: string = string.replace(char, "\\" + char) return string # output from the above nonXmlNameBMPRegexp = re.compile('[\x00-,/:-@\\[-\\^`\\{-\xb6\xb8-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u02cf\u02d2-\u02ff\u0346-\u035f\u0362-\u0385\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482\u0487-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u0590\u05a2\u05ba\u05be\u05c0\u05c3\u05c5-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u063f\u0653-\u065f\u066a-\u066f\u06b8-\u06b9\u06bf\u06cf\u06d4\u06e9\u06ee-\u06ef\u06fa-\u0900\u0904\u093a-\u093b\u094e-\u0950\u0955-\u0957\u0964-\u0965\u0970-\u0980\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bb\u09bd\u09c5-\u09c6\u09c9-\u09ca\u09ce-\u09d6\u09d8-\u09db\u09de\u09e4-\u09e5\u09f2-\u0a01\u0a03-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a58\u0a5d\u0a5f-\u0a65\u0a75-\u0a80\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abb\u0ac6\u0aca\u0ace-\u0adf\u0ae1-\u0ae5\u0af0-\u0b00\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3b\u0b44-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b5b\u0b5e\u0b62-\u0b65\u0b70-\u0b81\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bd6\u0bd8-\u0be6\u0bf0-\u0c00\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c3d\u0c45\u0c49\u0c4e-\u0c54\u0c57-\u0c5f\u0c62-\u0c65\u0c70-\u0c81\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbd\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0cdd\u0cdf\u0ce2-\u0ce5\u0cf0-\u0d01\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d3d\u0d44-\u0d45\u0d49\u0d4e-\u0d56\u0d58-\u0d5f\u0d62-\u0d65\u0d70-\u0e00\u0e2f\u0e3b-\u0e3f\u0e4f\u0e5a-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0ecf\u0eda-\u0f17\u0f1a-\u0f1f\u0f2a-\u0f34\u0f36\u0f38\u0f3a-\u0f3d\u0f48\u0f6a-\u0f70\u0f85\u0f8c-\u0f8f\u0f96\u0f98\u0fae-\u0fb0\u0fb8\u0fba-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u20cf\u20dd-\u20e0\u20e2-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3004\u3006\u3008-\u3020\u3030\u3036-\u3040\u3095-\u3098\u309b-\u309c\u309f-\u30a0\u30fb\u30ff-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa nonXmlNameFirstBMPRegexp = re.compile('[\x00-@\\[-\\^`\\{-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u0385\u0387\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u0640\u064b-\u0670\u06b8-\u06b9\u06bf\u06cf\u06d4\u06d6-\u06e4\u06e7-\u0904\u093a-\u093c\u093e-\u0957\u0962-\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09db\u09de\u09e2-\u09ef\u09f2-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a58\u0a5d\u0a5f-\u0a71\u0a75-\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abc\u0abe-\u0adf\u0ae1-\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3c\u0b3e-\u0b5b\u0b5e\u0b62-\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c5f\u0c62-\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cdd\u0cdf\u0ce2-\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d5f\u0d62-\u0e00\u0e2f\u0e31\u0e34-\u0e3f\u0e46-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eb1\u0eb4-\u0ebc\u0ebe-\u0ebf\u0ec5-\u0f3f\u0f48\u0f6a-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3006\u3008-\u3020\u302a-\u3040\u3095-\u30a0\u30fb-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa # Simpler things nonPubidCharRegexp = re.compile("[^\x20\x0D\x0Aa-zA-Z0-9\\-'()+,./:=?;!*#@$_%]") class InfosetFilter(object): replacementRegexp = re.compile(r"U[\dA-F]{5,5}") def __init__(self, dropXmlnsLocalName=False, dropXmlnsAttrNs=False, preventDoubleDashComments=False, preventDashAtCommentEnd=False, replaceFormFeedCharacters=True, preventSingleQuotePubid=False): self.dropXmlnsLocalName = dropXmlnsLocalName self.dropXmlnsAttrNs = dropXmlnsAttrNs self.preventDoubleDashComments = preventDoubleDashComments self.preventDashAtCommentEnd = preventDashAtCommentEnd self.replaceFormFeedCharacters = replaceFormFeedCharacters self.preventSingleQuotePubid = preventSingleQuotePubid self.replaceCache = {} def coerceAttribute(self, name, namespace=None): if self.dropXmlnsLocalName and name.startswith("xmlns:"): warnings.warn("Attributes cannot begin with xmlns", DataLossWarning) return None elif (self.dropXmlnsAttrNs and namespace == "http://www.w3.org/2000/xmlns/"): warnings.warn("Attributes cannot be in the xml namespace", DataLossWarning) return None else: return self.toXmlName(name) def coerceElement(self, name): return self.toXmlName(name) def coerceComment(self, data): if self.preventDoubleDashComments: while "--" in data: warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning) data = data.replace("--", "- -") if data.endswith("-"): warnings.warn("Comments cannot end in a dash", DataLossWarning) data += " " return data def coerceCharacters(self, data): if self.replaceFormFeedCharacters: for _ in range(data.count("\x0C")): warnings.warn("Text cannot contain U+000C", DataLossWarning) data = data.replace("\x0C", " ") # Other non-xml characters return data def coercePubid(self, data): dataOutput = data for char in nonPubidCharRegexp.findall(data): warnings.warn("Coercing non-XML pubid", DataLossWarning) replacement = self.getReplacementCharacter(char) dataOutput = dataOutput.replace(char, replacement) if self.preventSingleQuotePubid and dataOutput.find("'") >= 0: warnings.warn("Pubid cannot contain single quote", DataLossWarning) dataOutput = dataOutput.replace("'", self.getReplacementCharacter("'")) return dataOutput def toXmlName(self, name): nameFirst = name[0] nameRest = name[1:] m = nonXmlNameFirstBMPRegexp.match(nameFirst) if m: warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning) nameFirstOutput = self.getReplacementCharacter(nameFirst) else: nameFirstOutput = nameFirst nameRestOutput = nameRest replaceChars = set(nonXmlNameBMPRegexp.findall(nameRest)) for char in replaceChars: warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning) replacement = self.getReplacementCharacter(char) nameRestOutput = nameRestOutput.replace(char, replacement) return nameFirstOutput + nameRestOutput def getReplacementCharacter(self, char): if char in self.replaceCache: replacement = self.replaceCache[char] else: replacement = self.escapeChar(char) return replacement def fromXmlName(self, name): for item in set(self.replacementRegexp.findall(name)): name = name.replace(item, self.unescapeChar(item)) return name def escapeChar(self, char): replacement = "U%05X" % ord(char) self.replaceCache[char] = replacement return replacement def unescapeChar(self, charcode): return chr(int(charcode[1:], 16)) html5lib/_inputstream.py000064400000077141152347724720011377 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from pip._vendor.six.moves import http_client, urllib import codecs import re from io import BytesIO, StringIO from pip._vendor import webencodings from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase from .constants import _ReparseException from . import _utils # Non-unicode versions of constants for use in the pre-parser spaceCharactersBytes = frozenset([item.encode("ascii") for item in spaceCharacters]) asciiLettersBytes = frozenset([item.encode("ascii") for item in asciiLetters]) asciiUppercaseBytes = frozenset([item.encode("ascii") for item in asciiUppercase]) spacesAngleBrackets = spaceCharactersBytes | frozenset([b">", b"<"]) invalid_unicode_no_surrogate = "[\u0001-\u0008\u000B\u000E-\u001F\u007F-\u009F\uFDD0-\uFDEF\uFFFE\uFFFF\U0001FFFE\U0001FFFF\U0002FFFE\U0002FFFF\U0003FFFE\U0003FFFF\U0004FFFE\U0004FFFF\U0005FFFE\U0005FFFF\U0006FFFE\U0006FFFF\U0007FFFE\U0007FFFF\U0008FFFE\U0008FFFF\U0009FFFE\U0009FFFF\U000AFFFE\U000AFFFF\U000BFFFE\U000BFFFF\U000CFFFE\U000CFFFF\U000DFFFE\U000DFFFF\U000EFFFE\U000EFFFF\U000FFFFE\U000FFFFF\U0010FFFE\U0010FFFF]" # noqa if _utils.supports_lone_surrogates: # Use one extra step of indirection and create surrogates with # eval. Not using this indirection would introduce an illegal # unicode literal on platforms not supporting such lone # surrogates. assert invalid_unicode_no_surrogate[-1] == "]" and invalid_unicode_no_surrogate.count("]") == 1 invalid_unicode_re = re.compile(invalid_unicode_no_surrogate[:-1] + eval('"\\uD800-\\uDFFF"') + # pylint:disable=eval-used "]") else: invalid_unicode_re = re.compile(invalid_unicode_no_surrogate) non_bmp_invalid_codepoints = {0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF, 0x10FFFE, 0x10FFFF} ascii_punctuation_re = re.compile("[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005C\u005B-\u0060\u007B-\u007E]") # Cache for charsUntil() charsUntilRegEx = {} class BufferedStream(object): """Buffering for streams that do not have buffering of their own The buffer is implemented as a list of chunks on the assumption that joining many strings will be slow since it is O(n**2) """ def __init__(self, stream): self.stream = stream self.buffer = [] self.position = [-1, 0] # chunk number, offset def tell(self): pos = 0 for chunk in self.buffer[:self.position[0]]: pos += len(chunk) pos += self.position[1] return pos def seek(self, pos): assert pos <= self._bufferedBytes() offset = pos i = 0 while len(self.buffer[i]) < offset: offset -= len(self.buffer[i]) i += 1 self.position = [i, offset] def read(self, bytes): if not self.buffer: return self._readStream(bytes) elif (self.position[0] == len(self.buffer) and self.position[1] == len(self.buffer[-1])): return self._readStream(bytes) else: return self._readFromBuffer(bytes) def _bufferedBytes(self): return sum([len(item) for item in self.buffer]) def _readStream(self, bytes): data = self.stream.read(bytes) self.buffer.append(data) self.position[0] += 1 self.position[1] = len(data) return data def _readFromBuffer(self, bytes): remainingBytes = bytes rv = [] bufferIndex = self.position[0] bufferOffset = self.position[1] while bufferIndex < len(self.buffer) and remainingBytes != 0: assert remainingBytes > 0 bufferedData = self.buffer[bufferIndex] if remainingBytes <= len(bufferedData) - bufferOffset: bytesToRead = remainingBytes self.position = [bufferIndex, bufferOffset + bytesToRead] else: bytesToRead = len(bufferedData) - bufferOffset self.position = [bufferIndex, len(bufferedData)] bufferIndex += 1 rv.append(bufferedData[bufferOffset:bufferOffset + bytesToRead]) remainingBytes -= bytesToRead bufferOffset = 0 if remainingBytes: rv.append(self._readStream(remainingBytes)) return b"".join(rv) def HTMLInputStream(source, **kwargs): # Work around Python bug #20007: read(0) closes the connection. # http://bugs.python.org/issue20007 if (isinstance(source, http_client.HTTPResponse) or # Also check for addinfourl wrapping HTTPResponse (isinstance(source, urllib.response.addbase) and isinstance(source.fp, http_client.HTTPResponse))): isUnicode = False elif hasattr(source, "read"): isUnicode = isinstance(source.read(0), text_type) else: isUnicode = isinstance(source, text_type) if isUnicode: encodings = [x for x in kwargs if x.endswith("_encoding")] if encodings: raise TypeError("Cannot set an encoding with a unicode input, set %r" % encodings) return HTMLUnicodeInputStream(source, **kwargs) else: return HTMLBinaryInputStream(source, **kwargs) class HTMLUnicodeInputStream(object): """Provides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. """ _defaultChunkSize = 10240 def __init__(self, source): """Initialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) """ if not _utils.supports_lone_surrogates: # Such platforms will have already checked for such # surrogate errors, so no need to do this checking. self.reportCharacterErrors = None elif len("\U0010FFFF") == 1: self.reportCharacterErrors = self.characterErrorsUCS4 else: self.reportCharacterErrors = self.characterErrorsUCS2 # List of where new lines occur self.newLines = [0] self.charEncoding = (lookupEncoding("utf-8"), "certain") self.dataStream = self.openStream(source) self.reset() def reset(self): self.chunk = "" self.chunkSize = 0 self.chunkOffset = 0 self.errors = [] # number of (complete) lines in previous chunks self.prevNumLines = 0 # number of columns in the last line of the previous chunk self.prevNumCols = 0 # Deal with CR LF and surrogates split over chunk boundaries self._bufferedCharacter = None def openStream(self, source): """Produces a file object from source. source can be either a file object, local filename or a string. """ # Already a file object if hasattr(source, 'read'): stream = source else: stream = StringIO(source) return stream def _position(self, offset): chunk = self.chunk nLines = chunk.count('\n', 0, offset) positionLine = self.prevNumLines + nLines lastLinePos = chunk.rfind('\n', 0, offset) if lastLinePos == -1: positionColumn = self.prevNumCols + offset else: positionColumn = offset - (lastLinePos + 1) return (positionLine, positionColumn) def position(self): """Returns (line, col) of the current position in the stream.""" line, col = self._position(self.chunkOffset) return (line + 1, col) def char(self): """ Read one character from the stream or queue if available. Return EOF when EOF is reached. """ # Read a new chunk from the input stream if necessary if self.chunkOffset >= self.chunkSize: if not self.readChunk(): return EOF chunkOffset = self.chunkOffset char = self.chunk[chunkOffset] self.chunkOffset = chunkOffset + 1 return char def readChunk(self, chunkSize=None): if chunkSize is None: chunkSize = self._defaultChunkSize self.prevNumLines, self.prevNumCols = self._position(self.chunkSize) self.chunk = "" self.chunkSize = 0 self.chunkOffset = 0 data = self.dataStream.read(chunkSize) # Deal with CR LF and surrogates broken across chunks if self._bufferedCharacter: data = self._bufferedCharacter + data self._bufferedCharacter = None elif not data: # We have no more data, bye-bye stream return False if len(data) > 1: lastv = ord(data[-1]) if lastv == 0x0D or 0xD800 <= lastv <= 0xDBFF: self._bufferedCharacter = data[-1] data = data[:-1] if self.reportCharacterErrors: self.reportCharacterErrors(data) # Replace invalid characters data = data.replace("\r\n", "\n") data = data.replace("\r", "\n") self.chunk = data self.chunkSize = len(data) return True def characterErrorsUCS4(self, data): for _ in range(len(invalid_unicode_re.findall(data))): self.errors.append("invalid-codepoint") def characterErrorsUCS2(self, data): # Someone picked the wrong compile option # You lose skip = False for match in invalid_unicode_re.finditer(data): if skip: continue codepoint = ord(match.group()) pos = match.start() # Pretty sure there should be endianness issues here if _utils.isSurrogatePair(data[pos:pos + 2]): # We have a surrogate pair! char_val = _utils.surrogatePairToCodepoint(data[pos:pos + 2]) if char_val in non_bmp_invalid_codepoints: self.errors.append("invalid-codepoint") skip = True elif (codepoint >= 0xD800 and codepoint <= 0xDFFF and pos == len(data) - 1): self.errors.append("invalid-codepoint") else: skip = False self.errors.append("invalid-codepoint") def charsUntil(self, characters, opposite=False): """ Returns a string of characters from the stream up to but not including any character in 'characters' or EOF. 'characters' must be a container that supports the 'in' method and iteration over its characters. """ # Use a cache of regexps to find the required characters try: chars = charsUntilRegEx[(characters, opposite)] except KeyError: if __debug__: for c in characters: assert(ord(c) < 128) regex = "".join(["\\x%02x" % ord(c) for c in characters]) if not opposite: regex = "^%s" % regex chars = charsUntilRegEx[(characters, opposite)] = re.compile("[%s]+" % regex) rv = [] while True: # Find the longest matching prefix m = chars.match(self.chunk, self.chunkOffset) if m is None: # If nothing matched, and it wasn't because we ran out of chunk, # then stop if self.chunkOffset != self.chunkSize: break else: end = m.end() # If not the whole chunk matched, return everything # up to the part that didn't match if end != self.chunkSize: rv.append(self.chunk[self.chunkOffset:end]) self.chunkOffset = end break # If the whole remainder of the chunk matched, # use it all and read the next chunk rv.append(self.chunk[self.chunkOffset:]) if not self.readChunk(): # Reached EOF break r = "".join(rv) return r def unget(self, char): # Only one character is allowed to be ungotten at once - it must # be consumed again before any further call to unget if char is not EOF: if self.chunkOffset == 0: # unget is called quite rarely, so it's a good idea to do # more work here if it saves a bit of work in the frequently # called char and charsUntil. # So, just prepend the ungotten character onto the current # chunk: self.chunk = char + self.chunk self.chunkSize += 1 else: self.chunkOffset -= 1 assert self.chunk[self.chunkOffset] == char class HTMLBinaryInputStream(HTMLUnicodeInputStream): """Provides a unicode stream of characters to the HTMLTokenizer. This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking. """ def __init__(self, source, override_encoding=None, transport_encoding=None, same_origin_parent_encoding=None, likely_encoding=None, default_encoding="windows-1252", useChardet=True): """Initialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by html5lib. source can be either a file-object, local filename or a string. The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) """ # Raw Stream - for unicode objects this will encode to utf-8 and set # self.charEncoding as appropriate self.rawStream = self.openStream(source) HTMLUnicodeInputStream.__init__(self, self.rawStream) # Encoding Information # Number of bytes to use when looking for a meta element with # encoding information self.numBytesMeta = 1024 # Number of bytes to use when using detecting encoding using chardet self.numBytesChardet = 100 # Things from args self.override_encoding = override_encoding self.transport_encoding = transport_encoding self.same_origin_parent_encoding = same_origin_parent_encoding self.likely_encoding = likely_encoding self.default_encoding = default_encoding # Determine encoding self.charEncoding = self.determineEncoding(useChardet) assert self.charEncoding[0] is not None # Call superclass self.reset() def reset(self): self.dataStream = self.charEncoding[0].codec_info.streamreader(self.rawStream, 'replace') HTMLUnicodeInputStream.reset(self) def openStream(self, source): """Produces a file object from source. source can be either a file object, local filename or a string. """ # Already a file object if hasattr(source, 'read'): stream = source else: stream = BytesIO(source) try: stream.seek(stream.tell()) except Exception: stream = BufferedStream(stream) return stream def determineEncoding(self, chardet=True): # BOMs take precedence over everything # This will also read past the BOM if present charEncoding = self.detectBOM(), "certain" if charEncoding[0] is not None: return charEncoding # If we've been overridden, we've been overridden charEncoding = lookupEncoding(self.override_encoding), "certain" if charEncoding[0] is not None: return charEncoding # Now check the transport layer charEncoding = lookupEncoding(self.transport_encoding), "certain" if charEncoding[0] is not None: return charEncoding # Look for meta elements with encoding information charEncoding = self.detectEncodingMeta(), "tentative" if charEncoding[0] is not None: return charEncoding # Parent document encoding charEncoding = lookupEncoding(self.same_origin_parent_encoding), "tentative" if charEncoding[0] is not None and not charEncoding[0].name.startswith("utf-16"): return charEncoding # "likely" encoding charEncoding = lookupEncoding(self.likely_encoding), "tentative" if charEncoding[0] is not None: return charEncoding # Guess with chardet, if available if chardet: try: from pip._vendor.chardet.universaldetector import UniversalDetector except ImportError: pass else: buffers = [] detector = UniversalDetector() while not detector.done: buffer = self.rawStream.read(self.numBytesChardet) assert isinstance(buffer, bytes) if not buffer: break buffers.append(buffer) detector.feed(buffer) detector.close() encoding = lookupEncoding(detector.result['encoding']) self.rawStream.seek(0) if encoding is not None: return encoding, "tentative" # Try the default encoding charEncoding = lookupEncoding(self.default_encoding), "tentative" if charEncoding[0] is not None: return charEncoding # Fallback to html5lib's default if even that hasn't worked return lookupEncoding("windows-1252"), "tentative" def changeEncoding(self, newEncoding): assert self.charEncoding[1] != "certain" newEncoding = lookupEncoding(newEncoding) if newEncoding is None: return if newEncoding.name in ("utf-16be", "utf-16le"): newEncoding = lookupEncoding("utf-8") assert newEncoding is not None elif newEncoding == self.charEncoding[0]: self.charEncoding = (self.charEncoding[0], "certain") else: self.rawStream.seek(0) self.charEncoding = (newEncoding, "certain") self.reset() raise _ReparseException("Encoding changed from %s to %s" % (self.charEncoding[0], newEncoding)) def detectBOM(self): """Attempts to detect at BOM at the start of the stream. If an encoding can be determined from the BOM return the name of the encoding otherwise return None""" bomDict = { codecs.BOM_UTF8: 'utf-8', codecs.BOM_UTF16_LE: 'utf-16le', codecs.BOM_UTF16_BE: 'utf-16be', codecs.BOM_UTF32_LE: 'utf-32le', codecs.BOM_UTF32_BE: 'utf-32be' } # Go to beginning of file and read in 4 bytes string = self.rawStream.read(4) assert isinstance(string, bytes) # Try detecting the BOM using bytes from the string encoding = bomDict.get(string[:3]) # UTF-8 seek = 3 if not encoding: # Need to detect UTF-32 before UTF-16 encoding = bomDict.get(string) # UTF-32 seek = 4 if not encoding: encoding = bomDict.get(string[:2]) # UTF-16 seek = 2 # Set the read position past the BOM if one was found, otherwise # set it to the start of the stream if encoding: self.rawStream.seek(seek) return lookupEncoding(encoding) else: self.rawStream.seek(0) return None def detectEncodingMeta(self): """Report the encoding declared by the meta element """ buffer = self.rawStream.read(self.numBytesMeta) assert isinstance(buffer, bytes) parser = EncodingParser(buffer) self.rawStream.seek(0) encoding = parser.getEncoding() if encoding is not None and encoding.name in ("utf-16be", "utf-16le"): encoding = lookupEncoding("utf-8") return encoding class EncodingBytes(bytes): """String-like object with an associated position and various extra methods If the position is ever greater than the string length then an exception is raised""" def __new__(self, value): assert isinstance(value, bytes) return bytes.__new__(self, value.lower()) def __init__(self, value): # pylint:disable=unused-argument self._position = -1 def __iter__(self): return self def __next__(self): p = self._position = self._position + 1 if p >= len(self): raise StopIteration elif p < 0: raise TypeError return self[p:p + 1] def next(self): # Py2 compat return self.__next__() def previous(self): p = self._position if p >= len(self): raise StopIteration elif p < 0: raise TypeError self._position = p = p - 1 return self[p:p + 1] def setPosition(self, position): if self._position >= len(self): raise StopIteration self._position = position def getPosition(self): if self._position >= len(self): raise StopIteration if self._position >= 0: return self._position else: return None position = property(getPosition, setPosition) def getCurrentByte(self): return self[self.position:self.position + 1] currentByte = property(getCurrentByte) def skip(self, chars=spaceCharactersBytes): """Skip past a list of characters""" p = self.position # use property for the error-checking while p < len(self): c = self[p:p + 1] if c not in chars: self._position = p return c p += 1 self._position = p return None def skipUntil(self, chars): p = self.position while p < len(self): c = self[p:p + 1] if c in chars: self._position = p return c p += 1 self._position = p return None def matchBytes(self, bytes): """Look for a sequence of bytes at the start of a string. If the bytes are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone""" rv = self.startswith(bytes, self.position) if rv: self.position += len(bytes) return rv def jumpTo(self, bytes): """Look for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the match""" try: self._position = self.index(bytes, self.position) + len(bytes) - 1 except ValueError: raise StopIteration return True class EncodingParser(object): """Mini parser for detecting character encoding from meta elements""" def __init__(self, data): """string - the data to work on for encoding detection""" self.data = EncodingBytes(data) self.encoding = None def getEncoding(self): if b"") def handleMeta(self): if self.data.currentByte not in spaceCharactersBytes: # if we have ") def getAttribute(self): """Return a name,value pair for the next attribute in the stream, if one is found, or None""" data = self.data # Step 1 (skip chars) c = data.skip(spaceCharactersBytes | frozenset([b"/"])) assert c is None or len(c) == 1 # Step 2 if c in (b">", None): return None # Step 3 attrName = [] attrValue = [] # Step 4 attribute name while True: if c == b"=" and attrName: break elif c in spaceCharactersBytes: # Step 6! c = data.skip() break elif c in (b"/", b">"): return b"".join(attrName), b"" elif c in asciiUppercaseBytes: attrName.append(c.lower()) elif c is None: return None else: attrName.append(c) # Step 5 c = next(data) # Step 7 if c != b"=": data.previous() return b"".join(attrName), b"" # Step 8 next(data) # Step 9 c = data.skip() # Step 10 if c in (b"'", b'"'): # 10.1 quoteChar = c while True: # 10.2 c = next(data) # 10.3 if c == quoteChar: next(data) return b"".join(attrName), b"".join(attrValue) # 10.4 elif c in asciiUppercaseBytes: attrValue.append(c.lower()) # 10.5 else: attrValue.append(c) elif c == b">": return b"".join(attrName), b"" elif c in asciiUppercaseBytes: attrValue.append(c.lower()) elif c is None: return None else: attrValue.append(c) # Step 11 while True: c = next(data) if c in spacesAngleBrackets: return b"".join(attrName), b"".join(attrValue) elif c in asciiUppercaseBytes: attrValue.append(c.lower()) elif c is None: return None else: attrValue.append(c) class ContentAttrParser(object): def __init__(self, data): assert isinstance(data, bytes) self.data = data def parse(self): try: # Check if the attr name is charset # otherwise return self.data.jumpTo(b"charset") self.data.position += 1 self.data.skip() if not self.data.currentByte == b"=": # If there is no = sign keep looking for attrs return None self.data.position += 1 self.data.skip() # Look for an encoding between matching quote marks if self.data.currentByte in (b'"', b"'"): quoteMark = self.data.currentByte self.data.position += 1 oldPosition = self.data.position if self.data.jumpTo(quoteMark): return self.data[oldPosition:self.data.position] else: return None else: # Unquoted value oldPosition = self.data.position try: self.data.skipUntil(spaceCharactersBytes) return self.data[oldPosition:self.data.position] except StopIteration: # Return the whole remaining value return self.data[oldPosition:] except StopIteration: return None def lookupEncoding(encoding): """Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.""" if isinstance(encoding, bytes): try: encoding = encoding.decode("ascii") except UnicodeDecodeError: return None if encoding is not None: try: return webencodings.lookup(encoding) except AttributeError: return None else: return None html5lib/_trie/__pycache__/py.cpython-36.pyc000064400000004143152347724720014673 0ustar003 Pf@sLddlmZmZmZddlmZddlmZddlm Z Gddde Z dS) )absolute_importdivisionunicode_literals) text_type) bisect_left)Triec@sFeZdZddZddZddZddZd d Zdd d ZddZ d S)rcCsJtdd|jDstd||_t|j|_d|_dt|f|_dS)Ncss|]}t|tVqdS)N) isinstancer).0xr /usr/lib/python3.6/py.py sz Trie.__init__..zAll keys must be stringsr) allkeys TypeError_datasorted_keys _cachestrlen _cachepoints)selfdatar r r __init__ s z Trie.__init__cCs ||jkS)N)r)rkeyr r r __contains__szTrie.__contains__cCs t|jS)N)rr)rr r r __len__sz Trie.__len__cCs t|jS)N)iterr)rr r r __iter__sz Trie.__iter__cCs |j|S)N)r)rrr r r __getitem__szTrie.__getitem__NcCs|dks|dks|j r"t|jS|j|jrN|j\}}t|j|||}}nt|j|}}t}|t|jkrv|Sx,|j|j|r|j|j||d7}qxW||_||f|_|S)Nrr)rset startswithrrrradd)rprefixlohistartirr r r rs     z Trie.keyscCsd||jkrdS|j|jr6|j\}}t|j|||}n t|j|}|t|jkrTdS|j|j|S)NTF)rr#rrrrr)rr%r&r'r)r r r has_keys_with_prefix6s    zTrie.has_keys_with_prefix)N) __name__ __module__ __qualname__rrrr r!rr*r r r r r s  rN) Z __future__rrrZpip._vendor.sixrZbisectrZ_baserZABCTrier r r r s   html5lib/_trie/__pycache__/datrie.cpython-36.opt-1.pyc000064400000003626152347724720016457 0ustar003 Pf@sLddlmZmZmZddlmZddlmZddl mZ Gddde ZdS))absolute_importdivisionunicode_literals)Trie) text_typec@sVeZdZddZddZddZddZd d Zdd d ZddZ ddZ ddZ d S)rcCsvt}x:|jD].}t|ts&tdx|D]}|j|q,WqWtdj||_x|j D]\}}||j|<q\WdS)NzAll keys must be strings) setkeys isinstancer TypeErroraddDATriejoin_dataitems)selfdatacharskeycharvaluer/usr/lib/python3.6/datrie.py__init__ s  z Trie.__init__cCs ||jkS)N)r)rrrrr __contains__szTrie.__contains__cCs t|jS)N)lenr)rrrr__len__sz Trie.__len__cCs tdS)N)NotImplementedError)rrrr__iter__sz Trie.__iter__cCs |j|S)N)r)rrrrr __getitem__szTrie.__getitem__NcCs |jj|S)N)rr )rprefixrrrr "sz Trie.keyscCs |jj|S)N)rhas_keys_with_prefix)rr!rrrr"%szTrie.has_keys_with_prefixcCs |jj|S)N)rlongest_prefix)rr!rrrr#(szTrie.longest_prefixcCs |jj|S)N)rlongest_prefix_item)rr!rrrr$+szTrie.longest_prefix_item)N) __name__ __module__ __qualname__rrrrr r r"r#r$rrrrr s  rN) Z __future__rrrZdatrierrZpip._vendor.sixrZ_baseZABCTrierrrrs   html5lib/_trie/__pycache__/datrie.cpython-36.pyc000064400000003626152347724720015520 0ustar003 Pf@sLddlmZmZmZddlmZddlmZddl mZ Gddde ZdS))absolute_importdivisionunicode_literals)Trie) text_typec@sVeZdZddZddZddZddZd d Zdd d ZddZ ddZ ddZ d S)rcCsvt}x:|jD].}t|ts&tdx|D]}|j|q,WqWtdj||_x|j D]\}}||j|<q\WdS)NzAll keys must be strings) setkeys isinstancer TypeErroraddDATriejoin_dataitems)selfdatacharskeycharvaluer/usr/lib/python3.6/datrie.py__init__ s  z Trie.__init__cCs ||jkS)N)r)rrrrr __contains__szTrie.__contains__cCs t|jS)N)lenr)rrrr__len__sz Trie.__len__cCs tdS)N)NotImplementedError)rrrr__iter__sz Trie.__iter__cCs |j|S)N)r)rrrrr __getitem__szTrie.__getitem__NcCs |jj|S)N)rr )rprefixrrrr "sz Trie.keyscCs |jj|S)N)rhas_keys_with_prefix)rr!rrrr"%szTrie.has_keys_with_prefixcCs |jj|S)N)rlongest_prefix)rr!rrrr#(szTrie.longest_prefixcCs |jj|S)N)rlongest_prefix_item)rr!rrrr$+szTrie.longest_prefix_item)N) __name__ __module__ __qualname__rrrrr r r"r#r$rrrrr s  rN) Z __future__rrrZdatrierrZpip._vendor.sixrZ_baseZABCTrierrrrs   html5lib/_trie/__pycache__/_base.cpython-36.opt-1.pyc000064400000002625152347724720016256 0ustar003 Pf@s4ddlmZmZmZddlmZGdddeZdS))absolute_importdivisionunicode_literals)Mappingcs:eZdZdZd fdd ZddZddZd d ZZS) TriezAbstract base class for triesNcs4tt|j}dkrt|Stfdd|DS)Ncsg|]}|jr|qS) startswith).0x)prefixr/usr/lib/python3.6/_base.py szTrie.keys..)superrkeysset)selfr r) __class__)r r r sz Trie.keyscCs$x|jD]}|j|r dSq WdS)NTF)rr)rr keyrrr has_keys_with_prefixs zTrie.has_keys_with_prefixcCsT||kr |Sx:tdt|dD]$}|d| |kr |d| Sq Wt|dS)N)rangelenKeyError)rr irrr longest_prefixs zTrie.longest_prefixcCs|j|}|||fS)N)r)rr Zlprefixrrr longest_prefix_item$s zTrie.longest_prefix_item)N) __name__ __module__ __qualname____doc__rrrr __classcell__rr)rr rs   rN)Z __future__rrr collectionsrrrrrr s html5lib/_trie/__pycache__/__init__.cpython-36.pyc000064400000000524152347724720016001 0ustar003 Pf! @sRddlmZmZmZddlmZeZyddlmZWne k rHYnXeZdS))absolute_importdivisionunicode_literals)TrieN) Z __future__rrrpyrZPyTrieZdatrieZDATrie ImportErrorr r /usr/lib/python3.6/__init__.pys html5lib/_trie/__pycache__/_base.cpython-36.pyc000064400000002625152347724720015317 0ustar003 Pf@s4ddlmZmZmZddlmZGdddeZdS))absolute_importdivisionunicode_literals)Mappingcs:eZdZdZd fdd ZddZddZd d ZZS) TriezAbstract base class for triesNcs4tt|j}dkrt|Stfdd|DS)Ncsg|]}|jr|qS) startswith).0x)prefixr/usr/lib/python3.6/_base.py szTrie.keys..)superrkeysset)selfr r) __class__)r r r sz Trie.keyscCs$x|jD]}|j|r dSq WdS)NTF)rr)rr keyrrr has_keys_with_prefixs zTrie.has_keys_with_prefixcCsT||kr |Sx:tdt|dD]$}|d| |kr |d| Sq Wt|dS)N)rangelenKeyError)rr irrr longest_prefixs zTrie.longest_prefixcCs|j|}|||fS)N)r)rr Zlprefixrrr longest_prefix_item$s zTrie.longest_prefix_item)N) __name__ __module__ __qualname____doc__rrrr __classcell__rr)rr rs   rN)Z __future__rrr collectionsrrrrrr s html5lib/_trie/__pycache__/py.cpython-36.opt-1.pyc000064400000004143152347724720015632 0ustar003 Pf@sLddlmZmZmZddlmZddlmZddlm Z Gddde Z dS) )absolute_importdivisionunicode_literals) text_type) bisect_left)Triec@sFeZdZddZddZddZddZd d Zdd d ZddZ d S)rcCsJtdd|jDstd||_t|j|_d|_dt|f|_dS)Ncss|]}t|tVqdS)N) isinstancer).0xr /usr/lib/python3.6/py.py sz Trie.__init__..zAll keys must be stringsr) allkeys TypeError_datasorted_keys _cachestrlen _cachepoints)selfdatar r r __init__ s z Trie.__init__cCs ||jkS)N)r)rkeyr r r __contains__szTrie.__contains__cCs t|jS)N)rr)rr r r __len__sz Trie.__len__cCs t|jS)N)iterr)rr r r __iter__sz Trie.__iter__cCs |j|S)N)r)rrr r r __getitem__szTrie.__getitem__NcCs|dks|dks|j r"t|jS|j|jrN|j\}}t|j|||}}nt|j|}}t}|t|jkrv|Sx,|j|j|r|j|j||d7}qxW||_||f|_|S)Nrr)rset startswithrrrradd)rprefixlohistartirr r r rs     z Trie.keyscCsd||jkrdS|j|jr6|j\}}t|j|||}n t|j|}|t|jkrTdS|j|j|S)NTF)rr#rrrrr)rr%r&r'r)r r r has_keys_with_prefix6s    zTrie.has_keys_with_prefix)N) __name__ __module__ __qualname__rrrr r!rr*r r r r r s  rN) Z __future__rrrZpip._vendor.sixrZbisectrZ_baserZABCTrier r r r s   html5lib/_trie/__pycache__/__init__.cpython-36.opt-1.pyc000064400000000524152347724720016740 0ustar003 Pf! @sRddlmZmZmZddlmZeZyddlmZWne k rHYnXeZdS))absolute_importdivisionunicode_literals)TrieN) Z __future__rrrpyrZPyTrieZdatrieZDATrie ImportErrorr r /usr/lib/python3.6/__init__.pys html5lib/_trie/py.py000064400000003357152347724720010415 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from bisect import bisect_left from ._base import Trie as ABCTrie class Trie(ABCTrie): def __init__(self, data): if not all(isinstance(x, text_type) for x in data.keys()): raise TypeError("All keys must be strings") self._data = data self._keys = sorted(data.keys()) self._cachestr = "" self._cachepoints = (0, len(data)) def __contains__(self, key): return key in self._data def __len__(self): return len(self._data) def __iter__(self): return iter(self._data) def __getitem__(self, key): return self._data[key] def keys(self, prefix=None): if prefix is None or prefix == "" or not self._keys: return set(self._keys) if prefix.startswith(self._cachestr): lo, hi = self._cachepoints start = i = bisect_left(self._keys, prefix, lo, hi) else: start = i = bisect_left(self._keys, prefix) keys = set() if start == len(self._keys): return keys while self._keys[i].startswith(prefix): keys.add(self._keys[i]) i += 1 self._cachestr = prefix self._cachepoints = (start, i) return keys def has_keys_with_prefix(self, prefix): if prefix in self._data: return True if prefix.startswith(self._cachestr): lo, hi = self._cachepoints i = bisect_left(self._keys, prefix, lo, hi) else: i = bisect_left(self._keys, prefix) if i == len(self._keys): return False return self._keys[i].startswith(prefix) html5lib/_trie/datrie.py000064400000002232152347724720011224 0ustar00from __future__ import absolute_import, division, unicode_literals from datrie import Trie as DATrie from pip._vendor.six import text_type from ._base import Trie as ABCTrie class Trie(ABCTrie): def __init__(self, data): chars = set() for key in data.keys(): if not isinstance(key, text_type): raise TypeError("All keys must be strings") for char in key: chars.add(char) self._data = DATrie("".join(chars)) for key, value in data.items(): self._data[key] = value def __contains__(self, key): return key in self._data def __len__(self): return len(self._data) def __iter__(self): raise NotImplementedError() def __getitem__(self, key): return self._data[key] def keys(self, prefix=None): return self._data.keys(prefix) def has_keys_with_prefix(self, prefix): return self._data.has_keys_with_prefix(prefix) def longest_prefix(self, prefix): return self._data.longest_prefix(prefix) def longest_prefix_item(self, prefix): return self._data.longest_prefix_item(prefix) html5lib/_trie/_base.py000064400000001765152347724720011037 0ustar00from __future__ import absolute_import, division, unicode_literals try: from collections.abc import Mapping except ImportError: # Python 2.7 from collections import Mapping class Trie(Mapping): """Abstract base class for tries""" def keys(self, prefix=None): # pylint:disable=arguments-differ keys = super(Trie, self).keys() if prefix is None: return set(keys) return {x for x in keys if x.startswith(prefix)} def has_keys_with_prefix(self, prefix): for key in self.keys(): if key.startswith(prefix): return True return False def longest_prefix(self, prefix): if prefix in self: return prefix for i in range(1, len(prefix) + 1): if prefix[:-i] in self: return prefix[:-i] raise KeyError(prefix) def longest_prefix_item(self, prefix): lprefix = self.longest_prefix(prefix) return (lprefix, self[lprefix]) html5lib/_trie/__init__.py000064400000000155152347724720011515 0ustar00from __future__ import absolute_import, division, unicode_literals from .py import Trie __all__ = ["Trie"] html5lib/serializer.py000064400000036617152347724720011041 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type import re from codecs import register_error, xmlcharrefreplace_errors from .constants import voidElements, booleanAttributes, spaceCharacters from .constants import rcdataElements, entities, xmlEntities from . import treewalkers, _utils from xml.sax.saxutils import escape _quoteAttributeSpecChars = "".join(spaceCharacters) + "\"'=<>`" _quoteAttributeSpec = re.compile("[" + _quoteAttributeSpecChars + "]") _quoteAttributeLegacy = re.compile("[" + _quoteAttributeSpecChars + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n" "\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15" "\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x20\x2f\x60\xa0\u1680\u180e\u180f\u2000" "\u2001\u2002\u2003\u2004\u2005\u2006\u2007" "\u2008\u2009\u200a\u2028\u2029\u202f\u205f" "\u3000]") _encode_entity_map = {} _is_ucs4 = len("\U0010FFFF") == 1 for k, v in list(entities.items()): # skip multi-character entities if ((_is_ucs4 and len(v) > 1) or (not _is_ucs4 and len(v) > 2)): continue if v != "&": if len(v) == 2: v = _utils.surrogatePairToCodepoint(v) else: v = ord(v) if v not in _encode_entity_map or k.islower(): # prefer < over < and similarly for &, >, etc. _encode_entity_map[v] = k def htmlentityreplace_errors(exc): if isinstance(exc, (UnicodeEncodeError, UnicodeTranslateError)): res = [] codepoints = [] skip = False for i, c in enumerate(exc.object[exc.start:exc.end]): if skip: skip = False continue index = i + exc.start if _utils.isSurrogatePair(exc.object[index:min([exc.end, index + 2])]): codepoint = _utils.surrogatePairToCodepoint(exc.object[index:index + 2]) skip = True else: codepoint = ord(c) codepoints.append(codepoint) for cp in codepoints: e = _encode_entity_map.get(cp) if e: res.append("&") res.append(e) if not e.endswith(";"): res.append(";") else: res.append("&#x%s;" % (hex(cp)[2:])) return ("".join(res), exc.end) else: return xmlcharrefreplace_errors(exc) register_error("htmlentityreplace", htmlentityreplace_errors) def serialize(input, tree="etree", encoding=None, **serializer_opts): """Serializes the input token stream using the specified treewalker :arg input: the token stream to serialize :arg tree: the treewalker to use :arg encoding: the encoding to use :arg serializer_opts: any options to pass to the :py:class:`html5lib.serializer.HTMLSerializer` that gets created :returns: the tree serialized as a string Example: >>> from html5lib.html5parser import parse >>> from html5lib.serializer import serialize >>> token_stream = parse('

Hi!

') >>> serialize(token_stream, omit_optional_tags=False) '

Hi!

' """ # XXX: Should we cache this? walker = treewalkers.getTreeWalker(tree) s = HTMLSerializer(**serializer_opts) return s.render(walker(input), encoding) class HTMLSerializer(object): # attribute quoting options quote_attr_values = "legacy" # be secure by default quote_char = '"' use_best_quote_char = True # tag syntax options omit_optional_tags = True minimize_boolean_attributes = True use_trailing_solidus = False space_before_trailing_solidus = True # escaping options escape_lt_in_attrs = False escape_rcdata = False resolve_entities = True # miscellaneous options alphabetical_attributes = False inject_meta_charset = True strip_whitespace = False sanitize = False options = ("quote_attr_values", "quote_char", "use_best_quote_char", "omit_optional_tags", "minimize_boolean_attributes", "use_trailing_solidus", "space_before_trailing_solidus", "escape_lt_in_attrs", "escape_rcdata", "resolve_entities", "alphabetical_attributes", "inject_meta_charset", "strip_whitespace", "sanitize") def __init__(self, **kwargs): """Initialize HTMLSerializer :arg inject_meta_charset: Whether or not to inject the meta charset. Defaults to ``True``. :arg quote_attr_values: Whether to quote attribute values that don't require quoting per legacy browser behavior (``"legacy"``), when required by the standard (``"spec"``), or always (``"always"``). Defaults to ``"legacy"``. :arg quote_char: Use given quote character for attribute quoting. Defaults to ``"`` which will use double quotes unless attribute value contains a double quote, in which case single quotes are used. :arg escape_lt_in_attrs: Whether or not to escape ``<`` in attribute values. Defaults to ``False``. :arg escape_rcdata: Whether to escape characters that need to be escaped within normal elements within rcdata elements such as style. Defaults to ``False``. :arg resolve_entities: Whether to resolve named character entities that appear in the source tree. The XML predefined entities < > & " ' are unaffected by this setting. Defaults to ``True``. :arg strip_whitespace: Whether to remove semantically meaningless whitespace. (This compresses all whitespace to a single space except within ``pre``.) Defaults to ``False``. :arg minimize_boolean_attributes: Shortens boolean attributes to give just the attribute value, for example:: becomes:: Defaults to ``True``. :arg use_trailing_solidus: Includes a close-tag slash at the end of the start tag of void elements (empty elements whose end tag is forbidden). E.g. ``
``. Defaults to ``False``. :arg space_before_trailing_solidus: Places a space immediately before the closing slash in a tag using a trailing solidus. E.g. ``
``. Requires ``use_trailing_solidus=True``. Defaults to ``True``. :arg sanitize: Strip all unsafe or unknown constructs from output. See :py:class:`html5lib.filters.sanitizer.Filter`. Defaults to ``False``. :arg omit_optional_tags: Omit start/end tags that are optional. Defaults to ``True``. :arg alphabetical_attributes: Reorder attributes to be in alphabetical order. Defaults to ``False``. """ unexpected_args = frozenset(kwargs) - frozenset(self.options) if len(unexpected_args) > 0: raise TypeError("__init__() got an unexpected keyword argument '%s'" % next(iter(unexpected_args))) if 'quote_char' in kwargs: self.use_best_quote_char = False for attr in self.options: setattr(self, attr, kwargs.get(attr, getattr(self, attr))) self.errors = [] self.strict = False def encode(self, string): assert(isinstance(string, text_type)) if self.encoding: return string.encode(self.encoding, "htmlentityreplace") else: return string def encodeStrict(self, string): assert(isinstance(string, text_type)) if self.encoding: return string.encode(self.encoding, "strict") else: return string def serialize(self, treewalker, encoding=None): # pylint:disable=too-many-nested-blocks self.encoding = encoding in_cdata = False self.errors = [] if encoding and self.inject_meta_charset: from .filters.inject_meta_charset import Filter treewalker = Filter(treewalker, encoding) # Alphabetical attributes is here under the assumption that none of # the later filters add or change order of attributes; it needs to be # before the sanitizer so escaped elements come out correctly if self.alphabetical_attributes: from .filters.alphabeticalattributes import Filter treewalker = Filter(treewalker) # WhitespaceFilter should be used before OptionalTagFilter # for maximum efficiently of this latter filter if self.strip_whitespace: from .filters.whitespace import Filter treewalker = Filter(treewalker) if self.sanitize: from .filters.sanitizer import Filter treewalker = Filter(treewalker) if self.omit_optional_tags: from .filters.optionaltags import Filter treewalker = Filter(treewalker) for token in treewalker: type = token["type"] if type == "Doctype": doctype = "= 0: if token["systemId"].find("'") >= 0: self.serializeError("System identifier contains both single and double quote characters") quote_char = "'" else: quote_char = '"' doctype += " %s%s%s" % (quote_char, token["systemId"], quote_char) doctype += ">" yield self.encodeStrict(doctype) elif type in ("Characters", "SpaceCharacters"): if type == "SpaceCharacters" or in_cdata: if in_cdata and token["data"].find("= 0: self.serializeError("Unexpected ") elif type == "EndTag": name = token["name"] if name in rcdataElements: in_cdata = False elif in_cdata: self.serializeError("Unexpected child element of a CDATA element") yield self.encodeStrict("" % name) elif type == "Comment": data = token["data"] if data.find("--") >= 0: self.serializeError("Comment contains --") yield self.encodeStrict("" % token["data"]) elif type == "Entity": name = token["name"] key = name + ";" if key not in entities: self.serializeError("Entity %s not recognized" % name) if self.resolve_entities and key not in xmlEntities: data = entities[key] else: data = "&%s;" % name yield self.encodeStrict(data) else: self.serializeError(token["data"]) def render(self, treewalker, encoding=None): """Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTreeWalker >>> from html5lib.serializer import HTMLSerializer >>> token_stream = parse('Hi!') >>> walker = getTreeWalker('etree') >>> serializer = HTMLSerializer(omit_optional_tags=False) >>> serializer.render(walker(token_stream)) 'Hi!' """ if encoding: return b"".join(list(self.serialize(treewalker, encoding))) else: return "".join(list(self.serialize(treewalker))) def serializeError(self, data="XXX ERROR MESSAGE NEEDED"): # XXX The idea is to make data mandatory. self.errors.append(data) if self.strict: raise SerializeError class SerializeError(Exception): """Error in serialized tree""" pass html5lib/treeadapters/__pycache__/sax.cpython-36.pyc000064400000002416152347724720016420 0ustar003 Pf}@shddlmZmZmZddlmZddlmZmZiZ x&ej D]\Z Z Z e dk r>e e e <q>WddZdS))absolute_importdivisionunicode_literals)AttributesNSImpl)adjustForeignAttributesunadjustForeignAttributesNcCs(|jx tjD]\}}|j||qWx|D]}|d}|dkrHq0q0|dkrt|dt}|j|d|df|d||dkr|j|d|df|dq0|dkr|j|d|df|dq0|dkr|j|dq0|d krq0d s0t d q0Wx tjD]\}}|j |qW|j dS)z8Call SAX-like content handler based on treewalker walkertypeZDoctypeStartTagEmptyTagdata namespacenameZEndTag CharactersSpaceCharactersCommentFzUnknown token typeN)r r )rr) Z startDocumentprefix_mappingitemsZstartPrefixMappingrrZstartElementNSZ endElementNSZ charactersAssertionErrorZendPrefixMappingZ endDocument)ZwalkerZhandlerprefixr tokenr Zattrsr/usr/lib/python3.6/sax.pyto_sax s6   r)Z __future__rrrZxml.sax.xmlreaderrZ constantsrrrvaluesrZ localNamer rrrrrs  html5lib/treeadapters/__pycache__/__init__.cpython-36.pyc000064400000000553152347724720017364 0ustar003 Pf @sZddlmZmZmZddlmZdgZyddlmZWnek rJYn Xej ddS))absolute_importdivisionunicode_literals)saxr)genshirN) Z __future__rrrr__all__r ImportErrorappendr r /usr/lib/python3.6/__init__.pys html5lib/treeadapters/__pycache__/genshi.cpython-36.pyc000064400000002640152347724720017101 0ustar003 Pf@sLddlmZmZmZddlmZmZddlmZmZm Z m Z m Z ddZ dS))absolute_importdivisionunicode_literals)QNameAttrs)STARTENDTEXTCOMMENTDOCTYPEccsZg}x6|D],}|d}|dkr2|j|dn|rLtdj|dfVg}|dkr|d rrd |d |d f}n|d }td d |djD}tt||fdfV|dkrd}|dkr|d rd |d |d f}n|d }tt|dfVq |dkrt|dd fVq |dkr t |d |d|dfd#fVq q W|rVtdj|d&fVdS)'Ntype CharactersSpaceCharactersdataStartTagEmptyTag namespacez{%s}%snamecSs4g|],\}}t|ddk r"d|n|d|fqS)rNz{%s}%sr)r).0attrvaluer/usr/lib/python3.6/genshi.py szto_genshi..ZEndTagCommentZDoctypeZpublicIdZsystemId)r rr)Nrr)rrrr)Nrrrr)Nrrrr)Nrrrr)Nrrrr)Nrr) appendr joinritemsrrrr r )Zwalkertexttokenr rZattrsrrr to_genshis<  r#N) Z __future__rrrZ genshi.corerrrrr r r r#rrrrshtml5lib/treeadapters/__pycache__/sax.cpython-36.opt-1.pyc000064400000002335152347724720017357 0ustar003 Pf}@shddlmZmZmZddlmZddlmZmZiZ x&ej D]\Z Z Z e dk r>e e e <q>WddZdS))absolute_importdivisionunicode_literals)AttributesNSImpl)adjustForeignAttributesunadjustForeignAttributesNcCs|jx tjD]\}}|j||qWx|D]}|d}|dkrHq0q0|d krt|dt}|j|d|df|d||dkr|j|d|df|dq0|dkr|j|d|df|dq0|dkr|j|dq0|d kr0q0q0Wx tjD]\}}|j |qW|j d S)z8Call SAX-like content handler based on treewalker walkertypeZDoctypeStartTagEmptyTagdata namespacenameZEndTag CharactersSpaceCharactersCommentN)r r )rr) Z startDocumentprefix_mappingitemsZstartPrefixMappingrrZstartElementNSZ endElementNSZ charactersZendPrefixMappingZ endDocument)ZwalkerZhandlerprefixr tokenr Zattrsr/usr/lib/python3.6/sax.pyto_sax s6   r)Z __future__rrrZxml.sax.xmlreaderrZ constantsrrrvaluesrZ localNamer rrrrrs  html5lib/treeadapters/__pycache__/__init__.cpython-36.opt-1.pyc000064400000000553152347724720020323 0ustar003 Pf @sZddlmZmZmZddlmZdgZyddlmZWnek rJYn Xej ddS))absolute_importdivisionunicode_literals)saxr)genshirN) Z __future__rrrr__all__r ImportErrorappendr r /usr/lib/python3.6/__init__.pys html5lib/treeadapters/__pycache__/genshi.cpython-36.opt-1.pyc000064400000002640152347724720020040 0ustar003 Pf@sLddlmZmZmZddlmZmZddlmZmZm Z m Z m Z ddZ dS))absolute_importdivisionunicode_literals)QNameAttrs)STARTENDTEXTCOMMENTDOCTYPEccsZg}x6|D],}|d}|dkr2|j|dn|rLtdj|dfVg}|dkr|d rrd |d |d f}n|d }td d |djD}tt||fdfV|dkrd}|dkr|d rd |d |d f}n|d }tt|dfVq |dkrt|dd fVq |dkr t |d |d|dfd#fVq q W|rVtdj|d&fVdS)'Ntype CharactersSpaceCharactersdataStartTagEmptyTag namespacez{%s}%snamecSs4g|],\}}t|ddk r"d|n|d|fqS)rNz{%s}%sr)r).0attrvaluer/usr/lib/python3.6/genshi.py szto_genshi..ZEndTagCommentZDoctypeZpublicIdZsystemId)r rr)Nrr)rrrr)Nrrrr)Nrrrr)Nrrrr)Nrrrr)Nrr) appendr joinritemsrrrr r )Zwalkertexttokenr rZattrsrrr to_genshis<  r#N) Z __future__rrrZ genshi.corerrrrr r r r#rrrrshtml5lib/treeadapters/genshi.py000064400000003263152347724720012617 0ustar00from __future__ import absolute_import, division, unicode_literals from genshi.core import QName, Attrs from genshi.core import START, END, TEXT, COMMENT, DOCTYPE def to_genshi(walker): """Convert a tree to a genshi tree :arg walker: the treewalker to use to walk the tree to convert it :returns: generator of genshi nodes """ text = [] for token in walker: type = token["type"] if type in ("Characters", "SpaceCharacters"): text.append(token["data"]) elif text: yield TEXT, "".join(text), (None, -1, -1) text = [] if type in ("StartTag", "EmptyTag"): if token["namespace"]: name = "{%s}%s" % (token["namespace"], token["name"]) else: name = token["name"] attrs = Attrs([(QName("{%s}%s" % attr if attr[0] is not None else attr[1]), value) for attr, value in token["data"].items()]) yield (START, (QName(name), attrs), (None, -1, -1)) if type == "EmptyTag": type = "EndTag" if type == "EndTag": if token["namespace"]: name = "{%s}%s" % (token["namespace"], token["name"]) else: name = token["name"] yield END, QName(name), (None, -1, -1) elif type == "Comment": yield COMMENT, token["data"], (None, -1, -1) elif type == "Doctype": yield DOCTYPE, (token["name"], token["publicId"], token["systemId"]), (None, -1, -1) else: pass # FIXME: What to do? if text: yield TEXT, "".join(text), (None, -1, -1) html5lib/treeadapters/sax.py000064400000003360152347724720012133 0ustar00from __future__ import absolute_import, division, unicode_literals from xml.sax.xmlreader import AttributesNSImpl from ..constants import adjustForeignAttributes, unadjustForeignAttributes prefix_mapping = {} for prefix, localName, namespace in adjustForeignAttributes.values(): if prefix is not None: prefix_mapping[prefix] = namespace def to_sax(walker, handler): """Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use """ handler.startDocument() for prefix, namespace in prefix_mapping.items(): handler.startPrefixMapping(prefix, namespace) for token in walker: type = token["type"] if type == "Doctype": continue elif type in ("StartTag", "EmptyTag"): attrs = AttributesNSImpl(token["data"], unadjustForeignAttributes) handler.startElementNS((token["namespace"], token["name"]), token["name"], attrs) if type == "EmptyTag": handler.endElementNS((token["namespace"], token["name"]), token["name"]) elif type == "EndTag": handler.endElementNS((token["namespace"], token["name"]), token["name"]) elif type in ("Characters", "SpaceCharacters"): handler.characters(token["data"]) elif type == "Comment": pass else: assert False, "Unknown token type" for prefix, namespace in prefix_mapping.items(): handler.endPrefixMapping(prefix) handler.endDocument() html5lib/treeadapters/__init__.py000064400000001247152347724720013101 0ustar00"""Tree adapters let you convert from one tree structure to another Example: .. code-block:: python from pip._vendor import html5lib from pip._vendor.html5lib.treeadapters import genshi doc = 'Hi!' treebuilder = html5lib.getTreeBuilder('etree') parser = html5lib.HTMLParser(tree=treebuilder) tree = parser.parse(doc) TreeWalker = html5lib.getTreeWalker('etree') genshi_tree = genshi.to_genshi(TreeWalker(tree)) """ from __future__ import absolute_import, division, unicode_literals from . import sax __all__ = ["sax"] try: from . import genshi # noqa except ImportError: pass else: __all__.append("genshi") html5lib/html5parser.py000064400000344702152347724720011133 0ustar00from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import with_metaclass, viewkeys import types from . import _inputstream from . import _tokenizer from . import treebuilders from .treebuilders.base import Marker from . import _utils from .constants import ( spaceCharacters, asciiUpper2Lower, specialElements, headingElements, cdataElements, rcdataElements, tokenTypes, tagTokenTypes, namespaces, htmlIntegrationPointElements, mathmlTextIntegrationPointElements, adjustForeignAttributes as adjustForeignAttributesMap, adjustMathMLAttributes, adjustSVGAttributes, E, _ReparseException ) def parse(doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs): """Parse an HTML document as a string or file-like object into a tree :arg doc: the document to parse as a string or file-like object :arg treebuilder: the treebuilder to use when parsing :arg namespaceHTMLElements: whether or not to namespace HTML elements :returns: parsed tree Example: >>> from html5lib.html5parser import parse >>> parse('

This is a doc

') """ tb = treebuilders.getTreeBuilder(treebuilder) p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements) return p.parse(doc, **kwargs) def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs): """Parse an HTML fragment as a string or file-like object into a tree :arg doc: the fragment to parse as a string or file-like object :arg container: the container context to parse the fragment in :arg treebuilder: the treebuilder to use when parsing :arg namespaceHTMLElements: whether or not to namespace HTML elements :returns: parsed tree Example: >>> from html5lib.html5libparser import parseFragment >>> parseFragment('this is a fragment') """ tb = treebuilders.getTreeBuilder(treebuilder) p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements) return p.parseFragment(doc, container=container, **kwargs) def method_decorator_metaclass(function): class Decorated(type): def __new__(meta, classname, bases, classDict): for attributeName, attribute in classDict.items(): if isinstance(attribute, types.FunctionType): attribute = function(attribute) classDict[attributeName] = attribute return type.__new__(meta, classname, bases, classDict) return Decorated class HTMLParser(object): """HTML parser Generates a tree structure from a stream of (possibly malformed) HTML. """ def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False): """ :arg tree: a treebuilder class controlling the type of tree that will be returned. Built in treebuilders can be accessed through html5lib.treebuilders.getTreeBuilder(treeType) :arg strict: raise an exception when a parse error is encountered :arg namespaceHTMLElements: whether or not to namespace HTML elements :arg debug: whether or not to enable debug mode which logs things Example: >>> from html5lib.html5parser import HTMLParser >>> parser = HTMLParser() # generates parser with etree builder >>> parser = HTMLParser('lxml', strict=True) # generates parser with lxml builder which is strict """ # Raise an exception on the first error encountered self.strict = strict if tree is None: tree = treebuilders.getTreeBuilder("etree") self.tree = tree(namespaceHTMLElements) self.errors = [] self.phases = {name: cls(self, self.tree) for name, cls in getPhases(debug).items()} def _parse(self, stream, innerHTML=False, container="div", scripting=False, **kwargs): self.innerHTMLMode = innerHTML self.container = container self.scripting = scripting self.tokenizer = _tokenizer.HTMLTokenizer(stream, parser=self, **kwargs) self.reset() try: self.mainLoop() except _ReparseException: self.reset() self.mainLoop() def reset(self): self.tree.reset() self.firstStartTag = False self.errors = [] self.log = [] # only used with debug mode # "quirks" / "limited quirks" / "no quirks" self.compatMode = "no quirks" if self.innerHTMLMode: self.innerHTML = self.container.lower() if self.innerHTML in cdataElements: self.tokenizer.state = self.tokenizer.rcdataState elif self.innerHTML in rcdataElements: self.tokenizer.state = self.tokenizer.rawtextState elif self.innerHTML == 'plaintext': self.tokenizer.state = self.tokenizer.plaintextState else: # state already is data state # self.tokenizer.state = self.tokenizer.dataState pass self.phase = self.phases["beforeHtml"] self.phase.insertHtmlElement() self.resetInsertionMode() else: self.innerHTML = False # pylint:disable=redefined-variable-type self.phase = self.phases["initial"] self.lastPhase = None self.beforeRCDataPhase = None self.framesetOK = True @property def documentEncoding(self): """Name of the character encoding that was used to decode the input stream, or :obj:`None` if that is not determined yet """ if not hasattr(self, 'tokenizer'): return None return self.tokenizer.stream.charEncoding[0].name def isHTMLIntegrationPoint(self, element): if (element.name == "annotation-xml" and element.namespace == namespaces["mathml"]): return ("encoding" in element.attributes and element.attributes["encoding"].translate( asciiUpper2Lower) in ("text/html", "application/xhtml+xml")) else: return (element.namespace, element.name) in htmlIntegrationPointElements def isMathMLTextIntegrationPoint(self, element): return (element.namespace, element.name) in mathmlTextIntegrationPointElements def mainLoop(self): CharactersToken = tokenTypes["Characters"] SpaceCharactersToken = tokenTypes["SpaceCharacters"] StartTagToken = tokenTypes["StartTag"] EndTagToken = tokenTypes["EndTag"] CommentToken = tokenTypes["Comment"] DoctypeToken = tokenTypes["Doctype"] ParseErrorToken = tokenTypes["ParseError"] for token in self.tokenizer: prev_token = None new_token = token while new_token is not None: prev_token = new_token currentNode = self.tree.openElements[-1] if self.tree.openElements else None currentNodeNamespace = currentNode.namespace if currentNode else None currentNodeName = currentNode.name if currentNode else None type = new_token["type"] if type == ParseErrorToken: self.parseError(new_token["data"], new_token.get("datavars", {})) new_token = None else: if (len(self.tree.openElements) == 0 or currentNodeNamespace == self.tree.defaultNamespace or (self.isMathMLTextIntegrationPoint(currentNode) and ((type == StartTagToken and token["name"] not in frozenset(["mglyph", "malignmark"])) or type in (CharactersToken, SpaceCharactersToken))) or (currentNodeNamespace == namespaces["mathml"] and currentNodeName == "annotation-xml" and type == StartTagToken and token["name"] == "svg") or (self.isHTMLIntegrationPoint(currentNode) and type in (StartTagToken, CharactersToken, SpaceCharactersToken))): phase = self.phase else: phase = self.phases["inForeignContent"] if type == CharactersToken: new_token = phase.processCharacters(new_token) elif type == SpaceCharactersToken: new_token = phase.processSpaceCharacters(new_token) elif type == StartTagToken: new_token = phase.processStartTag(new_token) elif type == EndTagToken: new_token = phase.processEndTag(new_token) elif type == CommentToken: new_token = phase.processComment(new_token) elif type == DoctypeToken: new_token = phase.processDoctype(new_token) if (type == StartTagToken and prev_token["selfClosing"] and not prev_token["selfClosingAcknowledged"]): self.parseError("non-void-element-with-trailing-solidus", {"name": prev_token["name"]}) # When the loop finishes it's EOF reprocess = True phases = [] while reprocess: phases.append(self.phase) reprocess = self.phase.processEOF() if reprocess: assert self.phase not in phases def parse(self, stream, *args, **kwargs): """Parse a HTML document into a well-formed tree :arg stream: a file-like object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element). :arg scripting: treat noscript elements as if JavaScript was turned on :returns: parsed tree Example: >>> from html5lib.html5parser import HTMLParser >>> parser = HTMLParser() >>> parser.parse('

This is a doc

') """ self._parse(stream, False, None, *args, **kwargs) return self.tree.getDocument() def parseFragment(self, stream, *args, **kwargs): """Parse a HTML fragment into a well-formed tree fragment :arg container: name of the element we're setting the innerHTML property if set to None, default to 'div' :arg stream: a file-like object or string containing the HTML to be parsed The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element) :arg scripting: treat noscript elements as if JavaScript was turned on :returns: parsed tree Example: >>> from html5lib.html5libparser import HTMLParser >>> parser = HTMLParser() >>> parser.parseFragment('this is a fragment') """ self._parse(stream, True, *args, **kwargs) return self.tree.getFragment() def parseError(self, errorcode="XXX-undefined-error", datavars=None): # XXX The idea is to make errorcode mandatory. if datavars is None: datavars = {} self.errors.append((self.tokenizer.stream.position(), errorcode, datavars)) if self.strict: raise ParseError(E[errorcode] % datavars) def adjustMathMLAttributes(self, token): adjust_attributes(token, adjustMathMLAttributes) def adjustSVGAttributes(self, token): adjust_attributes(token, adjustSVGAttributes) def adjustForeignAttributes(self, token): adjust_attributes(token, adjustForeignAttributesMap) def reparseTokenNormal(self, token): # pylint:disable=unused-argument self.parser.phase() def resetInsertionMode(self): # The name of this method is mostly historical. (It's also used in the # specification.) last = False newModes = { "select": "inSelect", "td": "inCell", "th": "inCell", "tr": "inRow", "tbody": "inTableBody", "thead": "inTableBody", "tfoot": "inTableBody", "caption": "inCaption", "colgroup": "inColumnGroup", "table": "inTable", "head": "inBody", "body": "inBody", "frameset": "inFrameset", "html": "beforeHead" } for node in self.tree.openElements[::-1]: nodeName = node.name new_phase = None if node == self.tree.openElements[0]: assert self.innerHTML last = True nodeName = self.innerHTML # Check for conditions that should only happen in the innerHTML # case if nodeName in ("select", "colgroup", "head", "html"): assert self.innerHTML if not last and node.namespace != self.tree.defaultNamespace: continue if nodeName in newModes: new_phase = self.phases[newModes[nodeName]] break elif last: new_phase = self.phases["inBody"] break self.phase = new_phase def parseRCDataRawtext(self, token, contentType): # Generic RCDATA/RAWTEXT Parsing algorithm assert contentType in ("RAWTEXT", "RCDATA") self.tree.insertElement(token) if contentType == "RAWTEXT": self.tokenizer.state = self.tokenizer.rawtextState else: self.tokenizer.state = self.tokenizer.rcdataState self.originalPhase = self.phase self.phase = self.phases["text"] @_utils.memoize def getPhases(debug): def log(function): """Logger that records which phase processes each token""" type_names = {value: key for key, value in tokenTypes.items()} def wrapped(self, *args, **kwargs): if function.__name__.startswith("process") and len(args) > 0: token = args[0] info = {"type": type_names[token['type']]} if token['type'] in tagTokenTypes: info["name"] = token['name'] self.parser.log.append((self.parser.tokenizer.state.__name__, self.parser.phase.__class__.__name__, self.__class__.__name__, function.__name__, info)) return function(self, *args, **kwargs) else: return function(self, *args, **kwargs) return wrapped def getMetaclass(use_metaclass, metaclass_func): if use_metaclass: return method_decorator_metaclass(metaclass_func) else: return type # pylint:disable=unused-argument class Phase(with_metaclass(getMetaclass(debug, log))): """Base class for helper object that implements each phase of processing """ __slots__ = ("parser", "tree", "__startTagCache", "__endTagCache") def __init__(self, parser, tree): self.parser = parser self.tree = tree self.__startTagCache = {} self.__endTagCache = {} def processEOF(self): raise NotImplementedError def processComment(self, token): # For most phases the following is correct. Where it's not it will be # overridden. self.tree.insertComment(token, self.tree.openElements[-1]) def processDoctype(self, token): self.parser.parseError("unexpected-doctype") def processCharacters(self, token): self.tree.insertText(token["data"]) def processSpaceCharacters(self, token): self.tree.insertText(token["data"]) def processStartTag(self, token): # Note the caching is done here rather than BoundMethodDispatcher as doing it there # requires a circular reference to the Phase, and this ends up with a significant # (CPython 2.7, 3.8) GC cost when parsing many short inputs name = token["name"] # In Py2, using `in` is quicker in general than try/except KeyError # In Py3, `in` is quicker when there are few cache hits (typically short inputs) if name in self.__startTagCache: func = self.__startTagCache[name] else: func = self.__startTagCache[name] = self.startTagHandler[name] # bound the cache size in case we get loads of unknown tags while len(self.__startTagCache) > len(self.startTagHandler) * 1.1: # this makes the eviction policy random on Py < 3.7 and FIFO >= 3.7 self.__startTagCache.pop(next(iter(self.__startTagCache))) return func(token) def startTagHtml(self, token): if not self.parser.firstStartTag and token["name"] == "html": self.parser.parseError("non-html-root") # XXX Need a check here to see if the first start tag token emitted is # this token... If it's not, invoke self.parser.parseError(). for attr, value in token["data"].items(): if attr not in self.tree.openElements[0].attributes: self.tree.openElements[0].attributes[attr] = value self.parser.firstStartTag = False def processEndTag(self, token): # Note the caching is done here rather than BoundMethodDispatcher as doing it there # requires a circular reference to the Phase, and this ends up with a significant # (CPython 2.7, 3.8) GC cost when parsing many short inputs name = token["name"] # In Py2, using `in` is quicker in general than try/except KeyError # In Py3, `in` is quicker when there are few cache hits (typically short inputs) if name in self.__endTagCache: func = self.__endTagCache[name] else: func = self.__endTagCache[name] = self.endTagHandler[name] # bound the cache size in case we get loads of unknown tags while len(self.__endTagCache) > len(self.endTagHandler) * 1.1: # this makes the eviction policy random on Py < 3.7 and FIFO >= 3.7 self.__endTagCache.pop(next(iter(self.__endTagCache))) return func(token) class InitialPhase(Phase): __slots__ = tuple() def processSpaceCharacters(self, token): pass def processComment(self, token): self.tree.insertComment(token, self.tree.document) def processDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] correct = token["correct"] if (name != "html" or publicId is not None or systemId is not None and systemId != "about:legacy-compat"): self.parser.parseError("unknown-doctype") if publicId is None: publicId = "" self.tree.insertDoctype(token) if publicId != "": publicId = publicId.translate(asciiUpper2Lower) if (not correct or token["name"] != "html" or publicId.startswith( ("+//silmaril//dtd html pro v0r11 19970101//", "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", "-//as//dtd html 3.0 aswedit + extensions//", "-//ietf//dtd html 2.0 level 1//", "-//ietf//dtd html 2.0 level 2//", "-//ietf//dtd html 2.0 strict level 1//", "-//ietf//dtd html 2.0 strict level 2//", "-//ietf//dtd html 2.0 strict//", "-//ietf//dtd html 2.0//", "-//ietf//dtd html 2.1e//", "-//ietf//dtd html 3.0//", "-//ietf//dtd html 3.2 final//", "-//ietf//dtd html 3.2//", "-//ietf//dtd html 3//", "-//ietf//dtd html level 0//", "-//ietf//dtd html level 1//", "-//ietf//dtd html level 2//", "-//ietf//dtd html level 3//", "-//ietf//dtd html strict level 0//", "-//ietf//dtd html strict level 1//", "-//ietf//dtd html strict level 2//", "-//ietf//dtd html strict level 3//", "-//ietf//dtd html strict//", "-//ietf//dtd html//", "-//metrius//dtd metrius presentational//", "-//microsoft//dtd internet explorer 2.0 html strict//", "-//microsoft//dtd internet explorer 2.0 html//", "-//microsoft//dtd internet explorer 2.0 tables//", "-//microsoft//dtd internet explorer 3.0 html strict//", "-//microsoft//dtd internet explorer 3.0 html//", "-//microsoft//dtd internet explorer 3.0 tables//", "-//netscape comm. corp.//dtd html//", "-//netscape comm. corp.//dtd strict html//", "-//o'reilly and associates//dtd html 2.0//", "-//o'reilly and associates//dtd html extended 1.0//", "-//o'reilly and associates//dtd html extended relaxed 1.0//", "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", "-//spyglass//dtd html 2.0 extended//", "-//sq//dtd html 2.0 hotmetal + extensions//", "-//sun microsystems corp.//dtd hotjava html//", "-//sun microsystems corp.//dtd hotjava strict html//", "-//w3c//dtd html 3 1995-03-24//", "-//w3c//dtd html 3.2 draft//", "-//w3c//dtd html 3.2 final//", "-//w3c//dtd html 3.2//", "-//w3c//dtd html 3.2s draft//", "-//w3c//dtd html 4.0 frameset//", "-//w3c//dtd html 4.0 transitional//", "-//w3c//dtd html experimental 19960712//", "-//w3c//dtd html experimental 970421//", "-//w3c//dtd w3 html//", "-//w3o//dtd w3 html 3.0//", "-//webtechs//dtd mozilla html 2.0//", "-//webtechs//dtd mozilla html//")) or publicId in ("-//w3o//dtd w3 html strict 3.0//en//", "-/w3c/dtd html 4.0 transitional/en", "html") or publicId.startswith( ("-//w3c//dtd html 4.01 frameset//", "-//w3c//dtd html 4.01 transitional//")) and systemId is None or systemId and systemId.lower() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"): self.parser.compatMode = "quirks" elif (publicId.startswith( ("-//w3c//dtd xhtml 1.0 frameset//", "-//w3c//dtd xhtml 1.0 transitional//")) or publicId.startswith( ("-//w3c//dtd html 4.01 frameset//", "-//w3c//dtd html 4.01 transitional//")) and systemId is not None): self.parser.compatMode = "limited quirks" self.parser.phase = self.parser.phases["beforeHtml"] def anythingElse(self): self.parser.compatMode = "quirks" self.parser.phase = self.parser.phases["beforeHtml"] def processCharacters(self, token): self.parser.parseError("expected-doctype-but-got-chars") self.anythingElse() return token def processStartTag(self, token): self.parser.parseError("expected-doctype-but-got-start-tag", {"name": token["name"]}) self.anythingElse() return token def processEndTag(self, token): self.parser.parseError("expected-doctype-but-got-end-tag", {"name": token["name"]}) self.anythingElse() return token def processEOF(self): self.parser.parseError("expected-doctype-but-got-eof") self.anythingElse() return True class BeforeHtmlPhase(Phase): __slots__ = tuple() # helper methods def insertHtmlElement(self): self.tree.insertRoot(impliedTagToken("html", "StartTag")) self.parser.phase = self.parser.phases["beforeHead"] # other def processEOF(self): self.insertHtmlElement() return True def processComment(self, token): self.tree.insertComment(token, self.tree.document) def processSpaceCharacters(self, token): pass def processCharacters(self, token): self.insertHtmlElement() return token def processStartTag(self, token): if token["name"] == "html": self.parser.firstStartTag = True self.insertHtmlElement() return token def processEndTag(self, token): if token["name"] not in ("head", "body", "html", "br"): self.parser.parseError("unexpected-end-tag-before-html", {"name": token["name"]}) else: self.insertHtmlElement() return token class BeforeHeadPhase(Phase): __slots__ = tuple() def processEOF(self): self.startTagHead(impliedTagToken("head", "StartTag")) return True def processSpaceCharacters(self, token): pass def processCharacters(self, token): self.startTagHead(impliedTagToken("head", "StartTag")) return token def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagHead(self, token): self.tree.insertElement(token) self.tree.headPointer = self.tree.openElements[-1] self.parser.phase = self.parser.phases["inHead"] def startTagOther(self, token): self.startTagHead(impliedTagToken("head", "StartTag")) return token def endTagImplyHead(self, token): self.startTagHead(impliedTagToken("head", "StartTag")) return token def endTagOther(self, token): self.parser.parseError("end-tag-after-implied-root", {"name": token["name"]}) startTagHandler = _utils.MethodDispatcher([ ("html", startTagHtml), ("head", startTagHead) ]) startTagHandler.default = startTagOther endTagHandler = _utils.MethodDispatcher([ (("head", "body", "html", "br"), endTagImplyHead) ]) endTagHandler.default = endTagOther class InHeadPhase(Phase): __slots__ = tuple() # the real thing def processEOF(self): self.anythingElse() return True def processCharacters(self, token): self.anythingElse() return token def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagHead(self, token): self.parser.parseError("two-heads-are-not-better-than-one") def startTagBaseLinkCommand(self, token): self.tree.insertElement(token) self.tree.openElements.pop() token["selfClosingAcknowledged"] = True def startTagMeta(self, token): self.tree.insertElement(token) self.tree.openElements.pop() token["selfClosingAcknowledged"] = True attributes = token["data"] if self.parser.tokenizer.stream.charEncoding[1] == "tentative": if "charset" in attributes: self.parser.tokenizer.stream.changeEncoding(attributes["charset"]) elif ("content" in attributes and "http-equiv" in attributes and attributes["http-equiv"].lower() == "content-type"): # Encoding it as UTF-8 here is a hack, as really we should pass # the abstract Unicode string, and just use the # ContentAttrParser on that, but using UTF-8 allows all chars # to be encoded and as a ASCII-superset works. data = _inputstream.EncodingBytes(attributes["content"].encode("utf-8")) parser = _inputstream.ContentAttrParser(data) codec = parser.parse() self.parser.tokenizer.stream.changeEncoding(codec) def startTagTitle(self, token): self.parser.parseRCDataRawtext(token, "RCDATA") def startTagNoFramesStyle(self, token): # Need to decide whether to implement the scripting-disabled case self.parser.parseRCDataRawtext(token, "RAWTEXT") def startTagNoscript(self, token): if self.parser.scripting: self.parser.parseRCDataRawtext(token, "RAWTEXT") else: self.tree.insertElement(token) self.parser.phase = self.parser.phases["inHeadNoscript"] def startTagScript(self, token): self.tree.insertElement(token) self.parser.tokenizer.state = self.parser.tokenizer.scriptDataState self.parser.originalPhase = self.parser.phase self.parser.phase = self.parser.phases["text"] def startTagOther(self, token): self.anythingElse() return token def endTagHead(self, token): node = self.parser.tree.openElements.pop() assert node.name == "head", "Expected head got %s" % node.name self.parser.phase = self.parser.phases["afterHead"] def endTagHtmlBodyBr(self, token): self.anythingElse() return token def endTagOther(self, token): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) def anythingElse(self): self.endTagHead(impliedTagToken("head")) startTagHandler = _utils.MethodDispatcher([ ("html", startTagHtml), ("title", startTagTitle), (("noframes", "style"), startTagNoFramesStyle), ("noscript", startTagNoscript), ("script", startTagScript), (("base", "basefont", "bgsound", "command", "link"), startTagBaseLinkCommand), ("meta", startTagMeta), ("head", startTagHead) ]) startTagHandler.default = startTagOther endTagHandler = _utils.MethodDispatcher([ ("head", endTagHead), (("br", "html", "body"), endTagHtmlBodyBr) ]) endTagHandler.default = endTagOther class InHeadNoscriptPhase(Phase): __slots__ = tuple() def processEOF(self): self.parser.parseError("eof-in-head-noscript") self.anythingElse() return True def processComment(self, token): return self.parser.phases["inHead"].processComment(token) def processCharacters(self, token): self.parser.parseError("char-in-head-noscript") self.anythingElse() return token def processSpaceCharacters(self, token): return self.parser.phases["inHead"].processSpaceCharacters(token) def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagBaseLinkCommand(self, token): return self.parser.phases["inHead"].processStartTag(token) def startTagHeadNoscript(self, token): self.parser.parseError("unexpected-start-tag", {"name": token["name"]}) def startTagOther(self, token): self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]}) self.anythingElse() return token def endTagNoscript(self, token): node = self.parser.tree.openElements.pop() assert node.name == "noscript", "Expected noscript got %s" % node.name self.parser.phase = self.parser.phases["inHead"] def endTagBr(self, token): self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]}) self.anythingElse() return token def endTagOther(self, token): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) def anythingElse(self): # Caller must raise parse error first! self.endTagNoscript(impliedTagToken("noscript")) startTagHandler = _utils.MethodDispatcher([ ("html", startTagHtml), (("basefont", "bgsound", "link", "meta", "noframes", "style"), startTagBaseLinkCommand), (("head", "noscript"), startTagHeadNoscript), ]) startTagHandler.default = startTagOther endTagHandler = _utils.MethodDispatcher([ ("noscript", endTagNoscript), ("br", endTagBr), ]) endTagHandler.default = endTagOther class AfterHeadPhase(Phase): __slots__ = tuple() def processEOF(self): self.anythingElse() return True def processCharacters(self, token): self.anythingElse() return token def startTagHtml(self, token): return self.parser.phases["inBody"].processStartTag(token) def startTagBody(self, token): self.parser.framesetOK = False self.tree.insertElement(token) self.parser.phase = self.parser.phases["inBody"] def startTagFrameset(self, token): self.tree.insertElement(token) self.parser.phase = self.parser.phases["inFrameset"] def startTagFromHead(self, token): self.parser.parseError("unexpected-start-tag-out-of-my-head", {"name": token["name"]}) self.tree.openElements.append(self.tree.headPointer) self.parser.phases["inHead"].processStartTag(token) for node in self.tree.openElements[::-1]: if node.name == "head": self.tree.openElements.remove(node) break def startTagHead(self, token): self.parser.parseError("unexpected-start-tag", {"name": token["name"]}) def startTagOther(self, token): self.anythingElse() return token def endTagHtmlBodyBr(self, token): self.anythingElse() return token def endTagOther(self, token): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) def anythingElse(self): self.tree.insertElement(impliedTagToken("body", "StartTag")) self.parser.phase = self.parser.phases["inBody"] self.parser.framesetOK = True startTagHandler = _utils.MethodDispatcher([ ("html", startTagHtml), ("body", startTagBody), ("frameset", startTagFrameset), (("base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title"), startTagFromHead), ("head", startTagHead) ]) startTagHandler.default = startTagOther endTagHandler = _utils.MethodDispatcher([(("body", "html", "br"), endTagHtmlBodyBr)]) endTagHandler.default = endTagOther class InBodyPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#parsing-main-inbody # the really-really-really-very crazy mode __slots__ = ("processSpaceCharacters",) def __init__(self, *args, **kwargs): super(InBodyPhase, self).__init__(*args, **kwargs) # Set this to the default handler self.processSpaceCharacters = self.processSpaceCharactersNonPre def isMatchingFormattingElement(self, node1, node2): return (node1.name == node2.name and node1.namespace == node2.namespace and node1.attributes == node2.attributes) # helper def addFormattingElement(self, token): self.tree.insertElement(token) element = self.tree.openElements[-1] matchingElements = [] for node in self.tree.activeFormattingElements[::-1]: if node is Marker: break elif self.isMatchingFormattingElement(node, element): matchingElements.append(node) assert len(matchingElements) <= 3 if len(matchingElements) == 3: self.tree.activeFormattingElements.remove(matchingElements[-1]) self.tree.activeFormattingElements.append(element) # the real deal def processEOF(self): allowed_elements = frozenset(("dd", "dt", "li", "p", "tbody", "td", "tfoot", "th", "thead", "tr", "body", "html")) for node in self.tree.openElements[::-1]: if node.name not in allowed_elements: self.parser.parseError("expected-closing-tag-but-got-eof") break # Stop parsing def processSpaceCharactersDropNewline(self, token): # Sometimes (start of
, , and