ó jë±Rc@s£ddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl Z dZ d ZdZd Zd d d „ƒYZdS(i(t constantsiÿÿÿÿN(t Latin1Prober(tMBCSGroupProber(tSBCSGroupProber(tEscCharSetProbergš™™™™™É?iitUniversalDetectorcBs,eZd„Zd„Zd„Zd„ZRS(cCsDtjdƒ|_tjdƒ|_d|_g|_|jƒdS(Ns[€-ÿ]s(|~{)(tretcompilet_highBitDetectort _escDetectortNonet_mEscCharSetProbert_mCharSetProberstreset(tself((s=/usr/lib/python2.7/site-packages/chardet/universaldetector.pyt__init__-s   cCsidd6dd6|_t|_t|_t|_t|_d|_ |j r]|j j ƒnx|j D]}|j ƒqgWdS(Ntencodinggt confidencet( R tresulttFalsetdonetTruet_mStartt _mGotDatat ePureAsciit _mInputStatet _mLastCharR R R (Rtprober((s=/usr/lib/python2.7/site-packages/chardet/universaldetector.pyR 4s      cCs|jr dSt|ƒ}|s#dS|jsd|d tjkrYidd6dd6|_qd|d tjkr†idd6dd6|_qd|d tjkr³idd6dd6|_qd|d d krÝid d6dd6|_qd|d d krid d6dd6|_qd|d tjkr4idd6dd6|_qd|d tj krdidd6dd6|_qdnt |_|jdrš|jddkršt |_dS|j t krþ|j j|ƒrÇt|_ qþ|j t krþ|jj|j|ƒrþt|_ qþn|d|_|j tkr…|js2tƒ|_n|jj|ƒtjkri|jjƒd6|jjƒd6|_t |_qn•|j tkr|js»tƒtƒtƒg|_nx\|jD]N}|j|ƒtjkrÅi|jƒd6|jƒd6|_t |_PqÅqÅWndS(NisUTF-8Rgð?RisUTF-32LEsUTF-32BEsþÿsX-ISO-10646-UCS-4-3412tÿþsX-ISO-10646-UCS-4-2143isUTF-16LEsUTF-16BEgiÿÿÿÿ(RtlenRtcodecstBOMRt BOM_UTF32_LEt BOM_UTF32_BEtBOM_LEtBOM_BERRRRtsearcht eHighbyteR Rt eEscAsciiR RtfeedRteFoundIttget_charset_nametget_confidenceR RRR(RtaBuftaLenR((s=/usr/lib/python2.7/site-packages/chardet/universaldetector.pyR(@sh            cCs€|jr dS|js6tjr2tjjdƒndSt|_|jt krlidd6dd6|_ |j S|jt krd}d}d}xD|j D]9}|s©q—n|jƒ}||kr—|}|}q—q—W|r|tkri|jƒd6|jƒd6|_ |j Sntjr|tjjdƒxM|j djD]8}|sOq=ntjjd |jƒ|jƒfƒq=WndS( Nsno data received! tasciiRgð?Rgs"no probers hit minimum threshhold is%s confidence = %s (RRRt_debugtsyststderrtwriteRRRRR&R R R+tMINIMUM_THRESHOLDR*tmProbers(RtproberConfidencetmaxProberConfidencet maxProberR((s=/usr/lib/python2.7/site-packages/chardet/universaldetector.pytclose†sB           (t__name__t __module__RR R(R8(((s=/usr/lib/python2.7/site-packages/chardet/universaldetector.pyR,s  F((RRR0Rt latin1proberRtmbcsgroupproberRtsbcsgroupproberRt escproberRRR3RR'R&R(((s=/usr/lib/python2.7/site-packages/chardet/universaldetector.pyts