U ʗRe@s8ddlZddlZddlmZedZGdddZdS)N) ProbingStates%[a-zA-Z]*[-]+[a-zA-Z]*[^a-zA-Z-]?c@sneZdZdZdddZddZeddZd d Zed d Z d dZ e ddZ e ddZ e ddZdS) CharSetProbergffffff?NcCsd|_||_tt|_dSN)_state lang_filterlogging getLogger__name__logger)selfrr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/chardet/charsetprober.py__init__+szCharSetProber.__init__cCs tj|_dSr)r DETECTINGrr r r rreset0szCharSetProber.resetcCsdSrr rr r r charset_name3szCharSetProber.charset_namecCstdSr)NotImplementedError)r byte_strr r rfeed7szCharSetProber.feedcCs|jSr)rrr r rstate:szCharSetProber.statecCsdS)Ngr rr r rget_confidence>szCharSetProber.get_confidencecCstdd|}|S)Ns([-])+ )resub)bufr r rfilter_high_byte_onlyAsz#CharSetProber.filter_high_byte_onlycCsZt}t|}|D]@}||dd|dd}|sJ|dkrJd}||q|S)u7 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. Nr) bytearrayINTERNATIONAL_WORDS_PATTERNfindallextendisalpha)rfilteredwordsword last_charr r rfilter_international_wordsFs    z(CharSetProber.filter_international_wordscCst}d}d}t|d}t|D]R\}}|dkrB|d}d}q$|dkr$||krr|sr|||||dd}q$|s|||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. This filter can be applied to all scripts which contain both English characters and extended ASCII characters, but is currently only used by ``Latin1Prober``. Frc>rs